home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc192.zip / CKERMIT.INI < prev    next >
Text File  |  1996-12-03  |  26KB  |  704 lines

  1. COMMENT - Standard C-Kermit initialization file
  2. ;
  3. ; For C-Kermit Version: 6.0.192
  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. ; Version 5A(188): 23 November 1992
  17. ; Version 5A(189): 29 June 1993
  18. ; Version 5A(190): 04 October 1994
  19. ; Version 5A(191): 17 April 1995
  20. ; Version 6.0.192:  6 September 1996
  21. ;
  22. ; This is the standard and recommended C-Kermit 6.0 initialization file.  To
  23. ; override settings or definitions made in this file, to add new settings or
  24. ; definitions, or to make any other desired customizations, create a separate,
  25. ; personal customization file called:
  26. ;
  27. ;   .mykermrc     (UNIX, OS-9, Aegis, BeBox, Plan 9)
  28. ;   CKERMOD.INI   (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga)
  29. ;   ckermod.ini   (VOS)
  30. ;
  31. ; You can also define the customization filename in an environment
  32. ; variable (logical name in VMS), CKERMOD, which takes precedence over
  33. ; the names shown above.
  34. ;
  35. ; WHAT THIS FILE DOES:
  36. ;
  37. ; . The FULLSCREEN file transfer display is selected if it is available
  38. ; . Defines your default dialing directory name:
  39. ;     .kdd for UNIX, OS-9 and Aegis; CKERMIT.KDD for other operating systems.
  40. ;        You can override this with the environment variable K_DIAL_DIRECTORY
  41. ; . Defines your default network directory name:
  42. ;     .knd for UNIX, OS-9 and Aegis; CKERMIT.KND for other operating systems.
  43. ;        You can override this with the environment variable K_NET_DIRECTORY
  44. ; . Defines your default services directory name:
  45. ;     .ksd for UNIX, OS-9 and Aegis; CKERMIT.KSD for other operating systems.
  46. ;        You can override this with environment variable K_SERVICE_DIRECTORY.
  47. ; . Defines your customization file name (name given above)
  48. ; . Performs system-dependent setups for UNIX, VMS, OS/2, etc.
  49. ; . Defines an EDIT macro to let you invoke a text editor from C-Kermit.
  50. ; . Defines TSEND, BSEND, TGET, BGET macros for text and binary file transfer.
  51. ; . Defines VTPRINT, PCGET, and PCSEND macros for use with MS-DOS Kermit, etc.
  52. ; . Opens your dialing directory if you have one.
  53. ; . Reads your services directory and defines ACCESS and LIST macros for it.
  54. ; . Executes your personal customization file, if you have one.
  55. ;
  56. ; C-Kermit 6.0 is documented in the book "Using C-Kermit", 2nd Edition,
  57. ; by Frank da Cruz and Christine M. Gianone, 1997, Digital Press /
  58. ; Butterworth-Heinemann, ISBN 1-55558-164-1.
  59.  
  60. ; Everything after this point depends on the script programming language.
  61. ; The CHECK command terminates this command file immediately if the script
  62. ; programming language (IF command) is not configured.
  63. ;
  64. set take error on        ; This makes CHECK quit if no script language.
  65. check if            ; Do we have an IF command?  If not, quit now.
  66. set take error off        ; Back to normal.
  67.  
  68. local _sd _servicedir
  69.  
  70. COMMENT - Greet and make sure C-Kermit version is 6.0 or higher.
  71. ;
  72. echo Executing \v(cmdfile) for \v(system)...
  73. if < \v(version) 600192 -
  74.   stop 1 \v(cmdfile): C-Kermit 6.0.192 or later required.
  75.  
  76. def _dedit            ; No default editor yet.
  77. forward \v(system)        ; First do system-dependent items...
  78.  
  79. :unknown            ; Should not happen
  80. Stop 1 Error: System type unknown!
  81.  
  82. :Aegis                ; Apollo Aegis and
  83. :UNIX                ; UNIX, all versions
  84. def _dedit vi            ; Default editor is VI
  85. asg _myinit -
  86.   \v(home).mykermrc        ; Customization filename
  87. if remote forward COMMON        ; Skip local-mode items if "-R"
  88. asg _dialdir -
  89.   \v(home).kdd            ; C-Kermit dialing directory
  90. asg _netdir -
  91.   \v(home).knd            ; C-Kermit network directory
  92. asg _servicedir -
  93.   \v(home).ksd            ; C-Kermit services directory
  94. check fullscreen        ; Do we have a fullscreen display?
  95. if success set file displ full  ; If so, use it.
  96. forward COMMON                  ; End of UNIX section
  97.  
  98. :OS9/68K            ; OS-9
  99. asg _myinit -
  100.   \v(home).mykermrc        ; Customization filename
  101. if remote forward COMMON
  102. asg _dialdir -
  103.   \v(home).kdd            ; C-Kermit dialing directory
  104. asg _netdir -
  105.   \v(home).knd            ; C-Kermit network directory
  106. asg _servicedir -
  107.   \v(home).ksd            ; C-Kermit services directory
  108. if eq "\$(TERM)" "vt100" -      ; File transfer display
  109.   set file display full         ; Only works with VT-100 terminal type
  110. else if eq "\$(TERM)" "VT100" -
  111.   set file display full
  112. else set file display crt
  113. forward COMMON            ; End of OS-9 section
  114.  
  115. :VMS                ; VMS and OpenVMS
  116. def _dedit edit            ; Default editor is EDIT.
  117. set file display fullscreen     ; File transfer fisplay
  118. forward COMMON
  119.  
  120. :OS/2                ; OS/2
  121. asg _inifile \v(cmdfile)    ; Get directory where this file is kept...
  122. asg _inidirlen \feval(\flength(\m(_inifile))-11)
  123. asg _inidir \fsubstr(\m(_inifile),1,\m(_inidirlen))
  124. asg _dialdir    \m(_inidir)CKERMIT.KDD
  125. asg _netdir     \m(_inidir)CKERMIT.KND
  126. asg _servicedir \m(_inidir)CKERMIT.KSD
  127. asg _myinit     \m(_inidir)CKERMOD.INI
  128. asg _inidirlen            ; Release unneeded variables
  129. set file display fullscreen     ; File transfer fisplay
  130. set server display on        ; Show display in server mode too.
  131. def _dedit epm            ; Default editor is E
  132. set command bytesize 8          ; Use 8 bits between Kermit and console.
  133. set xfer char latin1            ; Use Latin-1 for text file transfer.
  134. def cls clear command-screen    ; Define CLS command to clear the screen.
  135. def os2 push            ; Make OS2 a synonym for PUSH, RUN, etc.
  136. def more run type \%1 | more    ; Easy access to MORE command.
  137. def vdir run dir | more            ; "Verbose" DIRECTORY
  138. def tdir run dir /o-d | more    ; Reverse Time-Order DIRECTORY
  139.  
  140. COMMENT - XSEND macro sends a directory tree.  Read XSEND.CMD for details.
  141. ; Arguments:
  142. ; 1. Pathname, such as C:\\ (backslashes must be doubled!)
  143. ; 2. Filespec, such as *.*
  144. ;
  145. define XSEND rexx call \fcontents(\v(startup))xsend.cmd '\%1 \%2'
  146. forward COMMON                  ; End of OS/2 section
  147.  
  148. :AOS/VS                ; Data General AOS/VS
  149. def _dedit sed            ; Default editor is SED
  150. set window 1            ; Sliding windows don't work
  151. set file char dg-international    ; File character-set
  152. set xfer char latin1        ; Transfer character-set
  153. set file display crt            ; File transfer fisplay
  154. def cli push            ; Escape to CLI
  155. def reset -            ; Macro to reset DG DASHER terminal
  156.  run write [!ascii 236 306 301]
  157. forward COMMON                  ; End of AOS/VS section
  158.  
  159. :Amiga                ; Commodore Amiga
  160. def cls echo \27[H\27[2J    ; CLS command to clear the screen
  161. set file display full           ; Supports fullscreen display
  162. set file char latin1        ; Use Latin Alphabet 1 for file transfer
  163. set xfer char latin1        ; ...
  164. forward COMMON                  ; End of Amiga section
  165.  
  166. :Atari_ST            ; Atari ST
  167. def cls echo \27H\27J        ; Clear screen a`la VT52
  168. set file display crt        ; FULLSCREEN not available
  169. set server display on        ; Show file xfer display in server mode too
  170. set server timeout 15        ; Nonzero required for ^C interruption!
  171. forward COMMON                  ; End of Atari ST section
  172.  
  173. :Macintosh            ; Apple Macintosh
  174. set server display on        ; Show file xfer display in server mode too.
  175. forward COMMON
  176.  
  177. :Stratus_VOS                    ; Stratus VOS
  178. def _dedit emacs        ; Default editor is emacs
  179. asg _myinit \v(home)ckermod.ini
  180. if remote forward COMMON
  181. asg _dialdir \v(home)ckermit.kdd
  182. asg _netdir \v(home)ckermit.knd
  183. asg _servicedir \v(home)ckermit.ksd
  184. set file display crt        ; FULLSCREEN not available
  185. forward COMMON                  ; End of Stratus VOS section
  186.  
  187. :COMMON                ; For all systems
  188.  
  189. COMMENT - EDIT macro.
  190. ;
  191. ; EDITOR environment variable, if defined, takes precedence.
  192. ;
  193. check push            ; Only works if we have a PUSH command
  194. xif success {
  195.     if def \$(EDITOR) assign myeditor \$(EDITOR)
  196.       else assign myeditor \m(_dedit)
  197.     if not def myeditor def myeditor edit
  198.     undef _dedit
  199.     undef myfile
  200.     def EDIT {
  201.     if > \v(argc) 2 echo WARNING: \%2 \%3 \%4 \%5 \%6... ignored
  202.     if = \v(argc) 2 assign myfile \%1
  203.     if not def myfile echo Edit what?
  204.     else run \m(myeditor) \m(myfile)
  205.     }
  206. }
  207.  
  208. ; File transfer macros
  209.  
  210. def _SEND {                           ; Used by BSEND, TSEND, etc.
  211.     local \%n
  212.     asg \%n \ffiles(\%1)                ; How many files match argument
  213.     if = 0 \%n end 1 {\?File not found} ; None
  214.     if = 1 \%n send \%1 \%2             ; Single file with as-name
  215.     else send \%1                       ; or wildcard with no as-name
  216. }
  217.  
  218. def BSEND binary, _send \%1 \%2                     ; Send binary file(s)
  219. def TSEND text, _send \%1 \%2                     ; Send text file(s)
  220. def BGET remote set file type binary, -          ; Get binary file(s)
  221.   if success get \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 ;  from server
  222. def TGET remote set file type text, -            ; Get text file(s)
  223.   if success get \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 ;  from server
  224.  
  225. ; Define macros that are useful when running C-Kermit in remote mode.
  226. ; These macros serve no purpose on local-mode-only versions such as
  227. ; OS/2, Macintosh, Amiga, and Atari ST Kermit, so we skip defining them
  228. ; for those systems.
  229. ;
  230. if not = 0 \findex(\v(system),WIN32:OS/2:Macintosh:Amiga:Atari_ST) -
  231.   forward files
  232.  
  233. ; VTPRINT macro.  Print a file on your PC's local printer.
  234.  
  235. def VTPRINT echo \27[5i, type \%1, echo \27[4i
  236. ; or if your printer needs a formfeed to force the page out:
  237. ; def VTPRINT  def echo \27[5i, type \%1, echo \12\27[4i
  238.  
  239. ; Macros for host-initiated file transfer using APC:
  240. ;   NOT NEEDED ANY MORE because of autodownload/autoupload.
  241. ;   Remove the following FORWARD command to reinstate these definitions:
  242.  
  243. FORWARD FILES
  244.  
  245. COMMENT - PCGET macro, for use against MS-DOS Kermit 3.13 and later,
  246. ; or Kermit 95, or Kermit/2, or C-Kermit 5A(190) on UNIX or VMS.
  247. ; Uses APC.  Arguments:
  248. ; 1 = Name of file to get from PC.
  249. ; 2 = Optional name that C-Kermit should store it under.
  250. ; NOTE: If the PC filename contains backslashes, you must make four (4)
  251. ; copies of each backslash, e.g. "pcget c:\\\\temp\\\\oofa.txt.
  252. ;
  253. def PCGET {
  254.     apc server
  255.     msleep 200
  256.     remote set file type \v(ftype)
  257.     xif def \%2 {                    ; If we have an "as-name"
  258.         get, \%1, \%2                ; use multiline GET
  259.         asg _tmp \v(status)          ; Remember status
  260.     } else {                         ; Otherwise
  261.         get \%1                      ; use regular GET
  262.         asg _tmp \v(status)          ; Remember status
  263.     }
  264.     fin                              ; FINISH server
  265.     end \m(_tmp)                     ; and return status
  266. }
  267.  
  268. COMMENT - PCSEND macro, for use against MS-DOS Kermit 3.13 and later,
  269. ; or C-Kermit 5A(190) or later.  Uses APC.  Arguments:
  270. ; \%1 = Name of file to send to MS-DOS Kermit.
  271. ; \%2 = Optional name to send it with.
  272. ;
  273. def PCSEND {
  274.     local \%n
  275.     asg \%n \ffiles(\%1)
  276.     if = 0 \%n end 1 {\?File not found}
  277.     apc receive
  278.     if = 1 \%n send \%1 \%2             ; Single file with as-name
  279.     else send \%1                       ; or wildcard with no as-name
  280. }
  281.  
  282. :FILES
  283.  
  284. ; Get customization and directory file names.  Environment variables take
  285. ; precedence, so you do not have to edit this file to change these filenames.
  286. ;
  287. if def \$(CKERMOD) assign _myinit \$(CKERMOD)
  288. if not def _myinit assign _myinit \v(home)CKERMOD.INI
  289.  
  290. if remote forward CUSTOM ; Skip all this if -R given on command line
  291.  
  292. if def \$(K_DIAL_DIRECTORY) assign _dialdir \$(K_DIAL_DIRECTORY)
  293. if not def _dialdir assign _dialdir \v(home)CKERMIT.KDD
  294.  
  295. if def \$(K_NET_DIRECTORY) assign _dialdir \$(K_NET_DIRECTORY)
  296. if not def _dialdir assign _dialdir \v(home)CKERMIT.KND
  297.  
  298. if def \$(K_SERVICE_DIRECTORY) assign _servicedir \$(K_SERVICE_DIRECTORY)
  299. if not def _servicedir assign _servicedir \v(home)CKERMIT.KSD
  300.  
  301. CHECK DIAL            ; Is the DIAL command enabled?
  302. xif fail {             ; No.
  303.     echo DIAL disabled
  304. } else {            ; Yes, check for and open the dial directory.
  305.     xif exist \m(_dialdir) {
  306.         set dial directory \m(_dialdir)
  307.         echo { Dial directory is \m(_dialdir) }
  308.     }
  309.     xif exist \m(_netdir) {
  310.         set net directory \m(_netdir)
  311.         echo { Network directory is \m(_netdir) }
  312.     }
  313. }
  314.  
  315. COMMENT - Services directory
  316.  
  317. if not exist \m(_servicedir) forward connection
  318. echo { Services directory is \m(_servicedir)}
  319.  
  320. def MAX_SVCS 200               ; Adjust this if you have more entries
  321. define _sd 0                   ; Assume no services directory
  322. open read \m(_servicedir)      ; Try to open services directory file
  323. xif success {
  324.     declare \&d[\m(MAX_SVCS)]  ; It's open, declare directory array
  325.     for \%i 1 \m(MAX_SVCS) 1 { ; Read the lines into the array
  326.     read \&d[\%i]
  327.     if fail break
  328.     }
  329.     close read        
  330.     xif > \%i  \m(MAX_SVCS) {
  331.     echo Too many entries in services directory
  332.     echo { Maximum is \m(MAX_SVCS).}
  333.     echo { Change definition of MAX_SVCS in \v(cmdfile) to allow more. }
  334.     echo { Services directory disabled.}
  335.     } else {
  336.         asg \&d[0] \feval(\%i - 1)
  337.         define _sd 1
  338.     }
  339. }
  340.  
  341. xif not \m(_sd) {
  342.     def access echo { Services directory not available.}
  343.     asg list \m(access)
  344. } else {
  345.     def FIND {
  346.     set case off
  347.     for \%i 1 \&d[0] 1 {
  348.         if eq {\%1} {\fsubstr(\&d[\%i],1,\flen(\%1))} break
  349.     }
  350.     if not > \%i \&d[0] return \&d[\%i]
  351.     }
  352.     def LIST {
  353.     xif > \v(argc) 1 {
  354.         find \%1
  355.         if def \v(return) echo \v(return)
  356.         else echo \%1: Not found
  357.     } else {
  358.         echo \&d[0] items in services directory:
  359.         for \%i 1 \&d[0] 1 { echo \fcont(\&d[\%i]) }
  360.     }
  361.     }
  362.     def SPLIT asg _word1 \%1, asg _word2 \%2
  363.     def DOACCESS {               ; (Used internally by ACCESS macro)
  364.     do \%5 \%6 \%7 \%8 \%9   ; Do the connection macro
  365.     if fail end 1
  366.         split \%3                ; Get words from \%3
  367.     asg \%3 \m(_word1)
  368.     asg \%2 \m(_word2)
  369.     do \%3 \%4 {\%1} \%2     ; Login macro, userid, password, prompt
  370.     }
  371.     def ACCESS {
  372.     if not defined \%1 end 1 access what?        ; Check service
  373.     find \%1                                     ; Look it up
  374.     if success doaccess {\%2} \v(return)         ; OK, try it
  375.     else end 1 "\%1" not in services directory   ; Not found
  376.     if fail end 1                                ; DOACCESS failed?
  377.     xif eq \v(cmdlevel) 1 {
  378.         echo
  379.         echo ACCESS: Login succeeded - CONNECTing...
  380.             show escape
  381.             output \13
  382.         connect /quietly
  383.         }
  384.     }
  385. }
  386.  
  387. :CONNECTION ; Macros for making connections
  388.  
  389. COMMENT - SERIAL macro.  Arguments:
  390. ; \%1 = device name
  391. ; \%2 = speed
  392. ;
  393. def SERIAL {
  394.     if < \v(argc) 3                         ; All arguments given?
  395.       end 1 Usage: SERIAL device speed      ; No.
  396.     set line \%1                            ; OK, try to SET LINE.
  397.     if failure -                            ; If this failed,
  398.       end 1 Can't open device: \%1          ; print message and quit.
  399.     set speed \%2                           ; Try to set the speed.
  400.     if fail end 1 Unsupported speed: \%2    ; Failed.
  401.     echo Connection successful.             ; Succeeded.
  402. }
  403.  
  404. COMMENT - NET macro.  Arguments:
  405. ; \%1 = network type
  406. ; \%2 = host name or address
  407. ;
  408. def NET {
  409.     if < \v(argc) 3 end 1 Usage: NET network host
  410.     set network \%1
  411.     if fail end 1 unsupported network: \%1
  412.     set host \%2
  413.     if fail end 1 can't reach host: \%2
  414.     echo Connection successful.
  415. }
  416.  
  417. COMMENT - CALL macro.  Arguments:
  418. ;
  419. ; \%1 = modem type
  420. ; \%2 = device name
  421. ; \%3 = speed
  422. ; \%4 = phone number
  423. ;
  424. def CALL {
  425.     if < \v(argc) 5 -         ; All arguments present?
  426.       end 1 Usage: CALL modem device speed number
  427.     set modem \%1             ; Set modem type
  428.     if fail end 1 unknown modem type: \%1
  429.     set line \%2              ; Communication device
  430.     if fail end 1 can't open device: \%2
  431.     set speed \%3             ; Communication speed
  432.     if fail end 1 unsupported speed: \%3
  433.     dial \%4                  ; Dial the number
  434.     if fail end 1 Can't place call: \%4
  435.     end 0 Connection successful.
  436. }
  437.  
  438. COMMENT - TCPCALL macro.  Arguments:
  439. ;
  440. ; \%1 = server name:port
  441. ; \%2 = modem type
  442. ; \%3 = phone number
  443. ;
  444. def TCPCALL {
  445.     if < \v(argc) 4 -         ; All arguments present?
  446.       end 1 Usage: TCPCALL server[:port] modem number
  447.     set net tcp/ip            ; Which network to use
  448.     if fail end 1 unsupported network: tcp/ip
  449.     set host \%1              ; Access server and port
  450.     if fail end 1 can't access server \%1
  451.     set modem \%2             ; Set modem type
  452.     if fail end 1 unknown modem type: \%2
  453.     dial \%3                  ; Dial the number
  454.     if fail end 1 Can't place call: \%3
  455.     end 0 Connection successful.
  456. }
  457.  
  458. COMMENT - SPRINT macro.  Arguments:
  459. ; \%1 = Service name or address
  460. ;
  461. def SPRINT {
  462.     if < \v(argc) 2 end 1 Usage: \%0 service
  463.     set input timeout proceed
  464.     output @D\13
  465.     input 10 TERMINAL=
  466.     if fail end 1 No terminal prompt
  467.     out D1\13
  468.     inp 10 @
  469.     if fail end 1 No atsign prompt
  470.     output c \%1\13
  471.     input 10 CONNECTED
  472.     if fail end 1 Can't access \%1 from SprintNet
  473. }
  474.  
  475. COMMENT - ULOGIN macro.  For logging into systems where user ID is required
  476. ; but there is no password.  Arguments:
  477. ; \%1 = UNIX user ID
  478. ;
  479. define ULOGIN {
  480.     if < \v(argc) 2 end 1 Usage: \%0 userid
  481.     set input timeout proceed     ; Handle timeouts ourselves
  482.     set case on                   ; Case is important in UNIX
  483.     minput 5 login: Username: {User ID:} {User Name:}
  484.     out \%1\13                    ; Send username, carriage return
  485.     end 0
  486. }
  487.  
  488. COMMENT - VMSLOGIN macro.  Arguments:
  489. ; \%1 = VMS user ID
  490. ; \%2 = Password.  If password not supplied, it is prompted for.
  491. ; \%3 = System prompt.  If omitted a default is supplied.
  492. ;
  493. define VMSLOGIN {
  494.     if < \v(argc) 2 end 1 Usage: \%0 userid [ password [ prompt ] ]
  495.     while not defined \%2 {
  496.         askq \%2 { \%1's password: }
  497.     }
  498.     set parity none               ; Set communication parameters
  499.     set duplex full
  500.     set handshake none
  501.     set input timeout proceed     ; Handle timeouts ourselves
  502.     in 5 Username:                ; Is prompt already there?
  503.     xif fail {                    ; No.
  504.         for \%i 1 3 1 {           ; Try 3 times to get it.
  505.             out \13               ; Send carriage return
  506.             in 5 Username:        ; Look for prompt
  507.             if success break      ; Success, go log in
  508.         }
  509.         if > \%i 3 end 1 No Username prompt
  510.     }
  511.     out \%1\13                    ; Send username, carriage return
  512.     inp 5 Password:               ; Wait 5 sec for this prompt
  513.     if fail end 1 No password prompt
  514.     pause                         ; Wait a sec
  515.     out \%2\13                    ; Send password
  516.     xif not emulation {           ; No emulator built in?
  517.         set input echo off        ; Protect terminal from this
  518.         minput 10 {\27Z} {\27[c} {\27[0c} ; Get terminal ID query
  519.         xif success {                     ; Got one
  520.             output \27[\?1c               ; Send VT100 terminal ID
  521.             in 2 \27[6n                   ; Screen dimension query?
  522.             if succ out \27[\v(rows);\v(cols)R ; Send dimensions
  523.         }
  524.         set input echo on         ; Echo input again
  525.     }
  526.     if not def \%3 -              ; If we were not given a prompt
  527.       asg \%3 {\v(prompt)}        ; use the SET LOGIN PROMPT value
  528.     if not def \%3 -              ; If we still don't have a prompt
  529.       asg \%3 {\13$\32}           ; use this one as the default
  530.     reinp 0 \%3                   ; Did we INPUT the prompt already?
  531.     if fail inp 60 \%3            ; No, look now.
  532.     if fail end 1
  533. }
  534.  
  535. COMMENT - UNIXLOGIN macro.  Arguments:
  536. ; \%1 = UNIX user ID
  537. ; \%2 = Password.  If password not supplied, it is prompted for.
  538. ; \%3 = System prompt.  If omitted a default is supplied.
  539. ;
  540. define UNIXLOGIN {
  541.     if < \v(argc) 2 -
  542.       end 1 Usage: \%0 userid [ password [ prompt ] ]
  543.     while not defined \%2 {
  544.         askq \%2 { \%1's password: }
  545.     }
  546.     set parity none               ; Set communication parameters
  547.     set duplex full
  548.     set handshake none
  549.     set input timeout proceed     ; Handle timeouts ourselves
  550.     set case on                   ; Case is important in UNIX
  551.     in 5 login:                   ; Is prompt already there?
  552.     xif fail {                    ; No.
  553.         for \%i 1 3 1 {           ; Try 3 times to get it.
  554.             out \B\13             ; Send BREAK and CR
  555.             in 5 login:           ; Look for prompt
  556.             if success break      ; Success, go log in
  557.         }
  558.         if > \%i 3 end 1 No login prompt
  559.     }
  560.     out \%1\13                    ; Send username, carriage return
  561.     inp 5 Password:               ; Wait 5 sec for this prompt
  562.     if fail end 1 No password prompt
  563.     pause                         ; Wait a sec
  564.     out \%2\13                    ; Send password
  565.     if not def \%3 -              ; If we were not given a prompt
  566.       asg \%3 {\v(prompt)}        ; use the SET LOGIN PROMPT value
  567.     if not def \%3 -              ; If we still don't have a prompt
  568.       asg \%3 {\10$ }             ; use this one as the default
  569.     reinp 0 \%3                   ; Did we INPUT the prompt already?
  570.     if fail inp 60 \%3            ; No, look now.
  571.     if fail end 1
  572. }
  573.  
  574. COMMENT - VMLINELOGIN macro.  Arguments:
  575. ; \%1 = User ID
  576. ; \%2 = Password
  577. ;
  578. define VMLINELOGIN {
  579.     if < \v(argc) 2 -
  580.       end 1 Usage: \%0 userid [ password ]
  581.     while not defined \%2 {
  582.         askq \%2 { \%1's password: }
  583.     }
  584.     set parity mark               ; Set communication parameters
  585.     set flow none
  586.     set handshake xon
  587.     set duplex half
  588.     set input timeout quit        ; Don't bother with IF FAILURE
  589.     input 10 BREAK KEY            ; Look for BREAK KEY prompt
  590.     pause 1                       ; Wait a second
  591.     output \B                     ; Send BREAK
  592.     input 10 .\17, output logon \%1\13    ; Now log in
  593.     input 10 .\17, output \%2\13          ; Send password
  594.     input 10 .\17, output \13             ; Send carriage return
  595.     input 10 .\17, output \13             ; Send another one
  596.     end 0
  597. }
  598.  
  599. COMMENT - VMFULLOGIN macro.  Arguments:
  600. ; \%1 = User ID
  601. ; \%2 = Password
  602. ;
  603. define VMFULLOGIN {
  604.     if < \v(argc) 2 -
  605.       end 1 Usage: \%0 userid [ password ]
  606.     while not defined \%2 {
  607.         askq \%2 { \%1's password: }
  608.     }
  609.     set input timeout quit      ; Quit if INPUT fails
  610.     set parity even             ; Set communication parameters
  611.     set duplex full
  612.     set handshake none
  613.     set flow xon/xoff
  614.     out \13                     ; Send carriage return
  615.     inp 5 TERMINAL TYPE:        ; Get terminal-type prompt
  616.     out vt-100\13               ; Just send "vt-100"
  617.     inp 20 RUNNING              ; Get RUNNING message
  618.     pau 1                       ; Wait one second
  619.     out \%1\9\%2\13             ; Send user ID, tab, password
  620.     out \13\13                  ; Two more carriage returns
  621.     end 0
  622. }
  623.  
  624. COMMENT - CISLOGIN macro.  Arguments:
  625. ; \%1 = CompuServe User ID
  626. ; \%2 = Password
  627. ; \%3 = Prompt
  628. ;
  629. define CISLOGIN {
  630.     if < \v(argc) 2 -
  631.       end 1 Usage: \%0 userid [ password [ prompt ] ]
  632.     while not defined \%2 {
  633.         askq \%2 { \%1's password: }
  634.     }
  635.     set terminal byteszie 7     ; No 8-bit characters
  636.     set input timeout quit      ; Skip the IF FAILURE's
  637.     output \13                  ; Send initial carriage return
  638.     input 5 Host Name:          ; Look for Host Name prompt
  639.     output cis\13               ; Send "cis" and carriage return
  640.     input 5 User ID:            ; Look for User ID prompt
  641.     output \%1\13               ; Send ID and carriage return
  642.     input Password:             ; Look for Password prompt
  643.     output \%2\13               ; Send password and CR
  644.     if not def \%3 asg \%3 \v(prompt)
  645.     if not def \%3 asg \%3 {CompuServe Information Service}
  646.     input 30 \%3
  647.     end 0
  648. }
  649.  
  650. COMMENT - DOWLOGIN macro.  Arguments:
  651. ; \%1 = Dow Jones Password
  652. ;
  653. define DOWLOGIN {
  654.     while not defined \%1 {              ; Get password
  655.         askq \%1 { Dow Jones password: }
  656.     }
  657.     set input timeout proceed
  658.     input 20 SERVICE PLEASE\?\?\?\?      ; Look for Dow prompt
  659.     if fail end 1 No service prompt
  660.     out djnr\13                          ; Select DJNR
  661.     input 10 @@@@@@@@                        ; Get password prompt
  662.     if fail end 1 No password prompt
  663.     pause 1                              ; Wait a second, then...
  664.     output \%1\13                        ; send password and CR
  665.     input 30 ENTER QUERY                 ; Get DJNR query prompt
  666.     if fail end 1 No main query prompt
  667.     pause 1
  668. }
  669.  
  670. COMMENT - DJNRSPRINT macro: Log in to Dow Jones via SprintNet.
  671. ;
  672. def djnrsprint sprint dow, if success dowlogin
  673.  
  674. COMMENT - NOLOGIN macro.  Does nothing.  Use when login not required.
  675. ;
  676. def nologin comment
  677.  
  678. :CUSTOM ; Customization file
  679.  
  680.  
  681. ; In VMS and OpenVMS, allow for system-wide site customizations
  682.  
  683. xif equal "\v(system)" "VMS" {
  684.     xif exist CKERMIT_INI:CKERMIT.SYS {
  685.     echo Executing CKERMIT_INI:CKERMIT.SYS
  686.     take CKERMIT_INI:CKERMIT.SYS
  687.     }
  688. }
  689.  
  690. ; Execute user's personal customization file
  691.  
  692. xif exist \m(_myinit)  {        ; If it exists,
  693.     echo Executing \m(_myinit)...    ; print message,
  694.     take \m(_myinit)            ; and TAKE the file.
  695. }
  696.  
  697. ; Finish up with traditional greeting.
  698.  
  699. if < \v(ntime) 43200 echo Good Morning!
  700.   else if < \v(ntime) 61200 echo Good Afternoon!
  701.   else echo Good Evening.
  702.  
  703. End ; of C-Kermit 6.0 initialization file.
  704.