home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / NextLibrary / PrivateFrameworks / Uucp.framework / Versions / A / Resources / contrib / Login.PortSel < prev    next >
Text File  |  1992-09-06  |  3KB  |  134 lines

  1. #!xchat
  2. # @(#) Login.PortSelUnix V1.0 Tue Sep  1 14:57:05 1992 (Bob Denny)
  3. #
  4. # NOTE: Untested with xchat V1.1. Taken from DECUS UUCP.
  5. #
  6. # From: "Kent C. Brodie" <moocow!brodie@CSD4.MILW.WISC.EDU>
  7. #    uucp:    {uunet!marque,csd4.milw.wisc.edu}!moocow!brodie  
  8. # special script for "uwmcsd4", have to go through a port selector (and then
  9. # log in via standard Unix procedures).  
  10. #
  11. # Also included is the ability to wait in the port selector queue.
  12. # Be forwarned that the debug log can get pretty big depending on 
  13. # how many times you "wait" in the queue.
  14. # (C) 1989 Kent C. Brodie - Medical College of Wisconsin
  15.  
  16. # P0 is systemname , P1 is username, P2 is password. 
  17.  
  18.     zero
  19.  
  20. # send a CR to get the selector's attention.  Sleep a little bit
  21. # due to large login text of selector.   It sends "Which System?"
  22. # when it's ready. 
  23.  
  24. getprtslct:
  25.     count
  26.     ifgtr    noprtslct    6
  27.     break
  28.     send    \r
  29.     sleep    2000
  30.     flush
  31.     expect    prtslctok    ystem?
  32.     timeout    getprtslct    15000
  33.  
  34. noprtslct:
  35.     logerr    Sent cr, no "Which System?" from port selector
  36.     failed
  37.  
  38. # Send the system name.  We either get "OK" (connected), or we
  39. # get "No ports available, would you like to wait?" (wait in queue)
  40.  
  41. prtslctok:
  42.     zero
  43.     sendstr    0
  44.     send    \r
  45.     expect    connected    OK
  46.     expect    prtslctwait    wait?
  47.     timeout    noconnect    10000
  48.  
  49. # Usually we get "nn Your place in queue" messages.  JUST in case we
  50. # get a free port right away, check for 'Are you ready?' as well.
  51.  
  52. prtslctwait:
  53.     zero
  54.     send    Y\r
  55.     expect    prtslctque    queue
  56.     expect    prtslctrdy    ready?
  57.     timeout    prtwaitbad    70000
  58.  
  59. prtwaitbad:
  60.     logerr    Sent "Y" to wait in queue, did not get valid response.
  61.     failed
  62.  
  63. # Here's where we wait in the queue.  The port selector sends us a status
  64. # message about once a minute.  We either get "nn Your place in queue"
  65. # or we get "System Available.  Are you Ready?". 
  66. # If something goes wrong, we time out waiting for either response.
  67. # The reason we don't sleep for 40-50 seconds is because as SOON as the
  68. # port is ready, it informs us.  If we wait too long, it drops us.
  69. # This setup is laid out for a maximum of 20 "tries" which is ABOUT
  70. # 20 minutes.   Note:  This constant retrying can make log files
  71. # kind of big....
  72.  
  73. prtslctque:
  74.     count
  75.     ifgtr    prtslcttry    20
  76.     expect    prtslctque    queue
  77.     expect    prtslctrdy    ready?
  78.     timeout    noportwait    70000
  79.  
  80. prtslcttry:
  81.     logerr    Too many (20) wait/retries -- queue too busy.
  82.     failed
  83.  
  84. prtslctrdy:
  85.     send    Y\r
  86.     expect    connected    OK
  87.     timeout    noconnect    20000
  88.  
  89.  
  90. noportwait:
  91.     logerr  Timed out awaiting place in port queue
  92.     failed
  93.  
  94. noconnect:
  95.     logerr    Sent system name, no "OK" from selector
  96.     failed
  97.  
  98. # standard Unix login stuff.  Send cr, expect "ogin:", if no, send a break 
  99. # (which tells Unix to try the next bit rate) and try again.  
  100.  
  101. connected:
  102.     send    \r
  103.     zero
  104.     goto    waitlogin
  105.  
  106. sendbreak:
  107.     count
  108.     ifgtr    nolgi        6
  109.     flush
  110.     break
  111.  
  112. waitlogin:
  113.     expect    gotlogin    ogin:
  114.     timeout    sendbreak    5000
  115.  
  116. nolgi:
  117.     logerr    No login: prompt
  118.     failed
  119.  
  120. gotlogin:
  121.     sendstr    1
  122.     send    \r
  123.     expect    gotword        word:
  124.     timeout    nopwd        10000
  125.  
  126. nopwd:
  127.     logerr    No password: prompt
  128.     failed
  129.  
  130. gotword:
  131.     sendstr    2
  132.     send    \r
  133.     success
  134.