home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # rmgroup group
- #
- #----------------------------------------------------------------------------
- # READ THIS FIRST:
- # Be sure to modify the definition of NEWSCONFIG appropriately.
- # Also, if you're on a BSD-derived system, you will probably need to
- # change the definition of $MAIL from "mail" to "Mail".
- #----------------------------------------------------------------------------
- #
- # Modified by Chip Salzenberg, 21 November 1990
- # Settle "mail" vs. "Mail" with the $MAIL variable.
- #
- # Modified by Chip Salzenberg, 7 June 1990.
- # Send mail to Usenet administrator describing the rmgroup request.
- # But if group doesn't exist, don't bother.
- #
-
- # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
- . ${NEWSCONFIG-/usenet/bin.server/config}
- export NEWSCTL NEWSBIN NEWSARTS
- PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
- umask $NEWSUMASK
-
- MAIL=Mail
-
- afile=/tmp/ncd
- afilehdr=/tmp/ncdhdr
- afilebody=/tmp/ncdbody
- hdr=/tmp/nc$$
-
- trap "exit 1" 1 2 3 13 15
- trap "rm -f $hdr $afilehdr $afilebody" 0
-
- $NEWSBIN/inject/tear $afile
- $NEWSBIN/canonhdr <$afilehdr >$hdr
-
- # unapproved ctl msg? then quit
- egrep '^Approved:' $hdr >/dev/null || exit 1
-
- # quit if the group is missing or if type is 'x' or '='
- pat="^`echo $1 | sed 's/[+\.]/\\\\&/g'` "
- type=`awk "/$pat/ { print \\$4; exit }" $NEWSCTL/active`
-
- case "$type" in
- ""|x|=*) exit 0 ;;
- esac
-
- # determine who sent the message
- SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
- case "$SENDER" in
- "") SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//'`" ;;
- esac
-
- ( echo "$SENDER says"
- echo "to remove the group '$1'"
- echo "in this article:"
- echo "================================================================"
- cat $afilehdr $afilebody ) |
- $MAIL -s "Remove $1" "$NEWSMASTER"
- exit 0
-