🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
3 messages
3 total messages Started by Todd D. Taft Fri, 05 Apr 1996 00:00
Re: "Ignoring newsgroup" when starting rtrn
#20290
Author: Todd D. Taft
Date: Fri, 05 Apr 1996 00:00
117 lines
4331 bytes
In article <4js0ht$cv@valhalla.comshare.com>,
Mike Pelletier <mikep@valhalla.comshare.com> wrote:
>When I start rtrn after adding newsgroups to my server's active file,
>it of course starts asking me whether I want to add these newsgroups.
>However, when I press "N", to refuse the entire list (as is advisable
>in these days of overwhelming alt.* chaos), instead of saying "Adding
>alt.i.dont.understand.heirarchies as unsubscribed", it says
>"(Ignoring alt.i.dont.understand.heirarchies)", and the next time it
>starts up, it asks me about that newsgroup again as if its never
>seen it before.
There was a bug in trn, as well as many of its descendant's that caused
this behaviour to occur in leap years.  I don't have a patch for rtrn, but
the one for vanilla trn 3.6 is below.
Please note that I'm copying news.software.readers on this message, and
sending all followups to that group.

----------------------------------------------------------------------------
SIMPLE PATCH THAT WORKS UNTIL 2100

Submitted by Miquel van Smoorenburg <miquels@debian.het.net>, reposted
to trn-test list by jml4@cus.cam.ac.uk (John Line)>

===== the patch (to nntp.c, line numbers are for trn 3.6)

------- nntp.c -------
*** /tmp/da005NK	Thu Jan  1 00:00:00 1970
--- nntp.c	Wed Jan  3 20:43:11 1996
***************
*** 319,326 ****
      for (month--; month; month--)
  	day += maxdays[month];

!     ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
! 	  + mm) * 60 + ss;

      return ss;
  }
--- 319,326 ----
      for (month--; month; month--)
  	day += maxdays[month];

!     ss = ((((year-1970) * 365 + (year-1969)/4 + day - 1) * 24L + hh) * 60
!         + mm) * 60 + ss;

      return ss;
  }

----------------------------------------------------------------------------
FANCY PATCH THAT WORKS UNTIL 2400


From: pdc@lunch.engr.sgi.com (Paul Close)
Subject: Re: trn (3.6 & 4.0-test38) listing "new groups" that aren't new
To: trn-test@trn.com (TRN mailing list)
Date: Fri, 5 Jan 1996 16:43:27 -0800 (PST)

Okay, here's my fix.  This uses a proper leap year calculation, and should
work for a very long time :-)

--- trn-3.6/nntp.c	Fri Nov 18 22:01:23 1994
+++ nntp.c.leap	Fri Jan  5 16:38:33 1996
@@ -285,12 +285,13 @@
 
 /* This is a 1-relative list */
 static int maxdays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
 
 time_t
 nntp_time()
 {
     char *s;
-    int year, month, day, hh, mm;
+    int year, month, day, hh, mm, y;
     time_t ss;
 
     nntp_command("XDATE" + (CompliantServer? 0 : 1));
@@ -306,11 +307,11 @@
     s[4] = '\0';
     year = atoi(s);
 
-    /* This simple algorithm will be valid until the year 2400 */
-    if (year % 4)
-	maxdays[2] = 28;
-    else
+    if (isleap(year))
 	maxdays[2] = 29;
+    else
+	maxdays[2] = 28;
+
     if (month < 1 || month > 12 || day < 1 || day > maxdays[month]
      || hh < 0 || hh > 23 || mm < 0 || mm > 59
      || ss < 0 || ss > 59)
@@ -319,8 +320,12 @@
     for (month--; month; month--)
 	day += maxdays[month];
 
-    ss = ((((year-1970) * 365 + (year-1968)/4 + day - 1) * 24L + hh) * 60
-	  + mm) * 60 + ss;
+    for (y = 1970; y < year; y++)
+	if (isleap(y))
+	    day += 366;
+	else
+	    day += 365;
+    ss += (((day - 1) * 24L + hh) * 60 + mm) * 60;
 
     return ss;
 }


----------------------------------------------------------------------------

-- 
Todd D. Taft                              taft@cs.unc.edu
WWW: http://www.cs.unc.edu/~taft/         todd_taft@unc.edu
U.N.C. Department of Computer Science Facilities Staff

Re: "Ignoring newsgroup" when starting rtrn
#20455
Author: Albert L. Donaldson
Date: Sun, 07 Apr 1996 00:00
28 lines
1862 bytes
In article <4k3pom$3rc@fovea.cs.unc.edu>, Todd D. Taft <taft@cs.unc.edu> wrote:
>Mike Pelletier <mikep@valhalla.comshare.com> wrote:
>>When I start rtrn after adding newsgroups to my server's active file,
>>it of course starts asking me whether I want to add these newsgroups.
>>However, when I press "N", to refuse the entire list ...

>There was a bug in trn, as well as many of its descendant's that caused
>this behaviour to occur in leap years.  I don't have a patch for rtrn, but
>the one for vanilla trn 3.6 is below.

Perhaps I misunderstand Mike's question, but I think there's a simpler answer.
Try running trn or rrn with the -q option, to "bypass the automatic check
for new newsgroups."  The newsreader will simply confine itself to the groups
in your .newsrc file.

I had to do this of necessity with the first rrn I built, because it would
handle something like 1500 newsgroups max, and the server had 15000 groups,
and (as I recall) the reader would dump core if I didn't run it with -q.
Been doing it ever since.

Of course, one disadvantage is that when comp.something.interesting comes 
along next month, you may not learn about it unless you fetch the active file 
from your server.

Al


Re: "Ignoring newsgroup" when starting rtrn
#20541
Author: Mike Castle
Date: Fri, 12 Apr 1996 00:00
19 lines
1522 bytes
In article <4k7uk9$c59@news1.mnsinc.com>,
Albert L. Donaldson <al@escom.com> wrote:
>Perhaps I misunderstand Mike's question, but I think there's a simpler answer.
>Try running trn or rrn with the -q option, to "bypass the automatic check
>for new newsgroups."  The newsreader will simply confine itself to the groups
>in your .newsrc file.

If you have a modern newsserver, when you configure trn, answer
yes to the question about reliable newgroups call.  This will get
you the best of both worlds.  You only correctly see new groups.

mrc
-- 
Mike Castle .-=NEXUS=-.  Life is like a clock:  You can work constantly
  mcastle@cs.umr.edu     and be right all the time, or not work at all
   mcastle@umr.edu       and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads