; FILE MSKERMIT.INI
;
; Standard initialization file for MS-DOS Kermit 3.11 or later.  Kermit should
; execute 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 (for MS-DOS Kermit version 3.0)
;   Revised for version 3.11 September 1991.
;   Revised for version 3.12 September 1992.
;   Revised for version 3.13 June 1993 (corrected August 1993)

; CUSTOMIZATIONS
;
; It is recommended that you not modify this file.  Instead, you should adapt
; the sample MSCUSTOM.INI file to make your customizations: key settings,
; macro definitions, SET commands to override the ones in this file, and so
; on.  The MSCUSTOM.INI file should go in the same directory as this file.
; This file will execute MSCUSTOM.INI if it can be found.

; COMPATIBILITY
;
; This initialization file works for versions 3.11 and later of MS-DOS Kermit.
; The IF INPATH command is new to version 3.12; it tests whether a given file
; can be found in your DOS PATH or your current directory.  The IF INPATH
; command is not used if your MS-DOS Kermit version is earlier than 3.12.

; PATCHES
;
; The MSKERMIT.PCH file contains "patches" (corrections) to MS-DOS Kermit.
; If the MSKERMIT.PCH file can be found, and it agrees with your Kermit
; version, the patches are applied at this time.  The MSKERMIT.PCH file
; is included on your MS-DOS Kermit distribution diskette.  Updated patch
; files can be obtained from Columbia University.
;
if > \v(version) 312 if inpath MSR\v(version).PCH goto patch
if > \v(version) 311 if not inpath MSKERMIT.PCH goto begin

:PATCH
echo Installing patches...
echo
patch

:BEGIN
echo MS-DOS Kermit 3.11 / 3.12 / 3.13 initialization file...

COMMENT - Variable definitions...

; Reserved variables.  If you define new macros, don't use these names:
;
;  _editor   - DOS command that runs my preferred editor, for EDIT macro.
;  _editfile - Last EDIT command filename, defined by EDIT macro.
;  _dialfile - Pathname of dialing directory file, for DIAL macro.
;  _dialnum  - Last DIAL command phone number, defined by DIAL macro.
;  _modem    - Modem type for DIAL command.  Used to run the appropriate
;              dialing script, e.g. HAYES.SCR.
;
; You can override the default _editor, _dialfile, and _modem definitions
; by setting environment variables in your AUTOEXEC.BAT file, for example:
;
;   SET EDITOR=EDIT
;   SET MODEM=MICROCOM
;   SET DIALFILE=C:\PHONES\DIALING.DIR
;
; or you can redefine these variables in your MSCUSTOM.INI file.

; Editor...
;
define _editor edlin			; EDLIN is the default editor.
if not eq "\$(EDITOR)" "" -
  define _editor \$(EDITOR)

; Dialing directory file...
;
define _dialfile C:\KERMIT\DIALUPS.TXT	; Default dialing directory file.
if not eq "\$(DIALFILE)" "" -
  define _dialfile \$(DIALFILE)
if > \v(version) 311 if not inpath \m(_dialfile) -
  echo Dialing directory \m(_dialfile) not found.

; The type of modem you have.  You also need a corresponding <name>.SCR
; file to dial the modem.  For example, if the value of _modem is HAYES,
; you must have a HAYES.SCR file stored somewhere in your DOS PATH or in
; your current directory.
;
define _modem HAYES			; Default is modem type is HAYES.
if not eq "\$(MODEM)" "" -
  define _modem \$(MODEM)
if > \v(version) 311 if not inpath \m(_modem).SCR -
  echo WARNING: Dialing script file \m(_modem).SCR not found!

COMMENT - Macro definitions section...

; Macros for communicating with UNIX, VAX/VMS, and similar systems:
;
def 8bit set parity none, set term bytesize 8, set term controls 8
def 7bit set term bytesize 7, set term controls 7

def vax set par non, set flo x, set hand no, set dupl ful, set key \270 \127

def vms do vax, do 8bit		; Assumes 8-bit no-parity connection.
def unix do vax, do 7bit	; 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

; Macro to use Internet host names with Novell's LWP/DOS TELAPI and TSU.
; Assumes TSU is in the PATH and current directory is writable.
; Usage: "telapi <host-name>".
;
def telapi run tsu -o \%1 k1,run tsu -a k1 1,set port bios1,connect

; Additional DOS commands available directly from the MS-Kermit> prompt.

; DOS MORE command... (no "<" needed)
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 765 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 terminal 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)

COMMENT - Personalized initialization file
;
if > \v(version) 311 if not inpath MSCUSTOM.INI goto fin
take mscustom.ini

:FIN
echo Smile!
