home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
mskscripts.tar.gz
/
mskscripts.tar
/
sport.kds
< prev
next >
Wrap
Text File
|
1996-12-27
|
5KB
|
142 lines
; FILE SPORT.SCR
;
; An MS-DOS Kermit script program for dialing the US Robotics Sportster or
; Courier 14400, 28800, or compatible modem, to be used with MS-DOS Kermit
; 3.15 or later. The modem is set for RTS/CTS flow control, fixed interface
; speed, and to negotiate highest modulation, error correction, compression,
; and all types of fallback.
;
; Authors: C. Gianone & F. da Cruz, Columbia U, December 1996
;
; To use: SET MODEM=SPORT (in DOS, before starting Kermit or in AUTOEXEC.BAT)
; or: SET MODEM SPORT (in Kermit, or in MSCUSTOM.INI)
; and: Make sure Kermit has executed the standard MSKERMIT.INI file,
; and then DIAL the desired number.
;
; Variables - define these prior to dialing if desired; they can be either
; Kermit variables or DOS environment variables:
;
; DIALPORT - COM port to use for dialing (COM1, COM2, etc)
; DIALSPEED - Speed for dialing (57600 by default)
; DIALMETHOD - TONE or PULSE (modem's default method is used by default)
; DIALRETRIES - Maximum times to redial the call (default 5)
; DIALTIMEOUT - How long to wait for result from modem (default 90 seconds)
;
if < VERSION 315 stop 1 MS-DOS Kermit 3.15 or later required.
def ERRFAIL echo \%1, forward FAIL
def CHKOK input 3 OK, if fail stop 1 \%1
local __dm __parity ; Local variables
set carrier off ; Don't require carrier during dialing.
set input echo on ; So we can watch what happens.
set input timeout proceed ; Allow IF SUCCESS, IF FAILURE.
set input case ignore ; Use caseless string comparisons
:PORT
if not def DIALPORT asg DIALPORT \$(DIALPORT)
if not def DIALPORT forward SPEED
set port \m(DIALPORT)
if success forward SPEED
echo SET PORT \m(DIALPORT) failed
end 1
:SPEED
asg __parity \v(parity) ; Save parity setting
set parity none ; Switch to none while dialing
set flow none ; Avoid flow control deadlocks
hangup ; Begin by dropping DTR
if not def DIALSPEED asg DIALSPEED \$(DIALSPEED)
if not def DIALSPEED asg DIALSPEED 57600
set speed \m(DIALSPEED)
if fail end 1 \m(DIALSPEED) - Speed not supported
; Dial method, retry limit, and timeout...
xif numeric \fsubstr(\%1,1,1) {
if eq "\m(DIALMETHOD)" "TONE" asg __dm T
if eq "\m(DIALMETHOD)" "PULSE" asg __dm P
}
if not def DIALRETRIES asg DIALRETRIES \$(DIALRETRIES)
if not def DIALRETRIES asg DIALRETRIES 5
if not def DIALTIMEOUT asg DIALTIMEOUT \$(DIALTIMEOUT)
if not def DIALTIMEOUT asg DIALTIMEOUT 90
; Begin the modem dialog...
echo Configuring USR Sportster on \v(line)...
output ATQ0V1\13 ; Enable word result codes
chkok {Can't get modem's attention}
output ATE1X4&A3&D2\13 ; Set echoing, result codes, etc.
chkok {Can't initialize modem}
output AT&B1\13 ; Fixed interface speed
chkok {Can't fix interface speed}
output AT &H1&R2\13 ; RTS/CTS hardware flow control
chkok {Can't enable RTS/CTS} ; On modem
wait 5 cts
if fail errfail {Configuration failed - no CTS from modem}
set flow rts/cts ; And in Kermit too, but only now
output AT &N0\13 ; Enable modulation fallback
chkok {Can't enable modulation fallback}
output AT &K1&M4\13 ; Compression and EC enabled
Chkok {Can't enable compression and EC}
output AT &Y3\13 ; Make modem pass BREAK transparently
chkok {Can't become transparent to BREAK}
mpause 500
clear input ; Clear INPUT buffer.
clear device ; Clear device buffer.
echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
echo
for \%i 1 \m(DIALRETRIES) 1 { ; Redial loop
xif > \%i 1 {
echo Redialing... ; Message for redialing
hangup ; Hang up first
}
pause 1 ; Wait a sec for modem to settle
output ATD\m(__dm)\%1\13 ; Dial the number.
for \%j 1 10 1 {
minput \m(DIALTIMEOUT) -
CONNECT BUSY ERROR {NO CARRIER} {NO ANSWER} {NO DIAL TONE} -
RINGING RING VOICE
xif fail { echo Call timed out, hangup, out \13, continue }
if not = \v(minput) 7 break
}
switch \v(minput) {
:1, forward done
:2, Echo Line is busy - will dial again in 30 seconds.
echo Press any key to cancel...
output \13
pause 30
if fail errfail Canceled
break
:3, errfail {Dialing command error}
:4, errfail {Call failed - no carrier}
:5, errfail {No answer - try again later}
:6, errfail {No dialtone - is your modem connected to the phone line?}
:7, errfail {Call failed - too many rings}
:8, errfail {Call failed - your phone is ringing}
:9, errfail {Call failed - answered by voice}
:default, break
}
}
errfail {It never answers! I give up.} ; Too many tries.
:DONE ; Connected.
echo \7 ; Celebrate with a beep.
set carrier on ; Require carrier from now on.
set parity \m(__parity) ; Restore host parity setting
undef errfail ; Erase local macro definitions...
end 0 ; Finished, return success code.
:FAIL
undef errfail ; Erase local macro definitions...
set carrier off ; Let them reconnect to see what's up.
hangup
end 1 ; Return failure code.
; End of SPORT.SCR