BSD 4_3 development
[unix-history] / usr / contrib / nntp / rrn / newsgroups
CommitLineData
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
9export 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.
17pager="/usr/ucb/more"
18active="/tmp/active.$$"
19
20: End of system dependencies, hopefully
21
22/usr/local/lib/rn/getactive $active
23
24if /bin/test $# -ge 2 ; then
25 pager=cat
26else
27 echo "Completely unsubscribed newsgroups:"
28fi
29
30dotdir=${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
35cat $dotdir/.newsrc $dotdir/.newsrc $active | \
36sed -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' | \
43sort | uniq -u | $pager
44if /bin/test $# -ge 2 ; then
45 exit
46fi
47echo -n "[Type return to continue] "
48read tmp
49echo ""
50echo "Unsubscribed but mentioned in .newsrc:"
51sed < $dotdir/.newsrc \
52 -e "/$1.*!/"'s/^\([^!]*\)!.*$/\1/p' \
53 -e 'd' | \
54sort | $pager
55rm $active