GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • For MS-DOS Kermit...
  • Accounts
  • ckubuildlog
  • C-Kermit 10.0 builds-table
  • findmissinghtml

This view

  • Original page
  • New address

GeezerVison is showing kermitproject.org — The Kermit Script Library and Tutorial

Icon The Kermit Project   |   Now hosted by Panix.com
New York City USA   •   [email protected]
…since 1981
Home C-Kermit E-Kermit Kermit 95 Scripts Timeline About Archive
Translations  (see below for credits):
Belarusian | Беларуская French | Français German | Deutsch Italian | Italiano Polish | Polski Russian | Русский Spanish | Español Ukrainian | Українська
C-Kermit / Kermit 95 Scripting Tutorial and Library
New York City
Most recent update: Fri Feb 23 14:35:57 2024

C-Kermit Tutorial   Kermit 95 Tutorial   See the scripts  ...  Built-in variables   Built-in functions

Contents
  • Introduction
  • Kermit script downloader/installer
  • Scripting tutorial
  • Recent Additions to the Script Library
  • C-Kermit Initialization Files
  • HTML Scripts
  • FTP Scripts
  • Internet Scripts
  • Logging Scripts
  • Modem Scripts
  • Pager Scripts
  • Screen-Formatting Scripts
  • Screen-Scraping Scripts
  • File-Transfer Scripts
  • File-Management Scripts
  • Number-Crunching Scripts
  • Date-Time Arithmetic
  • Object-Oriented Programming
  • Script-Language Torture Tests
  • For MS-DOS Kermit...


RECENT SCRIPTS (details below)

  • Accounts
    July 2023. For apartment-dwelling retirees: track your income versus your rent year by year; see which one is going up faster. Illustrates how to embed tabular data in the script itself rather than reading it from an external file; how to break a table row up into its elements; the use of multiple associative arrays at the same time; how to address associative array elements symbolically; and the use of S-expressions when floating-point results are needed (percentages in this case).
  • ckubuildlog
    June 2023. Creates an entry for the C-Kermit 10.0 builds-table, to be used after building a Beta test version, or for that matter, the real 10.0 release when it's ready. Unix-family OS's only for now.
  • findmissinghtml
    March 2023. For websites: finds missing pages that have Emacs backup files, so if you can't find the real page anywhere at least you can restore from the latest backup.
  • k95relay
    April 2022. Kermit 95 script for logging into a host whose SSH server doesn't support any of the ciphers that K95's SSH client does by using a Linux host or subsystem as a relay. No longer needed now that C-Kermit 10.0 for Windows is available.
  • Fixfilelists
    May 2021. Convert Kermit archive page to still display file lists after converting links from ftp: to http: because of "deprecation" of FTP by major web browsers in March-April 2021. Basically, this script makes the filenames in a directory listing clickable so you can see or download them.
  • Photogallery
    2013-2023 (active project). A production script for creating, modifying, and updating image galleries on the Web.
  • html
    May 2017. Converts plain-text files to html. This is also the first Kermit script that can be used in Unix pipelines.
  • Remind
    2016. A simple reminder program that can be invoked from your login profile.
  • Getkermitscript
    2014. Automated download and installation of scripts from the Kermit script library. Updated in 2022 to "comply" with the "deprecation" of ftp protocol for downloading.
  • Replacetextblock
    2014. An automated way to replace a block of text (such as a multiline copyright notice) in all the files that contain it.
  • Jpginfo
    2013. Produces a directory listing of JPG image files that shows date taken, width, height, and whether it's portrait or landscape.
  • Renamejpgs
    2013. A script to rename JPG files (e.g. from cameras, scanners, or cell phones) according to "time taken" or "time created". A bunch of images from different devices can be renamed in date-time order.


PREFACE

As I write this, fewer and fewer people know what Kermit is; if that applies to you, you can click here for an overview. Kermit's heyday was in the 1980s and 90s when almost everybody who used computers to communicate with other computers used Kermit as a terminal emulator and for file transfer. C-Kermit for Unix and VMS and MS-DOS Kermit for DOS were developed in tandem. As we started to add automation capabilities, the scripting language was common to both programs. When Kermit 95 for Windows came out, it had the same scripting language, since it is built upon C-Kermit.

At first the script language was targeted at communications and file-transfer tasks, but over time is has developed into a general-purpose programming language on a scale somewhere between shell scripts and Perl, with bits of Unix shell scripting, C, Bliss, Lisp, Snobol, Algol, and PL/I mixed in, with loops, variables, arrays, functions, artithmetic, associative arrays, recursion, boolean logic, string manipulation, file i/o and management, pattern matching, list processing, and so on.

Today you can write Kermit script programs to do almost anything, no matter whether it involves communication or not (and if it does involve communication, it can be over serial connections, clear-text network connections, or secure network connections). Kermit's main uses now are system and website administration and website development, and you can see a lot of examples of production scripts in these areas below.

Speaking for myself, having programmed since the mid-1960s, I have been fluent in a lot of programming languages, and I wish that all of them except C had not died out (PL/I, Snobol, and Mainsail are sorely missed; they were powerful, stable, consistent, and well documented). Today's choices (C, shell scripts, etc) are moving targets; programs written in these language do not stay written; they decay over time as the languages and associated libraries and utilities are constantly redefined. That's why now I write all my programs (except C-Kermit itself of course) in Kermit language... Because the language itself does not change in backwards-incompatible ways so that "old" scripts never need to be "upgraded", they just keep working, even as new versions of Kermit itself are released. And also because whenever there is a bug in the language I can fix it myself, and when there is something I need to do that is not in the language, I can add it myself. Always in a backwards-compatible way.

As yet there is no coherent manual for the Kermit language. Everything is documented somewhere, but it's scattered over books (which are now online) and a series of web pages. In July 2019, I put together a comprehensive guide to all the information. It's like a Table of Contents; HERE IT IS. Meanwhile this page (the one you are reading) is a pretty good place to start: Find a script that does something similar to what you want to do and use it as guide. And when you see a command or function you don't understand, use C-Kermit's built-in HELP command to find out about it:

help ?
Shows the help topics

help command
Gives information about the given command

help set command
Gives information about the given SET command

help function name
Gives information about the given built-in function.
Also use the Google Search dialog on the home page, and try out the new "Table of Contents".

—Frank da Cruz, May Day 2017, updated 29 August 2019.


INTRODUCTION

The command and script language of C-Kermit and Kermit 95 is described in Using C-Kermit, 2nd Edition, as supplemented by the C-Kermit 7.0 Supplement, the C-Kermit 8.0 Supplement, and the C-Kermit 9.0 Supplement. You can also get overviews and tutorials HERE for Kermit in general and HERE for Kermit 95 in particular.

Kermit software first appeared in 1981 for CP/M microcomputers and DECSYSTEM-20 and IBM mainframes. And shortly afterwards for IBM (and other) PCs with MS-DOS, and afterwards for more and more distinct computing platforms, notably Unix and Microsoft Windows. The command language, syntax, and (in most cases) command editing and assistance were adapted from the TOPS-20 EXEC, that is, the user interface (or "shell" in modern parlance) of the DECSYSTEM-20, which was the primary platform for academic computing at Columbia from 1977 to 1988. Notable features include per-field help upon '?', keyword and filename completion upon Tab or Esc, and built-in help. Programming capabilities were added to the command language beginning with C-Kermit 5A(190) for Unix, VMS, AOS/VS, Plan 9 (etc), and MS-DOS Kermit, and have been improved and expanded since then. A unique feature of Kermit scripting is that it is portable not only among different computing platforms (such as Unix and Windows) but also different communication methods (Telnet, FTP, secure Telnet, secure FTP, SSH, SSL, Kerberos IV/V, more than 100 different kinds of modems, and direct serial-port).

This page offers a brief introduction to Kermit scripting, and a library of sample Kermit scripts, 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

This makes the command-line arguments available to the script in the variables \%0 (script name), \%1 (first argument), \%2 (second argument), etc.

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 or later. For more about kerbang scripts, see the C-Kermit 7.0 Supplement Section on this topic.

WARNING: On Unix-based operating systems, the script file must be in Unix text format for the Kerbang mechanism to work. That is, lines must be terminated and separated only by linefeed, not carriage return and linefeed (as would happen, for example, if you uploaded the file from Windows in binary mode rather than text mode). If the Kerbang line ends with CR and LF, the Unix shell will think the CR is part of the filename if no '+' is included, and will fail to find "a valid interpreter" (i.e. Kermit) for the script. If a + sign is included, the CR might prevent Kermit from recognizing it. These are characteristics of the Unix shell, and apply to shell scripts, Perl scripts, and any other kind of script that uses the "shebang" convention for invoking the appropriate interpreter. To strip carriage returns use the following Unix shell commands:

  tr -d '\015' < scriptfilename > newfilename
  mv newfilename scriptfilename

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

  1. Giving a TAKE filename command to Kermit. In C-Kermit 7.0 and later, the filename can be followed by arguments, which are assigned to the variables \%1, \%2, ..., \%9.

  2. Including the script filename as the first command-line argument to the Kermit program, followed by a plus sign, followed by the arguments. In VMS and Windows, the plus sign seems to cause trouble with the shell, so in that case you can substitute an equal sign, but put it after the script file name instead of before it:

      kermit script.ksc = arg1 arg2 arg3 ...  VMS 
      k95 script.ksc = arg1 arg2 arg3 ...     Windows
    

    This assigns arg1 to \%1, arg2 to \%2, and so on.

  3. In Windows 95/98/ME/NT/2000/XP/etc, 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.

The scripts in this page are for illustrative purposes only and carry no warranty, express or implied.

Top


SCRIPT FOR DOWNLOADING SCRIPTS

As of January 2014 a new script is available that simplifies the downloading of scripts from the Kermit Script Library and their installation on your own computer. It is called getkermitscript, CLICK HERE to see it (and download it). You can use this script on a Unix-based computer that has C-Kermit 8.0 or later installed to download and install Kermit scripts from here in one simple command such as ”getkermitscript photogallery.ksc”. Some things to bear in mind:

  • All script file names in the Kermit library are all lowercase. The getkermitscript script knows this and lowercases any argument you might have capitalized.
  • Scripts in the script library are stored without any extension, even though you might see them referred to as name.ksc.
CLICK HERE for complete instructions.

Top


SCRIPTING TUTORIAL

  • For an introduction to C-Kermit, CLICK HERE.
  • For an introduction to Kermit 95, CLICK HERE.

The Kermit scripting language is a programming language similar to Perl, but with different syntax (because the Kermit language predates Perl and many other scripting languages). The Kermit language is portable across UNIX (Linux, AIX, HP-UX, Solaris, FreeBSD, IRIX, SINIX, QNX, SCO, Tru64, and every other known UNIX variation), VMS, Stratus VOS, Data General AOS/VS, Windows 95/98/ME/NT/2000/XP/7/8/10, OS/2, Plan 9, OS-9/68000, the Commodore Amiga, and other platforms, and works uniformly on serial connections (direct or dialed) and network connections (clear text or secure). Thus learning the language is a good investment of your time since it can be applied to almost any communications problem. The Kermit script language is documented in the book Using C-Kermit, but of course many improvements have been made since the book was published, which are explained in the updates for Version 7.0, Version 8.0, and Version 9.0, and illustrated by sample scripts listed below.

The Kermit scripting language is easy to learn if you already use Kermit, since it is the same as Kermit's command language. A Kermit script program is simply a series of Kermit commands collected into a file or a macro. To execute the script, you tell Kermit to TAKE the file or DO the macro. Or in UNIX you can also execute it as if it was a shell script, as described at the top of this page. In either case you can pass parameters to the script in the command that invokes it.

When using Kermit "manually", i.e. interacting with the host directly, you typically make a connection (SSH, TELNET, DIAL, etc), and then interact with the other computer directly, switching back and forth between the Kermit command screen and the terminal screen. The command to switch from the command screen to the terminal screen is CONNECT (C is a sufficient abbreviation). Returning from the terminal screen to the command screen requires a special "escape sequence" such as Ctrl-\C, Ctrl-]C, or Alt-x (Alt-x is used in Kermit 95 and MS-DOS Kermit). Note that Kermit's TELNET command is a shortcut for SET HOST followed by CONNECT; that is, TELNET includes an implied CONNECT command.

When automating a session, you do not switch back and forth between "screens"; you do not CONNECT or escape back. In a script, everything is done in command mode. There is no terminal screen in a script. Instead of CONNECT (or TELNET, or RLOGIN, or SSH), use the following commands, which tell Kermit to do what you would do "by hand":

SET HOST [ switches ] hostname-or-address [ switches ]
Open a network connection but remain in command mode, i.e. without entering the Terminal screen or CONNECT mode. Use this instead of TELNET, CONNECT, SSH, or other command that would enter the terminal screen. Synonym: OPEN HOST (which might be more evocative of the action performed).

For serial or modem connections, use:

SET MODEM TYPE [ name-of-modem or NONE ]
SET LINE device-name
SET SPEED interface-speed
[ DIAL phone-number ]
Open a direct or dialed serial connection but remain in command mode. Note that when the DIAL command is executed from a command file or macro, it does not automatically enter CONNECT mode.

Kermit's DIAL command places the call by sending the appropriate commands to the modem, normally AT commands, and reading the responses. The SET MODEM TYPE command, which must be given prior to the DIAL command, tells Kermit which kind of modem it is so it knows the specific command set to use. In C-Kermit and Kermit 95, it is normally not necessary to script the dialog with the modem; all that is already built into Kermit. For more information, see the manual or type HELP DIAL, HELP SET DIAL, and HELP SET MODEM.

If, however, you have a need to script such a dialog – e.g. to send alphanumeric pages or SMS messages – you can do so. The trick is that before executing the first INPUT or OUTPUT command (explained below), you must tell Kermit to SET CARRIER-WATCH OFF. Example:

SET MODEM TYPE NONE
SET LINE /dev/ttyS0
IF FAIL EXIT 1 "Device not available"
SET SPEED 57600
SET FLOW-CONTROL RTS/CTS
SET CARRIER-WATCH OFF
OUTPUT AT\13
INPUT 3 OK

Type HELP SET CARRIER-WATCH for a brief explanation.

Once the connection is open, use the following commands to simulate what you would do interactively:

INPUT timeout string
Wait up to timeout seconds for the given string to arrive from the other computer. If it arrives, this command succeeds; otherwise the command fails. Example: INPUT 10 login: The INPUT command can accept not only simple strings but also patterns. An alternative form, MINPUT, accepts a list of match strings and/or patterns.

SET INPUT ECHO ON
Normally you don't see scripted dialogs on your screen. Use this command to let you see the what Kermit and the host are saying to each other. This doesn't affect the operation of the script, only what you can see.

IF FAILURE command
If the preceding command (SET HOST, INPUT, or any other command) failed, execute the given command.
Example: IF FAIL EXIT 1 "No login prompt". The command can be a list of commands enclosed in braces, and the IF statement can also have an ELSE part, which can also be a single command or a list of commands.

IF SUCCESS command
If the preceding command succeeded, execute the given command.

STOP [ number [ string ] ]
Stop the script and return to the Kermit prompt. The number is a success code: 0 for success, nonzero for failure; the command that invoked the current command file (TAKE) or macro (DO or "implied DO") can be tested with IF SUCCESS or IF FAILURE based on this code. If a string is included, it is printed.

END [ number [ string ] ]
Like STOP, but pops the command stack just one level instead of all the way back to the top. Use this for returning early from a macro or command file to its caller. Synonym: POP.

EXIT [ number [ string ] ]
Stops the script and exits from Kermit. The number is Kermit's exit status code, normally 0 for success, nonzero for failure. If a message is given, it is printed.

OUTPUT string
Send the given string to the other computer. Control characters may be included in the string using \ddd notation (where the d's are digits, and ddd represents the numeric code for the control character.
Example: OUTPUT olga\13

LINEOUT string
(C-Kermit 7.0 and later; Kermit 95 1.1.20 and later) Since it is so common to output a line with a carriage return on the end, this command does it for you, so you don't have to remember to include \13 on the end. lineout foo is equivalent to output foo\13.

INPUT takes the place of your eyes, OUTPUT takes the place of your fingers, and IF takes the place of your brain.

The rest is regular programming: FOR, WHILE, SWITCH, GOTO, variables, arrays, functions, block structure, nesting, scoping, and the rest, listed HERE and documented in the manual (just as any other programming language is documented in its own manual).

Here is a very simple example of making a Telnet connection to UNIX and logging in:

  set host foo.bar.baz.com           ; Make the connection
  if fail stop 1 Connection failed   ; Check that it was made
  input 20 login:                    ; Wait 20 seconds for login: prompt
  if fail stop 1 No login prompt     ; Check that it came
  output myuserid\13                 ; or "lineout myuserid"
  input 5 Password:                  ; Wait 5 seconds for Password: prompt
  if fail stop 1 No Password prompt  ; Check that it came  
  output mypassword\13               ; or "lineout mypassword"

This illustrates how your actions in the terminal screen are simulated by INPUT (eyes), OUTPUT (fingers), and IF (brain). It can be elaborated to any desired degree: to use variables instead of constants for host, username, or password; to prompt for the password so you don't have to store it in a file; to attempt some sort of recovery action if a command fails instead of just stopping, and so on. And of course you can add more steps -- have it transfer a file, send email, whatever you want.

The syntax of the Kermit programming language should be familiar to anyone who uses other scripting languages such as the UNIX shell. It is a string substitution language, therefore an "escape character" (backslash) is used to indicate string substitution. Since many kinds of items can be substituted, the backslash is followed by a second character to indicate which kind of substitution is to be made: a scalar variable, an array element, a function result, a special character, and so forth. Examples:

  \%a           A scalar user-defined variable, evaluated recursively
  \m(name)      A scalar user-defined variable, evaluated one level deep
  \v(name)      A built-in variable (such as \v(time), "show var" for a list)
  \&a[1]        An array element, evaluated recursively
  \fname(args)  A function invocation ("show func" for a list, "help func xxx" for details of function xxx)
  \x0F          A character whose code is the given hexadecimal number (00-ff)
  \123          A character whose code is the given decimal number (0-255)
  \\            A literal backslash.
  (CLICK HERE for a more detailed explanation of this notation.)

This should give you an idea how to read the scripts in the library, and how to write a simple script or adapt one of them to your needs. For a brief description of a particular Kermit command or function, use Kermit's HELP command. For a description of a built-in function, type "help function xxx" at the prompt, where xxx is the function name. For a thorough treatment, please consult the manual.

Finally, remember:

  • Do not put a CONNECT command in a script unless you really want to suspend execution of the script and turn manual control over to the user. And remember that the CONNECT command can work only if the job has a controlling terminal; it can't work in a batch or cron job where there is no terminal.
  • You can't put text for the host "in-line". Kermit reads commands from the script, not text for the host. To send text to the host, use the OUTPUT or TRANSMIT command.
  • TELNET host is a shortcut for SET HOST host, IF SUCCESS CONNECT. Since TELNET includes an implied CONNECT command, don't put a TELNET command in your script unless you really want to suspend execution of the script and turn manual control over to the user. Similarly for SSH and RLOGIN. In a script, use SET HOST instead, with the appropriate switches (if necessary) to indicate the connection type. HELP SET HOST for details.
  • For more examples, look through the library below, and also see the C-Kermit case studies. Also see the C-Kermit FAQ, "Why Doesn't My Script Work?".

Top   Contents   C-Kermit   Kermit 95   Kermit Home

THE KERMIT SCRIPT LIBRARY

Recent Additions

  • Photogallery
    August 2013, with subsequent updates. A production script for creating, modifying, and updating image galleries for the Web. C-Kermit 9.0 or later required. This replaces the earlier photoalbum script, that was only a demo, not suitable for production.
  • html
    A program that converts a plain-text file into a Web page. Unlike all the other scripts presented here, this one can be used in a Unix pipeline.
  • Remind
    A simple reminder program that can be invoked from your login profile, or directly, or any other way you want. Illustrates some of C-Kermit's date-handling function (format conversion, comparison, sorting). Help text is HERE.
  • Replacetextblock
    February 2014. An automated way to replace a block of text (such as a multiline copyright notice) in all the files that contain it. C-Kermit 9.0 or later.
  • Getkermitscript
    January 2014. A Kermit script for downloading Kermit scripts from the Kermit Script Library and installing them on your computer without requiring you to edit them or give any other commands (previously would would always have to edit the "kerbang line" and change the permissions). Unix only for now. Requires C-Kermit 8.0 or later. Updated in 2022 to work around the disappearance of FTP protocol from the Intenet.
  • Jpginfo
    September 2013. Produces a directory listing of JPG image files that includes (for each file) date taken, width, height, and whether it's portrait or landscape.
  • Renamejpgs
    April 2013. A script to rename JPG files according to "time taken" or "time created". This allows images from multiple sources, or whose filenames have "wrapped around" to appear in chronological order by filename. C-Kermit 9.0.304 required.
  • ilosetup
    2009-2011. A production script for configuring HP Blade servers through their Integrated Lights Out (iLO) interface.
  • CBX
    A suite of scripts for getting reports out of a Rolm CBX. C-Kermit 8.0 or later or Kermit 95 2.1 or later.
  • Ksitemap
    Kermit builds a sitemap for a website based on a simple control file that you create, telling what files and images you want included. Google Image Sitemap Extensions are supported. If your control file contains text encoded in ISO 8859-1 or other commonly used character sets, Kermit converts it to UTF-8, which is required in sitemaps. Documented HERE. Requires C-Kermit 9.0.
  • Weblog
    Reads a Tab-Separated Record (TSV) web log for a bilingual Spanish-English website, extracts the Google searches, normalizes character set and capitalization of the search strings as far as possible, and prints the top 20 searches, along with their counts. Documented HERE. Requires C-Kermit 9.0. [As of October 2011 this script is largely academic because Google no longer includes search text in its URL parameters.]
  • ifdef
    A simple script for checking the #if/#ifdef/#ifndef..#endif structure in a C source code file.
  • ifdef2
    Like ifdef but also shows #define and #undef.
  • cmp
    Macro to compare two numbers of any length, integer or floating-point, signed or unsigned, even if they are longer than the underlying machine's word size. Requires C-Kermit 8.0 or later or K95 2.0 or later.
  • twoscomplementv3
    Macros to convert signed decimal number strings to hexadecimal two's complement format and vice versa. Does its own string arithmetic so is not limited by machine word size or memory model. As written can handle integers of up to 128 bits. Obviously, this one runs slower than twoscomplementv1, which uses machine arithmetic. Requires C-Kermit 8.0 or later or K95 2.0 or later. (The twoscomplementv2 script converted only in one direction, this version includes both directions.)
  • twoscomplementv1
    A script to convert signed decimal number strings to two's complement format and display them in hexadecimal. Uses machine arithmetic so the results are limited by the underlying word size and memory model (e.g. 32 bits). Requires C-Kermit 8.0 or later or K95 2.0 or later.
  • survey
    CGI script for processing a Web form (in this case a survey).
  • webindex
    Creates a Web index from the Kermit FTP site, thousands of files turned into clickable links. Requires C-Kermit 9.0 or later.
  • pop.ksc A fully elaborated production script for fetching one's mail from a POP3 server over a connection secured by SSL. For explanation and documentation, CLICK HERE. Requires C-Kermit 9.0 or later. I used this (and the next script, mailcheck) myself to fetch my email all day every day until Columbia switched from traditional Unix mail to Gmail.
  • mailcheck A wrapper for the pop.ksc script, which collects your password one time, and then checks for new mail every 5 minutes (or other selected interval) and fetches it if there is any.

FTP Scripts:

As of 2022, these are no longer useful in most cases, as FTP protocol and servers have been purged from the Internet.

  • Introduction to FTP Scripting
    How to automate FTP sessions with C-Kermit 8.0 and Kermit 95 2.0 or later. FTP itself has gone out of style, which is a shame, but some places still have FTP servers that you can access from a text-mode FTP client (but not from a Web browser like Chrome or Firefox).

  • ibm_infoexchange
    Makes a secure FTP connection to IBM InfoExchange. A secure version of Kermit 95 2.0 (or later) or C-Kermit 8.0 (or later) is required.

  • ftprename
    Multiple Rename: Shows how to rename a list of files on an FTP server. Requires Kermit 95 2.0 (or later) or C-Kermit 8.0 (or later).

  • ftpdirectory (*)
    How to get a directory listing from an FTP server that shows the full timestamp for every file. Requires Kermit 95 2.0 or C-Kermit 8.0 (or later).

  • usend
    Shows how to send a file to an FTP server with a guaranteed unique name, even if the server does not support STOU. Requires Kermit 95 2.0 (or later) or C-Kermit 8.0 (or later).

  • rawhide
    Daily download of new RPMs from Red Hat Linux Rawhide server. Kermit 95 2.0 (or later) or C-Kermit 8.0 (or later).

  • ftpsyncdown
    Uses FTP to synchronize a local directory with a remote server directory. Downloads new files and files that have changed, skips files that didn't change, deletes local files that don't have counterparts on the server. Works across platforms (Windows or Unix client; Unix, VMS, Windows, or most any other server); text-binary mode switching handled automatically. Kermit 95 2.0 (or later) or C-Kermit 8.0 (or later).

  • ftpsyncup
    Uses FTP to synchronize a remote server directory tree with a local directory tree. Local directory tree is duplicated on the server. Uploads new files and files that have changed, skips files that didn't change. Works across platforms via automatic text-binary mode switching. Kermit 95 2.0 (or later) or C-Kermit 8.0 (or later).

Other Internet Scripts:

  • kwhois
    A simple one-step WHOIS, a front end to the regular whois utility to look up any domain in one step rather than two.

  • remoteaccess
    How to present a command-oriented interface to users accessing Kermit directly from outside: dialup (ANSWER), Internet (SET HOST *), or even with Kermit running as a service under inetd. In these situations there is no terminal driver, so Kermit must handle echoing and editing itself, as well as parsing commands and executing them. This example implements a simple "BBS" where the user can get file listings and download files. Works with any recent version of C-Kermit or Kermit 95.

  • skermit (*)
    Client for a C-Kermit file transfer and management SSH Subsystem: a more powerful, friendlier, scriptable alternative to SFTP. CLICK HERE for documentation. C-Kermit 8.0.201 or K95 2.0 (or later) required.

  • autossh (*)
    Conducts an automated SSH session. C-Kermit 8.0 or K95 2.0 or later required.

  • autotelnet (*)
    Makes an automated Telnet connection. C-Kermit 7.0 or K95 1.1.19 or later required. Telnet has virtually disappeared from the face of the earth, even though it's far superior to SSH. Secure versions of Telnet were created, but nobody uses them and now they have disappeared too. "The bad drives out the good".

  • 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.13 or later required.

  • portlog (Intrusion Detection)
    Harmlessly absorbs and logs attacks on TCP Port 80, such as Code Red and Nimda. Resets itself every hour, at which time it also (a) uploads the hour's log to a selected FTP site; (b) e-mails a summary to a selected address. It can listen on TCP Port 80 or any other desired TCP port. Works nicely on Port 80 with Code Red, Code Red II, and Nimda. Requires: C-Kermit 8.0.

  • pop3 (*)
    Retrieves e-mail from a POP3 server. C-Kermit 7.0 required. By Mark Sapiro. Also see the newer secure POP3 script.

  • netedit
    Edits a remote file using your local computer's editor. C-Kermit 7.0 or K95 1.1.19 required.

  • iksget (*)
    Gets a file or files from an Internet Kermit Server. C-Kermit 7.0 required. No scripts needed in C-Kermit 8.0 or K95 2.x, which support kermit:// URLs on the command line (FTP, HTTP, and Telnet URLs too).

  • iksdpy (*)
    The Internet Kermit Service Daemon realtime display monitor. C-Kermit 7.0 or K95 2.0 or later required.

  • timestamp (*)
    Adds timestamps to Telnet-based system log display. C-Kermit 7.0 or K95 1.1.19 required. Note: C-Kermit 8.0 and Kermit 95 2.0 and later have a built-in option for timestamped session logs.

  • linksys (*)
    Used with a Linksys Ethernet Cable/DSL Router to retrieve the IP address for use with Kerberos 5 authentication when Network Address Translation (NAT) is enabled. C-Kermit 8.0 required.

Logging Scripts:

  • logport
    Logs data coming into a serial port. Handy for logging PBX call records, messages on control ports of routers, etc. Requires C-Kermit 8.0.211 or later.

  • daily-session-log
    Logs incoming data on any kind of connection (assumes a connection is open). An elaboration of the logport script that automatically rotates the log file every day at midnight. Should work with any recent version of K95 or C-Kermit.

Modem Scripts:

  • autodial
    This is the basic automatic dialing and logging in script. Sets up modem and communication parameters, dials, optionally negotiates through a terminal server, and then logs in to a Unix host. Should work with any version of C-Kermit or Kermit 95.

  • 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 or later required.

  • mpservers
    Given a list of TCP/IP modem-pool servers, gathers a census of in-use and free ports by sending "finger" commands to them and accumulating the results, both per-server and per-phone-number, as well as cumulative. Runs in UNIX. C-Kermit 8.0 required.

  • callstats
    Given a list of modem pool phone numbers, makes repeated calls to each one and logs the results of each call (BUSY, CONNECT 48000, etc) by date and time in a format suitable for statistical analysis. Runs in UNIX, Windows 95/98/ME/NT/2000/XP, or VMS. C-Kermit 7.0 or K95 1.1.19 or later required.

  • modemtest2 (*)
    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 9x/ME/NT/2000/XP, or VMS. C-Kermit 8.0 or Kermit 95 2.0 or later required. CLICK HERE for an earlier version that works with C-Kermit 7.0 and K95 1.1.19.

  • 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 or later 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 or later required.

  • alphapage (*)
    TAP/IXO alphanumeric paging script (UPDATED March 2003). C-Kermit 8.0 or K95 2.0 or later required.

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

  • malphapage (*)
    The TAP/IXO alphanumeric paging script modified by R.M. Almeria to send a series of pages, rather than just one. C-Kermit 8.0 or K95 2.0 or later required.

  • 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:

  • vmscapture
    Capture a text file from a VMS host without Kermit file transfer protocol.

  • 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:

  • concatenate
    Concatenates all the files in the current directory into one big file. Useful (e.g.) after downloading a bunch of EDI transaction files that need to be combined so the computer can process them all at once.

  • 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. Note: In C-Kermit 8.0, a script is no longer needed since GREP (including a recursive option) is a built-in command.

  • 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. This functionality is built in to C-Kermit as of version 8.0.211; CLICK HERE for documentation of the much-expanded RENAME command.

  • 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. This functionality, too, is built in to C-Kermit as of version 8.0.211; CLICK HERE for details.

  • delete (*)
    Answers the Frequently Asked Question "How do I delete files more than n 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's 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'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, minimum, mean, variance, and standard deviation of the X's and Y's, and the correlation coefficient of X and Y. The numbers in the file may (but need not) have decimal points and fractional parts. Illustrates the floating-point arithmetic functions introduced in C-Kermit 7.0.

  • xstats (*)
    Like statistics, except implemented (much more simply) using C-Kermit 8.0 S-Expressions.

Date-Time Arithmetic:

  • easter (*)
    Calculates the date of Easter for any year between 1900 and 2099 using S-Expressions. Requires C-Kermit 7.0 or later or K95 1.1.20 or later.

  • easter2 (*)
    Same as the previous one except this uses a new feature in C-Kermit 8.0.212 that forces integer arithmetic, which is required in this type of calculation.

  • calendar (*)
    Like Unix 'cal' - prints a calendar for any month in any year between 1859 and 9999. Requires C-Kermit 8.0 or later or K95 2.0 or later.

  • deleteold
    How to delete files that are older than a given age, in the client/server setting.

C-Kermit Initialization Files

  • kermrc
    The once-standard C-Kermit initialization file. Includes definitions for the services directory with automatic login macros for various platforms and communication methods. It's more of a demonstration of the scripting language than of practical use.

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

Kermit Protocol Augmentation:

  • rmsg
    Macro implementation of the (missing) REMOTE MESSAGE command for C-Kermit 8.0 and Kermit 95 2.0 or later.

Key Maps:

  • koikeys
    Sets up a "by-sound" keyboard for Cyrillic letters to be used with Russian Keyboard Mode in Kermit 95. This allows "touch typing" of Cyrillic by people who have QWERTY keyboards (Cyrillic letters are matched with Roman letters that have the "same sound", more or less). The normal Russian Keyboard Mode uses the standard Cyrillic keyboard layout, which is unfamiliar to QWERTY typists. Any version of Kermit 95 back to about 1.1.8 can use this key map. To see a version of this script file that also shows the Cyrillic version of each character, click here, but you may have to tell your browser that the text encoding is utf-8 (even though that is supposed be the default and preferred encoding for text on on the Web). And CLICK HERE for an HTML version with the correct Cyrillic characters that you can print on one page.

  • ar-medicare
    Kermit 95 key map required for access to the Arkansas state Medicare claims facility.

HTML Scripts

  • html
    Converts a plain-text file to HTML. Completely rewritten for production use in 2017.

Object-Oriented Programming:

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

  • cheetah
    Rule-based programming in Kermit: Animal Taxonomy. Requires C-Kermit 8.0 or Kermit 95 2.0 or later, plus the rule-engine module.

  • rulebase
    Rule-based programming in Kermit. Requires C-Kermit 8.0 or Kermit 95 2.0 or later.

  • autorepair
    Demonstration of "rulebase". Requires C-Kermit 8.0 or Kermit 95 2.0 or later.

  • socrates
    Prolog-like declarative logic programming in Kermit. Requires C-Kermit 8.0 or Kermit 95 2.0 or later.

  • symmetric
    Patterns and predicates. Requires C-Kermit 8.0 or Kermit 95 2.0 or later.

  • simulation
    Simulation of an Ice Cream Store: Customer arrivals, customer orders, customer departures, all programmed as objects. Requires the class macro defined HERE and C-Kermit 8.0 or Kermit 95 2.0 or later.

  • dining-philosophers
    The Dining Philosophers Problem: semaphore, process, timer and concurrency. Requires the class macro defined HERE and C-Kermit 8.0 or Kermit 95 2.0 or later.

  • dining-drinking-philosophers
    The Dining Philosophers Problem, with wine!

  • permute (*)
    Recursive string permutation. C-Kermit 8.0 or Kermit 95 2.0 or later required.

  • shortest_path
    Find the shortest path through a network. Illustrates S-Expressions and functions. C-Kermit 8.0 or Kermit 95 2.0 or later required.

  • fibonacci
    Recursive and iterative Fibonacci functions. Illustrates S-Expressions and functions. C-Kermit 8.0 or Kermit 95 2.0 or later required.

  • makechange
    How many ways to change a dollar? Illustrates S-Expressions and functions. C-Kermit 8.0 or Kermit 95 2.0 or later required.

  • the8queens
    The 8 Queens problem. Illustrates arrays, S-Expressions, compound Boolean expressions. C-Kermit 8.0 or Kermit 95 2.0 or later required.

  • income_tax
    Income tax calculation. Illustrates S-Expressions, floating-point arithmetic. C-Kermit 8.0 required.

  • hanoi
    Towers of Hanoi. Illustrates S-Expressions, recursion. C-Kermit 8.0 required.

  • hanoi2
    A faster version of Towers of Hanoi. Illustrates how to speed up recursive functions. C-Kermit 8.0 required.

  • class
    Hosts object-oriented programming in C-Kermit 8.0, it uses some S-Expression features. C-Kermit 8.0 required.

  • account
    An application demo that uses the same example that most Smalltalk dialects use as an introduction to object oriented programming. To run this demo:

    C-Kermit> take class
    C-Kermit> take account
    

    C-Kermit 8.0 required.

  • shortcircuit
    Short-circuit execution of macros in series (a) while all of them succeed, (b) until one of them succeeds. C-Kermit 7.0 or K95 1.1.19 required.

  • lispops
    This small package defines a series of LISP-like arithmetic operators for C-Kermit and Kermit 95. C-Kermit 7.0 or K95 1.1.19 required (obsoleted by the built-in LISP syntax of C-Kermit 8.0).

  • 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 references. 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.

  • dates
    Exerciser for date-time formats and arithmetic. C-Kermit 7.0 or later required. Script updated 26 April 2020.

  • sexp
    Exerciser for S-Expressions and floating-point arithmetic. C-Kermit 8.0 or K95 2.0 required.

Top


Links:
  • MS-DOS Kermit script library
  • Kermit script portability reference
  • Kermit script library (top)
  • Kermit home page
  • C-Kermit
  • C-Kermit manual
  • C-Kermit 7.0 Update Notes
  • C-Kermit 8.0 Update Notes
  • C-Kermit 9.0 Update Notes
  • C-Kermit 10.0 Update Notes
  • Kermit 95
  • EMACS Kermit Mode
  • Case Studies

  Translations of this page courtesy of...

Language Link Date Translator Organization
Belarusian Беларуская 2023/08/22 Vladyslav Byshuk | Владислав Бишук studycrumb.com
French Français 2023/08/25 Kerstin Schmidt Admission-Writer
German Deutsch 2023/08/25 Kerstin Schmidt Pro-Academic-Writers
Italian Italiano 2024/02/19 Priscilla Speranza Istruzione Messina
Polish Polski 2023/08/25 Kerstin Schmidt WriteMyEssay4Me
Russian Русский 2023/08/22 Vladyslav Byshuk | Владислав Бишук skyclinic.ua
Spanish Español 2024/01/03 Marglin Araujo chicksgold.com
Ukrainian Українська 2023/08/22 Vladyslav Byshuk | Владислав Бишук studybounty.com

Top


The Kermit Project hosted by Panix.com / [email protected] / 23 February 2024
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.