home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # newgroup group flag
- # subject to our sys file group pattern
- #
- # Modified by Chip Salzenberg, 7 June 1990.
- # Send mail to Usenet administrator describing the newgroup request.
- # But if group already exists with correct type, don't bother.
-
- # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
- . ${NEWSCONFIG-/usr/lib/news/bin/config}
- export NEWSCTL NEWSBIN NEWSARTS
- PATH=$NEWSCTL/bin:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH # include mkpdir
- umask $NEWSUMASK
-
- afile=/tmp/ncd
- afilehdr=/tmp/ncdhdr
- afilebody=/tmp/ncdbody
- hdr=/tmp/nc$$
-
- trap "exit 1" 1 2 3 13 15
- trap "rm -f $hdr $afile $afilehdr $afilebody; exit 0" 0
-
- $NEWSBIN/inject/tear $afile
- $NEWSBIN/canonhdr <$afilehdr >$hdr
-
- # unapproved ctl msg? then quit
- grep -s '^Approved:' $hdr >/dev/null || { rm -f $hdr; exit 0; }
-
- # quit if the group already exists in the form requested
- pat="^`echo $1 | sed 's/\./\\\\./g'` "
- case `awk "/$pat/ { print \\$4; exit }" $NEWSCTL/active` in
- x|=*) exit 0 ;;
- y) test "" = "$2" && exit 0 ;;
- m) test "moderated" = "$2" && exit 0 ;;
- esac
-
- SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
- case "$SENDER" in
- "") SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//' `" ;;
- esac
-
- # tell the local usenet administrator to do it by hand
- case "$2" in
- "") G="$1" ;;
- *) G="$1 $2" ;;
- esac
- ( echo "$SENDER says"
- echo "to create the group '$G',"
- echo "and adds this comment:";
- cat $afilebody ) |
- mail -s "newgroup $G" $NEWSMASTER
-