| 1 | #!/bin/sh |
| 2 | # \ |
| 3 | exec expect -- "$0" ${1+"$@"} |
| 4 | |
| 5 | # ftp-rfc <rfc-number> |
| 6 | # ftp-rfc -index |
| 7 | |
| 8 | # retrieves an rfc (or the index) from uunet |
| 9 | |
| 10 | exp_version -exit 5.0 |
| 11 | |
| 12 | if {$argc!=1} { |
| 13 | send_user "usage: ftp-rfc \[#] \[-index]\n" |
| 14 | exit |
| 15 | } |
| 16 | |
| 17 | set file "rfc$argv.Z" |
| 18 | |
| 19 | set timeout 60 |
| 20 | spawn ftp ftp.uu.net |
| 21 | expect "Name*:" |
| 22 | send "anonymous\r" |
| 23 | expect "Password:" |
| 24 | send "expect@nist.gov\r" |
| 25 | expect "ftp>" |
| 26 | send "binary\r" |
| 27 | expect "ftp>" |
| 28 | send "cd inet/rfc\r" |
| 29 | expect "550*ftp>" exit "250*ftp>" |
| 30 | send "get $file\r" |
| 31 | expect "550*ftp>" exit "200*226*ftp>" |
| 32 | close |
| 33 | wait |
| 34 | send_user "\nuncompressing file - wait...\n" |
| 35 | exec uncompress $file |
| 36 | |