5/1200,6/300			    !* -*-TECO-*-!

!Command file to negotiate an open to a DEC-20 via a Ventel modem!

[Getting modem's attention...
]

"
"				    !* Send first of two CRs!
W				    !* Wait 250 ms between them!
"
"				    !* Second second CR!

=2"$"				    !* Wait for prompt!
 -[Line is hung
] L ~				    !* Didn't get prompt!

E				    !* Eat any extraneous crud!

[Setting parity, stop bits...
]

WW"V"W"E"W"N"W"T"W"E"W"L"	    !* Send "VENTEL" slowly!

=5"NO PARITY, BIT 8 = 0"	    !* Wait for confirmation!
 -[Parity not set right
] "Q" E L ~			    !* Quit out and lose!

[Attempting to dial...
]

WW"K"				    !* Send command to dial!
="DIAL: " 
 -[Didn't get expected dial prompt
] "Q" E L ~			    !* Quit out and lose!

"5" W "5" W "5" W "1" W "2" W "3" W "4" W "
"				    !* Dial 555-1234!
=10"ONLINE"			    !* Did we get it?!
 -[Host is unavailable
] "Q" E L ~			    !* Quit out and lose!

[Trying to get prompt
]

W W W W W "
" W "
" W "
" W "
" W "
"				    !* Send a couple of CR's!

=20"
@"				    !* Wait for host prompt!
-[Failed to get prompt
] E L ~

[Attempting login...
]

"LOGIN user password
"				    !* Send login command!
=10" Job "			    !* Logged in?!
-[Login failed
] "LOGOUT
" E L ~				    !* Lose!

[Logged in...
]

<
 E ""			    !* Make sure we have its attention!
 =5"@"				    !* Wait for prompt!
 -^ [Failed to get prompt
] "LOGOUT
" E L ~				    !* Lose big!
>

[Starting server...
]

"CONNECT <queued mail directory>
GET CAFARD
REENTER
"				    !* Start server!
=10"Cockroach"			    !* Server started okay!
-[Server didn't start
] "LOGOUT
" E L ~				    !* No, die die!

[Server running!!
]