; FILE MSKERMIT.INI
;
; Sample initialization file for MS-DOS Kermit 3.11.  Kermit executes the
; commands in this file automatically when it starts.  Kermit looks for
; MSKERMIT.INI first in the current disk and directory, and if it is not
; found there, then in the disks and directories listed in your DOS PATH
; variable (if any).  You can override Kermit's initialization file
; search by specifying a different filename on the command line, preceded
; by the -F switch, for example "kermit -f monday.ini" or "kermit -f nul".
;
; Author: Christine M. Gianone, February 1990.
; Revised for version 3.11 September 1991.
;
; If you have a valid MSKERMIT.PCH file for version 3.11 of MS-DOS Kermit,
; obtained from Columbia University, remove the following GOTO command to
; have the patches installed automatically when you start Kermit:
;
GOTO MACROS

echo Patches...
patch                       ; Install patches, if any, from MSKERMIT.PCH.

:MACROS

echo MS-DOS Kermit 3.11 initialization file...

COMMENT - Macro definitions section...

; Reserved variables.  If you define new macros, don't use these names:
;  _editor   - DOS command that runs my preferred editor, for EDIT command.
;  _editfile - Last EDIT command filename.
;  _dialfile - Pathname of dialing directory file, for DIAL command.
;  _dialnum  - Last DIAL command phone number.
;  _modem    - Modem type for DIAL command.  Used to run the appropriate
;              dialing script, e.g. HAYES.SCR.  See DIAL definition.
;
define _editor edlin			; *** Change if necessary!
define _dialfile C:\KERMIT\DIALUPS.TXT	; *** Ditto
define _modem hayes			; *** Ditto

; Macros for communicating with UNIX, VAX/VMS, and similar systems:
def vax set par non, set flo x, set hand no, set dupl ful, set key \270 \127
def vms do vax, set term byte 8  ; Assumes 8-bit no-parity connection.
def unix do vax, set term byte 7 ; Most UNIX systems are still 7-bit.

; Macro for communicating with IBM mainframes in linemode:
def ibm set par mark, set flo no, set hand xon, set dup ha, set key \270 \8

; Macro for communicating with IBM mainframes in fullscreen mode,
; through 3270 protocol converter like IBM 7171:
def fullscreen set par ev,set flo x,set hand no,set dupl ful,set key \270 \8

; Additional DOS commands available directly from the MS-Kermit> prompt.

; DOS MORE command...
def more if < argc 2 fatal {More what?},-
run more < \%1

; DOS REN(ame) command...
def rename if < argc 2 fatal {Rename what?},-
  if < argc 3 fatal {Rename \%1 to what?},-
  run ren \%1 \%2

; DOS COPY command...
def copy if < argc 2 fatal {Copy what?},-
  if < argc 3 fatal {Copy \%1 to what?},-
  run copy \%1 \%2

; DOS CHCP command to examine or change code page...
def chcp run chcp \%1

; EDIT command...
def edit if = argc 2 assign _editfile \%1,-
  if not def _editfile fatal {Edit what?},-
  run \m(_editor) \m(_editfile)

; CAPTURE command - Easy downloading of a file from the host, with no error
; checking.  Unlike the LOG SESSION command, CAPTURE always creates a new
; file.  It overwrites file of same name if it already exists.  Usage: at the
; MS-Kermit> prompt, type "capture xxx" where xxx is the name of the file you
; want to create on the PC.  Once you are connected to the host, TYPE the
; desired file.  Escape back when done.  The captured file will be on your
; disk (with a TYPE command at the beginning & a prompt at the end).
;
def capture if = \v(argc) 1 fatal {Capture into what file?},-
  if exist \%1 del \%1,-
  log session \%1,-
  connect,close session,log sess session.log,close sess

; NORMAL, NOISY and CLEAN macros, modify to suit your environment...
def normal set rec pac   94, set ret  5, set block 1, set window 1
def noisy  set rec pac   40, set ret 20, set block 3, set window 8
def clean  set rec pac 1000, set ret  4, set block 2, set window 2

; Define a FATAL error macro.  Print message, go back to prompt.
def fatal echo \%1, stop

; ERRSTP macro, for use in scripts that want to hang up a dialed
; or network connection if there is any error.
def errstp echo \%1,hangup,stop

; LOOKUP macro for use with DIAL command.
; Requires MS-DOS Kermit 3.11 or later.
; Uses \m(_dialfile) for the dialing directory filename, defined above.
; Edit that file to contain the entries you will actually want to use.
;
if < version 311 goto nolook
def split assign \%x \%1,-
  assign \%y \%2,-
  assign \%s \%3,-
  assign \%p \%4

def lookup if < \v(argc) 2 end 0,-
  if not def _dialfile end 0,-
  if not exist \m(_dialfile) end 0,-
  open read \m(_dialfile),-
  if failure fatal {Can't open dialing directory file \m(_dialfile)},-
  assign \%5 \%x, assi \%6 \%y, assi \%7 \%s, assi \%8 \%p,-
  echo Looking up "\%1",-
:loop,-
  read \%9,-
  if fail goto eof,-
  split \%9,-
  if def \%x if not equal {\%x} {\%1} goto loop,-
  echo From dialing directory: \%x = \%y,-
  assign _dialnum \%y,-
  if def \%s if not eq \%s = set speed \%s,-
  if def \%p if not eq \%p = set parity \%p,-
  goto done,-
:eof,-
  echo "\%1" not found in dialing directory \m(_dialfile),-
:done,-
  assign \%x \%5, assi \%y \%6, assi \%s \%7, assi \%p \%8,-
  close read

; LIST macro to list dialing directory.
; Assumes pathname of dialing directory is in \m(_dialfile).
define list -
  if not def _dialfile fatal {_DIALFILE not defined},-
  if not exist \m(_dialfile) -
    fatal {Can't find dialing directory file \m(_dialfile)},-
  if < argc 2 run more < \m(_dialfile),-
  if > argc 1 run find "\%1" \m(_dialfile) | more

; DIAL and REDIAL commands...
; Requires the file \m(_modem).SCR to be on current disk or in DOS PATH,
; e.g., HAYES.SCR. Uses LOOKUP macro to access your dialing directory, if any.
; If argument omitted, uses previous phone number, if any.
; If multiple arguments are given, they are concatenated together
; with the separating spaces preserved, so you can "dial 800 7765 4321".
def dial if < \v(argc) 2 if not def _dialnum fatal {Dial what?},-
  if > \v(argc) 2 assign \%1 \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9,-
  if > \v(argc) 1 assign _dialnum \%1,-
  if not < \v(argc) 2 lookup {\m(_dialnum)},-
  assign \%1 \m(_dialnum),-
  take \m(_modem).scr,-
  if fail end 1, end 0

define redial if not def _dialnum fatal {No number to redial}, dial

goto common			; Skip over old-version warning

:NOLOOK
version
echo WARNING: This Kermit initialization file is for use with MS-DOS Kermit
echo version 3.11 or later.  The LOOKUP macro will not be defined, and DIAL
echo will not work.  Use an earlier version of MSKERMIT.INI or a later
echo version of MS-DOS Kermit.
define lookup echo The LOOKUP macro is not defined, stop
define dial echo The DIAL macro is not defined, stop

:COMMON

COMMENT - File transfer settings

set file collision rename	; Don't overwrite existing files
set transfer character-set transparent ; For compatibility with old versions
set receive packet-length 94    ; Regular-size packets
set attributes on		; Use file-attribute packets
set window 1			; Don't use sliding windows

COMMENT - Script defaults

set input timeout proceed	; Allow IF SUCCESS/FAILURE to work
set input echo on		; Display port input on screen
set input case ignore		; Ignore alphabet case for input matching

; The following setups are IBM-PC specific...

if not eq "\v(platform)" "IBM-PC" goto fin

COMMENT - Terminal emulation settings.  Modify to suit your environment.

set display 7			; In the 7-bit environment (use 8 for VMS)
set terminal vt320		; Emulate DEC VT320
set terminal roll off		; Keep rolled-back screens where they are
set terminal wrap on		; Tell Kermit to do line wrap
set terminal tabs at 1:8	; Set tabs at every 8 spaces
set terminal cursor underline	; Underline cursor (rather than block)
set terminal character latin1	; Use ISO Latin-1 terminal character set

COMMENT - Sample TCP/IP configuration
;
; To use TCP/IP connections, replace the dummy values below with appropriate
; values for your network (consult your network manager) and uncomment the SET
; TCP/IP commands:
;
; SET TCP/IP ADDRESS ???.???.???.???  ; My PC's numeric IP address
; SET TCP/IP SUBNETMASK 255.255.255.0 ; My physical network's subnet mask
; SET TCP/IP DOMAIN FOO.BAR.EDU       ; My network's domain name
; SET TCP/IP GATEWAY ???.???.???.???  ; My network gateway's IP address
; SET TCP/IP PRIMARY-NAMESERVER ???.???.???.??? ; Primary nameserver's address
; SET TCP/IP SECONDARY-NAMESERVER ???.???.???.??? ; fallback nameserver address
; SET TCP/IP BROADCAST: 255.255.255.255 ; My network's broadcast address

COMMENT - Initial PC communication setup.
;
; The following commands are commented out, shown as examples only.
; Replace with settings appropriate for your PC and tastes.
;
; set port 1			; Use COM1
; do vax			; Set parameters for talking to VAX
; 				; (These are the default parameters anyway)
;
; set key \96 \27		; Exchange ESC and
; set key \27 \96		; accent grave keys during terminal emulation
;
; set speed 9600                ; Transmission speed
; set terminal color 0 34 47    ; Terminal color is blue on white

COMMENT - Personalized initialization file
;
; To use a standard initialization file for everybody at your site, and still
; allow individual customizations, each user can have a file called (for
; example) MSCUSTOM.INI.  In this case, uncomment the following statement:
;
; take mscustom.ini

:FIN
echo Smile!
