home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / CNEWS / _CNEWS.TAR / usr / lib / newsbin / ctl / rmgroup < prev    next >
Encoding:
Text File  |  1994-09-02  |  879 b   |  32 lines

  1. #! /bin/sh
  2. # rmgroup group - snuff group
  3.  
  4. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  5. . ${NEWSCONFIG-/var/lib/news/bin/config}
  6. export NEWSCTL NEWSBIN NEWSARTS
  7. PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
  8. umask $NEWSUMASK
  9.  
  10. hdr=/tmp/nc$$
  11.  
  12. canonhdr >$hdr
  13.  
  14. # unapproved ctl msg? then quit
  15. egrep '^Approved:' $hdr >/dev/null || { rm -f $hdr; exit 0; }
  16.  
  17. # quit if no active entry
  18. # escape egrep metacharacters.  In theory one could add " ' ` \ to the list.
  19. egreppat="^(` echo "$1" | sed -e 's/[.+*()|[]/\\\\&/g' -e 's/,/|/g' `) "
  20. egrep "$egreppat" $NEWSCTL/active >/dev/null ||
  21.     { rm -f $hdr; exit 0; }
  22.  
  23. SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
  24. case "$SENDER" in
  25. "")    SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//'`" ;;
  26. esac
  27.  
  28. # tell the local usenet administrator to do it by hand
  29. echo "rmgroup $1 says $SENDER (see delgroup to do so)" | mail $NEWSMASTER
  30.  
  31. rm -f $hdr
  32.