source: trunk/third/kermit/ckermit.ini @ 20081

Revision 20081, 20.7 KB checked in by zacheiss, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20080, which included commits to RCS files with non-trunk default branches.
Line 
1COMMENT - Standard C-Kermit initialization file
2;
3; For C-Kermit Version: 8.0
4;
5; Filename:
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)
11;
12; Authors:
13;   Frank da Cruz, Christine M. Gianone, Jeffrey Altman
14;   Columbia University, New York, NY 10025-7799, USA
15;
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:
20;
21;   .mykermrc     (UNIX, OS-9, Aegis, BeBox, Plan 9)
22;   CKERMOD.INI   (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga)
23;   ckermod.ini   (VOS)
24;
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.
28;
29; WHAT THIS FILE DOES:
30;
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.
49;
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.
56;
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/
62;
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.
66;
67set take error on               ; This makes CHECK quit if no script language.
68check if                        ; Do we have an IF command?  If not, quit now.
69set take error off              ; Back to normal.
70
71local _sd _servicedir _xp       ; Declare local variables.
72
73COMMENT - C-Kermit version 6.0 or later required.
74;
75
76asg _xp \v(xprogram)
77if not def _xp asg _xp \v(program)
78if not equal "\m(_xp)" "C-Kermit" -
79  stop 1 \v(cmdfile): This initialization file is only for C-Kermit.
80echo Executing \v(cmdfile) for \v(system)...
81if < \v(version) 60000 -
82  stop 1 \v(cmdfile): C-Kermit 6.0 or later required.
83
84forward \v(system)              ; First do system-dependent items...
85
86:unknown                        ; Should not happen
87Stop 1 Error: System type unknown!
88
89:Aegis                          ; Apollo Aegis and
90:UNIX                           ; UNIX, all versions
91asg _myinit -
92  \v(home).mykermrc             ; Customization filename
93if remote forward COMMON        ; Skip local-mode items if "-R"
94asg _dialdir -
95  \v(home).kdd                  ; C-Kermit dialing directory
96asg _netdir -
97  \v(home).knd                  ; C-Kermit network directory
98asg _servicedir -
99  \v(home).ksd                  ; C-Kermit services directory
100forward COMMON                  ; End of UNIX section
101
102:OS9/68K                        ; OS-9
103asg _myinit -
104  \v(home).mykermrc             ; Customization filename
105if remote forward COMMON
106asg _dialdir -
107  \v(home).kdd                  ; C-Kermit dialing directory
108asg _netdir -
109  \v(home).knd                  ; C-Kermit network directory
110asg _servicedir -
111  \v(home).ksd                  ; C-Kermit services directory
112else set file display crt
113forward COMMON                  ; End of OS-9 section
114
115:VMS                            ; VMS and OpenVMS
116forward COMMON
117
118:OS/2                           ; Kermit 95
119:WIN32
120echo This initialization file is not for use with K95.
121forward COMMON                  ; End of OS/2 section
122
123:AOS/VS                         ; Data General AOS/VS
124set window 1                    ; Sliding windows don't work
125set file char dg-international  ; File character-set
126set xfer char latin1            ; Transfer character-set
127set file display crt            ; File transfer fisplay
128def cli push                    ; Escape to CLI
129def reset -                     ; Macro to reset DG DASHER terminal
130 run write [!ascii 236 306 301]
131forward COMMON                  ; End of AOS/VS section
132
133:Amiga                          ; Commodore Amiga
134def cls echo \27[H\27[2J        ; CLS command to clear the screen
135set file char latin1            ; Use Latin Alphabet 1 for file transfer
136set xfer char latin1            ; ...
137forward COMMON                  ; End of Amiga section
138
139:Atari_ST                       ; Atari ST
140def cls echo \27H\27J           ; Clear screen a`la VT52
141set server display on           ; Show file xfer display in server mode too
142set server timeout 15           ; Nonzero required for ^C interruption!
143forward COMMON                  ; End of Atari ST section
144
145:Macintosh                      ; Apple Macintosh
146set server display on           ; Show file xfer display in server mode too.
147forward COMMON
148
149:Stratus_VOS                    ; Stratus VOS
150asg _myinit \v(home)ckermod.ini
151if remote forward COMMON
152asg _dialdir \v(home)ckermit.kdd
153asg _netdir \v(home)ckermit.knd
154asg _servicedir \v(home)ckermit.ksd
155forward COMMON                  ; End of Stratus VOS section
156
157:COMMON                         ; For all systems
158
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
162; for those systems.
163;
164if not = 0 \findex(\v(system),WIN32:OS/2:Macintosh:Amiga:Atari_ST) -
165  forward files
166
167; VTPRINT macro.  Print a file on your PC's local printer.
168
169def 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
172
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:
176
177:FILES
178
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.
181;
182if def \$(CKERMOD) assign _myinit \$(CKERMOD)
183if not def _myinit assign _myinit \v(home)CKERMOD.INI
184
185if remote forward CUSTOM ; Skip all this if -R given on command line
186
187if def \$(K_NET_DIRECTORY) assign _netdir \$(K_NET_DIRECTORY)
188if not def _netdir assign _netdir \v(home)CKERMIT.KND
189
190if def \$(K_DIAL_DIRECTORY) assign _dialdir \$(K_DIAL_DIRECTORY)
191if not def _dialdir assign _dialdir \v(home)CKERMIT.KDD
192
193CHECK DIAL                      ; Is there a DIAL command?
194xif fail {                      ; No.
195    echo DIAL disabled
196    forward CUSTOM
197}
198
199CHECK NETWORK
200xif success {
201    xif exist \m(_netdir) {
202        set net directory \m(_netdir)
203        echo { Network directory is \m(_netdir) }
204    }
205}
206
207if eq "\v(name)" "telnet" forward CUSTOM
208
209xif exist \m(_dialdir) {
210    set dial directory \m(_dialdir)
211    echo { Dial directory is \m(_dialdir) }
212}
213
214COMMENT - Services directory
215
216if def \$(K_SERVICE_DIRECTORY) assign _servicedir \$(K_SERVICE_DIRECTORY)
217if not def _servicedir assign _servicedir \v(home)CKERMIT.KSD
218
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.
221
222if not exist \m(_servicedir) forward custom
223
224echo { Services directory is \m(_servicedir)}
225
226def MAX_SVCS 200               ; Adjust this if you have more entries
227define _sd 0                   ; Assume no services directory
228open read \m(_servicedir)      ; Try to open services directory file
229xif success {
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
232        read \&d[\%i]
233        if fail break
234    }
235    close read
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.}
241    } else {
242        asg \&d[0] \feval(\%i - 1)
243        define _sd 1
244    }
245}
246
247xif not \m(_sd) {
248    def access echo { Services directory not available.}
249    asg list \m(access)
250} else {
251    def FIND {
252        set case off
253        for \%i 1 \&d[0] 1 {
254            if eq {\%1} {\fsubstr(\&d[\%i],1,\flen(\%1))} break
255        }
256        if not > \%i \&d[0] return \&d[\%i]
257    }
258    def LIST {
259        xif > \v(argc) 1 {
260            find \%1
261            if def \v(return) echo \v(return)
262            else echo \%1: Not found
263        } else {
264            echo \&d[0] items in services directory:
265            for \%i 1 \&d[0] 1 { echo \fcont(\&d[\%i]) }
266        }
267    }
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
271        if fail end 1
272        split \%3                ; Get words from \%3
273        asg \%3 \m(_word1)
274        asg \%2 \m(_word2)
275        do \%3 \%4 {\%1} \%2     ; Login macro, userid, password, prompt
276    }
277    def ACCESS {
278        if not defined \%1 end 1 access what?        ; Check service
279        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 {
284            echo
285            echo ACCESS: Login succeeded - CONNECTing...
286            show escape
287            output \13
288            connect /quietly
289        }
290    }
291}
292
293:CONNECTION ; Macros for making connections
294
295COMMENT - SERIAL macro.  Arguments:
296; \%1 = device name
297; \%2 = speed
298;
299def SERIAL {
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.
308}
309
310COMMENT - NET macro.  Arguments:
311; \%1 = network type
312; \%2 = host name or address
313;
314def NET {
315    if < \v(argc) 3 end 1 Usage: NET network host
316    set network type \%1
317    if fail end 1 unsupported network: \%1
318    set login user                ; Don't send user ID.
319    set host \%2
320    if fail end 1 Can't reach host: \%2
321    echo Connection successful.
322}
323
324COMMENT - CALL macro.  Arguments:
325;
326; \%1 = modem type
327; \%2 = device name
328; \%3 = speed
329; \%4 = phone number
330;
331def CALL {
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
335        set modem \%1
336        if fail end 1 unknown modem type: \%1
337    }
338    xif not equal {\v(line)} {\%2} { ; Communication device
339        set line \%2
340        if fail end 1 can't open device: \%2
341    }
342    xif not equal {\v(speed)} {\%3} { ; Communication speed
343        set speed \%3
344        if fail end 1 unsupported speed: \%3
345    }
346    dial \%4                  ; Dial the number
347    if fail end 1 Can't place call: \%4
348    end 0 Connection successful.
349}
350
351COMMENT - TCPCALL macro.  Arguments:
352;
353; \%1 = server name:port
354; \%2 = modem type
355; \%3 = phone number
356;
357def TCPCALL {
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.
369}
370
371COMMENT - SPRINT macro.  Arguments:
372; \%1 = Service name or address
373;
374def SPRINT {
375    if < \v(argc) 2 end 1 Usage: \%0 service
376    set input timeout proceed
377    output @D\13
378    input 10 TERMINAL=
379    if fail end 1 No terminal prompt
380    out D1\13
381    inp 10 @
382    if fail end 1 No atsign prompt
383    output c \%1\13
384    input 10 CONNECTED
385    if fail end 1 Can't access \%1 from SprintNet
386}
387
388COMMENT - ULOGIN macro.  For logging into systems where user ID is required
389; but there is no password.  Arguments:
390; \%1 = UNIX user ID
391;
392define ULOGIN {
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
398    end 0
399}
400
401COMMENT - VMSLOGIN macro.  Arguments:
402; \%1 = VMS user ID
403; \%2 = Password.  If password not supplied, it is prompted for.
404; \%3 = System prompt.  If omitted a default is supplied.
405;
406define VMSLOGIN {
407    if < \v(argc) 2 end 1 Usage: \%0 userid [ password [ prompt ] ]
408    while not defined \%2 {
409        askq \%2 { \%1's password: }
410    }
411    set parity none               ; Set communication parameters
412    set duplex full
413    set handshake none
414    set input timeout proceed     ; Handle timeouts ourselves
415    in 5 Username:                ; Is prompt already there?
416    xif fail {                    ; No.
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
421        }
422        if > \%i 3 end 1 No Username prompt
423    }
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
427    pause                         ; Wait a sec
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
436        }
437        set input echo on         ; Echo input again
438    }
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.
445    if fail end 1
446}
447
448COMMENT - UNIXLOGIN macro.  Arguments:
449; \%1 = UNIX user ID
450; \%2 = Password.  If password not supplied, it is prompted for.
451; \%3 = System prompt.  If omitted a default is supplied.
452;
453define UNIXLOGIN {
454    local \%m \%i
455    if < \v(argc) 2 -
456      end 1 Usage: \%0 userid [ password [ prompt ] ]
457    while not defined \%2 {
458        askq \%2 { \%1's password: }
459    }
460    set input echo on
461    set parity none               ; Set communication parameters.
462    set duplex full
463    set handshake none
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
467    for \%i 1 5 1 {
468        minput \%m login: {ssword:} {Password for \%1:}
469        if success break
470        output \B\13
471        \%m ::= 6-\%1
472    }
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}
478    }
479    pause                         ; Wait a sec
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.
487    if fail end 1
488}
489
490COMMENT - VMLINELOGIN macro.  Arguments:
491; \%1 = User ID
492; \%2 = Password
493;
494define VMLINELOGIN {
495    if < \v(argc) 2 -
496      end 1 Usage: \%0 userid [ password ]
497    while not defined \%2 {
498        askq \%2 { \%1's password: }
499    }
500    set parity mark               ; Set communication parameters
501    set flow none
502    set handshake xon
503    set duplex half
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
512    end 0
513}
514
515COMMENT - VMFULLOGIN macro.  Arguments:
516; \%1 = User ID
517; \%2 = Password
518;
519define VMFULLOGIN {
520    if < \v(argc) 2 -
521      end 1 Usage: \%0 userid [ password ]
522    while not defined \%2 {
523        askq \%2 { \%1's password: }
524    }
525    set input timeout quit      ; Quit if INPUT fails
526    set parity even             ; Set communication parameters
527    set duplex full
528    set handshake none
529    set flow xon/xoff
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
537    end 0
538}
539
540COMMENT - CISLOGIN macro.  Arguments:
541; \%1 = CompuServe User ID
542; \%2 = Password
543; \%3 = Prompt
544;
545define CISLOGIN {
546    if < \v(argc) 2 -
547      end 1 Usage: \%0 userid [ password [ prompt ] ]
548    while not defined \%2 {
549        askq \%2 { \%1's password: }
550    }
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}
562    input 30 \%3
563    end 0
564}
565
566COMMENT - DOWLOGIN macro.  Arguments:
567; \%1 = Dow Jones Password
568;
569define DOWLOGIN {
570    while not defined \%1 {              ; Get password
571        askq \%1 { Dow Jones password: }
572    }
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
583    pause 1
584}
585
586COMMENT - DJNRSPRINT macro: Log in to Dow Jones via SprintNet.
587;
588def djnrsprint sprint dow, if success dowlogin
589
590COMMENT - NOLOGIN macro.  Does nothing.  Use when login not required.
591;
592def nologin comment
593
594:CUSTOM ; Customization file
595
596; In VMS and OpenVMS, allow for system-wide site customizations
597
598xif equal "\v(system)" "VMS" {
599    xif exist CKERMIT_INI:CKERMIT.SYS {
600        echo Executing CKERMIT_INI:CKERMIT.SYS
601        take CKERMIT_INI:CKERMIT.SYS
602    }
603}
604
605; Execute user's personal customization file
606
607xif exist \m(_myinit)  {                ; If it exists,
608    echo Executing \m(_myinit)...       ; print message,
609    take \m(_myinit)                    ; and TAKE the file.
610}
611
612; Finish up with traditional greeting.
613
614if < \v(ntime) 43200 echo Good Morning!
615  else if < \v(ntime) 61200 echo Good Afternoon!
616  else echo Good Evening.
617
618End ; of C-Kermit 7.0 initialization file.
Note: See TracBrowser for help on using the repository browser.