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