[alt.sources] retrieve RFC's automatically from uunet

sahayman@iuvax.cs.indiana.edu (Steve Hayman) (04/12/91)

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
% rfc 1217 | lpr	(A personal favourite. Get this one. It's funny.)

#!/bin/sh
# 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


PATH=/usr/local/bin:/usr/ucb:/bin:usr/bin export PATH

# 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.Z ;;
*)		file=$1.Z ;;
esac

ftp -n ftp.uu.net <<EOF
user anonymous $USER@`hostname`
binary
get rfc/$file "|uncompress -c"
EOF