🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #887

Re: Automatic Downloading from rn

#887
From: Martin J. Dellwo
Date: Wed, 13 Nov 1991 01:15
104 lines
4929 bytes
In article <0+h_Ss#@engin.umich.edu> lou@zug.csmil.umich.edu (Lou Rosenfeld) writes:
>I posted this question a week or two back with no
>response, but I'm quite desperate.  Is there a way
>that postings can be automatically downloaded via   
>rn?  I want to capture a number of postings locally
>...
>--Lou Rosenfeld

It seemed to me that one should be able to do this without too much 
trouble, given various options to rn, so I pulled out my trusty printed
man page for rn and....

Ok, sounds like you want to:
1) check a newsgroup to see if it has articles
2) start up rn to go to that specific newsgroup
3) save every unread article in the group
4) mark it as read (junk it)
5) exit cleanly without entering any other groups

The following script plus the appropriate KILL file can do this, 
assuming you are in UNIX (you *are* running rn).  I tried it, it 
worked fine.  First the script, then some explanations.

-----rn.script (snip,snip,snip)--------------
#! /bin/csh

if !($#argv == 1) then
	echo 'No newsgroup specified'
	exit
endif

if !( { rn -csq $1 } ) then
echo Extracting news from group $1.
rn -q -T -N $1 <<eof
yqq
eof
else
echo No news in group $1.
endif
---------------end---------------------

Make the script executable (chmod +x rn.script)

Make a kill file in your directory for each newsgroup you will be
checking.  For instance, for group news.software.readers, it's 
*likely* to be ~/News/news/software/readers/  by default (but you 
can change that: RTFM!).  In this directory, create the file 'KILL' 
with the line 
/^/s:j
This will tell rn to save every article in this group, and junk it.
The article will be saved, in this form, by it's article number.
If you wanted to append all of them to some single file 'bigfile',
you could use the line '/^/s bigfile:j' instead.  The format is set
by the '-N' option to be non-mailbox (see below).

Invoke for each newsgroup you want: eg. for news.software.readers
rn.script news.software.readers

You could direct the output to be appended to a logfile
thusly:
rn.script news.software.readers >>& ~/rn.log

Explanations

The first if-then checks for one-and-only-one argument to
the script.

The second if-then uses 'rn -cqs $1' to see if the group has unread
news.  If it does, it proceeds to extract it.  The actual extraction
uses the command 'rn -q -T -N $1'.  The '-q' bypasses automatic 
checking for new newsgroups.  Since it is invoked with the specific 
newsgroup from the argument $1 and you already checked for unread 
news, it will go immediately to the 'Read group?' prompt for that
group.  The option '-T' allows type-ahead, otherwise the input (on
the next script line) might get swallowed.  I presume not having type-
ahead would cause this script to fail, though I didn't try it.
The '-N' option causes the save-command to use non-mailbox format, so it
won't prompt you about this.  If you want mailbox format, use '-M' to 
replace '-N' in the script.

The '<< eof' indicates that everything on the subsequent script lines 
will be used as standard input to the 'rn' program, up until it encounters
'eof' on a line by itself.  Which is why I didn't indent my if-then lines:
'<tab>eof' doesn't cut it, it's gotta be just 'eof'.

So fine, the input is 'yqq': 'y' for yes, read this group, 'q' for quit this
group (at the 'End of group...' prompt, after the articles were all saved)
and 'q' to quit rn rather than visit any more groups.

If you don't want to have a permanent killfile, use a local variation:
eg.  at the beginning of the script, you could put the line
setenv KILLLOCAL "%p/%c/KILLBATCH"
then create the file KILLBATCH in the appropriate directory. In fact, I
recommend it!

Easy!! :-)

Marty

-- 
 \martin.j.dellwo.school.of.chemical.sciences.university.of.illinois.urbana-./
\champaign.phone.work.217.333.3944.home.217.344.7233.email.to.#uiuc.edu.where./
/#.eqs.(dellwo@[ottawa|toronto|montreal|winnipeg|halifax].scs.).or.(m-dellwo@)\
 /.quote.".Verbosity.leads.to.unclear.,.inarticulate.things.".v.p.dan.quayle.\
Technical Details
Message-ID: <1991Nov13.011558.13229@ux1.cso.uiuc.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmdzi!zeus.ieee.org!dorm.rutgers.edu!rutgers!cs.utexas.edu!sun-barr!ames!elroy.jpl.nasa.gov!swrinde!mips!pacbell.com!att!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!ottawa!dellwo
References: <0+h_Ss#@engin.umich.edu>

Show Full Headers
Complete Article Headers
Message-ID: <1991Nov13.011558.13229@ux1.cso.uiuc.edu>
Subject: Re: Automatic Downloading from rn
Date: Wed, 13 Nov 1991 01:15:58 +0000
From: dellwo@ottawa.scs.uiuc.edu (Martin J. Dellwo)
References: <0+h_Ss#@engin.umich.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmdzi!zeus.ieee.org!dorm.rutgers.edu!rutgers!cs.utexas.edu!sun-barr!ames!elroy.jpl.nasa.gov!swrinde!mips!pacbell.com!att!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!ottawa!dellwo
Newsgroups: news.software.readers
Summary: long, but useful
Sender: usenet@ux1.cso.uiuc.edu (News)
Organization: University of Illinois (Urbana-Champaign)
Lines: 104