[net.sources.bugs] Rn bug patch #9

jonab@sdcrdcf.UUCP (Jonathan Biggar) (11/17/84)

System: rn version 4.1
Bug #: 9
Priority: LOW
Subject: int vs. long
Index: common.h, last.c, ngdata.c
From: scw@cepu.UUCP (Stephen C. Woods)

Description:
	Some V7 compilers don't seem to know that atol returns a long.
	There are also some atoi calls which should be atol.  The symptoms
	were: always displayed the newsnews message (startup), continually
	reseting .newsrc ('Warning: Someone reset this.that, assuming
	nothing read'), and all newsgroups empty.

Repeat-By:
	Run rn and see if you get these problems.

Fix:	The patch involves adding 1 line to common.h and changing 2 lines
	in last.c, and 1 line in ngdata.c.

Fix:	From rn, say "| patch -d DIR", where DIR is your rn source directory.
	Outside of rn, say "cd DIR; patch <thisarticle".  If you don't have
	the patch program, apply the following by hand, or get patch.

*** common.h.old
--- common.h
*************
*** 664,669

  /* miscellania */

  EXT bool in_ng INIT(FALSE);		/* current state of rn */

  EXT FILE *tmpfp INIT(Nullfp);	/* scratch fp used for .rnlock, .rnlast, etc. */

--- 664,670

  /* miscellania */

+ long atol(), fseek(), ftell();
  EXT bool in_ng INIT(FALSE);		/* current state of rn */

  EXT FILE *tmpfp INIT(Nullfp);	/* scratch fp used for .rnlock, .rnlast, etc. */

Prereq: 4.1
*** last.c.old	Fri Oct 12 15:24:29 1984
--- last.c	Fri Oct 12 15:24:31 1984
***************
*** 1,4
! /* $Header: last.c,v 4.1 84/09/24 11:59:07 lwall Exp $
   *
   * $Log:	last.c,v $
   * Revision 4.1  84/09/24  11:59:07  lwall

--- 1,4 -----
! /* $Header: last.c,v 4.1.1.2 84/10/12 15:23:00 lwall Exp $
   *
   * $Log:	last.c,v $
   * Revision 4.1.1.2  84/10/12  15:23:00  lwall
***************
*** 1,6
  /* $Header: last.c,v 4.1 84/09/24 11:59:07 lwall Exp $
   *
   * $Log:	last.c,v $
   * Revision 4.1  84/09/24  11:59:07  lwall
   * Real baseline.
   * 

--- 1,12 -----
  /* $Header: last.c,v 4.1.1.2 84/10/12 15:23:00 lwall Exp $
   *
   * $Log:	last.c,v $
+  * Revision 4.1.1.2  84/10/12  15:23:00  lwall
+  * s/atoi/atol/ where necessary.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:23:37  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  11:59:07  lwall
   * Real baseline.
   * 
***************
*** 32,38
  	tcbuf[strlen(tcbuf)-1] = '\0';
  	lastngname = savestr(tcbuf);
  	fgets(tcbuf,1024,tmpfp);
! 	lasttime = atoi(tcbuf);
  	fgets(tcbuf,1024,tmpfp);
  	lastactsiz = atoi(tcbuf);
  	fclose(tmpfp);

--- 38,44 -----
  	tcbuf[strlen(tcbuf)-1] = '\0';
  	lastngname = savestr(tcbuf);
  	fgets(tcbuf,1024,tmpfp);
! 	lasttime = atol(tcbuf);
  	fgets(tcbuf,1024,tmpfp);
  	lastactsiz = atol(tcbuf);
  	fclose(tmpfp);
***************
*** 34,40
  	fgets(tcbuf,1024,tmpfp);
  	lasttime = atoi(tcbuf);
  	fgets(tcbuf,1024,tmpfp);
! 	lastactsiz = atoi(tcbuf);
  	fclose(tmpfp);
      }
      else {

--- 40,46 -----
  	fgets(tcbuf,1024,tmpfp);
  	lasttime = atol(tcbuf);
  	fgets(tcbuf,1024,tmpfp);
! 	lastactsiz = atol(tcbuf);
  	fclose(tmpfp);
      }
      else {

Prereq: 4.1
*** ngdata.c.old	Fri Oct 12 15:25:02 1984
--- ngdata.c		Fri Oct 12 15:25:07 1984
***************
*** 1,4
! /* $Header: ngdata.c,v 4.1 84/09/24 12:02:49 lwall Exp $
   *
   * $Log:	ngdata.c,v $
   * Revision 4.1  84/09/24  12:02:49  lwall

--- 1,4 -----
! /* $Header: ngdata.c,v 4.1.1.2 84/10/12 15:23:46 lwall Exp $
   *
   * $Log:	ngdata.c,v $
   * Revision 4.1.1.2  84/10/12  15:23:46  lwall
***************
*** 1,6
  /* $Header: ngdata.c,v 4.1 84/09/24 12:02:49 lwall Exp $
   *
   * $Log:	ngdata.c,v $
   * Revision 4.1  84/09/24  12:02:49  lwall
   * Real baseline.
   * 

--- 1,12 -----
  /* $Header: ngdata.c,v 4.1.1.2 84/10/12 15:23:46 lwall Exp $
   *
   * $Log:	ngdata.c,v $
+  * Revision 4.1.1.2  84/10/12  15:23:46  lwall
+  * s/atoi/atol/ where necessary.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:24:56  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  12:02:49  lwall
   * Real baseline.
   * 
***************
*** 165,171
      if (!dirp)
  	return 0;
      while ((dp = readdir(dirp)) != Null(struct direct *)) {
! 	if ((maybe = atoi(dp->d_name)) < min && maybe > floor) {
  	    for (p = dp->d_name; *p; p++)
  		if (!isdigit(*p))
  		    goto nope;

--- 171,177 -----
      if (!dirp)
  	return 0;
      while ((dp = readdir(dirp)) != Null(struct direct *)) {
! 	if ((maybe = atol(dp->d_name)) < min && maybe > floor) {
  	    for (p = dp->d_name; *p; p++)
  		if (!isdigit(*p))
  		    goto nope;