home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1368 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  1.8 KB

  1. From: eastick@me.utoronto.ca (Doug Eastick)
  2. Newsgroups: alt.config,alt.sources,news.software.b
  3. Subject: manual newgroup for C news
  4. Message-ID: <90May22.235719edt.19970@me.utoronto.ca>
  5. Date: 23 May 90 03:57:28 GMT
  6.  
  7. [Henry: can you add an auto/manual newgroup question to build to
  8. tailor this?]
  9.  
  10. Since I'm passing on the usenet alias to someone else,  I thought I'd
  11. ease the pain of all the stupid newgroups in alt.*.  Now it just tells
  12. you to do an addgroup alt.dorkheads (aw jeez, now some dork will
  13. actually go out and do it!).  Replaces $NEWSBIN/ctl/newgroup.
  14. Oh yeah, needs /usr/ucb/mail (for the Subject line).
  15.  
  16. #! /bin/sh
  17. # Usage: newgroup group flag 
  18. #  Tell NEWSMASTER to create it themselves using addgroup
  19.  
  20. # =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
  21. . ${NEWSCONFIG-/usr/lib/news/bin/config}
  22. export NEWSCTL NEWSBIN NEWSARTS
  23. PATH=$NEWSCTL/bin:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH 
  24. umask $NEWSUMASK
  25.  
  26. hdr=/tmp/nc$$
  27.  
  28. trap "rm -f $hdr; exit 0" 0
  29. canonhdr >$hdr
  30.  
  31. # unapproved ctl msg? then quit
  32. grep -s '^Approved:' $hdr >/dev/null || { rm -f $hdr; exit 0; }
  33.  
  34. SENDER="`grep '^Sender:' $hdr | sed 's/^[^:]*: *//'`"
  35. case "$SENDER" in
  36. "")    SENDER="`grep '^From:' $hdr | sed 's/^[^:]*: *//' `" ;;
  37. esac
  38.  
  39. greppat="^`echo $1 | sed 's/\./\\\\./g' ` "
  40. if grep -s "$greppat" $NEWSCTL/active >/dev/null; then    # group exists?
  41.     export SENDER
  42.     chamod "$1" "$2"         # change moderated flag if needed
  43.     exit
  44. fi
  45.  
  46. me="`newshostname`"
  47. gngppat=`awk -f $NEWSBIN/relay/canonsys.awk $NEWSCTL/sys |
  48.     egrep "^($me|ME):" |
  49.     awk -F: '
  50. {
  51.     fields = split($2, field2, "/")    # split ngs/dists
  52.     print field2[1]            # print only ngs
  53.     exit
  54. }' `
  55.  
  56. if gngp -a "$gngppat" >/dev/null <<!
  57. $1
  58. !
  59. then            # no group in active, but sys file likes it: tell them
  60.     case "$2" in
  61.     moderated)    flag=m ;;
  62.     *)        flag=y ;;
  63.     esac
  64.     echo "$SENDER says to addgroup $1 $2" | /usr/ucb/mail -s "newgroup $1 $2" $NEWSMASTER
  65. fi
  66.