[net.sources] checking active file against spool directory

larry@jc3b21.UUCP (Lawrence F. Strickland) (10/16/86)

When I started checking the /usr/lib/news/active file against the
directories in /usr/spool/news today, I noticed that there were quite
a few discrepancies.  Since it was difficult to determine what was and
was not acceptable, I wrote this quick shell script to find out.  It works
on our 3b2, don't guarantee it for anything else, though most of the
constructs are pretty standard.  Anyway, here it is if you want it.

There are bound to be few bugs, and it is not totally accurate (net and
mod appear because they are not in active).  Comments/suggestions/flames
are welcomed.  It is SLOW, though, if you can speed it up, let me know.

-----Lawrence F. Strickland (larry@jc3b21)     ---------------------------
     Dept. of Engineering Technology           + Cthulhu                 +
     St. Petersburg Jr. College                +      R`lyeh             +
     P.O. Box 13489                            +           wgah`nagl     +
     St. Petersburg, FL 33733                  +                 fh`tagn +
     Phone:  +1 813 341 4705                   ---------------------------

     UUCP:  ...akgua!usfvax2!jc3b21!larry

NOTE:  This is NOT a shar file, just cut and save.

--------------- cut here ----------------------- cut here -----------------
#!/bin/sh
#
#	ca -- check active file versus /usr/spool/news
#
: ${SPOOLDIR:=/usr/spool/news}
: ${LIBDIR:=/usr/lib/news}
TMP1=/tmp/ca1.$$
TMP2=/tmp/ca2.$$

trap 'rm $TMP1 $TMP2' 1 2 3 15

echo "Groups found only in" >$TMP1
echo "$LIBDIR/active" >>$TMP1
echo "-----------------------------------" >>$TMP1
echo "Directories found only in" >$TMP2
echo "$SPOOLDIR" >>$TMP2
echo "----------------------------------" >>$TMP2

echo "Building file of groups from $LIBDIR/active" 1>&2
sed 's/ .*$//' <$LIBDIR/active | sort >>$TMP1

echo "Building file of directories from $SPOOLDIR" 1>&2
cd $SPOOLDIR
find . -type d -print | sed '
1d
s/^\.\///
s/\//\./g
' | sort >>$TMP2

echo "Doing file comparison" 1>&2
echo
echo
sdiff -s -w 79 $TMP1 $TMP2 | sed '/^[0-9]/d'

rm $TMP1 $TMP2

exit 0