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

  1. From: Dan_Jacobson@ATT.COM
  2. Newsgroups: news.newusers.questions,alt.sources
  3. Subject: "...subjects": better "=" (list subjects) macro for rn newsreader
  4. Message-ID: <1990Jul9.025122.17778@cbnewse.att.com>
  5. Date: 9 Jul 90 02:51:22 GMT
  6.  
  7. # This is a shell archive.  Remove anything before this line,
  8. # then unpack it by saving it in a file and typing "sh file".
  9. #
  10. # Wrapped by danj1 on Sun Jul  8 21:32:09 CDT 1990
  11. # Contents:  ...subjects
  12.  
  13. echo x - ...subjects
  14. sed 's/^@//' > "...subjects" <<'@//E*O*F ...subjects//'
  15. : Dan_Jacobson@ATT.COM 1990-7-8
  16. # A poorperson's somewhat better "=" (list subjects) macro for the rn
  17. # newsreader
  18.  
  19. # A semi-stupid UNIX netnews subject gatherer for inside rn, because
  20. # rn's "=" isn't good enough.  Anybody can install this in their own
  21. # $HOME/bin, etc. Gives the count, in descending order [so hottest
  22. # topics are at top], of each subject in a newsgroup.  This program
  23. # takes a few seconds to run. It also doesn't look in your .newsrc
  24. # file, so it just lists all subjects, read and unread. Sample output
  25. # [while in newsgroup soc.singles]:
  26.  
  27. #   32 is monogamy passe?
  28. #   16 bathroom needs (was: meeting women)
  29. #   15 isis position paper on homosexuality
  30. #   [etc.]
  31.  
  32. # [I bet I'm not the first to make this kind of macro/program, and is
  33. # there a new release of rn that does it?]  This executable file is
  34. # called by an rn macro so that it executes in the newsgroup's spool
  35. # directory, which I assume you have access to (e.g., probably not
  36. # accessible if you're running rrn).  Lists all subjects, read and
  37. # unread.  To bind this to ":", put this line in your $HOME/.rnmac
  38. # file (with the ":" being the first character on the line):
  39.  
  40. #         : %(%m=[nap]?%(%m=n?.)!!...subjects^j)
  41.  
  42. # and call this file [that you are reading] "...subjects" and put it
  43. # in your UNIX $PATH.  Why the funny name "...subjects"?  So ls(1)
  44. # won't see it often, as it is a specialized command invoked only from
  45. # your macro file.
  46.  
  47. test -z "$PAGER" && PAGER="eval echo; cat"
  48. #echo: else output looks ugly when called from newsgroup selection level.
  49.  
  50. W='[     ]' #one "white space"... there should be a SPACE and a TAB
  51. # here, otherwise this file got mangled and you should restore those
  52. # two characters
  53.  
  54. sed "
  55.     /^Subject/!d
  56.     : Z
  57.     s/$W[Rr][Ee]:$W/ /g
  58.     s/$W[Rr][Ee]^2:$W/ /g
  59.     s/$W[Rr][Ee]$W/ /g
  60.     t Z
  61.     s/$W$W*$//
  62.     s/$W$W$W*/ /g
  63.     s/Subject: //g
  64.     y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
  65.     " * | sort | uniq -c | sort -nr | $PAGER
  66. @//E*O*F ...subjects//
  67. chmod u=rwx,g=rx,o=rx ...subjects
  68.  
  69. echo Inspecting for damage in transit...
  70. temp=/tmp/shar$$; dtemp=/tmp/.shar$$
  71. trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
  72. cat > $temp <<\!!!
  73.      51    332   1942 ...subjects
  74. !!!
  75. wc  ...subjects | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
  76. if [ -s $dtemp ]
  77. then echo "Ouch [diff of wc output]:" ; cat $dtemp
  78. else echo "No problems found."
  79. fi
  80. exit 0
  81.