How do I get RFC articles?

Simon Leinen simon at liasun2.epfl.ch
Wed Jun 19 19:13:23 AEST 1991


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 at 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 at 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



More information about the Comp.unix.admin mailing list