[news.software.b] Mods to inews.c for C news expire

rees@apollo.uucp (Jim Rees) (11/12/87)

For those of you who would like to play with C news, but don't want to
spend a lot of time at it, the easiest and most useful change you can
make (in my opinion) is to switch to C expire.  The rattiness of B
expire is what inspired C news originally.  C expire is much faster
and gives you the kind of flexibility you need to manage news expiration
these days.

The only change I made to C expire was to add setlinebuf(stderr) near
the beginning.  In debug mode it generates lots of output on stderr.

For best results, if you want to run C expire and B everything else,
you need to at least fix inews to generate the history file in C news
format.  This mod is switched on #ifdef CHIST, which I define in defs.h.
It also includes the mod to put the date in arpa format, which is
harmless.

*** /news/2.11/src/inews.c	Fri Nov  6 16:33:48 1987
--- inews.c	Thu Nov 12 10:24:13 1987
***************
*** 848,853
  	int is_invalid = FALSE;
  	int exitcode = 0;
  	long now;
  #ifdef DOXREFS
  	register char *nextref = header.xref;
  #endif /* DOXREFS */

--- 881,887 -----
  	int is_invalid = FALSE;
  	int exitcode = 0;
  	long now;
+ 	char expbuf[24];
  #ifdef DOXREFS
  	register char *nextref = header.xref;
  #endif /* DOXREFS */
***************
*** 857,863
  		is_invalid = ngfcheck(mode == PROC);
  
  	(void) time(&now);
! 	tm = gmtime(&now);
  	if (header.expdate[0])
  		addhist(" ");
  #ifdef USG

--- 891,900 -----
  		is_invalid = ngfcheck(mode == PROC);
  
  	(void) time(&now);
! #ifdef CHIST
! 	sprintf(expbuf, "%ld~%s\t", now, (header.expdate[0] ? header.expdate : "-"));
! 	addhist(expbuf);
! #else
  	if (header.expdate[0])
  		addhist(" ");
  	addhist(arpadate(&now));
***************
*** 860,872
  	tm = gmtime(&now);
  	if (header.expdate[0])
  		addhist(" ");
! #ifdef USG
! 	sprintf(bfr,"%2.2d/%2.2d/%d %2.2d:%2.2d\t",
! #else /* !USG */
! 	sprintf(bfr,"%02d/%02d/%d %02d:%02d\t",
! #endif /* !USG */
! 		tm->tm_mon+1, tm->tm_mday, tm->tm_year,tm->tm_hour, tm->tm_min);
! 	addhist(bfr);
  	log("%s %s ng %s subj '%s' from %s", spool_news != DONT_SPOOL
  		? "queued" : (mode==PROC ? "received" : "posted"),
  		header.ident, header.nbuf, header.title, header.from);

--- 897,905 -----
  #else
  	if (header.expdate[0])
  		addhist(" ");
! 	addhist(arpadate(&now));
! 	addhist("\t");
! #endif
  	log("%s %s ng %s subj '%s' from %s", spool_news != DONT_SPOOL
  		? "queued" : (mode==PROC ? "received" : "posted"),
  		header.ident, header.nbuf, header.title, header.from);