This is dial-modem.tcl in view mode; [Download] [Up]
#
# tcldiald TCL script used to dial a modem
# Originally contributed by Mark Crispin
#
# modified for University of Oregon environment by
# Audun S. Runde (audun@doek.uoregon.edu)
# - 10/16/92: added error response to BUSY + additional log info
# modified to recognize 14.4 modem connect signal
# Jason Fosback (jfosback@darkwing.uoregon.edu)
# $Id: dial-modem.tcl,v 4.6 1992/09/05 01:59:53 louie Rel $
# $Id: dial-modem.tcl,v 4.6b 1992/10/16 01:59:53 audun Rel $
# The phone number to dial is passed as the 0'th argument
set number [lindex $args 0]
# Set default timeout for expect/rexpect commands
set timeout 20
log "Start of dialing script"
# Flush any pending command
xmit {\r}
sleep 1
# Get modem attention
xmit {AT\r}
expect timeout {error "waiting for OK from AT"} "*OK*"
# Initialize to modem wired-in defaults
xmit {ATZ\r}
expect timeout {error "waiting for OK from ATZ"} "*OK*"
# Let things cool down from the ATZ
sleep 1
# Dial the number
log "Dialing $number"
xmit "ATDT$number\r"
# Wait for connect message - if we see something else (such as BUSY), or
# if we cannot finish negotiations in 40 seconds, break the connnection
set timeout 40
expect timeout {error "connecting"} \
"{*CONNECT 14400\r*}" {log "Connected 14400!"} \
"{*CONNECT 9600\r*}" {log "Connected 9600!"} \
"{*CONNECT 2400\r*}" {log "Connected 2400!"} \
"{*CONNECT 1200\r*}" {log "Connected 1200!"} \
"{*CONNECT 300\r*}" {log "Connected 300!"} \
"{*CONNECT*\r*}" {log "Connected $expect_match"} \
"{*ERROR\r*}" {error "Modem returned ERROR"} \
"{*NO CARRIER\r*}" {error "Modem returned NO CARRIER"} \
"{*BUSY\r*}" {error "Remote modem busy"}
# set expect timeout back to something "reasonable"
set timeout 20
# All OK
log "End of dial-modem script - Connected normally"
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.