COMMENT - Standard C-Kermit initialization file ; ; For C-Kermit Version: 6.0.192 ; ; 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 ; ; Version 5A(188): 23 November 1992 ; Version 5A(189): 29 June 1993 ; Version 5A(190): 04 October 1994 ; Version 5A(191): 17 April 1995 ; Version 6.0.192: 6 September 1996 ; ; This is the standard and recommended C-Kermit 6.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: ; ; . The FULLSCREEN file transfer display is selected if it is available ; . 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 an EDIT macro to let you invoke a text editor from C-Kermit. ; . Defines TSEND, BSEND, TGET, BGET macros for text and binary file transfer. ; . Defines VTPRINT, PCGET, and PCSEND macros for use with MS-DOS Kermit, etc. ; . Opens your dialing directory if you have one. ; . Reads your services directory and defines ACCESS and LIST macros for it. ; . Executes your personal customization file, if you have one. ; ; 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. ; 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 COMMENT - Greet and make sure C-Kermit version is 6.0 or higher. ; echo Executing \v(cmdfile) for \v(system)... if < \v(version) 600192 - stop 1 \v(cmdfile): C-Kermit 6.0.192 or later required. def _dedit ; No default editor yet. 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 def _dedit vi ; Default editor is VI 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 check fullscreen ; Do we have a fullscreen display? if success set file displ full ; If so, use it. 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 if eq "\$(TERM)" "vt100" - ; File transfer display set file display full ; Only works with VT-100 terminal type else if eq "\$(TERM)" "VT100" - set file display full else set file display crt forward COMMON ; End of OS-9 section :VMS ; VMS and OpenVMS def _dedit edit ; Default editor is EDIT. set file display fullscreen ; File transfer fisplay forward COMMON :OS/2 ; OS/2 asg _inifile \v(cmdfile) ; Get directory where this file is kept... asg _inidirlen \feval(\flength(\m(_inifile))-11) asg _inidir \fsubstr(\m(_inifile),1,\m(_inidirlen)) asg _dialdir \m(_inidir)CKERMIT.KDD asg _netdir \m(_inidir)CKERMIT.KND asg _servicedir \m(_inidir)CKERMIT.KSD asg _myinit \m(_inidir)CKERMOD.INI asg _inidirlen ; Release unneeded variables set file display fullscreen ; File transfer fisplay set server display on ; Show display in server mode too. def _dedit epm ; Default editor is E set command bytesize 8 ; Use 8 bits between Kermit and console. set xfer char latin1 ; Use Latin-1 for text file transfer. def cls clear command-screen ; Define CLS command to clear the screen. def os2 push ; Make OS2 a synonym for PUSH, RUN, etc. def more run type \%1 | more ; Easy access to MORE command. def vdir run dir | more ; "Verbose" DIRECTORY def tdir run dir /o-d | more ; Reverse Time-Order DIRECTORY COMMENT - XSEND macro sends a directory tree. Read XSEND.CMD for details. ; Arguments: ; 1. Pathname, such as C:\\ (backslashes must be doubled!) ; 2. Filespec, such as *.* ; define XSEND rexx call \fcontents(\v(startup))xsend.cmd '\%1 \%2' forward COMMON ; End of OS/2 section :AOS/VS ; Data General AOS/VS def _dedit sed ; Default editor is SED 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 display full ; Supports fullscreen display 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 file display crt ; FULLSCREEN not available 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 def _dedit emacs ; Default editor is emacs 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 set file display crt ; FULLSCREEN not available forward COMMON ; End of Stratus VOS section :COMMON ; For all systems COMMENT - EDIT macro. ; ; EDITOR environment variable, if defined, takes precedence. ; check push ; Only works if we have a PUSH command xif success { if def \$(EDITOR) assign myeditor \$(EDITOR) else assign myeditor \m(_dedit) if not def myeditor def myeditor edit undef _dedit undef myfile def EDIT { if > \v(argc) 2 echo WARNING: \%2 \%3 \%4 \%5 \%6... ignored if = \v(argc) 2 assign myfile \%1 if not def myfile echo Edit what? else run \m(myeditor) \m(myfile) } } ; File transfer macros def _SEND { ; Used by BSEND, TSEND, etc. local \%n asg \%n \ffiles(\%1) ; How many files match argument if = 0 \%n end 1 {\?File not found} ; None if = 1 \%n send \%1 \%2 ; Single file with as-name else send \%1 ; or wildcard with no as-name } def BSEND binary, _send \%1 \%2 ; Send binary file(s) def TSEND text, _send \%1 \%2 ; Send text file(s) def BGET remote set file type binary, - ; Get binary file(s) if success get \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 ; from server def TGET remote set file type text, - ; Get text file(s) if success get \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 ; from server ; 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: FORWARD FILES COMMENT - PCGET macro, for use against MS-DOS Kermit 3.13 and later, ; or Kermit 95, or Kermit/2, or C-Kermit 5A(190) on UNIX or VMS. ; Uses APC. Arguments: ; 1 = Name of file to get from PC. ; 2 = Optional name that C-Kermit should store it under. ; NOTE: If the PC filename contains backslashes, you must make four (4) ; copies of each backslash, e.g. "pcget c:\\\\temp\\\\oofa.txt. ; def PCGET { apc server msleep 200 remote set file type \v(ftype) xif def \%2 { ; If we have an "as-name" get, \%1, \%2 ; use multiline GET asg _tmp \v(status) ; Remember status } else { ; Otherwise get \%1 ; use regular GET asg _tmp \v(status) ; Remember status } fin ; FINISH server end \m(_tmp) ; and return status } COMMENT - PCSEND macro, for use against MS-DOS Kermit 3.13 and later, ; or C-Kermit 5A(190) or later. Uses APC. Arguments: ; \%1 = Name of file to send to MS-DOS Kermit. ; \%2 = Optional name to send it with. ; def PCSEND { local \%n asg \%n \ffiles(\%1) if = 0 \%n end 1 {\?File not found} apc receive if = 1 \%n send \%1 \%2 ; Single file with as-name else send \%1 ; or wildcard with no as-name } :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_DIAL_DIRECTORY) assign _dialdir \$(K_DIAL_DIRECTORY) if not def _dialdir assign _dialdir \v(home)CKERMIT.KDD if def \$(K_NET_DIRECTORY) assign _dialdir \$(K_NET_DIRECTORY) if not def _dialdir assign _dialdir \v(home)CKERMIT.KND if def \$(K_SERVICE_DIRECTORY) assign _servicedir \$(K_SERVICE_DIRECTORY) if not def _servicedir assign _servicedir \v(home)CKERMIT.KSD CHECK DIAL ; Is the DIAL command enabled? xif fail { ; No. echo DIAL disabled } else { ; Yes, check for and open the dial directory. xif exist \m(_dialdir) { set dial directory \m(_dialdir) echo { Dial directory is \m(_dialdir) } } xif exist \m(_netdir) { set net directory \m(_netdir) echo { Network directory is \m(_netdir) } } } COMMENT - Services directory if not exist \m(_servicedir) forward connection 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 { 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 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 \%1 if fail end 1 unsupported network: \%1 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 set modem \%1 ; Set modem type if fail end 1 unknown modem type: \%1 set line \%2 ; Communication device if fail end 1 can't open device: \%2 set speed \%3 ; Communication speed 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 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 { 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 set case on ; Case is important in UNIX in 5 login: ; Is prompt already there? xif fail { ; No. for \%i 1 3 1 { ; Try 3 times to get it. out \B\13 ; Send BREAK and CR in 5 login: ; Look for prompt if success break ; Success, go log in } if > \%i 3 end 1 No login 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 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 byteszie 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 6.0 initialization file.