🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.internet.services
Article #1810

ChooseNews II - Choose newsgroups based on area of interest

#1810
From: Scott A. Yanoff
Date: Wed, 01 Jun 1994 19:59
374 lines
12131 bytes
#!/bin/csh -f
# ChooseNews II.  Version 2.4 By Scott A. Yanoff    yanoff@csd4.csd.uwm.edu
# (C) 1994 Computing Services Division, Univ. of Wisconsin - Milwaukee
#
# The following simple script will provide users with a very simple way of
# choosing newsgroups by allowing them to subscribe to newsgroups based on 
# their inputted areas of interest.  Mail me for the man page.
#
# NOTE: The following pathnames may need to be changed: (Also see ~line 130)
#
# This is the pathname for the file containing a list of all the newsgroups
#  and a 1-line description for each (known as the newsgroups file):
set NEWSGROUPDIR = "/usr/local/lib/news/newsgroups"
set NEWSGROUPDIR2 = "/usr/local/lib/news/newsgroups" #Set to same as above!
#
onintr main
#
# If there is no .newsrc file in the user's home directory, we copy one
# there.  The path below can be changed to reflect where it is copied from:
set NEWSRCDIR = "/usr/local/lib/news/newsrc"
#
if !($?PAGER) then
  setenv PAGER "more -df"
endif
if  $#argv != 0 then
 echo -n " This is Version 2.4 of ChooseNews II by Scott Yanoff. "
 echo "(yanoff@csd4.csd.uwm.edu)"
 echo Usage: `basename $0`
 exit
endif
#Save our current biff status, and set to biff n while running this program:
setenv boff `biff | awk '{print $2}'`
biff n
#
#If there is no .newsrc file, copy vn's to user's home directory:
#
test -f $HOME/.newsrc && goto main
echo "Creating .newsrc file......."
#
cp -f $NEWSRCDIR $HOME/.newsrc
# System Operators: You can also comment the above and uncomment below:
# /usr/local/bin/newsetup
#
main:
clear
echo "                        * Welcome to ChooseNews II *"
echo "    			  (C) 1994 Scott A. Yanoff "
echo ""
echo ""
echo " This program is designed to help you subscribe to the news groups"
echo " that best suit your interests.  "
echo ""
echo " Suggestion:  Make your search specific.  That is, if you are interested"
echo " in dogs, use 'dogs' as the topic.  If nothing comes up, then try a"
echo " more generalized term, such as 'pets', and so on."
while 1
echo ""
echo -n "Hit return at the prompt to exit the program."
echo -n " (Subscribed to "
echo -n `grep : $HOME/.newsrc | wc -l`
echo " newsgroups)"
echo -n 'Please enter a topic (one-word) or 'help': _________________________'
set TOPIC = "$<"
if $TOPIC == "" then 
 echo ""
 echo "Thank you for using ChooseNews II v2.4"
#The line below sets biff back to its original value before running this prgm.
 biff $boff
exit
endif
#
if $TOPIC == "help" then
#
#Help for ChooseNews II
#
clear
while 1
echo "                        * Help With ChooseNews II *"
echo "  			 (C) 1994 Scott A. Yanoff "
echo ""
echo "[A] List out all alt.* newsgroups  [B] List out all bionet.* newsgroups "
echo "[C] List out all biz.* newsgroups  [D] List out all comp.* newsgroups "
echo "[E] List out all gnu.* newsgroups  [F] List out all ieee.* newsgroups "
echo "[G] List out all k12.* newsgroups  [H] List out all local newsgroups "
echo "[I] List out all misc.* newsgroups [J] List out all news.* newsgroups "
echo "[K] List out all rec.* newsgroups  [L] List out all sci.* newsgroups "
echo "[M] List out all soc.* newsgroups  [N] List out all talk.* newsgroups "
echo "[O] List out all vmsnet.* newsgroups "
echo ""
echo "[P] Definitions of each of the above types of newsgroups "
echo ""
echo "[Q] Unsubscribe from specific newsgroups "
echo "[R] Unsubscribe from ALL newsgroups (make SURE you want to do this)"
echo "[S] Sort your newsgroups into alphabetical order (make SURE you want to do this)"
echo -n "[T] List the "
echo -n `grep : $HOME/.newsrc | wc -l`
echo " newsgroups you are subscribed to "
echo ""
echo "[U] How to Read and Post News (A Brief Explanation)"
echo ""
echo "Hit return at the prompt to exit from the help menu"
echo -n "Please select one of the options from above: _"
set HELP = $<
#
if $HELP == "" then
 goto main
 endif
#
switch ($HELP)
 case [aA]: 
  grep ^alt. $NEWSGROUPDIR | $PAGER
  breaksw
 case [bB]: 
  grep ^bionet. $NEWSGROUPDIR | $PAGER
  breaksw
 case [cC]:
  grep ^biz. $NEWSGROUPDIR | $PAGER
  breaksw
 case [dD]:
  grep ^comp. $NEWSGROUPDIR | $PAGER
  breaksw
 case [eE]:
  grep ^gnu. $NEWSGROUPDIR | $PAGER
  breaksw
 case [fF]:
  grep ^ieee. $NEWSGROUPDIR | $PAGER
  breaksw
 case [gG]:
  grep ^k12. $NEWSGROUPDIR | $PAGER
  breaksw
# NOTE: Change the following to reflect your local newsgroups:
 case [hH]:
  grep ^wi. $NEWSGROUPDIR | $PAGER
  grep ^milw. $NEWSGROUPDIR | $PAGER
  grep uwm $NEWSGROUPDIR | $PAGER
  grep ^uwisc. $NEWSGROUPDIR | $PAGER
  breaksw
 case [iI]:
  grep ^misc. $NEWSGROUPDIR | $PAGER
  breaksw
 case [jJ]:
  grep ^news. $NEWSGROUPDIR | $PAGER
  breaksw
 case [kK]:
  grep ^rec. $NEWSGROUPDIR | $PAGER
  breaksw
 case [lL]:
  grep ^sci. $NEWSGROUPDIR | $PAGER
  breaksw
 case [mM]:
  grep ^soc. $NEWSGROUPDIR | $PAGER
  breaksw
 case [nN]:
  grep ^talk. $NEWSGROUPDIR | $PAGER
  breaksw
 case [oO]:
  grep ^vmsnet. $NEWSGROUPDIR | $PAGER
  breaksw
 case [pP]:
  clear
  echo " alt.*          Groups that discuss alternative ways of looking at  "
  echo "		things.  A heirarchy alternative to the mainstream. "
  echo ""
  echo " bionet.*       Discussions related to biology."
  echo ""
  echo " biz.*		Discussions related to business.  This news group   "
  echo "		allows postings of advertisements or other marketing "
  echo "		materials; such activity is not allowed in other groups"
  echo ""
  echo " comp.*    	Computer science and related topics.  This includes computer"
  echo "		science 'proper', software sources, information on "
  echo "		hardware and software systems, and topics of general interest."
  echo ""
  echo " gnu.*          Free Software Foundation and its GNU project."
  echo ""
  echo " ieee.*         IEEE (Institute of Electrical and Electronics Engineers) "
  echo ""
  echo " k12.*          K-12 school teachers, and other education-based stuff."
  echo ""
  echo " local          Groups related to newsgroups for this particular university, "
  echo "		city, and/or state. "
  echo ""
  echo "		     PRESS RETURN OR ENTER TO CONTINUE"
  set KEY = $<
  clear
  echo ""
  echo " misc.*		Anything that does not fit into any of the other    "
  echo "		categories.  					    "
  echo ""
  echo " news.*		Groups concerned with the news network and news     "
  echo "		software.  If you are new, you should read these for"
  echo "		a while, especially news.announce.newusers	    "
  echo ""
  echo " rec.*		Groups discussing hobbies, recreational activities, "
  echo "		and the arts. 					    "
  echo ""
  echo " sci.*		Groups discussing scientific research and applications (other"
  echo "		than computer science).  This includes newsgroups for many of"
  echo "		the established scientific and engineering disciplines, "
  echo "		including some social sciences."
  echo ""
  echo " soc.*		Groups that address social issues, where social can mean "
  echo "		'politically relevant' or 'socializing', or anything in between"
  echo ""
  echo " talk.*		Groups that are a forum for debate on controversial topics."
  echo ""
  echo " vmsnet.*       Groups related to DEC VAX/VMS and DECNET computer systems. "
  breaksw
 case [qQ]:
  foreach group (`awk '/:/ {print $1}' $HOME/.newsrc | sort`)
  while 1
   echo ""
   echo -n "Unsubscribe from "$group"? (y/n/q): _"
   set UNSUBS = "$<"
   switch ($UNSUBS)
    case [yY]:
    case [yY][eE][sS]:
     ex - +/$group $HOME/.newsrc << 'EOF'
     s/:/!
     w
     q
'EOF'
     break
     breaksw
     case [nN]:
     case [nN][oO]:
      break
      breaksw
     case [qQ]:
     case [qQ][uU][iI][tT]:
      goto loop2
      breaksw
     default:
      echo "Please enter either 'y', 'n', or 'q'"
      continue
      end
     endsw
   end
   echo ""
   loop2:
    clear
    continue
  breaksw
 case [rR]:
   echo "Unsubscribing from all newsgroups..."
     ex - $HOME/.newsrc << 'EOF'
     %s/:/!/g
     w
     q
'EOF'
     breaksw
 case [sS]: 
   echo "Sorting your .newsrc file into alphabetical order..."
   sort $HOME/.newsrc > $HOME/.newsrc2
   cp -f $HOME/.newsrc2 $HOME/.newsrc
   breaksw
 case [tT]:
  /bin/sed -n < $HOME/.newsrc -e "/$1.*:/"'s/^\([^:]*\):.*$/\1/p' | \
  /usr/bin/sort | more -d
  breaksw
 case [uU]:
  echo " The program you are currently running is called 'cn' or, ChooseNews II."
  echo " This program allows you to pick which newsgroups you will want to "
  echo " subscribe to. "
  echo " After you have selected newsgroups to subscribe to, you may then read"
  echo " articles from those newsgroups using a program called a newsreader."
  echo ""
  echo " There are several different newsreaders, and typing the name of the "
  echo " newsreader at a system prompt (once you have exited this cn program)"
  echo " will start you on your way to reading the Usenet news."
  echo ""
  echo " Some newsreaders are: "
  echo "   vn     - Visual News, recommended by many since it shows you"
  echo "             the subject line to each message so you can decide"
  echo "             which messages to read."
  echo ""
  echo "   rn     - Read News"
  echo ""
  echo "   tin    - Tin, a threaded newsreader"
  echo ""
  echo " Finally, you may want to post to a newsgroup.  There is a program"
  echo " to do that which you can access by typing 'Pnews' at a system prompt."
  breaksw
 default:
  echo ""
  echo "Please enter a valid menu item"
  breaksw
  endsw
echo ""
echo "		     PRESS RETURN OR ENTER TO CONTINUE"
set KEY = $<
clear
continue
endif
#
echo ""
echo ""
#
set NEWSGROUPDIR = $NEWSGROUPDIR2
set OTHERFILE=n
if ({ grep -is ${TOPIC} $NEWSGROUPDIR } == 0) then 
 set NEWSGROUPDIR = $HOME/.newsrc
 set OTHERFILE=y
     if ({ grep -is ${TOPIC} $NEWSGROUPDIR } == 0) then 
       echo "Sorry, could't find anything on that topic."
     endif
 endif
set SALL=n
foreach newsgroup (`grep -i $TOPIC $NEWSGROUPDIR | awk '{print $1}'`)
while 1
  if ($OTHERFILE == "y") then
   set newsgroup = `echo $newsgroup | sed 's/.$//'`
  endif
 echo ""
 grep $newsgroup $NEWSGROUPDIR | head -1
 if ($SALL == "n") then
 echo -n "   Subscribe to "$newsgroup"?"
 if ({ grep -s ${newsgroup}: $HOME/.newsrc } == 1) then
  echo -n " (Already subscribed)"
  endif
 echo -n " (y/n/q/all): y"
 set SUBS=$<
 else
	set SUBS=""
 endif
 if ($SUBS == "") set SUBS = "y"
 endif
 switch ($SUBS)
  case [aA]: case [aA][lL][lL]:
	set SALL=y
  case [yY]:
  case [yY][eE][sS]:
   if ({ grep -s ${newsgroup}: $HOME/.newsrc } == 1) then
    echo "You are already subscribed to this group."
    break
    breaksw
   endif
   if ({ grep -s $newsgroup! $HOME/.newsrc } == 1) then
       ex - +/$newsgroup $HOME/.newsrc << 'EOF'
       s/!/:
       w
       q
'EOF'
     else #the group isn't in .newsrc so let's add it and subscribe to it:
       echo ${newsgroup}: >> $HOME/.newsrc
     endif
   break
   breaksw
  case [nN]:
  case [nN][oO]:
   break
   breaksw
  case [qQ]:
  case [qQ][uU][iI][tT]:
   goto loop 
   breaksw
  default:
   echo "Please enter either 'y', 'a', 'n', or 'q'"
   continue
   end
  endsw
end
echo ""
loop:
continue
end
end
end
end
-- 
 _/\ _ !\ _         @          Milwaukee, WI - A Great Place On a Great Lake
!  _! !! ! !_  ~~  @ ~  ~~         
! ! ! !! ! ! !~~__=||_~ ~~~ Computing Services Division - MAINFRAME CONSULTING
! ! ! _! ! ~~~ ~\____/  ~~~  yanoff@csd4.csd.uwm.edu   yanoff@cs.uwm.edu
Technical Details
Message-ID: <2sipbqINNib1@uwm.edu>
Path: arc1-ca.pugleaf.net!wupost!psuvax1!uwm.edu!csd4.csd.uwm.edu!yanoff

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!psuvax1!uwm.edu!csd4.csd.uwm.edu!yanoff
From: yanoff@csd4.csd.uwm.edu (Scott A. Yanoff)
Newsgroups: alt.internet.services,alt.sources
Subject: ChooseNews II - Choose newsgroups based on area of interest
Date: 1 Jun 1994 19:59:54 GMT
Organization: University of Wisconsin - Milwaukee
Lines: 374
Distribution: world
Message-ID: <2sipbqINNib1@uwm.edu>
NNTP-Posting-Host: 129.89.7.4
Originator: yanoff@csd4.csd.uwm.edu