home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume19 / cnews2 / pch23jun89 < prev    next >
Internet Message Format  |  1989-09-17  |  54KB

  1. From attcan!utzoo!henry@uunet.uu.net Wed Aug  9 10:39:34 1989
  2. Received: from BBN.COM by pineapple.bbn.com
  3.     id <AA14000@pineapple.bbn.com>; Wed, 9 Aug 89 10:39:14 -0400
  4. Received: from uunet.uu.net by BBN.COM id aa27369; 9 Aug 89 10:38 EDT
  5. Received: from attcan.UUCP by uunet.uu.net (5.61/1.14) with UUCP 
  6.     id AA02312; Wed, 9 Aug 89 10:36:39 -0400
  7. Date: Wed, 9 Aug 89 10:36:39 -0400
  8. From: attcan!utzoo!henry@uunet.uu.net
  9. Message-Id: <8908091436.AA02312@uunet.uu.net>
  10. To: source-patches@uunet.UU.NET
  11. Subject: C News patch of 23-Jun-1989 (cumulative to that time)
  12. Content-Type: text  
  13. Content-Length: 53332  
  14. Status: R
  15.  
  16. The following is the first formal, official patch to C News.  It includes
  17. the two small ones that Geoff posted earlier; we apologize for the slightly
  18. disorganized way that was done, but we were caught slightly unprepared.
  19.  
  20. It seems the copy of C News we sent to comp.sources.unix fell into a black
  21. hole due to a mailer foulup.  It is being re-sent, including this patch.
  22. Only people who picked up copies earlier, by FTP or UUCP, need this.
  23. Existing FTPable copies will be updated as soon as possible; if there is
  24. a PATCHDATES file immediately after the copyright notice, you've got a
  25. current one.  The compressed current distribution is 387157 bytes.
  26.  
  27. This patch fixes a double handful of small bugs, one or two of them serious.
  28. It also makes a few small improvements, including a considerable streamlining
  29. of the processing in newsrun.  Finally, it includes a later version of the
  30. fast-start modifications to rn.
  31.  
  32. Oh yes, and it also introduces a patch-tracking mechanism, date-based rather
  33. than numeric but with the same sort of functionality.
  34.  
  35.  
  36. start of patch 23-Jun-1989
  37. this should be run with   patch -p0 <thisfile
  38.  
  39. The following are obsolete and should be deleted (there is no
  40. easy way we can convince patch to do this automatically):
  41. relay/TODO
  42.  
  43. Changed files, if any:
  44.  
  45. *** cnpatch/tmp.file    Fri Jun 23 14:34:49 1989
  46. --- README    Thu Jun 22 14:11:05 1989
  47. ***************
  48. *** 27,38 ****
  49.   syndrome.)
  50.   
  51.   C News's files are fully compatible with those of B News for any program
  52. ! that does not inspect the middle field of the history file closely.  (The
  53. ! one major program that does is "nntp"; we include diffs for NNTP 1.5 which
  54. ! handle our middle-field format, interface it to our input subsystem, and
  55. ! generally make it quite a bit faster than the original.)  C News complies
  56. ! fully with RFC 1036 (nee RFC 850), the official definition of news interchange
  57. ! format.
  58.   
  59.   C News is, by intent and *we think* in practice, compatible with B News
  60.   at the level of most interfaces to the normal user, which basically means
  61. --- 27,38 ----
  62.   syndrome.)
  63.   
  64.   C News's files are fully compatible with those of B News for any program
  65. ! that does not read log files and does not inspect the middle field of the
  66. ! history file closely.  (The one major program that does is "nntp"; we include
  67. ! diffs for NNTP 1.5 which handle our middle-field format, interface it to
  68. ! our input subsystem, and generally make it quite a bit faster than the
  69. ! original.)  C News complies fully with RFC 1036 (nee RFC 850), the official
  70. ! definition of news interchange format.
  71.   
  72.   C News is, by intent and *we think* in practice, compatible with B News
  73.   at the level of most interfaces to the normal user, which basically means
  74.  
  75. *** cnpatch/tmp.file    Fri Jun 23 14:34:52 1989
  76. --- batch/Makefile    Thu Jun 22 15:31:35 1989
  77. ***************
  78. *** 83,92 ****
  79.       rm -rf bin
  80.       mkdir bin
  81.       echo 'ln $$* >/dev/null 2>/dev/null' >bin/newslock
  82. !     echo 'cat $*' >bin/munch
  83. !     echo '( echo --- ; cat $* ) >>output' >bin/xmit
  84. !     echo 'echo 2 ; cat $*' >bin/munch2
  85. !     echo '( echo +++ ; cat $* ) >>output' >bin/xmit2
  86.       echo 'echo 4' >bin/queuelen
  87.       echo 'echo 99' >bin/spacefor
  88.       ln batcher bin/batcher
  89. --- 83,92 ----
  90.       rm -rf bin
  91.       mkdir bin
  92.       echo 'ln $$* >/dev/null 2>/dev/null' >bin/newslock
  93. !     echo 'cat' >bin/munch
  94. !     echo '( echo --- ; cat ) >>output' >bin/xmit
  95. !     echo 'echo 2 ; cat' >bin/munch2
  96. !     echo '( echo +++ ; cat ) >>output' >bin/xmit2
  97.       echo 'echo 4' >bin/queuelen
  98.       echo 'echo 99' >bin/spacefor
  99.       ln batcher bin/batcher
  100.  
  101. *** cnpatch/tmp.file    Fri Jun 23 14:35:02 1989
  102. --- batch/viainews    Wed Jun 21 19:44:49 1989
  103. ***************
  104. *** 1,4 ****
  105.   #! /bin/sh
  106.   # Feed batch to inews, for ihave/sendme mostly.
  107.   
  108. ! exec inews -h
  109. --- 1,4 ----
  110.   #! /bin/sh
  111.   # Feed batch to inews, for ihave/sendme mostly.
  112.   
  113. ! exec inews -h -W
  114.  
  115. *** cnpatch/tmp.file    Fri Jun 23 14:35:06 1989
  116. --- conf/Makefile    Thu Jun 22 16:12:47 1989
  117. ***************
  118. *** 79,87 ****
  119.       rm -f log mailpaths sys cron rc setnewsids setnewsids.o spacefor.bsd
  120.       rm -f replyusepath spacefor queuelen junk
  121.   
  122. ! gclean:
  123.       rm -f ../libcnews.a ../ranlibed
  124.       rm -rf ../include
  125.       for d in $(DIRS) ; do cd ../$$d ; make clean ; done
  126.   
  127.   spotless:    gclean
  128. --- 79,89 ----
  129.       rm -f log mailpaths sys cron rc setnewsids setnewsids.o spacefor.bsd
  130.       rm -f replyusepath spacefor queuelen junk
  131.   
  132. ! gclean:    tidy
  133.       rm -f ../libcnews.a ../ranlibed
  134.       rm -rf ../include
  135. + tidy:
  136.       for d in $(DIRS) ; do cd ../$$d ; make clean ; done
  137.   
  138.   spotless:    gclean
  139.  
  140. *** cnpatch/tmp.file    Fri Jun 23 14:35:12 1989
  141. --- conf/build    Thu Jun 22 16:11:17 1989
  142. ***************
  143. *** 346,356 ****
  144.       *)    fake="$fake $fn.o"    ;;
  145.       esac
  146.   done
  147. ! ./query "Does your system have a library function ldiv() as in ANSI C? [yes]? "
  148.   read answer
  149.   case "$answer" in
  150. ! y*|Y*|'')    ;;
  151. ! *)    fake="$fake ldiv.o"    ;;
  152.   esac
  153.   ./query 'Does your system have the "dbm" library [yes]? '
  154.   read answer
  155. --- 346,355 ----
  156.       *)    fake="$fake $fn.o"    ;;
  157.       esac
  158.   done
  159. ! ./query "Does your system have a library function ldiv() as in ANSI C? [no]? "
  160.   read answer
  161.   case "$answer" in
  162. ! n*|N*|'')    fake="$fake ldiv.o"    ;;
  163.   esac
  164.   ./query 'Does your system have the "dbm" library [yes]? '
  165.   read answer
  166. ***************
  167. *** 364,369 ****
  168. --- 363,371 ----
  169.           ;;
  170.   *)    fake="$fake dbm.o"
  171.       dbm='DBM='
  172. +     echo "Okay, we'll fake it for you.  You might want to look at"
  173. +     echo "contrib/dbz, which is a probably-superior fake that we have"
  174. +     echo "not examined closely."
  175.       ;;
  176.   esac
  177.   
  178. ***************
  179. *** 409,415 ****
  180.       echo
  181.       echo 'A well-tuned index() function customized to a particular machine'
  182.       echo 'is usually faster than portable C.  Is your index() function'
  183. !     ./query 'indeed fast [yes]? '
  184.       read fastindex
  185.       case "$fastindex" in
  186.       y*|Y*|'')    fastindex=y    ;;
  187. --- 411,417 ----
  188.       echo
  189.       echo 'A well-tuned index() function customized to a particular machine'
  190.       echo 'is usually faster than portable C.  Is your index() function'
  191. !     ./query 'indeed fast (okay to guess) [yes]? '
  192.       read fastindex
  193.       case "$fastindex" in
  194.       y*|Y*|'')    fastindex=y    ;;
  195. ***************
  196. *** 882,888 ****
  197.       echo "rm -f $ctlf"
  198.       echo "cp config.proto config"
  199.       echo "echo '$mailname' >mailname"
  200. !     echo "echo '$organization' >organization"
  201.       if test " $allowed" != " "
  202.       then
  203.           echo "echo '$allowed' >allowed"
  204. --- 884,892 ----
  205.       echo "rm -f $ctlf"
  206.       echo "cp config.proto config"
  207.       echo "echo '$mailname' >mailname"
  208. !     echo "cat <<'!' >organization"
  209. !     echo "$organization"
  210. !     echo '!'
  211.       if test " $allowed" != " "
  212.       then
  213.           echo "echo '$allowed' >allowed"
  214.  
  215. *** cnpatch/tmp.file    Fri Jun 23 14:35:18 1989
  216. --- conf/setnewsids.c    Thu Jun 22 14:32:47 1989
  217. ***************
  218. *** 80,86 ****
  219.               newsgid = grp->gr_gid;
  220.           (void) endgrent();
  221.       }
  222. !     if (setgid(newsgid) < 0 || setuid(newsuid) < 0)
  223.           error("set[ug]id failed", "");
  224.       /* we are now running as news, so you can all relax */
  225.   }
  226. --- 80,87 ----
  227.               newsgid = grp->gr_gid;
  228.           (void) endgrent();
  229.       }
  230. !     if (setgid(newsgid) < 0 || setuid(newsuid) < 0 ||
  231. !         getgid() != newsgid || getuid() != newsuid)    /* xenix workaround */
  232.           error("set[ug]id failed", "");
  233.       /* we are now running as news, so you can all relax */
  234.   }
  235.  
  236. *** cnpatch/tmp.file    Fri Jun 23 14:35:22 1989
  237. --- contrib/dbz    Fri Jun 23 13:11:14 1989
  238. ***************
  239. *** 170,178 ****
  240.           lseek(Data_fd, data_ptr, 0);
  241.           read(Data_fd, buffer, (unsigned)key.dsize);
  242.   
  243. !         /* key should be lcase version of article id and no tab */
  244.   
  245. !         lcase(buffer, key.dsize);
  246.           if (buffer[key.dsize - 1] == '\t') {
  247.               buffer[key.dsize - 1] = '\0';
  248.           }
  249. --- 170,178 ----
  250.           lseek(Data_fd, data_ptr, 0);
  251.           read(Data_fd, buffer, (unsigned)key.dsize);
  252.   
  253. !         /* key should be article id and no tab */
  254.   
  255. !         /* lcase(buffer, key.dsize);    lcase is a B news botch */
  256.           if (buffer[key.dsize - 1] == '\t') {
  257.               buffer[key.dsize - 1] = '\0';
  258.           }
  259.  
  260. *** cnpatch/tmp.file    Fri Jun 23 14:35:34 1989
  261. --- contrib/rn.mod/README    Thu Jun 22 16:42:26 1989
  262. ***************
  263. *** 31,34 ****
  264.   group/1 will be around for a very long time, making rn spuriously think
  265.   that the old groups are new.  Proper fixes for this problem involve
  266.   reworking rn's strategy for determining new newsgroups completely,
  267. ! using the "active.times" file.  Volunteers?
  268. --- 31,35 ----
  269.   group/1 will be around for a very long time, making rn spuriously think
  270.   that the old groups are new.  Proper fixes for this problem involve
  271.   reworking rn's strategy for determining new newsgroups completely,
  272. ! using the "active.times" file.  The file "better.way" is an attempt
  273. ! to do exactly that.
  274.  
  275. *** cnpatch/tmp.file    Fri Jun 23 14:35:40 1989
  276. --- doc/interface    Thu Jun 22 14:08:40 1989
  277. ***************
  278. *** 183,188 ****
  279. --- 183,192 ----
  280.   Beware introducing major inefficiencies:
  281.   \fIspacefor\fR is called a lot.
  282.   (Our current one could stand to be faster, in fact.)
  283. + Beware, also, that \fIspacefor\fR is not intended to permit routine operation
  284. + using filesystems that are on the brink of being full;
  285. + the limits it imposes are only approximate, and no attempt has been made
  286. + to tune its clients to exploit every last available block.
  287.   .PP
  288.   \fIQueuelen\fR is invoked by the batcher to determine how long the current
  289.   \fIuucp\fR queues are, so it can judge whether it should suspend batching
  290.  
  291. *** cnpatch/tmp.file    Fri Jun 23 14:35:46 1989
  292. --- expire/dircheck    Thu Jun 22 15:23:30 1989
  293. ***************
  294. *** 30,32 ****
  295. --- 30,33 ----
  296.           fi
  297.       fi
  298.   done
  299. + exit 0                # for stupid shells
  300.  
  301. *** cnpatch/tmp.file    Fri Jun 23 14:35:48 1989
  302. --- expire/expire.c    Thu Jun 22 15:36:25 1989
  303. ***************
  304. *** 102,108 ****
  305. --- 102,112 ----
  306.    * and also large enough for virtual certainty of getting the
  307.    * Subject: line in the first bufferload.
  308.    */
  309. + #ifdef SMALLMEM
  310. + char abuf[2*1024];        /* expire reported to be tight on 11 */
  311. + #else
  312.   char abuf[8*1024];
  313. + #endif
  314.   
  315.   char *progname;
  316.   
  317.  
  318. *** cnpatch/tmp.file    Fri Jun 23 14:35:59 1989
  319. --- input/Makefile    Thu Jun 22 14:27:07 1989
  320. ***************
  321. *** 29,34 ****
  322. --- 29,35 ----
  323.   bininstall:    all
  324.       chmod +x $(THEM) rnews
  325.       -if test ! -d $(NEWSBIN)/input ; then mkdir $(NEWSBIN)/input ; fi
  326. +     rm -f $(NEWSBIN)/input/newsspool
  327.       cp $(THEM) $(NEWSBIN)/input
  328.       cp rnews $(RBIN)/rnews
  329.       cp rnews $(RBIN)/cunbatch
  330. ***************
  331. *** 95,106 ****
  332.       rm -rf bin
  333.       mkdir bin
  334.       cp $(THEM) bin
  335.       rm -f tmp.1
  336.       here=`pwd` ; echo "cat >>$$here/tmp.1" >bin/relaynews
  337.       echo "echo 1" >bin/spacefor
  338.       echo 'ln $$*' >bin/newslock
  339.       echo 'echo 10' >bin/sizeof
  340. !     chmod +x bin/*
  341.       rm -rf in.coming
  342.       mkdir in.coming
  343.   
  344. --- 96,109 ----
  345.       rm -rf bin
  346.       mkdir bin
  347.       cp $(THEM) bin
  348. +     mkdir bin/input
  349. +     cp newsrun bin/input
  350.       rm -f tmp.1
  351.       here=`pwd` ; echo "cat >>$$here/tmp.1" >bin/relaynews
  352.       echo "echo 1" >bin/spacefor
  353.       echo 'ln $$*' >bin/newslock
  354.       echo 'echo 10' >bin/sizeof
  355. !     chmod +x bin/* bin/input/*
  356.       rm -rf in.coming
  357.       mkdir in.coming
  358.   
  359. ***************
  360. *** 125,131 ****
  361.       rm tmp.1
  362.       NEWSARTS=`pwd` NEWSCTL=`pwd` ./rnews.batch <test.1
  363.       NEWSARTS=`pwd` NEWSCTL=`pwd` ./rnews.batch <test.2
  364. !     NEWSARTS=`pwd` NEWSCTL=`pwd` ./rnews.immed <test.3
  365.       cmp tmp.1 test.out
  366.       test " `echo in.coming/*`" = ' in.coming/bad'
  367.       rm tmp.1
  368. --- 128,134 ----
  369.       rm tmp.1
  370.       NEWSARTS=`pwd` NEWSCTL=`pwd` ./rnews.batch <test.1
  371.       NEWSARTS=`pwd` NEWSCTL=`pwd` ./rnews.batch <test.2
  372. !     NEWSARTS=`pwd` NEWSCTL=`pwd` NEWSBIN=`pwd`/bin ./rnews.immed <test.3
  373.       cmp tmp.1 test.out
  374.       test " `echo in.coming/*`" = ' in.coming/bad'
  375.       rm tmp.1
  376.  
  377. *** cnpatch/tmp.file    Fri Jun 23 14:36:01 1989
  378. --- input/newsrun    Fri Jun 23 12:42:42 1989
  379. ***************
  380. *** 28,95 ****
  381.       exit 0
  382.   fi
  383.   
  384. - # Get rid of any old temporaries.
  385. - rm -f nruntmp.*
  386. - for f in `ls | egrep '^nspool'`
  387. - do
  388. -     find $f -mtime +1 -exec rm -f '{}' ';'
  389. - done
  390.   # Sort out where we are.
  391. - me="`hostname`"
  392.   if test -r $NEWSCTL/server
  393.   then
  394.       server=`cat $NEWSCTL/server`
  395.   else
  396.       server="$me"        # no server file --> we're it
  397.   fi
  398.   
  399.   # Master loop.
  400. ! while true
  401.   do
  402.       # Find some work.
  403. !     them=`ls | egrep '^[0-9]+$' | sort | sed 50q`
  404. !     if test "$them" = ""
  405.       then
  406. !         break
  407.       fi
  408.   
  409.       # Do it.
  410.       for f in $them
  411.       do
  412.           # Check for request to stop.
  413.           if test -r stop
  414.           then
  415.               exit 0
  416.           fi
  417.   
  418. !         # Check space.  It is *probably* better to stop processing
  419. !         # when things get too full.  (This test is actually a bit
  420. !         # inaccurate since the batch may be compressed, but it's
  421. !         # good enough to catch major space problems.)
  422. !         batchsize=`sizeof $f`
  423. !         if test " $batchsize" -eq 0        # empty batch
  424.           then
  425.               rm -f $f
  426. !             continue        # ugh
  427.           fi
  428. !         if test " `spacefor $batchsize articles`" -le 0
  429.           then
  430. !             exit 0
  431.           fi
  432.   
  433. !         # Decompress if necessary.
  434.           text=nruntmp.$$
  435.           if compress -d <$f >$text 2>/dev/null
  436.           then
  437. !             rmlist="$f $text"
  438.           elif c7decode <$f 2>/dev/null | compress -d >$text 2>/dev/null
  439.           then
  440. !             rmlist="$f $text"
  441.           else
  442.               rm -f $text
  443.               text=$f
  444. !             rmlist="$f"
  445.           fi
  446.   
  447.           # Do it.  -r redirects stdout and stderr into logs.  -n makes
  448. --- 28,108 ----
  449.       exit 0
  450.   fi
  451.   
  452.   # Sort out where we are.
  453.   if test -r $NEWSCTL/server
  454.   then
  455. +     me="`hostname`"
  456.       server=`cat $NEWSCTL/server`
  457.   else
  458. +     me=me            # don't need actual name
  459.       server="$me"        # no server file --> we're it
  460.   fi
  461.   
  462.   # Master loop.
  463. ! while :                # "while true", but : is faster
  464.   do
  465.       # Find some work.
  466. !     them=`ls | sed '/[^0-9]/d;50q'`
  467. !     if test " $them" = " "
  468.       then
  469. !         break            # NOTE BREAK OUT
  470.       fi
  471.   
  472. +     # Check space.  It is *probably* better to stop processing
  473. +     # when things get too full.  (This test is actually a bit
  474. +     # inaccurate since the batches may be compressed, but it's
  475. +     # good enough to catch major space problems.)
  476. +     allsize=`sizeof $them`
  477. +     if test " `spacefor $allsize articles`" -gt 1    # lots of room
  478. +     then
  479. +         muchroom=y
  480. +     else
  481. +         muchroom=
  482. +     fi
  483.       # Do it.
  484. +     rmlist=
  485.       for f in $them
  486.       do
  487.           # Check for request to stop.
  488.           if test -r stop
  489.           then
  490. +             rm -f $rmlist
  491.               exit 0
  492.           fi
  493.   
  494. !         # Check for empty.
  495. !         if test ! -s $f
  496.           then
  497.               rm -f $f
  498. !             continue            # NOTE CONTINUE
  499.           fi
  500. !         # Space check, if we're close.
  501. !         if test " $muchroom" != " y"
  502.           then
  503. !             batchsize=`sizeof $f`
  504. !             if test " `spacefor $batchsize articles`" -le 0
  505. !             then
  506. !                 rm -f $rmlist
  507. !                 exit 0
  508. !             fi
  509.           fi
  510.   
  511. !         # Decompress if necessary.  People who get lots of
  512. !         # uncompressed batches and never use c7 encoding might
  513. !         # want to remove the c7decode attempt to speed things up.
  514.           text=nruntmp.$$
  515.           if compress -d <$f >$text 2>/dev/null
  516.           then
  517. !             rmlist="$rmlist $f $text"
  518.           elif c7decode <$f 2>/dev/null | compress -d >$text 2>/dev/null
  519.           then
  520. !             rmlist="$rmlist $f $text"
  521.           else
  522.               rm -f $text
  523.               text=$f
  524. !             rmlist="$rmlist $f"
  525.           fi
  526.   
  527.           # Do it.  -r redirects stdout and stderr into logs.  -n makes
  528. ***************
  529. *** 128,137 ****
  530.                               mail "$NEWSMASTER"
  531.           fi
  532.   
  533. -         rm -f $rmlist
  534.       done
  535.   done
  536. - find bad -mtime +7 -exec rm -f '{}' ';'
  537.   
  538.   exit 0
  539. --- 141,148 ----
  540.                               mail "$NEWSMASTER"
  541.           fi
  542.   
  543.       done
  544. +     rm -f $rmlist
  545.   done
  546.   
  547.   exit 0
  548.  
  549. *** cnpatch/tmp.file    Fri Jun 23 14:36:03 1989
  550. --- input/newsspool.c    Thu Jun 22 14:14:32 1989
  551. ***************
  552. *** 105,111 ****
  553.               }
  554.   
  555.       if (immed) {
  556. !         execlp("newsrun", "newsrun", (char *)NULL);
  557.           error("attempt to run newsrun failed!", "");
  558.       }
  559.       exit(0);
  560. --- 105,112 ----
  561.               }
  562.   
  563.       if (immed) {
  564. !         /* execlp because shell files may not be directly execable */
  565. !         execlp(binfile("input/newsrun"), "newsrun", (char *)NULL);
  566.           error("attempt to run newsrun failed!", "");
  567.       }
  568.       exit(0);
  569.  
  570. *** cnpatch/tmp.file    Fri Jun 23 14:36:19 1989
  571. --- libcnews/string.c    Thu Jun 22 14:34:38 1989
  572. ***************
  573. *** 166,172 ****
  574.       register int ch;
  575.   
  576.       for (; *path != '\0'; path++)
  577. !         if (nothostchar(path[0], ch) && hostchar(path[1], ch))
  578.               ++count;    /* trailing edge of delimiters */
  579.       return count;
  580.   }
  581. --- 166,173 ----
  582.       register int ch;
  583.   
  584.       for (; *path != '\0'; path++)
  585. !         if (nothostchar(path[0], ch) &&
  586. !             (hostchar(path[1], ch) || path[1] == '\0'))
  587.               ++count;    /* trailing edge of delimiters */
  588.       return count;
  589.   }
  590. ***************
  591. *** 195,203 ****
  592.   }
  593.   
  594.   /*
  595. !  * Canonicalise rawpath: NULL -> "", chop last site (actually user name),
  596. !  * and if approved:, chop everything after the site in approved (user@host):
  597. !  * (or sender).
  598.    * Result is malloced memory.
  599.    */
  600.   char *
  601. --- 196,204 ----
  602.   }
  603.   
  604.   /*
  605. !  * Canonicalise rawpath: NULL -> "", chop last site (actually user name) but not
  606. !  * its leading delimiter, and if Approved:, chop everything after the site,
  607. !  * and its trailing delimiter, from Approved: (or Sender:) (user@host).
  608.    * Result is malloced memory.
  609.    */
  610.   char *
  611. ***************
  612. *** 205,216 ****
  613.   char *rawpath, *approved, *sender;
  614.   {
  615.       register char *newpath = strsave(nullify(rawpath));
  616. !     register char *p, *lastdelim = NULL, *site = NULL;
  617.       register int ch;
  618.   
  619.       for (p = newpath; *p != '\0'; ++p)
  620.           if (nothostchar(*p, ch))
  621. !             lastdelim = p;
  622.       if (lastdelim != NULL)
  623.           *lastdelim = '\0';        /* omit user's name */
  624.   
  625. --- 206,217 ----
  626.   char *rawpath, *approved, *sender;
  627.   {
  628.       register char *newpath = strsave(nullify(rawpath));
  629. !     register char *p, *lastdelim = newpath, *site = NULL;
  630.       register int ch;
  631.   
  632.       for (p = newpath; *p != '\0'; ++p)
  633.           if (nothostchar(*p, ch))
  634. !             lastdelim = p + 1;    /* just past delim */
  635.       if (lastdelim != NULL)
  636.           *lastdelim = '\0';        /* omit user's name */
  637.   
  638. ***************
  639. *** 221,227 ****
  640.       }
  641.       if (site != NULL) {
  642.           p = findhost(site+1, newpath);
  643. !         if (p != NULL)
  644.               *p = '\0';        /* terminate newpath after site */
  645.       }
  646.       return newpath;
  647. --- 222,228 ----
  648.       }
  649.       if (site != NULL) {
  650.           p = findhost(site+1, newpath);
  651. !         if (p != NULL && *p++ != '\0')    /* delim after site? */
  652.               *p = '\0';        /* terminate newpath after site */
  653.       }
  654.       return newpath;
  655.  
  656. *** cnpatch/tmp.file    Fri Jun 23 14:36:44 1989
  657. --- man/newsaux.8    Thu Jun 22 12:57:24 1989
  658. ***************
  659. *** 6,12 ****
  660.   .ds c /usr/lib/news
  661.   .\" =()<.ds m @<NEWSMASTER>@>()=
  662.   .ds m usenet
  663. ! .TH NEWSAUX 8 "9 June 1989" "C News"
  664.   .SH NAME
  665.   spacefor \- check available space for news
  666.   .br
  667. --- 6,12 ----
  668.   .ds c /usr/lib/news
  669.   .\" =()<.ds m @<NEWSMASTER>@>()=
  670.   .ds m usenet
  671. ! .TH NEWSAUX 8 "22 June 1989" "C News"
  672.   .SH NAME
  673.   spacefor \- check available space for news
  674.   .br
  675. ***************
  676. *** 89,95 ****
  677.   The precise locations of these places, and how low space gets before
  678.   it is unduly cramped, are site-specific.
  679.   .I Spacefor
  680. ! invokes \fIdu\fR(1) to determine the available space.
  681.   .PP
  682.   .I Queuelen
  683.   reports how many news batches \fIuucp\fR has queued up for \fIsite\fR.
  684. --- 89,95 ----
  685.   The precise locations of these places, and how low space gets before
  686.   it is unduly cramped, are site-specific.
  687.   .I Spacefor
  688. ! invokes \fIdf\fR(1) to determine the available space.
  689.   .PP
  690.   .I Queuelen
  691.   reports how many news batches \fIuucp\fR has queued up for \fIsite\fR.
  692. ***************
  693. *** 212,218 ****
  694.   .I Spacefor
  695.   and
  696.   .I queuelen
  697. ! are unfortunately somewhat system-specific, since \fIdu\fR output and
  698.   \fIuucp\fR file layout vary between different versions.
  699.   .PP
  700.   The need for \fIsizeof\fR and \fInewslock\fR is a botch.
  701. --- 212,218 ----
  702.   .I Spacefor
  703.   and
  704.   .I queuelen
  705. ! are unfortunately somewhat system-specific, since \fIdf\fR output and
  706.   \fIuucp\fR file layout vary between different versions.
  707.   .PP
  708.   The need for \fIsizeof\fR and \fInewslock\fR is a botch.
  709.  
  710. *** cnpatch/tmp.file    Fri Jun 23 14:36:46 1989
  711. --- man/newsmail.8    Thu Jun 22 15:22:51 1989
  712. ***************
  713. *** 6,16 ****
  714.   .ds c /usr/lib/news
  715.   .\" =()<.ds m @<NEWSMASTER>@>()=
  716.   .ds m usenet
  717. ! .TH NEWSMAIL 8 "31 May 1989" "C News"
  718.   .SH NAME
  719.   mailnews, sendnews \- send unbatched news as mail
  720.   .br
  721.   recenews, recpnews \- receive mailed news
  722.   .SH SYNOPSIS
  723.   .B \*b/relay/mailnews
  724.   address ...
  725. --- 6,18 ----
  726.   .ds c /usr/lib/news
  727.   .\" =()<.ds m @<NEWSMASTER>@>()=
  728.   .ds m usenet
  729. ! .TH NEWSMAIL 8 "22 June 1989" "C News"
  730.   .SH NAME
  731.   mailnews, sendnews \- send unbatched news as mail
  732.   .br
  733.   recenews, recpnews \- receive mailed news
  734. + .br
  735. + bdecode \- decode encoded mailed news
  736.   .SH SYNOPSIS
  737.   .B \*b/relay/mailnews
  738.   address ...
  739. ***************
  740. *** 21,26 ****
  741. --- 23,31 ----
  742.   .B \*b/input/recenews
  743.   .br
  744.   .B \*b/input/recpnews
  745. + .br
  746. + .B \*b/input/bdecode
  747. + [ file ]
  748.   .SH DESCRIPTION
  749.   Sometimes it is necessary to transmit news via mail,
  750.   to deal with network connections that have no notion of arbitrary file
  751. ***************
  752. *** 57,63 ****
  753. --- 62,75 ----
  754.   is sent to \fIrecenews\fR
  755.   and likewise for ``rnews'' (the name is historical, for compatibility
  756.   again) and \fIrecpnews\fR.
  757. + .PP
  758. + .I Bdecode
  759. + passes standard input, or the \fIfile\fR if there is one, to standard
  760. + output, decoding the \fIbencode\fR encoding and stripping off
  761. + debris prepended and appended by mailers.
  762.   .SH SEE ALSO
  763.   bencode(1), mail(1), news(5), newsbatch(8), rnews(8)
  764.   .SH HISTORY
  765.   Written at U of Toronto by Henry Spencer, with contributions by Geoff Collyer.
  766. + .I Bdecode
  767. + written at University of Waterloo by Reg Quinton and Ken Lalonde.
  768.  
  769. *** cnpatch/tmp.file    Fri Jun 23 14:36:50 1989
  770. --- man/rnews.8    Thu Jun 22 15:20:42 1989
  771. ***************
  772. *** 6,17 ****
  773.   .ds c /usr/lib/news
  774.   .\" =()<.ds m @<NEWSMASTER>@>()=
  775.   .ds m usenet
  776. ! .TH RNEWS 8 "24 May 1989" "C News"
  777.   .SH NAME
  778.   rnews, cunbatch \- accept and spool news input
  779.   .br
  780. - recbnews, recpnews, bdecode \- accept and spool news received via mail
  781. - .br
  782.   newsspool, newsrun, c7decode \- news input spooler and processing
  783.   .br
  784.   newsrunning \- control news-processing daemon
  785. --- 6,15 ----
  786.   .ds c /usr/lib/news
  787.   .\" =()<.ds m @<NEWSMASTER>@>()=
  788.   .ds m usenet
  789. ! .TH RNEWS 8 "22 June 1989" "C News"
  790.   .SH NAME
  791.   rnews, cunbatch \- accept and spool news input
  792.   .br
  793.   newsspool, newsrun, c7decode \- news input spooler and processing
  794.   .br
  795.   newsrunning \- control news-processing daemon
  796. ***************
  797. *** 22,32 ****
  798.   .B cunbatch
  799.   [ file ... ]
  800.   .br
  801. - .B \*b/input/recbnews
  802. - .br
  803. - .B \*b/input/recpnews
  804. - .br
  805. - .br
  806.   .B \*b/input/newsspool
  807.   [
  808.   .B \-i
  809. --- 20,25 ----
  810. ***************
  811. *** 36,44 ****
  812.   .br
  813.   .B \*b/input/c7decode
  814.   .br
  815. - .B \*b/input/bdecode
  816. - [ file ]
  817. - .br
  818.   .B \*b/input/newsrunning
  819.   {\fBon\fR|\fBoff\fR}
  820.   .SH DESCRIPTION
  821. --- 29,34 ----
  822. ***************
  823. *** 50,62 ****
  824.   .IR rnews ;
  825.   there is no difference in what they do.
  826.   .PP
  827. - .I Recbnews
  828. - receives news sent as mail in
  829. - \fIbencode\fR format (see \fInewsbatch\fR(8)),
  830. - runs it through \fIbdecode\fR, and feeds it to \fIrnews\fR.
  831. - .I Recpnews
  832. - does likewise for news sent as mail with `N' prepended to each line.
  833. - .PP
  834.   .I Newsspool
  835.   is the actual spooling program.
  836.   It creates a spool file with a name based on the current time
  837. --- 40,45 ----
  838. ***************
  839. *** 99,108 ****
  840.   .I C7decode
  841.   passes standard input to standard output, decoding a complex and bizarre
  842.   encoding of 8-bit data as printable ASCII characters.
  843. - .I Bdecode
  844. - passes standard input, or the \fIfile\fR if there is one, to standard
  845. - output, decoding the \fIbencode\fR encoding and stripping off
  846. - debris prepended and appended by mailers.
  847.   .SH FILES
  848.   .nf
  849.   (All in \fI\*a/in.coming\fR)
  850. --- 82,87 ----
  851. ***************
  852. *** 115,120 ****
  853. --- 94,100 ----
  854.   .SH SEE ALSO
  855.   compress(1),
  856.   newsbatch(8),
  857. + newsmail(8),
  858.   relaynews(8)
  859.   .SH DIAGNOSTICS
  860.   Complaints are mailed to \fB\*m\fR if something goes wrong.
  861. ***************
  862. *** 124,130 ****
  863.   .SH BUGS
  864.   \fIC7decode\fR should be part of the underlying transport mechanism.
  865.   It hasn't been tested very well in the C News environment.
  866. ! \fIBencode\fR is probably better.
  867. ! .PP
  868. ! \fIRecpnews\fR and the protocol it uses are obsolescent,
  869. ! as \fIrecbnews\fR and \fIbdecode\fR are far superior.
  870. --- 104,107 ----
  871.   .SH BUGS
  872.   \fIC7decode\fR should be part of the underlying transport mechanism.
  873.   It hasn't been tested very well in the C News environment.
  874. ! \fIBdecode\fR (see \fInewsmail\fR(8)) is probably better for most uses.
  875.  
  876. *** cnpatch/tmp.file    Fri Jun 23 14:36:52 1989
  877. --- misc/addgroup    Thu Jun 22 15:06:04 1989
  878. ***************
  879. *** 4,10 ****
  880.   # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  881.   . ${NEWSCONFIG-/usr/lib/news/bin/config}
  882.   
  883. ! PATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN:$NEWSPATH ; export PATH
  884.   umask $NEWSUMASK
  885.   
  886.   usage="Usage: $0 groupname {y|n|m|x|=realgroup}"
  887. --- 4,10 ----
  888.   # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  889.   . ${NEWSCONFIG-/usr/lib/news/bin/config}
  890.   
  891. ! PATH=$NEWSCTL/bin:$NEWSBIN/maint:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH
  892.   umask $NEWSUMASK
  893.   
  894.   usage="Usage: $0 groupname {y|n|m|x|=realgroup}"
  895. ***************
  896. *** 48,50 ****
  897. --- 48,55 ----
  898.   done
  899.   
  900.   echo "$1 0000000000 0000000000 $2" >>$NEWSCTL/active
  901. + mkpdir $NEWSARTS/`echo $1 | tr . /`
  902. + SENDER=${USER-unknown}@`hostname`
  903. + echo "$1 `getdate now` $SENDER" >>$NEWSCTL/active.times  # rn hook
  904. + echo "newsgroup $1 was created locally by $SENDER." | mail $NEWSMASTER
  905.  
  906. *** cnpatch/tmp.file    Fri Jun 23 14:36:54 1989
  907. --- misc/newsboot    Fri Jun 23 12:29:14 1989
  908. ***************
  909. *** 10,19 ****
  910.   cd $NEWSCTL
  911.   rm -f L.* LOCK*                # leftover locks
  912.   rm -f history.n*            # leftover expire work files
  913. - rm -f $NEWSARTS/in.coming/nspool.*    # leftover input temporaries
  914.   
  915. - # nntp goo processing
  916.   cd $NEWSARTS/in.coming
  917.   for f in nntp.*                # find partial batches
  918.   do
  919.       while test -f $f        # still there?
  920. --- 10,18 ----
  921.   cd $NEWSCTL
  922.   rm -f L.* LOCK*                # leftover locks
  923.   rm -f history.n*            # leftover expire work files
  924.   
  925.   cd $NEWSARTS/in.coming
  926. + rm -f nspool.* nruntmp.*        # leftover temporaries
  927.   for f in nntp.*                # find partial batches
  928.   do
  929.       while test -f $f        # still there?
  930.  
  931. *** cnpatch/tmp.file    Fri Jun 23 14:36:55 1989
  932. --- misc/newsdaily    Fri Jun 23 12:29:41 1989
  933. ***************
  934. *** 68,73 ****
  935. --- 68,74 ----
  936.           echo
  937.       ) >>$gripes
  938.   fi
  939. + find bad -type f -mtime +7 -exec rm -f '{}' ';'
  940.   
  941.   # look for output anomalies
  942.   cd $NEWSARTS/out.going
  943.  
  944. *** cnpatch/tmp.file    Fri Jun 23 14:37:07 1989
  945. --- relay/README    Fri Jun 23 13:57:30 1989
  946. ***************
  947. *** 17,20 ****
  948.   wish to disable ihave/sendme (typically because of foolishness like
  949.   proprietary newsgroups).
  950.   
  951. ! To run a regression test, make relaynews, cd regress, and run "regress".
  952. --- 17,20 ----
  953.   wish to disable ihave/sendme (typically because of foolishness like
  954.   proprietary newsgroups).
  955.   
  956. ! To run a regression test, "make r".
  957.  
  958. *** cnpatch/tmp.file    Fri Jun 23 14:37:08 1989
  959. --- relay/active.c    Mon Jun 12 04:46:50 1989
  960. ***************
  961. *** 34,39 ****
  962. --- 34,43 ----
  963.   char actrelnm[] = "active";
  964.   
  965.   static FILE *actfp = NULL;
  966. + static struct lastngcache {
  967. +     char *lnc_ng;            /* newsgroup name */
  968. +     char *lnc_line;            /* matching active file line */
  969. + } lnc = { NULL, NULL };
  970.   
  971.   /*
  972.    * return a pointer to the active file entry for ng
  973. ***************
  974. *** 47,56 ****
  975.   {
  976.       register char *ngline, *ng, *flag;
  977.       register int loopbreak = 100;
  978. -     static struct lastngcache {
  979. -         char *lnc_ng;        /* newsgroup name */
  980. -         char *lnc_line;        /* matching active file line */
  981. -     } lnc = { NULL, NULL };
  982.   
  983.       if (lnc.lnc_ng != NULL && STREQ(lnc.lnc_ng, ang))
  984.           return lnc.lnc_line;
  985. --- 51,56 ----
  986. ***************
  987. *** 132,138 ****
  988.   }
  989.   
  990.   /*
  991. !  * Write back to disk the active file cache, if any.
  992.    */
  993.   statust
  994.   actsync()
  995. --- 132,139 ----
  996.   }
  997.   
  998.   /*
  999. !  * Write back to disk the active file cache, if any, and flush the
  1000. !  * last-newsgroup-cache, since it refers to the (now invalid) active file cache.
  1001.    */
  1002.   statust
  1003.   actsync()
  1004. ***************
  1005. *** 140,145 ****
  1006. --- 141,147 ----
  1007.       register statust status = ST_OKAY;
  1008.   
  1009.       if (actfp != NULL) {
  1010. +         lnc.lnc_ng = lnc.lnc_line = NULL;
  1011.           status |= actfsync(actfp);
  1012.           if (nfclose(actfp) == EOF || status != ST_OKAY) {
  1013.               warning("error writing `%s'", ctlfile(actrelnm));
  1014.  
  1015. *** cnpatch/tmp.file    Fri Jun 23 14:37:18 1989
  1016. --- relay/aux/mkpdir    Mon Jun 12 20:59:28 1989
  1017. ***************
  1018. *** 4,10 ****
  1019.   # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  1020.   . ${NEWSCONFIG-/usr/lib/news/bin/config}
  1021.   export NEWSCTL NEWSBIN NEWSARTS
  1022. ! PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH    # must include this file's dir.
  1023.   
  1024.   umask $NEWSUMASK
  1025.   
  1026. --- 4,10 ----
  1027.   # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  1028.   . ${NEWSCONFIG-/usr/lib/news/bin/config}
  1029.   export NEWSCTL NEWSBIN NEWSARTS
  1030. ! PATH=$NEWSCTL/bin:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH    # must include this file's dir.
  1031.   
  1032.   umask $NEWSUMASK
  1033.   
  1034.  
  1035. *** cnpatch/tmp.file    Fri Jun 23 14:37:22 1989
  1036. --- relay/control.c    Mon Jun 12 05:20:42 1989
  1037. ***************
  1038. *** 170,177 ****
  1039.    * runctlmsg is called from a child of relaynews, so it must always
  1040.    * call _exit() rather than exit() to avoid flushing stdio buffers.
  1041.    *
  1042. !  * Enforce at least minimal security: standardise the environment,
  1043. !  * including PATH and IFS using standard(), a local addition to libc;
  1044.    * reject shell metacharacters in ctlcmd.
  1045.    */
  1046.   STATIC void
  1047. --- 170,177 ----
  1048.    * runctlmsg is called from a child of relaynews, so it must always
  1049.    * call _exit() rather than exit() to avoid flushing stdio buffers.
  1050.    *
  1051. !  * Enforce at least minimal security: the environment was standardised at
  1052. !  * startup, including PATH and IFS; close non-standard file descriptors;
  1053.    * reject shell metacharacters in ctlcmd.
  1054.    */
  1055.   STATIC void
  1056. ***************
  1057. *** 181,187 ****
  1058.       register char *cmd;
  1059.       register int cmdstat;
  1060.   
  1061. !     standard();                /* close most files, etc. */
  1062.       if (!safecmd(ctlcmd)) {
  1063.           (void) fprintf(stderr,
  1064.               "%s: control `%s' looks unsafe to execute\n", progname, ctlcmd);
  1065. --- 181,187 ----
  1066.       register char *cmd;
  1067.       register int cmdstat;
  1068.   
  1069. !     closeall(1);
  1070.       if (!safecmd(ctlcmd)) {
  1071.           (void) fprintf(stderr,
  1072.               "%s: control `%s' looks unsafe to execute\n", progname, ctlcmd);
  1073.  
  1074. *** cnpatch/tmp.file    Fri Jun 23 14:37:23 1989
  1075. --- relay/ctl/checkgroups    Fri Jun 23 13:28:38 1989
  1076. ***************
  1077. *** 35,43 ****
  1078.       echo "The following newsgroups are not valid and should be removed."
  1079.       sed "s/^/    /" /tmp/$$remove
  1080.       echo ""
  1081. !     echo "You can do this by executing the command:"
  1082. !     echo "    $NEWSBIN/maint/rmgroup \\"
  1083. !     sed 's;.*;        & \\;' /tmp/$$remove
  1084.       echo ""
  1085.   fi 2>&1 >/tmp/$$out
  1086.   
  1087. --- 35,42 ----
  1088.       echo "The following newsgroups are not valid and should be removed."
  1089.       sed "s/^/    /" /tmp/$$remove
  1090.       echo ""
  1091. !     echo "You can do this by executing the commands:"
  1092. !     sed "s;.*;     $NEWSBIN/maint/delgroup &;" /tmp/$$remove
  1093.       echo ""
  1094.   fi 2>&1 >/tmp/$$out
  1095.   
  1096.  
  1097. *** cnpatch/tmp.file    Fri Jun 23 14:37:24 1989
  1098. --- relay/ctl/newgroup    Fri Jun 23 13:31:33 1989
  1099. ***************
  1100. *** 14,20 ****
  1101.   cat >$F
  1102.   
  1103.   # unapproved ctl msg? then quit
  1104. ! grep -s '^Approved:' $F || { rm -f $F; exit 0; }
  1105.   
  1106.   SENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1107.   case "$SENDER" in
  1108. --- 14,20 ----
  1109.   cat >$F
  1110.   
  1111.   # unapproved ctl msg? then quit
  1112. ! grep -s '^Approved:' $F >/dev/null || { rm -f $F; exit 0; }
  1113.   
  1114.   SENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1115.   case "$SENDER" in
  1116. ***************
  1117. *** 22,28 ****
  1118.   esac
  1119.   
  1120.   greppat="^`echo $1 | sed 's/\./\\\\./g' ` "
  1121. ! if grep -s "$greppat" $NEWSCTL/active; then    # group exists?
  1122.       export SENDER
  1123.       chamod "$1" "$2"         # change moderated flag if needed
  1124.       exit
  1125. --- 22,28 ----
  1126.   esac
  1127.   
  1128.   greppat="^`echo $1 | sed 's/\./\\\\./g' ` "
  1129. ! if grep -s "$greppat" $NEWSCTL/active >/dev/null; then    # group exists?
  1130.       export SENDER
  1131.       chamod "$1" "$2"         # change moderated flag if needed
  1132.       exit
  1133.  
  1134. *** cnpatch/tmp.file    Fri Jun 23 14:37:31 1989
  1135. --- relay/makefile    Fri Jun 23 13:56:50 1989
  1136. ***************
  1137. *** 67,72 ****
  1138. --- 67,73 ----
  1139.   install: $(NEWSBIN)/relay/relaynews
  1140.   $(NEWSBIN)/relay/relaynews: relaynews
  1141.       -mkdir $(NEWSBIN)/relay $(NEWSBIN)/inject $(NEWSBIN)/ctl
  1142. +     rm -f $(NEWSBIN)/relay/relaynews
  1143.       cp relaynews $(NEWSBIN)/relay
  1144.       : needs to be news-owned, setuid -- build looks after that
  1145.       chmod +x sh/* aux/* ctl/*
  1146. ***************
  1147. *** 96,102 ****
  1148.       (echo relaynews update of `date`; echo ""; bundle $?) | /bin/mail cnews-updates
  1149.       touch $@
  1150.   clean:
  1151. !     rm -f core a.out relaynews *.o
  1152.       
  1153.   # header dependencies follow
  1154.   active.o: ../include/libc.h ../include/news.h ../include/config.h
  1155. --- 97,108 ----
  1156.       (echo relaynews update of `date`; echo ""; bundle $?) | /bin/mail cnews-updates
  1157.       touch $@
  1158.   clean:
  1159. !     rm -f core a.out relaynews *.o    
  1160. !     rm -rf regress/tmp
  1161. ! r:    relaynews
  1162. !     chmod +x regress/regress
  1163. !     cd regress; ./regress
  1164.       
  1165.   # header dependencies follow
  1166.   active.o: ../include/libc.h ../include/news.h ../include/config.h
  1167.  
  1168. *** cnpatch/tmp.file    Fri Jun 23 14:37:45 1989
  1169. --- relay/relaynews.c    Thu Jun 22 14:32:32 1989
  1170. ***************
  1171. *** 22,34 ****
  1172.    * testing is possible (and encouraged) in alternate directories.  This
  1173.    * does cause a loss of privilege, to avoid spoofing.
  1174.    *
  1175. !  * The disused old ihave/sendme protocol is dead; it's been broken in
  1176. !  * B news for ages but no one has noticed because it's essentially
  1177. !  * useless on the uucp network, especially when batching news articles.
  1178. !  * It is also only semi-documented, very wasteful and kludgey in the extreme.
  1179. !  * It is unreasonable to expect an ill-documented protocol to be implemented
  1180. !  * in new software, particularly one as kludgey as this one.
  1181. !  * The new ihave sys flag ("I") for NNTP is implemented (trivially).
  1182.    *
  1183.    * Portability vs SystemV.  relaynews uses dbm(3) and makes no apologies
  1184.    * for so doing.  Imitation UNIX (registered trademark of AT&T in the
  1185. --- 22,30 ----
  1186.    * testing is possible (and encouraged) in alternate directories.  This
  1187.    * does cause a loss of privilege, to avoid spoofing.
  1188.    *
  1189. !  * The disused old unbatched ihave/sendme protocol is gone because it was
  1190. !  * too wasteful; use the batched form instead (see the ihave sys flag
  1191. !  * ("I") instead).
  1192.    *
  1193.    * Portability vs SystemV.  relaynews uses dbm(3) and makes no apologies
  1194.    * for so doing.  Imitation UNIX (registered trademark of AT&T in the
  1195. ***************
  1196. *** 175,180 ****
  1197. --- 171,179 ----
  1198.    * setuid()," and exec this program again.  If NEWSPERMS is set,
  1199.    * the failure is a fatal error (recursive loop).
  1200.    * This program (relaynews) can be setuid-news.
  1201. +  *
  1202. +  * The peculiar tests for failure (getuid() != newsuid) are to work
  1203. +  * around a Xenix bug which returns 0 from setuid() upon failure.
  1204.    */
  1205.   void
  1206.   setids(argv)
  1207. ***************
  1208. *** 187,193 ****
  1209.           newsuid = getuid(), newsgid = getgid();
  1210.       else
  1211.           newsuid = geteuid(), newsgid = getegid();
  1212. !     if (setgid(newsgid) < 0 || setuid(newsuid) < 0) {
  1213.           if (getenv("NEWSPERMS") != 0)
  1214.               error("recursive loop setting ids", "");
  1215.           execv(ctlfile(SETNEWSIDS), argv);
  1216. --- 186,193 ----
  1217.           newsuid = getuid(), newsgid = getgid();
  1218.       else
  1219.           newsuid = geteuid(), newsgid = getegid();
  1220. !     if (setgid(newsgid) < 0 || setuid(newsuid) < 0 ||
  1221. !         getgid() != newsgid || getuid() != newsuid) {
  1222.           if (getenv("NEWSPERMS") != 0)
  1223.               error("recursive loop setting ids", "");
  1224.           execv(ctlfile(SETNEWSIDS), argv);
  1225.  
  1226. *** cnpatch/tmp.file    Fri Jun 23 14:37:47 1989
  1227. --- relay/sh/inews    Fri Jun 23 13:31:33 1989
  1228. ***************
  1229. *** 204,210 ****
  1230.   
  1231.   # to post or to mail? that is the question; whether 'tis nobler in the mind
  1232.   # to suffer the slings and arrows of outrageous mailers - Bill Shakespeare
  1233. ! if grep -s '^Control:' $inhdrs; then
  1234.       echo "control"            # a dreadful hack around all.all.ctl
  1235.   else
  1236.       sed -n '
  1237. --- 204,210 ----
  1238.   
  1239.   # to post or to mail? that is the question; whether 'tis nobler in the mind
  1240.   # to suffer the slings and arrows of outrageous mailers - Bill Shakespeare
  1241. ! if grep -s '^Control:' $inhdrs >/dev/null; then
  1242.       echo "control"            # a dreadful hack around all.all.ctl
  1243.   else
  1244.       sed -n '
  1245. ***************
  1246. *** 235,248 ****
  1247.           >>$grpok
  1248.           case "$flag" in
  1249.           [nx])
  1250. !             echo "$0: bugger off, $ng may not be posted to." >&2
  1251.               echo 1 >$exitflag
  1252.               trap 0        # this is a child process - no cleanup
  1253.               exit 1        # dregs in /tmp/in$$*
  1254.               ;;
  1255.           m)
  1256. !             if grep -s '^Approved:[     ]' $inhdrs; then
  1257. !                 rm $modroute        # just post normally
  1258.               else
  1259.                   # un-Approved: mail it to the moderator(s).
  1260.                   echo "%s" >$modroute    # in case no route
  1261. --- 235,248 ----
  1262.           >>$grpok
  1263.           case "$flag" in
  1264.           [nx])
  1265. !             echo "$0: sorry, $ng may not be posted to locally." >&2
  1266.               echo 1 >$exitflag
  1267.               trap 0        # this is a child process - no cleanup
  1268.               exit 1        # dregs in /tmp/in$$*
  1269.               ;;
  1270.           m)
  1271. !             if grep -s '^Approved:[     ]' $inhdrs >/dev/null; then
  1272. !                 rm -f $modroute        # just post normally
  1273.               else
  1274.                   # un-Approved: mail it to the moderator(s).
  1275.                   echo "%s" >$modroute    # in case no route
  1276.  
  1277. *** cnpatch/tmp.file    Fri Jun 23 14:37:49 1989
  1278. --- relay/sh/postnews    Thu Jun 22 14:02:03 1989
  1279. ***************
  1280. *** 32,38 ****
  1281.       ans=
  1282.       while test " $ans" = " "
  1283.       do
  1284. !         echo -n "Newsgroup(s)$dprompt? "
  1285.           read ans
  1286.           case "$ans" in
  1287.           '')    if test " $defg" != " "
  1288. --- 32,38 ----
  1289.       ans=
  1290.       while test " $ans" = " "
  1291.       do
  1292. !         echo "Newsgroup(s)$dprompt? " | tr -d '\012'
  1293.           read ans
  1294.           case "$ans" in
  1295.           '')    if test " $defg" != " "
  1296. ***************
  1297. *** 58,64 ****
  1298.   subj=
  1299.   while test " $subj" = " "
  1300.   do
  1301. !     echo -n 'Subject: '
  1302.       read subj
  1303.   done
  1304.   echo "Subject: $subj" >>$tmp
  1305. --- 58,64 ----
  1306.   subj=
  1307.   while test " $subj" = " "
  1308.   do
  1309. !     echo 'Subject: ' | tr -d '\012'
  1310.       read subj
  1311.   done
  1312.   echo "Subject: $subj" >>$tmp
  1313. ***************
  1314. *** 82,88 ****
  1315.   while egrep '^(DELETE|REPLACE) THIS LINE' $tmp >/dev/null
  1316.   do
  1317.       echo 'This posting does not appear to have been edited properly.'
  1318. !     echo -n 'Abandon it [y] ? '
  1319.       read ans
  1320.       case "$ans" in
  1321.       ''|y*|Y*)
  1322. --- 82,88 ----
  1323.   while egrep '^(DELETE|REPLACE) THIS LINE' $tmp >/dev/null
  1324.   do
  1325.       echo 'This posting does not appear to have been edited properly.'
  1326. !     echo 'Abandon it [y] ? ' | tr -d '\012'
  1327.       read ans
  1328.       case "$ans" in
  1329.       ''|y*|Y*)
  1330.  
  1331. Files that are new:
  1332.  
  1333. new contrib/rn.mod/better.way (patch can't create, so diff against null):
  1334. Index: contrib/rn.mod/better.way
  1335. *** cnpatch/tmp.preposterously.long.name.to.make.patch.behave.right    Fri Jun 23 14:34:45 1989
  1336. --- contrib/rn.mod/better.way    Thu Jun 22 16:38:07 1989
  1337. ***************
  1338. *** 0 ****
  1339. --- 1,465 ----
  1340. + Date:  9 Jun 1989 1852-EDT (Friday)
  1341. + From: csri.toronto.edu!moraes
  1342. + Received: by neat.ai.toronto.edu id 11723; Fri, 9 Jun 89 18:52:43 EDT
  1343. + Reply-To: moraes@csri.toronto.edu
  1344. + X-Mailer: Mail User's Shell (6.3 6/25/88)
  1345. + To:    henry@utzoo, geoff@utstat.toronto.edu
  1346. + Subject: rn fixes
  1347. + Cc:    moraes@csri.toronto.edu
  1348. + Message-Id: <89Jun9.185243edt.11723@neat.ai.toronto.edu>
  1349. + These are the rn fixes to make it use the new active.times file to
  1350. + stop the startup problems when new newsgroups are created.
  1351. + It seems fast, and reliable - also completely backward compatible, as
  1352. + far as I can tell. Note that a new newsreader will now not be asked
  1353. + about all the newsgroups - they can pick the ones they want later.
  1354. +     - moraes
  1355. + # To unbundle, sh this file
  1356. + echo README.rn 1>&2
  1357. + sed 's/^-//' >README.rn <<'!'
  1358. + The rn.mod file is a set of speedups for rn, which make use of a new file
  1359. + which C news can generate, called $NEWSCTL/active.times. This file contains
  1360. + the creation times of the newsgroups, and solves the problem of rn stat'ing
  1361. + every newsgroup spool directory to figure out if it is a new newsgroup or
  1362. + not.
  1363. + The changes to addng.c prevent rn stating all ~700 directories under
  1364. + -/usr/spool/news every time the active file changes (this is known as "the rn
  1365. + huddle").  This reduced start up time after touching active from 108 seconds
  1366. + elapsed on a Sun 3 to 5 seconds.
  1367. + The theory behind the 700 stats in the newgroup huddle is apparently that if
  1368. + rn stats group/1, and it exists, then group must be a newly-created group.
  1369. + With rapid expiry, group/1 won't be around for long in most groups, causing
  1370. + rn to miss some new groups, and in "valuable" groups with long expiry times,
  1371. + group/1 will be around for a very long time, making rn spuriously think that
  1372. + the old groups are new.
  1373. + To get this to work - apply the diffs to rn. You may need some hand patching
  1374. + -- our version of rn has been hacked to apply various local fixes and some U
  1375. + of Waterloo fixes. (The base U of Waterloo rn contains two other handy
  1376. + changes:  a -q which disables the interrogation when the active file
  1377. + changes, and a third answer during the interrogation: "q" means "I don't
  1378. + care, just show me some news, right now".)
  1379. + The main changes are to addng.c, and init.c, to use the new procedure
  1380. + checknewgroups() for detecting new groups, instead of the earlier heuristic.
  1381. + Create a active.times file from your active file using the act.to.times
  1382. + script in the C News distribution. (C News 'newgroup' will keep it uptodate)
  1383. + Try it.
  1384. + !
  1385. + echo rn.mod 1>&2
  1386. + sed 's/^-//' >rn.mod <<'!'
  1387. + -*** /tmp/,RCSt1a11034    Fri Jun  9 18:36:21 1989
  1388. + ---- addng.c    Fri Jun  9 18:33:55 1989
  1389. + -***************
  1390. + -*** 39,44 ****
  1391. + ---- 39,50 ----
  1392. + -  
  1393. + -  #ifdef FINDNEWNG
  1394. + -  /* generate a list of new newsgroups from active file */
  1395. + -+ /*
  1396. + -+  * The arguments are redundant - they used to be used in a heuristic to
  1397. + -+  * determine new newsgroups. With C News active.times file, this is
  1398. + -+  * unnecessary, since we use the faster, more reliable checknewgroups()
  1399. + -+  * procedure.
  1400. + -+  */
  1401. + -  
  1402. + -  bool
  1403. + -  newlist(munged,checkinlist)
  1404. + -***************
  1405. + -*** 71,86 ****
  1406. + -          fprintf(tmpfp,"%s\n",buf);
  1407. + -                      /* then remember said newsgroup */
  1408. + -          }
  1409. + -- #ifdef FASTNEW
  1410. + --         else {            /* not really a new group */
  1411. + --         if (!munged) {        /* did we assume not munged? */
  1412. + --             fclose(tmpfp);    /* then go back, knowing that */
  1413. + --             UNLINK(tmpname);
  1414. + --             free(tmpname);
  1415. + --             return TRUE;    /* active file was indeed munged */
  1416. + --         }
  1417. + --         }
  1418. + -- #endif
  1419. + -      }
  1420. + -  #ifdef DEBUGGING
  1421. + -      else
  1422. + ---- 77,82 ----
  1423. + -***************
  1424. + -*** 106,127 ****
  1425. + -      return FALSE;            /* do not call us again */
  1426. + -  }
  1427. + -  
  1428. + -! /* return creation time of newsgroup */
  1429. + -  
  1430. + -  long
  1431. + -  birthof(ngnam,ngsize)
  1432. + -  char *ngnam;
  1433. + -  ART_NUM ngsize;
  1434. + -  {
  1435. + --     long time();
  1436. + -- 
  1437. + --     /*
  1438. + --      * This used to try and stat article 1 to find the newsgroup creating
  1439. + --      * time. Almost never finds article 1, since it will always long gone.
  1440. + --      * Nuke the stat() and speed up startup immensely.
  1441. + --      */
  1442. + --     /* not there, assume something good */
  1443. + --     return (ngsize ? 0L : time(Null(long *)));
  1444. + -  }
  1445. + -  
  1446. + -  bool
  1447. + ---- 102,229 ----
  1448. + -      return FALSE;            /* do not call us again */
  1449. + -  }
  1450. + -  
  1451. + -! /*
  1452. + -!  * gets the group time, from the second field, simultaneously null terminating
  1453. + -!  * after the first field in buf.
  1454. + -!  */
  1455. + -! static long
  1456. + -! getgrptime(buf)
  1457. + -! char *buf;
  1458. + -! {
  1459. + -!     char *s;
  1460. + -!     
  1461. + -!     s = index(buf, ' ');
  1462. + -!     if (s == Nullch || *(s+1) == '\0')
  1463. + -!         return 0L;
  1464. + -!     *s++ = '\0';
  1465. + -!     return(atol(s));
  1466. + -! }
  1467. + -  
  1468. + -+ /*
  1469. + -+  * Use the groups file (ACTIVE.times, typically /usr/lib/news/active.times) to
  1470. + -+  * see if there are any new newsgroups
  1471. + -+  */
  1472. + -+ checknewgroups()
  1473. + -+ {
  1474. + -+     FILE *fp;
  1475. + -+     long grptime;
  1476. + -+     long ngrptime;
  1477. + -+     long pos;
  1478. + -+     long npos;
  1479. + -+     char *s;
  1480. + -+     char *grpfile;
  1481. + -+     char tmpbuf[LBUFLEN];
  1482. + -+ #define GROUPEXT ".times"
  1483. + -+ 
  1484. + -+     grpfile = safemalloc(strlen(filexp(ACTIVE)) + sizeof(GROUPEXT));
  1485. + -+     strcpy(grpfile, filexp(ACTIVE));
  1486. + -+     strcat(grpfile, GROUPEXT);
  1487. + -+     
  1488. + -+     fp = fopen(grpfile, "r");
  1489. + -+     if (fp == (FILE *) NULL) {
  1490. + -+     printf(cantopen, grpfile) FLUSH;
  1491. + -+         return;
  1492. + -+     }
  1493. + -+ 
  1494. + -+     pos = npos = lastpos;
  1495. + -+     grptime = lastgrptime;
  1496. + -+     if (lastnewgroup != Nullch)
  1497. + -+     strcpy(tmpbuf, lastnewgroup);
  1498. + -+     /*
  1499. + -+      * In the general case, this 'if()' will be false, unless someone has
  1500. + -+      * messed up the groups file, or this is the first time this person is
  1501. + -+      * reading news
  1502. + -+      */
  1503. + -+     if (lastnewgroup == Nullch || fseek(fp, lastpos, 0) == -1 ||
  1504. + -+         fgets(buf, LBUFLEN, fp) == NULL ||
  1505. + -+     !strnEQ(buf, lastnewgroup, strlen(lastnewgroup))) {
  1506. + -+         /* We need to check the file from the start - use time */
  1507. + -+         if (fseek(fp, 0L, 0) == -1) {
  1508. + -+             printf(cantseek, grpfile) FLUSH;
  1509. + -+             fclose(fp);
  1510. + -+             free(grpfile);
  1511. + -+             return;
  1512. + -+         }
  1513. + -+         pos = npos = 0L;
  1514. + -+         while (fgets(buf, LBUFLEN, fp) != Nullch) {
  1515. + -+             buf[strlen(buf)-1] = '\0';
  1516. + -+             ngrptime = getgrptime(buf);
  1517. + -+             if (ngrptime > lastgrptime)
  1518. + -+                 break;
  1519. + -+             if (ngrptime == 0L)
  1520. + -+                 continue;
  1521. + -+             grptime = ngrptime;
  1522. + -+             strcpy(tmpbuf, buf);
  1523. + -+             pos = npos;
  1524. + -+             npos = ftell(fp);
  1525. + -+         }
  1526. + -+         if (fseek(fp, pos, 0) == -1) {
  1527. + -+             printf(cantseek, grpfile) FLUSH;
  1528. + -+             fclose(fp);
  1529. + -+             free(grpfile);
  1530. + -+             return;
  1531. + -+         }
  1532. + -+         npos = pos;
  1533. + -+     }
  1534. + -+     /*
  1535. + -+      * At this point, the file pointer is positioned at the start of the first
  1536. + -+      * new group. This is the value of pos. Now start asking about new groups.
  1537. + -+      */
  1538. + -+     while (fgets(buf, LBUFLEN, fp) != Nullch) {
  1539. + -+     buf[strlen(buf)-1] = '\0';
  1540. + -+     ngrptime = getgrptime(buf);
  1541. + -+     if (ngrptime == 0L)
  1542. + -+         continue;
  1543. + -+     grptime = ngrptime;
  1544. + -+     strcpy(tmpbuf, buf);
  1545. + -+     pos = npos;
  1546. + -+     if (grptime > lastgrptime && find_ng(buf) == nextrcline)
  1547. + -+         /* not in .newsrc and newer that last new newsgroup */
  1548. + -+         get_ng(buf, TRUE);
  1549. + -+     npos = ftell(fp);
  1550. + -+     }
  1551. + -+     lastpos = pos;
  1552. + -+     lastgrptime = grptime;
  1553. + -+     if (lastnewgroup != Nullch)
  1554. + -+         free(lastnewgroup);
  1555. + -+     lastnewgroup = savestr(tmpbuf);
  1556. + -+     fclose(fp);
  1557. + -+     free(grpfile);
  1558. + -+ }
  1559. + -+ 
  1560. + -+     
  1561. + -+ 
  1562. + -+ /*
  1563. + -+  * return creation time of newsgroup - procedure made redundant by C News
  1564. + -+  * active.times and checknewgroups()
  1565. + -+  */
  1566. + -+ 
  1567. + -+ /*ARGSUSED*/
  1568. + -  long
  1569. + -  birthof(ngnam,ngsize)
  1570. + -  char *ngnam;
  1571. + -  ART_NUM ngsize;
  1572. + -  {
  1573. + -  }
  1574. + -  
  1575. + -  bool
  1576. + -*** /tmp/,RCSt1a11034    Fri Jun  9 18:36:24 1989
  1577. + ---- common.h    Fri Jun  9 18:30:10 1989
  1578. + -***************
  1579. + -*** 1,9 ****
  1580. + -! /* $Header: /ai/car/src/rn/RCS/common.h,v 4.6 89/06/09 18:29:44 moraes Exp $
  1581. + -   * 
  1582. + -   * $Log:    common.h,v $
  1583. + --  * Revision 4.6  89/06/09  18:29:44  moraes
  1584. + --  * *** empty log message ***
  1585. + --  * 
  1586. + -   * Revision 4.5  89/06/05  21:59:37  moraes
  1587. + -   * enabled -q option permanantly. New speed mods make it unnecessary for
  1588. + -   * most people, but some people just want to see general/gradnews/ut.*
  1589. + ---- 1,6 ----
  1590. + -! /* $Header: /ai/car/src/rn/RCS/common.h,v 4.5 89/06/05 21:59:37 moraes Exp $
  1591. + -   * 
  1592. + -   * $Log:    common.h,v $
  1593. + -   * Revision 4.5  89/06/05  21:59:37  moraes
  1594. + -   * enabled -q option permanantly. New speed mods make it unnecessary for
  1595. + -   * most people, but some people just want to see general/gradnews/ut.*
  1596. + -***************
  1597. + -*** 292,299 ****
  1598. + -              /* (Note: both VERBOSE and TERSE can be defined; -t
  1599. + -               * sets terse mode.  One or the other MUST be defined.
  1600. + -               */
  1601. + -- #define QUICK        /* -q option - Don't ask about new newsgroups */
  1602. + -- 
  1603. + -  #ifndef pdp11
  1604. + -  #   define CACHESUBJ    /* cache subject lines in memory */
  1605. + -              /* without this ^N still works but runs really slow */
  1606. + ---- 289,294 ----
  1607. + -*** /tmp/,RCSt1a11034    Fri Jun  9 18:36:25 1989
  1608. + ---- init.c    Fri Jun  9 18:30:10 1989
  1609. + -***************
  1610. + -*** 1,4 ****
  1611. + -! /* $Header: /ai/car/src/rn/RCS/init.c,v 1.2 88/07/14 18:15:22 ken Exp $
  1612. + -   *
  1613. + -   * $Log:    init.c,v $
  1614. + -   * Revision 1.2  88/07/14  18:15:22  ken
  1615. + ---- 1,4 ----
  1616. + -! /* $Header: init.c,v 1.2 88/07/14 18:15:22 ken Exp $
  1617. + -   *
  1618. + -   * $Log:    init.c,v $
  1619. + -   * Revision 1.2  88/07/14  18:15:22  ken
  1620. + -***************
  1621. + -*** 166,185 ****
  1622. + -  
  1623. + -  #ifdef FINDNEWNG
  1624. + -      fstat(actfp->_file,&filestat);    /* did active file grow? */
  1625. + -- #ifdef QUICK
  1626. + -      /* maintain the old active file size, to avoid "new newsgroup" blather */
  1627. + -      if (quick)
  1628. + -      filestat.st_size = lastactsiz;
  1629. + -- #endif
  1630. + -      if (filestat.st_size != lastactsiz) {
  1631. + -      long actsiz = filestat.st_size;    /* remember new size */
  1632. + -      NG_NUM oldnext = nextrcline;    /* remember # lines in newsrc */
  1633. + -- #ifdef FASTNEW
  1634. + --     bool munged = writesoft || !lastactsiz;
  1635. + --                     /* bad soft ptrs -> edited active */
  1636. + -- #else
  1637. + --     bool munged = TRUE;        /* just assume .newsrc munged */
  1638. + -- #endif
  1639. + -  
  1640. + -  #ifdef VERBOSE
  1641. + -      IF(verbose)
  1642. + ---- 166,177 ----
  1643. + -***************
  1644. + -*** 190,208 ****
  1645. + -  #ifdef TERSE
  1646. + -          fputs("\nNew newsgroups:\n",stdout) FLUSH;
  1647. + -  #endif
  1648. + -! #ifdef FASTNEW
  1649. + -!     if (!munged) {            /* maybe just do tail of file? */
  1650. + -!         fseek(actfp,lastactsiz-1,0);
  1651. + -!         fgets(buf,LBUFLEN,actfp);
  1652. + -!         munged = (*buf != '\n');
  1653. + -!         if (!munged)
  1654. + -!         munged = newlist(munged,FALSE);
  1655. + -!     }
  1656. + -! #endif
  1657. + -!     if (munged) {            /* must we scan entire file? */
  1658. + -!         fseek(actfp,0L,0);        /* rewind active file */
  1659. + -!         newlist(munged,FALSE);      /* sure hope they use hashing... */
  1660. + -!     }
  1661. + -      lastactsiz = actsiz;        /* remember for .rnlast */
  1662. + -      if (nextrcline != oldnext) {    /* did we add any new groups? */
  1663. + -          foundany = TRUE;        /* let main() know */
  1664. + ---- 182,188 ----
  1665. + -  #ifdef TERSE
  1666. + -          fputs("\nNew newsgroups:\n",stdout) FLUSH;
  1667. + -  #endif
  1668. + -!     checknewgroups();
  1669. + -      lastactsiz = actsiz;        /* remember for .rnlast */
  1670. + -      if (nextrcline != oldnext) {    /* did we add any new groups? */
  1671. + -          foundany = TRUE;        /* let main() know */
  1672. + -*** /tmp/,RCSt1a11034    Fri Jun  9 18:36:26 1989
  1673. + ---- last.c    Fri Jun  9 17:06:01 1989
  1674. + -***************
  1675. + -*** 1,9 ****
  1676. + -! /* $Header: /ai/car/src/rn/RCS/last.c,v 1.1 89/06/09 03:52:49 moraes Exp $
  1677. + -   *
  1678. + -   * $Log:    last.c,v $
  1679. + --  * Revision 1.1  89/06/09  03:52:49  moraes
  1680. + --  * Initial revision
  1681. + --  * 
  1682. + -   * Revision 4.3  85/05/01  11:42:16  lwall
  1683. + -   * Baseline for release with 4.3bsd.
  1684. + -   * 
  1685. + ---- 1,6 ----
  1686. + -! /* $Header: last.c,v 4.3 85/05/01 11:42:16 lwall Exp $
  1687. + -   *
  1688. + -   * $Log:    last.c,v $
  1689. + -   * Revision 4.3  85/05/01  11:42:16  lwall
  1690. + -   * Baseline for release with 4.3bsd.
  1691. + -   * 
  1692. + -***************
  1693. + -*** 26,37 ****
  1694. + -      lastname = savestr(filexp(LASTNAME));
  1695. + -      if ((tmpfp = fopen(lastname,"r")) != Nullfp) {
  1696. + -      fgets(tcbuf,1024,tmpfp);
  1697. + -!     tcbuf[strlen(tcbuf)-1] = '\0';
  1698. + -      lastngname = savestr(tcbuf);
  1699. + -      fgets(tcbuf,1024,tmpfp);
  1700. + -      lasttime = atol(tcbuf);
  1701. + -      fgets(tcbuf,1024,tmpfp);
  1702. + -      lastactsiz = atol(tcbuf);
  1703. + -      fclose(tmpfp);
  1704. + -      }
  1705. + -      else {
  1706. + ---- 23,52 ----
  1707. + -      lastname = savestr(filexp(LASTNAME));
  1708. + -      if ((tmpfp = fopen(lastname,"r")) != Nullfp) {
  1709. + -      fgets(tcbuf,1024,tmpfp);
  1710. + -!     tcbuf[strlen(tcbuf) - 1] = '\0';
  1711. + -      lastngname = savestr(tcbuf);
  1712. + -      fgets(tcbuf,1024,tmpfp);
  1713. + -      lasttime = atol(tcbuf);
  1714. + -      fgets(tcbuf,1024,tmpfp);
  1715. + -      lastactsiz = atol(tcbuf);
  1716. + -+     /*
  1717. + -+      * The first time when new rn is used by a user who was using the old
  1718. + -+      * rn, the lastgrptime is taken to be 'now', so the user is not
  1719. + -+      * hassled with hundreds of newsgroups
  1720. + -+      */
  1721. + -+     if (fgets(tcbuf, 1024,tmpfp) != (char *) NULL)
  1722. + -+         lastgrptime = atol(tcbuf);
  1723. + -+     else 
  1724. + -+         lastgrptime = time(0);
  1725. + -+     if (fgets(tcbuf, 1024, tmpfp) != (char *) NULL) {
  1726. + -+         tcbuf[strlen(tcbuf) - 1] = '\0';
  1727. + -+         lastnewgroup = savestr(tcbuf);
  1728. + -+     } else
  1729. + -+         lastnewgroup = NULL;
  1730. + -+     if (fgets(tcbuf, 1024, tmpfp) != (char *) NULL)
  1731. + -+         lastpos = atol(tcbuf);
  1732. + -+     else
  1733. + -+         lastpos = 0;
  1734. + -      fclose(tmpfp);
  1735. + -      }
  1736. + -      else {
  1737. + -***************
  1738. + -*** 38,43 ****
  1739. + ---- 53,67 ----
  1740. + -      lastngname = nullstr;
  1741. + -      lasttime = 0;
  1742. + -      lastactsiz = 0;
  1743. + -+     /*
  1744. + -+      * The default for the new reader is not to show hundreds of new
  1745. + -+      * newsgroups. The system admin should use newsetup to provide a
  1746. + -+      * proper starting subset - the user can select new newsgroups by
  1747. + -+      * hand. Much faster
  1748. + -+      */
  1749. + -+     lastgrptime = time(0);
  1750. + -+     lastnewgroup = Nullch;
  1751. + -+     lastpos = 0;
  1752. + -      }
  1753. + -  }
  1754. + -  
  1755. + -***************
  1756. + -*** 47,54 ****
  1757. + -  writelast()
  1758. + -  {
  1759. + -      if ((tmpfp = fopen(lastname,"w")) != Nullfp) {
  1760. + -!     fprintf(tmpfp,"%s\n%ld\n%ld\n",
  1761. + -!         (ngname==Nullch?nullstr:ngname),(long)lasttime,(long)lastactsiz);
  1762. + -      fclose(tmpfp);
  1763. + -      }
  1764. + -      else
  1765. + ---- 71,81 ----
  1766. + -  writelast()
  1767. + -  {
  1768. + -      if ((tmpfp = fopen(lastname,"w")) != Nullfp) {
  1769. + -!     fprintf(tmpfp,"%s\n%ld\n%ld\n%ld\n%s\n%ld\n",
  1770. + -!         (ngname==Nullch?nullstr:ngname),(long)lasttime,(long)lastactsiz,
  1771. + -!         lastgrptime, 
  1772. + -!         ((lastnewgroup == (char *) NULL) ? nullstr:lastnewgroup),
  1773. + -!         lastpos);
  1774. + -      fclose(tmpfp);
  1775. + -      }
  1776. + -      else
  1777. + -*** /tmp/,RCSt1a11034    Fri Jun  9 18:36:27 1989
  1778. + ---- last.h    Fri Jun  9 05:32:16 1989
  1779. + -***************
  1780. + -*** 12,17 ****
  1781. + ---- 12,20 ----
  1782. + -  EXT char *lastngname INIT(Nullch);    /* last newsgroup read, from .rnlast file */
  1783. + -  EXT long lasttime INIT(0);    /* time last rn was started up */
  1784. + -  EXT long lastactsiz INIT(0);    /* size of active file when rn last started up */
  1785. + -+ EXT long lastgrptime INIT(0);    /* time the groups file was last changed */
  1786. + -+ EXT char *lastnewgroup INIT(Nullch);    /* last new newsgroup */
  1787. + -+ EXT long lastpos INIT(0);    /* pos. of last new newsgroup in groups file */
  1788. + -  
  1789. + -  void    last_init();
  1790. + -  void    writelast();
  1791. + No differences encountered
  1792. + !
  1793.  
  1794. Finally, update PATCHDATES:
  1795. *** ../cnpatch/tmp.dates    Fri Jun 23 14:38:03 1989
  1796. --- PATCHDATES    Fri Jun 23 14:38:03 1989
  1797. ***************
  1798. *** 0 ****
  1799. --- 1 ----
  1800. + 23-Jun-1989
  1801.  
  1802. end of patch 23-Jun-1989
  1803.  
  1804.  
  1805.