Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!csd4.milw.wisc.edu!indri!uflorida!novavax!twwells!bill From: bill@twwells.com (T. William Wells) Newsgroups: news.software.b Subject: Another nit for C news Message-ID: <1989Jul14.185052.18976@twwells.com> Date: 14 Jul 89 18:50:52 GMT Organization: None, Ft. Lauderdale, FL Lines: 75 In the wake of the escaped checkgroups control message, I discovered several minor problems with the checkgroups script. 1) It creates a file newsgroups.bac as a temp but never deletes it. 2) It does not keep an original copy of the newsgroups file around, making recovery from problems more than a little irritating. (No, newsgroups.bac is not a backup of the original.) 3) If the comment on the checkgroups input is different from the one you have in your newsgroups file, you get two newsgroups lines and no way to tell which is the right one. 4) Since the script distinguishes different representations of white space, if the checkgroups has spaces where yours has tabs or v.v., it is a real pain to figure out which really belongs. This is exacerbated by 2). Following is a context diff for the changes I made to mine to make it tolerable: *** checkgroups.old Fri Jul 14 14:39:55 1989 --- checkgroups Fri Jul 14 14:47:26 1989 *************** *** 13,23 **** # generate newsgroups from localgroups & beheaded stdin (checkgroups article). # appending to newsgroups instead of overwriting is a hack, # but is about the best we can do until checkgroups is defined. - (cat $NEWSCTL/localgroups; sed '1,/^$/d') >>$NEWSCTL/newsgroups - # backup newsgroups, then strip duplicates cp $NEWSCTL/newsgroups $NEWSCTL/newsgroups.bac || exit 1 ! sort -u -o $NEWSCTL/newsgroups $NEWSCTL/newsgroups.bac # generate list of approved newsgroups from $nl/newsgroups # [^.]*\. in next two egreps was net.|mod.|fa., which is inadequate - geoff (echo junk; echo control; sed 's/[ \ ].*//' $NEWSCTL/newsgroups | --- 13,31 ---- # generate newsgroups from localgroups & beheaded stdin (checkgroups article). # appending to newsgroups instead of overwriting is a hack, # but is about the best we can do until checkgroups is defined. cp $NEWSCTL/newsgroups $NEWSCTL/newsgroups.bac || exit 1 ! (cat $NEWSCTL/localgroups; sed '1,/^$/d') >>$NEWSCTL/newsgroups ! sort -u -o $NEWSCTL/newsgroups $NEWSCTL/newsgroups + # display differences between old and new newsgroups file + sort -u $NEWSCTL/localgroups | comm -13 - $NEWSCTL/newsgroups | + diff $NEWSCTL/newsgroups.bac - >/tmp/$$change + if test -s /tmp/$$change; then + echo "Changes to your newsgroups file:" + cat /tmp/$$change + echo "" + fi 2>&1 >/tmp/$$out + # generate list of approved newsgroups from $nl/newsgroups # [^.]*\. in next two egreps was net.|mod.|fa., which is inadequate - geoff (echo junk; echo control; sed 's/[ \ ].*//' $NEWSCTL/newsgroups | *************** *** 38,44 **** echo "You can do this by executing the commands:" sed "s;.*; $NEWSBIN/maint/delgroup &;" /tmp/$$remove echo "" ! fi 2>&1 >/tmp/$$out if test -s /tmp/$$add; then echo "The following newsgroups were missing." # "and were added." --- 46,52 ---- echo "You can do this by executing the commands:" sed "s;.*; $NEWSBIN/maint/delgroup &;" /tmp/$$remove echo "" ! fi 2>&1 >>/tmp/$$out if test -s /tmp/$$add; then echo "The following newsgroups were missing." # "and were added." --- Bill { uunet | novavax | ankh | sunvice } !twwells!bill bill@twwells.com