Commit | Line | Data |
---|---|---|
25a197fc C |
1 | #!/bin/sh |
2 | # : newsgroups.SH,v 4.3 85/05/01 11:43:27 lwall Exp $ | |
3 | # | |
4 | # : newsgroups.SH,v $ | |
5 | # Revision 4.3 85/05/01 11:43:27 lwall | |
6 | # Baseline for release with 4.3bsd. | |
7 | # | |
8 | ||
9 | export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) | |
10 | ||
11 | : syntax: newsgroups [pattern] [pipeflag] | |
12 | ||
13 | : System Dependencies | |
14 | ||
15 | : You might want to change pager to a "make column" program if you have one. | |
16 | : On the other hand, if your kernel does paging, cat would probably do. | |
17 | pager="/usr/ucb/more" | |
18 | active="/tmp/active.$$" | |
19 | ||
20 | : End of system dependencies, hopefully | |
21 | ||
22 | /usr/local/lib/rn/getactive $active | |
23 | ||
24 | if /bin/test $# -ge 2 ; then | |
25 | pager=cat | |
26 | else | |
27 | echo "Completely unsubscribed newsgroups:" | |
28 | fi | |
29 | ||
30 | dotdir=${DOTDIR-${HOME-$LOGDIR}} | |
31 | ||
32 | : Throwing .newsrc into the pot twice is a lovely hack to prevent | |
33 | : bogus newsgroups from showing up as unsubscribed. | |
34 | ||
35 | cat $dotdir/.newsrc $dotdir/.newsrc $active | \ | |
36 | sed -e '/^options/d' \ | |
37 | -e '/^[ ]/d' \ | |
38 | -e '/^control/d' \ | |
39 | -e '/^to\./d' \ | |
40 | -e 's/^\([^ !:]*\)[ !:].*$/\1/' \ | |
41 | -e "/.*$1/p" \ | |
42 | -e 'd' | \ | |
43 | sort | uniq -u | $pager | |
44 | if /bin/test $# -ge 2 ; then | |
45 | exit | |
46 | fi | |
47 | echo -n "[Type return to continue] " | |
48 | read tmp | |
49 | echo "" | |
50 | echo "Unsubscribed but mentioned in .newsrc:" | |
51 | sed < $dotdir/.newsrc \ | |
52 | -e "/$1.*!/"'s/^\([^!]*\)!.*$/\1/p' \ | |
53 | -e 'd' | \ | |
54 | sort | $pager | |
55 | rm $active |