home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume19 / cnews2 / pch14sep89 < prev    next >
Internet Message Format  |  1990-02-05  |  52KB

  1. From bbn.com!bbn!uwm.edu!cs.utexas.edu!mailrus!jarvis.csri.toronto.edu!utgpu!utzoo!henry Mon Sep 18 12:15:22 EDT 1989
  2. Article 2479 of news.software.b:
  3. Path: bbn.com!bbn!uwm.edu!cs.utexas.edu!mailrus!jarvis.csri.toronto.edu!utgpu!utzoo!henry
  4. >From: henry@utzoo.uucp (Henry Spencer)
  5. Newsgroups: news.software.b
  6. Subject: 14-Sep-1989 patch for C News, corrected version
  7. Message-ID: <1989Sep16.225911.23438@utzoo.uucp>
  8. Date: 16 Sep 89 22:59:11 GMT
  9. Organization: U of Toronto Zoology
  10. Lines: 1968
  11.  
  12. (See accompanying article for explanation of correction.)
  13.  
  14. Well, dbz is still "in the works" -- I've been busy -- but here's the latest
  15. batch of (mostly) small stuff.  The big one here is that (with the exception
  16. of superkludge, whose days are numbered anyway), we now 100.000% comply with
  17. RFC822's rules about case-sensitivity in header keywords and message-IDs.
  18. (Note that B News is not RFC822-compliant on message-IDs, which are only
  19. *partly* [!] case-insensitive.)  Unless you want duplicate checking to fail
  20. temporarily, you will need to rebuild your dbm/dbz indexes to the history
  21. file when installing this.  (The history file itself is unchanged.)
  22. There are some #ifdefs in libcnews/case.c to give you B News behavior, if
  23. you really want it.
  24.  
  25. Other changes:  The usual minor cleanup and fixes for small annoyances.
  26. A new transmitter for the batcher, viarsh.  Robustness fixes in history
  27. rebuilding.  A warning message when configuration mismatches (or testing)
  28. cause programs to renounce setuid status.  Robustness improvements in the
  29. fast-stdio stuff, which may let it run on more systems.  Fix for a bug in
  30. change-moderation-status's newsgroup matching.  Slightly less noise from
  31. checkgroups.  Inews now passes formfeeds.  Inews -p now works better.
  32. A new program, recovact, to help recover an active file after problems.
  33. And inews's rsh handling has been cleaned up and revised, which should
  34. cure assorted minor problems.
  35.  
  36. start of patch 14-Sep-1989
  37. (suggested archive name: `pch14Sep89.Z')
  38. this should be run with   patch -p0 <thisfile
  39.  
  40. The following is a complete list of patches to date.
  41.  
  42. Prereq: 23-Jun-1989
  43. Prereq: 7-Jul-1989
  44. Prereq: 23-Jul-1989
  45. Prereq: 22-Aug-1989
  46. Prereq: 24-Aug-1989
  47. *** tmp.dates.with.really.long.filename.for.patch    Thu Sep 14 15:51:07 1989
  48. --- PATCHDATES    Thu Sep 14 15:51:07 1989
  49. ***************
  50. *** 1,5 ****
  51. --- 1,6 ----
  52.   23-Jun-1989
  53.   7-Jul-1989
  54.   23-Jul-1989
  55.   22-Aug-1989
  56.   24-Aug-1989
  57. + 14-Sep-1989
  58.  
  59. Changed files, if any:
  60.  
  61. *** cnpatch/tmp.file    Thu Sep 14 15:51:12 1989
  62. --- batch/Makefile    Sat Aug 26 22:48:38 1989
  63. ***************
  64. *** 17,24 ****
  65.   PGMS=batcher batchih batchsm batchsplit comp compcun nocomp viainews viauux \
  66.       sendbatches compc7 c7encode viamail viapmail bencode compb viauuxz \
  67. !     viaemail
  68.   DTR=Makefile batcher.c batchih batchsplit c7encode.c comp compc7 compcun \
  69.       newsbatch.8 nocomp sendbatches viainews viauux viamail \
  70. !     bencode.c coder.h crctab.c compb viapmail
  71.   ALL = $(PGMS) batchparms
  72.   
  73. --- 17,24 ----
  74.   PGMS=batcher batchih batchsm batchsplit comp compcun nocomp viainews viauux \
  75.       sendbatches compc7 c7encode viamail viapmail bencode compb viauuxz \
  76. !     viaemail viarsh
  77.   DTR=Makefile batcher.c batchih batchsplit c7encode.c comp compc7 compcun \
  78.       newsbatch.8 nocomp sendbatches viainews viauux viamail \
  79. !     bencode.c coder.h crctab.c compb viapmail viarsh
  80.   ALL = $(PGMS) batchparms
  81.   
  82.  
  83. *** cnpatch/tmp.file    Thu Sep 14 15:51:22 1989
  84. --- conf/build    Tue Aug 29 16:43:42 1989
  85. ***************
  86. *** 994,997 ****
  87. --- 994,999 ----
  88.       echo "echo 'general 0000000000 0000000001 y' >active"
  89.       echo "echo 'news.announce.newusers 0000000000 0000000001 y' >>active"
  90. +     echo "echo 'control 0000000000 0000000001 y' >>active"
  91. +     echo "echo 'junk 0000000000 0000000001 y' >>active"
  92.       echo ">errlog"
  93.       echo ">history"
  94. ***************
  95. *** 1083,1086 ****
  96. --- 1085,1089 ----
  97.       echo "    chmod +x $newsconfig"
  98.       echo "fi"
  99. +     echo "$newsbin/maint/adddirs"
  100.       echo ": It is virtually certain that some of those control files"
  101.       echo ": need modifying to suit your system.  In particular, you"
  102.  
  103. *** cnpatch/tmp.file    Thu Sep 14 15:51:30 1989
  104. --- conf/spacefor.proto    Tue Aug 29 19:22:20 1989
  105. ***************
  106. *** 22,26 ****
  107.       if test " $server" != " $me"
  108.       then
  109. !         exec rsh $server "PATH=$PATH `basename $0` $*"
  110.           # does not return
  111.       fi
  112. --- 22,26 ----
  113.       if test " $server" != " $me"
  114.       then
  115. !         exec rsh $server /bin/sh -c "'PATH=$PATH `basename $0` $*'"
  116.           # does not return
  117.       fi
  118.  
  119. *** cnpatch/tmp.file    Thu Sep 14 15:51:32 1989
  120. --- conf/subst.hs    Wed Sep 13 16:50:55 1989
  121. ***************
  122. *** 42,43 ****
  123. --- 42,45 ----
  124.   notebook/config
  125.   batch/batchih
  126. + expire/recovact
  127. + misc/adddirs
  128.  
  129. *** cnpatch/tmp.file    Thu Sep 14 15:51:32 1989
  130. --- conf/sys.proto    Tue Aug 29 19:30:01 1989
  131. ***************
  132. *** 20,24 ****
  133.   # Send ihave telling louie what we have -- batcher turns the batch into a
  134.   # giant control message and posts it to "to.louie".  (#1)
  135. ! louie:rec.music.synth/all,!sendme,!ihave:I:louie.ihave/togo
  136.   # Send sendme in response to ihave from louie -- again, turned by batcher
  137.   # into giant control message posted to "to.louie".  (#3)
  138. --- 20,24 ----
  139.   # Send ihave telling louie what we have -- batcher turns the batch into a
  140.   # giant control message and posts it to "to.louie".  (#1)
  141. ! louie:rec.music.synth,!to/all,!sendme,!ihave:I:louie.ihave/togo
  142.   # Send sendme in response to ihave from louie -- again, turned by batcher
  143.   # into giant control message posted to "to.louie".  (#3)
  144.  
  145. *** cnpatch/tmp.file    Thu Sep 14 15:51:34 1989
  146. --- contrib/dbz    Thu Sep 14 15:36:16 1989
  147. ***************
  148. *** 174,177 ****
  149. --- 174,179 ----
  150.   
  151.           /* lcase(buffer, key.dsize);    lcase is a B news botch */
  152. +         buffer[key.dsize] = '\0';
  153. +         (void) rfc822ize(buffer);
  154.           if (buffer[key.dsize - 1] == '\t') {
  155.               buffer[key.dsize - 1] = '\0';
  156.  
  157. *** cnpatch/tmp.file    Thu Sep 14 15:51:48 1989
  158. --- expire/Makefile    Thu Sep 14 15:50:17 1989
  159. ***************
  160. *** 7,14 ****
  161.   LIBS= ../libcnews.a
  162.   THEM = expire histdups histinfo histslash mkdbm mkhistory \
  163. !     superkludge upact doexpire mkadir
  164.   DTR = README Makefile dircheck doexpire expire.c histdups histinfo.c \
  165.       histslash.c mkdbm.c mkhistory pgood superkludge tgood upact \
  166. !     mkadir updatemin.c
  167.   UPACT=upact
  168.   # =()<NEWSARTS = @<NEWSARTS>@>()=
  169. --- 7,14 ----
  170.   LIBS= ../libcnews.a
  171.   THEM = expire histdups histinfo histslash mkdbm mkhistory \
  172. !     superkludge upact doexpire mkadir recovact
  173.   DTR = README Makefile dircheck doexpire expire.c histdups histinfo.c \
  174.       histslash.c mkdbm.c mkhistory pgood superkludge tgood upact \
  175. !     mkadir updatemin.c recovact
  176.   UPACT=upact
  177.   # =()<NEWSARTS = @<NEWSARTS>@>()=
  178. ***************
  179. *** 212,219 ****
  180.       test ! -f arts/urp/99 ;
  181.       cmp history history.after
  182. !     : "that's it for expire, on to upact"
  183.       $(D) ./$(UPACT)
  184.       cmp active active.after
  185.       $(D) ./$(UPACT)
  186.       cmp active active.after
  187.       : "and for upact, on to mkhistory"
  188. --- 212,224 ----
  189.       test ! -f arts/urp/99 ;
  190.       cmp history history.after
  191. !     : "that's it for expire, on to upact and recovact"
  192.       $(D) ./$(UPACT)
  193.       cmp active active.after
  194.       $(D) ./$(UPACT)
  195. +     cmp active active.after
  196. +     $(D) ./recovact
  197. +     cmp active active.after
  198. +     sed '/^foo /s/99/09/' active.after >active
  199. +     $(D) ./recovact
  200.       cmp active active.after
  201.       : "and for upact, on to mkhistory"
  202.  
  203. *** cnpatch/tmp.file    Thu Sep 14 15:51:51 1989
  204. --- expire/expire.c    Wed Sep 13 21:02:42 1989
  205. ***************
  206. *** 77,80 ****
  207. --- 77,81 ----
  208.   int verbose = 0;        /* report statistics */
  209.   int rebuild = 1;        /* rebuild history files */
  210. + int violate = 0;        /* non-rfc822 case-sensitive messageIDs */
  211.   
  212.   long nkept = 0;            /* count of articles not expired */
  213. ***************
  214. *** 167,171 ****
  215.       ftime(&ftnow);
  216.   
  217. !     while ((c = getopt(argc, argv, "pa:sF:cn:tlvrd")) != EOF)
  218.           switch (c) {
  219.           case 'p':    /* print info line for archived articles */
  220. --- 168,172 ----
  221.       ftime(&ftnow);
  222.   
  223. !     while ((c = getopt(argc, argv, "pa:sF:cn:tlvrVd")) != EOF)
  224.           switch (c) {
  225.           case 'p':    /* print info line for archived articles */
  226. ***************
  227. *** 199,202 ****
  228. --- 200,206 ----
  229.               rebuild = 0;
  230.               break;
  231. +         case 'V':    /* non-rfc822 dualcase messageIDs */
  232. +             violate = 1;
  233. +             break;
  234.           case 'd':    /* debug */
  235.               expdebug = 1;
  236. ***************
  237. *** 215,220 ****
  238.           setbuf(stderr, (char *)NULL);
  239.   
  240. -     (void) cistrncmp("a", "a", 1);        /* prime case.c */
  241.       if (optind < argc) {
  242.           cf = eufopen(argv[optind], "r");
  243. --- 219,222 ----
  244. ***************
  245. *** 433,436 ****
  246. --- 435,439 ----
  247.       datum rhs;
  248.       register int ret;
  249. +     register char *id;
  250.   
  251.       cd(ctlfile((char *)NULL));
  252. ***************
  253. *** 464,469 ****
  254.               /* make the DBM entry */
  255.               *nameend = '\0';
  256. !             lhs.dptr = line;
  257. !             lhs.dsize = strlen(line)+1;
  258.               here = ftell(new);
  259.               rhs.dptr = (char *)&here;
  260. --- 467,476 ----
  261.               /* make the DBM entry */
  262.               *nameend = '\0';
  263. !             if (!violate)
  264. !                 lhs.dptr = rfc822ize(strsave(line));
  265. !             else
  266. !                 lhs.dptr = strsave(line);
  267. !             *nameend = '\t';
  268. !             lhs.dsize = strlen(lhs.dptr)+1;
  269.               here = ftell(new);
  270.               rhs.dptr = (char *)&here;
  271. ***************
  272. *** 473,477 ****
  273.               if (ret < 0)
  274.                   fail("dbm failure on `%s'", line);
  275. !             *nameend = '\t';
  276.   
  277.               /* and the history entry */
  278. --- 480,484 ----
  279.               if (ret < 0)
  280.                   fail("dbm failure on `%s'", line);
  281. !             free(lhs.dptr);
  282.   
  283.               /* and the history entry */
  284. ***************
  285. *** 909,913 ****
  286.       limit = buf + bsize - len;
  287.       for (scan = buf; scan < limit; scan++)
  288. !         if (TOLOW(*scan) == 's' && cistrncmp(scan, sline, len) == 0 &&
  289.                   (scan == buf || *(scan-1) == '\n')) {
  290.               scan += len;
  291. --- 916,920 ----
  292.       limit = buf + bsize - len;
  293.       for (scan = buf; scan < limit; scan++)
  294. !         if (CISTREQN(scan, sline, len) &&
  295.                   (scan == buf || *(scan-1) == '\n')) {
  296.               scan += len;
  297. ***************
  298. *** 915,919 ****
  299.                   if (*limit == '\n')
  300.                       break;
  301. !             while (scan < limit && isspace(*scan))
  302.                   scan++;
  303.               len = limit-scan;
  304. --- 922,926 ----
  305.                   if (*limit == '\n')
  306.                       break;
  307. !             while (scan < limit && isascii(*scan) && isspace(*scan))
  308.                   scan++;
  309.               len = limit-scan;
  310. ***************
  311. *** 1143,1147 ****
  312.    */
  313.   void
  314. ! unprivileged()
  315.   {
  316.   }
  317. --- 1150,1155 ----
  318.    */
  319.   void
  320. ! unprivileged(reason)
  321. ! char *reason;
  322.   {
  323.   }
  324.  
  325. *** cnpatch/tmp.file    Thu Sep 14 15:51:56 1989
  326. --- expire/histinfo.c    Mon Sep 11 17:38:15 1989
  327. ***************
  328. *** 87,95 ****
  329.       while ((line = fgetms(in)) != NULL && strcmp(line, "\n") != 0) {
  330.           line[strlen(line)-1] = '\0';        /* trim newline */
  331. !         if (cistrncmp(line, msgidnm, STRLEN(msgidnm)) == 0) {
  332.               if (msgid != NULL)
  333.                   free(msgid);
  334.               msgid = strsave(line+STRLEN(msgidnm));
  335. !         } else if (cistrncmp(line, expnm, STRLEN(expnm)) == 0) {
  336.               free(expiry);
  337.               expiry = strsave(line+STRLEN(expnm));
  338. --- 87,95 ----
  339.       while ((line = fgetms(in)) != NULL && strcmp(line, "\n") != 0) {
  340.           line[strlen(line)-1] = '\0';        /* trim newline */
  341. !         if (CISTREQN(line, msgidnm, STRLEN(msgidnm))) {
  342.               if (msgid != NULL)
  343.                   free(msgid);
  344.               msgid = strsave(line+STRLEN(msgidnm));
  345. !         } else if (CISTREQN(line, expnm, STRLEN(expnm))) {
  346.               free(expiry);
  347.               expiry = strsave(line+STRLEN(expnm));
  348. ***************
  349. *** 109,113 ****
  350.   
  351.       /* deal with empty and trash articles */
  352. !     if (msgid == NULL || strchr(msgid, '\t') != NULL) {
  353.           if (msgid != NULL)
  354.               free(msgid);
  355. --- 109,116 ----
  356.   
  357.       /* deal with empty and trash articles */
  358. !     if (msgid == NULL || strchr(msgid, '\t') != NULL || msgid[0] != '<' ||
  359. !                     msgid[strlen(msgid)-1] != '>' ||
  360. !                     strchr(expiry, '\t') != NULL ||
  361. !                     strchr(expiry, '~') != NULL) {
  362.           if (msgid != NULL)
  363.               free(msgid);
  364. ***************
  365. *** 134,138 ****
  366.    */
  367.   void
  368. ! unprivileged()
  369.   {
  370.   }
  371. --- 137,142 ----
  372.    */
  373.   void
  374. ! unprivileged(reason)
  375. ! char *reason;
  376.   {
  377.   }
  378.  
  379. *** cnpatch/tmp.file    Thu Sep 14 15:51:57 1989
  380. --- expire/histslash.c    Tue Aug 29 19:24:44 1989
  381. ***************
  382. *** 32,36 ****
  383.               scan++;
  384.           }
  385. !         fputs(line, stdout);
  386.           free(line);
  387.       }
  388. --- 32,37 ----
  389.               scan++;
  390.           }
  391. !         if (fputs(line, stdout) == EOF)
  392. !             error("fputs failed", "");
  393.           free(line);
  394.       }
  395.  
  396. *** cnpatch/tmp.file    Thu Sep 14 15:51:58 1989
  397. --- expire/mkdbm.c    Wed Sep 13 16:36:31 1989
  398. ***************
  399. *** 7,12 ****
  400.   #include <stdio.h>
  401.   #include <string.h>
  402. - #include <ctype.h>
  403.   #include "fgetmfs.h"
  404.   
  405.   
  406. --- 7,12 ----
  407.   #include <stdio.h>
  408.   #include <string.h>
  409.   #include "fgetmfs.h"
  410. + #include "case.h"
  411.   
  412.   
  413. ***************
  414. *** 40,43 ****
  415. --- 40,44 ----
  416.           *scan = '\0';
  417.   
  418. +         rfc822ize(line);
  419.           lhs.dptr = line;
  420.           lhs.dsize = strlen(line) + 1;
  421.  
  422. *** cnpatch/tmp.file    Thu Sep 14 15:51:59 1989
  423. --- expire/mkhistory    Wed Sep 13 20:49:00 1989
  424. ***************
  425. *** 8,12 ****
  426.   umask $NEWSUMASK
  427.   
  428. ! lock="$NEWSCTL/LOCK"        # modify name as appropriate
  429.   ltemp="$NEWSCTL/L.$$"
  430.   echo $$ >$ltemp
  431. --- 8,12 ----
  432.   umask $NEWSUMASK
  433.   
  434. ! lock="$NEWSCTL/LOCK"
  435.   ltemp="$NEWSCTL/L.$$"
  436.   echo $$ >$ltemp
  437.  
  438. *** cnpatch/tmp.file    Thu Sep 14 15:52:00 1989
  439. --- expire/superkludge    Wed Sep 13 16:56:22 1989
  440. ***************
  441. *** 32,36 ****
  442.               END { print FILENAME, mid, sup ; exit }' $f >>/tmp/sup$$
  443.       done
  444. !     awk 'NF > 3 || $2 !~ /^<.*>$/ || $3 !~ /^(<.*>)?$/' /tmp/sup$$ >/tmp/supx$$
  445.       if test -s /tmp/supx$$
  446.       then
  447. --- 32,36 ----
  448.               END { print FILENAME, mid, sup ; exit }' $f >>/tmp/sup$$
  449.       done
  450. !     awk 'NF > 3 || $2 !~ /^<.*>$/ || (NF == 3 && $3 !~ /^(<.*>)?$/)' /tmp/sup$$ >/tmp/supx$$
  451.       if test -s /tmp/supx$$
  452.       then
  453.  
  454. *** cnpatch/tmp.file    Thu Sep 14 15:52:01 1989
  455. --- expire/updatemin.c    Tue Sep  5 17:29:35 1989
  456. ***************
  457. *** 211,215 ****
  458.    */
  459.   void
  460. ! unprivileged()
  461.   {
  462.   }
  463. --- 211,216 ----
  464.    */
  465.   void
  466. ! unprivileged(reason)
  467. ! char *reason;
  468.   {
  469.   }
  470.  
  471. *** cnpatch/tmp.file    Thu Sep 14 15:52:04 1989
  472. --- h/case.h    Sun Aug 27 18:39:49 1989
  473. ***************
  474. *** 1,5 ****
  475.   extern int cistrncmp();
  476.   
  477. - /* must call the above once before invoking the macro below */
  478.   extern char casemap[];
  479. ! #define    TOLOW(c)    (casemap[(c)])
  480. --- 1,12 ----
  481.   extern int cistrncmp();
  482. + extern char *rfc822ize();
  483.   
  484.   extern char casemap[];
  485. ! /* must call cistrncmp before invoking TOLOW... */
  486. ! #define    TOLOW(c)    (casemap[(c)+128])    /* see case.c for why 128 */
  487. ! /* ...but the use of it in CISTREQN is safe without the preliminary call (!) */
  488. ! /* CISTREQN is an optimised case-insensitive strncmp(a,b,n)==0; n > 0 */
  489. ! #define CISTREQN(a, b, n) \
  490. !     (TOLOW((a)[0]) == TOLOW((b)[0]) && cistrncmp(a, b, n) == 0)
  491.  
  492. *** cnpatch/tmp.file    Thu Sep 14 15:52:05 1989
  493. --- h/libc.h    Sat Aug 26 18:34:25 1989
  494. ***************
  495. *** 56,61 ****
  496.   extern FILE *popen();            /* stdio.h */
  497.   #ifdef __STDC__
  498. ! extern int printf(char *fmt, ...), fprintf(FILE *, char *fmt, ...); /* stdio.h */
  499. ! extern sprvalue sprintf(char *buf, char *fmt, ...);        /* stdio.h */
  500.   #else                    /* __STDC__ */
  501.   extern int printf(), fprintf();        /* stdio.h */
  502. --- 56,62 ----
  503.   extern FILE *popen();            /* stdio.h */
  504.   #ifdef __STDC__
  505. ! extern int printf(char *fmt, ...)    /* stdio.h */
  506. ! extern int fprintf(FILE *fp, char *fmt, ...);        /* stdio.h */
  507. ! extern sprvalue sprintf(char *buf, char *fmt, ...);    /* stdio.h */
  508.   #else                    /* __STDC__ */
  509.   extern int printf(), fprintf();        /* stdio.h */
  510.  
  511. *** cnpatch/tmp.file    Thu Sep 14 15:52:11 1989
  512. --- input/newsspool.c    Tue Sep  5 17:20:37 1989
  513. ***************
  514. *** 285,291 ****
  515.    */
  516.   void
  517. ! unprivileged()
  518.   {
  519.       setgid(getgid());
  520.       setuid(getuid());
  521.   }
  522. --- 285,294 ----
  523.    */
  524.   void
  525. ! unprivileged(reason)
  526. ! char *reason;
  527.   {
  528.       setgid(getgid());
  529.       setuid(getuid());
  530. +     fprintf(stderr, "%s: renouncing setuid due to nonstandard `%s'\n",
  531. +                             progname, reason);
  532.   }
  533.  
  534. *** cnpatch/tmp.file    Thu Sep 14 15:52:26 1989
  535. --- libcnews/case.c    Mon Aug 28 14:16:11 1989
  536. ***************
  537. *** 5,10 ****
  538.    * headers are limited to the ASCII characters by RFC822.  It is barely
  539.    * possible that we might be dealing with a translation into another
  540. !  * character set, but in particular it's very difficult for a header
  541. !  * character to be negative without blowing standard compliance.
  542.    */
  543.   #include <stdio.h>
  544. --- 5,13 ----
  545.    * headers are limited to the ASCII characters by RFC822.  It is barely
  546.    * possible that we might be dealing with a translation into another
  547. !  * character set, but in particular it's very unlikely for a header
  548. !  * character to be outside -128..255.
  549. !  *
  550. !  * Life would be a whole lot simpler if tolower() could safely and portably
  551. !  * be applied to any char.
  552.    */
  553.   #include <stdio.h>
  554. ***************
  555. *** 12,16 ****
  556.   #include "case.h"
  557.   
  558. ! #define    MAPSIZE    256        /* overkill for ASCII */
  559.   char casemap[MAPSIZE];        /* relies on init to '\0' */
  560.   static int primed = 0;        /* has casemap been set up? */
  561. --- 15,21 ----
  562.   #include "case.h"
  563.   
  564. ! /* note that case.h knows the value of OFFSET */
  565. ! #define    OFFSET    128        /* avoid trouble with negative chars */
  566. ! #define    MAPSIZE    (256+OFFSET)
  567.   char casemap[MAPSIZE];        /* relies on init to '\0' */
  568.   static int primed = 0;        /* has casemap been set up? */
  569. ***************
  570. *** 25,28 ****
  571. --- 30,34 ----
  572.       register char *up;
  573.       register int c;
  574. +     register int i;
  575.       static char lower[] = "abcdefghijklmnopqrstuvwxyz";
  576.       static char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  577. ***************
  578. *** 30,39 ****
  579.       for (lp = lower, up = upper; *lp != '\0'; lp++, up++) {
  580.           c = *lp;
  581. !         casemap[c] = c;
  582. !         casemap[*up] = c;
  583.       }
  584. !     for (c = 0; c < MAPSIZE; c++)
  585. !         if (casemap[c] == '\0')
  586. !             casemap[c] = c;
  587.       primed = 1;
  588.   }
  589. --- 36,45 ----
  590.       for (lp = lower, up = upper; *lp != '\0'; lp++, up++) {
  591.           c = *lp;
  592. !         casemap[c+OFFSET] = c;
  593. !         casemap[*up+OFFSET] = c;
  594.       }
  595. !     for (i = 0; i < MAPSIZE; i++)
  596. !         if (casemap[i] == '\0')
  597. !             casemap[i] = (char)(i-OFFSET);
  598.       primed = 1;
  599.   }
  600. ***************
  601. *** 78,80 ****
  602. --- 84,120 ----
  603.       else
  604.           return(TOLOW(*p1) - TOLOW(*p2));
  605. + }
  606. + /*
  607. +  - rfc822ize - do the bizarre case conversion needed for rfc822 message-ids
  608. +  */
  609. + char *                /* returns the argument */
  610. + rfc822ize(s)
  611. + char *s;
  612. + {
  613. +     register char *p;
  614. +     static char post[] = "postmaster";
  615. +     static int postlen = sizeof(post)-1;
  616. +     if (!primed)
  617. +         prime();
  618. +     p = strrchr(s, '@');
  619. +     if (p == NULL)            /* no local/domain split */
  620. +         p = "";            /* assume all local */
  621. +     else if    (p - (s+1) == postlen && CISTREQN(s+1, post, postlen)) {
  622. +         /* crazy special case -- "postmaster" is case-insensitive */
  623. +         p = s;
  624. +     }
  625. + #ifdef NONSTANDARD
  626. + #ifdef RFCVIOLATION
  627. + #ifdef B_2_11_MISTAKE
  628. +     p = s;                /* all case-insensitive */
  629. + #endif
  630. + #endif
  631. + #endif
  632. +     for (; *p != '\0'; p++)
  633. +         *p = TOLOW(*p);
  634. +     return(s);
  635.   }
  636.  
  637. *** cnpatch/tmp.file    Thu Sep 14 15:52:28 1989
  638. --- libcnews/config.c    Tue Sep  5 17:17:40 1989
  639. ***************
  640. *** 61,67 ****
  641.   {
  642.       register char *p;
  643. -     register int nonstd = NO;
  644.       register int mask;
  645.       register char *scan;
  646.   
  647.       if (dirsset)
  648. --- 61,68 ----
  649.   {
  650.       register char *p;
  651.       register int mask;
  652.       register char *scan;
  653. +     register int ns = 0;
  654. + #    define    NONSTD(reason)    { if (!ns) { unprivileged(reason); ns = 1; } }
  655.   
  656.       if (dirsset)
  657. ***************
  658. *** 70,75 ****
  659.       p = getenv("NEWSARTS");
  660.       if (p != NULL && !STREQ(p, arts)) {
  661. -         nonstd = YES;
  662.           arts = p;
  663.       }
  664.   
  665. --- 71,76 ----
  666.       p = getenv("NEWSARTS");
  667.       if (p != NULL && !STREQ(p, arts)) {
  668.           arts = p;
  669. +         NONSTD("NEWSARTS");
  670.       }
  671.   
  672. ***************
  673. *** 77,81 ****
  674.       if (p != NULL && !STREQ(p, ctl)) {
  675.           ctl = p;
  676. !         nonstd = YES;
  677.       }
  678.   
  679. --- 78,82 ----
  680.       if (p != NULL && !STREQ(p, ctl)) {
  681.           ctl = p;
  682. !         NONSTD("NEWSCTL");
  683.       }
  684.   
  685. ***************
  686. *** 83,87 ****
  687.       if (p != NULL && !STREQ(p, path)) {
  688.           path = p;
  689. !         nonstd = YES;
  690.       }
  691.   
  692. --- 84,88 ----
  693.       if (p != NULL && !STREQ(p, path)) {
  694.           path = p;
  695. !         NONSTD("NEWSPATH");
  696.       }
  697.   
  698. ***************
  699. *** 89,93 ****
  700.       if (p != NULL && !STREQ(p, bin)) {
  701.           bin = p;
  702. !         nonstd = YES;
  703.       }
  704.   
  705. --- 90,94 ----
  706.       if (p != NULL && !STREQ(p, bin)) {
  707.           bin = p;
  708. !         NONSTD("NEWSBIN");
  709.       }
  710.   
  711. ***************
  712. *** 104,108 ****
  713.           if (mask != numask) {
  714.               numask = mask;
  715. !             nonstd = YES;
  716.           }
  717.       }
  718. --- 105,109 ----
  719.           if (mask != numask) {
  720.               numask = mask;
  721. !             NONSTD("NEWSUMASK");
  722.           }
  723.       }
  724. ***************
  725. *** 111,120 ****
  726.       if (p != NULL && !STREQ(p, nmaster)) {
  727.           nmaster = p;
  728. !         nonstd = YES;
  729.       }
  730.   
  731.       dirsset = YES;
  732. -     if (nonstd)
  733. -         unprivileged();
  734.   }
  735.   
  736. --- 112,119 ----
  737.       if (p != NULL && !STREQ(p, nmaster)) {
  738.           nmaster = p;
  739. !         NONSTD("NEWSMASTER");
  740.       }
  741.   
  742.       dirsset = YES;
  743.   }
  744.   
  745.  
  746. *** cnpatch/tmp.file    Thu Sep 14 15:52:48 1989
  747. --- libstdio/fgets.c    Wed Sep  6 16:33:39 1989
  748. ***************
  749. *** 30,33 ****
  750. --- 30,35 ----
  751.               register int bytesleft = fp->_cnt;    /* to EOB */
  752.   
  753. +             if (bytesleft < 0)
  754. +                 bytesleft = 0;
  755.               if (bytesleft > lim)    /* buffer longer than s */
  756.                   bytesleft = lim; /* only copy to s's end */
  757.  
  758. *** cnpatch/tmp.file    Thu Sep 14 15:52:50 1989
  759. --- libstdio/rdwr.c    Wed Sep  6 16:33:38 1989
  760. ***************
  761. *** 29,32 ****
  762. --- 29,34 ----
  763.               register int copy = fp->_cnt;
  764.   
  765. +             if (copy < 0)
  766. +                 copy = 0;
  767.               if (copy > bytes)    /* buffer longer than ptr */
  768.                   copy = bytes;    /* only fill ptr */
  769. ***************
  770. *** 76,79 ****
  771. --- 78,83 ----
  772.               register int copy = fp->_cnt;
  773.   
  774. +             if (copy < 0)
  775. +                 copy = 0;
  776.               if (copy > bytes)    /* buffer longer than ptr */
  777.                   copy = bytes;    /* only empty ptr */
  778.  
  779. *** cnpatch/tmp.file    Thu Sep 14 15:53:01 1989
  780. --- man/expire.8    Thu Sep 14 15:50:22 1989
  781. ***************
  782. *** 7,11 ****
  783.   .\" =()<.ds m @<NEWSMASTER>@>()=
  784.   .ds m usenet
  785. ! .TH EXPIRE 8 "23 Aug 1989" "C News"
  786.   .SH NAME
  787.   expire, doexpire \- expire old news
  788. --- 7,11 ----
  789.   .\" =()<.ds m @<NEWSMASTER>@>()=
  790.   .ds m usenet
  791. ! .TH EXPIRE 8 "13 Sept 1989" "C News"
  792.   .SH NAME
  793.   expire, doexpire \- expire old news
  794. ***************
  795. *** 15,18 ****
  796. --- 15,20 ----
  797.   upact \- update news active file
  798.   .br
  799. + recovact \- partially recover news active file
  800. + .br
  801.   superkludge \- implement stupid Supersedes header in news
  802.   .SH SYNOPSIS
  803. ***************
  804. *** 53,56 ****
  805. --- 55,60 ----
  806.   .B \*b/expire/upact
  807.   .br
  808. + .B \*b/expire/recovact
  809. + .br
  810.   .B \*b/expire/superkludge
  811.   [
  812. ***************
  813. *** 226,230 ****
  814.   updates the third fields of the \fIactive\fR file to match the articles
  815.   in \fI\*a\fR (for historical reasons, \fIexpire\fR does not do this).
  816. ! These programs are both fairly slow and they both lock the whole news
  817.   system for the duration of the run, so they should not be run casually.
  818.   .PP
  819. --- 230,238 ----
  820.   updates the third fields of the \fIactive\fR file to match the articles
  821.   in \fI\*a\fR (for historical reasons, \fIexpire\fR does not do this).
  822. ! .I Recovact
  823. ! updates the second fields of the \fIactive\fR file to match the articles
  824. ! in \fI\*a\fR,
  825. ! for use in disaster recovery based on an outdated \fIactive\fR file.
  826. ! These programs are all fairly slow and they all lock the whole news
  827.   system for the duration of the run, so they should not be run casually.
  828.   .PP
  829. ***************
  830. *** 266,270 ****
  831.   `Supersedes' header.
  832.   .PP
  833. ! Some of the more obscure options of \fIexpire\fR have not been tested well.
  834.   .PP
  835.   One cannot put more than one newsgroup into a single archiving directory
  836. --- 274,280 ----
  837.   `Supersedes' header.
  838.   .PP
  839. ! .I Superkludge
  840. ! does not understand RFC822's complex case-sensitivity rules for message-IDs,
  841. ! and insists on an exact case-sensitive match.
  842.   .PP
  843.   One cannot put more than one newsgroup into a single archiving directory
  844.  
  845. *** cnpatch/tmp.file    Thu Sep 14 15:53:03 1989
  846. --- man/inews.1    Tue Aug 29 12:20:37 1989
  847. ***************
  848. *** 7,11 ****
  849.   .\" =()<.ds m @<NEWSMASTER>@>()=
  850.   .ds m usenet
  851. ! .TH INEWS 1 "6 Aug 1989" "C News"
  852.   .SH NAME
  853.   inews \- `user-friendly' news-posting front-end for relaynews
  854. --- 7,11 ----
  855.   .\" =()<.ds m @<NEWSMASTER>@>()=
  856.   .ds m usenet
  857. ! .TH INEWS 1 "29 Aug 1989" "C News"
  858.   .SH NAME
  859.   inews \- `user-friendly' news-posting front-end for relaynews
  860. ***************
  861. *** 117,124 ****
  862.   .PP
  863.   .B "inews -p"
  864.   is exactly equivalent to
  865.   invoking
  866. ! .BR rnews (8);
  867. ! this is seldom useful in C News.
  868.   Normal usage is
  869.   .BR "inews -h" ,
  870. --- 117,133 ----
  871.   .PP
  872.   .B "inews -p"
  873. + .I files
  874.   is exactly equivalent to
  875.   invoking
  876. ! .B "cat"
  877. ! .I files
  878. ! .BR "| relaynews -r" ,
  879. ! where
  880. ! .I files
  881. ! may be an empty list;
  882. ! there is no automatic recovery of the input
  883. ! file(s) in case of errors,
  884. ! full disks
  885. ! or other problems.
  886.   Normal usage is
  887.   .BR "inews -h" ,
  888. ***************
  889. *** 209,212 ****
  890. --- 218,224 ----
  891.   (no line-printer graphics, please)
  892.   .TP
  893. + .IB $HOME /dead.article
  894. + saved article in case of errors or problems
  895. + .TP
  896.   .BR /tmp/in *
  897.   temporaries
  898. ***************
  899. *** 214,219 ****
  900.   .SH "SEE ALSO"
  901.   .IR mail (1),
  902. ! .IR rnews (1),
  903. ! .IR newsaux (8)
  904.   .SH DIAGNOSTICS
  905.   .I inews
  906. --- 226,232 ----
  907.   .SH "SEE ALSO"
  908.   .IR mail (1),
  909. ! .IR news (5),
  910. ! .IR newsaux (8),
  911. ! .IR relaynews (8)
  912.   .SH DIAGNOSTICS
  913.   .I inews
  914.  
  915. *** cnpatch/tmp.file    Thu Sep 14 15:53:04 1989
  916. --- man/newsaux.8    Wed Sep 13 20:49:45 1989
  917. ***************
  918. *** 7,11 ****
  919.   .\" =()<.ds m @<NEWSMASTER>@>()=
  920.   .ds m usenet
  921. ! .TH NEWSAUX 8 "19 Aug 1989" "C News"
  922.   .SH NAME
  923.   spacefor \- check available space for news
  924. --- 7,11 ----
  925.   .\" =()<.ds m @<NEWSMASTER>@>()=
  926.   .ds m usenet
  927. ! .TH NEWSAUX 8 "13 Sept 1989" "C News"
  928.   .SH NAME
  929.   spacefor \- check available space for news
  930. ***************
  931. *** 21,24 ****
  932. --- 21,26 ----
  933.   gngp \- search text using a newsgroup pattern
  934.   .br
  935. + canonhdr \- extract header and canonicalize case in header keywords
  936. + .br
  937.   newshist \- extract history line for news article(s)
  938.   .br
  939. ***************
  940. *** 57,63 ****
  941. --- 59,70 ----
  942.   [
  943.   .B \-a
  944. + ] [
  945. + .B \-r
  946.   ]
  947.   ngpattern file ...
  948.   .br
  949. + .B \*b/canonhdr
  950. + [ file ] ...
  951. + .br
  952.   .B \*b/maint/newshist
  953.   msgid ...
  954. ***************
  955. *** 133,136 ****
  956. --- 140,156 ----
  957.   flag is given, the eligible substrings start at the beginning of the
  958.   line and end at white space or the end of the line.
  959. + The
  960. + \fB\-r\fR flag reverses the inputs, with patterns coming from
  961. + the file and the argument taken as the line(s).
  962. + .PP
  963. + .I Canonhdr
  964. + takes the concatenation of its input \fIfile\fR(s) (standard input if none)
  965. + as an article,
  966. + and outputs the header from the article with header keywords canonicalized
  967. + for easier processing.
  968. + Canonicalization forces all alphabetics to lower case except the first
  969. + letter of the keyword, which is forced to upper case.
  970. + (One exception:
  971. + ``Message-ID'' is the canonical form of [e.g.] ``message-id''.)
  972.   .PP
  973.   .I Newshist
  974.  
  975. *** cnpatch/tmp.file    Thu Sep 14 15:53:06 1989
  976. --- man/newsbatch.8    Wed Sep 13 16:12:45 1989
  977. ***************
  978. *** 7,11 ****
  979.   .\" =()<.ds m @<NEWSMASTER>@>()=
  980.   .ds m usenet
  981. ! .TH NEWSBATCH 8 "19 Aug 1989" "C News"
  982.   .SH NAME
  983.   sendbatches, batchsplit \- news batching to other sites
  984. --- 7,11 ----
  985.   .\" =()<.ds m @<NEWSMASTER>@>()=
  986.   .ds m usenet
  987. ! .TH NEWSBATCH 8 "26 Aug 1989" "C News"
  988.   .SH NAME
  989.   sendbatches, batchsplit \- news batching to other sites
  990. ***************
  991. *** 17,21 ****
  992.   c7encode, bencode \- compressed-news-batch encoding
  993.   .br
  994. ! viauux, viauuxz, viainews \- news-batch transmission
  995.   .br
  996.   viamail, viaemail, viapmail \- news-batch transmission via mail
  997. --- 17,21 ----
  998.   c7encode, bencode \- compressed-news-batch encoding
  999.   .br
  1000. ! viauux, viauuxz, viainews, viarsh \- news-batch transmission
  1001.   .br
  1002.   viamail, viaemail, viapmail \- news-batch transmission via mail
  1003. ***************
  1004. *** 72,75 ****
  1005. --- 72,78 ----
  1006.   site
  1007.   .br
  1008. + .B \&.../viarsh
  1009. + site
  1010. + .br
  1011.   .B \&.../viamail
  1012.   site
  1013. ***************
  1014. *** 216,219 ****
  1015. --- 219,227 ----
  1016.   feed the batch back to \fIinews\fR, ignoring the \fIsite\fR argument
  1017.   (normally useful only for ihave/sendme)
  1018. + .IP viarsh
  1019. + use \fIrsh\fR to run \fIrnews\fR on the \fIsite\fR via Ethernet,
  1020. + Internet, etc.
  1021. + (the directory containing \fIrnews\fR
  1022. + must be in the default PATH on \fIsite\fR)
  1023.   .IP viamail
  1024.   mail the batch to \fIsite\fB!rnews\fR
  1025.  
  1026. *** cnpatch/tmp.file    Thu Sep 14 15:53:09 1989
  1027. --- misc/Makefile    Tue Aug 29 12:18:05 1989
  1028. ***************
  1029. *** 13,17 ****
  1030.   MAINTBIN=newshist
  1031.   MAINT = $(MAINTBIN) newsdaily newswatch newsboot locknews addgroup delgroup adddirs
  1032. ! UTILBIN = gngp newslock ctime getdate
  1033.   UTILS = $(UTILBIN) sizeof newshostname
  1034.   THEM = $(MAINT) $(UTILS)
  1035. --- 13,17 ----
  1036.   MAINTBIN=newshist
  1037.   MAINT = $(MAINTBIN) newsdaily newswatch newsboot locknews addgroup delgroup adddirs
  1038. ! UTILBIN = gngp newslock ctime getdate canonhdr
  1039.   UTILS = $(UTILBIN) sizeof newshostname
  1040.   THEM = $(MAINT) $(UTILS)
  1041. ***************
  1042. *** 45,48 ****
  1043. --- 45,51 ----
  1044.   newslock:    newslock.o $(LIBS)
  1045.       $(CC) $(CFLAGS) $(LDFLAGS) newslock.o $(PRE) $(LIBS) $(POST) -o $@
  1046. + canonhdr:    canonhdr.o $(LIBS)
  1047. +     $(CC) $(CFLAGS) $(LDFLAGS) canonhdr.o $(PRE) $(LIBS) $(POST) -o $@
  1048.   
  1049.   NHCFLAGS = -I$(RN) $(CFLAGS)
  1050.  
  1051. *** cnpatch/tmp.file    Thu Sep 14 15:53:13 1989
  1052. --- misc/gngp.c    Wed Sep  6 16:29:05 1989
  1053. ***************
  1054. *** 1,4 ****
  1055.   /*
  1056. !  * gngp - globally find newsgroup and print
  1057.    *    like grep, but for newsgroup patterns instead of regular expressions
  1058.    */
  1059. --- 1,4 ----
  1060.   /*
  1061. !  * gngp - globally match newsgroup pattern and print
  1062.    *    like grep, but for newsgroup patterns instead of regular expressions
  1063.    */
  1064. ***************
  1065. *** 13,16 ****
  1066. --- 13,17 ----
  1067.    */
  1068.   int anchored = 0;
  1069. + int reverse = 0;    /* iff true, reverse argument & file roles */
  1070.   
  1071.   FILE *efopen();
  1072. ***************
  1073. *** 30,34 ****
  1074.   
  1075.       progname = argv[0];
  1076. !     while ((c = getopt(argc, argv, "ad")) != EOF)
  1077.           switch (c) {
  1078.           case 'a':        /* anchored at start of line */
  1079. --- 31,35 ----
  1080.   
  1081.       progname = argv[0];
  1082. !     while ((c = getopt(argc, argv, "adr")) != EOF)
  1083.           switch (c) {
  1084.           case 'a':        /* anchored at start of line */
  1085. ***************
  1086. *** 39,42 ****
  1087. --- 40,46 ----
  1088.               debug++;
  1089.               break;
  1090. +         case 'r':    /* reverse roles: ngs in arg., patterns in file */
  1091. +             reverse++;
  1092. +             break;
  1093.           default:
  1094.               errflg++;
  1095. ***************
  1096. *** 44,48 ****
  1097.           }
  1098.       if (errflg || optind == argc) {
  1099. !         (void) fprintf(stderr, "usage: %s [-ad] pattern [file...]\n",
  1100.               progname);
  1101.           exit(2);
  1102. --- 48,52 ----
  1103.           }
  1104.       if (errflg || optind == argc) {
  1105. !         (void) fprintf(stderr, "usage: %s [-adr] ng_pattern [file...]\n",
  1106.               progname);
  1107.           exit(2);
  1108. ***************
  1109. *** 102,106 ****
  1110.           }
  1111.       }
  1112. !     returned = ngmatch(pattern, text);
  1113.       if (anchored) {
  1114.           if (whitesp != NULL)
  1115. --- 106,110 ----
  1116.           }
  1117.       }
  1118. !     returned = (!reverse? ngmatch(pattern, text): ngmatch(text, pattern));
  1119.       if (anchored) {
  1120.           if (whitesp != NULL)
  1121.  
  1122. *** cnpatch/tmp.file    Thu Sep 14 15:53:27 1989
  1123. --- notebook/config    Tue Sep  5 17:31:30 1989
  1124. ***************
  1125. *** 1,3 ****
  1126. ! .DA "18 Feb 1989"
  1127.   .TL
  1128.   Configuration Mechanisms in C News
  1129. --- 1,3 ----
  1130. ! .DA "5 Sept 1989"
  1131.   .TL
  1132.   Configuration Mechanisms in C News
  1133. ***************
  1134. *** 93,100 ****
  1135.   .LP
  1136.   .RS
  1137. ! .IP "void unprivileged(void);"
  1138.   Drop any special powers that should not be available to a normal user
  1139.   program,
  1140.   e.g. those obtained by set-uid bit.
  1141.   .RE
  1142.   .LP
  1143. --- 93,102 ----
  1144.   .LP
  1145.   .RS
  1146. ! .IP "void unprivileged(char *reason);"
  1147.   Drop any special powers that should not be available to a normal user
  1148.   program,
  1149.   e.g. those obtained by set-uid bit.
  1150. + .I Reason
  1151. + is the name of the first environment variable that caused trouble.
  1152.   .RE
  1153.   .LP
  1154.  
  1155. *** cnpatch/tmp.file    Thu Sep 14 15:53:42 1989
  1156. --- relay/aux/chamod    Tue Sep 12 12:53:54 1989
  1157. ***************
  1158. *** 19,26 ****
  1159.   esac
  1160.   
  1161. ! aflag=`awk "/$1/"' { print $4 }' $NEWSCTL/active`
  1162.   if test "$aflag" != "$flag" -a \( "$aflag" = m -o "$aflag" = y \); then
  1163.       # old & new flags differ & old flag is m or y
  1164. -     # watch closely - shell quoting is tricky here
  1165.       awk '
  1166.   $1 == "'$1'"    {            # this line is for first arg.
  1167. --- 19,26 ----
  1168.   esac
  1169.   
  1170. ! # watch closely - shell quoting is tricky in the next two awk invocations
  1171. ! aflag=`awk '$1 == "'$1'" { print $4 }' $NEWSCTL/active`
  1172.   if test "$aflag" != "$flag" -a \( "$aflag" = m -o "$aflag" = y \); then
  1173.       # old & new flags differ & old flag is m or y
  1174.       awk '
  1175.   $1 == "'$1'"    {            # this line is for first arg.
  1176.  
  1177. *** cnpatch/tmp.file    Thu Sep 14 15:53:46 1989
  1178. --- relay/aux/newsreply    Tue Aug 29 12:16:17 1989
  1179. ***************
  1180. *** 10,23 ****
  1181.   umask $NEWSUMASK
  1182.   
  1183. ! art=/tmp/nc$$
  1184.   mroute=/tmp/ncm$$
  1185.   
  1186. ! cat >$art
  1187.   
  1188.   if test -r $NEWSCTL/replyusepath
  1189.   then
  1190. !     sender="`grep '^Path:' $art | sed 's/^[^:]*://' `"
  1191. !     echo "$sender"
  1192. !     rm -f $art
  1193.       exit 0
  1194.   fi
  1195. --- 10,22 ----
  1196.   umask $NEWSUMASK
  1197.   
  1198. ! hdr=/tmp/nc$$
  1199.   mroute=/tmp/ncm$$
  1200.   
  1201. ! canonhdr >$hdr
  1202.   
  1203.   if test -r $NEWSCTL/replyusepath
  1204.   then
  1205. !     grep '^Path:' $hdr | sed 's/^[^:]*:[     ]*//'
  1206. !     rm -f $hdr
  1207.       exit 0
  1208.   fi
  1209. ***************
  1210. *** 24,30 ****
  1211.   
  1212.   # pick out the appropriate header
  1213. ! sender="` grep '^Reply-To:' $art `"
  1214.   case "$sender" in
  1215. ! "")    sender="` grep '^From:' $art `" ;;
  1216.   esac
  1217.   
  1218. --- 23,29 ----
  1219.   
  1220.   # pick out the appropriate header
  1221. ! sender="` grep '^Reply-To:' $hdr `"
  1222.   case "$sender" in
  1223. ! "")    sender="` grep '^From:' $hdr `" ;;
  1224.   esac
  1225.   
  1226. ***************
  1227. *** 55,57 ****
  1228.   fi
  1229.   
  1230. ! rm -f $art $mroute
  1231. --- 54,56 ----
  1232.   fi
  1233.   
  1234. ! rm -f $hdr $mroute
  1235.  
  1236. *** cnpatch/tmp.file    Thu Sep 14 15:53:51 1989
  1237. --- relay/ctl/checkgroups    Wed Sep 13 13:18:50 1989
  1238. ***************
  1239. *** 19,26 ****
  1240.   sort -u -o $NEWSCTL/newsgroups $NEWSCTL/newsgroups.bac
  1241.   
  1242.   # generate list of approved newsgroups from $nl/newsgroups
  1243. - # [^.]*\. in next two egreps was net.|mod.|fa., which is inadequate - geoff
  1244.   (echo junk; echo control; sed 's/[ \    ].*//' $NEWSCTL/newsgroups |
  1245. !     egrep "^([^.]*\.|general)") | sort -u >/tmp/$$a
  1246.   
  1247.   # generate list of locally-present newsgroups from $nl/active
  1248. --- 19,36 ----
  1249.   sort -u -o $NEWSCTL/newsgroups $NEWSCTL/newsgroups.bac
  1250.   
  1251. + # locate our subscription list
  1252. + me="`newshostname`"
  1253. + gngppat=`awk -f $NEWSBIN/relay/canonsys.awk $NEWSCTL/sys |
  1254. +     egrep "^($me|ME):" |
  1255. +     awk -F: '
  1256. + {
  1257. +     fields = split($2, field2, "/")    # split ngs/dists
  1258. +     print field2[1]            # print only ngs
  1259. +     exit
  1260. + }' `
  1261.   # generate list of approved newsgroups from $nl/newsgroups
  1262.   (echo junk; echo control; sed 's/[ \    ].*//' $NEWSCTL/newsgroups |
  1263. !     egrep "^([^.]*\.|general)") | gngp -a "$gngppat" | sort -u >/tmp/$$a
  1264.   
  1265.   # generate list of locally-present newsgroups from $nl/active
  1266.  
  1267. *** cnpatch/tmp.file    Thu Sep 14 15:53:52 1989
  1268. --- relay/ctl/newgroup    Tue Aug 29 12:16:19 1989
  1269. ***************
  1270. *** 9,23 ****
  1271.   umask $NEWSUMASK
  1272.   
  1273. ! F=/tmp/nc$$
  1274.   
  1275. ! trap "rm -f $F; exit 0" 0
  1276. ! cat >$F
  1277.   
  1278.   # unapproved ctl msg? then quit
  1279. ! grep -s '^Approved:' $F >/dev/null || { rm -f $F; exit 0; }
  1280.   
  1281. ! SENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1282.   case "$SENDER" in
  1283. ! "")    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//' `" ;;
  1284.   esac
  1285.   
  1286. --- 9,23 ----
  1287.   umask $NEWSUMASK
  1288.   
  1289. ! hdr=/tmp/nc$$
  1290.   
  1291. ! trap "rm -f $hdr; exit 0" 0
  1292. ! canonhdr >$hdr
  1293.   
  1294.   # unapproved ctl msg? then quit
  1295. ! grep -s '^Approved:' $hdr >/dev/null || { rm -f $hdr; exit 0; }
  1296.   
  1297. ! SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
  1298.   case "$SENDER" in
  1299. ! "")    SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//' `" ;;
  1300.   esac
  1301.   
  1302.  
  1303. *** cnpatch/tmp.file    Thu Sep 14 15:53:53 1989
  1304. --- relay/ctl/rmgroup    Tue Aug 29 12:16:20 1989
  1305. ***************
  1306. *** 8,27 ****
  1307.   umask $NEWSUMASK
  1308.   
  1309. ! F=/tmp/nc$$
  1310.   
  1311. ! cat >$F
  1312.   
  1313.   # unapproved ctl msg? then quit
  1314. ! egrep '^Approved:' $F >/dev/null || { rm -f $F; exit 0; }
  1315.   
  1316.   # quit if no active entry
  1317.   egrep "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active >/dev/null ||
  1318. !     { rm -f $F; exit 0; }
  1319.   
  1320. ! SENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1321.   case "$SENDER" in
  1322. ! "")
  1323. !     SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  1324. !     ;;
  1325.   esac
  1326.   
  1327. --- 8,25 ----
  1328.   umask $NEWSUMASK
  1329.   
  1330. ! hdr=/tmp/nc$$
  1331.   
  1332. ! canonhdr >$hdr
  1333.   
  1334.   # unapproved ctl msg? then quit
  1335. ! egrep '^Approved:' $hdr >/dev/null || { rm -f $hdr; exit 0; }
  1336.   
  1337.   # quit if no active entry
  1338.   egrep "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active >/dev/null ||
  1339. !     { rm -f $hdr; exit 0; }
  1340.   
  1341. ! SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
  1342.   case "$SENDER" in
  1343. ! "")    SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//'`" ;;
  1344.   esac
  1345.   
  1346. ***************
  1347. *** 29,31 ****
  1348.   echo "rmgroup $1 says $SENDER" | mail $NEWSMASTER
  1349.   
  1350. ! rm -f $F*
  1351. --- 27,29 ----
  1352.   echo "rmgroup $1 says $SENDER" | mail $NEWSMASTER
  1353.   
  1354. ! rm -f $hdr
  1355.  
  1356. *** cnpatch/tmp.file    Thu Sep 14 15:54:01 1989
  1357. --- relay/hdrmunge.c    Tue Aug 29 12:18:03 1989
  1358. ***************
  1359. *** 22,25 ****
  1360. --- 22,26 ----
  1361.   #include "libc.h"
  1362.   #include "news.h"
  1363. + #include "case.h"
  1364.   #include "fileart.h"
  1365.   #include "headers.h"
  1366. ***************
  1367. *** 92,98 ****
  1368.       if (headdebug)
  1369.           (void) fputs(buffer, stderr);
  1370. !     for (vhp = hdrlst; *vhp != NULL; vhp++)
  1371. !         if (STREQN(buffer, (*vhp)->hdrnm, (int)(*vhp)->hdrlen))
  1372.               return;            /* don't save this header */
  1373.       hdrsave(art, buffer, hdrlen);
  1374.   }
  1375. --- 93,102 ----
  1376.       if (headdebug)
  1377.           (void) fputs(buffer, stderr);
  1378. !     for (vhp = hdrlst; *vhp != NULL; vhp++) {
  1379. !         register char *hdrnm = (*vhp)->hdrnm;
  1380. !         if (CISTREQN(buffer, hdrnm, (int)(*vhp)->hdrlen))
  1381.               return;            /* don't save this header */
  1382. +     }
  1383.       hdrsave(art, buffer, hdrlen);
  1384.   }
  1385. ***************
  1386. *** 172,176 ****
  1387.   register int hdrlen;
  1388.   {
  1389. !     if (STREQN(hdr, pathhdr.hdrnm, (int)pathhdr.hdrlen)) {
  1390.           register char *oldpath, *hostnm = hostname();
  1391.   
  1392. --- 176,180 ----
  1393.   register int hdrlen;
  1394.   {
  1395. !     if (CISTREQN(hdr, pathhdr.hdrnm, (int)pathhdr.hdrlen)) {
  1396.           register char *oldpath, *hostnm = hostname();
  1397.   
  1398.  
  1399. *** cnpatch/tmp.file    Thu Sep 14 15:54:05 1989
  1400. --- relay/hdrparse.c    Tue Aug 29 12:18:04 1989
  1401. ***************
  1402. *** 4,11 ****
  1403.   
  1404.   #include <stdio.h>
  1405. - #include <ctype.h>
  1406.   #include <sys/types.h>
  1407.   #include "libc.h"
  1408.   #include "news.h"
  1409.   #include "headers.h"
  1410.   #include "hdrint.h"
  1411. --- 4,11 ----
  1412.   
  1413.   #include <stdio.h>
  1414.   #include <sys/types.h>
  1415.   #include "libc.h"
  1416.   #include "news.h"
  1417. + #include "case.h"
  1418.   #include "headers.h"
  1419.   #include "hdrint.h"
  1420. ***************
  1421. *** 22,30 ****
  1422.   
  1423.   /*
  1424. !  * Parse RFC822/850/1036 header into "hdrs".  Retain significant values.
  1425. !  * Assumes ishdr has been called first.
  1426. !  *
  1427. !  * If a keyword matches one in hdrlst, store the value in *malloc'ed memory*
  1428. !  * (N.B.).  freeheader() will free this memory.
  1429.    */
  1430.   void
  1431. --- 22,31 ----
  1432.   
  1433.   /*
  1434. !  * Parse (assumed) RFC822/850/1036 header in "line" (ishdr(line) can
  1435. !  * verify this) into "hdrs" using hdrlst set of keywords by retaining the
  1436. !  * value of any matching keyword.  Keyword matching is case-insensitive.
  1437. !  * If the keyword in "line" matches one in hdrlst, store the value in
  1438. !  * *malloc'ed memory* (N.B.) pointed to by a member of "hdrs".
  1439. !  * freeheader() will free this memory.
  1440.    */
  1441.   void
  1442. ***************
  1443. *** 36,51 ****
  1444.       register struct hdrdef **hpp;
  1445.   
  1446. !     for (hpp = hdrlst; *hpp != NULL; hpp++)
  1447. !         if (STREQN(line, (*hpp)->hdrnm, (int)(*hpp)->hdrlen) &&
  1448. !             (*hpp)->hdroff >= 0) {    /* paranoia */
  1449. !             register char **ptrp =
  1450. !                 (char **)((char *)hdrs+(*hpp)->hdroff);
  1451.   
  1452. !             nnfree(ptrp);    /* free prev. val. in this art. */
  1453. !             *ptrp = strsave(skipsp(&line[(*hpp)->hdrlen]));
  1454. !             if (*ptrp != NULL)
  1455. !                 trim(*ptrp);    /* cut trailing \n */
  1456.               break;
  1457. !         }
  1458.   }
  1459.   
  1460. --- 37,55 ----
  1461.       register struct hdrdef **hpp;
  1462.   
  1463. !     for (hpp = hdrlst; *hpp != NULL; hpp++) {
  1464. !         register char *hdrnm = (*hpp)->hdrnm;
  1465.   
  1466. !         if (CISTREQN(line, hdrnm, (int)(*hpp)->hdrlen) &&
  1467. !             (*hpp)->hdroff >= 0)    /* paranoia */
  1468.               break;
  1469. !     }
  1470. !     if (*hpp != NULL) {
  1471. !         register char **ptrp = (char **)((char *)hdrs+(*hpp)->hdroff);
  1472. !         nnfree(ptrp);        /* free prev. value in this article */
  1473. !         *ptrp = strsave(skipsp(&line[(*hpp)->hdrlen]));
  1474. !         if (*ptrp != NULL)
  1475. !             trim(*ptrp);        /* cut trailing \n */
  1476. !     }
  1477.   }
  1478.   
  1479.  
  1480. *** cnpatch/tmp.file    Thu Sep 14 15:54:08 1989
  1481. --- relay/history.c    Wed Sep  6 16:28:09 1989
  1482. ***************
  1483. *** 23,26 ****
  1484. --- 23,27 ----
  1485.   #include "libc.h"
  1486.   #include "news.h"
  1487. + #include "case.h"
  1488.   #include "config.h"
  1489.   #include "fgetmfs.h"
  1490. ***************
  1491. *** 101,105 ****
  1492.       if (!openhist())
  1493.           return msgidkey;
  1494. !     clnmsgid = strsave(msgid);
  1495.       sanitise(clnmsgid);
  1496.       msgidkey.dptr = clnmsgid;
  1497. --- 102,106 ----
  1498.       if (!openhist())
  1499.           return msgidkey;
  1500. !     clnmsgid = rfc822ize(strsave(msgid));
  1501.       sanitise(clnmsgid);
  1502.       msgidkey.dptr = clnmsgid;
  1503. ***************
  1504. *** 233,243 ****
  1505.           fulldisk(art, filename);
  1506.   
  1507. !     msgidkey.dptr = msgid;
  1508.       msgidkey.dsize = strlen(msgid) + 1;    /* include NUL */
  1509.       posdatum.dptr = (char *)&pos;
  1510.       posdatum.dsize = sizeof pos;
  1511. ! #ifdef NOSTOREVAL
  1512. !     /* original v7 dbm store() returned no value */
  1513. !     (void) store(msgidkey, posdatum);
  1514.   #else
  1515.       if (store(msgidkey, posdatum) < 0)
  1516. --- 234,243 ----
  1517.           fulldisk(art, filename);
  1518.   
  1519. !     msgidkey.dptr = rfc822ize(strsave(msgid));
  1520.       msgidkey.dsize = strlen(msgid) + 1;    /* include NUL */
  1521.       posdatum.dptr = (char *)&pos;
  1522.       posdatum.dsize = sizeof pos;
  1523. ! #ifdef NOSTOREVAL        /* original v7 dbm store() returned no value */
  1524. !     store(msgidkey, posdatum);
  1525.   #else
  1526.       if (store(msgidkey, posdatum) < 0)
  1527. ***************
  1528. *** 244,247 ****
  1529. --- 244,248 ----
  1530.           fulldisk(art, filename);
  1531.   #endif
  1532. +     free(msgidkey.dptr);
  1533.   }
  1534.   
  1535.  
  1536. *** cnpatch/tmp.file    Thu Sep 14 15:54:14 1989
  1537. --- relay/makefile    Wed Sep 13 20:48:34 1989
  1538. ***************
  1539. *** 76,80 ****
  1540.       cp aux/* $(NEWSBIN)/relay
  1541.       rm -f $(BIN)/inews
  1542. !     ln $(NEWSBIN)/inject/inews $(BIN)/inews || cp sh/inews $(BIN)
  1543.   
  1544.   cmp:    relaynews
  1545. --- 76,80 ----
  1546.       cp aux/* $(NEWSBIN)/relay
  1547.       rm -f $(BIN)/inews
  1548. !     ln $(NEWSBIN)/inject/inews $(BIN)/inews 2>/dev/null || cp sh/inews $(BIN)
  1549.   
  1550.   cmp:    relaynews
  1551.  
  1552. *** cnpatch/tmp.file    Thu Sep 14 15:54:20 1989
  1553. --- relay/procart.c    Wed Sep  6 16:34:22 1989
  1554. ***************
  1555. *** 214,218 ****
  1556.           art->a_charswritten += bodylen;
  1557.       }
  1558. !     for (; art->a_unread > 0 && !(art->a_status&ST_DISKFULL) &&
  1559.           (readcnt=fread(block, 1, (int)min(art->a_unread, COPYSIZE), in)) > 0;
  1560.           art->a_unread -= readcnt, art->a_charswritten += readcnt)
  1561. --- 214,218 ----
  1562.           art->a_charswritten += bodylen;
  1563.       }
  1564. !     for (; art->a_unread > 0 && !(art->a_status&ST_DISKFULL) && !feof(in) &&
  1565.           (readcnt=fread(block, 1, (int)min(art->a_unread, COPYSIZE), in)) > 0;
  1566.           art->a_unread -= readcnt, art->a_charswritten += readcnt)
  1567.  
  1568. *** cnpatch/tmp.nonexistent.file.with.very.long.name.for.stupid.patch    Thu Sep 14 15:54:41 1989
  1569. --- relay/regress/out/stderr    Wed Sep 13 20:35:17 1989
  1570. ***************
  1571. *** 0 ****
  1572. --- 1 ----
  1573. + ./relaynews: warning: renouncing setuid due to nonstandard `NEWSARTS'
  1574.  
  1575. *** cnpatch/tmp.file    Thu Sep 14 15:54:45 1989
  1576. --- relay/relaynews.c    Wed Sep  6 16:25:32 1989
  1577. ***************
  1578. *** 250,257 ****
  1579.   }
  1580.   
  1581.   void
  1582. ! unprivileged()        /* called if NEWSARTS, NEWSCTL or NEWSBIN present */
  1583.   {
  1584.       userealids = YES;
  1585.   }
  1586.   
  1587. --- 250,267 ----
  1588.   }
  1589.   
  1590. + /*
  1591. +  * called if NEWSARTS, NEWSCTL, NEWSBIN, etc. are non-standard.
  1592. +  * this may be due to legitimate testing, but we can't tell.
  1593. +  * the error message will at least be seen by a human trying to
  1594. +  * track down a problem, even if stderr isn't normally seen.
  1595. +  */
  1596.   void
  1597. ! unprivileged(reason)
  1598. ! char *reason;
  1599.   {
  1600.       userealids = YES;
  1601. +     (void) fprintf(stderr,
  1602. +         "%s: warning: renouncing setuid due to nonstandard `%s'\n",
  1603. +                             progname, reason);
  1604.   }
  1605.   
  1606.  
  1607. *** cnpatch/tmp.file    Thu Sep 14 15:54:47 1989
  1608. --- relay/sh/anne.jones    Fri Sep  8 13:20:58 1989
  1609. ***************
  1610. *** 110,115 ****
  1611.       # strip invisible chars, a la B news; turn tabs to spaces (RFC1036)
  1612.       case "$trversion" in
  1613. !     v7)    tr -d '\1-\7\13\14\16-\37';;
  1614. !     v6)    tr -d '[\1-\7]\13\14[\16-\37]' ;;
  1615.       esac |
  1616.       sed 's/:    /: /' |
  1617. --- 110,115 ----
  1618.       # strip invisible chars, a la B news; turn tabs to spaces (RFC1036)
  1619.       case "$trversion" in
  1620. !     v7)    tr -d  '\1-\7\13\15-\37' ;;
  1621. !     v6)    tr -d '[\1-\7]\13[\15-\37]' ;;
  1622.       esac |
  1623.       sed 's/:    /: /' |
  1624.  
  1625. *** cnpatch/tmp.file    Thu Sep 14 15:54:48 1989
  1626. --- relay/sh/ctlrun    Tue Aug 29 12:16:21 1989
  1627. ***************
  1628. *** 14,23 ****
  1629.   for file in *
  1630.   do
  1631. !     grep '^Control:' $file |
  1632. !         sed 's;^Control:[     ]*;'$NEWSBIN/ctl/';' |
  1633. !         grep -v '/cancel ' >/tmp/ctl$$    # cancel needs dbm(3)
  1634.       sh -x /tmp/ctl$$ <$file
  1635.   done
  1636.   
  1637. ! rm -f /tmp/ctl$$    
  1638. ! rm -f LOCK
  1639. --- 14,23 ----
  1640.   for file in *
  1641.   do
  1642. !     # cancel, ihave and sendme are internal to relaynews and use < > metachars.
  1643. !     canonhdr $file | 
  1644. !         sed -n 's;^Control:[     ]*;'$NEWSBIN/ctl/';p' |
  1645. !         egrep -v '/(cancel|ihave|sendme) ' >/tmp/ctl$$
  1646.       sh -x /tmp/ctl$$ <$file
  1647.   done
  1648.   
  1649. ! rm -f /tmp/ctl$$ LOCK
  1650.  
  1651. *** cnpatch/tmp.file    Thu Sep 14 15:54:49 1989
  1652. --- relay/sh/inews    Fri Sep  8 13:20:58 1989
  1653. ***************
  1654. *** 39,43 ****
  1655.   -p)
  1656.       shift
  1657. !     exec rnews $*        # rnews, bailing out at or near line 1
  1658.       ;;
  1659.   esac
  1660. --- 39,44 ----
  1661.   -p)
  1662.       shift
  1663. !     cat $* | relaynews -r    # feed directly to relaynews, seat belts off
  1664. !     exit
  1665.       ;;
  1666.   esac
  1667. ***************
  1668. *** 159,162 ****
  1669. --- 160,167 ----
  1670.   trap "$cleanup" 0
  1671.   tear /tmp/in$$ <$input        # output in $inhdrs and $inbody
  1672. + # canonicalise header keyword capitalisation.
  1673. + # greps for Control: and Approved: later assume this, as does defhdrs.awk.
  1674. + canonhdr <$inhdrs >/tmp/in$$realtmp
  1675. + mv /tmp/in$$realtmp $inhdrs
  1676.   # pad zero-line articles, since old B [ir]news are confused by them
  1677.   # and the news readers generate zero-line control messages, alas.
  1678. ***************
  1679. *** 184,191 ****
  1680.   # echo Lines: $lines
  1681.   
  1682. !  # strip invisible chars from body, a la B news
  1683.    case "$trversion" in
  1684. !  v7)    tr -d '\1-\7\13\14\16-\37' ;;
  1685. !  v6)    tr -d '[\1-\7]\13\14[\16-\37]' ;;
  1686.    esac <$inbody
  1687.   
  1688. --- 189,196 ----
  1689.   # echo Lines: $lines
  1690.   
  1691. !  # strip invisible chars from body, a la B news.  bells and escapes are right out.
  1692.    case "$trversion" in
  1693. !  v7)    tr -d  '\1-\7\13\15-\37' ;;
  1694. !  v6)    tr -d '[\1-\7]\13[\15-\37]' ;;
  1695.    esac <$inbody
  1696.   
  1697. ***************
  1698. *** 234,265 ****
  1699.           m)
  1700.               if grep -s '^Approved:[     ]' $inhdrs >/dev/null; then
  1701. !                 rm -f $modroute        # just post normally
  1702.               else
  1703. !                 # un-Approved: mail it to the moderator(s).
  1704. !                 echo "%s" >$modroute    # in case no route
  1705. !                 # look for route for this group
  1706. !                 cat $NEWSCTL/mailpaths |
  1707. !                     while read ngpat route junk
  1708. !                     do
  1709. !                         # a dreadful B 2.11 hack:
  1710. !                         # backbone == all
  1711. !                         case "$ngpat" in
  1712. !                         backbone) ngpat="all" ;;
  1713. !                         esac
  1714. !                         if gngp -a "$ngpat" $nglist >/dev/null; then
  1715. !                             echo "$route" >$modroute
  1716. !                             break    # take only 1st match
  1717. !                         fi
  1718. !                     done
  1719. !             fi
  1720. !             # ngpat and route are not set here, damn it!
  1721. !             if test -s $modroute; then
  1722. !                 # an unapproved article in a mod group:
  1723. !                 # mail the article to this moderator.
  1724. !                 moderator=`
  1725. !                  sed "s/%s/\` echo $ng | tr . - \`/" $modroute
  1726. !                 `
  1727.                   echo "$0: mailing your article to $moderator" >&2
  1728. !                 mail $moderator <$censart
  1729.                   trap 0    # this is a child process - no cleanup here
  1730.                   echo 0 >$exitflag
  1731. --- 239,257 ----
  1732.           m)
  1733.               if grep -s '^Approved:[     ]' $inhdrs >/dev/null; then
  1734. !                 :        # just post normally
  1735.               else
  1736. !                 # un-Approved article: mail it to the moderator(s).
  1737. !                 # look for a route for this group.
  1738. !                 # a dreadful B 2.11 hack: backbone == all
  1739. !                 (sed 's/^backbone[     ]/all /' \
  1740. !                             $NEWSCTL/mailpaths |
  1741. !                         gngp -a -r "`cat $nglist`";
  1742. !                         echo 'default    %s') |
  1743. !                     sed -n "1{s/^[^     ]*[     ][     ]*//
  1744. !                         s/%s/` echo $ng | tr . - `/p;q;}" \
  1745. !                         >$modroute
  1746. !                 moderator="`cat $modroute `"
  1747.                   echo "$0: mailing your article to $moderator" >&2
  1748. !                 mail "$moderator" <$censart
  1749.                   trap 0    # this is a child process - no cleanup here
  1750.                   echo 0 >$exitflag
  1751. ***************
  1752. *** 335,341 ****
  1753.       ;;
  1754.   *)
  1755. !     status=`rsh $server \
  1756. ! "PATH=$PATH relaynews $relayopts -s $exclusion -d \"$debug\"; echo status $?" \
  1757. !         <$censart >$outfile; sed -n '/^status /s///p' $outfile `
  1758.       sed '/^status /d' $outfile    # print relaynews's stdout
  1759.       ;;
  1760. --- 327,342 ----
  1761.       ;;
  1762.   *)
  1763. !     # send article+commands to remote shell, including clean up
  1764. !     (echo "sed 's/^-//' >/tmp/irsh\$\$ <<'!'"    # remove guard
  1765. !      sed 's/^[^A-EG-Za-z0-9]/-&/' $censart    # prepend guard
  1766. !      echo !
  1767. !      cat <<!
  1768. ! PATH=$PATH relaynews $relayopts -s $exclusion -d "$debug" </tmp/irsh\$\$
  1769. ! !
  1770. !      echo 'echo status $?'
  1771. !      echo 'rm -f /tmp/irsh$$') |
  1772. !         rsh $server /bin/sh >$outfile
  1773. !     status=`sed -n '/^status /s///p' $outfile `
  1774.       sed '/^status /d' $outfile    # print relaynews's stdout
  1775.       ;;
  1776.  
  1777. Files that are new:
  1778.  
  1779. new batch/viarsh (patch can't create, so diff against null):
  1780. Index: batch/viarsh
  1781. *** cnpatch/tmp.preposterously.long.name.to.make.patch.behave.right    Thu Sep 14 15:51:06 1989
  1782. --- batch/viarsh    Sat Aug 26 22:48:03 1989
  1783. ***************
  1784. *** 0 ****
  1785. --- 1,5 ----
  1786. + #! /bin/sh
  1787. + # Transmit batch to $1 by rshing rnews.  This does assume that rnews is
  1788. + # in a user-searched directory.
  1789. + exec rsh $1 rnews
  1790.  
  1791. new expire/recovact (patch can't create, so diff against null):
  1792. Index: expire/recovact
  1793. *** cnpatch/tmp.preposterously.long.name.to.make.patch.behave.right    Thu Sep 14 15:51:06 1989
  1794. --- expire/recovact    Thu Sep 14 15:50:17 1989
  1795. ***************
  1796. *** 0 ****
  1797. --- 1,62 ----
  1798. + #! /bin/sh
  1799. + # Try to recover 2nd field of active file.
  1800. + # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  1801. + . ${NEWSCONFIG-/usr/lib/news/bin/config}
  1802. + PATH=$NEWSCTL/bin:$NEWSBIN/expire:$NEWSBIN:$NEWSPATH ; export PATH
  1803. + umask $NEWSUMASK
  1804. + cd $NEWSCTL || { echo "$0: can't cd to $NEWSCTL" >&2; exit 1; }
  1805. + # check active file format
  1806. + set ""`sed 1q active`
  1807. + case $# in
  1808. + 4)    ;;
  1809. + *)    echo "$0: active file has other than 4 fields" >&2
  1810. +     exit 1 ;;
  1811. + esac
  1812. + # lock news system
  1813. + lock="$NEWSCTL/LOCK"
  1814. + ltemp="$NEWSCTL/L.$$"
  1815. + echo $$ >$ltemp
  1816. + trap "rm -f $ltemp ; exit 0" 0 1 2 15
  1817. + while true
  1818. + do
  1819. +     if newslock $ltemp $lock
  1820. +     then
  1821. +         trap "rm -f $ltemp $lock ; exit 0" 0 1 2 15
  1822. +         break
  1823. +     fi
  1824. +     sleep 30
  1825. + done
  1826. + while read group max min fourth
  1827. + do
  1828. +     dir=`echo $group | tr . / `    # map ng name to directory name
  1829. +     new=
  1830. +     if test -d $NEWSARTS/$dir
  1831. +     then
  1832. +         new=`ls $NEWSARTS/$dir | egrep '^[0-9]+$' | sort -n | tail -1`
  1833. +     fi
  1834. +     case "$new" in
  1835. +     "")    new=$max    ;;    # no files -- preserve old value
  1836. +     *)    if test "$new" -lt "$max"    # old value more recent (!)
  1837. +         then
  1838. +             new="$max"
  1839. +         fi
  1840. +         ;;
  1841. +     esac
  1842. +     dots="`echo $max | tr 0123456789 ..........`"
  1843. +     max="`expr 0000000000$new : '.*\('$dots'\)$'`"    # preserve length
  1844. +     echo $group $max $min $fourth
  1845. + done <active >active.new
  1846. + # replace active, carefully
  1847. + rm -f active.old
  1848. + ln active active.old
  1849. + mv active.new active
  1850. + exit 0
  1851.  
  1852. new misc/canonhdr.c (patch can't create, so diff against null):
  1853. Index: misc/canonhdr.c
  1854. *** cnpatch/tmp.preposterously.long.name.to.make.patch.behave.right    Thu Sep 14 15:51:06 1989
  1855. --- misc/canonhdr.c    Tue Aug 29 12:18:06 1989
  1856. ***************
  1857. *** 0 ****
  1858. --- 1,93 ----
  1859. + /*
  1860. +  * canonhdr - canonicalise capitalisation of header keywords
  1861. +  */
  1862. + #include <stdio.h>
  1863. + #include <ctype.h>
  1864. + #include <sys/types.h>
  1865. + #include "news.h"
  1866. + #include "libc.h"
  1867. + char *progname;
  1868. + int debug;
  1869. + /*
  1870. +  * main - parse arguments and handle options
  1871. +  */
  1872. + main(argc, argv)
  1873. + int argc;
  1874. + char *argv[];
  1875. + {
  1876. +     int c;
  1877. +     int errflg = 0;
  1878. +     extern int optind;
  1879. +     extern char *optarg;
  1880. +     extern FILE *efopen();
  1881. +     progname = argv[0];
  1882. +     while ((c = getopt(argc, argv, "d")) != EOF)
  1883. +         switch (c) {
  1884. +         case 'd':
  1885. +             ++debug;
  1886. +             break;
  1887. +         default:
  1888. +             errflg++;
  1889. +             break;
  1890. +         }
  1891. +     if (errflg) {
  1892. +         (void) fprintf(stderr, "usage: %s [-d] [file]...\n", progname);
  1893. +         exit(2);
  1894. +     }
  1895. +     if (optind >= argc)
  1896. +         process(stdin, "stdin");
  1897. +     else
  1898. +         for (; optind < argc; optind++)
  1899. +             if (STREQ(argv[optind], "-"))
  1900. +                 process(stdin, "-");
  1901. +             else {
  1902. +                 FILE *in = efopen(argv[optind], "r");
  1903. +                 process(in, argv[optind]);
  1904. +                 (void) fclose(in);
  1905. +             }
  1906. +     exit(0);
  1907. + }
  1908. + /*
  1909. +  * process - process input file
  1910. +  */
  1911. + process(in, inname)
  1912. + FILE *in;
  1913. + char *inname;
  1914. + {
  1915. +     register char *hdr;
  1916. +     int ishdr = YES;
  1917. +     long nolimit = -1;
  1918. +     static int washdr = YES;
  1919. +     if (!washdr)
  1920. +         return;
  1921. +     while ((hdr = gethdr(in, &nolimit, &ishdr)) != NULL && ishdr) {
  1922. +         register char *cp;
  1923. +         static char canonmsgid[] = "Message-Id:";
  1924. +         static char magicmsgid[] = "Message-ID:";
  1925. +         /* capitalise initial letter of each word, Message-ID: special */
  1926. +         for (cp = hdr; *cp != ':' && *cp != '\0'; cp++)
  1927. +             if (cp == hdr || cp[-1] == '-') {
  1928. +                 if (isascii(*cp) && islower(*cp))
  1929. +                     *cp = toupper(*cp);
  1930. +             } else
  1931. +                 if (isascii(*cp) && isupper(*cp))
  1932. +                     *cp = tolower(*cp);
  1933. +         if (STREQN(hdr, canonmsgid, sizeof canonmsgid - 1))
  1934. +             (void) strncpy(hdr, magicmsgid, sizeof magicmsgid - 1);
  1935. +         (void) fputs(hdr, stdout);
  1936. +         /* must not free hdr; gethdr will do so automatically */
  1937. +     }
  1938. +     if (hdr != NULL)
  1939. +         free(hdr);
  1940. +     if (!ishdr)
  1941. +         washdr = NO;
  1942. + }
  1943.  
  1944.  
  1945. end of patch 14-Sep-1989
  1946. -- 
  1947. V7 /bin/mail source: 554 lines.|     Henry Spencer at U of Toronto Zoology
  1948. 1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
  1949.  
  1950.  
  1951.