home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1492 / rmgroup < prev   
Encoding:
Text File  |  1990-12-28  |  1.1 KB  |  43 lines

  1. #! /bin/sh
  2. # rmgroup group
  3. #
  4. # Modified by Chip Salzenberg, 7 June 1990.
  5. # Send mail to Usenet administrator describing the rmgroup request.
  6. # But if group doesn't exist, don't bother.
  7.  
  8. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  9. . ${NEWSCONFIG-/usr/lib/news/bin/config}
  10. export NEWSCTL NEWSBIN NEWSARTS
  11. PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
  12. umask $NEWSUMASK
  13.  
  14. afile=/tmp/ncd
  15. afilehdr=/tmp/ncdhdr
  16. afilebody=/tmp/ncdbody
  17. hdr=/tmp/nc$$
  18.  
  19. trap "exit 1" 1 2 3 13 15
  20. trap "rm -f $hdr $afile $afilehdr $afilebody; exit 0" 0
  21.  
  22. $NEWSBIN/inject/tear $afile
  23. $NEWSBIN/canonhdr <$afilehdr >$hdr
  24.  
  25. # unapproved ctl msg? then quit
  26. egrep '^Approved:' $hdr >/dev/null || { rm -f $afile*; exit 0; }
  27.  
  28. # quit if no active entry
  29. egrep "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active >/dev/null || exit 0
  30.  
  31. SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
  32. case "$SENDER" in
  33. "")    SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//'`" ;;
  34. esac
  35.  
  36. # tell the local usenet administrator to do it by hand
  37. G="$1"
  38. ( echo "$SENDER says"
  39.   echo "to remove the group '$G',"
  40.   echo "and adds this comment:";
  41.   cat $afilebody ) |
  42.     mail -s "rmgroup $G" $NEWSMASTER
  43.