michael@stb.UUCP (Michael) (08/02/88)
Posting-number: Volume 4, Issue 3 Submitted-by: "Michael" <michael@stb.UUCP> Archive-name: delsub This program implements the "delsub" control message defined as unimplemented in news 2.11. Specifically, this program will modify the sys file to delete the subscription, but it is not (yet) called by the news program itself. (That will have to wait for patch 15) Usage: delsub site group ex: delsub uunet test.test Michael Note: Do Not Use This To Delete A Subscription For Your Own Site (the Me:all line), It Will Not Work. : hand shar, use sh # this comment is for some unshar's, the next for others #! /bin/sh cat > delsub <<\E*O*F : /bin/sh : Program to delete a subscription to a newsgroup for a site. site=$1 group=$2 cat >> /tmp/sub.$$ << END BEGIN {FS=":"} /^$site/ { END cat >> /tmp/sub.$$ << \END count = split ($0, array, ":"); END cat >> /tmp/sub.$$ << END if (count == 1) {state=1; print; next} if (count == 3) {state=3; printf ("%s:%s,!%s:%s\n", array[1],array[2],"$group",array[3]); next} if (count == 4) {state = 3; printf ("%s:%s,!%s:%s:%s\n", array[1],array[2],"$group",array[3],array[4]); next} if (count == 2) #Here we have a toughie. The second field must be modified, #but there is a \ at the end. Lets assume we can put our #thing on the next line. {print; print " !" "$group" ",\\\\" ;state=3; next} } state == 1 { # Here if the first line only declared the site name, and nothing else. END cat >> /tmp/sub.$$ << \END count = split ($0, array, ":"); END cat >> /tmp/sub.$$ << END if (count == 0) # Boy, are things screwed. {state=3; next} if (count == 1) {print; print "!" "$group" ",\\\\" ; state=3; next} if (count > 1) {state=3; printf ("%s,!%s:%s\n",array[1],"$group",array[2],array[3]); next} } state == 3 {print} state == 0 {print} END awk -f /tmp/sub.$$ /usr/lib/news/sys > /tmp/sys.$$ mv /usr/lib/news/sys /usr/lib/news/sys.old mv /tmp/sys.$$ /usr/lib/news/sys E*O*F : --- : Michael Gersten uunet.uu.net!denwa!stb!michael : sdcsvax!crash!gryphon!denwa!stb!michael : What would have happened if we had lost World War 2. Well, the west coast : would be owned by Japan, we would all be driving foreign cars, hmm...