home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # newgroup group flag
- # subject to our sys file group pattern
- #
- #----------------------------------------------------------------------------
- # 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.
- # Combine all possibilities into one mail statement.
- #
- # Modified by David C Lawrence, 25 August 1990
- # Include whole article. Fixed testing for change of status.
- #
- # Modified by Bill Wisner, 23 August 1990
- # Properly handle changes in moderation status.
- #
- # 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
-
- MAIL=mail
-
- afile=/tmp/ncd
- afilehdr=${afile}hdr
- afilebody=${afile}body
- 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 already exists in the form requested
- pat="^`echo $1 | sed 's/[+\.]/\\\\&/g'` "
- type=`awk "/$pat/ { print \\$4; exit }" $NEWSCTL/active`
-
- case "$type" in
- x|=*) exit 0 ;;
- y) test "" = "$2" && exit 0 ;;
- m) test "moderated" = "$2" && exit 0 ;;
- esac
-
- # determine who sent the message
- SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
- case "$SENDER" in
- "") SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//' `" ;;
- esac
-
- if test "y" = "$type" -a "moderated" = "$2"; then
- subject="Make $1 moderated"
- killme="change the group '$1' from unmoderated to moderated"
- elif test "m" = "$type" -a "moderated" != "$2"; then
- subject="Make $1 unmoderated"
- killme="change the group '$1' from moderated to unmoderated"
- else
- subject="Create $1 $2"
- if test "moderated" = "$2"; then
- killme="create the moderated group '$1'"
- else
- killme="create the group '$1'"
- fi
- fi
-
- ( echo "$SENDER says"
- echo "to $killme"
- echo "in this article:"
- echo "================================================================"
- cat $afilehdr $afilebody ) |
- $MAIL -s "$subject" "$NEWSMASTER"
- exit 0
-