#!../expect --

# ftp-rfc <rfc-number>
# ftp-rfc -index

# retrieves an rfc (or the index) from uunet
if [llength $argv]==1 {
	send_user "usage: ftp-rfc \[#] \[-index]\n"
	exit
}

set file "rfc[lindex $argv 1].Z"

set timeout 60
spawn ftp ftp.uu.net
expect "*Name*:*"
send "anonymous\r"
expect "*Password:*"
send "expect\r"
expect "*ftp>*"
send "binary\r"
expect "*ftp>*"
send "cd inet/rfc\r"
expect "*550*ftp>*" exit "*250*ftp>*"
send "get $file\r"
expect "*550*ftp>*" exit "*200*226*ftp>*"
close
wait
send_user "\nuncompressing file - wait...\n"
exec uncompress $file

