🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
3 messages
3 total messages Started by Hank Pike Wed, 12 Jun 1996 00:00
building trn
#22687
Author: Hank Pike
Date: Wed, 12 Jun 1996 00:00
14 lines
1031 bytes
Has anyone had any problems with trn, specifically where it prompts you
with new news groups and you answer 'N' and it does not append those
groups to the .newsrc file and the next time you run trn you get the
same questions.  Any comments would be appreciated.

hp

-------------------
Hank Pike --	CAS Unix Systems Group
office: 200 SMC - A3		phone:	(423) 974-1599
email:	hank@utk.edu 		url:	http://funnelweb.utcc.utk.edu/~hank

Re: building trn
#22756
Author: Robert Boutwell
Date: Thu, 13 Jun 1996 00:00
140 lines
4966 bytes
In article <31BF2CBA.41C6@utkux.utcc.utk.edu>,
Hank Pike  <hank@utkux.utcc.utk.edu> wrote:
>Has anyone had any problems with trn, specifically where it prompts you
>with new news groups and you answer 'N' and it does not append those
>groups to the .newsrc file and the next time you run trn you get the
>same questions.  Any comments would be appreciated.

*******************************************************************

Here is the explanation and the patch that I mentioned in my previous
message.  They are from the "trn FAQ".

This FAQ is maintained by Peter J. Kappesser <pjkappes@mailbox.syr.edu> 
and is archived at
<URL:ftp://rtfm.mit.edu/pub/usenet/news.software.readers/>. 



Subject: BLYC: Patches for "leap year bug"
Contributors: Duncan Gibson <duncan@yc.estec.esa.nl>, 
	Erez Zadok <ezk@news.cs.columbia.edu>, John Line <jml4@cus.cam.ac.uk>,
	Peter Kappesser <pjkappes@mailbox.syr.edu>,
	Anne Bennett <anne@alcor.concordia.ca>

Since January 1, 1996 on some systems, every time users run trn, they may
be asked whether they want to subscribe to new newsgroups which they have
previously declined by answering 'n' or 'N'. The reason is that, as of the
first second of 1996, trn miscomputed the number of leap years, and was
therefore off by one whole day, reporting that the date of the news server
was exactly 24 hours into the future, thus thinking that these "new" 
newsgroups could not have been seen at all. 

Either of two patches will fix the problem. The "simple patch" works until
the year 2100, and is preferred by Wayne Davison (since it uses a simple
division, instead of a loop, and he doesn't expect people to still be
using trn at that time anyway). The "fancy patch" is accurate until the
year 2400. 

Although the line numbers are for trn 3.6, the code will work in
strn-0.9.2 at the appropriate place. 


SIMPLE PATCH THAT WORKS UNTIL 2100

Submitted by Miquel van Smoorenburg <miquels@debian.het.net>

---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
------- 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;
  }
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---


FANCY PATCH THAT WORKS UNTIL 2400

Submitted by Paul Close <pdc@lunch.engr.sgi.com>

---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
--- 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;
 }
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---

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

*********************************************************************
-- 
--
Bob Boutwell          Jamaica Plain, MA          boutwell@shore.net

Re: building trn
#22773
Author: Robert Boutwell
Date: Thu, 13 Jun 1996 00:00
26 lines
1831 bytes
In article <31BF2CBA.41C6@utkux.utcc.utk.edu>,
Hank Pike  <hank@utkux.utcc.utk.edu> wrote:
>Has anyone had any problems with trn, specifically where it prompts you
>with new news groups and you answer 'N' and it does not append those
>groups to the .newsrc file and the next time you run trn you get the
>same questions.  Any comments would be appreciated.

Yes, this has been a continual problem with the implementation of strn on
my current ISP, North Shore Access (shore.net) in Lynn, MA.  There was a
post on this group in April, I believe (or perhaps it was a section of the
trn FAQ or trn intro) which said that trn (on which strn is based) had a
problem calculating dates starting in 1996, I think due to the leap year.
The post included a patch to be inserted into the strn code, which should
have corrected the problem after recompiling.  However, shore.net is still
having this problem.  I get asked if I want to subscribe to about 50
groups (microsoft.blah.blah; linux.blah.blah) every time I start strn on
shore.net.

The *one* good thing I can say about netcom, where I also have an account,
is that it has a good implementation of strn.
-- 
--
Bob Boutwell          Jamaica Plain, MA          boutwell@shore.net

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