[net.news.b] Bug in 's' command in readnews

solomon@crystal.ARPA (12/26/83)

Please excuse me if this has been posted before.  I haven't been keeping up
with this group.

The 's' command (save the article in a file) was creating a From line
at the beginning of the file with a garbage date.  Investigating further,
I discovered that if the option '#define V7MAIL' is defined (as it is by
default), a v7-mail-style from line is created with a date generated
by ctime(&hh.subtime).  Unfortunately, the hh.subtime is unitialized.
Taking a cue from the Mail() function in rfuncs.c, I initialized from the
hh.subdate field using cgtdate.  My fix makes the problem go away, but
it's just a kludge.  Perhaps that field should be initialized when the
header is parsed.  Perhaps it should go away altogether and be replaced
with something else, since it is nowhere used except in save() and Mail().
There are just too many assorted date fields (both string and binary)
in a header structure for me to keep straight what they all signify.

This fix applies to the version of 2.10 B news distributed with Berkeley 4.2
(News version: B 2.10.1 6/24/83; sccsid = "@(#)rfuncs2.c	1.9	4/25/83"),
but I don't think this code has changed for a long time, so it might be
present in other versions.

*** orig/rfuncs2.c	Fri Oct 28 19:27:58 1983
--- ./rfuncs2.c	Mon Dec 26 08:29:08 1983
***************
*** 115,120
  	 * on the end of articles) substitute it here.
  	 */
  #ifdef V7MAIL
  	fprintf(ufp, "From %s %s",
  #ifdef INTERNET
  				hh.from,

--- 115,121 -----
  	 * on the end of articles) substitute it here.
  	 */
  #ifdef V7MAIL
+ 	hh.subtime = cgtdate(hh.subdate); /* solomon@uwvax, 12/26/83 */
  	fprintf(ufp, "From %s %s",
  #ifdef INTERNET
  				hh.from,
-- 
	Marvin Solomon
	Computer Sciences Department
	University of Wisconsin, Madison WI
	solomon@uwisc
	...{ihnp4,seismo,ucbvax}!uwvax!solomon