COMMENT - Standard C-Kermit initialization file ; ; For C-Kermit Version: 5A(190) ; ; Filename: ; .kermrc (UNIX, OS-9, Aegis) ; CKERMIT.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga) ; ckermit.ini (Stratus VOS) ; ; Authors: ; Frank da Cruz, Christine M. Gianone ; Columbia University, New York, NY, USA ; ; OS/2 modifications for version 5A(189-190): ; Jeffrey Altman ; Altmania Productions ; ; Version 5A(188): 23 November 1992 ; Version 5A(189): 29 June 1993 ; Version 5A(190) (in progress): Sat Aug 20 11:20:07 1994 ; ; This is the standard and recommended C-Kermit 5A initialization file. ; It should be portable to all implementations of C-Kermit 5A edit 188 ; and later. 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) ; CKERMOD.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga) ; ; 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 CKDDIR. ; . 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 CKSDIR. ; . 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. ; . 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 5A is documented in the book "Using C-Kermit" by Frank da Cruz ; and Christine M. Gianone, 1993, Digital Press / Butterworth-Heinemann, ; Woburn, MA; ISBN 1-55558-108-0, Price: US $34.95. def \%g FORWARD ; Use FORWARD for speed if available. check FORWARD if success forward OK ec WARNING: ec This command file should be used with C-Kermit 5A(190) Beta.18 or later. def \%g GOTO :OK ; 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. COMMENT - Greet and make sure C-Kermit edit is 188 or higher. ; echo Executing \v(cmdfile) for \v(system)... if < \v(version) 501188 - stop 1 \v(cmdfile): C-Kermit 5A(188) or later required. def _dedit ; No default editor yet. \%g \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 > \v(version) 501189 if remote \%g COMMON ; Skip local-mode items if "-R" asg _dialdir - \v(home).kdd ; C-Kermit dialing 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. \%g COMMON ; End of UNIX section :OS9/68K ; OS-9 asg _myinit - \v(home).mykermrc ; Customization filename if > \v(version) 501189 if remote \%g COMMON asg _dialdir - \v(home).kdd ; C-Kermit dialing 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 \%g COMMON ; End of OS-9 section :VMS ; VMS and OpenVMS def _dedit edit ; Default editor is EDIT. set file display fullscreen ; File transfer fisplay \%g 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 _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 e ; 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 echo \27[H\27[2J ; 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 \%g COMMON ; End of OS/2 section :AOS/VS ; Data General AOS/VS def _dedit sed ; Default editor is SED 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] \%g 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 ; ... \%g 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! \%g COMMON ; End of Atari ST section :Macintosh ; Apple Macintosh set server display on ; Show file xfer display in server mode too. \%g COMMON :Stratus_VOS ; Stratus VOS def _dedit emacs ; Default editor is emacs asg _myinit \v(home)ckermod.ini if > \v(version) 501189 if remote \%g COMMON asg _dialdir \v(home)ckermit.kdd asg _servicedir \v(home)ckermit.ksd \%g COMMON ; End of Stratus VOS section :COMMON ; System-independent items ; Make the C-Kermit prompt show my current directory. ; Environment variable or logical name CKPROMPT takes precedence. ; if def \$(CKPROMPT) set prompt \$(CKPROMPT) else if eq "\v(system)" "VMS" set prompt \v(dir) C-Kermit> else set prompt [\v(dir)] C-Kermit> COMMENT - File transfer macros ; def _SEND asg \%9 \ffiles(\%1),- if = 0 \%9 end 1 {\?File not found},- if = 1 \%9 send \%1 \%2,- ; Single file with as-name else send \%1 ; or wildcard with no as-name def BINARY set file type binary def TEXT set file type text 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 def FAST - ech FAST file transfer settings - use at your own risk...,- set win 5, set rec packet 5000, set contr u all,- set con p 0 1 3 13 17 19 129 141 145 147 def ROBUST set win 1, set rec packet 90, set con p all COMMENT - EDIT macro. ; ; EDITOR environment variable, if defined, takes precedence. ; check push ; Only works if we have a PUSH command if fail \%g macros ; (so it doesn't work on the Macintosh). if def \$(EDITOR) assign myeditor \$(EDITOR) else assign myeditor \m(_dedit) if not def myeditor def myeditor edit def _dedit def myfile def edit if = \v(argc) 2 assign myfile \%1,- if not def myfile echo Edit what?,- else run \m(myeditor) \m(myfile) :MACROS ; 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),OS/2:Macintosh:Amiga:Atari_ST) \%g files COMMENT - VTPRINT macro. Print a file on your PC's local printer. ; def vtprint echo \27[5i, type \%1, echo \27[4i COMMENT - Macros for host-initiated file transfer with MS-DOS Kermit ; And OS/2 C-Kermit. ; ; The method for doing this changed in June/July 1993, when C-Kermit 5A(189) ; and MS-DOS Kermit 3.13 were released (at approximately the same time). ; There is no good way for C-Kermit to find out the MS-DOS Kermit version ; number, so we determine which method to use based on the C-Kermit version. ; if > \v(version) 501188 \%g apc COMMENT - PCGET macro, for use with MS-DOS Kermit 3.12 and earlier. Argument: ; 1 = Name of file to get from MS-DOS Kermit. ; Requires MS-DOS Kermit macro TERMINALS defined as "server, connect". ; def PCGET echo \27[\?34h, get \%1, finish COMMENT - PCSEND macro, for use with MS-DOS Kermit 3.12 and earlier. Args: ; \%1 = Name of file to send to MS-DOS Kermit. ; \%2 = Optional name to send it with. ; Requires MS-DOS Kermit macro TERMINALR defined as "receive, connect". ; def PCSEND asg \%9 \ffiles(\%1),- if = 0 \%9 end 1 {\?File not found},- set delay 1, echo \27[\?34l,- if = 1 \%9 send \%1 \%2,- ; Single file with as-name else send \%1 ; or wildcard with no as-name \%g files :APC COMMENT - PCGET macro, for use against MS-DOS Kermit 3.13 and later, ; or C-Kermit 5A(190) or later on the PC. Arguments: ; 1 = Name of file to get from PC. ; 2 = Optional name that C-Kermit should store it under. ; def pcget apc server, - msleep 200,- if not eq "\v(ftype)" "" 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, end \m(_tmp) ; FINISH server and return status COMMENT - PCSEND macro, for use against MS-DOS Kermit 3.13 and later, ; or C-Kermit 5A(190) or later. Arguments: ; \%1 = Name of file to send to MS-DOS Kermit. ; \%2 = Optional name to send it with. ; def pcsend asg \%9 \ffiles(\%1),- if = 0 \%9 end 1 {\?File not found},- set delay 1, apc receive,- if = 1 \%9 send \%1 \%2,- ; Single file with as-name else send \%1 ; or wildcard with no as-name :FILES ; Get customization, dialing directory, and services directory filenames. ; Let environment variables take precedence, so users 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 > \v(version) 501189 if remote \%g NOSERVICES if def \$(CKDDIR) assign _dialdir \$(CKDDIR) if not def _dialdir assign _dialdir \v(home)CKERMIT.KDD if def \$(CKSDIR) assign _servicedir \$(CKSDIR) 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) } - } - } COMMENT - Check for existence of services directory ; if not exist \m(_servicedir) \%g NOSERVICES COMMENT - Have services directory, so read it and define related macros ; echo { Services directory is \m(_servicedir)} def max_svcs 50 ; Adjust this if you have more than 50 entries! open read \m(_servicedir) ; Open services directory file xif fail { - echo Can't open \m(_servicedir), - goto NOSERVICES - } declare \&d[\m(max_svcs)] ; Declare array for service directory entries for \%i 1 \m(max_svcs) 1 { - ; Read entries into array read \&d[\%i], - if fail \%g DONE - } close read ; Didn't reach the end echo - ; Close the file and print useful message \?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.} \%g NOSERVICES :DONE ; We have the services directory in memory asg \&d[0] \feval(\%i - 1) ; Keep size of array in zeroth element ; LIST macro. Arguments: ; \%1 = service name (optional) ; def LIST - if > \v(argc) 1 goto SEARCH, - echo \&d[0] items in services directory:, - ; No search item for \%i 1 \&d[0] 1 { echo \&d[\%i] }, end, - ; List whole directory :SEARCH, - ; Search item given lookup \%1, - ; Look it up if def \v(return) echo \v(return), - ; List it if found else echo \%1: Not found ; or say it wasn't 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 end 1 Usage: CALL modem device speed number,- set modem \%1,- if fail end 1 unknown modem type: \%1,- set line \%2,- if fail end 1 can't open device: \%2,- set speed \%3,- if fail end 1 unsupported speed: \%3,- for \%i 1 10 1 { - xif > \%i 1 { - echo Will redial in 1 minute: please wait...,- pause 60,- echo Redialing: try number \%i...,- },- dial \%4,- if success goto OK,- hangup,- } - end 1 Can't place call: \%4,- :ok,- pause 1,- echo 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 - VMSLOGIN macro. Arguments: ; \%1 = VMS user ID ; \%2 = Password. If password not supplied, it is prompted for. ; def VMSLOGIN if < \v(argc) 2 end 1 Usage: VMSLOGIN userid password,- if eq \fcode(\%2) 32 asg \%2 \fsubst(\%2,2), - while not def \%2 { - askq \%2 { \%1's password: } - },- set parity none,- set duplex full,- set handshake none,- set flow xon/xoff,- set input timeout proceed,- for \%i 1 3 1 { - out \13,- in 5 Username:,- if success goto DOLOGIN - },- end 1 No Username prompt,- :DOLOGIN,- out \%1\13,- inp 5 Password:,- if fail end 1 No password prompt,- out \%2\13,- def \%2,- set inp ech off,- minp 20 \27Z \27[c,- xif success { - out \27[\?1c,- in 2 [6n,- if succ out \27[24;80R - } else { out \13},- set inp ech on,- if not def \%3 asg \%3 {\10\13$\32},- reinp 0 \%3,- if fail inp 60 \%3,- if fail end 1 No system prompt,- echo Login successful. COMMENT - UNIXLOGIN macro. Arguments: ; \%1 = user ID ; \%2 = password ; def UNIXLOGIN if < \v(argc) 2 end 1 Usage: \%0 userid password,- if eq \fcode(\%2) 32 asg \%2 \fsubst(\%2,2), - while not def \%2 { - askq \%2 { \%1's password: } - },- set parity none,- set duplex full,- set handshake none,- set case on,- out \13,- set input timeout proceed,- for \%i 1 15 1 { - in 5 login:,- if success goto DOLOGIN,- output \\B - },- end 1 No login prompt,- :DOLOGIN,- out \%1\13,- inp 5 Password:,- if fail end 1 No password prompt,- out \%2\13,- def \%2,- if not def \%3 asg \%3 {\13\10$ },- inp 60 \%3,- if fail end 1 No system prompt,- echo, echo Login successful. COMMENT - VMLINELOGIN macro. Arguments: ; \%1 = User ID ; \%2 = Password ; def VMLINELOGIN - if < \v(argc) 2 end 1 Usage: \%0 userid password,- if eq \fcode(\%2) 32 asg \%2 \fsubst(\%2,2), - while not def \%2 { - askq \%2 { \%1's password: } - },- set parity mark,- set flow none,- set handshake xon,- set duplex half,- set input timeout quit,- input 10 BREAK KEY,- pause 1,- output \\B,- input 10 .\17, output login \%1\13,- input 10 .\17, output \%2\13, def \%2,- input 10 .\17, output \13,- input 10 .\17, output \13,- set input timeout proceed,- echo Login successful. COMMENT - VMFULLOGIN macro. Arguments: ; \%1 = User ID ; \%2 = Password ; def VMFULLOGIN - if < \v(argc) 2 end 1 Usage: \%0 userid password,- if eq \fcode(\%2) 32 asg \%2 \fsubst(\%2,2), - while not def \%2 { - askq \%2 { \%1's password: } - },- set input timeout quit,- set parity even,- set duplex full,- set handshake none,- set flow xon/xoff,- out \13,- inp 5 TERMINAL TYPE:,- out vt-100\13,- inp 20 RUNNING,- pau 1,- out \%1\9\%2\13,- out \13\13,- set input timeout proceed,- echo Login successful. COMMENT - CISLOGIN macro for CompuServe. Arguments: ; \%1 = CompuServe User ID ; \%2 = Password ; def CISLOGIN - if < \v(argc) 2 end 1 Usage: \%0 userid password,- if eq \fcode(\%2) 32 asg \%2 \fsubst(\%2,2), - while not def \%2 { - askq \%2 { \%1's password: } - },- set terminal bytesize 7,- set input timeout quit,- output \13,- input 5 Host Name:,- output cis\13,- input 5 User ID:,- output \%1\13,- input 5 Password:,- output \%2\13,- def \%2,- if not def \%3 asg \%3 CompuServe Information Service,- input 30 \%3,- echo, echo Login successful. COMMENT - DOWLOGIN macro for Dow Jones News/Retrieval. Arguments: ; \%1 = Dow Jones Password ; def DOWLOGIN - if eq \fcode(\%2) 32 asg \%2 \fsubst(\%2,2), - while not def \%2 { - askq \%2 { \%1's password: } - },- set input timeout proceed,- input 20 SERVICE PLEASE\?\?\?\?,- if fail end 1 no service prompt,- out djnr\13,- input 10 @@@@,- if fail end 1 No password prompt,- pause 1,- output \%1\13,- if not def \%3 asg \%3 ENTER QUERY,- input 30 \%3,- if fail end 1 No main query prompt,- pause 1@,- echo Login successful. COMMENT - DJNRSPRINT macro: Log in to Dow Jones via SprintNet. ; def djnrsprint sprint dow, dowlogin COMMENT - NOLOGIN macro. Does nothing. Use when login not required. ; def nologin comment COMMENT - LOOKUP macro. Argument: ; \%1 = Service name to look for in services directory ; def LOOKUP - set case off,- ; Ignore alphabetic case for \%i 1 \&d[0] 1 { - ; Loop thru services directory if eq \%1 \fsubstr(\&d[\%i],1,\flen(\%1)) - ; Got a match? break - ; If so, we're done },- if not > \%i \&d[0] return \&d[\%i] ; Return the entry def _a1 return \%1 def _a2 return \%2 def DOACCESS - ; (Used internally by ACCESS macro) do \%5 \%6 \%7 \%8 \%9,- ; Do the connection macro if fail end 1,- _a2 \%3,- ; Prompt, if any asg \%2 \v(return),- _a1 \%3,- ; Login macro name asg \%3 \v(return),- do \%3 \%4 {\%1} \%2 ; Login macro, userid, password, prompt ; ACCESS macro. Arguments: ; \%1 = service name ; \%2 = password (optional) ; def ACCESS - if not defined \%1 end 1 access what?,- ; Check service lookup \%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 stop 1 ; DOACCESS failed? \%g ENDSERVICES ; Skip around NOSERVICES definitions. :NOSERVICES def access echo { Services directory not available.} asg list \m(access) :ENDSERVICES COMMENT - In VMS and OpenVMS, allow for system-wide site customizations ; if not equal "\v(system)" "VMS" \%g CUSTOM xif exist CKERMIT_INI:CKERMIT.SYS { - echo Executing CKERMIT_INI:CKERMIT.SYS, - take CKERMIT_INI:CKERMIT.SYS - } COMMENT - Execute user's personal customization file ; :CUSTOM xif exist \m(_myinit) { - ; If it exists, echo Executing \m(_myinit)..., - ; print message, take \m(_myinit) - ; and TAKE the file. } COMMENT - Greeting. ; if < \v(ntime) 43200 echo Good Morning! else if < \v(ntime) 61200 echo Good Afternoon! else echo Good Evening. ; End of C-Kermit 5A initialization file.