home *** CD-ROM | disk | FTP | other *** search
- COMMENT - Standard C-Kermit initialization file
- ;
- ; For C-Kermit Version: 5A(188)
- ;
- ; Filename:
- ; .kermrc (UNIX, OS-9)
- ; CKERMIT.INI (OS/2, VMS, OpenVMS, AOS/VS, Atari ST, Commodore Amiga)
- ;
- ; Authors:
- ; Frank da Cruz, Christine M. Gianone
- ; Columbia University, New York, NY, USA
- ;
- ; Date: 23 November 1992
- ; Last update: Thu Nov 26 11:15:44 1992: OS-9 changes and other fixes
- ;
- ; 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)
- ; 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 and OS-9, CKERMIT.KDD for other operating systems.
- ; You can override this with the environment variable CKDDIR.
- ; . Defines your default services directory name:
- ; .ksd for UNIX and OS-9, 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, Digital Press, Burlington, MA, USA. Digital
- ; Press ISBN: 1-55558-108-0; Prentice-Hall ISBN: 0-13-037490-3. Price: US
- ; $34.95. Available: Winter 1992.
-
- ; 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.
-
- define _dedit ; No default editor yet.
- goto \v(system) ; First do system-dependent items...
-
- :unknown ; Should not happen
- Stop 1 Error: System type unknown!
-
- :UNIX ; UNIX, all versions
- assign _dialdir -
- \v(home).kdd ; C-Kermit dialing directory
- assign _servicedir -
- \v(home).ksd ; C-Kermit services directory
- assign _myinit -
- \v(home).mykermrc ; Customization filename
- check fullscreen ; Do we have a fullscreen display?
- if success set file displ full ; If so, use it.
- define _dedit vi ; Default editor is VI
- goto common ; End of UNIX section
-
- :OS9/68K ; OS-9
- assign _dialdir -
- \v(home).kdd ; C-Kermit dialing directory
- assign _servicedir -
- \v(home).ksd ; C-Kermit services directory
- assign _myinit -
- \v(home).mykermrc ; Customization filename
- 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
- goto common ; End of OS-9 section
-
- :VMS ; VMS and OpenVMS
- define _dedit edit ; Default editor is EDIT.
- set file display fullscreen ; File transfer fisplay
- goto common
-
- :OS/2 ; OS/2
- define _dialdir C:/CKERMIT/CKERMIT.KDD
- define _servicedir C:/CKERMIT/CKERMIT.KSD
- define _myinit C:/CKERMIT/CKERMOD.INI
- set file display fullscreen ; File transfer fisplay
- set server display on ; Show display in server mode too.
- define _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.
- define cls echo \27[H\27[2J ; Define CLS command to clear the screen.
- define os2 push ; Make OS2 a synonym for PUSH, RUN, etc.
- define more run more < \%1 ; Easy access to MORE command.
- define vdir run dir | more ; "Verbose" DIRECTORY
- define tdir run dir /o-d | more ; Reverse Time-Order DIRECTORY
- goto common ; End of OS/2 section
-
- :AOS/VS ; Data General AOS/VS
- define _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
- define cli push ; Escape to CLI
- define reset - ; Macro to reset DG DASHER terminal
- run write [!ascii 236 306 301]
- goto common ; End of AOS/VS section
-
- :Amiga ; Commodore Amiga
- define 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 ; ...
- goto common ; End of Amiga section
-
- :Atari_ST ; Atari ST
- define 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!
- goto common ; End of Atari ST section
-
- :Macintosh ; Apple Macintosh
- set server display on ; Show file xfer display in server mode too.
-
- :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 - Macros to send and get binary and text files.
- ;
- define bsend set file type binary, send \%1 \%2 ; Send binary file(s)
- define tsend set file type text, send \%1 \%2 ; Send text file(s)
- define bget remote set file type binary, - ; Get binary file(s)
- if success get \%1 \%2 ; from server
- define tget remote set file type text, - ; Get text file(s)
- if success get \%1 ; from server
-
- COMMENT - EDIT macro.
- ;
- ; EDITOR environment variable, if defined, takes precedence.
- ;
- check push ; Only works if we have a PUSH command
- if fail goto 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
- define _dedit
- define myfile
-
- define 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 = 0 \findex(\v(system),OS/2:Macintosh:Amiga:Atari_ST) goto files
-
- COMMENT - VTPRINT macro. Print a file on your PC's local printer.
- ;
- define vtprint echo \27[5i, type \%1, echo \27[4i
-
- COMMENT - PCGET macro, for use with MS-DOS Kermit. Argument:
- ; 1 = Name of file to get from MS-DOS Kermit.
- ; Requires MS-DOS Kermit macro TERMINALS defined as "server, connect".
- ;
- define pcget echo \27[\?34h, get \%1, finish
-
- COMMENT - PCSEND macro, for use with MS-DOS Kermit. Arguments:
- ; \%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".
- ;
- define 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
-
- :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 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) goto 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 goto 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.}
- goto 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)
- ;
- define 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
- ;
- define 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
- ;
- define 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
- ;
- define 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
- ;
- define SPRINT -
- if < \v(argc) 2 end 1 Usage: \%0 service,-
- set input timeout proceed,-
- output \13\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.
- ;
- define VMSLOGIN if < \v(argc) 2 end 1 Usage: VMSLOGIN userid password,-
- while not defined \%2 { -
- askq \%2 { \%1's password: } -
- },-
- set parity none,-
- set duplex full,-
- set handshake none,-
- set flow xon/xoff,-
- define 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,-
- inp 10 \27Z,-
- if success output \27[\?1c,-
- set inp ech on,-
- inp 60 {\13\10$ },- ; CHANGE THIS IF NECESSARY!
- if fail end 1 No system prompt,-
- echo Login successful.
-
- COMMENT - UNIXLOGIN macro. Arguments:
- ; \%1 = user ID
- ; \%2 = password
- ;
- define UNIXLOGIN if < \v(argc) 2 end 1 Usage: \%0 userid password,-
- while not defined \%2 { -
- askq \%2 { \%1's password: } -
- },-
- set parity none,-
- set duplex full,-
- set handshake none,-
- set flow xon/xoff,-
- set case on,-
- out \13,-
- define 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,-
- inp 60 {\13\10$ },- ; CHANGE THIS IF NECESSARY!
- if fail end 1 No system prompt,-
- echo Login successful.
-
- COMMENT - VMLINELOGIN macro. Arguments:
- ; \%1 = User ID
- ; \%2 = Password
- ;
- define VMLINELOGIN -
- if < \v(argc) 2 end 1 Usage: \%0 userid password,-
- while not defined \%2 { -
- askq \%2 { \%1's password: } -
- },-
- set parity mark,-
- set 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,-
- 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
- ;
- define VMFULLOGIN -
- if < \v(argc) 2 end 1 Usage: \%0 userid password,-
- while not defined \%2 { -
- askq \%2 { \%1's password: } -
- },-
- set input timeout quit,-
- 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
- ;
- define CISLOGIN -
- if < \v(argc) 2 end 1 Usage: \%0 userid password,-
- while not defined \%2 { -
- askq \%2 { \%1's password: } -
- },-
- set input timeout quit,-
- output \13,-
- input 5 Host Name:,-
- output cis\13,-
- input 5 User ID:,-
- output \%2\13,-
- input Password:,-
- output \%3\13,-
- input 20 Enter Choice!,-
- set input timeout proceed,-
- echo Login successful.
-
- COMMENT - DOWLOGIN macro for Dow Jones News/Retrieval. Arguments:
- ; \%1 = Dow Jones Password
- ;
- define DOWLOGIN -
- while not defined \%1 { -
- askq \%1 { Dow Jones password: } -
- },-
- define 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,-
- input 20 ENTER QUERY,-
- if fail end 1 No main query prompt,-
- pause 1@,-
- echo Login successful.
-
- COMMENT - DJNRSPRINT macro: Log in to Dow Jones via SprintNet.
- ;
- define djnrsprint sprint dow, dowlogin
-
- COMMENT - NOLOGIN macro. Does nothing. Use when login not required.
- ;
- define nologin comment
-
- COMMENT - LOOKUP macro. Argument:
- ; \%1 = Service name to look for in services directory
- ;
- define 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
-
- define DOACCESS - ; (Used internally by ACCESS macro)
- asg \%1 \fsubstr(\%1,2),- ; Trim password argument
- do \%5 \%6 \%7 \%8 \%9,- ; Do the connection macro
- if success do \%3 \%4 \%1 ; Do the login macro
-
- ; ACCESS macro. Arguments:
- ; \%1 = service name
- ; \%2 = password (optional)
- ;
- define 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?
-
- goto endservices ; Skip around NOSERVICES definitions.
-
- :NOSERVICES
- define access echo { Services directory not available.}
- assign list \m(access)
-
- :ENDSERVICES
-
- COMMENT - In VMS and OpenVMS, allow for system-wide site customizations
- ;
- if not equal "\v(system)" "VMS" goto 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.
-