[net.news.b] rn bugs #7..16

lwall@sdcrdcf.UUCP (Larry Wall) (10/16/84)

#!/bin/sh
: make a subdirectory, cd to it, and run this through sh.
echo 'If this kit is complete, "End of kit" will echo at the end'
echo Extracting index
cat >index <<'!STUFFY!FUNK!'
bug1:	Subject: %i and %R use old Article-I.D. line
bug2:	Subject: rn may get confused about minimum article numbers
bug3:	Subject: rn on System V--circular dependency
bug4:	Subject: 2.10.2 disables checkexpired() optimization.
bug5:	Subject: Xref patch for 2.10.1 inews is wrong.
bug6:	Subject: articles saved to mailbox start with "From: " instead of "From ".
bug7:	Subject: core dump on portable rn
bug8:	Subject: <sys/ioctl> not found on V7
bug9:	Subject: int vs. long
bug10:	Subject: %d vs %ld
bug11:	Subject: R and F may not include article.
bug12:	Subject: missing free() on pdp11's
bug13:	Subject: switch bugs
bug14:	Subject: missing ; if DEBUGGING not defined
bug15:	Subject: (Mail) happens inappropriately.
bug16:	Subject: & substitution in fullname incorrect
!STUFFY!FUNK!
echo Extracting bug7
cat >bug7 <<'!STUFFY!FUNK!'
System:	rn version 4.1
Bug #: 7
Subject: core dump on portable rn
Index: intrp.c
From: mcneal@forace.UUCP (Rick McNeal), north@down.UUCP (Stephen C North)

Description:
	With PHOSTNAME defined Rn will core dump when determining
	the site name.

Repeat-By:
	Rn popens PHOSTNAME and the variable pipefp is then pointing to
	a stream.  Instead of Rn using pipefp in the fgets() call
	it uses a temporary variable(tmpfp) that has yet to be defined.
	The temporary is declared of course in common.h which is why 
	the compiler never complains.

Fix:	Install either intrp.c.7-c (diff -c) by hand or intrp.c.7-e (diff -e)
	using ed.  The -e version must be applied only to revision 4.1.1.2
	intrp.c (with patch #1 installed, including comments).
!STUFFY!FUNK!
echo Extracting intrp.c.7-c
cat >intrp.c.7-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1014724	Fri Oct 12 15:11:58 1984
--- /tmp/,RCSt2014724	Fri Oct 12 15:12:12 1984
***************
*** 1,4
! /* $Header: intrp.c,v 4.1.1.2 84/09/25 14:02:08 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.2  84/09/25  14:02:08  lwall

--- 1,4 -----
! /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall
***************
*** 1,6
  /* $Header: intrp.c,v 4.1.1.2 84/09/25 14:02:08 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.2  84/09/25  14:02:08  lwall
   * %i used ARTID_LINE, should be MESSID_LINE.
   * 

--- 1,9 -----
  /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
+  * Revision 4.1.1.3  84/10/12  14:32:40  lwall
+  * Fixed PHOSTNAME core dump.
+  * 
   * Revision 4.1.1.2  84/09/25  14:02:08  lwall
   * %i used ARTID_LINE, should be MESSID_LINE.
   * 
***************
*** 137,143
  	FILE *popen();
  	FILE *pipefp = popen(PHOSTNAME,"r");
  
! 	fgets(buf,sizeof buf,tmpfp);
  	buf[strlen(buf)-1] = '\0';	/* wipe out newline */
  	hostname = savestr(buf);
  	pclose(pipefp);

--- 140,146 -----
  	FILE *popen();
  	FILE *pipefp = popen(PHOSTNAME,"r");
  
! 	fgets(buf,sizeof buf,pipefp);
  	buf[strlen(buf)-1] = '\0';	/* wipe out newline */
  	hostname = savestr(buf);
  	pclose(pipefp);
!STUFFY!FUNK!
echo Extracting intrp.c.7-e
sed >intrp.c.7-e <<'!STUFFY!FUNK!' -e 's/X//'
X140c
X	fgets(buf,sizeof buf,pipefp);
X.
X3a
X * Revision 4.1.1.3  84/10/12  14:32:40  lwall
X * Fixed PHOSTNAME core dump.
X * 
X.
X1c
X/* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug8
cat >bug8 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 8
Subject: <sys/ioctl> not found on V7
Index: common.h
From: scw@cepu.UUCP (Stephen C. Woods)

Description:
	I [scw] have discovered a minor installation problem with V7 systems.
	Seems that there is no <sys/ioctl.h> on v7.

Repeat-By:
	Compile rn on a V7 system and see if it complains.

Cheap fix:
	Delete the include of <sys/ioctl.h>.

Complete fix:
	Making the following assumptions:

	(1) <sys/ioctl.h> is the set of collected arg2's for all the drivers.
	(2) systems without <sys/ioctl.h> have them in the correct places
	    (like sgtty.h>
	
	I hacked common.h to conditionally include <sys/ioctl.h> if IOCTL
	was defined (which it is not).  Worked like a charm. So appended to
	the message are the diffs from Configure and common.h to avoid the
	problem.

*** Configure.B	Thu Oct  4 11:29:51 1984
--- Configure	Fri Oct  5 07:18:24 1984
***************
*** 745,746
  
  : see if there is a vfork

--- 703,714 -----
  
+ : see if ioctl defs are in sgtty/termio or sys/ioctl
+ if $test -r /usr/include/sys/ioctl.h ; then
+     ioctl=define
+     $echo "sys/ioctl.h found"
+ else
+     ioctl=undef
+     $echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h"
+ if
+ 
+ 
  : see if there is a vfork
***************
*** 1275,1276
  termio="$termio"
  normsig="$normsig"

--- 1243,1245 -----
  termio="$termio"
+ ioctl="$ioctl"
  normsig="$normsig"
***************
*** 1357,1358
  export termio
  export normsig

--- 1326,1328 -----
  export termio
+ export ioctl
  export normsig
***************
*** 1437,1438
  #$termio	TERMIO		/* is this a termio system? */
  #$normsig	NORMSIG		/* use signal rather than sigset? */

--- 1407,1409 -----
  #$termio	TERMIO		/* is this a termio system? */
+ #$ioctl		IOCTL		/* are ioctl args all defined in one place?*/
  #$normsig	NORMSIG		/* use signal rather than sigset? */

*** common.h.B	Thu Oct  4 11:36:40 1984
--- common.h	Thu Oct  4 16:10:07 1984
***************
*** 45,46
  #include <signal.h>
  #include <sys/ioctl.h>

--- 45,49 -----
  #include <signal.h>
+ #ifdef IOCTL
  #include <sys/ioctl.h>
+ #endif IOCTL



!STUFFY!FUNK!
echo Extracting bug9
cat >bug9 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 9
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.  The patch to common.h is below.
	The patches for last.c and ngdata.c are to be found in files
	last.c.9-? and ngdata.c.9-?, where ? is either c for context diffs,
	or e for edit scripts.  The edit scripts must only be applied to
	stock version 4.1 last.c or ngdata.c.

*** common.h.old
--- common.h
*************

  /* miscellania */

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

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

  /* 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. */
!STUFFY!FUNK!
echo Extracting last.c.9-c
cat >last.c.9-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1015176	Fri Oct 12 15:24:29 1984
--- /tmp/,RCSt2015176	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 {
!STUFFY!FUNK!
echo Extracting last.c.9-e
sed >last.c.9-e <<'!STUFFY!FUNK!' -e 's/X//'
X37c
X	lastactsiz = atol(tcbuf);
X.
X35c
X	lasttime = atol(tcbuf);
X.
X3a
X * Revision 4.1.1.2  84/10/12  15:23:00  lwall
X * s/atoi/atol/ where necessary.
X * 
X * Revision 4.1.1.1  84/09/25  13:23:37  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: last.c,v 4.1.1.2 84/10/12 15:23:00 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting ngdata.c.9-c
cat >ngdata.c.9-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1015206	Fri Oct 12 15:25:02 1984
--- /tmp/,RCSt2015206	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;
!STUFFY!FUNK!
echo Extracting ngdata.c.9-e
sed >ngdata.c.9-e <<'!STUFFY!FUNK!' -e 's/X//'
X168c
X	if ((maybe = atol(dp->d_name)) < min && maybe > floor) {
X.
X3a
X * Revision 4.1.1.2  84/10/12  15:23:46  lwall
X * s/atoi/atol/ where necessary.
X * 
X * Revision 4.1.1.1  84/09/25  13:24:56  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: ngdata.c,v 4.1.1.2 84/10/12 15:23:46 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug10
cat >bug10 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 10
Subject: %d vs %ld
Index: ng.c
From: scw@cepu.UUCP (Stephen C. Woods)

Description:
	On sizeof(long)!=sizeof(int) machines the article number gets
	printed as 0 (when you do a '=' command). 

Fix:	Install either ng.c.10-c (diff -c) by hand or ng.c.10-e (diff -e)
	using ed.  The -e version must be applied only to a stock revision
	4.1 ng.c.
!STUFFY!FUNK!
echo Extracting ng.c.10-c
cat >ng.c.10-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1015492	Fri Oct 12 15:35:25 1984
--- /tmp/,RCSt2015492	Fri Oct 12 15:35:33 1984
***************
*** 1,4
! /* $Header: ng.c,v 4.1 84/09/24 12:01:53 lwall Exp $
   *
   * $Log:	ng.c,v $
   * Revision 4.1  84/09/24  12:01:53  lwall

--- 1,4 -----
! /* $Header: ng.c,v 4.1.1.2 84/10/12 15:33:15 lwall Exp $
   *
   * $Log:	ng.c,v $
   * Revision 4.1.1.2  84/10/12  15:33:15  lwall
***************
*** 1,6
  /* $Header: ng.c,v 4.1 84/09/24 12:01:53 lwall Exp $
   *
   * $Log:	ng.c,v $
   * Revision 4.1  84/09/24  12:01:53  lwall
   * Real baseline.
   * 

--- 1,12 -----
  /* $Header: ng.c,v 4.1.1.2 84/10/12 15:33:15 lwall Exp $
   *
   * $Log:	ng.c,v $
+  * Revision 4.1.1.2  84/10/12  15:33:15  lwall
+  * Oops, didn't get all the %d's to %ld's.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:24:24  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  12:01:53  lwall
   * Real baseline.
   * 
***************
*** 743,749
  	      s = fetchsubj(i,FALSE,FALSE)
  #endif
  	      ) ) {
! 		sprintf(tmpbuf,"%5d ", i);
  		safecpy(tmpbuf + 6,
  #ifdef CACHESUBJ
  		subj_list[OFFSET(i)],

--- 749,755 -----
  	      s = fetchsubj(i,FALSE,FALSE)
  #endif
  	      ) ) {
! 		sprintf(tmpbuf,"%5ld ", i);
  		safecpy(tmpbuf + 6,
  #ifdef CACHESUBJ
  		subj_list[OFFSET(i)],
***************
*** 773,779
  	    for (i=1; i<=lastart && !int_count; i++) {
  		if (subj_list[OFFSET(i)])
  		    /*NOSTRICT*/
! 		    printf("%5d %c %s\n",
  			i, (was_read(i)?'y':'n'), subj_list[OFFSET(i)]);
  	    }
  	}

--- 779,785 -----
  	    for (i=1; i<=lastart && !int_count; i++) {
  		if (subj_list[OFFSET(i)])
  		    /*NOSTRICT*/
! 		    printf("%5ld %c %s\n",
  			i, (was_read(i)?'y':'n'), subj_list[OFFSET(i)]);
  	    }
  	}
!STUFFY!FUNK!
echo Extracting ng.c.10-e
sed >ng.c.10-e <<'!STUFFY!FUNK!' -e 's/X//'
X776c
X		    printf("%5ld %c %s\n",
X.
X746c
X		sprintf(tmpbuf,"%5ld ", i);
X.
X3a
X * Revision 4.1.1.2  84/10/12  15:33:15  lwall
X * Oops, didn't get all the %d's to %ld's.
X * 
X * Revision 4.1.1.1  84/09/25  13:24:24  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: ng.c,v 4.1.1.2 84/10/12 15:33:15 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug11
cat >bug11 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 11
Subject: R and F may not include article.
Index: respond.c
From: scw@cepu.UUCP (Stephen C. Woods)

Description:
	On machines where sizeof(int) != sizeof(long), rn won't include the
	old article with the R or F commands.  The problem is that [fl]seek
	requires that it's second argument (offset) be a long, but
	htype[PAST_HEADER].ht_mispos is defined as a short (for pdp-11s).

Repeat-By:
	Use the R or F command, and see if the old article is included into
	the header file generated by rn.

Fix:	Install either respond.c.11-c (diff -c) by hand or respond.c.11-e
	(diff -e) using ed.  The -e version must be applied only to a stock
	revision 4.1 respond.c.



!STUFFY!FUNK!
echo Extracting respond.c.11-c
cat >respond.c.11-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1015892	Fri Oct 12 15:52:52 1984
--- /tmp/,RCSt2015892	Fri Oct 12 15:52:57 1984
***************
*** 1,4
! /* $Header: respond.c,v 4.1 84/09/24 12:06:33 lwall Exp $
   *
   * $Log:	respond.c,v $
   * Revision 4.1  84/09/24  12:06:33  lwall

--- 1,4 -----
! /* $Header: respond.c,v 4.1.1.2 84/10/12 15:52:07 lwall Exp $
   *
   * $Log:	respond.c,v $
   * Revision 4.1.1.2  84/10/12  15:52:07  lwall
***************
*** 1,6
  /* $Header: respond.c,v 4.1 84/09/24 12:06:33 lwall Exp $
   *
   * $Log:	respond.c,v $
   * Revision 4.1  84/09/24  12:06:33  lwall
   * Real baseline.
   * 

--- 1,12 -----
  /* $Header: respond.c,v 4.1.1.2 84/10/12 15:52:07 lwall Exp $
   *
   * $Log:	respond.c,v $
+  * Revision 4.1.1.2  84/10/12  15:52:07  lwall
+  * Made sure fseek()s got (long) as second argument.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:25:56  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  12:06:33  lwall
   * Real baseline.
   * 
***************
*** 331,337
  #ifdef ASYNC_PARSE
  	parse_maybe(art);
  #endif
! 	fseek(artfp,htype[PAST_HEADER].ht_minpos,0);
  	while (fgets(buf,LBUFLEN,artfp) != Nullch) {
  	    fprintf(tmpfp,"%s%s",indstr,buf);
  	}

--- 337,343 -----
  #ifdef ASYNC_PARSE
  	parse_maybe(art);
  #endif
! 	fseek(artfp,(long)htype[PAST_HEADER].ht_minpos,0);
  	while (fgets(buf,LBUFLEN,artfp) != Nullch) {
  	    fprintf(tmpfp,"%s%s",indstr,buf);
  	}
***************
*** 376,382
  #ifdef ASYNC_PARSE
  	parse_maybe(art);
  #endif
! 	fseek(artfp,htype[PAST_HEADER].ht_minpos,0);
  	while (fgets(buf,LBUFLEN,artfp) != Nullch) {
  	    fprintf(tmpfp,"%s%s",indstr,buf);
  	}

--- 382,388 -----
  #ifdef ASYNC_PARSE
  	parse_maybe(art);
  #endif
! 	fseek(artfp,(long)htype[PAST_HEADER].ht_minpos,0);
  	while (fgets(buf,LBUFLEN,artfp) != Nullch) {
  	    fprintf(tmpfp,"%s%s",indstr,buf);
  	}
!STUFFY!FUNK!
echo Extracting respond.c.11-e
sed >respond.c.11-e <<'!STUFFY!FUNK!' -e 's/X//'
X379c
X	fseek(artfp,(long)htype[PAST_HEADER].ht_minpos,0);
X.
X334c
X	fseek(artfp,(long)htype[PAST_HEADER].ht_minpos,0);
X.
X3a
X * Revision 4.1.1.2  84/10/12  15:52:07  lwall
X * Made sure fseek()s got (long) as second argument.
X * 
X * Revision 4.1.1.1  84/09/25  13:25:56  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: respond.c,v 4.1.1.2 84/10/12 15:52:07 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug12
cat >bug12 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 12
Subject: missing free() on pdp11's
Index: head.c
From: pur-ee!Physics:crl  (Charles LaBrec)

Description:
	On a machine without CACHESUBJ defined, too much subject searching
	and listing can run rn out of memory.  In head.c, in fetchsubj(),
	without CACHESUBJ, if copy is false, then after the call to
	safecpy(), you must do a free(s), or you lose mem.

Fix:	Install either head.c.12-c (diff -c) by hand or head.c.12-e (diff -e)
	using ed.  The -e version must be applied only to a stock revision
	4.1 head.c.
!STUFFY!FUNK!
echo Extracting head.c.12-c
cat >head.c.12-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1027059	Fri Oct 12 12:06:12 1984
--- /tmp/,RCSt2027059	Fri Oct 12 12:06:23 1984
***************
*** 1,4
! /* $Header: head.c,v 4.1 84/09/24 11:47:10 lwall Exp $
   *
   * $Log:	head.c,v $
   * Revision 4.1  84/09/24  11:47:10  lwall

--- 1,4 -----
! /* $Header: head.c,v 4.1.1.2 84/10/12 12:03:43 lwall Exp $
   *
   * $Log:	head.c,v $
   * Revision 4.1.1.2  84/10/12  12:03:43  lwall
***************
*** 1,6
  /* $Header: head.c,v 4.1 84/09/24 11:47:10 lwall Exp $
   *
   * $Log:	head.c,v $
   * Revision 4.1  84/09/24  11:47:10  lwall
   * Real baseline.
   * 

--- 1,12 -----
  /* $Header: head.c,v 4.1.1.2 84/10/12 12:03:43 lwall Exp $
   *
   * $Log:	head.c,v $
+  * Revision 4.1.1.2  84/10/12  12:03:43  lwall
+  * Added free(s) to fetchsubj().
+  * 
+  * Revision 4.1.1.1  84/09/25  13:21:49  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  11:47:10  lwall
   * Real baseline.
   * 
***************
*** 209,214
  	return s;
      else {
  	safecpy(cmd_buf,s,CBUFLEN);	/* hope this is okay--we're */
  	return cmd_buf;			/* really scraping for space here */
      }
  #endif

--- 215,221 -----
  	return s;
      else {
  	safecpy(cmd_buf,s,CBUFLEN);	/* hope this is okay--we're */
+ 	free(s);
  	return cmd_buf;			/* really scraping for space here */
      }
  #endif
!STUFFY!FUNK!
echo Extracting head.c.12-e
sed >head.c.12-e <<'!STUFFY!FUNK!' -e 's/X//'
X211a
X	free(s);
X.
X3a
X * Revision 4.1.1.2  84/10/12  12:03:43  lwall
X * Added free(s) to fetchsubj().
X * 
X * Revision 4.1.1.1  84/09/25  13:21:49  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: head.c,v 4.1.1.2 84/10/12 12:03:43 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug13
cat >bug13 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 13
Subject: switch bugs
Index: 
From: pur-ee!Physics:crl  (Charles LaBrec)

Description:
	In sw.c, in pr_switches(), the test to print +-/ should compare
	against %p/%c instead of %d/%c.

	The documentation says -1200 should be performed if the baud rate is
	1200 or less, but the code says 1200 or greater.

Fix:	Install either sw.c.13-c (diff -c) by hand or sw.c.13-e (diff -e)
	using ed.  The -e version must be applied only to a stock revision
	4.1 sw.c.
!STUFFY!FUNK!
echo Extracting sw.c.13-c
cat >sw.c.13-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1013469	Fri Oct 12 15:01:47 1984
--- /tmp/,RCSt2013469	Fri Oct 12 15:01:52 1984
***************
*** 1,4
! /* $Header: sw.c,v 4.1 84/09/24 12:10:21 lwall Exp $
   *
   * $Log:	sw.c,v $
   * Revision 4.1  84/09/24  12:10:21  lwall

--- 1,4 -----
! /* $Header: sw.c,v 4.1.1.2 84/10/12 12:34:44 lwall Exp $
   *
   * $Log:	sw.c,v $
   * Revision 4.1.1.2  84/10/12  12:34:44  lwall
***************
*** 1,6
  /* $Header: sw.c,v 4.1 84/09/24 12:10:21 lwall Exp $
   *
   * $Log:	sw.c,v $
   * Revision 4.1  84/09/24  12:10:21  lwall
   * Real baseline.
   * 

--- 1,13 -----
  /* $Header: sw.c,v 4.1.1.2 84/10/12 12:34:44 lwall Exp $
   *
   * $Log:	sw.c,v $
+  * Revision 4.1.1.2  84/10/12  12:34:44  lwall
+  * Fixed inverted baud-rate dependencies.
+  * Fixed -/ printing.
+  * 
+  * Revision 4.1.1.1  84/09/25  13:26:47  lwall
+  * Branch for sdcrdcf changes.
+  * 
   * Revision 4.1  84/09/24  12:10:21  lwall
   * Real baseline.
   * 
***************
*** 131,138
  #ifdef BAUDMOD
  	case '0': case '1': case '2': case '3': case '4':
  	case '5': case '6': case '7': case '8': case '9':
! 	    if (upordown ? (atoi(s) <= just_a_sec*10)
! 	    		 : (atoi(s) >= just_a_sec*10) ) {
  		while (isdigit(*s)) s++;
  		decode_switch(s);
  	    }

--- 138,145 -----
  #ifdef BAUDMOD
  	case '0': case '1': case '2': case '3': case '4':
  	case '5': case '6': case '7': case '8': case '9':
! 	    if (upordown ? (just_a_sec*10 <= atoi(s))
! 	    		 : (just_a_sec*10 >= atoi(s)) ) {
  		while (isdigit(*s)) s++;
  		decode_switch(s);
  	    }
***************
*** 330,336
      register int i;
      
      fputs("\nCurrent switch settings:\n",stdout);
!     printf("%c/ ", mp[strEQ(getval("SAVEDIR",SAVEDIR),"%d/%c")]);
      printf("%cc ", mp[checkflag]);
      printf("-C%d ", docheckwhen);
      printf("-d%s ", cwd);

--- 337,343 -----
      register int i;
      
      fputs("\nCurrent switch settings:\n",stdout);
!     printf("%c/ ", mp[strEQ(getval("SAVEDIR",SAVEDIR),"%p/%c")]);
      printf("%cc ", mp[checkflag]);
      printf("-C%d ", docheckwhen);
      printf("-d%s ", cwd);
!STUFFY!FUNK!
echo Extracting sw.c.13-e
sed >sw.c.13-e <<'!STUFFY!FUNK!' -e 's/X//'
X333c
X    printf("%c/ ", mp[strEQ(getval("SAVEDIR",SAVEDIR),"%p/%c")]);
X.
X134,135c
X	    if (upordown ? (just_a_sec*10 <= atoi(s))
X	    		 : (just_a_sec*10 >= atoi(s)) ) {
X.
X3a
X * Revision 4.1.1.2  84/10/12  12:34:44  lwall
X * Fixed inverted baud-rate dependencies.
X * Fixed -/ printing.
X * 
X * Revision 4.1.1.1  84/09/25  13:26:47  lwall
X * Branch for sdcrdcf changes.
X * 
X.
X1c
X/* $Header: sw.c,v 4.1.1.2 84/10/12 12:34:44 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug14
cat >bug14 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 14
Subject: missing ; if DEBUGGING not defined
Index: rcln.c
From: gail@calmasd.UUCP (Gail Bayley Hanrahan)

Description:
	If DEBUGGING is undefined, and your compiler doesn't like labels
	without a statement following them, it will complain.

Fix:	Install either rcln.c.14-c (diff -c) by hand or rcln.c.14-e (diff -e)
	using ed.  The -e version must be applied only to a revision 4.1.1.2
	rcln.c (with patch #4 applied).

!STUFFY!FUNK!
echo Extracting rcln.c.14-c
cat >rcln.c.14-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1018202	Fri Oct 12 17:07:24 1984
--- /tmp/,RCSt2018202	Fri Oct 12 17:07:34 1984
***************
*** 1,4
! /* $Header: rcln.c,v 4.1.1.2 84/09/25 17:20:55 lwall Exp $
   *
   * $Log:	rcln.c,v $
   * Revision 4.1.1.2  84/09/25  17:20:55  lwall

--- 1,4 -----
! /* $Header: rcln.c,v 4.1.1.3 84/10/12 17:04:21 lwall Exp $
   *
   * $Log:	rcln.c,v $
   * Revision 4.1.1.3  84/10/12  17:04:21  lwall
***************
*** 1,6
  /* $Header: rcln.c,v 4.1.1.2 84/09/25 17:20:55 lwall Exp $
   *
   * $Log:	rcln.c,v $
   * Revision 4.1.1.2  84/09/25  17:20:55  lwall
   * Getting abs1st from active file before calling checkexpired caused
   * checkexpired to not get called.

--- 1,9 -----
  /* $Header: rcln.c,v 4.1.1.3 84/10/12 17:04:21 lwall Exp $
   *
   * $Log:	rcln.c,v $
+  * Revision 4.1.1.3  84/10/12  17:04:21  lwall
+  * Supplied missing semicolon when DEBUGGING undefined.
+  * 
   * Revision 4.1.1.2  84/09/25  17:20:55  lwall
   * Getting abs1st from active file before calling checkexpired caused
   * checkexpired to not get called.
***************
*** 449,455
  	rcline[ngnum] = mbuf;
      }
  
! ret:
  #ifdef DEBUGGING
      if (debug & DEB_XREF_MARKER) {
  	printf("%s%c%s\n",rcline[ngnum],rcchar[ngnum],

--- 452,458 -----
  	rcline[ngnum] = mbuf;
      }
  
! ret:;		/* semicolon in case DEBUGGING undefined */
  #ifdef DEBUGGING
      if (debug & DEB_XREF_MARKER) {
  	printf("%s%c%s\n",rcline[ngnum],rcchar[ngnum],
!STUFFY!FUNK!
echo Extracting rcln.c.14-e
sed >rcln.c.14-e <<'!STUFFY!FUNK!' -e 's/X//'
X452c
Xret:;		/* semicolon in case DEBUGGING undefined */
X.
X3a
X * Revision 4.1.1.3  84/10/12  17:04:21  lwall
X * Supplied missing semicolon when DEBUGGING undefined.
X * 
X.
X1c
X/* $Header: rcln.c,v 4.1.1.3 84/10/12 17:04:21 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug15
cat >bug15 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 15
Subject: (Mail) happens inappropriately.
Index: ng.c
From: mp@allegra.UUCP

Description:
	Since (at least here) people frequently keep messages in their
	mailboxes for weeks at a time, the (Mail) prompt is a bit
	misleading.  I changed it so that the prompt appears only if the
	mailbox contains unread mail.

Fix:	Install either ng.c.15-c (diff -c) by hand or ng.c.15-e (diff -e)
	using ed.  The -e version must be applied only to a revision 4.1.1.2
	ng.c (with patch #10 applied).


!STUFFY!FUNK!
echo Extracting ng.c.15-c
cat >ng.c.15-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1018433	Fri Oct 12 17:18:32 1984
--- /tmp/,RCSt2018433	Fri Oct 12 17:18:57 1984
***************
*** 1,4
! /* $Header: ng.c,v 4.1.1.2 84/10/12 15:33:15 lwall Exp $
   *
   * $Log:	ng.c,v $
   * Revision 4.1.1.2  84/10/12  15:33:15  lwall

--- 1,4 -----
! /* $Header: ng.c,v 4.1.1.3 84/10/12 17:16:41 lwall Exp $
   *
   * $Log:	ng.c,v $
   * Revision 4.1.1.3  84/10/12  17:16:41  lwall
***************
*** 1,6
  /* $Header: ng.c,v 4.1.1.2 84/10/12 15:33:15 lwall Exp $
   *
   * $Log:	ng.c,v $
   * Revision 4.1.1.2  84/10/12  15:33:15  lwall
   * Oops, didn't get all the %d's to %ld's.
   * 

--- 1,9 -----
  /* $Header: ng.c,v 4.1.1.3 84/10/12 17:16:41 lwall Exp $
   *
   * $Log:	ng.c,v $
+  * Revision 4.1.1.3  84/10/12  17:16:41  lwall
+  * Hid old mail in mailbox.
+  * 
   * Revision 4.1.1.2  84/10/12  15:33:15  lwall
   * Oops, didn't get all the %d's to %ld's.
   * 
***************
*** 890,896
      if (! (mailcount++)) {
  	char *mailfile = filexp(getval("MAILFILE",MAILFILE));
  	
! 	if (stat(mailfile,&filestat) < 0 || !filestat.st_size)
  	    mailcall = nullstr;
  	else
  	    mailcall = "(Mail) ";

--- 893,900 -----
      if (! (mailcount++)) {
  	char *mailfile = filexp(getval("MAILFILE",MAILFILE));
  	
! 	if (stat(mailfile,&filestat) < 0 || !filestat.st_size
! 	    || filestat.st_atime > filestat.st_mtime)
  	    mailcall = nullstr;
  	else
  	    mailcall = "(Mail) ";
!STUFFY!FUNK!
echo Extracting ng.c.15-e
sed >ng.c.15-e <<'!STUFFY!FUNK!' -e 's/X//'
X893c
X	if (stat(mailfile,&filestat) < 0 || !filestat.st_size
X	    || filestat.st_atime > filestat.st_mtime)
X.
X3a
X * Revision 4.1.1.3  84/10/12  17:16:41  lwall
X * Hid old mail in mailbox.
X * 
X.
X1c
X/* $Header: ng.c,v 4.1.1.3 84/10/12 17:16:41 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting bug16
cat >bug16 <<'!STUFFY!FUNK!'
System: rn version 4.1
Bug #: 16
Subject: & substitution in fullname incorrect
Index: Pnews.SH, intrp.c
From: mcvax!guido (Guido van Rossum)

Description:
	Neither Pnews nor rn does the & substitution (inserting login name
	into full name) correctly.  This should be of concern only to
	bsd sites.

Repeat-By:
	Have a passwd GCOS entry that uses & substitution.  Get into rn and
	type /<esc>N.  You should end up with your correct name.  If not,
	you have the intrp.c bug.  Run Pnews.  If it produces a header with
	an incorrect full name, you have the Pnews bug.

Fix:
	intrp.c:

	Install either intrp.c.16-c (diff -c) by hand or intrp.c.16-e
	(diff -e) using ed.  The -e version must be applied only to a
	revision 4.1.1.3 intrp.c (with patches 1 and 7).
	
	Pnews.SH:

	Install either Pnews.SH.16-c (diff -c) by hand or Pnews.SH.16-e
	(diff -e) using ed.  The -e version must be applied only to a stock
	revision 4.1 Pnews.SH.  Then rerun Pnews.SH and install the new Pnews.


!STUFFY!FUNK!
echo Extracting Pnews.SH.16-c
cat >Pnews.SH.16-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1005267	Mon Oct 15 17:34:56 1984
--- /tmp/,RCSt2005267	Mon Oct 15 17:35:18 1984
***************
*** 4,10
  echo "Extracting Pnews (with variable substitutions)"
  $spitshell >Pnews <<!GROK!THIS!
  $startsh
! # $Header: Pnews.SH,v 4.1 84/09/24 11:37:46 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1  84/09/24  11:37:46  lwall

--- 4,10 -----
  echo "Extracting Pnews (with variable substitutions)"
  $spitshell >Pnews <<!GROK!THIS!
  $startsh
! # $Header: Pnews.SH,v 4.1.1.2 84/10/15 17:28:28 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1.1.2  84/10/15  17:28:28  lwall
***************
*** 7,12
  # $Header: Pnews.SH,v 4.1 84/09/24 11:37:46 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1  84/09/24  11:37:46  lwall
  # Real baseline.
  # 

--- 7,18 -----
  # $Header: Pnews.SH,v 4.1.1.2 84/10/15 17:28:28 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
+ # Revision 4.1.1.2  84/10/15  17:28:28  lwall
+ # Fixed & fullname substitution for bsd names.
+ # 
+ # Revision 4.1.1.1  84/09/25  13:19:11  lwall
+ # Branch for sdcrdcf changes.
+ # 
  # Revision 4.1  84/09/24  11:37:46  lwall
  # Real baseline.
  # 
***************
*** 235,241
      bsd)
  	fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  	case $fullname in
! 	'*&*') : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
  	    lname=`$echo lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
  	    fullname=`$echo $fullname | $sed 's/&/${lname}/'`

--- 241,247 -----
      bsd)
  	fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  	case $fullname in
! 	*'&'*) : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
  	    lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
  	    fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
***************
*** 237,244
  	case $fullname in
  	'*&*') : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
! 	    lname=`$echo lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
! 	    fullname=`$echo $fullname | $sed 's/&/${lname}/'`
  	    ;;
  	esac
  	;;

--- 243,250 -----
  	case $fullname in
  	*'&'*) : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
! 	    lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
! 	    fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
  	    ;;
  	esac
  	;;
!STUFFY!FUNK!
echo Extracting Pnews.SH.16-e
sed >Pnews.SH.16-e <<'!STUFFY!FUNK!' -e 's/X//'
X240,241c
X	    lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
X	    fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
X.
X238c
X	*'&'*) : GACK
X.
X9a
X# Revision 4.1.1.2  84/10/15  17:28:28  lwall
X# Fixed & fullname substitution for bsd names.
X# 
X# Revision 4.1.1.1  84/09/25  13:19:11  lwall
X# Branch for sdcrdcf changes.
X# 
X.
X7c
X# $Header: Pnews.SH,v 4.1.1.2 84/10/15 17:28:28 lwall Exp $
X.
!STUFFY!FUNK!
echo Extracting intrp.c.16-c
cat >intrp.c.16-c <<'!STUFFY!FUNK!'
*** /tmp/,RCSt1005185	Mon Oct 15 17:31:31 1984
--- /tmp/,RCSt2005185	Mon Oct 15 17:31:53 1984
***************
*** 1,4
! /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall

--- 1,4 -----
! /* $Header: intrp.c,v 4.1.1.4 84/10/15 17:25:44 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.4  84/10/15  17:25:44  lwall
***************
*** 1,6
  /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall
   * Fixed PHOSTNAME core dump.
   * 

--- 1,9 -----
  /* $Header: intrp.c,v 4.1.1.4 84/10/15 17:25:44 lwall Exp $
   *
   * $Log:	intrp.c,v $
+  * Revision 4.1.1.4  84/10/15  17:25:44  lwall
+  * Reordered init sequence so & fullname substitution works.
+  * 
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall
   * Fixed PHOSTNAME core dump.
   * 
***************
*** 106,116
  
      dotdir = getval("DOTDIR",homedir);
  
-     /* get the real name of the person (%N) */
- 
-     strcpy(tcbuf,getrealname(getuid()));
-     realname = savestr(tcbuf);
- 
      /* get login name */
  
      logname = getenv("USER");

--- 109,114 -----
  
      dotdir = getval("DOTDIR",homedir);
  
      /* get login name */
  
      logname = getenv("USER");
***************
*** 120,125
      if (logname == Nullch)
  	logname = savestr(getlogin());
  #endif
  
      /* name of header file (%h) */
  

--- 118,129 -----
      if (logname == Nullch)
  	logname = savestr(getlogin());
  #endif
+ 
+     /* get the real name of the person (%N) */
+     /* Must be done after logname is read in because BERKNAMES uses that */
+ 
+     strcpy(tcbuf,getrealname(getuid()));
+     realname = savestr(tcbuf);
  
      /* name of header file (%h) */
  
!STUFFY!FUNK!
echo Extracting intrp.c.16-e
sed >intrp.c.16-e <<'!STUFFY!FUNK!' -e 's/X//'
X122a
X
X    /* get the real name of the person (%N) */
X    /* Must be done after logname is read in because BERKNAMES uses that */
X
X    strcpy(tcbuf,getrealname(getuid()));
X    realname = savestr(tcbuf);
X.
X109,113d
X3a
X * Revision 4.1.1.4  84/10/15  17:25:44  lwall
X * Reordered init sequence so & fullname substitution works.
X * 
X.
X1c
X/* $Header: intrp.c,v 4.1.1.4 84/10/15 17:25:44 lwall Exp $
X.
!STUFFY!FUNK!
echo ""
echo "End of kit"
: I do not append .signature, but someone might mail this.
exit