home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2660 / rmgroup < prev   
Encoding:
Text File  |  1991-02-05  |  1.7 KB  |  62 lines

  1. #! /bin/sh
  2. # rmgroup group
  3. #
  4. #----------------------------------------------------------------------------
  5. # READ THIS FIRST:
  6. # Be sure to modify the definition of NEWSCONFIG appropriately.
  7. # Also, if you're on a BSD-derived system, you will probably need to
  8. # change the definition of $MAIL from "mail" to "Mail".
  9. #----------------------------------------------------------------------------
  10. #
  11. # Modified by Chip Salzenberg, 21 November 1990
  12. # Settle "mail" vs. "Mail" with the $MAIL variable.
  13. #
  14. # Modified by Chip Salzenberg, 7 June 1990.
  15. # Send mail to Usenet administrator describing the rmgroup request.
  16. # But if group doesn't exist, don't bother.
  17. #
  18.  
  19. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  20. . ${NEWSCONFIG-/usenet/bin.server/config}
  21. export NEWSCTL NEWSBIN NEWSARTS
  22. PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
  23. umask $NEWSUMASK
  24.  
  25. MAIL=Mail
  26.  
  27. afile=/tmp/ncd
  28. afilehdr=/tmp/ncdhdr
  29. afilebody=/tmp/ncdbody
  30. hdr=/tmp/nc$$
  31.  
  32. trap "exit 1" 1 2 3 13 15
  33. trap "rm -f $hdr $afilehdr $afilebody" 0
  34.  
  35. $NEWSBIN/inject/tear $afile
  36. $NEWSBIN/canonhdr <$afilehdr >$hdr
  37.  
  38. # unapproved ctl msg? then quit
  39. egrep '^Approved:' $hdr >/dev/null || exit 1
  40.  
  41. # quit if the group is missing or if type is 'x' or '='
  42. pat="^`echo $1 | sed 's/[+\.]/\\\\&/g'` "
  43. type=`awk "/$pat/ { print \\$4; exit }" $NEWSCTL/active`
  44.  
  45. case "$type" in
  46. ""|x|=*) exit 0 ;;
  47. esac
  48.  
  49. # determine who sent the message
  50. SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
  51. case "$SENDER" in
  52. "")    SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//'`" ;;
  53. esac
  54.  
  55. ( echo "$SENDER says"
  56.   echo "to remove the group '$1'"
  57.   echo "in this article:"
  58.   echo "================================================================"
  59.   cat $afilehdr $afilebody ) |
  60.     $MAIL -s "Remove $1" "$NEWSMASTER"
  61. exit 0
  62.