henry@utzoo.uucp (Henry Spencer) (08/23/89)
This one is a lot of small stuff; some more major work is coming, but this one is already pushing 60KB (context diffs are so damned bulky...). Some "make cmp" stuff intended for our own testing, but possibly of use. A C version of upact. Some new fflushes in relaynews to make "status 16" failures report properly. A new option to expire to suppress the history rebuild. "inews -C" now produces an (informative) error message and exits. Lots of minor cleanup and improvement. start of patch 22-Aug-1989 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 expire/lowest.c mv relay/sh/postnews rna/postnews The following is a complete list of patches to date. Prereq: 23-Jun-1989 Prereq: 7-Jul-1989 Prereq: 23-Jul-1989 *** tmp.dates.with.really.long.filename.for.patch Tue Aug 22 14:05:43 1989 --- PATCHDATES Tue Aug 22 14:05:43 1989 *************** *** 1,3 **** --- 1,4 ---- 23-Jun-1989 7-Jul-1989 23-Jul-1989 + 22-Aug-1989 Changed files, if any: *** cnpatch/tmp.file Tue Aug 22 14:05:49 1989 --- batch/Makefile Mon Aug 21 19:15:19 1989 *************** *** 17,21 **** PGMS=batcher batchih batchsm batchsplit comp compcun nocomp viainews viauux \ ! sendbatches compc7 c7encode viamail viapmail bencode compb DTR=Makefile batcher.c batchih batchsplit c7encode.c comp compc7 compcun \ newsbatch.8 nocomp sendbatches viainews viauux viamail \ --- 17,22 ---- PGMS=batcher batchih batchsm batchsplit comp compcun nocomp viainews viauux \ ! sendbatches compc7 c7encode viamail viapmail bencode compb viauuxz \ ! viaemail DTR=Makefile batcher.c batchih batchsplit c7encode.c comp compc7 compcun \ newsbatch.8 nocomp sendbatches viainews viauux viamail \ *************** *** 41,44 **** --- 42,48 ---- cp $(PGMS) $(PGMDIR) + cmp: $(PGMS) + for f in $(PGMS) ; do cmp $(PGMDIR)/$$f $$f ; done + newsinstall: batchparms -if test ! -d $(OUTGOING) ; then mkdir $(OUTGOING) ; fi *************** *** 61,64 **** --- 65,74 ---- sed 's/ihave/sendme/g' batchih >$@ + viauuxz: viauux + sed '$$s/-r/-r -z/' viauux >$@ + + viaemail: viamail + sed '$$s/rnews/enews/' viamail >$@ + test.1: echo 'a test' >$@ *************** *** 165,167 **** rm -rf out.going bin rm -f *.o test.* togo togo.* batchparms batcher batchsm ! rm -f batchlog batchlog.* c7encode bencode --- 175,177 ---- rm -rf out.going bin rm -f *.o test.* togo togo.* batchparms batcher batchsm ! rm -f batchlog batchlog.* c7encode bencode viauuxz viaemail *** cnpatch/tmp.file Tue Aug 22 14:05:51 1989 --- batch/batcher.c Sun Aug 20 00:42:51 1989 *************** *** 115,119 **** error("internal disaster, can't fstat", ""); if ((sbuf.st_mode&S_IFMT) != S_IFREG) { ! close(artfile); return; /* Don't try to batch directories etc. */ } --- 115,119 ---- error("internal disaster, can't fstat", ""); if ((sbuf.st_mode&S_IFMT) != S_IFREG) { ! (void) close(artfile); return; /* Don't try to batch directories etc. */ } *** cnpatch/tmp.file Tue Aug 22 14:05:58 1989 --- batch/sendbatches Wed Aug 16 15:54:35 1989 *************** *** 148,152 **** if test $? -eq 0 -a ! -s /tmp/nb$$ then ! rm $f /tmp/nb$$ else ( --- 148,152 ---- if test $? -eq 0 -a ! -s /tmp/nb$$ then ! rm -f $f /tmp/nb$$ else ( *** cnpatch/tmp.file Tue Aug 22 14:05:59 1989 --- batch/viainews Sun Aug 6 02:48:24 1989 *************** *** 2,4 **** --- 2,5 ---- # Feed batch to inews, for ihave/sendme mostly. + HOME=/dev/null ; export HOME # suppress signatures, .name, etc. exec inews -h -W -A *** cnpatch/tmp.file Tue Aug 22 14:06:01 1989 --- conf/Makefile Mon Aug 21 19:46:47 1989 *************** *** 15,18 **** --- 15,20 ---- libsmall libstdio libusg libv7 libv8 DIRS = batch conf expire h hfake input $(LIBDIRS) misc relay rna + CMPDIRS = batch conf expire input man misc relay rna + SHS = doit.root doit.bin doit.news again.root PGMS = spacefor queuelen *************** *** 27,30 **** --- 29,38 ---- : and build takes care of setnewsids if needed + pcmp: $(PGMS) + for f in $(PGMS) ; do cmp $(NEWSBIN)/$$f $$f ; done + + cmp: + : nothing + newsinstall: : build stuff does the real work *************** *** 82,86 **** rm -f substitutions history history.pag history.dir active localgroups rm -f log mailpaths sys cron rc setnewsids setnewsids.o spacefor.bsd ! rm -f replyusepath spacefor queuelen junk gclean: tidy --- 90,94 ---- rm -f substitutions history history.pag history.dir active localgroups rm -f log mailpaths sys cron rc setnewsids setnewsids.o spacefor.bsd ! rm -rf replyusepath spacefor queuelen junk save gclean: tidy *************** *** 92,96 **** spotless: gclean ! rm -f again.root doit.bin doit.news doit.root lclean: --- 100,104 ---- spotless: gclean ! rm -f $(SHS) lclean: *************** *** 97,98 **** --- 105,116 ---- rm -f ../ranlibed for d in $(LIBDIRS) ; do cd ../$$d ; make clean ; done + + cmps: + for d in $(CMPDIRS) ; do cd ../$$d ; make cmp RBIN=/usr/lib/uucp/bin ; done + + save: $(SHS) + mkdir save + mv $(SHS) save + + check: + -for f in $(SHS) ; do diff save/$$f $$f ; done *** cnpatch/tmp.file Tue Aug 22 14:06:03 1989 --- conf/build Mon Aug 21 19:08:35 1989 *************** *** 8,12 **** # directories in which to do makes # batch must precede input; relay must precede misc ! pgmdirs='conf batch expire input relay misc rna' # control files built in conf --- 8,13 ---- # directories in which to do makes # batch must precede input; relay must precede misc ! # the "doui" code below may add rna to the list ! pgmdirs='conf batch expire input relay misc' # control files built in conf *************** *** 727,731 **** echo ! echo 'The "inews", "postnews", "readnews", and "checknews" commands should' echo 'go in one of the directories searched for normal commands, so users' echo 'can run them without special arrangements. What directory should' --- 728,748 ---- echo ! echo 'Our "postnews", "readnews", and "checknews" are included mostly for' ! echo 'completeness. They are very simple and crude compared to the user' ! echo 'interface many users are accustomed to. As far as we know, B News' ! echo '(or other) versions should run fine with C News. If you are already' ! echo 'running such user-interface software, you may not want to change.' ! ./query 'Do you want to install our user-interface programs [yes]? ' ! read doui ! case "$doui" in ! ''|y*|Y*) doui=yes ; pgmdirs="$pgmdirs rna" ;; ! *) doui=no ;; ! esac ! ! echo ! case "$doui" in ! no) echo 'The "inews" command(s) should' ;; ! *) echo 'The "inews", "postnews", "readnews", and "checknews" commands should' ;; ! esac echo 'go in one of the directories searched for normal commands, so users' echo 'can run them without special arrangements. What directory should' *************** *** 748,763 **** esac ! echo ! echo 'Postnews can supply a default newsgroup, to assist naive users in' ! echo 'getting the group right for simple postings. What should the default' ! ./query 'newsgroup for postnews be [no default]? ' ! read postdefltgroup ! echo ! echo 'Postnews can supply a default distribution, to restrict news to a' ! echo 'local area unless the user specifically changes it. This is probably' ! echo 'a good idea. What should the default distribution for postnews' ! ./query 'be [world]? ' ! read postdefltdist echo --- 765,784 ---- esac ! case "$doui" in ! yes) ! echo ! echo 'Postnews can supply a default newsgroup, to aid naive users in' ! echo 'getting this right for simple postings. What should the default' ! ./query 'newsgroup for postnews be [no default]? ' ! read postdefltgroup ! echo ! echo 'Postnews can supply a default distribution, to limit news to a' ! echo 'local area unless the user specifically changes it. This is' ! echo 'probably wise. What should the default postnews distribution' ! ./query 'be [world]? ' ! read postdefltdist ! ;; ! esac echo *************** *** 771,775 **** case "$answer" in n*|N*|'') ;; ! *) echo 'You should substitute relay/ihave.not.c for relay/ihave.c' echo 'before running doit.bin, so that ihave/sendme is disabled' echo 'at your site.' --- 792,796 ---- case "$answer" in n*|N*|'') ;; ! *) echo 'You may want to substitute relay/ihave.not.c for relay/ihave.c' echo 'before running doit.bin, so that ihave/sendme is disabled' echo 'at your site.' *************** *** 859,866 **** echo 'case "$1" in' echo '-*s*) ;;' ! echo '*) make substs ;;' echo 'esac' else ! echo ": make substs not necessary, defaults used" fi echo ": done" --- 880,887 ---- echo 'case "$1" in' echo '-*s*) ;;' ! echo '*) make substs || exit 1 ;;' echo 'esac' else ! echo ": make substs || exit 1 not necessary, defaults used" fi echo ": done" *************** *** 867,873 **** echo ": making spacefor, queuelen, etc...." echo "rm -f spacefor queuelen hostname setnewsids" ! echo "make spacefor.$dftype" echo "cp spacefor.$dftype spacefor" ! echo "make queuelen.$uucptype" echo "cp queuelen.$uucptype queuelen" if test " $hostname" = " y" --- 888,894 ---- echo ": making spacefor, queuelen, etc...." echo "rm -f spacefor queuelen hostname setnewsids" ! echo "make spacefor.$dftype || exit 1" echo "cp spacefor.$dftype spacefor" ! echo "make queuelen.$uucptype || exit 1" echo "cp queuelen.$uucptype queuelen" if test " $hostname" = " y" *************** *** 901,905 **** if test " $ranlib" = " y" then ! echo "make ../ranlibed" fi echo ': library done' --- 922,926 ---- if test " $ranlib" = " y" then ! echo "make ../ranlibed || exit 1" fi echo ': library done' *************** *** 922,926 **** if test " $sete" != " y" then ! echo "make setnewsids NEWSUSER=$newsuid NEWSGROUP=$newsgid $cc $copts $postlibs" fi echo "for dir in $pgmdirs" --- 943,947 ---- if test " $sete" != " y" then ! echo "make setnewsids NEWSUSER=$newsuid NEWSGROUP=$newsgid $cc $copts $postlibs || exit 1" fi echo "for dir in $pgmdirs" *************** *** 927,931 **** echo "do" echo " cd ../\$dir" ! echo " make all $dbm $cc $copts $postlibs" echo "done" echo ": done" --- 948,952 ---- echo "do" echo " cd ../\$dir" ! echo " make all $dbm $cc $copts $postlibs || exit 1" echo "done" echo ": done" *************** *** 955,960 **** fi echo "echo '$whoami' >whoami" ! echo "echo 'general 00000 00000 y' >active" ! echo "echo 'news.announce.newusers 00000 00000 y' >>active" echo ">errlog" echo ">history" --- 976,981 ---- fi echo "echo '$whoami' >whoami" ! echo "echo 'general 0000000000 0000000001 y' >active" ! echo "echo 'news.announce.newusers 0000000000 0000000001 y' >>active" echo ">errlog" echo ">history" *************** *** 972,976 **** 40 * 1-31 * 0-6 su news -c '$newsbin/batch/sendbatches' 59 0 1-31 * 0-6 su news -c '$newsbin/expire/doexpire' ! 45 3 1-31 * 0-6 su news -c '$newsbin/expire/superkludge comp.mail.maps' 10 8 1-31 * 0-6 su news -c '$newsbin/maint/newsdaily' 00 5,13,21 1-31 * 0-6 su news -c '$newsbin/maint/newswatch' --- 993,997 ---- 40 * 1-31 * 0-6 su news -c '$newsbin/batch/sendbatches' 59 0 1-31 * 0-6 su news -c '$newsbin/expire/doexpire' ! 45 3 1-31 * 0-6 su news -c '$newsbin/expire/superkludge comp.mail.maps news.announce.newusers' 10 8 1-31 * 0-6 su news -c '$newsbin/maint/newsdaily' 00 5,13,21 1-31 * 0-6 su news -c '$newsbin/maint/newswatch' *************** *** 986,990 **** echo "do" echo " cd ../\$dir" ! echo " make bininstall BIN=$bin RBIN=$rbin $dbm" echo "done" echo ": done" --- 1007,1011 ---- echo "do" echo " cd ../\$dir" ! echo " make bininstall BIN=$bin RBIN=$rbin $dbm || exit 1" echo "done" echo ": done" *************** *** 991,997 **** echo ': installing manual pages' echo 'cd ../man' for chap in $chaps do ! for f in `ls ../man | egrep "\.$chap\$"` do echo "cp $f $manpages/man$chap/$f" --- 1012,1022 ---- echo ': installing manual pages' echo 'cd ../man' + case "$doui" in + yes) exclude='!!nothing!!' ;; + no) exclude='^postnews\.' ;; + esac for chap in $chaps do ! for f in `ls ../man | egrep -v "$exclude" | egrep "\.$chap\$"` do echo "cp $f $manpages/man$chap/$f" *************** *** 1018,1022 **** echo "do" echo " cd ../\$dir" ! echo " make newsinstall BIN=$bin RBIN=$rbin $dbm" echo "done" echo ": done" --- 1043,1047 ---- echo "do" echo " cd ../\$dir" ! echo " make newsinstall BIN=$bin RBIN=$rbin $dbm || exit 1" echo "done" echo ": done" *** cnpatch/tmp.file Tue Aug 22 14:06:07 1989 --- conf/config.proto Mon Aug 14 13:23:58 1989 *************** *** 3,6 **** --- 3,12 ---- # available everywhere immediately # + # This is not, repeat NOT, a master control file for all of C News. + # This is the shell equivalent of libcnews/config.c, a "subroutine + # library" that gives shell files access to the default settings and + # lets environment variables override the defaults. Changing the + # defaults here will *NOT* change them throughout C News. + # # =()<NEWSCTL=${NEWSCTL-@<NEWSCTL>@}>()= NEWSCTL=${NEWSCTL-/usr/lib/news} *** cnpatch/tmp.file Tue Aug 22 14:06:11 1989 --- conf/spacefor.proto Sun Aug 20 01:08:15 1989 *************** *** 37,41 **** incoming) arg="$NEWSARTS/in.coming" ; desire=5000 ;; articles) arg="$NEWSARTS" ; desire=5000 ;; ! control) arg="$NEWSCTL" ; desire=3000 ;; outbound) arg="/usr/spool/uucp" ; desire=10000 ;; # ignore $3 archive) arg="$NEWSARTS" ; desire=1 ;; # system-specific --- 37,41 ---- incoming) arg="$NEWSARTS/in.coming" ; desire=5000 ;; articles) arg="$NEWSARTS" ; desire=5000 ;; ! control) arg="$NEWSCTL" ; desire=3000 ;; # for expire, mostly outbound) arg="/usr/spool/uucp" ; desire=10000 ;; # ignore $3 archive) arg="$NEWSARTS" ; desire=1 ;; # system-specific *** cnpatch/tmp.file Tue Aug 22 14:06:12 1989 --- conf/subst.gc Mon Aug 21 18:43:45 1989 *************** *** 16,18 **** relay/sh/inews rna/makefile ! relay/sh/postnews --- 16,18 ---- relay/sh/inews rna/makefile ! rna/postnews *** cnpatch/tmp.file Tue Aug 22 14:06:29 1989 --- doc/interface Sat Aug 19 23:26:32 1989 *************** *** 1,3 **** ! .DA "4 July 1989" .TL The Interface Between C News And The Outside World --- 1,3 ---- ! .DA "19 Aug 1989" .TL The Interface Between C News And The Outside World *************** *** 130,137 **** That is, with news's standard PATH, if .DS ! echo hi there Joe | mail joe .DE ! does not result in the message ``hi there Joe'' arriving in the mailbox ``joe'', you're going to have to fake it. See \fIDirectory Layout\fR for insight on where to put a fake \fImail\fR so that C News components will use it rather than \fI/bin/mail\fR. --- 130,140 ---- That is, with news's standard PATH, if .DS ! echo "relaynews: hi there Joe" | mail joe .DE ! does not result in the message ``relaynews: hi there Joe'' ! arriving in the mailbox ``joe'', you're going to have to fake it. + (Note that some BSD mailers run into trouble with the colon in the example, + interpreting such a line as a header.) See \fIDirectory Layout\fR for insight on where to put a fake \fImail\fR so that C News components will use it rather than \fI/bin/mail\fR. *** cnpatch/tmp.file Tue Aug 22 14:06:33 1989 --- expire/Makefile Mon Aug 21 14:50:57 1989 *************** *** 10,15 **** superkludge upact doexpire mkadir DTR = README Makefile dircheck doexpire expire.c histdups histinfo.c \ ! histslash.c lowest.c mkdbm.c mkhistory pgood superkludge tgood upact \ ! mkadir # =()<NEWSARTS = @<NEWSARTS>@>()= NEWSARTS = /usr/spool/news --- 10,16 ---- superkludge upact doexpire mkadir DTR = README Makefile dircheck doexpire expire.c histdups histinfo.c \ ! histslash.c mkdbm.c mkhistory pgood superkludge tgood upact \ ! mkadir updatemin.c ! UPACT=upact # =()<NEWSARTS = @<NEWSARTS>@>()= NEWSARTS = /usr/spool/news *************** *** 21,37 **** SHELL = /bin/sh ! all: $(THEM) chmod +x $(THEM) ! bininstall: $(THEM) explist.proto -if test ! -d $(NEWSBIN)/expire ; then mkdir $(NEWSBIN)/expire; fi cp $(THEM) $(NEWSBIN)/expire newsinstall: explist.proto -if test ! -r $(NEWSCTL)/explist ; then cp explist.proto $(NEWSCTL)/explist ; fi - cmp: $(THEM) - -for f in $(THEM) ; do cmp $$f $(NEWSBIN)/expire/$$f ; done - expire: expire.o $(LIBS) $(CC) $(LDFLAGS) expire.o $(PRE) $(LIBS) $(DBM) $(POST) -o $@ --- 22,38 ---- SHELL = /bin/sh ! all: $(THEM) explist.proto chmod +x $(THEM) ! bininstall: $(THEM) -if test ! -d $(NEWSBIN)/expire ; then mkdir $(NEWSBIN)/expire; fi cp $(THEM) $(NEWSBIN)/expire + cmp: $(THEM) + for f in $(THEM) ; do cmp $(NEWSBIN)/expire/$$f $$f ; done + newsinstall: explist.proto -if test ! -r $(NEWSCTL)/explist ; then cp explist.proto $(NEWSCTL)/explist ; fi expire: expire.o $(LIBS) $(CC) $(LDFLAGS) expire.o $(PRE) $(LIBS) $(DBM) $(POST) -o $@ *************** *** 40,45 **** $(CC) $(LDFLAGS) histinfo.o $(PRE) $(LIBS) $(POST) -o $@ ! lowest: lowest.o $(LIBS) ! $(CC) $(LDFLAGS) lowest.o $(PRE) $(LIBS) $(POST) -o $@ histslash: histslash.o $(LIBS) --- 41,46 ---- $(CC) $(LDFLAGS) histinfo.o $(PRE) $(LIBS) $(POST) -o $@ ! updatemin: updatemin.o $(LIBS) ! $(CC) $(LDFLAGS) updatemin.o $(PRE) $(LIBS) $(POST) -o $@ histslash: histslash.o $(LIBS) *************** *** 98,102 **** echo 'foo 00099 00001 y' >>active.after echo 'bar 00099 00000 m' >>active ! echo 'bar 00099 00099 m' >>active.after echo 'bar.ugh 00099 00000 m' >>active echo 'bar.ugh 00099 00099 m' >>active.after --- 99,103 ---- echo 'foo 00099 00001 y' >>active.after echo 'bar 00099 00000 m' >>active ! echo 'bar 00099 00100 m' >>active.after echo 'bar.ugh 00099 00000 m' >>active echo 'bar.ugh 00099 00099 m' >>active.after *************** *** 108,112 **** echo 'mod.unmod 00016 00016 y' >>active.after echo 'bletch 00099 00000 y' >>active ! echo 'bletch 00099 00099 y' >>active.after echo '<wont1> 9999~- foo/1' >>history.proto echo :foo/1: >arts/foo/1 --- 109,113 ---- echo 'mod.unmod 00016 00016 y' >>active.after echo 'bletch 00099 00000 y' >>active ! echo 'bletch 00099 00100 y' >>active.after echo '<wont1> 9999~- foo/1' >>history.proto echo :foo/1: >arts/foo/1 *************** *** 187,191 **** # the regression test proper ! r: $(THEM) dircheck setup tgood pgood chmod +x dircheck $(THEM) $(RUN) -c explist --- 188,192 ---- # the regression test proper ! r: $(THEM) $(UPACT) dircheck setup tgood pgood chmod +x dircheck $(THEM) $(RUN) -c explist *************** *** 213,217 **** cmp history history.after : "that's it for expire, on to upact" ! $(D) ./upact cmp active active.after : "and for upact, on to mkhistory" --- 214,218 ---- cmp history history.after : "that's it for expire, on to upact" ! $(D) ./$(UPACT) cmp active active.after : "and for upact, on to mkhistory" *************** *** 230,233 **** --- 231,254 ---- : "success!" + # variant regression test for -r + rr: $(THEM) $(UPACT) dircheck setup tgood pgood + chmod +x dircheck $(THEM) + $(RUN) -p -r explist >test.out 2>test.stderr + test ! -s test.stderr ; + cmp test.out pgood + cmp history.proto history + egrep wont history.proto | ./dircheck arts + egrep 'will|two|gone|three' history.proto | ./dircheck -n arts + egrep will history.proto | ./dircheck arch + egrep 'wont|two|gone|three' history.proto | ./dircheck -n arch + egrep two history.proto | ./dircheck arch2 + egrep 'will|wont|gone|three' history.proto | ./dircheck -n arch2 + egrep three history.proto | ./dircheck arch3 + egrep 'will|wont|gone|two' history.proto | ./dircheck -n arch3 + test -f arts/foo/99 ; + test -f arts/bar/ugh/99 ; + test -f arch2/bar/99 ; + test ! -f arts/urp/99 ; + tidy: rm -f junk history history.pag history.dir history.o active *************** *** 237,242 **** clean: tidy ! rm -f *.o expire histslash mkdbm histinfo lowest explist.proto ! rm -f dtr spotless: clean # don't run this unless you know what you're doing --- 258,263 ---- clean: tidy ! rm -f *.o expire histslash mkdbm histinfo explist.proto ! rm -f dtr updatemin spotless: clean # don't run this unless you know what you're doing *** cnpatch/tmp.file Tue Aug 22 14:06:35 1989 --- expire/README Sun Aug 20 01:24:03 1989 *************** *** 22,28 **** dircheck checks the results of expire regression testing. histdups, histinfo, histslash, and mkdbm are parts of mkhistory. ! lowest is an optimized version of part of upact -- it's faster, but it's also the only thing in C News that needs to know how to read directories, which is a portability hassle, so it's not the default. pgood and tgood are regression-test output-should-look-like-this files. mkadir is what expire invokes to create archiving subdirectories. --- 22,31 ---- dircheck checks the results of expire regression testing. histdups, histinfo, histslash, and mkdbm are parts of mkhistory. ! updatemin is a C version of upact -- it's vastly faster, but it's also the only thing in C News that needs to know how to read directories, which is a portability hassle, so it's not the default. + Compile it with -DBERKDIR if you have 4BSD directory functions + rather than standard (POSIX) ones. "make r UPACT=updatemin" + will include it in the regression test. pgood and tgood are regression-test output-should-look-like-this files. mkadir is what expire invokes to create archiving subdirectories. *** cnpatch/tmp.file Tue Aug 22 14:06:38 1989 --- expire/expire.c Sun Aug 20 03:21:09 1989 *************** *** 75,78 **** --- 75,79 ---- int leaders = 0; /* only first link ("leader") is hard link */ int verbose = 0; /* report statistics */ + int rebuild = 1; /* rebuild history files */ long nkept = 0; /* count of articles not expired */ *************** *** 165,169 **** ftime(&ftnow); ! while ((c = getopt(argc, argv, "pa:sF:cn:tlvd")) != EOF) switch (c) { case 'p': /* print info line for archived articles */ --- 166,170 ---- ftime(&ftnow); ! while ((c = getopt(argc, argv, "pa:sF:cn:tlvrd")) != EOF) switch (c) { case 'p': /* print info line for archived articles */ *************** *** 194,197 **** --- 195,201 ---- verbose = 1; break; + case 'r': /* suppress history-file rebuild */ + rebuild = 0; + break; case 'd': /* debug */ expdebug = 1; *************** *** 431,444 **** if (old < 0) fail("cannot open `%s'", "history"); ! (void) unlink("history.n"); ! (void) unlink("history.n.dir"); ! (void) unlink("history.n.pag"); ! if (spacetight) ! (void) unlink("history.o"); ! new = eufopen("history.n", "w"); ! (void) fclose(eufopen("history.n.dir", "w")); ! (void) fclose(eufopen("history.n.pag", "w")); ! if (dbminit("history.n") < 0) ! fail("dbminit(history.n) failed", ""); cd(artfile((char *)NULL)); --- 435,450 ---- if (old < 0) fail("cannot open `%s'", "history"); ! if (rebuild) { ! (void) unlink("history.n"); ! (void) unlink("history.n.dir"); ! (void) unlink("history.n.pag"); ! if (spacetight) ! (void) unlink("history.o"); ! new = eufopen("history.n", "w"); ! (void) fclose(eufopen("history.n.dir", "w")); ! (void) fclose(eufopen("history.n.pag", "w")); ! if (dbminit("history.n") < 0) ! fail("dbminit(history.n) failed", ""); ! } cd(artfile((char *)NULL)); *************** *** 445,449 **** while ((line = readline(old)) != NULL) { line = doline(line); ! if (line != NULL) { /* extract the message-id */ nameend = strchr(line, '\t'); --- 451,455 ---- while ((line = readline(old)) != NULL) { line = doline(line); ! if (line != NULL && rebuild) { /* extract the message-id */ nameend = strchr(line, '\t'); *************** *** 469,474 **** fputs(line, new); putc('\n', new); - free(line); } } /* side effect of readline() == NULL: newslock() */ --- 475,481 ---- fputs(line, new); putc('\n', new); } + if (line != NULL) + free(line); } /* side effect of readline() == NULL: newslock() */ *************** *** 475,504 **** (void) close(old); ! eufclose(new, "history.n"); if (testing) return; ! cd(ctlfile((char *)NULL)); ! (void) unlink("history.o"); ! if (link("history", "history.o") < 0) ! fail("can't move history", ""); ! if (unlink("history") < 0) ! fail("can't finish moving history", ""); ! if (link("history.n", "history") < 0) ! fail("disaster -- can't reinstate history!", ""); ! if (unlink("history.n") < 0) ! fail("disaster -- can't unlink history.n!", ""); ! if (unlink("history.dir") < 0) ! fail("disaster -- can't unlink history.dir!", ""); ! if (unlink("history.pag") < 0) ! fail("disaster -- can't unlink history.pag!", ""); ! if (link("history.n.dir", "history.dir") < 0) ! fail("disaster -- can't reinstate history.dir!", ""); ! if (link("history.n.pag", "history.pag") < 0) ! fail("disaster -- can't reinstate history.pag!", ""); ! if (unlink("history.n.dir") < 0) ! fail("disaster -- can't unlink history.n.dir!", ""); ! if (unlink("history.n.pag") < 0) ! fail("disaster -- can't unlink history.n.pag!", ""); } --- 482,514 ---- (void) close(old); ! if (rebuild) ! eufclose(new, "history.n"); if (testing) return; ! if (rebuild) { ! cd(ctlfile((char *)NULL)); ! (void) unlink("history.o"); ! if (link("history", "history.o") < 0) ! fail("can't move history", ""); ! if (unlink("history") < 0) ! fail("can't finish moving history", ""); ! if (link("history.n", "history") < 0) ! fail("disaster -- can't reinstate history!", ""); ! if (unlink("history.n") < 0) ! fail("disaster -- can't unlink history.n!", ""); ! if (unlink("history.dir") < 0) ! fail("disaster -- can't unlink history.dir!", ""); ! if (unlink("history.pag") < 0) ! fail("disaster -- can't unlink history.pag!", ""); ! if (link("history.n.dir", "history.dir") < 0) ! fail("disaster -- can't reinstate history.dir!", ""); ! if (link("history.n.pag", "history.pag") < 0) ! fail("disaster -- can't reinstate history.pag!", ""); ! if (unlink("history.n.dir") < 0) ! fail("disaster -- can't unlink history.n.dir!", ""); ! if (unlink("history.n.pag") < 0) ! fail("disaster -- can't unlink history.n.pag!", ""); ! } } *** cnpatch/tmp.file Tue Aug 22 14:06:42 1989 --- expire/histinfo.c Tue Aug 22 13:48:05 1989 *************** *** 67,71 **** char *inname; { ! char *nl, *files; char line[MAXLINE], msgid[MAXLINE], expiry[MAXLINE]; char datercv[30]; --- 67,71 ---- char *inname; { ! char *nl, *name; char line[MAXLINE], msgid[MAXLINE], expiry[MAXLINE]; char datercv[30]; *************** *** 74,77 **** --- 74,78 ---- static char expnm[] = "Expires: "; register char *p; + static char trash[] = "<swill@trash>"; extern char *strrchr(); extern char *strchr(); *************** *** 80,84 **** /* set defaults */ (void) strcpy(expiry, "-"); ! (void) strcpy(msgid, "<swill@trash>"); /* read until EOF or blank line (end of headers) */ --- 81,85 ---- /* set defaults */ (void) strcpy(expiry, "-"); ! (void) strcpy(msgid, trash); /* read until EOF or blank line (end of headers) */ *************** *** 93,100 **** /* generate the file name */ ! files = inname; ! if (strncmp(files, spdir, spdirlen) == 0 && ! files[spdirlen] == '/') ! files += spdirlen + 1; /* skip spool dir. & slash */ /* generate the date received */ --- 94,101 ---- /* generate the file name */ ! name = inname; ! if (strncmp(name, spdir, spdirlen) == 0 && ! name[spdirlen] == '/') ! name += spdirlen + 1; /* skip spool dir. & slash */ /* generate the date received */ *************** *** 106,109 **** --- 107,116 ---- *p = ' '; + /* deal with empty and trash articles */ + if (strcmp(msgid, trash) == 0) { + (void) sprintf(msgid, "<%s@trash>", name); + (void) sprintf(datercv, "0"); /* expire at once */ + } + /* whomp out the history line */ (void) fputs(msgid, stdout); *************** *** 113,117 **** (void) fputs(expiry, stdout); (void) putchar('\t'); ! (void) fputs(files, stdout); (void) putchar('\n'); (void) fflush(stdout); --- 120,124 ---- (void) fputs(expiry, stdout); (void) putchar('\t'); ! (void) fputs(name, stdout); (void) putchar('\n'); (void) fflush(stdout); *** cnpatch/tmp.file Tue Aug 22 14:06:46 1989 --- expire/mkdbm.c Sun Aug 20 00:45:54 1989 *************** *** 25,29 **** close(creat("hist.dir", 0666)); close(creat("hist.pag", 0666)); ! dbminit("hist"); for (;;) { --- 25,30 ---- close(creat("hist.dir", 0666)); close(creat("hist.pag", 0666)); ! if (dbminit("hist") < 0) ! error("unable to do dbminit(\"hist\")", ""); for (;;) { *** cnpatch/tmp.file Tue Aug 22 14:06:47 1989 --- expire/mkhistory Tue Aug 22 14:04:51 1989 *************** *** 27,35 **** cd $NEWSCTL ! if egrep '^<swill@trash> ' history.n >/dev/null then ! echo "$0: <swill@trash> found in history.n -- aborting" >&2 ! echo "$0: (some article lacks a Message-ID)" >&2 ! exit 1 fi mkdbm <history.n --- 27,34 ---- cd $NEWSCTL ! if egrep '^<[^>]*@trash> ' history.n >/dev/null then ! echo "$0: (warning) empty/trash articles found, will expire at once" >&2 ! echo "$0: (grep history file for '@trash' to see them)" >&2 fi mkdbm <history.n *** cnpatch/tmp.file Tue Aug 22 14:06:51 1989 --- expire/upact Sun Aug 20 00:37:04 1989 *************** *** 39,47 **** if test -d $NEWSARTS/$dir then - # min=`lowest $NEWSARTS/$dir` min=`ls $NEWSARTS/$dir | egrep '^[0-9]+$' | sort -nr | tail -1` fi ! case "$min" in # no files, so ! "") min=$max ;; # use maximum esac case "$min" in --- 39,46 ---- if test -d $NEWSARTS/$dir then min=`ls $NEWSARTS/$dir | egrep '^[0-9]+$' | sort -nr | tail -1` fi ! case "$min" in # no files, so use max+1 ! "") min=`awk "END{ print $max + 1 }" /dev/null` ;; esac case "$min" in *** cnpatch/tmp.file Tue Aug 22 14:07:03 1989 --- input/Makefile Tue Aug 8 12:24:05 1989 *************** *** 25,32 **** rnews.8 bdecode.c recenews recpnews ! all: $(THEM) rnews ! chmod +x $(THEM) rnews ! bininstall: $(THEM) rnews -if test ! -d $(NEWSBIN)/input ; then mkdir $(NEWSBIN)/input ; fi rm -f $(NEWSBIN)/input/newsspool --- 25,32 ---- rnews.8 bdecode.c recenews recpnews ! all: $(THEM) ! chmod +x $(THEM) ! bininstall: $(THEM) -if test ! -d $(NEWSBIN)/input ; then mkdir $(NEWSBIN)/input ; fi rm -f $(NEWSBIN)/input/newsspool *************** *** 35,38 **** --- 35,44 ---- cp rnews $(RBIN)/cunbatch : "and newsspool needs to be made setuid-news" + + cmp: $(THEM) + for f in $(THEM) ; do cmp $(NEWSBIN)/input/$$f $$f ; done + cmp rnews $(RBIN)/rnews + cmp rnews $(RBIN)/cunbatch + ls -lg $(NEWSBIN)/input/newsspool | egrep -s '^-rwsrwsr-x 1 news news' newsinstall: *** cnpatch/tmp.file Tue Aug 22 14:07:06 1989 --- input/newsrun Wed Aug 9 16:01:45 1989 *************** *** 35,39 **** server=`cat $NEWSCTL/server` else ! me=me # don't need actual name server="$me" # no server file --> we're it fi --- 35,39 ---- server=`cat $NEWSCTL/server` else ! me=thishost # don't need actual name server="$me" # no server file --> we're it fi *************** *** 62,65 **** --- 62,66 ---- # Do it. + tmp=nruntmp.$$ rmlist= for f in $them *************** *** 68,89 **** if test -r stop then ! rm -f $rmlist exit 0 fi - # Check for empty. - if test ! -s $f - then - rm -f $f - continue # NOTE CONTINUE - fi - # Space check, if we're close. if test " $muchroom" != " y" then batchsize=`sizeof $f` if test " `spacefor $batchsize articles`" -le 0 then ! rm -f $rmlist exit 0 fi --- 69,85 ---- if test -r stop then ! rm -f $tmp $rmlist exit 0 fi # Space check, if we're close. if test " $muchroom" != " y" then + rm -f $tmp $rmlist # free up what we can + rmlist= batchsize=`sizeof $f` if test " `spacefor $batchsize articles`" -le 0 then ! # already removed $tmp $rmlist exit 0 fi *************** *** 93,109 **** # uncompressed batches and never use c7 encoding might # want to remove the c7decode attempt to speed things up. ! text=nruntmp.$$ if compress -d <$f >$text 2>/dev/null then ! rmlist="$rmlist $f $text" elif c7decode <$f 2>/dev/null | compress -d >$text 2>/dev/null then ! rmlist="$rmlist $f $text" else - rm -f $text text=$f - rmlist="$rmlist $f" fi # Do it. -r redirects stdout and stderr into logs. -n makes # history entries for refused articles; this is right for --- 89,110 ---- # uncompressed batches and never use c7 encoding might # want to remove the c7decode attempt to speed things up. ! text=$tmp if compress -d <$f >$text 2>/dev/null then ! : okay elif c7decode <$f 2>/dev/null | compress -d >$text 2>/dev/null then ! : okay else text=$f fi + rmlist="$rmlist $f" + # Check for empty. + if test ! -s $text + then + continue # NOTE CONTINUE + fi + # Do it. -r redirects stdout and stderr into logs. -n makes # history entries for refused articles; this is right for *************** *** 138,142 **** mv $f $bad # Not $text, save the ORIGINAL! fi ! echo "$server $consumer \`$bad' failed, status $st" | mail "$NEWSMASTER" fi --- 139,143 ---- mv $f $bad # Not $text, save the ORIGINAL! fi ! echo "$server relaynews \`$bad' failed, status $st" | mail "$NEWSMASTER" fi *************** *** 143,147 **** done ! rm -f $rmlist done --- 144,148 ---- done ! rm -f $tmp $rmlist done *** cnpatch/tmp.file Tue Aug 22 14:07:08 1989 --- input/newsspool.c Sun Aug 20 00:43:48 1989 *************** *** 197,202 **** extern int errno; ! if (fclose(f) == EOF) ! error("fclose error on file `%s'", tmpname); p = fullartfile("in.coming/"); --- 197,202 ---- extern int errno; ! if (nfclose(f) == EOF) ! error("close error on file `%s'", tmpname); p = fullartfile("in.coming/"); *** cnpatch/tmp.file Tue Aug 22 14:07:49 1989 --- man/inews.1 Sun Aug 6 00:42:31 1989 *************** *** 7,11 **** .\" =()<.ds m @<NEWSMASTER>@>()= .ds m usenet ! .TH INEWS 1 "6 July 1989" "C News" .SH NAME inews \- `user-friendly' news-posting front-end for relaynews --- 7,11 ---- .\" =()<.ds m @<NEWSMASTER>@>()= .ds m usenet ! .TH INEWS 1 "6 Aug 1989" "C News" .SH NAME inews \- `user-friendly' news-posting front-end for relaynews *************** *** 177,185 **** and .B \-C ! generates ! .BI "Control: newgroup" " newsgroup" ! and ! .BI "Newsgroups:" " newsgroup" ! headers. .SH FILES .PD 0 --- 177,186 ---- and .B \-C ! tells you to use ! .I addgroup ! for local group creations ! and tells you what to feed to ! .B "inews -h" ! for global ones. .SH FILES .PD 0 *************** *** 213,217 **** .SH "SEE ALSO" .IR mail (1), ! .IR rnews (1) .SH DIAGNOSTICS .I inews --- 214,219 ---- .SH "SEE ALSO" .IR mail (1), ! .IR rnews (1), ! .IR newsaux (8) .SH DIAGNOSTICS .I inews *** cnpatch/tmp.file Tue Aug 22 14:07:51 1989 --- man/newsaux.8 Sat Aug 19 23:10:27 1989 *************** *** 7,11 **** .\" =()<.ds m @<NEWSMASTER>@>()= .ds m usenet ! .TH NEWSAUX 8 "4 July 1989" "C News" .SH NAME spacefor \- check available space for news --- 7,11 ---- .\" =()<.ds m @<NEWSMASTER>@>()= .ds m usenet ! .TH NEWSAUX 8 "19 Aug 1989" "C News" .SH NAME spacefor \- check available space for news *************** *** 34,37 **** --- 34,39 ---- .br addgroup, delgroup \- add and delete newsgroups, locally only + .br + adddirs \- make any missing directories for active newsgroups .SH SYNOPSIS .B \*b/spacefor *************** *** 79,82 **** --- 81,86 ---- .B \*b/maint/delgroup group + .br + .B \*b/maint/adddirs .SH DESCRIPTION These programs are minor utilities used by various parts of C News. *************** *** 180,183 **** --- 184,197 ---- 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 *************** *** 217,220 **** --- 231,238 ---- are unfortunately somewhat system-specific, since \fIdf\fR output and \fIuucp\fR file layout vary between different versions. + .PP + .I Queuelen + probably ought to count bytes rather than batches, but that would make + its system-dependency even worse. .PP The need for \fIsizeof\fR and \fInewslock\fR is a botch. *** cnpatch/tmp.file Tue Aug 22 14:07:52 1989 --- man/newsbatch.8 Sun Aug 20 03:24:09 1989 *************** *** 7,11 **** .\" =()<.ds m @<NEWSMASTER>@>()= .ds m usenet ! .TH NEWSBATCH 8 "17 July 1989" "C News" .SH NAME sendbatches, batchsplit \- news batching to other sites --- 7,11 ---- .\" =()<.ds m @<NEWSMASTER>@>()= .ds m usenet ! .TH NEWSBATCH 8 "19 Aug 1989" "C News" .SH NAME sendbatches, batchsplit \- news batching to other sites *************** *** 17,21 **** c7encode, bencode \- compressed-news-batch encoding .br ! viauux, viainews, viamail, viapmail \- news-batch transmission .SH SYNOPSIS .B \*b/batch/sendbatches --- 17,23 ---- c7encode, bencode \- compressed-news-batch encoding .br ! viauux, viauuxz, viainews \- news-batch transmission ! .br ! viamail, viaemail, viapmail \- news-batch transmission via mail .SH SYNOPSIS .B \*b/batch/sendbatches *************** *** 63,66 **** --- 65,71 ---- .B \&.../viauux site + .br + .B \&.../viauuxz + site .br .B \&.../viainews *************** *** 70,73 **** --- 75,81 ---- site .br + .B \&.../viaemail + site + .br .B \&.../viapmail site *************** *** 202,205 **** --- 210,216 ---- .IP viauux 9 normal transmission via UUCP + .IP viauuxz + 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 viainews feed the batch back to \fIinews\fR, ignoring the \fIsite\fR argument *************** *** 207,210 **** --- 218,223 ---- .IP viamail mail the batch to \fIsite\fB!rnews\fR + .IP viaemail + mail the batch to \fIsite\fB!enews\fR .IP viapmail mail the batch to \fIsite\fB!rnews\fR, attempting to *************** *** 266,268 **** .PP \fIViapmail\fR is obsolescent; ! \fIviamail\fR with a batch encoded with \fIbencode\fR is vastly superior. --- 279,281 ---- .PP \fIViapmail\fR is obsolescent; ! \fIviaemail\fR with a batch encoded with \fIbencode\fR is vastly superior. *** cnpatch/tmp.file Tue Aug 22 14:07:56 1989 --- misc/Makefile Sat Aug 19 20:43:05 1989 *************** *** 12,16 **** MAINTBIN=newshist ! MAINT = $(MAINTBIN) newsdaily newswatch newsboot locknews addgroup delgroup UTILBIN = gngp newslock ctime getdate UTILS = $(UTILBIN) sizeof newshostname --- 12,16 ---- MAINTBIN=newshist ! MAINT = $(MAINTBIN) newsdaily newswatch newsboot locknews addgroup delgroup adddirs UTILBIN = gngp newslock ctime getdate UTILS = $(UTILBIN) sizeof newshostname *************** *** 26,29 **** --- 26,33 ---- cp $(MAINT) $(NEWSBIN)/maint cp $(UTILS) $(NEWSBIN) + + cmp: $(THEM) + for f in $(MAINT) ; do cmp $(NEWSBIN)/maint/$$f $$f ; done + for f in $(UTILS) ; do cmp $(NEWSBIN)/$$f $$f ; done newsinstall: *** cnpatch/tmp.file Tue Aug 22 14:08:00 1989 --- misc/addgroup Wed Aug 16 15:52:50 1989 *************** *** 48,52 **** done ! echo "$1 0000000000 0000000000 $2" >>$NEWSCTL/active mkpdir $NEWSARTS/`echo $1 | tr . /` --- 48,52 ---- done ! echo "$1 0000000000 0000000001 $2" >>$NEWSCTL/active mkpdir $NEWSARTS/`echo $1 | tr . /` *** cnpatch/tmp.file Tue Aug 22 14:08:04 1989 --- misc/newsdaily Sat Aug 19 20:34:19 1989 *************** *** 53,70 **** # look for input anomalies cd $NEWSARTS/in.coming ! them="`ls | egrep -v '^bad$'`" ! if test " $them" != " " then ! find $them -mtime +1 -print >$tmp # old non-bad files lying about ! if test -s $tmp ! then ! ( ! echo 'old input files:' ! cat $tmp ! echo ! ) >>$gripes ! fi fi ! find bad -type f -mtime -2 -print >$tmp # recent bad batches if test -s $tmp then --- 53,66 ---- # look for input anomalies cd $NEWSARTS/in.coming ! find . -type f -mtime +1 -print | sed 's;^\./;;' | egrep -v '^bad/' >$tmp ! if test -s $tmp # old non-bad files lying about then ! ( ! echo 'old input files:' ! cat $tmp ! echo ! ) >>$gripes fi ! find bad -type f -name '[0-9]*' -mtime -2 -print >$tmp # recent bad batches if test -s $tmp then *************** *** 75,83 **** ) >>$gripes fi ! find bad -type f -mtime +7 -exec rm -f '{}' ';' # look for output anomalies cd $NEWSARTS/out.going ! find * -type f -name 'togo*' -size +0 -mtime +1 -print >$tmp if test -s $tmp then --- 71,79 ---- ) >>$gripes fi ! find bad -type f -name '[0-9]*' -mtime +7 -exec rm -f '{}' ';' # look for output anomalies cd $NEWSARTS/out.going ! find . -type f -name 'togo*' -size +0 -mtime +1 -print >$tmp if test -s $tmp then *************** *** 84,88 **** ( echo 'batching possibly stalled for sites:' ! sed 's;/.*;;' $tmp | sort -u echo ) >>$gripes --- 80,97 ---- ( echo 'batching possibly stalled for sites:' ! sed 's;^\./\([^/]*\)/.*;\1;' $tmp | sort -u ! echo ! ) >>$gripes ! fi ! ! # look for unknown newsgroups on input (misses cross-posted articles) ! cd $NEWSCTL ! egrep '`' log.o | egrep junked | sed 's/.*`\(.*\)'"'"'.*/\1/' | sort | ! uniq -c | sort -nr | sed 5q >$tmp ! if test -s $tmp ! then ! ( ! echo 'leading five unknown newsgroups by number of articles:' ! cat $tmp echo ) >>$gripes *** cnpatch/tmp.file Tue Aug 22 14:08:19 1989 --- relay/README Mon Aug 21 18:45:01 1989 *************** *** 11,15 **** ctl control-message shell files altctl alternative, not recommended, versions of rmgroup and sendgroups ! sh shell files, including inews and postnews and their flunkies regress regression-test facilities for relaynews --- 11,15 ---- ctl control-message shell files altctl alternative, not recommended, versions of rmgroup and sendgroups ! sh shell files, including inews and its flunkies regress regression-test facilities for relaynews *** cnpatch/tmp.file Tue Aug 22 14:08:32 1989 --- relay/control.c Sat Aug 5 23:32:52 1989 *************** *** 186,189 **** --- 186,190 ---- (void) fprintf(stderr, "%s: control `%s' looks unsafe to execute\n", progname, ctlcmd); + (void) fflush(stderr); _exit(1); } *************** *** 193,196 **** --- 194,198 ---- if (cmd == NULL) { warning("can't allocate memory in runctlmsg", ""); + (void) fflush(stderr); _exit(1); } *************** *** 228,231 **** --- 230,234 ---- if (mailcmd == NULL) { warning("can't allocate memory in bombctlmsg", ""); + (void) fflush(stderr); _exit(1); } *************** *** 237,240 **** --- 240,244 ---- "%s: control message `%s' exited with status 0%o\n", progname, cmd, cmdstat); + (void) fflush(mailf); if (mailf != stderr) (void) pclose(mailf); *** cnpatch/tmp.file Tue Aug 22 14:08:35 1989 --- relay/ctl/newgroup Wed Aug 16 15:53:05 1989 *************** *** 47,51 **** *) flag=y ;; esac ! echo "$1 0000000000 0000000000 $flag" >>$NEWSCTL/active (echo "$1 `getdate now` $SENDER" >>$NEWSCTL/active.times) # rn hook # make the directory since rn will bitch if it's missing --- 47,51 ---- *) flag=y ;; esac ! echo "$1 0000000000 0000000001 $flag" >>$NEWSCTL/active (echo "$1 `getdate now` $SENDER" >>$NEWSCTL/active.times) # rn hook # make the directory since rn will bitch if it's missing *** cnpatch/tmp.file Tue Aug 22 14:08:44 1989 --- relay/makefile Mon Aug 21 17:31:00 1989 *************** *** 75,80 **** cp ctl/* $(NEWSBIN)/ctl cp aux/* $(NEWSBIN)/relay ! ln $(NEWSBIN)/inject/postnews $(BIN)/postnews || cp sh/postnews $(BIN) ln $(NEWSBIN)/inject/inews $(BIN)/inews || cp sh/inews $(BIN) TODO.grep: TODO --- 75,88 ---- cp ctl/* $(NEWSBIN)/ctl cp aux/* $(NEWSBIN)/relay ! rm -f $(BIN)/inews ln $(NEWSBIN)/inject/inews $(BIN)/inews || cp sh/inews $(BIN) + + cmp: relaynews + cmp $(NEWSBIN)/relay/relaynews relaynews + ls -lg $(NEWSBIN)/relay/relaynews | egrep -s '^-rwsrwsr-x 1 news news' + for f in `ls sh` ; do cmp $(NEWSBIN)/inject/$$f sh/$$f ; done + for f in `ls ctl` ; do cmp $(NEWSBIN)/ctl/$$f ctl/$$f ; done + for f in `ls aux` ; do cmp $(NEWSBIN)/relay/$$f aux/$$f ; done + cmp $(BIN)/inews sh/inews TODO.grep: TODO *** cnpatch/tmp.file Tue Aug 22 14:09:04 1989 --- relay/sh/defhdrs.awk Mon Aug 7 01:49:14 1989 *************** *** 25,28 **** --- 25,33 ---- sendername = "Sender:" + # nullify headers with empty contents + for (i in hdrval) + if (hdrval[i] ~ /^[^\t ]*:[\t ]*$/) + hdrval[i] = "" + # fill in missing headers if (hdrval[typoname] != "") { # spelling hack *************** *** 36,47 **** hdrval[msgidname] = hdrval[msgidname] " " fields[i] } if (hdrval[msgidname] == "") hdrval[msgidname] = msgidname " " defmsgid if (hdrval[orgname] == "") hdrval[orgname] = orgname " " deforg - - # replace users headers (if any) - hdrval[datename] = datename " " defdate - hdrval[pathname] = pathname " " defpath if (hdrval[fromname] == "") hdrval[fromname] = fromname " " deffrom --- 41,52 ---- hdrval[msgidname] = hdrval[msgidname] " " fields[i] } + if (hdrval[pathname] == "") + hdrval[pathname] = pathname " " defpath if (hdrval[msgidname] == "") hdrval[msgidname] = msgidname " " defmsgid + if (hdrval[datename] == "") + hdrval[datename] = datename " " defdate if (hdrval[orgname] == "") hdrval[orgname] = orgname " " deforg if (hdrval[fromname] == "") hdrval[fromname] = fromname " " deffrom *************** *** 48,51 **** --- 53,58 ---- else if (hdrval[sendername] == "") hdrval[sendername] = sendername " " deffrom + + # replace user's headers (if any) [this is not currently done] # snuff some headers *** cnpatch/tmp.file Tue Aug 22 14:09:05 1989 --- relay/sh/inews Mon Aug 7 01:50:19 1989 *************** *** 22,26 **** relayopts=-i # redirect stdout to log - whoami=/tmp/in$$who # just created to determine effective uid input=/tmp/in$$in # uncensored input inhdrs=/tmp/in$$hdr # generated by tear: headers --- 22,25 ---- *************** *** 31,36 **** exitflag=/tmp/in$$exit # exit status, if present outfile=/tmp/in$$out # relaynews stdout grpok=/tmp/in$$grp # flag file: groups okay if present - rmlist="$inhdrs $inbody $input $censart $nglist $modroute $exitflag $outfile $grpok" umask $NEWSUMASK --- 30,35 ---- exitflag=/tmp/in$$exit # exit status, if present outfile=/tmp/in$$out # relaynews stdout + rmlist="$inhdrs $inbody $input $censart $nglist $modroute $exitflag $outfile" grpok=/tmp/in$$grp # flag file: groups okay if present umask $NEWSUMASK *************** *** 87,108 **** -o) shift; ORGANIZATION="$1"; export ORGANIZATION ;; ! -C) # megakludge-o-rama ! # first, permit only to super-users ! >$whoami ! case "`ls -l $whoami | awk '{print $3}'`" in ! root) : a winner ;; ! *) ! echo "$0: only super-users may create news groups" >&2 ! exit 1 ! ;; ! esac ! rm -f $whoami ! shift # skip -C to get ng as $1 ! cat <<! >>$input # generate a control message ! Newsgroups: $1 ! Control: newgroup $1 ! Subject: newgroup $1 ! Approved: above-user@above-host ! ;; -*) --- 86,103 ---- -o) shift; ORGANIZATION="$1"; export ORGANIZATION ;; ! -C) ! echo "$0: you either want to use addgroup (see newsaux(8)) to make" >&2 ! echo "$0: $2 locally or this to make it network-wide:" >&2 ! cat <<eg ! inews -h <<'!' ! Control: newgroup $2 ! Subject: newgroup $2 ! Newsgroups: $2 ! Approved: you@hostname ! ! Non-empty. ! + eg + exit 1 ;; -*) *************** *** 219,223 **** # n, x and (unapproved) m flags are dealt with on the spot; if none are # seen, the article is posted normally. ! # escape egrep metacharacters. In theory one could add " ' ` \ egreppat="^(` sed -e 's/[.+*()|[]/\\\\&/g' -e 's/,/|/g' <$nglist `) " egrep "$egreppat" $NEWSCTL/active >/dev/null || { --- 214,218 ---- # n, x and (unapproved) m flags are dealt with on the spot; if none are # seen, the article is posted normally. ! # escape egrep metacharacters. In theory one could add " ' ` \ to the list. egreppat="^(` sed -e 's/[.+*()|[]/\\\\&/g' -e 's/,/|/g' <$nglist `) " egrep "$egreppat" $NEWSCTL/active >/dev/null || { *************** *** 233,238 **** [nx]) echo "$0: sorry, $ng may not be posted to locally." >&2 echo 1 >$exitflag - trap 0 # this is a child process - no cleanup exit 1 # dregs in /tmp/in$$* ;; --- 228,233 ---- [nx]) echo "$0: sorry, $ng may not be posted to locally." >&2 + trap 0 # this is a child process - no cleanup here echo 1 >$exitflag exit 1 # dregs in /tmp/in$$* ;; *************** *** 267,273 **** echo "$0: mailing your article to $moderator" >&2 mail $moderator <$censart ! rm -f $rmlist echo 0 >$exitflag - trap 0 # this is a child process - did cleanup exit 0 fi --- 262,267 ---- echo "$0: mailing your article to $moderator" >&2 mail $moderator <$censart ! trap 0 # this is a child process - no cleanup here echo 0 >$exitflag exit 0 fi *************** *** 288,297 **** exit 1 # abnormal exit - cleans up, makes dead.article fi if test -f $exitflag; then exitstatus="`cat $exitflag`" case "$exitstatus" in ! 0) trap 0 ;; # normal exit - cleanup done, no dead.article esac ! exit $exitstatus # trap 0 will cleanup, make dead.article fi --- 282,292 ---- exit 1 # abnormal exit - cleans up, makes dead.article fi + rm -f $grpok if test -f $exitflag; then exitstatus="`cat $exitflag`" case "$exitstatus" in ! 0) rm -f $rmlist; trap 0 ;; # normal exit - cleanup, no dead.article esac ! exit $exitstatus # trap 0 may cleanup, make dead.article fi *** cnpatch/tmp.file Tue Aug 22 14:09:19 1989 --- rna/makefile Mon Aug 21 19:31:57 1989 *************** *** 24,28 **** FILES = help LCOMMANDS = postnews.lint uurec.lint readnews.lint uusend.lint expire.lint ! PFILES = header.c postnews.c funcs.c active.c history.c maketime.c mtempnam.c RFILES = header.c readnews.c funcs.c active.c newsrc.c history.c maketime.c ROFILES= header.o readnews.o funcs.o active.o newsrc.o history.o maketime.o --- 24,29 ---- FILES = help LCOMMANDS = postnews.lint uurec.lint readnews.lint uusend.lint expire.lint ! # PFILES = header.c postnews.c funcs.c active.c history.c maketime.c mtempnam.c ! PFILES = header.c funcs.c active.c history.c maketime.c mtempnam.c RFILES = header.c readnews.c funcs.c active.c newsrc.c history.c maketime.c ROFILES= header.o readnews.o funcs.o active.o newsrc.o history.o maketime.o *************** *** 39,44 **** $(INSTALL) -c $*.sh bin 755 $@ ! all: readnews checknews ! chmod +x checknews : warning, defs.h may not be right for your system --- 40,45 ---- $(INSTALL) -c $*.sh bin 755 $@ ! all: readnews checknews postnews ! chmod +x checknews postnews : warning, defs.h may not be right for your system *************** *** 52,56 **** # bininstall: make directories, install programs bininstall: install ! install: $(BINDIR)/readnews $(BINDIR)/checknews $(BINDIR)/readnews: readnews cp readnews $(BINDIR) --- 53,57 ---- # bininstall: make directories, install programs bininstall: install ! install: $(BINDIR)/readnews $(BINDIR)/checknews $(BINDIR)/postnews $(BINDIR)/readnews: readnews cp readnews $(BINDIR) *************** *** 58,62 **** --- 59,70 ---- $(BINDIR)/checknews: checknews cp checknews $(BINDIR) + $(BINDIR)/postnews: postnews + cp postnews $(BINDIR) + cmp: readnews checknews postnews + cmp $(BINDIR)/readnews readnews + cmp $(BINDIR)/checknews checknews + cmp $(BINDIR)/postnews postnews + defs.h: at.h # $C touch defs.h *************** *** 74,81 **** $(ROFILES): defs.h ! postnews: $(BINDIR)/postnews ! $(BINDIR)/postnews: $(PFILES) defs.h ! $(CC) $(CFLAGS) $(PFILES) -o postnews ! $(INSTALL) - postnews news 6711 $(BINDIR)/postnews postgroup: $(BINDIR)/postgroup --- 82,89 ---- $(ROFILES): defs.h ! # postnews: $(BINDIR)/postnews ! # $(BINDIR)/postnews: $(PFILES) defs.h ! # $(CC) $(CFLAGS) $(PFILES) -o postnews ! # $(INSTALL) - postnews news 6711 $(BINDIR)/postnews postgroup: $(BINDIR)/postgroup Files that are new: new expire/updatemin.c (patch can't create, so diff against null): Index: expire/updatemin.c *** cnpatch/tmp.preposterously.long.name.to.make.patch.behave.right Tue Aug 22 14:05:42 1989 --- expire/updatemin.c Sun Aug 20 00:53:41 1989 *************** *** 0 **** --- 1,211 ---- + /* + * updatemin - update the "min" fields in the active file + */ + + #include <stdio.h> + #include <sys/types.h> + #include <string.h> + #include <signal.h> + + #ifndef BERKDIR + #include <dirent.h> + #else + #include <sys/dir.h> + #define dirent direct + #endif + + #include "config.h" + #include "fgetmfs.h" + #include "alloc.h" + + void fail(); + void catch(); + void slash(); + long lowest(); + + char newname[] = "active.new"; + + char *progname; + + extern long atol(); + + /* + - main - parse arguments and handle options + */ + main(argc, argv) + int argc; + char *argv[]; + { + DIR *d; + register FILE *a; + register FILE *new; + char *line; + # define NF 4 + char *field[NF]; + register int nf; + register long min; + register char *name; + char minstr[6]; + + progname = argv[0]; + + cd(ctlfile((char *)NULL)); + (void) umask(newsumask()); + + catch(SIGINT); + catch(SIGQUIT); + catch(SIGHUP); + catch(SIGTERM); + newslock(); + + a = fopen("active", "r"); + if (a == NULL) + fail("cannot open `%s'", ctlfile("active")); + new = fopen(newname, "w"); + if (new == NULL) + fail("cannot create `%s'", ctlfile(newname)); + + cd(fullartfile((char *)NULL)); + while ((line = fgetms(a)) != NULL) { + nf = split(line, field, NF, " \t\n"); + if (nf != NF) + fail("bad number of fields in `%s ...'", field[0]); + name = strsave(field[0]); + slash(name); + d = opendir(artfile(name)); + if (d != NULL) { + min = lowest(d); + if (min < 0) /* no articles */ + min = atol(field[1])+1; + closedir(d); + } else /* no directory */ + min = atol(field[2]); + fprintf(new, "%s %s ", field[0], field[1]); + if (min < 10000) { /* insist on at least five digits */ + sprintf(minstr, "%ld", min); + fprintf(new, "%s", "00000"+strlen(minstr)); + } + fprintf(new, "%ld %s\n", min, field[3]); + free(name); + free(line); + } + + if (nfclose(new) == EOF) + fail("close failed on `%s'", ctlfile(newname)); + cd(ctlfile((char *)NULL)); + (void) unlink("active.old"); + if (link("active", "active.old") < 0) + fail("can't link `active' to `active.old'", ""); + if (unlink("active") < 0) + fail("can't unlink `active'", ""); + if (link(newname, "active") < 0) { + if (link("active.old", "active") < 0) + fail("disaster -- cannot recover `active'!!", ""); + else + fail("can't link in new `active' -- old one used", ""); + } + newsunlock(); + + exit(0); + } + + /* + - lowest - find numerically-lowest name in directory + */ + long /* lowest; -1 if none */ + lowest(d) + register DIR *d; + { + register struct dirent *dp; + register long this; + register long min = -1; + register int any = 0; + + while ((dp = readdir(d)) != NULL) { + if (strspn(dp->d_name, "0123456789") == strlen(dp->d_name)) { + this = atol(dp->d_name); + if (this < min || !any) { + min = this; + any = 1; + } + } + } + + return(min); + } + + /* + - split - divide a line into fields, like awk split() + */ + int /* number of fields */ + split(line, fields, nfmax, sep) + char *line; + char *fields[]; + int nfmax; + char *sep; + { + register int i; + register char *p; + + i = 0; + for (p = strtok(line, sep); p != NULL; p = strtok((char *)NULL, sep)) { + if (i < nfmax) + fields[i] = p; + i++; + } + + return(i); + } + + /* + - slash - convert dots to slashes in string + */ + void + slash(s) + char *s; + { + register char *p = s; + + while ((p = strchr(p, '.')) != NULL) + *p = '/'; + } + + /* + - interrupt - signal handler + */ + void + interrupt() + { + fail("interrupted", ""); + } + + /* + - catch - set up to catch a signal + */ + void + catch(sig) + int sig; + { + if (signal(sig, SIG_IGN) != SIG_IGN) + (void) signal(sig, interrupt); + } + + /* + - fail - some sort of error occurred + */ + void + fail(s1, s2) + char *s1; + char *s2; + { + /* possibly should rm newname, but it may be important evidence */ + errunlock(s1, s2); + } + + /* + - unprivileged - keep the configuration stuff happy + */ + void + unprivileged() + { + } new man/Makefile (patch can't create, so diff against null): Index: man/Makefile *** cnpatch/tmp.preposterously.long.name.to.make.patch.behave.right Tue Aug 22 14:05:42 1989 --- man/Makefile Sat Aug 19 20:47:51 1989 *************** *** 0 **** --- 1,4 ---- + cmp: + -for f in *.1 ; do echo --- $$f --- ; diff /usr/man/man1 $$f ; done + -for f in *.5 ; do echo --- $$f --- ; diff /usr/man/man5 $$f ; done + -for f in *.8 ; do echo --- $$f --- ; diff /usr/man/man8 $$f ; done new misc/adddirs (patch can't create, so diff against null): Index: misc/adddirs *** cnpatch/tmp.preposterously.long.name.to.make.patch.behave.right Tue Aug 22 14:05:42 1989 --- misc/adddirs Sat Aug 19 20:41:27 1989 *************** *** 0 **** --- 1,17 ---- + #! /bin/sh + # adddirs - add any directories needed for newsgroups in active file + + # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()= + . ${NEWSCONFIG-/usr/lib/news/bin/config} + + PATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH + umask $NEWSUMASK + + for dir in `sed 's/[ ].*//' $NEWSCTL/active | tr . /` + do + if test ! -d $NEWSARTS/$dir + then + echo "making $dir (and parents if needed...)" + : mkpdir $NEWSARTS/$dir + fi + done end of patch 22-Aug-1989 -- V7 /bin/mail source: 554 lines.| Henry Spencer at U of Toronto Zoology 1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu