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 / archie next >
Encoding:
Text File  |  1993-04-12  |  764 b   |  32 lines

  1. #!../expect -f
  2.  
  3. # archie
  4.  
  5. # Log in to the archie ftp-catalog at McGill University, and mail back results
  6. # Brian P. Fitzgerald
  7. # Department of Mechanical Engineering
  8. # Rensselaer Polytechnic Institute
  9.  
  10. set CINTR \003    ;# ^C
  11. set CSUSP \032    ;# ^Z
  12.  
  13. set timeout -1
  14. spawn telnet quiche.cs.mcgill.ca
  15.  
  16. expect_after eof exit    ;# archie logs us out if too many people are logged in
  17.  
  18. expect {
  19.     login:        {send archie\r}
  20.     "unknown"    {exit 1}
  21.     "unreachable"    {exit 1}
  22. }
  23.  
  24. expect    archie>*        {send set pager\r}
  25. expect    archie>*        {send set  maxhits 20\r}
  26. expect    archie>*        {send set term vt100\r}
  27. expect    archie>*        {send set sortby time\r}
  28. expect    archie>*        {send set mailto you@your.edu\r}
  29.  
  30. send_user "type ^C to exit, ^Z to suspend\n"
  31. interact    $CINTR  {exit 0} $CSUSP  {exec kill -STOP 0}
  32.