[alt.sources.d] How do I get RFC articles?

simon@liasun2.epfl.ch (Simon Leinen) (06/19/91)

If you mind the traffic, or want to build an RFC collection
incrementally, you may want to use my caching version of the recently
posted program.  You have to modify the RFCDIR variable to a suitable
cache directory (should be world-writable with the sticky bit set if
your system provides this feature).
-- 
Simon.

#!/bin/sh
##############################################################################
# File Name:	rfc
# Description:	retrieve RFC's automatically from uunet
# Author:	Steve Hayman (sahayman@iuvax.cs.indiana.edu)
# Date Created:	11-Apr-91
##############################################################################
# rfc NNN
# retrieve rfc NNN from uunet, put it on stdout
# assumes rfc's are in uunet:/rfc/rfcNNNN.Z
#
# Actually the uunet people would prefer it if you ftp'd things
# from 'ftp.uu.net', so we retrieve things from that machine.
#
# uunet conveniently has files called "index" and "rfc-index"
# in the /rfc directory, so this script will also let you
# retrieve those.
#
# sahayman
# 1991 04 10
##############################################################################
# I made the following modification: The RFC is first searched in the
# ${RFCDIR} directory in either compressed or uncompressed form.  If
# it is not found there, the compressed version is first retrieved
# from ${FTPSERVER} (defaults to ftp.uu.net) and stored in the cache
# directory.  You should have write access to the cache directory.
#
# Simon Leinen (simon@liasun6.epfl.ch).
##############################################################################
export PATH
ftp=ftp #(mine was called "pftp" --DJ)
PATH=/usr/local/bin:/usr/ucb:/bin:usr/bin
RFCDIR=/public/doc/rfc
TMPDIR=/tmp
RFCSERVER=ftp.uu.net

# a little hack so that we can say "rfc index" or "rfc rfc-index"
# as well as "rfc 822"

case "$1" in
"")		echo "$0: Usage $0 [NNN] [index] [rfc-index]" 1>&2; exit 1 ;;
[0123456789]*)	file=rfc$1 ;;
*)		file=$1 ;;
esac

if [ -r $RFCDIR/$file ]
then
  cat $RFCDIR/$file
else
if [ ! -r $RFCDIR/$file.Z ]
then
${ftp?} -n $RFCSERVER <<EOF
user anonymous $USER@`hostname`
binary
get rfc/$file.Z $TMPDIR/$file.Z
EOF
cp -p $TMPDIR/$file.Z $RFCDIR/$file.Z
zcat $TMPDIR/$file.Z
rm -f $TMPDIR/$file.Z
else
zcat $RFCDIR/$file.Z
fi
fi

bob@MorningStar.Com (Bob Sutterfield) (06/19/91)

In article <1991Jun19.005837.21993@cbfsb.att.com> Dan_Jacobson@ATT.COM writes:

   #From: sahayman@iuvax.cs.indiana.edu (Steve Hayman)
   #Newsgroups: alt.sources
   #Subject: retrieve RFC's automatically from uunet
   #Date: 11 Apr 91 22:22:30 GMT
   #Organization: Computer Science, Indiana University
   #
   #I find this little script handy, it retrieves RFC's automatically
   #from uunet via anonymous ftp and sticks them on stdout.
   #So, instead of keeping your own little collection of RFCs
   #hidden away somewhere and forgetting what directory you
   #put them in, you can just use
   #
   #% rfc index | more

I'm shocked that Dan, rarely one to miss a chance to proselytize for
GNU Emacs, didn't mention ange-ftp.el and crypt.el.  Ange-ftp.el
manages FTP connections, transparently associating buffers in a local
Emacs with files on remote machines.  It's one of my favorite tools
for editing files on IP-accessible machines without reasonable
editors, or on those on which I have no personal account, or when I'd
rather get the response time of using a local application.  Crypt.el
can uncompress (local or remote) files as they're read and recompress
them as they're written.

If I tell my Emacs "C-x C-f /ftp.uu.net:/rfc/rfc874$", ange-ftp opens
an anonymous FTP connection to UUNET (since I have a line like
"machine ftp.uu.net login anonymous password bob@morningstar.com" in
my ~/.netrc), gets a directory listing, and completes the "rfc874.Z".
As the file is "read" into my buffer, crypt.el notes from its magic
number that it's compressed, and passes it through "compress -d"
before showing it to me.

I've solved some icky problems in my own networking code by browsing
the examples in the uunet:bsd-sources/ directories, using ange-ftp and
dired and friends.

All this stuff is, of course, available from the Elisp Archives via
anonymous FTP from tut.cis.ohio-state.edu or via anonymous UUCP from
osu-cis.

Dan_Jacobson@ATT.COM (06/20/91)

>>>>> "Bob" == Bob Sutterfield <bob@MorningStar.Com> writes:

Bob> If I tell my Emacs "C-x C-f /ftp.uu.net:/rfc/rfc874$", ange-ftp opens
Bob> an anonymous FTP connection to UUNET (since I have a line like
Bob> "machine ftp.uu.net login anonymous password bob@morningstar.com" in
Bob> my ~/.netrc), gets a directory listing, and completes the "rfc874.Z".

Bob's right, folks.  And furthermore, you can set this variable to t
(=true):

ange-ftp-generate-anonymous-password's value is t

Documentation:
*If non-nil, by default use a password of user@host when logging
in as the anonymous user.