-; For C-Kermit Version: 8.0
-;
-; Filename:
-; .kermrc (UNIX, OS-9, Aegis)
-; CKERMIT.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga)
-; ckermit.ini (Stratus VOS)
-; K95.INI (Kermit 95 -- but this big version is not used there)
-; K2.INI (Kermit/2 -- but ditto)
-;
-; Authors:
-; Frank da Cruz, Christine M. Gianone, Jeffrey Altman
-; Columbia University, New York, NY 10025-7799, USA
-;
-; This is the standard and recommended C-Kermit 8.0 initialization file. To
-; override settings or definitions made in this file, to add new settings or
-; definitions, or to make any other desired customizations, create a separate,
-; personal customization file called:
-;
-; .mykermrc (UNIX, OS-9, Aegis, BeBox, Plan 9)
-; CKERMOD.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga)
-; ckermod.ini (VOS)
-;
-; You can also define the customization filename in an environment
-; variable (logical name in VMS), CKERMOD, which takes precedence over
-; the names shown above.
-;
-; WHAT THIS FILE DOES:
-;
-; . Defines your default dialing directory name:
-; .kdd for UNIX, OS-9 and Aegis; CKERMIT.KDD for other operating systems.
-; You can override this with the environment variable K_DIAL_DIRECTORY
-; . Defines your default network directory name:
-; .knd for UNIX, OS-9 and Aegis; CKERMIT.KND for other operating systems.
-; You can override this with the environment variable K_NET_DIRECTORY
-; . Defines your default services directory name:
-; .ksd for UNIX, OS-9 and Aegis; CKERMIT.KSD for other operating systems.
-; You can override this with environment variable K_SERVICE_DIRECTORY.
-; . Defines your customization file name (name given above)
-; . Performs system-dependent setups for UNIX, VMS, OS/2, etc.
-; . Defines VTPRINT macros for use with K95, MS-DOS Kermit, etc.
-; . If you have a services directory, all the macros needed to use it are
-; defined. If you don't have a services directory, the macros are not
-; defined and Kermit starts faster.
-; . Executes your personal customization file, if you have one.
-; NOTE: Your customization file is NOT executed by Kermit itself; it is
-; executed by this file.
-;
-; In UNIX, with C-Kermit 7.0 and later, you can store this file with a name
-; other than .kermrc, and it will not be executed automatically, but, if you
-; give this file execute permission, you can execute directly because of the
-; "kerbang line" at the top, whenever you want all of the above actions to
-; occur. The kerbang line must reflect the actual full path of the Kermit
-; 7.0-or-later executable.
-;
-; C-Kermit 6.0 is documented in the book "Using C-Kermit", 2nd Edition,
-; by Frank da Cruz and Christine M. Gianone, 1997, Digital Press /
-; Butterworth-Heinemann, ISBN 1-55558-164-1. New features of subsequent
-; versions are documented at the Kermit website:
-; http://www.columbia.edu/kermit/
-;
-; Everything after this point depends on the script programming language.
-; The CHECK command terminates this command file immediately if the script
-; programming language (IF command) is not configured.
-;
-set take error on ; This makes CHECK quit if no script language.
-check if ; Do we have an IF command? If not, quit now.
-set take error off ; Back to normal.
-
-local _sd _servicedir _xp ; Declare local variables.
-
-COMMENT - C-Kermit version 6.0 or later required.
-;
-
-asg _xp \v(xprogram)
-if not def _xp asg _xp \v(program)
-if not equal "\m(_xp)" "C-Kermit" -
- stop 1 \v(cmdfile): This initialization file is only for C-Kermit.
-echo Executing \v(cmdfile) for \v(system)...
-if < \v(version) 60000 -
- stop 1 \v(cmdfile): C-Kermit 6.0 or later required.
-
-forward \v(system) ; First do system-dependent items...
-
-:unknown ; Should not happen
-Stop 1 Error: System type unknown!
-
-:Aegis ; Apollo Aegis and
-:UNIX ; UNIX, all versions
-asg _myinit -
- \v(home).mykermrc ; Customization filename
-if remote forward COMMON ; Skip local-mode items if "-R"
-asg _dialdir -
- \v(home).kdd ; C-Kermit dialing directory
-asg _netdir -
- \v(home).knd ; C-Kermit network directory
-asg _servicedir -
- \v(home).ksd ; C-Kermit services directory
-forward COMMON ; End of UNIX section
-
-:OS9/68K ; OS-9
-asg _myinit -
- \v(home).mykermrc ; Customization filename
-if remote forward COMMON
-asg _dialdir -
- \v(home).kdd ; C-Kermit dialing directory
-asg _netdir -
- \v(home).knd ; C-Kermit network directory
-asg _servicedir -
- \v(home).ksd ; C-Kermit services directory
-else set file display crt
-forward COMMON ; End of OS-9 section
-
-:VMS ; VMS and OpenVMS
-forward COMMON
-
-:OS/2 ; Kermit 95
-:WIN32
-echo This initialization file is not for use with K95.
-forward COMMON ; End of OS/2 section
-
-:AOS/VS ; Data General AOS/VS
-set window 1 ; Sliding windows don't work
-set file char dg-international ; File character-set
-set xfer char latin1 ; Transfer character-set
-set file display crt ; File transfer fisplay
-def cli push ; Escape to CLI
-def reset - ; Macro to reset DG DASHER terminal
- run write [!ascii 236 306 301]
-forward COMMON ; End of AOS/VS section
-
-:Amiga ; Commodore Amiga
-def cls echo \27[H\27[2J ; CLS command to clear the screen
-set file char latin1 ; Use Latin Alphabet 1 for file transfer
-set xfer char latin1 ; ...
-forward COMMON ; End of Amiga section
-
-:Atari_ST ; Atari ST
-def cls echo \27H\27J ; Clear screen a`la VT52
-set server display on ; Show file xfer display in server mode too
-set server timeout 15 ; Nonzero required for ^C interruption!
-forward COMMON ; End of Atari ST section
-
-:Macintosh ; Apple Macintosh
-set server display on ; Show file xfer display in server mode too.
-forward COMMON
-
-:Stratus_VOS ; Stratus VOS
-asg _myinit \v(home)ckermod.ini
-if remote forward COMMON
-asg _dialdir \v(home)ckermit.kdd
-asg _netdir \v(home)ckermit.knd
-asg _servicedir \v(home)ckermit.ksd
-forward COMMON ; End of Stratus VOS section
-
-:COMMON ; For all systems
-
-; Define macros that are useful when running C-Kermit in remote mode.
-; These macros serve no purpose on local-mode-only versions such as
-; OS/2, Macintosh, Amiga, and Atari ST Kermit, so we skip defining them
-; for those systems.
-;
-if not = 0 \findex(\v(system),WIN32:OS/2:Macintosh:Amiga:Atari_ST) -
- forward files
-
-; VTPRINT macro. Print a file on your PC's local printer.
-
-def VTPRINT echo \27[5i, type \%1, echo \27[4i
-; or if your printer needs a formfeed to force the page out:
-; def VTPRINT def echo \27[5i, type \%1, echo \12\27[4i
-
-; Macros for host-initiated file transfer using APC:
-; NOT NEEDED ANY MORE because of autodownload/autoupload.
-; Remove the following FORWARD command to reinstate these definitions:
-
-:FILES
-
-; Get customization and directory file names. Environment variables take
-; precedence, so you do not have to edit this file to change these filenames.
-;
-if def \$(CKERMOD) assign _myinit \$(CKERMOD)
-if not def _myinit assign _myinit \v(home)CKERMOD.INI
-
-if remote forward CUSTOM ; Skip all this if -R given on command line
-
-if def \$(K_NET_DIRECTORY) assign _netdir \$(K_NET_DIRECTORY)
-if not def _netdir assign _netdir \v(home)CKERMIT.KND
-
-if def \$(K_DIAL_DIRECTORY) assign _dialdir \$(K_DIAL_DIRECTORY)
-if not def _dialdir assign _dialdir \v(home)CKERMIT.KDD
-
-CHECK DIAL ; Is there a DIAL command?
-xif fail { ; No.
- echo DIAL disabled
- forward CUSTOM
-}
-
-CHECK NETWORK
-xif success {
- xif exist \m(_netdir) {
- set net directory \m(_netdir)
- echo { Network directory is \m(_netdir) }
- }
-}
-
-if eq "\v(name)" "telnet" forward CUSTOM
-
-xif exist \m(_dialdir) {
- set dial directory \m(_dialdir)
- echo { Dial directory is \m(_dialdir) }
-}
-
-COMMENT - Services directory
-
-if def \$(K_SERVICE_DIRECTORY) assign _servicedir \$(K_SERVICE_DIRECTORY)
-if not def _servicedir assign _servicedir \v(home)CKERMIT.KSD
-
-; If no services directory is found skip all the big macro definitions and
-; go straight to the bottom, where we execute the customization file.
-
-if not exist \m(_servicedir) forward custom
-
-echo { Services directory is \m(_servicedir)}
-
-def MAX_SVCS 200 ; Adjust this if you have more entries
-define _sd 0 ; Assume no services directory
-open read \m(_servicedir) ; Try to open services directory file
-xif success {
- declare \&d[\m(MAX_SVCS)] ; It's open, declare directory array
- for \%i 1 \m(MAX_SVCS) 1 { ; Read the lines into the array
- read \&d[\%i]
- if fail break
- }
- close read
- xif > \%i \m(MAX_SVCS) {
- echo Too many entries in services directory
- echo { Maximum is \m(MAX_SVCS).}
- echo { Change definition of MAX_SVCS in \v(cmdfile) to allow more. }
- echo { Services directory disabled.}
- } else {
- asg \&d[0] \feval(\%i - 1)
- define _sd 1
- }
-}
-
-xif not \m(_sd) {
- def access echo { Services directory not available.}
- asg list \m(access)
-} else {
- def FIND {
- set case off
- for \%i 1 \&d[0] 1 {
- if eq {\%1} {\fsubstr(\&d[\%i],1,\flen(\%1))} break
- }
- if not > \%i \&d[0] return \&d[\%i]
- }
- def LIST {
- xif > \v(argc) 1 {
- do find \%1
- if def \v(return) echo \v(return)
- else echo \%1: Not found
- } else {
- echo \&d[0] items in services directory:
- for \%i 1 \&d[0] 1 { echo \fcont(\&d[\%i]) }
- }
- }
- def SPLIT { asg _word1 \%1, asg _word2 \%2 }
- def DOACCESS { ; (Used internally by ACCESS macro)
- do \%5 \%6 \%7 \%8 \%9 ; Do the connection macro
- if fail end 1
- split \%3 ; Get words from \%3
- asg \%3 \m(_word1)
- asg \%2 \m(_word2)
- do \%3 \%4 {\%1} \%2 ; Login macro, userid, password, prompt
- }
- def ACCESS {
- if not defined \%1 end 1 access what? ; Check service
- do find \%1 ; Look it up
- if success doaccess {\%2} \v(return) ; OK, try it
- else end 1 "\%1" not in services directory ; Not found
- if fail end 1 ; DOACCESS failed?
- xif eq \v(cmdlevel) 1 {
- echo
- echo ACCESS: Login succeeded - CONNECTing...
- show escape
- output \13
- connect /quietly
- }
- }
-}
-
-:CONNECTION ; Macros for making connections
-
-COMMENT - SERIAL macro. Arguments:
-; \%1 = device name
-; \%2 = speed
-;
-def SERIAL {
- if < \v(argc) 3 ; All arguments given?
- end 1 Usage: SERIAL device speed ; No.
- set line \%1 ; OK, try to SET LINE.
- if failure - ; If this failed,
- end 1 Can't open device: \%1 ; print message and quit.
- set speed \%2 ; Try to set the speed.
- if fail end 1 Unsupported speed: \%2 ; Failed.
- echo Connection successful. ; Succeeded.
-}
-
-COMMENT - NET macro. Arguments:
-; \%1 = network type
-; \%2 = host name or address
-;
-def NET {
- if < \v(argc) 3 end 1 Usage: NET network host
- set network type \%1
- if fail end 1 unsupported network: \%1
- set login user ; Don't send user ID.
- set host \%2
- if fail end 1 Can't reach host: \%2
- echo Connection successful.
-}
-
-COMMENT - CALL macro. Arguments:
-;
-; \%1 = modem type
-; \%2 = device name
-; \%3 = speed
-; \%4 = phone number
-;
-def CALL {
- if < \v(argc) 5 - ; All arguments present?
- end 1 Usage: CALL modem device speed number
- xif not equal {\v(modem)} {\%1} { ; Set modem type
- set modem \%1
- if fail end 1 unknown modem type: \%1
- }
- xif not equal {\v(line)} {\%2} { ; Communication device
- set line \%2
- if fail end 1 can't open device: \%2
- }
- xif not equal {\v(speed)} {\%3} { ; Communication speed
- set speed \%3
- if fail end 1 unsupported speed: \%3
- }
- dial \%4 ; Dial the number
- if fail end 1 Can't place call: \%4
- end 0 Connection successful.
-}
-
-COMMENT - TCPCALL macro. Arguments:
-;
-; \%1 = server name:port
-; \%2 = modem type
-; \%3 = phone number
-;
-def TCPCALL {
- if < \v(argc) 4 - ; All arguments present?
- end 1 Usage: TCPCALL server[:port] modem number
- set net type tcp/ip ; Which network to use
- if fail end 1 unsupported network: tcp/ip
- set host \%1 ; Access server and port
- if fail end 1 can't access server \%1
- set modem \%2 ; Set modem type
- if fail end 1 unknown modem type: \%2
- dial \%3 ; Dial the number
- if fail end 1 Can't place call: \%3
- end 0 Connection successful.
-}
-
-COMMENT - SPRINT macro. Arguments:
-; \%1 = Service name or address
-;
-def SPRINT {
- if < \v(argc) 2 end 1 Usage: \%0 service
- set input timeout proceed
- output @D\13
- input 10 TERMINAL=
- if fail end 1 No terminal prompt
- out D1\13
- inp 10 @
- if fail end 1 No atsign prompt
- output c \%1\13
- input 10 CONNECTED
- if fail end 1 Can't access \%1 from SprintNet
-}
-
-COMMENT - ULOGIN macro. For logging into systems where user ID is required
-; but there is no password. Arguments:
-; \%1 = UNIX user ID
-;
-define ULOGIN {
- if < \v(argc) 2 end 1 Usage: \%0 userid
- set input timeout proceed ; Handle timeouts ourselves
- set case on ; Case is important in UNIX
- minput 5 login: Username: {User ID:} {User Name:}
- out \%1\13 ; Send username, carriage return
- end 0
-}
-
-COMMENT - VMSLOGIN macro. Arguments:
-; \%1 = VMS user ID
-; \%2 = Password. If password not supplied, it is prompted for.
-; \%3 = System prompt. If omitted a default is supplied.
-;
-define VMSLOGIN {
- if < \v(argc) 2 end 1 Usage: \%0 userid [ password [ prompt ] ]
- while not defined \%2 {
- askq \%2 { \%1's password: }
- }
- set parity none ; Set communication parameters
- set duplex full
- set handshake none
- set input timeout proceed ; Handle timeouts ourselves
- in 5 Username: ; Is prompt already there?
- xif fail { ; No.
- for \%i 1 3 1 { ; Try 3 times to get it.
- out \13 ; Send carriage return
- in 5 Username: ; Look for prompt
- if success break ; Success, go log in
- }
- if > \%i 3 end 1 No Username prompt
- }
- out \%1\13 ; Send username, carriage return
- inp 5 Password: ; Wait 5 sec for this prompt
- if fail end 1 No password prompt
- pause ; Wait a sec
- out \%2\13 ; Send password
- xif not emulation { ; No emulator built in?
- set input echo off ; Protect terminal from this
- minput 10 {\27Z} {\27[c} {\27[0c} ; Get terminal ID query
- xif success { ; Got one
- output \27[\?1c ; Send VT100 terminal ID
- in 2 \27[6n ; Screen dimension query?
- if succ out \27[\v(rows);\v(cols)R ; Send dimensions
- }
- set input echo on ; Echo input again
- }
- if not def \%3 - ; If we were not given a prompt
- asg \%3 {\v(prompt)} ; use the SET LOGIN PROMPT value
- if not def \%3 - ; If we still don't have a prompt
- asg \%3 {\13$\32} ; use this one as the default
- reinp 0 \%3 ; Did we INPUT the prompt already?
- if fail inp 60 \%3 ; No, look now.
- if fail end 1
-}
-
-COMMENT - UNIXLOGIN macro. Arguments:
-; \%1 = UNIX user ID
-; \%2 = Password. If password not supplied, it is prompted for.
-; \%3 = System prompt. If omitted a default is supplied.
-;
-define UNIXLOGIN {
- local \%m \%i
- if < \v(argc) 2 -
- end 1 Usage: \%0 userid [ password [ prompt ] ]
- while not defined \%2 {
- askq \%2 { \%1's password: }
- }
- set input echo on
- set parity none ; Set communication parameters.
- set duplex full
- set handshake none
- set input timeout proceed ; Handle timeouts ourselves
- set case on ; Case is important in UNIX
- def \%m 10 ; Waiting time for INPUT
- for \%i 1 5 1 {
- minput \%m login: {ssword:} {Password for \%1:}
- if success break
- output \B\13
- \%m ::= 6-\%1
- }
- if > \%i 5 end 1 {No response from host}
- xif = \v(minput) 1 { ; Have username prompt
- output \%1\13 ; Send username
- minput 5 {ssword:} {ssword for \%1:} ; Wait for password prompt
- if fail end 1 {No password prompt}
- }
- pause ; Wait a sec
- out \%2\13 ; Send password
- if not def \%3 - ; If we were not given a prompt
- asg \%3 {\v(prompt)} ; use the SET LOGIN PROMPT value
- if not def \%3 - ; If we still don't have a prompt
- asg \%3 {\10$ } ; use this one as the default
- reinp 0 \%3 ; Did we INPUT the prompt already?
- if fail inp 60 \%3 ; No, look now.
- if fail end 1
-}
-
-COMMENT - VMLINELOGIN macro. Arguments:
-; \%1 = User ID
-; \%2 = Password
-;
-define VMLINELOGIN {
- if < \v(argc) 2 -
- end 1 Usage: \%0 userid [ password ]
- while not defined \%2 {
- askq \%2 { \%1's password: }
- }
- set parity mark ; Set communication parameters
- set flow none
- set handshake xon
- set duplex half
- set input timeout quit ; Don't bother with IF FAILURE
- input 10 BREAK KEY ; Look for BREAK KEY prompt
- pause 1 ; Wait a second
- output \B ; Send BREAK
- input 10 .\17, output logon \%1\13 ; Now log in
- input 10 .\17, output \%2\13 ; Send password
- input 10 .\17, output \13 ; Send carriage return
- input 10 .\17, output \13 ; Send another one
- end 0
-}
-
-COMMENT - VMFULLOGIN macro. Arguments:
-; \%1 = User ID
-; \%2 = Password
-;
-define VMFULLOGIN {
- if < \v(argc) 2 -
- end 1 Usage: \%0 userid [ password ]
- while not defined \%2 {
- askq \%2 { \%1's password: }
- }
- set input timeout quit ; Quit if INPUT fails
- set parity even ; Set communication parameters
- set duplex full
- set handshake none
- set flow xon/xoff
- out \13 ; Send carriage return
- inp 5 TERMINAL TYPE: ; Get terminal-type prompt
- out vt-100\13 ; Just send "vt-100"
- inp 20 RUNNING ; Get RUNNING message
- pau 1 ; Wait one second
- out \%1\9\%2\13 ; Send user ID, tab, password
- out \13\13 ; Two more carriage returns
- end 0
-}
-
-COMMENT - CISLOGIN macro. Arguments:
-; \%1 = CompuServe User ID
-; \%2 = Password
-; \%3 = Prompt
-;
-define CISLOGIN {
- if < \v(argc) 2 -
- end 1 Usage: \%0 userid [ password [ prompt ] ]
- while not defined \%2 {
- askq \%2 { \%1's password: }
- }
- set terminal bytesize 7 ; No 8-bit characters
- set input timeout quit ; Skip the IF FAILURE's
- output \13 ; Send initial carriage return
- input 5 Host Name: ; Look for Host Name prompt
- output cis\13 ; Send "cis" and carriage return
- input 5 User ID: ; Look for User ID prompt
- output \%1\13 ; Send ID and carriage return
- input Password: ; Look for Password prompt
- output \%2\13 ; Send password and CR
- if not def \%3 asg \%3 \v(prompt)
- if not def \%3 asg \%3 {CompuServe Information Service}
- input 30 \%3
- end 0
-}
-
-COMMENT - DOWLOGIN macro. Arguments:
-; \%1 = Dow Jones Password
-;
-define DOWLOGIN {
- while not defined \%1 { ; Get password
- askq \%1 { Dow Jones password: }
- }
- set input timeout proceed
- input 20 SERVICE PLEASE\?\?\?\? ; Look for Dow prompt
- if fail end 1 No service prompt
- out djnr\13 ; Select DJNR
- input 10 @@@@@@@@ ; Get password prompt
- if fail end 1 No password prompt
- pause 1 ; Wait a second, then...
- output \%1\13 ; send password and CR
- input 30 ENTER QUERY ; Get DJNR query prompt
- if fail end 1 No main query prompt
- pause 1
-}
-
-COMMENT - DJNRSPRINT macro: Log in to Dow Jones via SprintNet.
-;
-def djnrsprint sprint dow, if success dowlogin
-
-COMMENT - NOLOGIN macro. Does nothing. Use when login not required.
-;
-def nologin comment
-
-:CUSTOM ; Customization file
-
-; In VMS and OpenVMS, allow for system-wide site customizations
-
-xif equal "\v(system)" "VMS" {
- xif exist CKERMIT_INI:CKERMIT.SYS {
- echo Executing CKERMIT_INI:CKERMIT.SYS
- take CKERMIT_INI:CKERMIT.SYS
- }
-}
-
-; Execute user's personal customization file
-
-xif exist \m(_myinit) { ; If it exists,
- echo Executing \m(_myinit)... ; print message,
- take \m(_myinit) ; and TAKE the file.
-}
-
-; Finish up with traditional greeting.
-
-if < \v(ntime) 43200 echo Good Morning!
- else if < \v(ntime) 61200 echo Good Afternoon!
- else echo Good Evening.
-
-End ; of C-Kermit 8.0 initialization file.