2 # @(#) Login.PortSelUnix V1.0 Tue Sep 1 14:57:05 1992 (Bob Denny)
4 # NOTE: Untested with xchat V1.1. Taken from DECUS UUCP.
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).
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
16 # P0 is systemname , P1 is username, P2 is password.
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?"
31 expect prtslctok ystem?
32 timeout getprtslct 15000
35 logerr Sent cr, no "Which System?" from port selector
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)
46 expect prtslctwait wait?
47 timeout noconnect 10000
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.
55 expect prtslctque queue
56 expect prtslctrdy ready?
57 timeout prtwaitbad 70000
60 logerr Sent "Y" to wait in queue, did not get valid response.
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
76 expect prtslctque queue
77 expect prtslctrdy ready?
78 timeout noportwait 70000
81 logerr Too many (20) wait/retries -- queue too busy.
87 timeout noconnect 20000
91 logerr Timed out awaiting place in port queue
95 logerr Sent system name, no "OK" from selector
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.
113 expect gotlogin ogin:
114 timeout sendbreak 5000
117 logerr No login: prompt
127 logerr No password: prompt