C News patch of 16-Jan-1990

Henry Spencer henry at utzoo.uucp
Wed Jan 17 10:00:37 AEST 1990


This is the first of two coordinated patches; the second is set to appear
tomorrow.  The big change, set up in the first and implemented in the
second, is that build has been revamped to use your previous answers as
the defaults for the next run.  (Thanks to the magic :-( of context diffs,
and the large number of lines affected, the changes to build itself are
essentially the entire second patch.)

Other work is mostly further cleanout of the to-do list.  Porting problems
with MAXLONG have been largely -- we hope -- eliminated by generating the
value in a more sophisticated way at run time.  A new batch transmitter,
viauuxl, for multicast transmission (requires uux -l).  Batchsplit modified
to reduce the time spent with the news system locked.  Subst has been
fixed so it does not replace the target file if the new version is identical
to the old, and the main Makefile has been touched up to avoid doing a
subst run unnecessarily.  Versions of queuelen for old and prehistoric
versions of uucp.  An "addfeed" command for one common sysadmin chore.
Further expansion of notebook/problems to cover more porting troubles.
And the newsaux(8) manual page has been split, with the maintenance stuff
moving to newsmaint(8).

start of patch 16-Jan-1990
(suggested archive name: `pch16Jan90.Z')
this should be run with   patch -p0 <thisfile

Please do the following (there is no easy way we can convince
patch to do this automatically):
rm relay/cpu.h

The following is a complete list of patches to date.

Prereq: 23-Jun-1989
Prereq: 7-Jul-1989
Prereq: 23-Jul-1989
Prereq: 22-Aug-1989
Prereq: 24-Aug-1989
Prereq: 14-Sep-1989
Prereq: 13-Nov-1989
Prereq: 10-Jan-1990
*** PATCHDATES.old	Tue Jan 16 16:54:51 1990
--- PATCHDATES	Tue Jan 16 16:54:51 1990
***************
*** 1,8 ****
--- 1,9 ----
  23-Jun-1989
  7-Jul-1989
  23-Jul-1989
  22-Aug-1989
  24-Aug-1989
  14-Sep-1989
  13-Nov-1989
  10-Jan-1990
+ 16-Jan-1990

Changed files, if any:

*** cnpatch/old/batch/Makefile	Wed Jan 10 19:10:14 1990
--- batch/Makefile	Sun Jan 14 02:52:40 1990
***************
*** 17,24 ****
  PGMS=batcher batchih batchsm batchsplit comp compcun nocomp viainews viauux \
  	sendbatches compc7 c7encode viamail viapmail bencode compb viauuxz \
! 	viaemail viarsh
! DTR=Makefile batcher.c batchih batchsplit c7encode.c comp compc7 compcun \
! 	newsbatch.8 nocomp sendbatches viainews viauux viamail \
! 	bencode.c coder.h crctab.c compb viapmail viarsh
  ALL = $(PGMS) batchparms
  
--- 17,21 ----
  PGMS=batcher batchih batchsm batchsplit comp compcun nocomp viainews viauux \
  	sendbatches compc7 c7encode viamail viapmail bencode compb viauuxz \
! 	viaemail viarsh viauuxl
  ALL = $(PGMS) batchparms
  
***************
*** 114,118 ****
  	echo g 1 >test.good ; cmp test.good togo.7
  	echo h 3 >test.good ; echo i 20 >>test.good ; cmp test.good togo.next
! 	echo j 999 >test.good ; cmp test.good togo
  	rm togo.*
  	echo `pwd`/test.1 >togo
--- 111,116 ----
  	echo g 1 >test.good ; cmp test.good togo.7
  	echo h 3 >test.good ; echo i 20 >>test.good ; cmp test.good togo.next
! 	echo j 999 >test.good ; cmp test.good togo.more
! 	test ! -s togo ;
  	rm togo.*
  	echo `pwd`/test.1 >togo
***************
*** 170,176 ****
  	cmp test.good test.log
  	rm -rf test.* togo out.going bin batchparms batchlog batchlog.*
- 
- dtr:	$(DTR)
- 	makedtr $(DTR) >$@
  
  clean:
--- 168,171 ----

*** cnpatch/old/batch/batchsplit	Fri Jul  7 15:40:02 1989
--- batch/batchsplit	Sun Jan 14 02:50:04 1990
***************
*** 2,20 ****
  # Prepare some batches of size $1 in files named togo.[0-9] .  We prepare a
  # total of 7 to stay within awk's limits on file descriptors (we need a
! # couple of other descriptors).  Source is file togo.next if it exists, or
! # togo if not.  If there is no togo.next and there is more in togo than will
! # fit in the numbered batches, put the next few lots in togo.next.  This
! # avoids the need to paw through the whole togo file every time when a large
! # backlog has built up.
  #
  # Buglet:  does not count the "#! rnews nnnnn" headers in sizes.
  #
! # If the togo file does not contain file sizes, we make an arbitrary guess
  # at an average size.
  
! case $#
! in
! 	0)
! 	echo 'Usage: batchsplit size' >&2
  	exit 2
  	;;
--- 2,22 ----
  # Prepare some batches of size $1 in files named togo.[0-9] .  We prepare a
  # total of 7 to stay within awk's limits on file descriptors (we need a
! # couple of other descriptors).  We ultimately work from togo, but if it's
! # the only thing we've got to work on, we immediately shuffle it aside into
! # togo.more so that we can unlock the news system.  If we've got an existing
! # non-empty togo.more, we use that.  As a further optimization, if there
! # is more than will fit in the numbered batches, we put the next few
! # lots in togo.next, and use that thereafter until it's empty.  This
! # avoids the need to paw through the whole huge list every time when
! # a large backlog has built up.  We also punt to sed to trim the big
! # list when we do process it, avoiding the need to run it all through awk.
  #
  # Buglet:  does not count the "#! rnews nnnnn" headers in sizes.
  #
! # If the togo files do not contain file sizes, we make an arbitrary guess
  # at an average size.
  
! case $# in
! 0)	echo 'Usage: batchsplit size' >&2
  	exit 2
  	;;
***************
*** 42,53 ****
  done
  
! rm -f togo.overflow togo.count
  if test -s togo.next
  then
  	input=togo.next
  else
! 	input=togo
  fi
  
  awk 'BEGIN { total = 0 ; ninbatch = 0 ; bno = 1 ; limit = '$1'
  		batch = "togo." bno ; nbatches = 7 }
--- 44,65 ----
  done
  
! # pick an input file, shuffling togo aside if needed, and unlock
  if test -s togo.next
  then
  	input=togo.next
+ elif test -s togo.more
+ then
+ 	input=togo.more
  else
! 	rm -f togo.more
! 	mv togo togo.more
! 	>togo
! 	input=togo.more
  fi
+ trap 0 1 2 15
+ rm -f $ltemp $lock
  
+ # main processing
+ rm -f togo.overflow togo.count
  awk 'BEGIN { total = 0 ; ninbatch = 0 ; bno = 1 ; limit = '$1'
  		batch = "togo." bno ; nbatches = 7 }
***************
*** 63,67 ****
  				batch = "togo." bno
  				ninbatch = 0
! 			} else if (bno == nbatches+1 && FILENAME == "togo") {
  				batch = "togo.next"
  				limit = 4 * nbatches * limit
--- 75,79 ----
  				batch = "togo." bno
  				ninbatch = 0
! 			} else if (bno == nbatches+1 && FILENAME == "togo.more") {
  				batch = "togo.next"
  				limit = 4 * nbatches * limit
***************
*** 77,80 ****
--- 89,93 ----
  	}' $input
  
+ # handle the overflow case efficiently
  if test -s togo.count
  then
***************
*** 81,90 ****
  	sed "1,`cat togo.count`d" $input >togo.overflow
  	rm togo.count
- fi
- 
- if test -r togo.overflow
- then
  	mv togo.overflow $input
  else
! 	>$input
  fi
--- 94,99 ----
  	sed "1,`cat togo.count`d" $input >togo.overflow
  	rm togo.count
  	mv togo.overflow $input
  else
! 	rm $input
  fi

*** cnpatch/old/batch/sendbatches	Mon Nov 13 17:39:43 1989
--- batch/sendbatches	Sun Jan 14 02:57:10 1990
***************
*** 133,137 ****
  		then
  			# No -- need some more batches.
! 			if test ! -s togo && test ! -s togo.next
  			then
  				break		# Nothing left to do.
--- 133,138 ----
  		then
  			# No -- need some more batches.
! 			if test ! -s togo && test ! -s togo.more &&
! 							test ! -s togo.more
  			then
  				break		# Nothing left to do.

*** cnpatch/old/conf/Makefile	Wed Jan 10 19:10:16 1990
--- conf/Makefile	Sun Jan 14 01:43:15 1990
***************
*** 46,49 ****
--- 46,50 ----
  	rm -f junk
  	./subst -f substitutions `sed 's;^;../;' subst.hs subst.gc`
+ 	touch $@
  
  spacefor.bsd:	spacefor.proto Makefile
***************
*** 75,78 ****
--- 76,85 ----
  	: okay
  
+ queuelen.old:
+ 	: okay
+ 
+ queuelen.pre:	queuelen.old
+ 	sed '/grade=d/s//grade=./' queuelen.old >$@
+ 
  queuelen.null:
  	echo '#! /bin/sh' >$@
***************
*** 88,92 ****
  clean:
  	rm -f spacefor.sysv spacefor.v7 spacefor.null queuelen.null
! 	rm -f spacefor.sgi spacefor.xenix
  	rm -f config mailname organization server whoami hostname errlog
  	rm -f substitutions history history.pag history.dir active localgroups
--- 95,99 ----
  clean:
  	rm -f spacefor.sysv spacefor.v7 spacefor.null queuelen.null
! 	rm -f spacefor.sgi spacefor.xenix queuelen.pre
  	rm -f config mailname organization server whoami hostname errlog
  	rm -f substitutions history history.pag history.dir active localgroups
***************
*** 103,106 ****
--- 110,114 ----
  spotless:	gclean
  	rm -f $(SHS)
+ 	rm -f substs
  
  lclean:

*** cnpatch/old/conf/spacefor.proto	Wed Jan 10 19:10:18 1990
--- conf/spacefor.proto	Mon Jan 15 02:21:51 1990
***************
*** 47,51 ****
  # block count comes from, and the one for nr determines which line.  For
  # System V, the Makefile edits in a sed which tries to strip silliness
! # off in a reasonably System-V-variant-indepedent way.  Expr would be
  # faster than awk, but on a 16-bit machine, expr does 16-bit arithmetic,
  # which isn't enough.
--- 47,51 ----
  # block count comes from, and the one for nr determines which line.  For
  # System V, the Makefile edits in a sed which tries to strip silliness
! # off in a reasonably System-V-variant-independent way.  Expr would be
  # faster than awk, but on a 16-bit machine, expr does 16-bit arithmetic,
  # which isn't enough.

*** cnpatch/old/conf/subst	Tue Jun 20 18:55:56 1989
--- conf/subst	Sat Jan 13 21:06:55 1990
***************
*** 73,83 ****
  	}" $f >$new
  
! 	# substitute new for old
! 	trap "mv $old $f; exit" 1 2 15
! 	mv $f $old
! 	mv $new $f
! 
! 	# dispense with the old version
! 	trap "rm -f $old; exit" 1 2 15
! 	rm $old
  done
--- 73,86 ----
  	}" $f >$new
  
! 	# substitute new for old, if necessary
! 	if cmp -s $new $f
! 	then
! 		rm -f $new $old
! 	else
! 		trap "mv $old $f; exit" 1 2 15
! 		mv $f $old
! 		mv $new $f
! 		trap "rm -f $old; exit" 1 2 15
! 		rm $old
! 	fi
  done

*** cnpatch/old/conf/subst.hs	Thu Sep 14 16:03:28 1989
--- conf/subst.hs	Sun Jan 14 00:22:53 1990
***************
*** 27,30 ****
--- 27,31 ----
  man/news.5
  man/newsaux.8
+ man/newsmaint.8
  man/newsbatch.8
  man/newsmail.8
***************
*** 38,41 ****
--- 39,43 ----
  man/postnews.1
  misc/addgroup
+ misc/addfeed
  misc/delgroup
  misc/locknews

*** cnpatch/old/expire/Makefile	Wed Jan 10 19:10:22 1990
--- expire/Makefile	Sun Jan 14 03:47:37 1990
***************
*** 21,25 ****
  SHELL = /bin/sh
  
! all:	$(THEM) explist.proto
  	chmod +x $(THEM)
  
--- 21,25 ----
  SHELL = /bin/sh
  
! all:	$(THEM)
  	chmod +x $(THEM)
  
***************
*** 34,39 ****
  	for f in $(THEM) ; do cmp $(NEWSBIN)/expire/$$f $$f || true ; done
  
! newsinstall:	explist.proto
! 	-if test ! -r $(NEWSCTL)/explist ; then cp explist.proto $(NEWSCTL)/explist ; fi
  
  expire: expire.o $(LIBS)
--- 34,39 ----
  	for f in $(THEM) ; do cmp $(NEWSBIN)/expire/$$f $$f || true ; done
  
! newsinstall:	explist
! 	-if test ! -r $(NEWSCTL)/explist ; then cp explist $(NEWSCTL)/explist ; fi
  
  expire: expire.o $(LIBS)
***************
*** 55,59 ****
  	lint -ha $(LINTFLAGS) expire.c 2>&1 | egrep -v $(JUNKLINT) | tee $@
  
! explist.proto:
  	echo "# hold onto history lines 14 days, nobody gets >90 days" >$@
  	echo "/expired/			x	14	-" >>$@
--- 55,59 ----
  	lint -ha $(LINTFLAGS) expire.c 2>&1 | egrep -v $(JUNKLINT) | tee $@
  
! explist.yes:
  	echo "# hold onto history lines 14 days, nobody gets >90 days" >$@
  	echo "/expired/			x	14	-" >>$@
***************
*** 76,79 ****
--- 76,87 ----
  	echo "all				x	7	@" >>$@
  
+ explist.no:	explist.yes
+ 	echo '# modified version, no archiving' >$@
+ 	echo '#' >>$@
+ 	sed 's/@/-/' explist.yes >>$@
+ 
+ explist:	explist.no
+ 	cp explist.no $@
+ 
  # setup for regression test
  setup:
***************
*** 267,271 ****
  
  clean:	tidy
! 	rm -f *.o expire histslash mkdbm histinfo explist.proto
  	rm -f dtr updatemin
  
--- 275,279 ----
  
  clean:	tidy
! 	rm -f *.o expire histslash mkdbm histinfo explist explist.*
  	rm -f dtr updatemin
  

*** cnpatch/old/man/expire.8	Wed Jan 10 19:10:44 1990
--- man/expire.8	Fri Jan 12 14:59:50 1990
***************
*** 7,11 ****
  .\" =()<.ds m @<NEWSMASTER>@>()=
  .ds m usenet
! .TH EXPIRE 8 "3 Jan 1990" "C News"
  .SH NAME
  expire, doexpire \- expire old news
--- 7,11 ----
  .\" =()<.ds m @<NEWSMASTER>@>()=
  .ds m usenet
! .TH EXPIRE 8 "12 Jan 1990" "C News"
  .SH NAME
  expire, doexpire \- expire old news
***************
*** 273,276 ****
--- 273,283 ----
  \fIUpact\fR is a distasteful kludge,
  but then, so is the third field of the \fIactive\fR file.
+ .PP
+ \fIUpact\fR forces the third field of the \fIactive\fR file to be at least
+ five digits, for backward compatibility, but otherwise just makes it as
+ large as necessary.
+ The group-creation operations always create it ten digits long.
+ The discrepancy is harmless, since unlike the second field, the third
+ field is never updated in place.
  .PP
  One cannot put more than one newsgroup into a single archiving directory

*** cnpatch/old/man/newsaux.8	Wed Jan 10 19:10:45 1990
--- man/newsaux.8	Sun Jan 14 00:18:23 1990
***************
*** 7,11 ****
  .\" =()<.ds m @<NEWSMASTER>@>()=
  .ds m usenet
! .TH NEWSAUX 8 "30 Dec 1989" "C News"
  .SH NAME
  spacefor \- check available space for news
--- 7,11 ----
  .\" =()<.ds m @<NEWSMASTER>@>()=
  .ds m usenet
! .TH NEWSAUX 8 "13 Jan 1990" "C News"
  .SH NAME
  spacefor \- check available space for news
***************
*** 23,41 ****
  canonhdr \- extract header and canonicalize case in header keywords
  .br
- newshist \- extract history line for news article(s)
- .br
  newslock \- do locking for news
- .br
- newsdaily \- maintain news log files and report problems
- .br
- newswatch \- keep an eye on news system for difficulties
- .br
- newsboot \- clean up news debris on reboot
- .br
- locknews \- lock news system for manual tinkering
- .br
- addgroup, delgroup \- add and delete newsgroups, locally only
- .br
- adddirs \- make any missing directories for active newsgroups
  .SH SYNOPSIS
  .B \*b/spacefor
--- 23,27 ----
***************
*** 67,93 ****
  [ file ] ...
  .br
- .B \*b/maint/newshist
- msgid ...
- .br
  .B \*b/newslock
  locktemp lockname
- .br
- .B \*b/maint/newsdaily
- [ guru ... ]
- .br
- .B \*b/maint/newswatch
- [ guru ... ]
- .br
- .B \*b/maint/newsboot
- .br
- .B \*b/maint/locknews
- .br
- .B \*b/maint/addgroup
- group {\fBy\fR|\fBn\fR|\fBm\fR|\fBx\fR|\fB=\fIrealgroup\fR}
- .br
- .B \*b/maint/delgroup
- group
- .br
- .B \*b/maint/adddirs
  .SH DESCRIPTION
  These programs are minor utilities used by various parts of C News.
--- 53,58 ----
***************
*** 155,161 ****
  ``Message-ID'' is the canonical form of [e.g.] ``message-id''.)
  .PP
- .I Newshist
- prints the history line for each article identified by a \fImsgid\fR.
- .PP
  .I Newslock
  makes a link named \fIlockname\fR to the file \fIlocktemp\fR,
--- 120,123 ----
***************
*** 168,218 ****
  (Some brain-damaged versions of \fIln\fR helpfully remove \fIlockname\fR
  in that case, making them useless for locking.)
- .PP
- .I Newsdaily
- performs minor maintenance chores
- that typically should be done once a day for the news system:
- saving copies of log files and truncating them,
- reporting logged errors, checking for anomalies suggesting something
- is wrong, and cleaning out leftover files.
- \fINewsdaily\fR saves one generation of old \fIlog\fR files and three
- generations of old \fIerrlog\fR and \fIbatchlog\fR files.
- It reports problems to the named \fIguru\fRs
- (default:  `\*m').
- .PP
- .I Newswatch
- looks for indications of news problems on a shorter time scale than those
- reported by \fInewsdaily\fR, notably strangely-persistent lock files that
- may indicate a news-system failure.
- It typically should be run a few times a day.
- .PP
- .I Newsboot
- should be run from \fI/etc/rc\fR or the system's equivalent on reboot.
- It cleans up files that the news system might have left lying about
- if the system crashed while news was being processed,
- notably old lock files.
- .PP
- .I Locknews
- locks the news system, starts up a shell for the user, and waits around to
- unlock the news system when that shell terminates.
- This simplifies manual maintenance.
- .PP
- .I Addgroup
- and
- .I delgroup
- respectively add a newsgroup (with a specified flags field for the
- \fIactive\fR file, normally `y' [see \fInews\fR(5)]) and delete a
- newsgroup manually, with proper locking.
- The effect is purely local; no control message (to propagate the
- change to other machines) is sent.
- .PP
- .I Adddirs
- sweeps through the \fIactive\fR file checking that directories exist for
- all newsgroups.
- (\fIRelaynews\fR
- will create directories as needed, but some
- user-interface software gets upset if a newsgroup exists but its directory
- does not.)
- This is mostly useful when adding groups in bulk, based on another site's
- \fIactive\fR file.
  .SH FILES
  .ta 6c
--- 130,133 ----
***************
*** 220,247 ****
  /usr/spool/uucp/*	uucp queues
  \*c/whoami	news host name
- \*c/history	history file
- \*c/history.pag	\fIdbm\fR database for history file
- \*c/history.dir	\fIdbm\fR database for history file
  \*c/L.*	lock temporaries
  \*c/LOCK*	lock files
- \*c/log	current news log
- \*c/log.o	previous news log
- \*c/errlog	current news-error log
- \*c/errlog.o*	old news-error logs
- \*c/batchlog	current news-batcher log
- \*c/batchlog.o*	old news-batcher logs
- \*a/in.coming	input-spooling area
- \*a/out.going	output-batching area
- \*c/watchtime	last time \fInewswatch\fR was run
- \*c/active	list of current newsgroups
- \*c/active.old	backup copy created by \fIaddgroup\fR and \fIdelgroup\fR
  .SH SEE ALSO
  df(1), uucp(1), ls(1), ctime(3), getdate(3), hostname(1),
! grep(1), news(5), expire(8), newsbatch(8), rnews(8)
! .SH DIAGNOSTICS
! .I Locknews
! complains and exits if it is unable to lock the news system; this is
! typically a matter of either inadequate permissions or news activity
! already in progress.
  .SH HISTORY
  Written at U of Toronto by Henry Spencer and Geoff Collyer.
--- 135,143 ----
  /usr/spool/uucp/*	uucp queues
  \*c/whoami	news host name
  \*c/L.*	lock temporaries
  \*c/LOCK*	lock files
  .SH SEE ALSO
  df(1), uucp(1), ls(1), ctime(3), getdate(3), hostname(1),
! grep(1), news(5), expire(8), newsbatch(8), rnews(8), newsmaint(8)
  .SH HISTORY
  Written at U of Toronto by Henry Spencer and Geoff Collyer.
***************
*** 258,268 ****
  .PP
  The need for \fIsizeof\fR and \fInewslock\fR is a botch.
- .PP
- \fILocknews\fR is a bit crude.
- .PP
- \fIDelgroup\fR does not remove files or directories from \*a, although it
- prints a reminder to do so.
- .PP
- Various nuisances can result if the maintenance utilities are run as
- \fIroot\fR rather than as the owner of the news database.
- It's difficult to defend against this.
--- 154,155 ----

*** cnpatch/old/man/newsbatch.8	Thu Sep 14 16:03:42 1989
--- man/newsbatch.8	Sun Jan 14 02:09:07 1990
***************
*** 7,11 ****
  .\" =()<.ds m @<NEWSMASTER>@>()=
  .ds m usenet
! .TH NEWSBATCH 8 "26 Aug 1989" "C News"
  .SH NAME
  sendbatches, batchsplit \- news batching to other sites
--- 7,11 ----
  .\" =()<.ds m @<NEWSMASTER>@>()=
  .ds m usenet
! .TH NEWSBATCH 8 "13 Jan 1990" "C News"
  .SH NAME
  sendbatches, batchsplit \- news batching to other sites
***************
*** 17,21 ****
  c7encode, bencode \- compressed-news-batch encoding
  .br
! viauux, viauuxz, viainews, viarsh \- news-batch transmission
  .br
  viamail, viaemail, viapmail \- news-batch transmission via mail
--- 17,21 ----
  c7encode, bencode \- compressed-news-batch encoding
  .br
! viauux, viauuxz, viauuxl, viainews, viarsh \- news-batch transmission
  .br
  viamail, viaemail, viapmail \- news-batch transmission via mail
***************
*** 68,71 ****
--- 68,74 ----
  .B \&.../viauuxz
  site
+ .br	
+ .B \&.../viauuxl
+ group
  .br
  .B \&.../viainews
***************
*** 216,219 ****
--- 219,226 ----
  like \fIviauux\fR except with \fB\-z\fR option given to \fIuux\fR
  (for old UUCPs where don't-report-result-on-zero-status is not default)
+ .IP viauuxl
+ multicast transmission using the \fB\-l\fR option of \fIuux\fR (not found
+ on all systems) to send the same batch to all systems listed in the
+ file `\*c/sites.\fIgroup\fR'
  .IP viainews
  feed the batch back to \fIinews\fR, ignoring the \fIsite\fR argument
***************
*** 261,264 ****
--- 268,272 ----
  \*a/out.going/*	batch directories
  \*c/batchparms	parameter file
+ \*c/sites.*	\fIviauuxl\fR multicast lists
  
  also see text
***************
*** 288,289 ****
--- 296,301 ----
  \fIViapmail\fR is obsolescent;
  \fIviaemail\fR with a batch encoded with \fIbencode\fR is vastly superior.
+ .PP
+ Queue-length limiting does not work for \fIviauuxl\fR because \fIqueuelen\fR
+ (see \fInewsaux\fR(8)) does not know about multicast groups.
+ Also, \fIviauuxl\fR has not been tested well.

*** cnpatch/old/misc/README	Tue Jun 20 19:00:07 1989
--- misc/README	Sun Jan 14 00:49:59 1990
***************
*** 1,5 ****
  These are miscellaneous C News utilities which are used by more than one
  subsystem or aren't large enough to deserve their own directory.  newsaux(8)
! describes most of them.
  
  Ctime and getdate are, in our opinion, useful enough to deserve installing
--- 1,5 ----
  These are miscellaneous C News utilities which are used by more than one
  subsystem or aren't large enough to deserve their own directory.  newsaux(8)
! and newsmaint(8) describe most of them.
  
  Ctime and getdate are, in our opinion, useful enough to deserve installing

*** cnpatch/old/notebook/config	Thu Sep 14 16:03:44 1989
--- notebook/config	Sat Jan 13 21:11:30 1990
***************
*** 151,155 ****
  # foobar \- does foo, bar, and bletch
  
! # =()<. ${NEWSCONFIG\-@<NEWSCONFIG>@}>()=
  \&. ${NEWSCONFIG\-/usr/lib/news/bin/config}
  
--- 151,155 ----
  # foobar \- does foo, bar, and bletch
  
! # =()<\&. ${NEWSCONFIG\-@<NEWSCONFIG>@}>()=
  \&. ${NEWSCONFIG\-/usr/lib/news/bin/config}
  

*** cnpatch/old/notebook/log	Wed Jan 10 19:10:50 1990
--- notebook/log	Mon Jan 15 02:22:08 1990
***************
*** 87,91 ****
  .PP
  Beware that control-message handlers inherit
! .I relaynew 's
  standard output, so if any of them natters on standard output
  (we believe none of ours does), the nattering will appear in
--- 87,91 ----
  .PP
  Beware that control-message handlers inherit
! .I relaynews 's
  standard output, so if any of them natters on standard output
  (we believe none of ours does), the nattering will appear in

*** cnpatch/old/notebook/problems	Wed Jan 10 19:10:10 1990
--- notebook/problems	Sun Jan 14 04:04:07 1990
***************
*** 1,3 ****
! .DA "31 Dec 1989"
  .TL
  Known Porting Problems With C News
--- 1,3 ----
! .DA "13 Jan 1990"
  .TL
  Known Porting Problems With C News
***************
*** 142,145 ****
  telling \fIbuild\fR that you don't want to use the fast-stdio stuff is
  always safe.
  .PP
! xxx more to come...
--- 142,307 ----
  telling \fIbuild\fR that you don't want to use the fast-stdio stuff is
  always safe.
+ .SH
+ Readnews vs. System V
  .PP
! The terminal handling in the Australian \fIreadnews\fR that we include
! is known not to work under a ``pure'' System V.
! There are stubs for System V code but it's never been implemented.
! Most current System V implementations from serious suppliers have enough
! BSD compatibility that this is not an issue.
! .SH
! Readnews Simplicity
! .PP
! Generally, the Australian \fIreadnews\fR
! is a bit on the simple and buggy side.
! There are various things wrong with it that we're not very interested
! in fixing\(emwe consider it useful primarily for naive users who just
! want to read system announcements, and recommend that sophisticated
! users use something else.
! One known interoperability issue is that it is fussier about the format
! of \fI.newsrc\fR files than fancier readers.
! .PP
! Problems will arise if the news directories are in non-standard places,
! because \fIreadnews\fR is not well integrated into our configuration
! machinery; we want to fix this someday.
! .SH
! void
! .PP
! Old compilers that don't understand the \fIvoid\fR type will choke on
! much of our code.
! There is a commented-out ``#define\ void\ int'' in \fInews.h\fR that
! cures most cases of this if you uncomment it.
! (We have a report that you might need to add ``\-Dvoid=int'' to the
! Makefile in \fIlibv7\fR if you're using that library.)
! C News does not rely on the ANSI C ``void\ *'' type as far as we know.
! .SH
! Read/write Modes in fopen
! .PP
! Unix V7 documented only ``r'', ``w'', and ``a'' as suitable mode arguments
! to \fIfopen\fR.
! It actually implemented the read/write modes, ``r+'', ``w+'', and ``a+'',
! as well, and C News relies on them.
! Unix reimplementations based on old documentation may have trouble here;
! we know that at least the older versions of Minix really don't implement
! these modes.
! .SH
! MAXLONG
! .PP
! The \fIrelay/cpu.h\fR file formerly defined a constant \fIMAXLONG\fR
! which is the biggest positive value of a \fIlong\fR.
! The definition was clever but failed on some odd systems (Unisys?).
! Current versions of C News
! generate the value dynamically in a less fallible way,
! and check the value for plausibility.
! (This is encountered when \fIrelaynews\fR is asked to
! process a single article, not a batch.
! This happens primarily when an article is posted locally, with \fIinews\fR.)
! .SH
! df Output Format
! .PP
! The \fIspacefor\fR utility needs to understand the output format of \fIdf\fR.
! There are numerous variations on \fIdf\fR.
! \fIBuild\fR and the relevant makefiles know about the more common ones,
! but customization may be necessary.
! \fISpacefor\fR is commented well enough that it should be possible to
! figure out the necessary changes; usually the initializations of \fInr\fR
! and \fInf\fR are all that need changing.
! If there are colons (:) in your \fIdf\fR's output format, you should
! probably start from the ``sysv'' \fIspacefor\fR, which attempts to
! preprocess the output to get rid of System V garbage;
! otherwise the ``bsd'' one is a reasonable starting point.
! .PP
! One constant nuisance is \fIdf\fRs that are too stupid to take a directory
! name as an argument.
! The long-term solution to this is to edit a suitable variant of \fIspacefor\fR
! to know about the proper arguments.
! A short-term solution is to use the ``null'' variant, sacrificing space
! checking for the sake of getting something working.
! .SH
! Floating Point
! .PP
! The only place in C News where floating point is used, as far as we know,
! is in the calculation of expiry dates in \fIexpire\fR.
! This is not a performance bottleneck, so slow floating-point arithmetic
! is not a problem.
! Complete absence of floating point would require minor modifications to
! \fIexpire\fR.
! .SH
! 386 Optimizer vs. dbz
! .PP
! We have a reliable report that the System V 386 optimizer (invoked when
! \fIcc\fR is given the \fB\-O\fR option) miscompiles the \fIdbz\fR package
! badly enough to cripple it, without producing any error messages.
! The only fix is to compile \fIdbz\fR without \fB\-O\fR.
! .SH
! HP Spectrum Optimizer vs. nnfree
! .PP
! We have a reliable report that
! the HP Spectrum C compiler has an optimiser bug that makes it throw up
! (with a 
! ``cc: Internal error 3279: Please contact your local HP representative''
! message)
! on the \fInnfree\fR macro in \fIh/news.h\fR.
! The following revised version of
! the macro reportedly avoids
! the problem.
! .DS
! #define nnafree(mempp) do { if (*(mempp) != 0) { free((char *)*(mempp)); \e
!    *(mempp) = 0; }} while (0)
! .DE
! .SH
! ANSI C
! .PP
! Although we made an effort to be ANSI-C compatible,
! lack of access to a real ANSI C compiler limits our ability to do this.
! A secondary problem is that it's really very difficult to get code that
! is 100% acceptable to both ANSI C compilers and older compilers.
! Some issues inevitably got resolved in favor of current compilers,
! and may cause complaints from ANSI C compilers.
! .SH
! GNU C
! .PP
! If compiling with the GNU compiler, you will need the
! \fB\-traditional\fR flag.
! Beware, also, that if you are using your system's \fIdbm\fR library,
! it contains functions that return structure values, and the GNU conventions
! for handling such values are incompatible with the ones in many AT&T-derived
! compilers.
! The
! \fB\-fpcc-struct-return\fR option cures this.
! .SH
! Eccentric Awks
! .PP
! A number of problems can arise if your \fIawk\fR has bugs, since the shell
! files rely on \fIawk\fR fairly extensively.
! For example, \fIawk\fR is a prime suspect if \fIspacefor\fR doesn't work.
! We've fixed the worst trouble spots, but would appreciate detailed information
! on any more.
! .SH
! Systems Without Hard Links
! .PP
! Some vaguely Unixoid systems have trouble implementing real (``hard'') links.
! Examples are VMS in general and Eunice in particular.
! There are some hooks for dealing with this, but it's not trivial.
! .PP
! \fIRelaynews\fR will try to make symbolic links if real ones fail.
! There is one exception:
! if \fIrelaynews\fR cannot buffer up enough of the article in memory to
! find the `Newsgroups:' line, it will drop the article into a temporary
! file and will rely on being able to move that to the first of the
! `real' locations by manipulating links.
! This should essentially never happen except on 16-bit machines,
! and should be rare even on them.
! .PP
! \fIExpire\fR has a \fB\-l\fR option which
! tells it to consider the first filename of an article its `leader',
! not expiring the article under that name until it has expired under
! all others.
! This has not been tested much recently.
! .PP
! The locking system (both C routines and the \fInewslock\fR program)
! will need revision in some system-dependent way to avoid use of links.
! .PP
! There is one minor use of links in installation (\fIinews\fR is found
! in two places, and the Makefile attempts a link before doing a copy),
! and substantially more in the regression tests.

*** cnpatch/old/relay/control.c	Wed Jan 10 19:10:52 1990
--- relay/control.c	Sat Jan 13 19:42:17 1990
***************
*** 201,205 ****
  	cmd = malloc((unsigned) STRLEN("PATH=") + strlen(ctlfile("bin")) +
  		STRLEN(":") + strlen(SUBDIR) + STRLEN(";") + strlen(ctlcmd) +
! 		STRLEN(" <") + strlen(inname) + 1);
  	if (cmd == NULL) {
  		warning("can't allocate memory in runctlmsg", "");
--- 201,205 ----
  	cmd = malloc((unsigned) STRLEN("PATH=") + strlen(ctlfile("bin")) +
  		STRLEN(":") + strlen(SUBDIR) + STRLEN(";") + strlen(ctlcmd) +
! 		STRLEN(" <") + strlen(inname) + SIZENUL);
  	if (cmd == NULL) {
  		warning("can't allocate memory in runctlmsg", "");
***************
*** 237,241 ****
  	
  	mailcmd = malloc((unsigned)STRLEN("PATH=") + strlen(newspath()) +
! 		STRLEN(" mail ") + strlen(newsmaster()) + 1);
  	if (mailcmd == NULL) {
  		warning("can't allocate memory in bombctlmsg", "");
--- 237,241 ----
  	
  	mailcmd = malloc((unsigned)STRLEN("PATH=") + strlen(newspath()) +
! 		STRLEN(" mail ") + strlen(newsmaster()) + SIZENUL);
  	if (mailcmd == NULL) {
  		warning("can't allocate memory in bombctlmsg", "");

*** cnpatch/old/relay/fileart.c	Wed Jan 10 19:10:53 1990
--- relay/fileart.c	Sat Jan 13 19:42:33 1990
***************
*** 252,256 ****
  	(void) sprintf(artnumstr, "%ld", artnum);
  	artname = nemalloc((unsigned) (strlen(slashng) +
! 		STRLEN(SFNDELIM) + strlen(artnumstr) + 1));
  	(void) strcpy(artname, slashng);
  	(void) strcat(artname, SFNDELIM);
--- 252,256 ----
  	(void) sprintf(artnumstr, "%ld", artnum);
  	artname = nemalloc((unsigned) (strlen(slashng) +
! 		STRLEN(SFNDELIM) + strlen(artnumstr) + SIZENUL));
  	(void) strcpy(artname, slashng);
  	(void) strcat(artname, SFNDELIM);

*** cnpatch/old/relay/history.c	Thu Sep 14 16:03:48 1989
--- relay/history.c	Sat Jan 13 19:43:20 1990
***************
*** 4,8 ****
   * B 2.10+ news pulls a dirty (and undocumented) trick and converts
   * message-id's to lower case before using them as keys in the dbm file.
!  * We don't; you'll want to fix your news readers accordingly.
   *
   * B 2.10.3+ rnews puts out a leading space before received
--- 4,15 ----
   * B 2.10+ news pulls a dirty (and undocumented) trick and converts
   * message-id's to lower case before using them as keys in the dbm file.
!  * C news instead invokes rfc822ize on the key, which does the rational
!  * part of what RFC 822 requires: it converts the `domain' part on the
!  * right of the `@' to lower case.  We have not attempted to fully meet
!  * 822's bizarre requirements, since they pretty much require a lex
!  * scanner or a slightly-simplified version of the scanner found in the
!  * shell, neither of which will be simple, which means either would
!  * likely contain subtle bugs.  You'll want to fix your news readers
!  * accordingly.
   *
   * B 2.10.3+ rnews puts out a leading space before received
***************
*** 105,109 ****
  	sanitise(clnmsgid);
  	msgidkey.dptr = clnmsgid;
! 	msgidkey.dsize = strlen(clnmsgid) + 1;	/* include NUL */
  	keypos = fetch(msgidkey);		/* offset into ascii file */
  	free(clnmsgid);
--- 112,116 ----
  	sanitise(clnmsgid);
  	msgidkey.dptr = clnmsgid;
! 	msgidkey.dsize = strlen(clnmsgid) + SIZENUL;
  	keypos = fetch(msgidkey);		/* offset into ascii file */
  	free(clnmsgid);
***************
*** 132,136 ****
  		static char *histent = NULL;
  
! 		memcpy((char *)&pos, posdatum.dptr, sizeof pos); /* align */
  		nnfree(&histent);
  		if (fseek(fp, pos, SEEK_SET) != -1 &&
--- 139,143 ----
  		static char *histent = NULL;
  
! 		(void) memcpy((char *)&pos, posdatum.dptr, sizeof pos); /* align */
  		nnfree(&histent);
  		if (fseek(fp, pos, SEEK_SET) != -1 &&
***************
*** 235,239 ****
  
  	msgidkey.dptr = rfc822ize(strsave(msgid));
! 	msgidkey.dsize = strlen(msgid) + 1;	/* include NUL */
  	posdatum.dptr = (char *)&pos;
  	posdatum.dsize = sizeof pos;
--- 242,246 ----
  
  	msgidkey.dptr = rfc822ize(strsave(msgid));
! 	msgidkey.dsize = strlen(msgid) + SIZENUL;
  	posdatum.dptr = (char *)&pos;
  	posdatum.dsize = sizeof pos;
***************
*** 298,302 ****
  register char *artnumstr;
  {
! 	unsigned addlen = strlen(group)+STRLEN(SFNDELIM)+strlen(artnumstr)+1;
  
  	art->a_filed = YES;			/* make a note */
--- 305,310 ----
  register char *artnumstr;
  {
! 	unsigned addlen = strlen(group) + STRLEN(SFNDELIM) +
! 		strlen(artnumstr) + SIZENUL;
  
  	art->a_filed = YES;			/* make a note */

*** cnpatch/old/relay/ihave.c	Thu Aug 24 16:40:01 1989
--- relay/ihave.c	Sat Jan 13 19:43:28 1990
***************
*** 177,181 ****
  	statust status = ST_OKAY;
  
! 	ng = nemalloc((unsigned)(STRLEN("to.") + strlen(remotesys) + 1));
  	(void) strcpy(ng, "to.");
  	(void) strcat(ng, remotesys);
--- 177,181 ----
  	statust status = ST_OKAY;
  
! 	ng = nemalloc((unsigned)(STRLEN("to.") + strlen(remotesys) + SIZENUL));
  	(void) strcpy(ng, "to.");
  	(void) strcat(ng, remotesys);

*** cnpatch/old/relay/makefile	Wed Jan 10 19:10:57 1990
--- relay/makefile	Sat Jan 13 19:41:52 1990
***************
*** 25,29 ****
  LLIBS=-llocal
  # I wish I could make lint shut the fk up about some things.  Grrr!
! LINTFILT=egrep -v '(possible pointer|long assign|can.t take|never used|nnfree|getdate|:$$)'
  PROPTS=
  P=stpr
--- 25,29 ----
  LLIBS=-llocal
  # I wish I could make lint shut the fk up about some things.  Grrr!
! LINTFILT=egrep -v '(possible pointer|long assign|nnfree|getdate|:$$)'
  PROPTS=
  P=stpr
***************
*** 45,49 ****
  	sh/realrnews sh/serverrnews makefile
  CFILES= ../include/*.h \
! 	active.h article.h caches.h mkdirs.h control.h cpu.h fileart.h \
  	hdrint.h headers.h history.h system.h transmit.h trbatch.h $(SRC)
  
--- 45,49 ----
  	sh/realrnews sh/serverrnews makefile
  CFILES= ../include/*.h \
! 	active.h article.h caches.h mkdirs.h control.h fileart.h \
  	hdrint.h headers.h history.h system.h transmit.h trbatch.h $(SRC)
  
***************
*** 146,150 ****
  procart.o: headers.h article.h history.h system.h
  relaynews.o: ../include/libc.h ../include/news.h ../include/config.h
! relaynews.o: ../include/fgetmfs.h active.h caches.h cpu.h headers.h
  relaynews.o: history.h
  string.o: ../include/libc.h ../include/news.h
--- 146,150 ----
  procart.o: headers.h article.h history.h system.h
  relaynews.o: ../include/libc.h ../include/news.h ../include/config.h
! relaynews.o: ../include/fgetmfs.h active.h caches.h headers.h
  relaynews.o: history.h
  string.o: ../include/libc.h ../include/news.h

*** cnpatch/old/relay/procart.c	Wed Jan 10 19:10:58 1990
--- relay/procart.c	Sat Jan 13 19:46:26 1990
***************
*** 136,144 ****
  {
  	register char *hdr = NULL;
! 	long limit = (art->a_blvmax? art->a_unread+1: art->a_unread); /* 1 for NUL */
  	int is_hdr = NO;
  
! 	/* 1 is again for NUL */
! 	while (limit > 1 && (hdr = gethdr(in, &limit, &is_hdr)) != NULL && is_hdr) {
  	    	hdrdigest(art, hdr, strlen(hdr));
  		hdr = NULL;			/* freed inside gethdr */
--- 136,144 ----
  {
  	register char *hdr = NULL;
! 	long limit = art->a_unread + SIZENUL;
  	int is_hdr = NO;
  
! 	while (limit > SIZENUL && (hdr = gethdr(in, &limit, &is_hdr)) != NULL &&
! 	    is_hdr) {
  	    	hdrdigest(art, hdr, strlen(hdr));
  		hdr = NULL;			/* freed inside gethdr */
***************
*** 145,152 ****
  	}
  	/* If we read a body line, gethdr has adjusted limit appropriately. */
! 	art->a_unread = limit - 1;		/* limit updated by gethdr */
! 	if (is_hdr)				/* no body: header fills limit */
! 		hdr = NULL;
! 	return hdr;
  }
  
--- 145,151 ----
  	}
  	/* If we read a body line, gethdr has adjusted limit appropriately. */
! 	art->a_unread = limit - SIZENUL;
! 	/* if is_hdr, there is no body: header fills limit */
! 	return (is_hdr? NULL: hdr);
  }
  

*** cnpatch/old/relay/relaynews.c	Mon Nov 13 17:39:53 1989
--- relay/relaynews.c	Sat Jan 13 19:47:39 1990
***************
*** 44,48 ****
  #include "active.h"
  #include "caches.h"
- #include "cpu.h"
  #include "fileart.h"
  #include "headers.h"
--- 44,47 ----
***************
*** 78,81 ****
--- 77,81 ----
  extern boolean batchln();
  FORWARD boolean debugon();
+ FORWARD long maxlong();
  
  /*
***************
*** 148,152 ****
  	(void) umask(2);		/* undo silly umasks, ignore newsumask() */
  	(void) alarm(0);		/* cancel any pending alarm */
! 	newpath = malloc(STRLEN("PATH=") + strlen(newspath()) + 1);
  	if (newpath == NULL)
  		exit(1);		/* no chatter until stdfdopen */
--- 148,152 ----
  	(void) umask(2);		/* undo silly umasks, ignore newsumask() */
  	(void) alarm(0);		/* cancel any pending alarm */
! 	newpath = malloc((unsigned)(STRLEN("PATH=")+strlen(newspath())+SIZENUL));
  	if (newpath == NULL)
  		exit(1);		/* no chatter until stdfdopen */
***************
*** 154,157 ****
--- 154,158 ----
  	(void) strcat(newpath, newspath());
  	if (putenv(newpath) ||
+ 	    putenv("SHELL=/bin/sh") ||
  	    putenv("IFS= \t\n"))
  		exit(1);		/* no chatter until stdfdopen */
***************
*** 246,250 ****
  		(void) fprintf(stderr, "usage: %s [-inrs][-d fhlmt][-x site]\n",
  			progname);
! 		exit(2);
  	}
  }
--- 247,251 ----
  		(void) fprintf(stderr, "usage: %s [-inrs][-d fhlmt][-x site]\n",
  			progname);
! 		exit(1);
  	}
  }
***************
*** 375,379 ****
  
  	fullname = nemalloc((unsigned)strlen(origdir) + STRLEN(SFNDELIM) +
! 		strlen(name) + 1);
  	fullname[0] = '\0';
  
--- 376,380 ----
  
  	fullname = nemalloc((unsigned)strlen(origdir) + STRLEN(SFNDELIM) +
! 		strlen(name) + SIZENUL);
  	fullname[0] = '\0';
  
***************
*** 410,424 ****
  	if (c == '#')
  		return unbatch(in, inname);
! 	else {
! 		register long infinite = MAXLONG;
  
! 		if (infinite <= 0) {		/* paranoia */
! 			errno = 0;
! 			errunlock(
! 			"MAXLONG is non-positive; rebuild the news software",
! 				"");
! 		}
! 		return cpinsart(in, inname, infinite, NO);
  	}
  }
  
--- 411,443 ----
  	if (c == '#')
  		return unbatch(in, inname);
! 	else
! 		/* -SIZENUL is to avoid overflow later during +SIZENUL */
! 		return cpinsart(in, inname, maxlong() - SIZENUL, NO);
! }
  
! /*
!  * compute the largest number that can be stored in a long.  in theory, 
!  * #define MAXLONG ((long)(~(unsigned long)0 >> 1))
!  * will do the job, but old compilers don't have "unsigned long", don't
!  * like casts in initialisers, or otherwise miscompute.
!  */
! STATIC long
! maxlong()
! {
! 	register int bits = 0;
! 	register unsigned word = 1;		/* "unsigned" avoids overflow */
! 	static long savemaxlong = 0;
! 
! 	if (savemaxlong > 0)
! 		return savemaxlong;
! 	for (bits = 0, word = 1; word != 0; word <<= 1)
! 		bits++;
! 	/* bits/sizeof word = bits per char; all bits on but the sign bit */
! 	savemaxlong = ~(1L << (bits/sizeof word * sizeof savemaxlong - 1));
! 	if (savemaxlong <= 0) {			/* sanity check */
! 		errno = 0;
! 		errunlock("maxlong is non-positive; your compiler is broken", "");
  	}
+ 	return savemaxlong;
  }
  

*** cnpatch/old/relay/sh/ctlrun	Thu Sep 14 16:03:53 1989
--- relay/sh/ctlrun	Sat Jan 13 19:45:01 1990
***************
*** 8,12 ****
  
  cd $NEWSCTL
! newslock sys LOCK || exit 1	# lock
  
  cd $NEWSARTS/control
--- 8,12 ----
  
  cd $NEWSCTL
! newslock sys LOCK || exit 1
  
  cd $NEWSARTS/control
***************
*** 21,23 ****
  done
  
! rm -f /tmp/ctl$$ LOCK
--- 21,23 ----
  done
  
! rm -f /tmp/ctl$$ $NEWSCTL/LOCK

*** cnpatch/old/relay/sh/inews	Thu Sep 14 16:03:53 1989
--- relay/sh/inews	Sat Jan 13 19:45:28 1990
***************
*** 19,23 ****
  hdrspresent=no
  autopost=no
! waitcmd=''
  relayopts=-i			# redirect stdout to log
  
--- 19,23 ----
  hdrspresent=no
  autopost=no
! waitcmd='status=0'
  relayopts=-i			# redirect stdout to log
  
***************
*** 61,65 ****
  	-A)	autopost=yes ;;		# wait for free space
  	-V)	relayopts= ;;		# verbose: don't redirect stdout (or stderr)
! 	-W)	waitcmd=wait ;;		# wait for completion
  	# useful standard options
  	-h)	hdrspresent=yes ;;
--- 61,65 ----
  	-A)	autopost=yes ;;		# wait for free space
  	-V)	relayopts= ;;		# verbose: don't redirect stdout (or stderr)
! 	-W)	waitcmd='wait; status=$?' ;;	# wait for completion
  	# useful standard options
  	-h)	hdrspresent=yes ;;
***************
*** 353,357 ****
  exit $status				# trap 0 may cleanup, make dead.article
  ) &
! $waitcmd				# wait if -W given
  trap 0					# let the background run on unmolested
! exit
--- 353,357 ----
  exit $status				# trap 0 may cleanup, make dead.article
  ) &
! eval $waitcmd				# wait & get status if -W given
  trap 0					# let the background run on unmolested
! exit $status

*** cnpatch/old/relay/sys.c	Mon Nov 13 17:39:54 1989
--- relay/sys.c	Sat Jan 13 19:43:57 1990
***************
*** 171,175 ****
  	if (sysp->sy_flags&FLG_BATCH && sysp->sy_cmd[0] == '\0') {
  		register char *deffile = nemalloc((unsigned) STRLEN(BTCHPFX) +
! 			strlen(sysp->sy_name) + STRLEN(BTCHSFX) + 1);
  
  		(void) strcpy(deffile, BTCHPFX);
--- 171,175 ----
  	if (sysp->sy_flags&FLG_BATCH && sysp->sy_cmd[0] == '\0') {
  		register char *deffile = nemalloc((unsigned) STRLEN(BTCHPFX) +
! 			strlen(sysp->sy_name) + STRLEN(BTCHSFX) + SIZENUL);
  
  		(void) strcpy(deffile, BTCHPFX);
***************
*** 182,186 ****
  	if (sysp->sy_flags&FLG_BATCH && sysp->sy_cmd[0] != FNDELIM) {
  		register char *absfile = nemalloc((unsigned) STRLEN(BTCHDIR) +
! 			strlen(sysp->sy_cmd) + 1);
  
  		(void) strcpy(absfile, BTCHDIR);
--- 182,186 ----
  	if (sysp->sy_flags&FLG_BATCH && sysp->sy_cmd[0] != FNDELIM) {
  		register char *absfile = nemalloc((unsigned) STRLEN(BTCHDIR) +
! 			strlen(sysp->sy_cmd) + SIZENUL);
  
  		(void) strcpy(absfile, BTCHDIR);
***************
*** 193,197 ****
  		free(sysp->sy_cmd);	/* malloced by parse */
  		sysp->sy_cmd = nemalloc((unsigned) STRLEN(CMDPFX) +
! 			strlen(sysp->sy_name) + STRLEN(CMDSFX) + 1);
  		(void) strcpy(sysp->sy_cmd, CMDPFX);
  		(void) strcat(sysp->sy_cmd, sysp->sy_name);
--- 193,197 ----
  		free(sysp->sy_cmd);	/* malloced by parse */
  		sysp->sy_cmd = nemalloc((unsigned) STRLEN(CMDPFX) +
! 			strlen(sysp->sy_name) + STRLEN(CMDSFX) + SIZENUL);
  		(void) strcpy(sysp->sy_cmd, CMDPFX);
  		(void) strcat(sysp->sy_cmd, sysp->sy_name);

Files that are new:

new batch/viauuxl (patch can't create, so diff against null):
Index: batch/viauuxl
*** cnpatch/old/batch/viauuxl	Tue Jan 16 16:58:43 1990
--- batch/viauuxl	Sun Jan 14 02:01:40 1990
***************
*** 0 ****
--- 1,25 ----
+ #! /bin/sh
+ # Multicast transmission using uux -l.
+ # This has not been well tested, we don't have -l.
+ 
+ # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
+ . ${NEWSCONFIG-/usr/lib/news/bin/config}
+ 
+ PATH=$NEWSCTL/bin:$NEWSBIN/batch:$NEWSBIN:$NEWSPATH ; export PATH
+ umask $NEWSUMASK
+ 
+ if test ! -r $NEWSCTL/sites.$1
+ then
+ 	echo "$0: cannot read \`sites.$1'" >&2
+ 	exit 1
+ fi
+ sites="`cat $NEWSCTL/sites.$1`"
+ 
+ cd $NEWSARTS/out.going/$1
+ trap 'rm -f temp ; exit 0' 0 1 2 15
+ cat >temp
+ 
+ for site in $sites
+ do
+ 	uux -r -gd -l $site!rnews '<' !temp
+ done

new conf/ask (patch can't create, so diff against null):
Index: conf/ask
*** cnpatch/old/conf/ask	Tue Jan 16 16:58:44 1990
--- conf/ask	Sat Jan 13 22:29:21 1990
***************
*** 0 ****
--- 1,9 ----
+ #! /bin/sh
+ echo "$1 [$2]? " | tr -d '\012' >/dev/tty	# echo -n, sort of portably
+ default="$2"
+ read answer
+ case "$answer" in
+ '')	answer="$default"	;;
+ -)	answer=			;;
+ esac
+ echo "$answer"

new conf/notinlist (patch can't create, so diff against null):
Index: conf/notinlist
*** cnpatch/old/conf/notinlist	Tue Jan 16 16:58:44 1990
--- conf/notinlist	Fri Dec 29 21:00:28 1989
***************
*** 0 ****
--- 1,10 ----
+ #! /bin/sh
+ for f in $1
+ do
+ 	if test " $f" = " $2"
+ 	then
+ 		echo no
+ 		exit
+ 	fi
+ done
+ echo yes

new conf/queuelen.old (patch can't create, so diff against null):
Index: conf/queuelen.old
*** cnpatch/old/conf/queuelen.old	Tue Jan 16 16:58:45 1990
--- conf/queuelen.old	Sun Jan 14 01:39:13 1990
***************
*** 0 ****
--- 1,18 ----
+ #! /bin/sh
+ # Find size of current queue of news outbound to $1.  Ancient-uucp version.
+ 
+ # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
+ . ${NEWSCONFIG-/usr/lib/news/bin/config}
+ 
+ PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
+ umask $NEWSUMASK
+ 
+ cd /usr/spool/uucp
+ grade=d
+ 
+ case "$1" in
+ ?|??|???|????|?????|??????|???????)	site="$1" ;;
+ *)	site=`expr "$1" : '^\(.......\).*'`
+ esac
+ 
+ ls | egrep "^C\.$site$grade....\$" | wc | awk '{print $1}'

new conf/yesno (patch can't create, so diff against null):
Index: conf/yesno
*** cnpatch/old/conf/yesno	Tue Jan 16 16:58:45 1990
--- conf/yesno	Sat Jan 13 22:19:47 1990
***************
*** 0 ****
--- 1,19 ----
+ #! /bin/sh
+ default="$2"
+ while :
+ do
+ 	echo "$1 [$default]? " | tr -d '\012' >/dev/tty	# portable echo -n
+ 	read answer
+ 	case "$answer" in
+ 	'')	answer="$default"	;;
+ 	esac
+ 	case "$answer" in
+ 	n*|N*)	answer=no	;;
+ 	y*|Y*)	answer=yes	;;
+ 	esac
+ 	case "$answer" in
+ 	yes|no)	break		;;	# NOTE BREAK OUT
+ 	*)	echo '???' >/dev/tty	;;
+ 	esac
+ done
+ echo "$answer"

new man/newsmaint.8 (patch can't create, so diff against null):
Index: man/newsmaint.8
*** cnpatch/old/man/newsmaint.8	Tue Jan 16 16:58:46 1990
--- man/newsmaint.8	Tue Jan 16 15:06:28 1990
***************
*** 0 ****
--- 1,168 ----
+ .\" =()<.ds a @<NEWSARTS>@>()=
+ .ds a /usr/spool/news
+ .\" =()<.ds b @<NEWSBIN>@>()=
+ .ds b /usr/lib/newsbin
+ .\" =()<.ds c @<NEWSCTL>@>()=
+ .ds c /usr/lib/news
+ .\" =()<.ds m @<NEWSMASTER>@>()=
+ .ds m usenet
+ .TH NEWSMAINT 8 "16 Jan 1990" "C News"
+ .SH NAME
+ newshist \- extract history line for news article(s)
+ .br
+ newsdaily \- maintain news log files and report problems
+ .br
+ newswatch \- keep an eye on news system for difficulties
+ .br
+ newsboot \- clean up news debris on reboot
+ .br
+ locknews \- lock news system for manual tinkering
+ .br
+ addgroup, delgroup \- add and delete newsgroups, locally only
+ .br
+ adddirs \- make any missing directories for active newsgroups
+ .br
+ addfeed \- add a news feed
+ .SH SYNOPSIS
+ .B \*b/maint/newshist
+ msgid ...
+ .br
+ .B \*b/maint/newsdaily
+ [ guru ... ]
+ .br
+ .B \*b/maint/newswatch
+ [ guru ... ]
+ .br
+ .B \*b/maint/newsboot
+ .br
+ .B \*b/maint/locknews
+ .br
+ .B \*b/maint/addgroup
+ group {\fBy\fR|\fBn\fR|\fBm\fR|\fBx\fR|\fB=\fIrealgroup\fR}
+ .br
+ .B \*b/maint/delgroup
+ group
+ .br
+ .B \*b/maint/adddirs
+ .br
+ .B \*b/maint/addfeed
+ [
+ .B \-L
+ ]
+ site groups
+ .SH DESCRIPTION
+ These programs are utilities useful in maintaining a C News
+ system and diagnosing problems in it.
+ .PP
+ .I Newshist
+ prints the history line for each article identified by a \fImsgid\fR.
+ .PP
+ .I Newsdaily
+ performs minor maintenance chores
+ that typically should be done once a day for the news system:
+ saving copies of log files and truncating them,
+ reporting logged errors, checking for anomalies suggesting something
+ is wrong, and cleaning out leftover files.
+ \fINewsdaily\fR saves one generation of old \fIlog\fR files and three
+ generations of old \fIerrlog\fR and \fIbatchlog\fR files.
+ It reports problems to the named \fIguru\fRs
+ (default:  `\*m').
+ .PP
+ .I Newswatch
+ looks for indications of news problems on a shorter time scale than those
+ reported by \fInewsdaily\fR, notably strangely-persistent lock files that
+ may indicate a news-system failure.
+ It typically should be run a few times a day.
+ .PP
+ .I Newsboot
+ should be run from \fI/etc/rc\fR or the system's equivalent on reboot.
+ It cleans up files that the news system might have left lying about
+ if the system crashed while news was being processed,
+ notably old lock files.
+ .PP
+ .I Locknews
+ locks the news system, starts up a shell for the user, and waits around to
+ unlock the news system when that shell terminates.
+ This simplifies manual maintenance.
+ .PP
+ .I Addgroup
+ and
+ .I delgroup
+ respectively add a newsgroup (with a specified flags field for the
+ \fIactive\fR file, normally `y' [see \fInews\fR(5)]) and delete a
+ newsgroup manually, with proper locking.
+ The effect is purely local; no control message (to propagate the
+ change to other machines) is sent.
+ .PP
+ .I Adddirs
+ sweeps through the \fIactive\fR file checking that directories exist for
+ all newsgroups.
+ (\fIRelaynews\fR
+ will create directories as needed, but some
+ user-interface software gets upset if a newsgroup exists but its directory
+ does not.)
+ This is mostly useful when adding groups in bulk, based on another site's
+ \fIactive\fR file.
+ .PP
+ .I Addfeed
+ adds a line to the \fIsys\fR file specifying that the \fIsite\fR should
+ be fed the \fIgroups\fR,
+ and creates a suitable outbound-batching directory.
+ If the
+ .B \-L
+ option is given, the \fBL\fR flag is included to restrict the feed to
+ locally-generated articles only.
+ If \fIgroups\fR does not include a distribution list (separated from the
+ newsgroups by a `/'), the default distribution list `/all' is appended.
+ If \fIgroups\fR is of the form \fB=\fIname\fR,
+ this specifies the same groups as those fed to site `\fIname\fR',
+ with the exception that `to.\fIname\fR' is rewritten to `to.\fIsite\fR'.
+ .SH FILES
+ .ta 6c
+ .nf
+ \*c/history	history file
+ \*c/history.pag	\fIdbm\fR database for history file
+ \*c/history.dir	\fIdbm\fR database for history file
+ \*c/log	current news log
+ \*c/log.o	previous news log
+ \*c/errlog	current news-error log
+ \*c/errlog.o*	old news-error logs
+ \*c/batchlog	current news-batcher log
+ \*c/batchlog.o*	old news-batcher logs
+ \*a/in.coming	input-spooling area
+ \*a/out.going	output-batching area
+ \*c/watchtime	last time \fInewswatch\fR was run
+ \*c/active	list of current newsgroups
+ \*c/active.old	backup copy created by \fIaddgroup\fR and \fIdelgroup\fR
+ .SH SEE ALSO
+ df(1), uucp(1), ls(1), ctime(3), getdate(3), hostname(1),
+ grep(1), news(5), expire(8), newsbatch(8), rnews(8), newsaux(8)
+ .SH DIAGNOSTICS
+ .I Locknews
+ complains and exits if it is unable to lock the news system; this is
+ typically a matter of either inadequate permissions or news activity
+ already in progress.
+ .PP
+ .I Addfeed
+ looks for a \fB/default/\fR line
+ or a line for \fIsite\fR in
+ the \fIbatchparms\fR file, and if
+ none is found, warns the user to create one.
+ .SH HISTORY
+ Written at U of Toronto by Henry Spencer and Geoff Collyer.
+ .SH BUGS
+ \fILocknews\fR is a bit crude.
+ .PP
+ \fIDelgroup\fR does not remove files or directories from \*a, although it
+ prints a reminder to do so.
+ .PP
+ The \fB=\fIname\fR form of \fIaddfeed\fR
+ cannot cope with continued \fIsys\fR lines.
+ .PP
+ \fIAddfeed\fR assumes that attention to the \fIbatchparms\fR file suffices
+ to get batching going for a new feed, which is naive if you are running
+ \fIsendbatches\fR selectively, i.e. with arguments.
+ .PP
+ Various nuisances can result if the maintenance utilities are run as
+ \fIroot\fR rather than as the owner of the news database.
+ It's difficult to defend against this.

new misc/addfeed (patch can't create, so diff against null):
Index: misc/addfeed
*** cnpatch/old/misc/addfeed	Tue Jan 16 16:58:46 1990
--- misc/addfeed	Sun Jan 14 01:03:08 1990
***************
*** 0 ****
--- 1,66 ----
+ #! /bin/sh
+ # addgroup - add a newsgroup, locally only
+ 
+ # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
+ . ${NEWSCONFIG-/usr/lib/news/bin/config}
+ 
+ PATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH
+ umask $NEWSUMASK
+ 
+ usage="Usage: $0 [-L] sitename groups"
+ 
+ local=
+ case "$1" in
+ -L)	local=L ; shift ;;
+ esac
+ 
+ case $# in
+ 2)	;;
+ *)	echo "$usage" >&2 ; exit 2	;;
+ esac
+ 
+ case "$1$2" in
+ *:*)	echo "$usage" >&2 ; exit 2	;;
+ esac
+ if egrep -s "^$1:" $NEWSCTL/sys >/dev/null
+ then
+ 	echo "$0: sys-file entry for \`$1' already exists" >&2
+ 	exit 1
+ fi
+ 
+ case "$2" in
+ =*)	b="`echo $2 | sed 's/^=//'`"		# base system
+ 	groups="`awk -F: \"\\\$1 == \\\"$b\\\" {print \\\$2}\" $NEWSCTL/sys |
+ 						sed \"s;to\\.$b;to.$1;\"`"
+ 	;;
+ *)	groups="$2"	;;
+ esac
+ case "$groups" in
+ */*)	;;
+ *)	groups="$groups/all"	;;
+ esac
+ 
+ lock="$NEWSCTL/LOCK"
+ ltemp="$NEWSCTL/L.$$"
+ echo $$ >$ltemp
+ trap "rm -f $ltemp ; exit 0" 0 1 2 15
+ while true
+ do
+ 	if newslock $ltemp $lock
+ 	then
+ 		trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
+ 		break
+ 	fi
+ 	echo 'news system locked, waiting...'
+ 	sleep 5
+ done
+ 
+ echo "$1:$groups:${local}f:" >>$NEWSCTL/sys
+ mkdir "$NEWSARTS/out.going/$1"
+ 
+ if egrep -s "^($1|/default/)[ 	]" $NEWSCTL/batchparms
+ then
+ 	: okay
+ else
+ 	echo "$0: remember to add a line to \`batchparms' for \`$1'"
+ fi


end of patch 16-Jan-1990
-- 
1972: Saturn V #15 flight-ready|     Henry Spencer at U of Toronto Zoology
1990: birds nesting in engines | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.sources.bugs mailing list