Article View: news.software.b
Article #5016Re: These C News "newgroup/rmgroup" scripts ignore crybabies
From: Chip Salzenberg
Date: Thu, 22 Oct 1992 19:21
Date: Thu, 22 Oct 1992 19:21
214 lines
7603 bytes
7603 bytes
According to derwin@mach2.wlu.ca (Daryl Erwin):
>How do I stop the addgroup and rmgroups from automatically occuring?
The below C News newgroup and rmgroup scripts do nothing except send
mail to the Usenet administrator. No more hassles from alt.crybabies.
Also, improving on previous releases, these scripts allow you to put a
list of contested newsgroups in /usr/lib/news/control.ignore; messages
regarding those newsgroups are dropped in the bit bucket.
Shar and enjoy.
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: newgroup rmgroup
# Wrapped by chip@animal on Thu Oct 22 15:15:08 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'newgroup' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'newgroup'\"
else
echo shar: Extracting \"'newgroup'\" \(2834 characters\)
sed "s/^X//" >'newgroup' <<'END_OF_FILE'
X#! /bin/sh
X# newgroup group flag
X# subject to our sys file group pattern
X#
X#----------------------------------------------------------------------------
X# READ THIS FIRST:
X# Be sure to modify the definition of NEWSCONFIG appropriately.
X# Also, if you're on a BSD-derived system, you will probably need to
X# change the definition of $MAIL from "mail" to "Mail".
X#----------------------------------------------------------------------------
X#
X# Modified by Chip Salzenberg, 19 October 1992
X# Ignore messages for groups named in "$NEWSLIB/control.ignore".
X#
X# Modified by Chip Salzenberg, 21 November 1990
X# Settle "mail" vs. "Mail" with the $MAIL variable.
X# Combine all possibilities into one mail statement.
X#
X# Modified by David C Lawrence, 25 August 1990
X# Include whole article. Fixed testing for change of status.
X#
X# Modified by Bill Wisner, 23 August 1990
X# Properly handle changes in moderation status.
X#
X# Modified by Chip Salzenberg, 7 June 1990.
X# Send mail to Usenet administrator describing the newgroup request.
X# But if group already exists with correct type, don't bother.
X#
X
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
Xexport NEWSCTL NEWSBIN NEWSARTS
XPATH=$NEWSCTL/bin:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH # include mkpdir
Xumask $NEWSUMASK
X
XMAIL=mail
X
Xafile=/tmp/ncd
Xafilehdr=${afile}hdr
Xafilebody=${afile}body
Xhdr=/tmp/nc$$
X
Xtrap "exit 1" 1 2 3 13 15
Xtrap "rm -f $hdr $afilehdr $afilebody" 0
X
X$NEWSBIN/inject/tear $afile
X$NEWSBIN/canonhdr <$afilehdr >$hdr
X
X# unapproved ctl msg? then quit
Xegrep '^Approved:' $hdr >/dev/null || exit 1
X
X# figure an egrep pattern for the group
Xpat="^`echo $1 | sed 's/[+\.]/\\\\&/g'` "
X
X# quit if the group is a bone of contention
Xgrep -s "$pat\$" $NEWSLIB/control.ignore && exit 0
X
X# quit if the group already exists in the form requested
Xtype=`awk "/$pat/ { print \\$4; exit }" $NEWSCTL/active`
X
Xcase "$type" in
Xx|=*) exit 0 ;;
Xy) test "" = "$2" && exit 0 ;;
Xm) test "moderated" = "$2" && exit 0 ;;
Xesac
X
X# determine who sent the message
XSENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
Xcase "$SENDER" in
X"") SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//' `" ;;
Xesac
X
Xif test "y" = "$type" -a "moderated" = "$2"; then
X subject="Make $1 moderated"
X killme="change the group '$1' from unmoderated to moderated"
Xelif test "m" = "$type" -a "moderated" != "$2"; then
X subject="Make $1 unmoderated"
X killme="change the group '$1' from moderated to unmoderated"
Xelse
X subject="Create $1 $2"
X if test "moderated" = "$2"; then
X killme="create the moderated group '$1'"
X else
X killme="create the group '$1'"
X fi
Xfi
X
X( echo "$SENDER says"
X echo "to $killme"
X echo "in this article:"
X echo "================================================================"
X cat $afilehdr $afilebody ) |
X $MAIL -s "$subject" "$NEWSMASTER"
Xexit 0
END_OF_FILE
if test 2834 -ne `wc -c <'newgroup'`; then
echo shar: \"'newgroup'\" unpacked with wrong size!
fi
chmod +x 'newgroup'
# end of 'newgroup'
fi
if test -f 'rmgroup' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'rmgroup'\"
else
echo shar: Extracting \"'rmgroup'\" \(1985 characters\)
sed "s/^X//" >'rmgroup' <<'END_OF_FILE'
X#! /bin/sh
X# rmgroup group
X#
X#----------------------------------------------------------------------------
X# READ THIS FIRST:
X# Be sure to modify the definition of NEWSCONFIG appropriately.
X# Also, if you're on a BSD-derived system, you will probably need to
X# change the definition of $MAIL from "mail" to "Mail".
X#----------------------------------------------------------------------------
X#
X# Modified by Chip Salzenberg, 19 October 1992
X# Ignore messages for groups named in "$NEWSLIB/control.ignore".
X#
X# Modified by Chip Salzenberg, 21 November 1990
X# Settle "mail" vs. "Mail" with the $MAIL variable.
X#
X# Modified by Chip Salzenberg, 7 June 1990.
X# Send mail to Usenet administrator describing the rmgroup request.
X# But if group doesn't exist, don't bother.
X#
X
X# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
X. ${NEWSCONFIG-/usr/lib/news/bin/config}
Xexport NEWSCTL NEWSBIN NEWSARTS
XPATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
Xumask $NEWSUMASK
X
XMAIL=mail
X
Xafile=/tmp/ncd
Xafilehdr=/tmp/ncdhdr
Xafilebody=/tmp/ncdbody
Xhdr=/tmp/nc$$
X
Xtrap "exit 1" 1 2 3 13 15
Xtrap "rm -f $hdr $afilehdr $afilebody" 0
X
X$NEWSBIN/inject/tear $afile
X$NEWSBIN/canonhdr <$afilehdr >$hdr
X
X# unapproved ctl msg? then quit
Xegrep '^Approved:' $hdr >/dev/null || exit 1
X
X# figure an egrep pattern for the group
Xpat="^`echo $1 | sed 's/[+\.]/\\\\&/g'` "
X
X# quit if the group is a bone of contention
Xgrep -s "$pat\$" $NEWSLIB/control.ignore && exit 0
X
X# quit if the group is missing or if type is 'x' or '='
Xtype=`awk "/$pat/ { print \\$4; exit }" $NEWSCTL/active`
X
Xcase "$type" in
X""|x|=*) exit 0 ;;
Xesac
X
X# determine who sent the message
XSENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
Xcase "$SENDER" in
X"") SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//'`" ;;
Xesac
X
X( echo "$SENDER says"
X echo "to remove the group '$1'"
X echo "in this article:"
X echo "================================================================"
X cat $afilehdr $afilebody ) |
X $MAIL -s "Remove $1" "$NEWSMASTER"
Xexit 0
END_OF_FILE
if test 1985 -ne `wc -c <'rmgroup'`; then
echo shar: \"'rmgroup'\" unpacked with wrong size!
fi
chmod +x 'rmgroup'
# end of 'rmgroup'
fi
echo shar: End of shell archive.
exit 0
--
Chip Salzenberg at Teltronics/TCT <chip@tct.com>, <73717.366@compuserve.com>
"I am truly as big a genius as all other Rush fans." -- Bruce Bufalini
Technical Details
Message-ID:
<2AE6FF2C.AAF9@tct.com>Path:
arc1-ca.pugleaf.net!wupost!cs.utexas.edu!uunet!sybus.sybus.com!myrddin!tct!chipReferences:
<BwJ5ou.2yx@mach1.wlu.ca>Show Full Headers
Complete Article Headers
Newsgroups: news.software.b,news.admin.policy,alt.sources Path: arc1-ca.pugleaf.net!wupost!cs.utexas.edu!uunet!sybus.sybus.com!myrddin!tct!chip From: chip@tct.com (Chip Salzenberg) Subject: Re: These C News "newgroup/rmgroup" scripts ignore crybabies Message-ID: <2AE6FF2C.AAF9@tct.com> Date: Thu, 22 Oct 1992 19:21:16 GMT References: <BwJ5ou.2yx@mach1.wlu.ca> Organization: TC Telemanagement, Clearwater, FL Keywords: Becker Poskanzer is-not is-too Followup-To: news.software.b,news.admin.policy Lines: 214