#!/bin/sh # $Id: newsgroups.SH,v 3.0 1992/02/01 03:09:32 davison Trn $ # # This software is Copyright 1991 by Stan Barber. # # Permission is hereby granted to copy, reproduce, redistribute or otherwise # use this software as long as: there is no monetary profit gained # specifically from the use or reproduction of this software, it is not # sold, rented, traded or otherwise marketed, and this copyright notice is # included prominently in any copy made. # # The author make no claims as to the fitness or correctness of this software # for any use whatsoever, and it is provided as is. Any use of this software # is at the user's own risk. export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) : syntax: newsgroups [pattern] [pipeflag] : System Dependencies : You might want to change pager to a "make column" program if you have one. : On the other hand, if your kernel does paging, cat would probably do. pager="/bin/more" active="/tmp/active.$$" rnlib=/usr/lib/trn case $rnlib in ~*) rnlib=`/usr/lib/trn/filexp $rnlib` ;; esac nntplist=/usr/bin/nntplist : End of system dependencies, hopefully if $nntplist ACTIVE $active; then : nothing else exit 1 fi if test $# -ge 2 ; then pager=cat else echo "Completely unsubscribed newsgroups:" fi dotdir=${DOTDIR-${HOME-$LOGDIR}} newsrc=$dotdir/.newsrc : Throwing .newsrc into the pot twice is a lovely hack to prevent : bogus newsgroups from showing up as unsubscribed. cat $newsrc $newsrc $active | \ sed -n -e '/^options/d' \ -e '/^[ ]/d' \ -e '/^control/d' \ -e '/^to\./d' \ -e '/ x$/d' \ -e 's/^\([^ !:]*\)[ !:].*$/\1/' \ -e "/.*$1/p" | \ sort | uniq -u | $pager rm -f $active if test $# -ge 2 ; then exit fi echo -n "[Type return to continue] " read tmp echo "" echo "Unsubscribed but mentioned in $newsrc:" sed -n < $newsrc \ -e "/$1.*!/"'s/^\([^!]*\)!.*$/\1/p' | \ sort | $pager