home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / expect / expect-4.7 / example / ftp-rfc < prev    next >
Encoding:
Text File  |  1993-04-12  |  564 b   |  32 lines

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