C-KERMIT / KERMIT 95 SCRIPTS LIBRARY

Most recent update: 8 February 2000.

The command and script language of C-Kermit and Kermit 95 is described in
Using C-Kermit, 2nd Edition, as supplemented by the ckermit2.txt file.

Most of these scripts are intended to illustrate new features of C-Kermit
7.0 (released 1 Jan 2000) and K95 1.1.19.

The scripts are listed below. Those marked with (*) are "kerbang" scripts
which, in UNIX, can be used exactly like shell scripts if you give them
execute permission:

  chmod +x scriptname

Command-line arguments are accepted in the expected manner, e.g.:

  autotelnet xyz.com myuserid

The first line of each kerbang script looks like:

  #!/usr/local/bin/wermit +

(but without the indentation). This indicates the pathname of the C-Kermit
executable that is to execute the script; change this line as needed. The
trailing plus sign is required if command-line arguments are to be passed
to the script (and doesn't hurt if they are not). The "kerbang" feature
requires C-Kermit 7.0. For more about kerbang scripts, see ckermit2.txt,
Section 7.19 (which also explains how to use them in VMS).

On non-UNIX platforms, these scripts are executed by:

  1. Giving a TAKE command to Kermit, or:

  2. Including the script filename as the first command-line argument to
     the Kermit program, or:

  3. In Windows 95/98/NT/2000, by filetype association (when the script
     filename has the suffix ".ksc"), but in this case Windows does not
     provide a mechanism to pass arguments to the script.

Outside of UNIX, the "kerbang" line has no effect, since it is a comment to
Kermit. In VMS, any references to "environment variables" can be satisfied
by logical names or DCL symbols.

     These scripts are for illustrative purposes only and carry no
     warranty, express or implied.

  ------------------------------------------------------------------------
CONTENTS

   * C-Kermit Initialization Files
   * Internet Scripts
   * Modem Scripts
   * Pager Scripts
   * Screen-Formatting Scripts
   * Screen-Scraping Scripts
   * File-Transfer Scripts
   * File-Management Scripts
   * Number-Crunching Scripts
   * Object-Oriented Programming
   * Script-Language Torture Tests

  ------------------------------------------------------------------------
C-Kermit Initialization Files

   * kermrc
     The standard C-Kermit initialization file, slightly updated for
     version 7.0. C-Kermit 6.0 or later required. Includes definitions for
     the services directory with automatic login macros for various
     platforms and communication methods.

   * mykermrc
     Sample C-Kermit customization file. C-Kermit 6.0 or later required.

Internet Scripts:

   * autotelnet (*)
     Makes an automated Telnet connection. C-Kermit 7.0 or K95 1.1.19
     required.

   * autotelnet6 (*)
     Makes an automated Telnet connection. Same as "autotelnet" but does
     not use any new features of C-Kermit 7.0. C-Kermit 6.0 or K95 1.1.9 or
     later required.

   * iksget (*)
     Gets files from an Internet Kermit Service.

   * iksdpy (*)
     The Internet Kermit Service Daemon realtime display monitor. C-Kermit
     7.0 required.

Modem Scripts:

   * getline (*)
     Given a list of serial devices usable for dialing out, finds and
     assigns the first free one. C-Kermit 7.0 or K95 1.1.19 required.

   * modemtest (*)
     Given a list of modem pool phone numbers, makes repeated calls to each
     one; logs into a specified host, transfers files back and forth, and
     keeps a logfile of connection and performance statistics. Runs in
     UNIX, Windows 95/98/NT/2000, or VMS. C-Kermit 7.0 or K95 1.1.19
     required.

   * dialout (*)
     Puts up a form for the user to fill out to select modem type, port,
     speed, and phone number, and then dials upon user command. C-Kermit
     7.0 or K95 1.1.19 required. Note: This is also a screen-formatting
     script.

   * callbycall
     A dialing script that selects the most appropriate long-distance
     provider by time of day, and that also cycles through providers upon
     busy signals (in case the provider itself is busy, rather than the
     destination number). For use with SET DIAL MACRO. By Peter Eichhorn,
     Assyst GmbH, München. C-Kermit 7.0 or K95 1.1.19 required.

Pager Scripts:

   * numpage (*)
     Script for beepers or numeric pagers. C-Kermit 7.0 or K95 1.1.19
     required.

   * alphapage (*)
     TAP/IXO alphanumeric paging script. C-Kermit 7.0 or K95 1.1.19
     required.

   * alphapage6
     TAP/IXO alphanumeric paging script that can be used by C-Kermit 6.0 or
     K95 1.1.13 or later.

   * More about pagers

Screen-Formatting Scripts:

   * bottom (*)
     A simple one-line script that uses C-Kermit to put the cursor on the
     bottom line of your screen. C-Kermit 7.0 or K95 1.1.19 required.

   * menu (*)
     Skeleton of a menu application. C-Kermit 7.0 or K95 1.1.19 required.

   * Also see the dialout script, which uses screen-drawing techniques.

Screen-Scraping Scripts:

   * scrape
     In Kermit 95, scripts can interact with the terminal emulator to
     retrieve strings from specified locations on the terminal screen,
     similar to HLLAPI. In this script, screen forms are parsed to select
     and retrieve images from a database on the host computer. By Max
     Evarts. K95 1.1.17 or later required.

File-Transfer Scripts:

   * deliver (*)
     A script that delivers the specified file or files to their
     destination, even if the connection is broken in mid-transfer.
     C-Kermit 6.0 or K95 1.1.8 or later required.

   * synchronize (*)
     A script that synchronizes directory trees on two Internet hosts over
     a Telnet connection. Only the files that are newer on the source than
     at the destination are transferred. Directories are created
     automatically as needed at the destination. Files that disappeared
     from the source are deleted at the destination. Any mixture of text
     and binary files can be handled. The two hosts need not have the same
     operating system or file system. The destination host is contacted and
     logged in to automatically (so this is also an Internet script); thus
     the entire operation can run unattended. C-Kermit 7.0 or K95 1.1.19
     required.

File-Management Scripts:

   * rgrep (*)
     Answers the frequently asked question: "Where is recursive grep?"
     Searches through files in a directory tree whose names match the given
     pattern and prints all lines in all files that match the given
     pattern. C-Kermit 7.0 or K95 1.1.19 required.

   * rename (*)
     A one-line analog to the UNIX shell "for i in *; do blah; done" loop.
     C-Kermit 7.0 or K95 1.1.19 required.

   * changetype (*)
     Elaboration of rename to general-purpose file-type changing script;
     old and new filetypes and file list are given as command-line
     arguments, e.g. "changetype hlp txt *" renames *.hlp files to *.txt.
     C-Kermit 7.0 or K95 1.1.19 required.

   * delete (*)
     Answers the Frequently Asked Question "How do I delete files more than
     5 days old?". C-Kermit 7.0 or K95 1.1.19 required.

   * review (*)
     Review files interactively. Everything you ever wanted in a text-mode
     file browser. C-Kermit 7.0 or K95 1.1.19 required.

   * logrotate
     Rotates connection logs on a monthly basis. C-Kermit 7.0 or K95 1.1.19
     required.

   * cleandups (*)
     A rather complex file-management application (used, in fact, to manage
     the update and installation of C-Kermit 7.0 Beta-test binaries on our
     ftp server). C-Kermit 7.0 required.

   * install (*)
     Moves new C-Kermit Beta-test binaries from a staging area to the ftp
     site, deleting corresponding binaries from previous Beta tests as it
     goes, so as not to fill up the ftp server disk. C-Kermit 7.0 required.

   * merge (*)
     Merges any number of presorted files together into a single output
     file. Illustrates C-Kermit 7.0's new file i/o package operating on
     multiple files at once. C-Kermit 7.0 required.

   * ftplog (*)
     Analyzes a file-transfer log in wu-ftpd format, which is also created
     by C-Kermit 7.0's SET TRANSACTION-LOG FTP format. Lists the five most
     popular files and also prints a histogram of file count per number of
     accesses. Illustrates associative arrays. C-Kermit 7.0 required.

Number-Crunching Scripts:

   * statistics (*)
     Given a file in which each line contains a pair of numbers, X and Y,
     computes and prints the maximum, mininum, mean, variance, and standard
     deviation of the X's and Y's, and the correlation coefficient of X and
     Y. The numbers in file may (but need not) have decimal points and
     fractional parts. Illustrates the floating-point arithmetic features
     new to C-Kermit 7.0.

Object-Oriented Programming:

(And other creative programming techniques.) This section by Dat Thuc
Nguyen.

   * matrix
     The matrix is an essential element in many computing areas. C-Kermit
     and Kermit 95 can do matrix operations easily. This script creates two
     matrices, A and B, then computes their sum: matrix C.

   * noswitch
     "SWITCH Considered Harmful"

   * oop
     Object-oriented programming in C-Kermit and Kermit 95. Fun with dogs
     and cats.

   * complex
     Complex numbers are not a built-in type of many programming languages.
     Here OOP comes to rescue with the user-defined type. This script
     defines a complex number class in C-Kermit, offering the familiar C++
     interface. C-Kermit 7.0 required.

   * wordcount (*)
     Word frequency counting is the Excel of scripting languages such as
     awk and Perl. With OOP, C-Kermit also handles the task comfortably.
     This script defines and uses the class Words to count the occurrences
     of unique words of a plain-text text file. The class Words shields
     implementation details and promotes reuse, the flagship of OOP.
     C-Kermit 7.0 required.

   * inheritance
     No object-oriented programming language leaves home without
     inheritance. This script displays inheritance in C-Kermit and Kermit
     95.

   * multiple
     Multiple inheritance enriches software design. Not all OOP languages
     have it: C++ does; Java and Smalltalk don't. This script implements
     multiple inheritance in C-Kermit. The famous animal class found in
     many C++ and Smalltalk references is used to present the subject.

   * bag
     The container is a key concept in object-oriented programming.
     Smalltalk, C++, etc. have standard libraries of containers. This
     script defines the class 'bag' in C-Kermit/Kermit 95. Bag offers a
     rich usage interface.

   * string
     A rudimentary string class based on the Smalltalk model.

   * semaphore
     We use semaphores to coordinate computing tasks, share resources, etc.
     This script defines semaphore classes in both the Smalltalk and C++
     styles. C-Kermit 6.0 / K95 1.1.17 required.

   * singleton
     In the patterns community, the singleton is a class that can have only
     one instance. All objects instantiated from that class refer to the
     one and only singleton! The singleton is very useful where there is
     only one resource available and various user-defined functions access
     that resource under different refferences. The singleton class ensures
     that one and only one object can be instantiated from it, though under
     different names.

   * state
     The finite state machine is a useful concept in many applications.
     This script suggests a framework for a state machine.

Script-Language Torture Tests:

   * demo (*)
     An interactive "torture test" for C-Kermit's script language. C-Kermit
     7.0 or K95 1.1.19 required.

   * iftest (*)
     Exerciser for compound Boolean expressions. C-Kermit 7.0 or K95 1.1.19
     required.

   * functions (*)
     Function exerciser. C-Kermit 7.0 or K95 1.1.19 required.

   * localarray (*)
     Local array exerciser. C-Kermit 7.0 or K95 1.1.19 required.

  ------------------------------------------------------------------------
Links:

   * Kermit script portability reference
   * Kermit script library (top)
   * Kermit home page
   * C-Kermit
   * C-Kermit manual
   * The ckermit2.txt file
   * Kermit 95

  ------------------------------------------------------------------------
C-Kermit/K95 Script Library / Columbia University / 8 Feb 2000
