1 COMMENT - Standard C-Kermit initialization file
3 ; For C-Kermit Version: 8.0
6 ; .kermrc (UNIX, OS-9, Aegis)
7 ; CKERMIT.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga)
8 ; ckermit.ini (Stratus VOS)
9 ; K95.INI (Kermit 95 -- but this big version is not used there)
10 ; K2.INI (Kermit/2 -- but ditto)
13 ; Frank da Cruz, Christine M. Gianone, Jeffrey Altman
14 ; Columbia University, New York, NY 10025-7799, USA
16 ; This is the standard and recommended C-Kermit 8.0 initialization file. To
17 ; override settings or definitions made in this file, to add new settings or
18 ; definitions, or to make any other desired customizations, create a separate,
19 ; personal customization file called:
21 ; .mykermrc (UNIX, OS-9, Aegis, BeBox, Plan 9)
22 ; CKERMOD.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga)
25 ; You can also define the customization filename in an environment
26 ; variable (logical name in VMS), CKERMOD, which takes precedence over
27 ; the names shown above.
29 ; WHAT THIS FILE DOES:
31 ; . Defines your default dialing directory name:
32 ; .kdd for UNIX, OS-9 and Aegis; CKERMIT.KDD for other operating systems.
33 ; You can override this with the environment variable K_DIAL_DIRECTORY
34 ; . Defines your default network directory name:
35 ; .knd for UNIX, OS-9 and Aegis; CKERMIT.KND for other operating systems.
36 ; You can override this with the environment variable K_NET_DIRECTORY
37 ; . Defines your default services directory name:
38 ; .ksd for UNIX, OS-9 and Aegis; CKERMIT.KSD for other operating systems.
39 ; You can override this with environment variable K_SERVICE_DIRECTORY.
40 ; . Defines your customization file name (name given above)
41 ; . Performs system-dependent setups for UNIX, VMS, OS/2, etc.
42 ; . Defines VTPRINT macros for use with K95, MS-DOS Kermit, etc.
43 ; . If you have a services directory, all the macros needed to use it are
44 ; defined. If you don't have a services directory, the macros are not
45 ; defined and Kermit starts faster.
46 ; . Executes your personal customization file, if you have one.
47 ; NOTE: Your customization file is NOT executed by Kermit itself; it is
48 ; executed by this file.
50 ; In UNIX, with C-Kermit 7.0 and later, you can store this file with a name
51 ; other than .kermrc, and it will not be executed automatically, but, if you
52 ; give this file execute permission, you can execute directly because of the
53 ; "kerbang line" at the top, whenever you want all of the above actions to
54 ; occur. The kerbang line must reflect the actual full path of the Kermit
55 ; 7.0-or-later executable.
57 ; C-Kermit 6.0 is documented in the book "Using C-Kermit", 2nd Edition,
58 ; by Frank da Cruz and Christine M. Gianone, 1997, Digital Press /
59 ; Butterworth-Heinemann, ISBN 1-55558-164-1. New features of subsequent
60 ; versions are documented at the Kermit website:
61 ; http://www.columbia.edu/kermit/
63 ; Everything after this point depends on the script programming language.
64 ; The CHECK command terminates this command file immediately if the script
65 ; programming language (IF command) is not configured.
67 set take error on ; This makes CHECK quit if no script language.
68 check if ; Do we have an IF command? If not, quit now.
69 set take error off ; Back to normal.
71 local _sd _servicedir _xp ; Declare local variables.
73 COMMENT - C-Kermit version 6.0 or later required.
77 if not def _xp asg _xp \v(program)
78 if not equal "\m(_xp)" "C-Kermit" -
79 stop 1 \v(cmdfile): This initialization file is only for C-Kermit.
80 echo Executing \v(cmdfile) for \v(system)...
81 if < \v(version) 60000 -
82 stop 1 \v(cmdfile): C-Kermit 6.0 or later required.
84 forward \v(system) ; First do system-dependent items...
86 :unknown ; Should not happen
87 Stop 1 Error: System type unknown!
89 :Aegis ; Apollo Aegis and
90 :UNIX ; UNIX, all versions
92 \v(home).mykermrc ; Customization filename
93 if remote forward COMMON ; Skip local-mode items if "-R"
95 \v(home).kdd ; C-Kermit dialing directory
97 \v(home).knd ; C-Kermit network directory
99 \v(home).ksd ; C-Kermit services directory
100 forward COMMON ; End of UNIX section
104 \v(home).mykermrc ; Customization filename
105 if remote forward COMMON
107 \v(home).kdd ; C-Kermit dialing directory
109 \v(home).knd ; C-Kermit network directory
111 \v(home).ksd ; C-Kermit services directory
112 else set file display crt
113 forward COMMON ; End of OS-9 section
115 :VMS ; VMS and OpenVMS
120 echo This initialization file is not for use with K95.
121 forward COMMON ; End of OS/2 section
123 :AOS/VS ; Data General AOS/VS
124 set window 1 ; Sliding windows don't work
125 set file char dg-international ; File character-set
126 set xfer char latin1 ; Transfer character-set
127 set file display crt ; File transfer fisplay
128 def cli push ; Escape to CLI
129 def reset - ; Macro to reset DG DASHER terminal
130 run write [!ascii 236 306 301]
131 forward COMMON ; End of AOS/VS section
133 :Amiga ; Commodore Amiga
134 def cls echo \27[H\27[2J ; CLS command to clear the screen
135 set file char latin1 ; Use Latin Alphabet 1 for file transfer
136 set xfer char latin1 ; ...
137 forward COMMON ; End of Amiga section
140 def cls echo \27H\27J ; Clear screen a`la VT52
141 set server display on ; Show file xfer display in server mode too
142 set server timeout 15 ; Nonzero required for ^C interruption!
143 forward COMMON ; End of Atari ST section
145 :Macintosh ; Apple Macintosh
146 set server display on ; Show file xfer display in server mode too.
149 :Stratus_VOS ; Stratus VOS
150 asg _myinit \v(home)ckermod.ini
151 if remote forward COMMON
152 asg _dialdir \v(home)ckermit.kdd
153 asg _netdir \v(home)ckermit.knd
154 asg _servicedir \v(home)ckermit.ksd
155 forward COMMON ; End of Stratus VOS section
157 :COMMON ; For all systems
159 ; Define macros that are useful when running C-Kermit in remote mode.
160 ; These macros serve no purpose on local-mode-only versions such as
161 ; OS/2, Macintosh, Amiga, and Atari ST Kermit, so we skip defining them
164 if not = 0 \findex(\v(system),WIN32:OS/2:Macintosh:Amiga:Atari_ST) -
167 ; VTPRINT macro. Print a file on your PC's local printer.
169 def VTPRINT echo \27[5i, type \%1, echo \27[4i
170 ; or if your printer needs a formfeed to force the page out:
171 ; def VTPRINT def echo \27[5i, type \%1, echo \12\27[4i
173 ; Macros for host-initiated file transfer using APC:
174 ; NOT NEEDED ANY MORE because of autodownload/autoupload.
175 ; Remove the following FORWARD command to reinstate these definitions:
179 ; Get customization and directory file names. Environment variables take
180 ; precedence, so you do not have to edit this file to change these filenames.
182 if def \$(CKERMOD) assign _myinit \$(CKERMOD)
183 if not def _myinit assign _myinit \v(home)CKERMOD.INI
185 if remote forward CUSTOM ; Skip all this if -R given on command line
187 if def \$(K_NET_DIRECTORY) assign _netdir \$(K_NET_DIRECTORY)
188 if not def _netdir assign _netdir \v(home)CKERMIT.KND
190 if def \$(K_DIAL_DIRECTORY) assign _dialdir \$(K_DIAL_DIRECTORY)
191 if not def _dialdir assign _dialdir \v(home)CKERMIT.KDD
193 CHECK DIAL ; Is there a DIAL command?
201 xif exist \m(_netdir) {
202 set net directory \m(_netdir)
203 echo { Network directory is \m(_netdir) }
207 if eq "\v(name)" "telnet" forward CUSTOM
209 xif exist \m(_dialdir) {
210 set dial directory \m(_dialdir)
211 echo { Dial directory is \m(_dialdir) }
214 COMMENT - Services directory
216 if def \$(K_SERVICE_DIRECTORY) assign _servicedir \$(K_SERVICE_DIRECTORY)
217 if not def _servicedir assign _servicedir \v(home)CKERMIT.KSD
219 ; If no services directory is found skip all the big macro definitions and
220 ; go straight to the bottom, where we execute the customization file.
222 if not exist \m(_servicedir) forward custom
224 echo { Services directory is \m(_servicedir)}
226 def MAX_SVCS 200 ; Adjust this if you have more entries
227 define _sd 0 ; Assume no services directory
228 open read \m(_servicedir) ; Try to open services directory file
230 declare \&d[\m(MAX_SVCS)] ; It's open, declare directory array
231 for \%i 1 \m(MAX_SVCS) 1 { ; Read the lines into the array
236 xif > \%i \m(MAX_SVCS) {
237 echo Too many entries in services directory
238 echo { Maximum is \m(MAX_SVCS).}
239 echo { Change definition of MAX_SVCS in \v(cmdfile) to allow more. }
240 echo { Services directory disabled.}
242 asg \&d[0] \feval(\%i - 1)
248 def access echo { Services directory not available.}
254 if eq {\%1} {\fsubstr(\&d[\%i],1,\flen(\%1))} break
256 if not > \%i \&d[0] return \&d[\%i]
261 if def \v(return) echo \v(return)
262 else echo \%1: Not found
264 echo \&d[0] items in services directory:
265 for \%i 1 \&d[0] 1 { echo \fcont(\&d[\%i]) }
268 def SPLIT { asg _word1 \%1, asg _word2 \%2 }
269 def DOACCESS { ; (Used internally by ACCESS macro)
270 do \%5 \%6 \%7 \%8 \%9 ; Do the connection macro
272 split \%3 ; Get words from \%3
275 do \%3 \%4 {\%1} \%2 ; Login macro, userid, password, prompt
278 if not defined \%1 end 1 access what? ; Check service
279 do find \%1 ; Look it up
280 if success doaccess {\%2} \v(return) ; OK, try it
281 else end 1 "\%1" not in services directory ; Not found
282 if fail end 1 ; DOACCESS failed?
283 xif eq \v(cmdlevel) 1 {
285 echo ACCESS: Login succeeded - CONNECTing...
293 :CONNECTION ; Macros for making connections
295 COMMENT - SERIAL macro. Arguments:
300 if < \v(argc) 3 ; All arguments given?
301 end 1 Usage: SERIAL device speed ; No.
302 set line \%1 ; OK, try to SET LINE.
303 if failure - ; If this failed,
304 end 1 Can't open device: \%1 ; print message and quit.
305 set speed \%2 ; Try to set the speed.
306 if fail end 1 Unsupported speed: \%2 ; Failed.
307 echo Connection successful. ; Succeeded.
310 COMMENT - NET macro. Arguments:
312 ; \%2 = host name or address
315 if < \v(argc) 3 end 1 Usage: NET network host
317 if fail end 1 unsupported network: \%1
318 set login user ; Don't send user ID.
320 if fail end 1 Can't reach host: \%2
321 echo Connection successful.
324 COMMENT - CALL macro. Arguments:
332 if < \v(argc) 5 - ; All arguments present?
333 end 1 Usage: CALL modem device speed number
334 xif not equal {\v(modem)} {\%1} { ; Set modem type
336 if fail end 1 unknown modem type: \%1
338 xif not equal {\v(line)} {\%2} { ; Communication device
340 if fail end 1 can't open device: \%2
342 xif not equal {\v(speed)} {\%3} { ; Communication speed
344 if fail end 1 unsupported speed: \%3
346 dial \%4 ; Dial the number
347 if fail end 1 Can't place call: \%4
348 end 0 Connection successful.
351 COMMENT - TCPCALL macro. Arguments:
353 ; \%1 = server name:port
358 if < \v(argc) 4 - ; All arguments present?
359 end 1 Usage: TCPCALL server[:port] modem number
360 set net type tcp/ip ; Which network to use
361 if fail end 1 unsupported network: tcp/ip
362 set host \%1 ; Access server and port
363 if fail end 1 can't access server \%1
364 set modem \%2 ; Set modem type
365 if fail end 1 unknown modem type: \%2
366 dial \%3 ; Dial the number
367 if fail end 1 Can't place call: \%3
368 end 0 Connection successful.
371 COMMENT - SPRINT macro. Arguments:
372 ; \%1 = Service name or address
375 if < \v(argc) 2 end 1 Usage: \%0 service
376 set input timeout proceed
379 if fail end 1 No terminal prompt
382 if fail end 1 No atsign prompt
385 if fail end 1 Can't access \%1 from SprintNet
388 COMMENT - ULOGIN macro. For logging into systems where user ID is required
389 ; but there is no password. Arguments:
393 if < \v(argc) 2 end 1 Usage: \%0 userid
394 set input timeout proceed ; Handle timeouts ourselves
395 set case on ; Case is important in UNIX
396 minput 5 login: Username: {User ID:} {User Name:}
397 out \%1\13 ; Send username, carriage return
401 COMMENT - VMSLOGIN macro. Arguments:
403 ; \%2 = Password. If password not supplied, it is prompted for.
404 ; \%3 = System prompt. If omitted a default is supplied.
407 if < \v(argc) 2 end 1 Usage: \%0 userid [ password [ prompt ] ]
408 while not defined \%2 {
409 askq \%2 { \%1's password: }
411 set parity none ; Set communication parameters
414 set input timeout proceed ; Handle timeouts ourselves
415 in 5 Username: ; Is prompt already there?
417 for \%i 1 3 1 { ; Try 3 times to get it.
418 out \13 ; Send carriage return
419 in 5 Username: ; Look for prompt
420 if success break ; Success, go log in
422 if > \%i 3 end 1 No Username prompt
424 out \%1\13 ; Send username, carriage return
425 inp 5 Password: ; Wait 5 sec for this prompt
426 if fail end 1 No password prompt
428 out \%2\13 ; Send password
429 xif not emulation { ; No emulator built in?
430 set input echo off ; Protect terminal from this
431 minput 10 {\27Z} {\27[c} {\27[0c} ; Get terminal ID query
432 xif success { ; Got one
433 output \27[\?1c ; Send VT100 terminal ID
434 in 2 \27[6n ; Screen dimension query?
435 if succ out \27[\v(rows);\v(cols)R ; Send dimensions
437 set input echo on ; Echo input again
439 if not def \%3 - ; If we were not given a prompt
440 asg \%3 {\v(prompt)} ; use the SET LOGIN PROMPT value
441 if not def \%3 - ; If we still don't have a prompt
442 asg \%3 {\13$\32} ; use this one as the default
443 reinp 0 \%3 ; Did we INPUT the prompt already?
444 if fail inp 60 \%3 ; No, look now.
448 COMMENT - UNIXLOGIN macro. Arguments:
450 ; \%2 = Password. If password not supplied, it is prompted for.
451 ; \%3 = System prompt. If omitted a default is supplied.
456 end 1 Usage: \%0 userid [ password [ prompt ] ]
457 while not defined \%2 {
458 askq \%2 { \%1's password: }
461 set parity none ; Set communication parameters.
464 set input timeout proceed ; Handle timeouts ourselves
465 set case on ; Case is important in UNIX
466 def \%m 10 ; Waiting time for INPUT
468 minput \%m login: {ssword:} {Password for \%1:}
473 if > \%i 5 end 1 {No response from host}
474 xif = \v(minput) 1 { ; Have username prompt
475 output \%1\13 ; Send username
476 minput 5 {ssword:} {ssword for \%1:} ; Wait for password prompt
477 if fail end 1 {No password prompt}
480 out \%2\13 ; Send password
481 if not def \%3 - ; If we were not given a prompt
482 asg \%3 {\v(prompt)} ; use the SET LOGIN PROMPT value
483 if not def \%3 - ; If we still don't have a prompt
484 asg \%3 {\10$ } ; use this one as the default
485 reinp 0 \%3 ; Did we INPUT the prompt already?
486 if fail inp 60 \%3 ; No, look now.
490 COMMENT - VMLINELOGIN macro. Arguments:
496 end 1 Usage: \%0 userid [ password ]
497 while not defined \%2 {
498 askq \%2 { \%1's password: }
500 set parity mark ; Set communication parameters
504 set input timeout quit ; Don't bother with IF FAILURE
505 input 10 BREAK KEY ; Look for BREAK KEY prompt
506 pause 1 ; Wait a second
507 output \B ; Send BREAK
508 input 10 .\17, output logon \%1\13 ; Now log in
509 input 10 .\17, output \%2\13 ; Send password
510 input 10 .\17, output \13 ; Send carriage return
511 input 10 .\17, output \13 ; Send another one
515 COMMENT - VMFULLOGIN macro. Arguments:
521 end 1 Usage: \%0 userid [ password ]
522 while not defined \%2 {
523 askq \%2 { \%1's password: }
525 set input timeout quit ; Quit if INPUT fails
526 set parity even ; Set communication parameters
530 out \13 ; Send carriage return
531 inp 5 TERMINAL TYPE: ; Get terminal-type prompt
532 out vt-100\13 ; Just send "vt-100"
533 inp 20 RUNNING ; Get RUNNING message
534 pau 1 ; Wait one second
535 out \%1\9\%2\13 ; Send user ID, tab, password
536 out \13\13 ; Two more carriage returns
540 COMMENT - CISLOGIN macro. Arguments:
541 ; \%1 = CompuServe User ID
547 end 1 Usage: \%0 userid [ password [ prompt ] ]
548 while not defined \%2 {
549 askq \%2 { \%1's password: }
551 set terminal bytesize 7 ; No 8-bit characters
552 set input timeout quit ; Skip the IF FAILURE's
553 output \13 ; Send initial carriage return
554 input 5 Host Name: ; Look for Host Name prompt
555 output cis\13 ; Send "cis" and carriage return
556 input 5 User ID: ; Look for User ID prompt
557 output \%1\13 ; Send ID and carriage return
558 input Password: ; Look for Password prompt
559 output \%2\13 ; Send password and CR
560 if not def \%3 asg \%3 \v(prompt)
561 if not def \%3 asg \%3 {CompuServe Information Service}
566 COMMENT - DOWLOGIN macro. Arguments:
567 ; \%1 = Dow Jones Password
570 while not defined \%1 { ; Get password
571 askq \%1 { Dow Jones password: }
573 set input timeout proceed
574 input 20 SERVICE PLEASE\?\?\?\? ; Look for Dow prompt
575 if fail end 1 No service prompt
576 out djnr\13 ; Select DJNR
577 input 10 @@@@@@@@ ; Get password prompt
578 if fail end 1 No password prompt
579 pause 1 ; Wait a second, then...
580 output \%1\13 ; send password and CR
581 input 30 ENTER QUERY ; Get DJNR query prompt
582 if fail end 1 No main query prompt
586 COMMENT - DJNRSPRINT macro: Log in to Dow Jones via SprintNet.
588 def djnrsprint sprint dow, if success dowlogin
590 COMMENT - NOLOGIN macro. Does nothing. Use when login not required.
594 :CUSTOM ; Customization file
596 ; In VMS and OpenVMS, allow for system-wide site customizations
598 xif equal "\v(system)" "VMS" {
599 xif exist CKERMIT_INI:CKERMIT.SYS {
600 echo Executing CKERMIT_INI:CKERMIT.SYS
601 take CKERMIT_INI:CKERMIT.SYS
605 ; Execute user's personal customization file
607 xif exist \m(_myinit) { ; If it exists,
608 echo Executing \m(_myinit)... ; print message,
609 take \m(_myinit) ; and TAKE the file.
612 ; Finish up with traditional greeting.
614 if < \v(ntime) 43200 echo Good Morning!
615 else if < \v(ntime) 61200 echo Good Afternoon!
616 else echo Good Evening.
618 End ; of C-Kermit 8.0 initialization file.