1. CTOS KERMIT Version: 2.0 Date: January 1993 This document is based on that of UNIX Kermit 4.2, modified for CTOS-Kermit. CTOS-Kermit is implementation of Kermit based on C-Kermit (Unix) Version 4.2, written modularly and transportably in C. The protocol state transition table is written in wart, a (not proprietary) lex-like preprocessor for C. System-dependent primitive functions are isolated into separately compiled modules so that the program should be easily portable among other systems. Since this version is based on the original UNIX-Kermit source code, it should not be used as a basis for new versions. Rather, the original UNIX- Kermit source code would be a better place to start. CTOS-Kermit Capabilities At A Glance: Local operation: Yes Remote operation: Yes Login scripts: Yes Transfer text files: Yes Transfer binary files: Yes Wildcard send: No File transfer interruption: Yes Filename collision avoidance: Yes Can time out: Yes 8th-bit prefixing: Yes Repeat count prefixing: Yes Alternate block checks: Yes Terminal emulation: Yes Communication settings: Yes Transmit BREAK: Yes Support for dialout modems: Yes IBM mainframe communication: No Transaction logging: Yes Session logging: Yes Debug logging: Yes Packet logging: Yes Act as server: Yes Talk to server: Yes Advanced server functions: Yes Local file management: Yes Command/Init files: Yes UUCP and multiuser line locking: No File attributes: No Command macros: No Raw file transmit: No CTOS-Kermit provides command line operation as well as interactive command prompting and execution. The command line options provide access to a minimal subset of CTOS-Kermit's capabilities; the interactive command set is far richer. On systems with dialout modems, CTOS-Kermit can use command files and login scripts to automate remote system logins. 1.1. The CTOS File System Consult your CTOS manual for details about the file system under your version of CTOS. For the purposes of Kermit, several things are worth briefly noting. CTOS files have case-insensitive names. CTOS directories are not tree- structured. Directory names are surrounded by "<>" characters. For example, foo.bar denotes the file foo.bar in the directory . Wildcard or "meta" characters allow groups of files to be specified. "*" matches any string; "?" matches any single character. CTOS files are linear streams of 8-bit bytes. Text files consist of 7-bit AS- CII characters, with the high bit off (0), and lines separated by the CTOS newline character, which is linefeed (LF, ASCII 10). This distinguishes CTOS text files from those on most other ASCII systems, in which lines are separated by a carriage-return linefeed sequence (CRLF, ASCII 13 followed by ASCII 10). Binary files are likely to contain data in the high bits of the file bytes, and are not treated in terms of lines. When transferring files, CTOS-Kermit will convert between upper and lower case filenames and between LF and CRLF line terminators automatically, unless told to do otherwise. When binary files must be transferred, the program must be instructed not to perform LF/CRLF conversion (-i on the command line or "set file type" interactively; see below). 1.2. Command Line Operation The CTOS-Kermit command line syntax rules that apply are: - An option name is a single character. - Options are delimited by '-'. - Options with no arguments may be grouped (bundled) behind one delimiter. - Option-arguments cannot be optional. - Arguments immediately follow options, separated by whitespace. - The order of options does not matter. The following notation is used in command descriptions: fn1 A CTOS file specification which may not contain '*' or '?'. rfn A remote file specification in the remote system's own syntax, which may denote a single file or a group of files. rfn1 A remote file specification which should denote only a single file. n A decimal number between 0 and 94. c A decimal number between 0 and 127 representing the value of an ASCII character. cc A decimal number between 0 and 31, or else exactly 127, representing the value of an ASCII control character. [ ] Any field in square braces is optional. {x,y,z} Alternatives are listed in curly braces. CTOS-Kermit command line options may specify either actions or settings. If CTOS-Kermit is invoked with a command line that specifies no actions, then it will issue a prompt and begin interactive dialog. Action options specify either protocol transactions or terminal connection. To invoke CTOS-Kermit, run the 'run file' command at the system prompt. Two prompts will be displayed: 'File name' and '[Parameters]'. kermit.run should be entered at the first prompt. Options may be entered at the second prompt. the 'GO' key then invokes CTOS-Kermit. -s fn1 Send the specified file. File name kermit.run [Parameters] -s foo.bar -r Receive a file or files. Wait passively for files to arrive. -k Receive (passively) a file or files, sending them to standard output. This option can be used in several ways: File name kermit.run [Parameters] -k Displays the incoming files on your screen; to be used only in "local mode" (see below). -a fn1 If you have specified a file transfer option, you may specify an alter- nate name for a single file with the -a option. For example, File name kermit.run [Parameters] -s foo -a bar sends the file foo telling the receiver that its name is bar. -x Begin server operation. May be used in either local or remote mode. -O Arguments specify commands to perform. Commands may perform actions or specify settings. Actions specified on the command line are executed prior to any commands in the .kermrc file. If no action command is included, enter interactive dialog. Commands specified with the -O option are executed after any commands in the .kermrc file. Before proceeding, a few words about remote and local operation are necessary. CTOS-Kermit is "local" if it is running on PC or workstation that you are using directly. CTOS-Kermit is remote if it is running on another system and transferring files over its own controlling terminal's communication line, connected to your PC or workstation. If you are running CTOS-Kermit, it is in local mode by default, with the "back port" designated for file transfer and terminal connection. If you are running Kermit on a multiuser (timesharing) system, it is in remote mode unless you explicitly point it at an external line for file transfer or terminal connection. The following command sets CTOS-Kermit's "mode": -l dev Line -- Specify a terminal line to use for file transfer and terminal connection, as in File name kermit.run [Parameters] -l [comm]a When an external line is being used, you might also need some additional op- tions for successful communication with the remote system: -b n Baud -- Specify the baud rate for the line given in the -l option, as in File name kermit.run [Parameters] -l [comm]a -b 9600 This option should always be included with the -l option, since the speed of an external line is not necessarily what you expect. -p x Parity -- e,o,m,s,n (even, odd, mark, space, or none). If parity is other than none, then the 8th-bit prefixing mechanism will be used for transferring 8-bit binary data, provided the opposite Kermit agrees. The default parity is even. -t Specifies half duplex, line turnaround with XON as the handshake character. The following commands may be used only with a CTOS-Kermit which is local -- either by default or else because the -l option has been specified. -g rfn Actively request a remote server to send the named file or files; rfn is a file specification in the remote host's own syntax. -f Send a 'finish' command to a remote server. -c Establish a terminal connection over the specified or default com- munication line, before any protocol transaction takes place. Get back to the local system by typing the escape character (normally GO) followed by the letter 'c'. -n Like -c, but after a protocol transaction takes place; -c and -n may both be used in the same command. The use of -n and -c is illustrated below. On a timesharing system, the -l and -b options will also have to be included with the -r, -k, or -s options if the other Kermit is on a remote system. If CTOS-Kermit is in local mode, the screen (stdout) is continously updated to show the progress of the file transer. A dot is printed for every four data packets, other packets are shown by type (e.g. 'S' for Send-Init), 'T' is printed when there's a timeout, and '%' for each retransmission. In addition, you may type (to stdin) certain "interrupt" commands during file transfer: Control-F: Interrupt the current File, and go on to the next (if any). Control-B: Interrupt the entire Batch of files, terminate the transaction. Control-R: Resend the current packet Control-A: Display a status report for the current transaction. These interrupt characters are used to be compatible with UNIX Kermit interrupt characters. Several other command-line options are provided: -i Specifies that files should be sent or received exactly "as is" with no conversions. This option is necessary for transmitting binary files. It may also be used to slightly boost efficiency in CTOS-to-CTOS trans- fers of text files by eliminating CRLF/newline conversion. -w Write-Protect -- Avoid filename collisions for incoming files. -q Quiet -- Suppress screen update during file transfer, for instance to allow a file transfer to proceed in the background. -d Debug -- Record debugging information in the file debug.log in the cur- rent directory. Use this option if you believe the program is mis- behaving, and show the resulting log to your local kermit maintainer. -h Help -- Display a brief synopsis of the command line options. The command line may contain no more than one protocol action option. Files are sent with their own names, except that lowercase letters are raised to upper, pathnames are stripped off, tilde ('~') characters changed to 'X', and if the file name begins with a period, an 'X' is inserted before it. In- coming files are stored under their own names except that uppercase letters are lowered, and, if -w was specified, a "generation number" is appended to the name if it has the same name as an existing file which would otherwise be overwritten. If the -a option is included, then the same rules apply to its argument. The file transfer display shows any transformations performed upon filenames. During transmission, files are encoded as follows: - Control characters are converted to prefixed printables. - Sequences of repeated characters are collapsed via repeat counts, if the other Kermit is also capable of repeated-character compression. - If parity is being used on the communication line, data characters with the 8th (parity) bit on are specially prefixed, provided the other Kermit is capable of 8th-bit prefixing (if not, 8-bit binary files cannot be successfully transferred). - Conversion is done between CTOS newlines and carriage-return-linefeed sequences unless the -i option was specified. Command Line Examples: File name kermit.run [Parameters] -l [comm]a -b 1200 -cnr This command connects you to the system on the other end of [comm]a at 1200 baud, where you presumably log in and run Kermit with a 'send' command. After you escape back, CTOS-Kermit waits for a file (or files) to arrive. When the file transfer is completed, you are again connected to the remote system so that you can logout. File name kermit.run [Parameters] -l [comm]b -b 2400 -cntp m -ra foo This command is like the preceding one, except the remote system in this case uses half duplex communication with mark parity. The first file that arrives is stored under the name foo. File name kermit.run [Parameters] -l [comm] -b 9600 -c This example uses Kermit to connect your terminal to the system at the other end of [comm]a. File name kermit.run [Parameters] -l [comm]a -b 9600 -nf This command would be used to shut down a remote server and then connect to the remote system, in order to log out or to make further use of it. The -n option is invoked after -f (-c would have been invoked before). File name kermit.run [Parameters] -l [comm]a -b 9600 -qg foo.* This command causes CTOS-Kermit to get a group of files from a remote server. No display occurs on the screen, and the keyboard is not sampled for interrup- tion commands. File name kermit.run [Parameters] -iwx This command starts up CTOS-Kermit as a server. Files are transmitted with no newline/carriage-return-linefeed conversion; the -i option is necessary for binary file transfer and useful for CTOS-to-CTOS transfers. Incoming files that have the same names as existing files are given new, unique names. File name kermit.run [Parameters] -l [comm]a -b 9600 This command sets the communication line and speed. Since no action is specified, CTOS-Kermit issues a prompt and enters an interactive dialog with you. Any settings given on the command line remain in force during the dialog, unless explicitly changed. File name kermit.run [Parameters] This command starts up Kermit interactively with all default settings. A final example shows how CTOS Kermit might be invoked, then execute arbitrary commands. File name kermit.run [Parameters] -O assign \\%A hello -O echo \\%A This causes kermit to assign the string "hello" to the variable \\%A, then echo that string to stdout. Virtually any valid kermit command may be used with the -O option. Exit Status Codes: Kermit returns an exit status of zero, except when a fatal error is encoun- tered, where the exit status is set to one. The exit command may return a specific exit code. 1.3 CTOS Interactive Commands CTOS-Kermit's interactive command prompt is "CTOS-Kermit>". In response to this prompt, you may type any valid command. CTOS-Kermit executes the command and then prompts you for another command. The process continues until you instruct the program to terminate. Commands begin with a keyword, normally an English verb, such as "send". You may omit trailing characters from any keyword, so long as you specify sufficient characters to distinguish it from any other keyword valid in that field. Certain commonly-used keywords (such as "send", "receive", "connect") have special non-unique abbreviations ("s" for "send", "r" for "receive", "c" for "connect"). Certain characters have special functions in interactive commands: ? Question mark, typed at any point in a command, followed by a carriage return, will produce a message explaining what is possible or expected at that point. Depending on the context, the message may be a brief phrase, a menu of keywords, or a list of files. ESC (The GO key) -- Request completion of the current keyword or filename, or insertion of a default value. The result will be a beep if the requested operation fails. DEL (The Delete or Rubout key) -- Delete the previous character from the command. You may also use BS (Backspace) for this function. ^W (Code-W) -- Erase the rightmost word from the command line. ^U (Code-U) -- Erase the entire command. ^R (Code-R) -- Redisplay the current command. SP (Space) -- Delimits fields (keywords, filenames, numbers) within a command. HT (Horizontal Tab) may also be used for this purpose. CR (Carriage Return) -- Enters the command for execution. LF (Linefeed) or FF (formfeed) may also be used for this purpose. \ (Backslash) -- Enter any of the above characters into the command, literally. To enter a backslash, type two backslashes in a row (\\). You may type the editing characters (DEL, ^W, etc) repeatedly, to delete all the way back to the prompt. No action will be performed until the command is entered by typing carriage return, linefeed, or formfeed. If you make any mistakes, you will receive an informative error message and a new prompt -- make liberal use of '?' and ESC to feel your way through the commands. One important command is "help" -- you should use it the first time you run CTOS Kermit. Interactive CTOS Kermit accepts commands from files as well as from the keyboard. When you enter interactive mode, CTOS-Kermit looks for the file .kermrc in your current directory and executes any commands it finds there. These commands must be in interactive format, not CTOS command-line format. A "take" command is also provided for use at any time during an interactive session. Command files may be nested to a depth of 20. Here is a brief list of CTOS Kermit interactive commands: ask, askq Prompt the user for a variable string. assign Assign a string to a variable. bye Terminate and log out a remote Kermit server. close Close a log file. connect Establish a terminal connection to a remote system. cwd Change Working Directory. dial Dial a telephone number. delete Delete a local file. directory Display a directory listing. echo Display arguments literally. exit Exit from the program, closing any open logs. finish Instruct a remote Kermit server to exit, but not log out. get Get files from a remote Kermit server. goto Go to a labeled command in a command file or macro. hangup Hang up the phone or network connection. help Display a help message for a given command. if Conditionally execute the following command. input Match characters from another computer against a given text. log Open a log file -- debugging, packet, session, transaction. output Send text to another computer. quit Same as 'exit'. receive Passively wait for files to arrive. remote Issue file management commands to a remote Kermit server. reinput Reexamine text previously received from another computer. script Execute a expect, send sequence. send Send files. server Begin server operation. set Set various parameters. show Display values of 'set' parameters. space Display current disk space usage. statistics Display statistics about most recent transaction. take Execute commands from a file. The 'set' parameters are: block-check Level of packet error detection. count Loop counter delay How long to wait before sending first packet. duplex Specify which side echoes during 'connect'. end-of-packet Terminator for outbound packets. escape-character Character to prefix "escape commands" during 'connect'. file Set various file parameters. flow-control Communication line full-duplex flow control. handshake Communication line half-duplex turnaround character. line Communication line device name. modem-dialer Type of modem-dialer on communication line. packet-length Maximum length for packets. pad-character Character to use for inter-packet padding. padding How much inter-packet padding to use. parity Communication line character parity. prompt Change the CTOS-Kermit program's prompt. speed Communication line speed. start-of-packet Control character to mark beginning of packets. take echo Take file command echo on/off take error Take file termination on error on/off timeout Timer interval to detect lost packets. The 'remote' commands are: cwd Change remote working directory. delete Delete remote files. directory Display a listing of remote file names. help Request help from a remote server. host Issue a command to the remote host in its own command language space Display current disk space usage on remote system. type Display a remote file on your screen. who Display who's logged in, or get information about a user. Most of these commands are described adequately in the Kermit User Guide. Special aspects of certain CTOS Kermit commands are described below. THE 'SEND' COMMAND Syntax: send fn - or - send fn1 rfn1 Send the file or files denoted by fn to the other Kermit, which should be running as a server, or which should be given the 'receive' command. Each file is sent under its own name (as described above, or as specified by the 'set file names' command). If the second form is used, i.e. with fn1 denoting a single CTOS file, rfn1 may be specified as a name to send it under. The 'send' command may be abbreviated to 's', even though 's' is not a unique abbreviation for a top-level CTOS-Kermit command. Note -- CTOS-Kermit sends only from the current or specified directory. It does not traverse directory trees. If the source directory contains subdirectories, they will be skipped. Conversely, CTOS-Kermit does not create directories when receiving files. THE 'RECEIVE' COMMAND Syntax: receive - or - receive fn1 Passively wait for files to arrive from the other Kermit, which must be given the 'send' command -- the 'receive' command does not work in conjunction with a server (use 'get' for that). If fn1 is specified, store the first incoming file under that name. The 'receive' command may be abbreviated to 'r'. THE 'GET' COMMAND: Syntax: get rfn or: get rfn fn1 Request a remote Kermit server to send the named file or files. Since a remote file specification (or list) might contain spaces, which normally delimit fields of a CTOS-Kermit command, an alternate form of the command is provided to allow the inbound file to be given a new name: type 'get' alone on a line, and you will be prompted separately for the remote and local file specifications, for example CTOS-Kermit>get Remote file specification: foo Local name to store it under: bar As with 'receive', if more than one file arrives as a result of the 'get' command, only the first will be stored under the alternate name given by fn1; the remaining files will be stored under their own names if possible. If a '?' is to be included in the remote file specification, you must prefix it with '\' to suppress its normal function of providing help. THE 'SERVER' COMMAND: The 'server' command places CTOS-Kermit in "server mode" on the currently selected communication line. All further commands must arrive as valid Kermit packets from the Kermit on the other end of the line. The CTOS Kermit server can respond to the following commands: Command Server Response get Sends files send Receives files bye Attempts to log itself out finish Exits to level from which it was invoked remote directory Sends directory lising remote delete Removes files remote cwd Changes working directory remote type Sends files to your screen remote space Reports about its disk usage remote who Shows who's logged in remote host Executes a remote shell command remote help Lists these capabilities If the Kermit server is directed at an external line (i.e. it is in "local mode") then the console may be used for other work if you have 'set file display off'; normally the program expects the console to be used to observe file transfers and enter status queries or interruption commands. THE 'REMOTE', 'BYE', AND 'FINISH' COMMANDS: CTOS-Kermit may itself request services from a remote Kermit server. In addition to the 'send' and 'get' commands, the following may also be used: remote cwd [directory] If the optional remote directory specification is included, you will be prompted on a separate line for a password, which will not echo as you type it. remote delete rfn delete remote file or files. remote directory [rfn] directory listing of remote files. remote host command command in remote host's own command language. remote space disk usage report from remote host. remote type [rfn] display remote file or files on the screen. remote who [user] display information about who's logged in. remote help display remote server's capabilities. bye and finish: When connected to a remote Kermit server, these commands cause the remote server to terminate; 'finish' returns it to Kermit or system command level (depending on the implementation or how the program was invoked); 'bye' also requests it to log itself out. THE 'LOG' AND 'CLOSE' COMMANDS: Syntax: log {debugging, packets, session, transactions} [ fn1 ] CTOS-Kermit's progress may be logged in various ways. The 'log' command opens a log, the 'close' command closes it. In addition, all open logs are closed by the 'exit' and 'quit' commands. A name may be specified for a log file; if the name is omitted, the file is created with a default name as shown below. log debugging This produces a voluminous log of the internal workings of CTOS- Kermit, of use to Kermit developers or maintainers in tracking down suspected bugs in the CTOS-Kermit program. Use of this feature dramatically slows down the Kermit protocol. Default name: debug.log. log packets This produces a record of all the packets that go in and out of the communication port. This log is of use to Kermit maintainers who are tracking down protocol problems in either CTOS-Kermit or any Kermit that CTOS-Kermit is connected to. Default name: packet.log. log session This log will contain a copy of everything you see on your screen during the 'connect' command, except for local messages or interaction with local escape commands. Default name: session.log. log transactions The transaction log is a record of all the files that were sent or received while transaction logging was in effect. It includes time stamps and statistics, filename transformations, and records of any errors that may have occurred. The transaction log allows you to have long unattended file transfer sessions without fear of missing some vital screen message. Default name: transaction.log. The 'close' command explicitly closes a log, e.g. 'close debug'. LOCAL FILE MANAGEMENT COMMANDS: CTOS Kermit allows some degree of local file management from interactive command level: directory Displays a listing of the names, modes, sizes, and dates of files (which defaults to '*'). cwd [directory-name] Changes Kermit's working directory to the one given, or to the your default directory if the directory name is omitted. Equivalent to 'cd'. space Display information about disk space and/or quota in the current directory and device. THE 'SET' AND 'SHOW' COMMANDS: Since Kermit is designed to allow diverse systems to communicate, it is often necessary to issue special instructions to allow the program to adapt to peculiarities of the another system or the communication path. These instructions are accomplished by the 'set' command. The 'show' command may be used to display current settings. Here is a brief synopsis of settings available in the current release of CTOS-Kermit: block-check {1, 2, 3} Determines the level of per-packet error detection. "1" is a single-character 6-bit checksum, folded to include the values of all bits from each character. "2" is a 2-character, 12- bit checksum. "3" is a 3-character, 16-bit cyclic redundancy check (CRC). The higher the block check, the better the error detection and correction and the higher the resulting overhead. Type 1 is most commonly used; it is supported by all Kermit implementations, and it has proven adequate in most circumstances. Types 2 or 3 would be used to advantage when transferring 8-bit binary files over noisy lines. count n Provides for counted loops within Kermit script files. The IF COUNT command decrements the count variable, and if the result is greater than zero, executes the following command. A separate count variable is maintained for each take level. delay n How many seconds to wait before sending the first packet after a 'send' command. Used in remote mode to give you time to escape back to your local Kermit and issue a 'receive' command. Normally 5 seconds. duplex {full, half} For use during 'connect'. Specifies which side is doing the echoing; 'full' means the other side, 'half' means CTOS-Kermit must echo typein itself. end-of-packet cc Specifies the control character needed by the other Kermit to recognize the end of a packet. CTOS-Kermit sends this character at the end of each packet. Normally 13 (carriage return), which most Kermit implementations require. Other Kermits require no terminator at all, still others may require a different terminator, like linefeed (10). escape-character cc For use during 'connect' to get CTOS-Kermit's attention. The escape character acts as a prefix to an 'escape command', for instance to close the connection and return to CTOS-Kermit or CTOS command level. The normal escape character is Code-C. file {display, names, type, warning} Establish various file-related parameters: display {on, off} Normally 'on'; when in local mode, display progress of file transfers on the screen (stdout), and listen to the keyboard (stdin) for interruptions. If off (-q on command line) none of this is done, and the file transfer may proceed in the background oblivious to any other work concurrently done at the console terminal. names {converted, literal} Normally converted, which mean that outbound filenames have path specifications stripped, lowercase letters raised to upper, tildes and extra periods changed to X's, and an X inserted in front of any name that starts with period. Incoming files have uppercase letters lowered. Literal means that none of these conversions are done; therefore, any directory path appearing in a received file specification must exist and be write-accessible. When literal naming is being used, the sender should not use path names in the file specification unless the same path exists on the target system and is writable. type {binary, text} Normally text, which means that conversion is done between CTOS newline characters and the carriage-return/linefeed sequences required by the canonical Kermit file transmission format, and in common use on non-CTOS systems. Binary means to transmit file contents without conversion. Binary is necessary for binary file transfers. warning {on, off} Normally off, which means that incoming files will silently overwrite existing files of the same name. When on ('-w' on command line) Kermit will check if an arriving file would overwrite an existing file; if so, it will construct a new name for the arriving file, of the form foo~n, where foo is the name they share and n is a "generation number"; if foo exists, then the new file will be called foo~1. If foo and foo~1 exist, the new file will be foo~2, and so on. flow-control {none, xon/xoff} Normally xon/xoff for full duplex flow control. Should be set to 'none' if the other system cannot do xon/xoff flow control. handshake {xon, xoff, cr, lf, bell, esc, none} Normally none. Otherwise, half-duplex communication line turnaround handshaking is done, which means CTOS Kermit will not reply to a packet until it has received the indicated handshake character or has timed out waiting for it. line [device-name] The device name for the communication line to be used for file transfer and terminal connection, e.g. [comm]a. If you specify a device name, Kermit will be in local mode, and you should remember to issue any other necessary 'set' commands, such as 'set speed'. If you omit the device name, Kermit will revert to its default mode of operation. modem-dialer {direct, hayes, ventel, racal} The type of modem dialer on the communication line. "Direct" indicates either there is no dialout modem, or that if the line requires carrier detection to open, then 'set line' will hang waiting for an incoming call. "Hayes" and "Ventel" indicate that the subsequent 'set line' will prepare for a subsequent 'dial' command for Hayes and Ventel dialers, respectively. packet-length n Specify the maximum packet length to use. Normally 90. Shorter packet lengths can be useful on noisy lines, or with systems or front ends or networks that have small buffers. The shorter the packet, the higher the overhead, but the lower the chance of a packet being corrupted by noise, and the less time to retransmit corrupted packets. pad-character cc CTOS-Kermit normally does not need to have incoming packets preceded with pad characters. This command allows CTOS-Kermit to request the other Kermit to use cc as a pad character. Default cc is NUL, ASCII 0. padding n How many pad characters to ask for, normally 0. parity {even, odd, mark, space, none} Specify character parity for use in packets and terminal connection, normally none. If other than none, CTOS-Kermit will seek to use the 8th-bit prefixing mechanism for transferring 8-bit binary data, which can be used successfully only if the other Kermit agrees; if not, 8-bit binary data cannot be successfully transferred. prompt [string] The given string will be substituted for "CTOS-Kermit>" as this program's prompt. If the string is omitted, the prompt will revert to "CTOS-Kermit>". retry n Specify how many packet retries to attempt before giving up. speed {0, 110, 150, 300, 600, 1200, 1800, 2400, 4800, 9600} The baud rate for the external communication line. This command cannot be used to change the speed of your own console terminal. Many CTOS systems are set up in such a way that you must give this command after a 'set line' command before you can use the line. start-of-packet cc The Kermit packet prefix is Control-A (1). The only reasons it should ever be changed would be: Some piece of equipment somewhere between the two Kermit programs will not pass through a Cotrol- A; or, some piece of of equipment similarly placed is echoing its input. In the latter case, the recipient of such an echo can change the packet prefix for outbound packets to be different from that of arriving packets, so that the echoed packets will be ignored. The opposite Kermit must also be told to change the prefix for its inbound packets. CTOS Kermit presently can be told to change only its outbound packet prefix. take { echo, error } { on, off } SET TAKE ECHO tells whether commands from a TAKE file are displayed on the screen as they are executed (off prevents command display). SET TAKE ERROR controls whether execution of a TAKE command file should be terminated if an error occurs (off prevents termination). In both cases, on is the default. timeout n Normally, each Kermit partner sets its packet timeout interval based on what the opposite Kermit requests. This command allows you to override the normal procedure and specify a timeout interval. If you specify 0, then no timeouts will occur, and CTOS Kermit will wait forever for expected packets to arrive. THE 'SHOW' COMMAND: Syntax: show {parameters, versions, macros} The show command displays the values of all the 'set' parameters described above. If you type 'show versions', then CTOS-Kermit will display the version numbers and dates of all its internal modules. You should use the 'show versions' command to ascertain the vintage of your Kermit program before reporting problems to Kermit maintainers. The 'show macros' command displays the values of all Kermit variables. THE 'STATISTICS' COMMAND: The statistics command displays information about the most recent Kermit protocol transaction, including file and communication line i/o, as well as what encoding options were in effect (such as 8th-bit prefixing, repeat-count compression). THE 'TAKE' AND 'ECHO' COMMANDS: Syntax: take fn1 The 'take' command instructs CTOS-Kermit to execute commands from the named file. The file may contain any interactive CTOS-Kermit commands, including 'take'; command files may be nested to any reasonable depth. The 'echo' command may be used within command files to issue greetings, announce progress, etc. Command files are in exactly the same syntax as interactive commands. Note that this implies that if you want to include special characters like question mark or backslash that you would have to quote with backslash when typing interactive commands, you must quote these characters the same way in command files. Command files may be used in lieu of command macros, which have now been implemented in this version of CTOS-Kermit. For instance, if you commonly connect to a system called 'B' that is connected to [comm]a at 4800 baud, you could create a file called b containing the commands set line [comm]a set speed 4800 echo Connecting to System B... connect and then simply type 'take b' (or 't b' since no other commands begin with the letter 't') whenever you wished to connect to system B. For connecting to IBM mainframes, a number of 'set' commands are required; these, too, are conveniently collected into a 'take' file like this one: set speed 1200 set parity mark set handshake xon set flow-control none set duplex half An implicit 'take' command is executed upon your .kermrc file upon CTOS-Kermit's initial entry into interactive dialog. The .kermrc file should contain 'set' or other commands you want to be in effect at all times. For instance, you might want override the default action when incoming files have the same names as existing files -- in that case, put the command set file warning on in your .kermrc file. Commands executed from take files are echoed at the terminal if TAKE ECHO has been set to ON. Errors encountered during execution of take files (such as failure to complete dial or script operations) cause termination of the current take file if TAKE ERROR has not been set to OFF, popping to the take file that invoked it, or to interactive level. A take file stack is maintained by Kermit which allows take files to invoke other take files to a depth of 20. THE 'POP' COMMAND: Syntax: pop The POP command exits the current take file a returns execution control to the take file that invoked the current take file, or to the interactive level. The pop command has no effect if it is executed from the interactive command line. THE 'CONNECT' COMMAND: The connect command links your terminal to another computer as if it were a local terminal to that computer, through the device specified in the most recent 'set line' command, or through the default device if your system is a PC or workstation. All characters you type at your keyboard are sent out the communication line, all characters arriving at the communication port are displayed on your screen. Current settings of speed, parity, duplex, and flow-control are honored. If you have issued a 'log session' command, everything you see on your screen will also be recorded to your session log. This provides a way to "capture" files from systems that don't have Kermit programs available. To get back to your own system, you must type the escape character, which is "Code key" unless you have changed it with the 'set escape' command, followed by a single-character command, such as 'c' for "command". Single-character commands include: c Switch to command mode b Send a BREAK signal 0 (zero) send a null s Give a status report about the connection Code Send Code itself (whatever you have defined the escape character to be, typed twice in a row sends one copy of it). Lowercase and control equivalents for these letters are also accepted. A space typed after the escape character is ignored. Any other character will produce a beep. The connect command simply displays incoming characters on the screen. Any screen control sequences sent by the host will be handled by the vt100 terminal emulator built in to CTOS-KERMIT. THE 'DIAL' COMMAND: Syntax: dial telephone-number-string This command controls dialout modems. The telephone-number-string may contain modem-dialer commands, such as comma for Hayes pause, or '&' for Ventel dial-tone wait and '%' for Ventel pause. Because modem dialers have strict requirements to override the carrier-detect signal most CTOS implementations expect, the sequence for dialing is more rigid than with the rest of kermit's features. Example one: CTOS-Kermit>set modem-dialer hayes hint: abbreviate set m h CTOS-Kermit>dial 9W5551212 Connected! CTOS-Kermit>set modem-dialer racal hint: abbreviate set m r CTOS-Kermit>dial 9W5551212 Connected! CTOS-Kermit>connect hint: abbreviate c logon, request remote server, etc. CTOS-Kermit> ... CTOS-Kermit>quit hint: abbreviate q this exits Kermit without hanging up the communications line. Example two: kermit CTOS-Kermit>set modem-dialer ventel CTOS-Kermit>set line [comm]a CTOS-Kermit>dial 9&5551212% Connected! CTOS-Kermit> ... Example three: kermit CTOS-Kermit>take my-dial-procedure Connected! file my-dial-procedure: set modem hayes set line [comm]a dial 5551212 connect For Hayes dialers, two important switch settings are #1 and #6. #1 should be up so that the DTR is only asserted when the line is 'open'. #6 should be up so carrier-detect functions properly. Switches #2 (English versus digit result codes) and #4 (Hayes echoes modem commands) may be in either position. Note: These examples are for Hayes and Ventel modems. They are not applicable to the TACCS internal modem. Dialing of the TACCS internal modem is accomplished through the use of scripts. THE 'HANGUP' COMMAND: Syntax: hangup The HANGUP command attempts to hang up the modem on a local-mode dialout connection established by SET LINE command in order to break the connection On terminal devices, Kermit accomplishes the hangup by momentarily turning off the Data Terminal Ready (DTR) RS-232 signal. THE 'SCRIPT' COMMAND: Syntax: script expect send [expect send] . . . "expect" has the syntax: expect[-send-expect[-send-expect[...]]] This command facilitates logging into a remote system and/or invoking programs or other facilities after login on a remote system. More control over scripting may be attained by using the INPUT, REINPUT and OUTPUT commands. This login script facility operates in a manner similar to that commonly used by the Unix uucp System's "L.sys" file entries. A login script is a sequence of the form: expect send [expect send] . . . where expect is a prompt or message to be issued by the remote site, and send is the string (names, numbers, etc) to return. The send may also be the keyword EOT, to send Code-D, or BREAK, to send a break signal. Letters in send may be prefixed by '~' to send special characters. These are: ~b backspace ~s space ~q '?'(trapped by Kermit's command interpreter) ~n linefeed ~r carriage return ~t tab ~' single quote ~~ tilde ~" double quote ~c don't append a carriage return ~o[o[o]] an octal character As with some uucp systems, sent strings are followed by ~r unless they have a ~c. Only the last 7 characters in each expect are matched. A null expect, e.g. ~0 or two adjacent dashes, causes a short delay before proceeding to the next send sequence. A null expect always succeeds. As with uucp, if the expect string does not arrive, the script attempt fails. If you expect that a sequence might not arrive, as with uucp, conditional sequences may be expressed in the form: -send-expect[-send-expect[...]] where dashed sequences are followed as long as previous expects fail. Expect/send transactions can be easily be debugged by logging transactions. This records all exchanges, both expected and actual. Note that '\' characters in login scripts, as in any other CTOS-Kermit interactive commands, must be doubled up. Example one: Using a modem, dial a unix host site. Expect "login" (...gin), and if it doesn't come, simply send a null string with a ~r. (Some systems require either an EOT or a BREAK instead of the null sequence, depending on the particular site's "logger" program.) After providing user id and password, respond "x" to a question-mark prompt, expect the Bourne shell "$" prompt (and send return if it doesn't arrive). Then cd to directory kermit, and run the program called "wermit", entering the interactive connect state after wermit is loaded. set modem-dialer ventel set line [comm]a set baud 1200 dial 9&5551212 script gin:--gin:--gin: smith ssword: mysecret ~q x $--$ cd~skermit $ wermit connect Example two: Using a modem, dial the Telenet network. This network expects three returns with slight delays between them. These are sent following null expects. The single return is here sent as a null string, with a return appended by default. Four returns are sent to be safe before looking for the prompt. Then the telenet id and password are entered. Then telenet is instructed to connect to a host site (c 12345). The host has a data switch, and to "which system" it responds "myhost". This is followed by a TOPS-20 logon, and a request to load Kermit, set even parity, and enter the server mode. Files are then exchanged. The commands are in a take file. The login command is split onto two lines for readability, though it is a single long line in the take file. set modem-dialer hayes set line [comm]a set baud 1200 dial 9,5551212 set parity even script ~0 ~0 ~0 ~0 ~0 ~0 ~0 ~0 @--@--@ id~saa001122 = 002211 @ c~s12345 ystem-c~s12345-ystem myhost @ joe~ssecret @ kermit > set~sparity~seven > server send some.stuff get some.otherstuff bye quit THE 'OUTPUT' COMMAND Syntax: output text Send the text to the serial port defined by a previous SET LINE. The text can be any combination of plain ordinary characters, and backslash codes. Backslash codes are decimal numbers preceeded by two backslashes. For example, //13 is the backslash code for carriage return. Example: output This is text to be output.//13//10 THE 'INPUT' COMMAND Syntax: input timeout text Read responses from the other computer. Wait up to timeout seconds for the specified text to appear. If the text appears within the timeout interval, the command succeeds immediately. Otherwise it fails. The text can contain any combination of ordinary characters. The maximum length of text is 7 bytes. If text is longer than 7 bytes, the first 7 bytes are used. Example: input 10 CONNECT THE 'REINPUT' COMMAND Syntax: reinput timeout text Searches response from the previous INPUT command for the given text. The timeout parameter is required but ignored. The previous INPUT response is stored in an input buffer which is 300 characters long. Example: reinput 10 BUSY THE 'IF' COMMAND: Syntax: if {success, failure, count, equal, defined, exist} command The IF command provides Kermit with a decision making mechanism to tell whether the following command should be executed bases on a given condition. The IF command supports a variety of conditions. These are: IF SUCCESS If the previous command succeeded, execute the following command. IF FAILURE If the previous command failed, execute the following command. IF COUNT Execute the command if the result is greater than zero (see SET COUNT). The value of count is decremented after it is evaluated. IF EQUAL Execute the command if the two subsequent strings are equivalent. IF DEFINED Execute the command if the variable is non-null. IF EXIST Execute the command if the specified file exists. THE 'GOTO' COMMAND: Syntax: goto label_name Go to the command which follows the named label. A label is a word beginning with a colon (:) on the left margin. Example: send test if success goto GOOD echo "Send failed" goto FINISH :GOOD echo "Send completed successfully" :FINISH bye exit THE 'HELP' COMMAND: Syntax: help or: help keyword or: help {set, remote} keyword Brief help messages or menus are always available at interactive command level by typing a question mark at any point. A slightly more verbose form of help is available through the 'help' command. The 'help' command with no arguments prints a brief summary of how to enter commands and how to get further help. 'help' may be followed by one of the top-level CTOS-Kermit command keywords, such as 'send', to request information about a command. Commands such as 'set' and 'remote' have a further level of help. Thus you may type 'help', 'help set', or 'help set parity'; each will provide a successively more detailed level of help. THE 'EXIT' AND 'QUIT' COMMANDS: Syntax: exit or: quit or: exit exitstat or: quit exitstat These two commands are identical. Both of them do the following: - Attempt to insure that the terminal is returned to normal. - Relinquish access to any communication line assigned via 'set line'. - Close any open log files. - If a positive numeric value is provided for 'exitstat', Kermit will set an operating system exit status value that can be evaluated by the next function to execute. If 'exitstat' is not a positive value or is not supplied, Kermit exits with a value of zero which indicates a normal completion. Exit does not hangup the communication line. After exit from CTOS-Kermit, your default directory will be the same as when you started the program. The 'exit' command is issued implicitly whenever CTOS-Kermit halts normally, e.g. after a command line invocation, or after certain kinds of interruptions. 1.7. How to Build CTOS-Kermit The CTOS-Kermit files, as distributed from Columbia, all begin with the prefix "ct". You should make a directory for these files and then set path to it. The Workstation C compiler is used to compile .c files into .o files using the medium model. A 'ctobjs' file is supplied, containing a list of all .o files. To link, specify @ctobjs for the object modules, and @ctlibs (supplied) for libraries.