File CKERMIT.UPD, Supplement to "Using C-Kermit", 1st Edition. -*- text -*- As of C-Kermit version: 6.0.192 and Kermit 95 version: 1.1.7 This file last updated: Wed Jul 17 09:40:31 1996 Authors: Frank da Cruz and Christine M. Gianone Address: The Kermit Project Watson Laboratory Columbia University 612 West 115th Street, New York NY 10025-7799, USA. Fax: +1 212 662-6442 -- or -- +1 212 663-8202 E-Mail: kermit@columbia.edu Web: http://www.columbia.edu/kermit/ Copyright (C) 1992, 1996, Trustees of Columbia University in the City of New York. All rights reserved. ------------------------------ WHAT IS IN THIS FILE This file lists changes made to C-Kermit since version 5A(188) was released and the first edition of the book "Using C-Kermit" was published in 1993. Use this file as a supplement to "Using C-Kermit". If you have the second edition of "Using C-Kermit" (1997), you don't need this file. If the "most recent update" shown above is long ago, contact Columbia University to see if there is a newer release. For further information, also see the CKCKER.BWR ("C-Kermit beware") file for hints, tips, tricks, restrictions, frequently asked questions, etc, plus the system-specific "beware file", e.g. CKUKER.BWR for UNIX, CKVKER.BWR for VMS, etc, and also any system-specific update files such as BUGS.DOC and UPDATES.DOC for Windows 95 and NT. ------------------------------ NOTE TO KERMIT 95 USERS This file concentrates on the aspects of C-Kermit that are common to all versions: UNIX, VMS, OS/2, etc. Please refer to your Kermit 95 documentation: the "Kermit 95" booklet, the UPDATES.DOC and BUGS.DOC files, and to all the other files in the Kermit 95 DOCS directory for information that is specific to Kermit 95. Also, please note that "Using C-Kermit" predates Kermit 95 altogether, and so please pardon the fact that it does not mention Windows 95 or NT; it is still the definitive reference for the C-Kermit command and script programming language. ----------------------------------------- A WORD ABOUT VERSIONS AND VERSION NUMBERS "C-Kermit" refers to all the many programs that are compiled in whole or in part from common C-language source code, comprising: . A Kermit file transfer protocol module . A command parser and script execution module . A modem-dialing module . A network support module . A character-set translation module. and several others. These "system-independent" modules are combined with system-dependent modules for each platform to provide the required input/output functions, and also in some cases overlaid with an alternative user interface, such as Macintosh Kermit's point-and-click interface, and in some cases also a terminal emulator, as in Macintosh Kermit, OS/2 C-Kermit, or Kermit 95. The C-Kermit version number started as 1.0, ... 3.0, 4.0, 4.1 and then (because of confusion at the time with Berkeley UNIX 4.2), 4B, 4C, and so on, with the specific edit number in parentheses, for example 4E(072) or 5A(188). This scheme was used through 5A(191), but now we have gone back to the traditional numbering scheme with decimal points: major.minor.edit; for example 6.0.192. Meanwhile, C-Kermit versions for some platforms might go through several releases while C-Kermit itself remains the same. These versions have their own platform-specific version numbers, such as Kermit 95 1.1.1, 1.1.2, and so on, or Macintosh Kermit 0.993. ------------------------------ CONTENTS I. C-KERMIT DOCUMENTATION: Information about the C-Kermit manual. II. NEW FEATURES: Documentation for features added since 5A(188) -- (1) PROGRAM MANAGEMENT 1.0. Finding and Executing Command Files 1.1. Command Retry, Recall, and Typeahead 1.2. The System-Wide Initialization File 1.3. The SET EXIT Command 1.4. The SET BELL Command 1.5. Command-File Line Numbers 1.6. Disabling System Access 1.7. The "KERMIT" Command 1.8. Automatic CD 1.9. Improved ?-Menus 1.10. "More?" prompting (2) MAKING AND USING CONNECTIONS 2.0. Modems and Dialing 2.1. Using the Services Directory 2.1.1. Login Macros 2.1.2. Connection Details 2.2. Incoming TCP/IP Connections 2.3. Controlling TCP Parameters 2.4. The Network Directory 2.5. Automatic Flow Control (3) TERMINAL CONNECTION 3.0. Automatic File Transfer 3.1. The APC Escape Sequence 3.2. The CONNECT Command 3.3. The SET KEY Command 3.4. The SET TERMINAL Command 3.5. The SET TELNET Command (4) FILE TRANSFER AND MANAGEMENT 4.0. New File Transfer Commands 4.0.1. Automatic Transfer Mode 4.0.2. Dynamic Packet Timeouts 4.0.3. The MOVE and MMOVE Commands 4.0.4. The BINARY and TEXT Commands 4.0.5. The FAST, CAUTIOUS, and ROBUST Macros 4.0.6. New Default Block Check Type 4.0.7. New Auto-up/download Feature 4.0.8. Packet Length Slow Start 4.0.9. Download Directory 4.0.10. The SEND List 4.0.11. The -Q Option 4.1. File Transfer Recovery 4.1.1. The RESEND and REGET Commands 4.1.2. Manual Recovery: The PSEND Command 4.2. Control-Character Unprefixing 4.3. Keyboard Cancellation of Packet Mode 4.4. New RECEIVE Command Features 4.5. Automatic Directory Creation 4.6. Pausing Between Packets 4.7. Fullscreen File Transfer Display Improvements 4.7.1. Thermometer 4.7.2. Repainting the Screen 4.8. Improved Status Codes 4.9. Managing Directories 4.10. Printing 4.11. Text-file Record-format Control 4.12. Incoming File Destination Control (5) NEW CLIENT/SERVER FEATURES 5.0. REMOTE Command Redirection 5.1. New REMOTE Commands 5.2. "WHATAMI" -- Making Kermit GET more like FTP GET 5.3. Idle Timeout for Server 5.4. Internally Generated Directory Listings 5.5. Server GET Path (6) INTERNATIONAL CHARACTER SETS 6.1. Hebrew File Transfer 6.2. Hebrew Terminal Emulation 6.3. The Hewlett Packard Roman8 Character Set (7) SCRIPT PROGRAMMING 7.1. New IF Commands 7.2. New \v() Variables 7.3. New \f() functions 7.4. INPUT and OUTPUT Command Improvements 7.5. The New MINPUT Command 7.6. Other New or Improved Script Programming Commands 7.7. Arrays 7.8. Arithmetic 7.9. New Block Structure for Commands 7.10. Local Variables 7.11. More Uses for "Long Variable Names" 7.12. hh:mm:ss Time Notation in Selected Commands 7.13. The SWITCH Command (8) USING OTHER FILE TRANSFER PROTOCOLS 8.0. Built-in XYZMODEM (Kermit 95 only) 8.1. The REDIRECT Command 8.2. New Macros for External Protocols 8.3. Built-in Selection for External Protocols (9) NEW COMMAND-LINE OPTIONS III. APPENDICES Appendix 1: UNIX C-KERMIT Appendix 2: VMS C-KERMIT Appendix 3: OS/2 C-KERMIT Appendix 4: MACINTOSH KERMIT Appendix 5: STRATUS VOS C-KERMIT IV. ERRATA & CORRIGENDA: Corrections to "Using C-Kermit" ------------------------------ I. C-KERMIT DOCUMENTATION The user manual for C-Kermit is: Frank da Cruz and Christine M. Gianone, "Using C-Kermit", Digital Press / Butterworth-Heinemann, Woburn, MA, 1993, 514 pages, ISBN 1-55558-108-0 US single-copy price: $39.95; quantity discounts available. Available in computer bookstores or directly from Columbia University: The Kermit Project Columbia University 612 West 115th Street New York NY 10025-7799 USA Telephone: +1 (212) 854-3703 Fax: +1 (212) 663-8202 Domestic and overseas orders accepted. Price: US $39.95 (US, Canada, and Mexico), $50 elsewhere. Orders may be paid by MasterCard or Visa, or prepaid by check in US dollars. Add $35 bank fee for checks not drawn on a US bank. Price includes shipping. Do not include sales tax. Inquire about quantity discounts. You can also order by phone from the publisher, Digital Press / Butterworth-Heinemann, with MasterCard, Visa, or American Express: +1 800 366-2665 (Woburn, Massachusetts office for USA & Canada) +44 1865 314627 (Oxford, England distribution centre for UK & Europe) +61 03 9245 7111 (Melbourne, Vic, office for Australia & NZ) +65 356-1968 (Singapore office for Asia) +27 (31) 2683111 (Durban office for South Africa) A German-language edition is also available: Frank da Cruz and Christine M. Gianone, "C-Kermit - Einfuehrung und Referenz", Verlag Heinz Heise, Hannover, Germany (1994). ISBN 3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 88,00. Verlag Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625 Hannover. Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 52-1 29. The Kermit file transfer protocol is specified in: Frank da Cruz, "Kermit, A File Transfer Protocol", Digital Press, Bedford, MA, 1987, 379 pages, ISBN 0-932376-88-6. US single-copy price: $32.95. Availability as above. Kermit for Windows 95 is documented in: Christine M. Gianone and Frank da Cruz, "Kermit 95", Manning Publications, Greenwich CT (1996), 88 pages, ISBN 1-884777-14-7. US single-copy price: $14.95. Included in Kermit 95 shrink wrapped package and available separately from Columbia University or direct from the publisher: Manning Publications Co. 3 Lewis Street Greenwich CT 06830 USA Fax: +1 (203) 661 9018 Email: 73150.1431@compuserve.com News and articles about Kermit software and protocol are published periodically in the journal, Kermit News. Subscriptions are free; contact Columbia University at the address above. Online news about Kermit is published in the comp.protocols.kermit.announce and comp.protocols.kermit.misc newsgroups. ------------------------------ II. NEW FEATURES Items are grouped together by major topic, roughly corresponding to the chapters of "Using C-Kermit". (1) PROGRAM MANAGEMENT 1.0. Finding and Executing Command Files The recommended extension (filetype) for Kermit scripts is KSC (Kermit SCript). This avoids conflicts other types of files that might have extensions like SCR (e.g. in Windows this means "Screen Saver"), CMD (OS/2 Rexx file), etc. When you give a TAKE command, specifying the name of a command file, C-Kermit tries to find the file in the normal way and fails if it can't. As of edit 192, if it can't find the file, then, if the filename that you gave was not "absolute" -- that is, it did not include a full path -- then Kermit looks in either your home directory or your Kermit software installation area, depending on the operating system. In OS/2, Windows NT or Windows 95, it looks in the SCRIPTS subdirectory directory. In UNIX it looks in your home (login) directory. So, for example, in Windows 95, if your Kermit 95 directory is D:\K95, and you keep all your Kermit 95 command files in D:\K95\SCRIPTS, then you can give TAKE commands for them by name only, no matter what your current directory is: [C:\TMP] K-95> take oofa.ksc Starting in edit 192, error messages issued during execution of a command file show the file name and line number at which the error occurred. This makes it easier to debug scripts. If an error occurred during execution of a macro, the line number indicates the file line where the macro was invoked, not the line or command within the macro. Lines are numbered starting at 1. Similarly, if you SET SET TAKE ECHO ON, the line numbers from the file are shown. 1.1. Command Retry, Recall, and Typeahead These features apply only when you are typing commands at the C-Kermit> prompt, and not to command file or macro execution. They were added in edit 190. If you enter a command that contains a syntax error, C-Kermit now reprompts you automatically with the portion of the command that was correct, so you don't have to retype it. Example: C-Kermit>set block-check oofa ?No keywords match - oofa C-Kermit>set block-check _ "_" shows the position of the cursor after you are reprompted. At this point, you can type question mark (?) to find out what is legal here, or you can complete the command, or you can erase it with Ctrl-U, etc, just as if you had retyped the initial words yourself. If you want to disable this feature, tell C-Kermit to: SET COMMAND RETRY OFF C-Kermit versions that are built with the "DYNAMIC" memory allocation option now support command recall (type "show features" and look for DYNAMIC and/or CK_RECALL). C-Kermit saves your commands in a command recall (history) buffer, which, by default, holds your last 10 commands. To recall your previous command, type Ctrl-P (that is, hold down the Control or Ctrl key and press the P or p key) or Ctrl-B. Type Ctrl-P (or Ctrl-B) again to recall the command before that, and so on. If you try to go back too far, C-Kermit beeps at you. NOTE: In OS/2 and Windows you should use Ctrl-B rather than Ctrl-P because, at least in certain kinds of sessions, depending on your system's configuration, Ctrl-P is trapped by OS/2 or Windows itself as a "toggle printer" command, as in MS-DOS. Each time you recall a command, it appears before you as if you had typed it up to, but not including, the Enter (Carriage Return) that actually causes it to execute. If you want to execute the command, press the Enter (Carriage Return) key. If you want to edit it, use the editing keys, including Ctrl-U to erase it. When you are viewing recalled commands, you can also go forwards in the command recall buffer by typing Ctrl-N. This is handy in case (for example), you typed too many Ctrl-P's, and went back too far. NOTE: In general, arrow keys (and mice, etc) can not be used for command recall. Why? Because C-Kermit would have to grow to twice its size to include all the operating-system, version, hardware, keyboard, and terminal dependent code to make these devices work uniformly on all (or even some) of the computers where C-Kermit runs. EXCEPTION: The up- and down-arrow keys can be used in Windows and OS/2 to scroll up and down in the command recall buffer. You can change the size of the command recall buffer to hold any number of commands you like, subject to the memory limitations of your computer. The command is: SET COMMAND RECALL-BUFFER-SIZE number where "number" is the number of commands you want to keep. The more you keep, the more memory C-Kermit uses. If you enter a size of 0, the command recall feature is disabled. Whenever you give the SET COMMAND RECALL-BUFFER-SIZE command, your previous command history is lost. You can display the size of your command recall buffer, as well as your COMMAND RETRY setting, with: SHOW COMMAND (Note: SET CMD and SHOW CMD are synonyms for SET COMMAND and SHOW COMMAND) Typeahead is now permitted during entry of interactive commands. Typeahead is not preserved, however, over execution of command files or macros, because these might themselves require keyboard input, or might enter CONNECT or file transfer protocol mode. Edit 190. 1.2. The System-Wide Initialization File As of edit 190, C-Kermit can be configured to execute its initialization file from a single system-wide directory, rather than requiring a copy in each user's home directory. This is particularly important for UNIX; VMS C-Kermit already had a facility for this. A common initialization file saves disk space and management headaches. It is recommended that all the features of the standard initialization file (dialing directory and services directory setup, chaining to customization file, etc) be kept intact. 1.3. The SET EXIT Command SET EXIT WARNING { ON, OFF, ALWAYS } tells whether C-Kermit should issue a warning message and require confirmation if an EXIT command, or a SET LINE (SET PORT), SET HOST, or TELNET command is given and a connection (dialed or network) still appears to be open, since any of these commands would close the currently open connection. The default is OFF, meaning no warnings. ALWAYS means always warn. If SET EXIT WARNING is ON, a warning is issued if a network connection appears to be open: C-Kermit>exit A network connection to foo.bar.edu might still be active. OK to exit? at which point you can type Yes or No. You will also get a warning if the serial SET LINE device has the carrier (CD, DCD) signal and C-Kermit has not been told to SET CARRIER-WATCH OFF: C-Kermit>set line /dev/acu A serial connection might still be active on /dev/ttyh6. OK to close? Note that not all versions of C-Kermit have access to the carrier signal; if your version of C-Kermit says "Modem signals not available" when you give a SHOW COMM command, then SET EXIT WARNING ON will always warn you about a possibly active serial connection when you try to exit after using a SET LINE / SET PORT connection. SET EXIT STATUS tells C-Kermit to use the given number as its program exit (return) code. This lets the user set program return code without actually having to exit; for example, the user can OR in various bits at different times. Display the SET EXIT values with SHOW EXIT. Edit 190. 1.4. SET BELL { AUDIBLE { BEEP, SYSTEM-SOUNDS }, VISIBLE, NONE } This command applies only to OS/2 and Windows. It tells how bell (beep) characters / noises should be sounded or displayed. VISIBLE means to flash the screen rather than making a noise. AUDIBLE means to make a noise, which can be either the standard "beep", or else "System sounds" that give you three different noises for "information", "warning", and "error". 1.5. Command-File Line Numbers Beginning in edit 192, any errors that occur during execution of a command file display the offending line, the name of the file that it's in, and its line number within the file. File line numbers are also shown during command-file execution if you SET TAKE ECHO ON. 1.6. Disabling System Access Many sites wish to install C-Kermit "behind a menu" in such a way that users can only do things that the system administrator approves of. In many cases the administrator does not want to let users "escape to the shell", which is accomplished in C-Kermit using RUN, !, PUSH, REDIRECT, and similar commands. There has long been a compile-time option, NOPUSH, to remove these functions from C-Kermit, but beginning in edit 192, there is now also a runtime option. If the command NOPUSH is given, all of these facilities are disabled until the program exits. Thus NOPUSH can be included in a system-wide initialization file, or on the command line (kermit -C nopush), etc. Furthermore, if C-Kermit is started and the environment variable (logical name in VMS) CK_NOPUSH is defined (to be anything at all), this is equivalent to giving the NOPUSH command. 1.7. The "kermit" Command Most versions of C-Kermit have two kinds of commands: command-line options (like a traditional 1960s-vintage UNIX program) and interactive commands and the two are completely different. Beginning in edit 192, it is possible to give a C-Kermit command-line invocation at the C-Kermit> interactive-mode prompt, and it will actually work as expected, for example: C-Kermit> kermit -r Tells C-Kermit to receive a file, just as "kermit -r", when given at the system prompt, starts Kermit in RECEIVE mode. Note, however, that you must use C-Kermit's own grouping mechanism in these commands, not your shell's. Example: kermit -C { command, command } rather than kermit -C " command, command ". 1.8. Automatic CD In the Windows and OS/2 versions, if you give a disk letter followed by a colon, at the C-Kermit> prompt, C-Kermit will treat it the same way the DOS prompt does -- it will change to the given disk. As an added bonus, you may also include a directory name after the colon, which you can't do at the DOS prompt. 1.9. Improved ?-Menus In 6.0.192, context-sensitive help menus (the lists you get when you type a question mark (?) in a command) are now organized maximally for your screen or window size, rather than into fixed-size columns. Furthermore, if C-Kermit knows your screen length, then rather than scrolling long lists right off the screen, it gives you a "More?" prompt, described in the next section. When using ? to view a file list, the list is now alphabetized, and in most cases it is allowed to be significantly longer than in previous releases. 1.10. "More?" Prompting In displays produced by a C-Kermit commands, such as the keyword or file lists mentioned in 1.9, as well as the output of various SHOW commands, the HELP command, etc, C-Kermit does its best to pause at the end of each screenful, ask "More?", and wait for you to type something before displaying the next screen. The place where C-Kermit pauses is based upon its idea of your screen size, which it obtains by asking the operating system. If the operating system doesn't know, then 24 lines by 80 columns is assumed. You can change C-Kermit's idea of your command-screen dimensions with the commands: SET COMMAND HEIGHT SET COMMAND WIDTH In the Windows and OS/2 versions, these commands change the size of the command screen size. In UNIX, VMS, and the other versions, they are used to adjust C-Kermit to what the size actually is. The "More?" prompt gives you time to read the material on the screen. At the "More?" prompt you can reply "y" (or press the space bar) to see the next screen, or "n" or "q" to cancel the list and return to the prompt. Furthermore (in edit 192 and later), you can turn more-prompting on and off with the command: SET COMMAND MORE-PROMPTING { ON, OFF } If you turn it off, long reports -- such as file lists produced by typing a question mark in a filename field (such as "send ?") will scroll past without pausing. This behavior might be preferred by those whose command windows have vertical scroll bars. NOTE: "More?" prompting presently does not work for listings produced by system processes that are started by C-Kermit, e.g. by commands like RUN or DIRECTORY. However, in most systems you can achieve it yourself; e.g. by using "run dir /p" in Windows or OS/2 or "!ls -l | more" in UNIX (a good use for macros). (2) MAKING AND USING CONNECTIONS 2.0 Modems and Dialing Dial and modem operations were totally overhauled in edit 192 to give you total control over every aspect of modem setup and configuration, as well as dialing procedures and phone number format. The dialing directory format was changed to allow for "portable" phone numbers that can be dialed from any location. All of these improvements -- hopefully all of them backwards compatible so as not to break current setups -- are detailed in separate files. Also note that new modem types are being added all the time. To get a current list, type "set modem type ?" at the C-Kermit> prompt. 2.1 Using The Services Directory NOTE: The Services Directory is replaced in Kermit 95 by the graphical Dialer. Kermit 95 users should skip this section. Kermit 95's graphical Dialer is explained in the Kermit 95 manual. In the original release of C-Kermit, 5A(188), the services directory feature was provided mainly as an illustration of how C-Kermit's script programming language can be used to build handy communications tools, and so it was not presented or explained until Chapter 13 of "Using C-Kermit", and therefore was probably missed by a lot of readers (and users). Since then, the services directory feature has proven to be quite useful in its own right, and has also been improved in one small but important way. Here is a brief nontechnical explanation. The services directory is a plain-text file in your home directory, containing one line, or "entry", for each service that you want to access. Each service listed in your services directory can be connected to and logged in to automatically, no matter whether this involves dialing up a modem, making a network connection, or any other type of connection that C-Kermit can handle. The name of the services directory file is .ksd in UNIX and OS-9, and CKERMIT.KSD in OS/2, VMS, and elsewhere. The services directory can be used only if you are also using the standard C-Kermit initialization file. Each line in the services directory has the following parts: For example: HP9000 unixlogin olga net tcp/ip hp.xyzcorp.com where "HP9000" is the entry name, "unixlogin" is the login macro name, "olga" is the username, and "net tcp/ip hp.xyzcorp.com" are the connection details. To use this entry, you would give the following command at the C-Kermit prompt: access hp9000 or: access hp9000 xxxxxx where "xxxxxx" is your password on the computer you will be accessing. C-Kermit's ACCESS macro (defined in your C-Kermit initialization file) handles the connection details: "net" means it's a network connection; "tcp/ip" tells which type of network, and "hp.xyzcorp.com" tells the name or address (in this case, the name) of the computer or service on the network. If you don't supply a password to the ACCESS command, you are prompted for it. You do not (can not, and should not) include passwords in your services directory file. Here's another example, in which the connection is made by dialing a modem: COMPUSERVE cislogin 765,4321 call hayes /dev/cua 2400 93,876-5432 Here, "COMPUSERVE" is the entry name, "cislogin" is the name of the login macro, "765,4321" is your CompuServe user ID, and the connection details are: "call hayes /dev/cua 2400 93,876-5432". "Call" means we will be making a phone call; "hayes" tells which type of modem, "/dev/cua" is the name of the device that modem is connected to, "2400" tells the communication speed, and "93,876-5432" is the phone number to dial. 2.1.1. Login Macros Each login macro looks for the appropriate prompts from the host or service and responds accordingly with your username, password, and/or other information, and then waits until it sees the main prompt of the host or service, or other indication that you have been logged in successfully. The following login macros are available in the standard C-Kermit initialization file (.kermrc on UNIX and OS-9, CKERMIT.INI elsewhere): UNIXLOGIN For logging in to all types of UNIX systems: Solaris, HP-UX, Linux, IRIX, DG/UX, NeXTSTEP, OSF/1, SunOS, etc etc. The default system prompt (explained below) is "\13\10$\32"; that is, carriage return, linefeed, dollar sign, space. VMSLOGIN For logging in to DEC VAX/VMS or OpenVMS systems. The default system prompt is "\10\13$\32"; that is, linefeed, carriage return, dollar sign, space. This macro can also be used for logging in to DG AOS/VS systems if you specify a different prompt ("\13\10)\32"). NOTE: The VMSLOGIN macro has been updated to account for new procedures for use with VMS 6.0 and/or 6.1, while retaining comptability with earlier VMS releases. VMLINELOGIN For logging into IBM mainframes with VM/CMS over linemode connections. VMFULLOGIN For logging into IBM mainframes with VM/CMS over fullscreen connections. CISLOGIN For logging in to CompuServe. DOWLOGIN For logging in to Dow Jones News/Retrieval. DJNRSPRINT For logging in to Dow Jones News/Retrieval over SprintNet. NOLOGIN For accessing computers or services that do not require logging in. Each login macro name must be followed by a username, even NOLOGIN. For NOLOGIN, just include a "dummy" name, like "xxxx", that will not be used. Other login macros can be easily constructed, modeled on those above. Read Chapters 11-13 of "Using C-Kermit" for full instructions. If you add or modify login macros, you should put their definitions in your C-Kermit customization file (.mykermrc in UNIX and OS-9, CKERMOD.INI elsewhere). There was a problem with the login macros in C-Kermit 5A(188-189), namely that the system prompt was hard-coded into the macro. For example, the UNIXLOGIN macro assumed that the UNIX shell prompt was "$ " (dollar sign followed by space), but in many cases it might be something else, and the only way to allow for different prompts was to edit the macro itself. In C-Kermit 5A(190) and later, you may include the system prompt in your services directory by grouping it together in curly braces with the login macro name: {macroname prompt} For example: CSHELL {unixlogin \13\10%\32} olga net tcp/ip bsd.xyzcorp.com CHEMISTRY {vmslogin \10\13CHEM$} OLGA net tcp/ip chemlab.xyzcorp.com DG {vmslogin \13\10)\32} olga net tcp/ip aosvs.xyzcorp.com The first example specifies the C-Shell prompt, "% ", rather than using the default UNIX (Bourne Shell, K-Shell) prompt of "$ ". The second example accesses a system that has a custom prompt. The third uses the VMSLOGIN macro to access a Data General AOS/VS system by specifying the AOS/VS prompt, ") ", since otherwise the Username: and Password: prompts are the same as for VMS. The "backslash-number" notation is a way of including special (usually nonprintable) characters in C-Kermit commands and files, explained on pages 21-22 of "Using C-Kermit". The number is the ASCII character number, such as 10 for linefeed, 32 for space. 2.1.2. Connection Details The Connection Details part of a services directory entry starts with one of the following words: CALL - The connection is made with a phone call through a modem. SERIAL - The connection is a direct (dedicated) serial connection. NET - The connection is made on a network. The subsequent information depends on the type of connection. CALL must be followed by the following information, in this order: 1. The modem type (a valid SET MODEM value). 2. The name of the device on your computer that the modem is connected to. 3. The speed, in bits per second, at which to use the device. 4. The telephone number to dial. This can also be the name of an entry in your dialing directory. SERIAL must be followed by the following information, in this order: 1. The serial device name. 2. The communication speed. NET must be followed by: 1. The network type: TCP/IP, X.25, DECNET, etc (a valid SET NET TYPE value). 2. The name or address of the host or service you want to connect to. 3. Additional network-specific information, like a service or socket number. For TCP/IP network connections, you can include a socket number by appending to the IP name or address with a colon, for example: WEATHER nologin xxxx net tcp/ip madlab.sprl.umich.edu:3000 Create your services directory file using a text editor, as a plain-text (ASCII) file. If you are using a word processor, be sure to save your services directory as a plain text (ASCII) file. To use your services directory, just type "access" and the service name at the C-Kermit prompt, for example: C-Kermit> access hp9000 olga's password: __________ To list your services directory, type "list" at the C-Kermit prompt. To look up a particular services directory entry, type "list" and then the name, for example "list hp9000". 2.2. Incoming TCP/IP Connections As of September 27, 1995, Kermit protocol has an official TCP Registered Port Number from the Internet Assigned Numbers Authority (RFC 1340): 1649 We haven't quite decided what to do with it yet, so let's hold it in reserve. In the OS/2, Windows NT, and Windows 95 versions of C-Kermit, which support incoming TCP/IP connections, this is the default port number for "set host *". You still can (and should) specify any other desired port after the "*", e.g. "set host * 3333". In edit 192 incoming TCP/IP connections were also added for UNIX and VMS, as long as the underlying operating system or TCP/IP library provides the select() function. You can tell if your version of Kermit supports this feature by giving the command "SHOW FEATURES" and looking to see that TCPSOCKET is listed and NOLISTEN is not listed -- or simply by trying it. For the present, incoming connections can be used in the following ways: . For chat sessions. This requires both Kermit programs to be in CONNECT mode. . For protocol operations. For this you would typically put the listening Kermit in server mode after the connection came in. . For "host mode", such as the one that comes with Kermit 95, which is implemented as a script. This gives incoming clients a nice menu. One good use for this feature is when you want to exchange files with someone else on the Internet, and neither of you has a login ID on the other person's computer. Anonymous ftp is often not a solution because (e.g. on UNIX) you might not have write access to the /pub/ftp tree to put something there to be picked up, and/or your site does not allow anonymous users write access. Or, perhaps more to the point, the files to be transferred are of a private nature and you might not want to trust them to email. In this case you can set up an access point only for the intended person. See the example at the end of this section. Since the SET HOST * command blocks until a connection comes in (or until you interrupt it with Ctrl-C), you would normally have to sit and wait for this to happen before you type the next command (CONNECT, SERVER, etc). For this reason, incoming connections are best set up from a command file or macro. For example, to set up a server: define be_a_server set host * 3333, if success serve define lets_chat set host * 4444, if sucess connect and so on. In operating systems like UNIX and VMS, which have real user IDs, passwords, groups, access controls, and so on, C-Kermit does not interface with those mechanisms in any way (this might come in a later release). Instead, it runs as the user who started it -- in the user's file space, name space, etc, with all of the user's access rights in effect. To achieve a measure of security, use the DISABLE and ENABLE commands described in "Using C-Kermit", Chapter 7, page 148. For example, if you use DISABLE CD in combination with SET FILE DOWNLOAD-DIRECTORY (see section 4.0), you can restrict the client's read access to one directory and its write access to a different directory. The SET SERVER LOGIN command was also added in edit 192 for an additional measure of protection: SET SERVER LOGIN [ username [ password [ account ] ] ] The maximum length for each field is 32. If you give this command prior to putting C-Kermit in server mode, nobody will be able to issue any commands until they use REMOTE LOGIN to supply a username (and password, if you specified one) that match those from SET SERVER LOGIN exactly. Logins and logouts are recorded in the transaction log ("log transactions"). Presently only one username/password combination can be set up; there is no "password file" or user list by which the Kermit server supports multiple users. WARNING: this command echoes like any other, so the password will be visible when you type it; furthermore there is no encryption of any kind. In short, use this feature at your own risk :-) And use your imagination... Note: C-Kermit is not yet suitable for use as a system service or daemon, e.g. for running under inetd, or like (say) ftpd is. As to performance, measurements made on a fast and unloaded computer on a fast an unloaded network showed file transfer speed improved over 90% when the Kermit server was accessed directly on a socket as opposed to going through an intermediate Telnet server and pseudoterminal driver. Here's an example of setting up a TCP/IP Kermit server: $ cd private $ kermit [/usr/olga/private] C-Kermit> log transactions [/usr/olga/private] C-Kermit> disable cd [/usr/olga/private] C-Kermit> set download directory ./incoming [/usr/olga/private] C-Kermit> set server login olaf supersecret [/usr/olga/private] C-Kermit> define xx set host * 4444, server [/usr/olga/private] C-Kermit> xx Binding to socket 4444 ... Listening ... Waiting to accept a TCP/IP connection on port 4444 ... When the connection comes in, C-Kermit automatically enters server mode (because of the xx macro), but whoever made the connection cannot use it for anything until they log in with the proper username and password. Once they do, they can get files from the "private" directory, and they can send files to the "private/incoming" directory. The user on the other end would do as follows (using Kermit 95, C-Kermit, or MS-DOS Kermit): Kermit> set host 4444 (Note: in MS-DOS Kermit the above command would be "set port tcp" rather than "set host".) Kermit> remote login olaf supersecret Logged in. Kermit> (Now any server commands can be issued -- SEND, GET, REMOTE xxx, etc) Kermit> remote logout Kermit> hangup Hint: Pick a port number above 1000, but make sure nobody else is using the same one. But how would you know? One way is to try connecting to the port yourself. If Telnet (or Kermit) says "connection refused", that probably means the port is not in use. 2.3. Controlling TCP Parameters The following commands were added in 6.0.192 (Kermit 95 1.1.3): SET TCP KEEPALIVE { ON, OFF } Setting this ON might help to detect broken connections more quickly. Default is ON. SET TCP LINGER { ON [], OFF } Setting this ON ensures that a connection doesn't close before all outstanding data has been transferred and acknowledged. The optional specifies how many 10th of a millisecond we should wait for a close to succeed. 0 means no timeout, wait forever. Default is OFF. SET TCP NODELAY { ON, OFF } ON means send short TCP packets immediately rather than waiting to accumulate a bunch of them before transmitting (Nagle Algorithm). Default is OFF. Turning this ON can significantly degrade overall network performance -- use it only if you have to. SET TCP RECVBUF SET TCP SENDBUF TCP receive and send buffer sizes. The system default sizes are used unless a specific size is specified. These items are designed to let you tune TCP networking performance on a per-connection basis by adjusting items that you normally would not have access to. You should use these commands only if you feel that the TCP/IP protocol stack that Kermit is using is giving you inadequate performance, and then only if you understand the concepts (see, for example, the Comer TCP/IP books), and then at your own risk. These settings are displayed by SHOW NETWORK. Not all options are necessarily available in all C-Kermit versions; it depends on the underlying TCP/IP services. 2.4. The Network Directory Similar to the Dialing Directory (see DIALING.DOC). SET NETWORK DIRECTORY [ file [ file [ file [ ... ] ] ] ] Chooses zero, one, or more network directory files, which, together, make up the network directory. The standard C-Kermit initialization file assumes you have one network directory file called .knd (UNIX or OS-9) or ckermit.knd (elsewhere) in your home directory. This can be overridden by the environment variable K_NET_DIRECTORY. If you have a network directory, then SET HOST, RLOGIN, and TELNET commands look up their argument there if it starts with a letter. Directory format: ; Full-line command entryname networktype address network-specific-items ; trailing comment Full-line comments and blank lines are allowed; trailing comments must begin with a semicolon preceded by at least one space. "entryname" is the name of entry, must start with a letter. "networktype" is one of the following: tcp/ip x.25 decnet superlat netbios named-pipe (type "set network type ?" for a list of types that are supported in your version of C-Kermit.) "address" is the host name or address you would use in a SET HOST command, such as an IP hostname, and IP address, and X.121 address, a DECnet node name, etc. "network-specific-items" are optional. For TCP/IP: TCP service port name or number, username. For SuperLAT: Password (we do NOT recommend recording this). For X.25 we use keyword parameters: cug= Closed user group, if any cud= Call user data, if any rev=on (or) off Reverse charge on or off pad=p:v,p:v,p:v,p:v,... PAD numeric parameter:value sequence and can be given in any combination or any order. 2.5. Automatic Flow Control As of 6.0.192, the default flow control setting is AUTOMATIC, meaning that whenever you SET LINE, SET PORT, SET MODEM TYPE, SET MODEM CAPABILITIES, or SET HOST (or TELNET), an appropriate type of flow control is chosen automatically: . In VMS C-Kermit, it is always set to Xon/Xoff, which actually means /TTSYNC/HOSTSYNC, which should always be used. The rest apply to all systems except VMS. . For network connections (SET HOST or TELNET), flow control is set to NONE; the underlying network protocols handle flow control themselves. . For direct serial connections (SET MODEM TYPE NONE, SET PORT/LINE xxx), FLOW is set to RTS/CTS if the C-Kermit implementation supports it, otherwise to Xon/Xoff. . For modem connections, FLOW is set to RTS/CTS if C-Kermit supports AND if the modem supports it (as determined from the modem's capabilities list, shown as HWFC by SHOW MODEM); otherwise to Xon/Xoff. To override this behavior, SET FLOW to the desired specific value: NONE, XON/XOFF, RTS/CTS, or other ("set flow ?" for list of the options available in your version of C-Kermit). (3) TERMINAL CONNECTION 3.0. Automatic File Transfer If SET TERMINAL AUTODOWNLOAD is ON, and C-Kermit is in CONNECT mode, then the terminal emulator automatically recognizes certain kinds of Kermit packets (and, if external or internal ZMODEM protocol is supported, also incoming ZMODEM transfers) and automatically goes into receive or server mode using the appropriate protocol, and then returns to terminal emulation automatically when the transfer is finished. Edit 192: Kermit 95, OS/2, VMS, UNIX. Example: Tell C-Kermit to "set terminal autodownload on", then "connect". Then while in CONNECT mode, to download a file to C-Kermit, just tell the remote Kermit to "send" the file. To upload a file from C-Kermit to the remote Kermit, tell the remote Kermit to "get" the file. Also be sure to read section 8.3, subsection "Receiving files", about this, and particularly the caution regarding multihop Kermit connections. 3.1. The APC Escape Sequence Kermit 95 and, as of edit 190, also the OS/2, UNIX, and VMS versions of C-Kermit are able to respond automatically to "autoupload", "autodownload", or auto-anything-else directives from the remote computer during CONNECT mode. These directives come in the form of an Application Program Command escape sequence, or APC. The APC is sent by a host application to a terminal emulator, containing one or more commands to be executed by the terminal emulation program. This mechanism lets the host application software control your communications software, allowing an unprecedented degree of automation and convenience. Good uses for this feature include: (a) automatic communications, protocol, terminal, keyboard, or other setups by the host application; (b) automatic initiation of file transfer by the host application. The form of an APC is "_text\", where "" is ASCII character 27 (Escape), and "text" is a command or a list of commands separated by commas. The APC sequence was originally defined defined in ANSI X3.64 and first implemented by Digital Equipment Corporation for its VT300-series and higher terminals. There are two "ends" to an APC operation, and you need to understand how to control each end. Let's call the application which sends an APC escape sequence the "APC sender", and the application that receives it, and which is supposed to execute the commands it contains, the "APC receiver". Any host application can be an APC sender. To send an APC, all it needs to do is display the desired commands on your terminal screen, enclosed in _ and \. C-Kermit 5A(189) (and later) has a command for doing this: APC text where the "text" is a command (or commands) for the APC receiver. Leading and trailing spaces are removed from the text unless it is enclosed in braces: APC { text } Here's an example that sets MS-DOS Kermit parameters from the C-Kermit command line. It assumes that C-Kermit is being accessed from MS-DOS Kermit 3.13 or later, which is in CONNECT mode: C-Kermit>apc set receive packet-length 2000, set window 4 This command causes C-Kermit to send the following characters to the terminal (i.e. MS-DOS Kermit's terminal emulator): _set receive packet-length 2000, set window 4\ MS-DOS Kermit recognizes the APC sequence, extracts the commands from it, and processes them automatically, according to the rules listed below. Here's an example in which you define and then execute a C-Kermit macro to send a file from C-Kermit, causing MS-DOS Kermit to receive it automatically without your having to escape back and type "receive". You do not need to CONNECT again after the transfer is done, either; this too happens automatically. C-Kermit>define autosend apc receive, send \%1 C-Kermit>autosend oofa.txt A macro is used because if you type APC RECEIVE at the C-Kermit prompt, MS-DOS Kermit goes immediately into RECEIVE mode and you have no way to give the SEND command to C-Kermit. Conversely, if you type the SEND command first, C-Kermit goes into SEND mode, and you have no opportunity to give it an APC command. When the macro (or a TAKE command file) is the source of commands, the "Catch-22" is avoided because the keyboard is out of the picture. The APC receiver can be: . MS-DOS Kermit 3.13 or later . Kermit 95 . C-Kermit 5A(190) or later for OS/2 . C-Kermit 5A(190) or later for UNIX . C-Kermit 5A(190) or later for VMS When one of these Kermit programs is in CONNECT mode, and an APC escape sequence arrives, the commands it contains are executed if: 1. Terminal emulation is VT100, VT102, VT220, VT320, ANSI-BBS, SCOANSI, AT386, or Wyse370, and: 2. SET TERMINAL APC is ON and the commands are not "dangerous", or: 3. SET TERMINAL APC is UNCHECKED. After processing the APC sequence, whether its commands are executed or not, the APC receiver returns to CONNECT mode automatically. The C-Kermit initialization file defines several macros to let you take advantage of the APC feature. They are to be used at the C-Kermit> prompt, when you are accessing C-Kermit through an APC receiver. They include: PCSEND [ ] Sends the file or files from C-Kermit to the "PC" that's on your desk. (Of course, the PC might also be a UNIX workstation, etc). If the does not contain wildcard characters (that is, it is the name of a single file), you can include the optional "as-name" to send it under a different name. The file or files are sent according to C-Kermit's current FILE TYPE setting, text or binary (except in VMS, where VMS C-Kermit determines the file type and transfer automatically for each file). In other words, the PCSEND macro is exactly like the SEND command, except it automatically puts your local Kermit program into RECEIVE mode, and then back into CONNECT mode again when the transfer is complete. This process is sometimes referred to as "autodownloading". PCGET [ ] This tells C-Kermit to get the specified file or files from your "PC". It puts your local Kermit program into server mode, GETs the specified files from it, then sends it a FINISH command and puts it back in CONNECT mode automatically. The transfer type is governed by C-Kermit's current FILE TYPE setting. This process can be called "autouploading". C-Kermit's response to APC sequences is controlled by the following command: SET TERMINAL APC { ON, OFF, UNCHECKED } The default setting is OFF, meaning that C-Kermit ignores APC sequences unless you tell it otherwise. In the OS/2 version, they are harmlessly absorbed and not displayed. In the UNIX and VMS versions of C-Kermit, they are passed through transparently, in case you want them acted upon by your actual terminal or terminal emulator. To activate the APC feature, use: SET TERMINAL APC ON This allows execution of all commands received in APC sequences except those considered dangerous, such as: PUSH, RUN, !, REDIRECT, DELETE, RENAME, OUTPUT, ENABLE, DISABLE, SCRIPT, and SET TERMINAL APC. With this setting, for example, it would not be possible for someone to send you a "letter bomb" or screen message that contained an APC sequence to execute a command on your computer (because RUN and ! are disabled). The commands allowed by SET TERMINAL APC ON are only the ones which affect Kermit itself, including the initiation of Kermit file transfers. Should you want to enable APC execution of ALL commands, which can be dangerous and is therefore not recommended unless you know exactly what you are doing, you can: SET TERMINAL APC UNCHECKED Use UNCHECKED at your own risk. 3.2. The CONNECT Command The CONNECT command now has an optional "switch", /QUIETLY, to suppress the verbose CONNECT message on versions of C-Kermit (such as UNIX, VMS, etc) that normally give one: C-Kermit>CONNECT /QUIETLY or: C-Kermit>C /Q or even just: C-Kermit C / This switch has no effect on versions of C-Kermit that contain true terminal emulators, such as the OS/2, Windows 95, and Macintosh versions. 3.3. The SET KEY Command The SET KEY command now allows you to press the Return or Enter key after the word KEY to be prompted for a keystroke and then a definition separately. Using this form of the command lets you assign material to a key or key combination without having to know its key code. After you press the key to be assigned, you are shown its current definition, if any. You can cancel by typing Ctrl-C, restore the default definition by pressing the Return or Enter key, or enter a new definition. Example: C-Kermit>set key Press key: Key code \16 => Character: \16 (self, no translation) Definition: blah C-Kermit> NOTE: There are many changes and additions to the key mapping facility in the OS/2 and Windows versions. Please refer to the platform-specific documentation for details. In version 6.0.192, C-Kermit allows you to save your current key map. The command is: SAVE KEYMAP [ [ { NEW, APPEND } ] ] If you don't specify a filename, KEYMAP.INI is used. If you don't specify NEW or APPEND after the filename, a new file is created. If you specify the name of an existing file, and the APPEND, the material is written to the end of the existing file. The keymap is written in the form of a series of SET KEY commands, one for each key that has a non-default definition. Thus you can TAKE a SAVE KEYMAP file to execute all of the SET KEY commands that are in it. 3.4. The SET TERMINAL Command SET TERMINAL DEBUG { ON, OFF } SET TERMINAL DEBUG ON is a synonym for SET DEBUG SESSION. SET TERMINAL DEBUG OFF turns off session debugging without interfering with any other debugging that might be active (such as LOG DEBUG). Session debugging status is displayed in the SHOW TERMINAL display. Edit 190. SET TERMINAL ESCAPE-CHARACTER { ENABLED, DISABLED } ENABLED allows normal processing of the CONNECT-mode escape character. DISABLED causes the CONNECT-mode escape character to be treated like any other data character -- i.e. simply transmitted to the remote computer or service, thus preventing you from being able to escape back or issue any of the other ? commands. On OS/2 and Windows you can still use Alt-X (or whatever \Kexit is assigned to), but in UNIX, VMS, etc, there is no way to get back except logging out from the remote host or service, but only if that normally pops you back to the C-Kermit prompt anyway. DISABLED is mainly intended for use on UNIX, VMS, AOS/VS, etc, when it is "in the middle" and you need a totally transparent connection between the two end systems, e.g. to transfer a file using XMODEM (in which case, also remember to SET COMMAND BYTESIZE 8 and SET TERMINAL BYTESIZE 8). NOTE: There are numerous other new SET TERMINAL commands for Kermit 95 and OS/2 C-Kermit. Please refer to the Kermit 95 or OS/2-specific documentation for details. 3.4. The SET TELNET Command SET TELNET BINARY-MODE { ACCEPTED, REFUSED, REQUESTED } This command tells C-Kermit how it should respond to requests to enter Telnet Binary mode. The default Telnet connection type is Network Virtual Terminal (NVT) mode. By negotiating Binary mode a cleaner 8-bit connection is established which may allow XYZmodem transfers that were not possible before. The default is ACCEPTED. SET TELNET NEWLINE-MODE { ON, OFF, RAW } This command tells C-Kermit what to send during CONNECT mode on a TELNET connection when you type Carriage Return (Return or Enter key). ON (the default) means to send Carriage Return and Linefeed (CRLF); OFF means to send Carriage Return and NUL (ASCII 0). The TELNET protocol Network Virtual Terminal specification says that Carriage Return must always be followed by LF or NUL. However, certain TCP/IP services do not like CRLF or CR-NUL, and so in edit 190, the RAW option was added, which means to send CR as itself, i.e. a plain carriage return. (4) FILE TRANSFER 4.0. New File Transfer Commands (edit 192). 4.0.1. Automatic Transfer Mode Beginning in version 6.0.192, C-Kermit has a new capability to exchange "system-type" information with the other Kermit, and to set its file transfer mode accordingly, automatically. If the other Kermit also has this capability, and indicates that it is on the same type of system (e.g. UNIX) as we are, then C-Kermit performs the following commands implicitly: SET FILE TYPE BINARY SET FILE NAMES LITERAL For VMS-to-VMS transfers, and for OS/2-to-OS/2 transfers, instead of BINARY, we use LABELED, so that complex files can be transferred with all their directory info and attributes and structure intact. Like all features in C-Kermit, you can turn this one off and on if you want to. The command is: SET TRANSFER MODE { AUTOMATIC, MANUAL } AUTOMATIC is the default. Upon exit from protocol, the user's most recent SET FILE TYPE and SET FILE NAMES settings are restored automatically. 4.0.2. Dynamic Packet Timeouts Beginning in version 6.0.192, C-Kermit has the ability to adjust its packet timeouts dynamically according to the observed packet arrival rate, and in fact, does this unless you tell it otherwise: SET SEND TIMEOUT [ { DYNAMIC [ [ ] ], FIXED } ] When the SEND TIMEOUT is FIXED (the old behavior), then the given is always used as the timeout (in seconds) when waiting for a packet to come in. When it is DYNAMIC, the given is the INITIAL timeout, which is adjusted every time a packet arrives based upon a weighted average (in which the most recent packets count the most) and standard deviation of the packet arrival times (with a lower limit of one second and an upper limit of six times ). This should result in faster and more robust error recovery. It also should help prevent file transfer failures when timeouts have been set too low by mistake, as was common in earlier versions when accessing C-Kermit's host from a low-speed modem dialed up to a network terminal server. In case dynamic timeouts become too short, resulting in spurious retransmissions, or too long, resulting in overly long waits for packets that don't show up, you can specify your own minimum and maximum dynamic timeout values after the word DYNAMIC, e.g.: set send timeout 10 dynamic 4 20 The minimum must be greater than 0. The maximum, if greater than 0, is taken literally; if 0, it means to use the default of 6 times , and if less than 0 it means there should be no maximum at all. All numbers are in seconds. These values are shown in the SHOW PROTOCOL display. The fullscreen file transfer display has a new line, "RTT/Timeout", which shows the average round-trip time (RTT -- the amount of time from when a packet was sent until its acknowledgement is received), an indicator of the amount of delay in the connection, and the current timeout, which is based on the rate at which packets arrive, and may or may not be shorter than the RTT. 4.0.3. The MOVE and MMOVE Commands MOVE is like SEND, except if (and only if) the file is sent successfully, it is deleted. Thus MOVE really MOVEs the file from the sending system to the receiving system. MMOVE is like MSEND, but deletes the source files after they are successfully sent. 4.0.4. The BINARY and TEXT Commands BINARY is an "invisible" synonym for SET FILE TYPE BINARY. TEXT and ASCII are invisible synonyms for SET FILE TYPE TEXT. Invisible means they don't show up in the command list when you type ? at the C-Kermit> prompt, but you can still give these commands as shorthands for the longer versions. Edit 192. 4.0.5. The FAST, CAUTIOUS, and ROBUST Macros As of edit 192, there are also three new built-in "macros" (commands that execute a group of commands) that you can use to switch among three levels Kermit file-transfer protocol settings: FAST is equivalent to: SET WINDOW 20 ; or 4, depending on memory configuration SET RECEIVE PACKET-LENGTH 4096 ; or 2200, depending on memory configuration SET PREFIXING MINIMAL CAUTIOUS is equivalent to: SET WINDOW 4 SET RECEIVE PACKET-LENGTH 1000 SET PREFIXING CAUTIOUS ROBUST is equivalent to: SET WINDOW 1 SET RECEIVE PACKET-LENGTH 90 SET PREFIXING ALL 4.0.6. New Default Block Check Type As of edit 192, the default block-check type is 3 -- the 16-bit CRC. If the other Kermit does not support this, C-Kermit falls back to type 1 automatically. 4.0.7. New Auto-up/download Feature SET TERMINAL AUTODOWNLOAD { ON, OFF } When ON (which is the default), and Kermit is in CONNECT mode, Kermit automatically goes into receive mode when the other Kermit sends a file to it. Also works with ZMODEM. The feature works independent of your SET PROTOCOL setting. Autodownloads switch the appropriate protocol (Kermit or ZMODEM) temporarily for the transfer, and then back to the prevailing SET PROTOCOL setting. Edit 192. When your protocol is Kermit, autouploads are also possible. Just tell the remote Kermit program to GET , and the local C-Kermit program goes into server mode automatically, sends the file, exits server mode automatically, and returns to CONNECT mode, also automatically. The same will happen if you give any client command: REMOTE , MAIL, FINISH (though there is not much point in that), BYE (ditto). If you give a REMOTE command whose main purpose is to display something, like REMOTE DIRECTORY, be sure to redirect it to a file or else the results won't have anywhere to go (see section 5.0), e.g.: remote directory > dirfile 4.0.8. Packet Length Slow Start Beginning in 6.0.192, Kermit protocol sends use a "slow start" algorithm for growing the packet length to the maximum negotiated length. If the negotiated packet length is 500 or greater, C-Kermit begins with a packet of 244 bytes, and then doubles the length each time an acknowledgement is received, until the maximum negotiated length is reached or an error occurs. (Note that when the window size is greater than 1, a whole window full of these shorter packets might go out before the first acknowledgement comes back.) The idea is to calibrate the best packet length for the connection, so in case of transmission errors Kermit knows the best length to fall back to. In the event that your connection is known to be relatively free of errors and obstructions, you can turn off the slow-start procedure with: SET TRANSFER SLOW-START OFF 4.0.9. Download Directory SET FILE DOWNLOAD-DIRECTORY [ ] Use this command to specify whether Kermit should place received files into a special "download directory" rather than into its current directory. If you specify a directory name, then all received files will go into that directory, no matter what your current directory is (except that you can override this on a per-file basis with "receive " or "set receive pathnames on"). If you omit the , then incoming files are placed in Kermit's current directory in the absence of any other instructions. Edit 192. 4.0.10. The SEND List Version 6.0.192 also allows you to build up a list of files to be sent, in which each file or group in the list can have its own text/binary transfer mode and its own "as-name". All the files in the list are sent in a single transaction; thus the other Kermit can receive them all with a single RECEIVE command. The new commands are: ADD SEND-LIST [ [ ] ] SHOW SEND-LIST CLEAR SEND-LIST SEND To start a new SEND-LIST, use CLEAR-SEND LIST. Use ADD to add files or file groups to it, and SEND (by itself) to send all the files from the list. Example: CLEAR SEND-LIST SET FILE TYPE TEXT ADD SEND-LIST ck*.h ; Transfer mode defaults to TEXT ADD SEND ck*.c text ; No as-name ADD SEND wart binary ; Transfer mode forced to binary ADD SEND wermit binary ADD SEND ck*.o binary ADD SEND makefile text ckuker.mak ; As-name given SEND The SEND-LIST stays put after the SEND command, in case you want to send it again. To display it, use SHOW SEND-LIST. To get rid of it, use CLEAR SEND-LIST. Even when a SEND list is defined, you can still SEND files in the regular ways, by specifying their name(s) in a SEND or MSEND command, etc, without disturbing the SEND-LIST. The SEND list is intended mainly for use by programs or scripts that generate file lists, although of course it can be used interactively too. For example, a program might build up a list of files and determine whether each one was text or binary depending on some criterion best known to itself, such as whether its name ended in ".EXE". 4.0.11. The -Q Option The -Q command-line option sets all of the file-transfer performance features at once: . 20 window slots . 4K-byte packets (or less, depending on configured packet buffer size) . "Cautious" control-character unprefixing 4.1. File Transfer Recovery Beginning with version (190) the UNIX, Windows 95 and NT, OS/2, AOS/VS, and Amiga versions of C-Kermit, and MS-DOS Kermit 3.14, have the ability to continue interrupted binary-mode file transfers, and also allow you to "manually" recover from certain other types of failures. 4.1.1. The RESEND and REGET Commands The new RESEND command lets you continue a file transfer from the point where it was interrupted (for example, because of a telephone disconnection) without having to retransmit the data that was already successfully transmitted. Imagine, for example, transferring a ten-megabyte file over a 2400-bps modem connection when, after 9 megabytes have been sent, your call-waiting feature kicks in and drops the modem connection. 9 megabytes at 240 cps takes about 11 hours. The remaining megabyte would take about 1.2 hours. The recovery feature lets you complete the failed transfer in the amount of time it takes to send the as-yet-untranmsitted part of the file, rather than sending the entire file again from the beginning -- in this example, a savings of 11 hours. Before seeing how to use this feature, let's look at the restrictions: 1. Recovery works only for binary-mode transfers between computers that have Kermit programs that support this feature. It does not work with any other transfer modes, including text or labeled. In other words, if you want to be able to use the recovery feature, you must tell the file sender to: SET FILE TYPE BINARY In VMS, C-Kermit will switch to binary mode automatically if the file has a fixed record format. You can also force binary-mode transfer in VMS via SET FILE TYPE IMAGE. 2. The original transfer must have been done with SET FILE INCOMPLETE KEEP in effect at the receiver, meaning that incompletely received files are kept rather than discarded. In C-Kermit 5A(190) and later, this is the default, which is a change from previous releases. 3. Recovery only works between two Kermit programs that have this capability and negotiate it successfully. As of this writing, these programs include C-Kermit 5A(190) and later for UNIX, OS/2, VMS, VOS, and the Commodore Amiga, and MS-DOS Kermit 3.14 and later for DOS and Windows. (But see below for a way around this.) 4. You should never use SET FILE COLLISION RENAME if you intend to use the recovery feature (see the CKCKER.BWR file for an explanation). Hint: You can also resend text files as long as you transfer them in binary mode. You can transfer text files in binary mode as long as (a) both computers represent text files in stream-CRLF format, and (b) you do not need character-set translation. To recover a failed upload: reestablish the connection, access the same account and directory to which you were sending the file previously, start Kermit there and put it in RECEIVE or SERVER mode. Then escape back to the local Kermit program and give it these commands: SET FILE TYPE BINARY RESEND filename [ as-name ] The RESEND command should use exactly the same names (and SET FILE NAME options) as the SEND command that was interrupted. When you RESEND a file, the receiving Kermit, upon getting the filename, looks up the file and gets its size; it sends the size back to the sending Kermit, and the sending Kermit resumes sending from that point; the receiving Kermit appends incoming material to the partial file rather than creating a new file. You can recover a failed download in the same way. Just make sure you are accessing the same directories as before, and the files have (or are being sent with) the same names as before. The RESEND command ignores your SET FILE COLLISION setting; thus you need not change your FILE COLLISION setting when RESENDing, and you will not find it altered afterwards either. (But please, as mentioned earlier, do not use SET FILE COLLISION RENAME if you ever intend to use the RESEND command.) If the RESEND command is used, but a partial file of the same name does not exist on the receiving end, RESEND behaves just like SEND -- it sends the whole file. If the file on the receiving is the same size as the sender's copy, RESEND does nothing; both files are left alone (exception: when VMS C-Kermit is receiving a resend, it will replace the file's final block). These properties let you resume the interrupted transfer of a group of files. Suppose you had originally done this: Receiver: Sender: SET FILE INCOMPLETE KEEP SET FILE TYPE BINARY RECEIVE (or SERVER) SEND *.ZIP and the phone hung up in the middle of one of the ZIP files. Just reestablish the connection, and recover this way: Receiver: Sender: SET FILE INCOMPLETE KEEP SET FILE TYPE BINARY RECEIVE (or SERVER) RESEND *.ZIP The files that were already sent are skipped, the file that was partially sent is recovered, and the files that were not sent yet are sent. In order for the recovery feature feature to be useful at all, the default for SET FILE INCOMPLETE was changed from DISCARD to KEEP when the RESEND command was added in edit 190. Otherwise an interrupted transfer would leave no partial file behind unless you had remembered to change the default. But now you have to pay closer attention to Kermit's messages to know whether a transfer succeeded or failed -- previously, if it failed, the file would not show up on the receiving end at all; in edit 190 and later, you'll get a partial file which could easily be mistaken for the complete file unless you change the default back to DISCARD or read the screen messages, or keep a transaction log. Watch out for SET FILE COLLISION RENAME, especially when used in conjunction with recovery. Recall that this option (which is NOT the default) renames the incoming file if a file already exists with the same name (the default is to rename the previously existing file, and store the incoming file with its own name). It is strongly recommended that you do not use SET FILE COLLISION RENAME if you ever intend to use the recovery feature: . When the file is first received by C-Kermit, its name will be changed if another file already has the same name. When you RESEND the same file after a failure, C-Kermit will probably try to append the re-sent portion to the wrong file. . Assuming that you get RESEND to work with FILE COLLISION RENAME, C-Kermit, when receiving the remainder of the file during a RESEND operation, will report back the wrong name. Nothing can be done about this because the name is reported back before the receiving Kermit program finds out that it is a recovery operation. Using RESEND, you can write a script program to REALLY, REALLY send a file. Here is a sample, in which we dial up to a UNIX computer and send the MS-DOS Kermit distribution ZIP file. This script program runs under C-Kermit 5A(190) or later on OS/2 (and with a change in the dialout device name, under UNIX too), and under MS-DOS Kermit 3.14 or later. If the transfer fails, we reestablish the connection and restart the transfer from the point of failure, as many times as it takes to get the file across. ---(cut here)--- ask \%u { username: } askq \%p { \%u's password: } ; ; Settings for entire session. ; define \%s 20 ; Seconds to pause between each try define \%n 7654321 ; Phone number set modem type hayes ; Modem type set port com1 ; Communication port (use /dev/whatever for UNIX) set speed 19200 ; Speed set file type binary ; File transfer mode must be binary set input timeout quit ; This is just to keep the script program short... set count 50 ; Try up to 50 times to send the file goto nomsg ; Skip message the first time :LOOP ; Come here to redial hangup ; Give the phone a rest echo CONNECTION BROKEN. echo Pausing for \%s seconds... sleep \%s Echo redialing... :NOMSG dial \%n ; Dial the phone number if fail goto AGAIN ; Keep trying... output \13 ; System answered, send a carriage return input 15 login: ; Get login prompt output \%u\13 ; Send user ID input 8 Password: ; Get password prompt output \%p\13 ; Send password input 60 {$ } ; Get system prompt cd /kermit ; CD to desired source directory output cd mskermit\13 ; and destination directory input 8 {$ } ; Get system prompt out kermit -r\13 ; kermit -r(eceive) on remote system input 10 KERMIT READY ; Wait for READY message pause 1 ; Plus a second for safety resend msvibm.zip ; RESEND the file if success goto done ; Success means file is completely transferred :AGAIN if count goto LOOP ; Otherwise, try again. Stop 1 Too many tries. ; Too many tries, give up. :DONE echo File transferred OK ; Success, give message output exit\13 ; Log out from remote computer pause 5 ; Give it time... hangup ; Hang up stop 0 Script succeeded ; Finished, the end. ---(cut here)--- The REGET Command allows the client of a Kermit server to request the server to RESEND the given file. 4.1.2. Manual Recovery: The PSEND Command The PSEND ("partial send") command is like the SEND command, but it begins sending from a specified position in the file: PSEND [ ] must refer to a single file, not a file group. is the byte position in (offset into) the file; 0 means the beginning, 1000 means the 1001st byte. As with the SEND command, the file is sent under its own name unless you specify an "as-name". Unlike RESEND, PSEND can be used for both text and binary transfers, and no special capabilities are required of the Kermit program on the receiving end. The PSEND command can be viewed as part of a "do-it-yourself" recovery feature to be used when the other Kermit program does not support recovery. For example, suppose you were sending a file called OOFA when the connection hung up, and that the receiving Kermit program had been instructed to keep incompletely received files (SET FILE INCOMPLETE KEEP). If the transfer was in binary mode, you could note the length of the partial file on the receiving end; let's say it was 123456. Then tell the file receiver to: SET FILE COLLISION APPEND RECEIVE and tell the sender to: SET FILE TYPE BINARY PSEND OOFA 123456 If the receiver does not support SET FILE COLLISION APPEND, you could just use PSEND to create a new file: SET FILE TYPE BINARY PSEND OOFA 123456 OOFA.NEW and then, after the transfer is complete, join the two pieces together on the receiving end, using a system command or utility. 4.2. Control-Character Unprefixing This feature allows you to improve C-Kermit's file transfer performance on connections that you know are transparent to certain control characters. It lets you tell C-Kermit exactly which control characters need to be prefixed and encoded, and which ones can be transmitted "bare" when sending files. SET { SEND, RECEIVE } CONTROL-PREFIX Sets the control-character prefix which C-Kermit uses to the ASCII character represented by the numeric . The must be in the range 33-63 or 96-126. Normally it is 35 (#, number sign). SEND is the one that C-Kermit should use in packets it is sending. RECEIVE should normally never be used, except to override some kind of protocol negotiation foulup with a buggy commercial or shareware Kermit implementation. Synonym: SET { SEND, RECEIVE } QUOTE. SET CONTROL-CHARACTER UNPREFIXED { ..., ALL } Says you think it's safe to include the control character represented by without prefixing in packets which C-Kermit sends. The is the numeric ASCII code for a control character, 1-31, 127-159, or 255. For example, linefeed (code 10) is normally sent as two printable characters, #J. SET CONTROL UNPREFIXED 10 lets linefeed be sent literally. Include the word ALL to unprefix all control characters (except 0). Or you can specify a list of one or more numeric values, separated by spaces, e.g.: SET CONTROL UNPREFIXED 2 4 5 18 20 If you can safely declare a lot of control characters to be UNPREFIXED, you can send binary files (esp. precompressed ones) up to about 20-25% faster. If you include a control character in this category that causes trouble, however, the transfer will fail, so experimentation is necessary. This command will not let you "unprefix" the NUL character (0), nor the following characters if C-Kermit's current FLOW-CONTROL setting is XON/XOFF: 17, 19, 145, 147. Nor can you unprefix character 255 on a TELNET connection (if C-Kermit *knows* it's a TELNET connection). SET CONTROL-CHARACTER PREFIXED { ..., ALL } Says that the given control character(s) must be prefixed in Kermit packets. By default, all control characters, 0-31, 127-159, and 255, are prefixed. SET PREFIXING { ALL, CAUTIOUS, MINIMAL, NONE } (edit 192) This command gives you quick access to commonly-used control-character (un)prefixing configurations: NONE prefixes only 0. MINIMAL prefixes the start- and end-of-packet characters, 0, carriage return (13), and their 8-bit counterparts, and 255. CAUTIOUS is like MINIMAL, plus 3, 16, 17, 19, 28, 29, 30 and their 8-bit counterparts. ALL prefixes all control characters (= SET CONTROL PREFIX ALL) SHOW CONTROL-PREFIXING Displays the current control prefix and a table of all control-character values, showing 1 for each one that will be prefixed and 0 for each one that will not be prefixed. SET REPEAT PREFIX Sets the repeat-count prefix to the ASCII character represented by the numeric . Normally it is 126 (tilde). The must be in the range 33-63 or 96-126. SET REPEAT COUNTS { OFF, ON } Turns the repeat-count compression mechanism off and on. REPEAT COUNTS are ON by default. Turn them OFF in case they cause trouble when used against a faulty Kermit implementation in a shareware or commercial communications program. Or when transferring precompressed files (like .ZIP or .Z files), since it is very rare to find runs of repeated characters, and disabling the repeat-count mechanism frees another character from prefixing, thus resulting in slightly more efficient transfers. The purpose of the SET CONTROL UNPREFIX command is to UNILATERALLY configure C-Kermit to skip prefixing and printable encoding of selected control characters to achieve higher performance when sending files. This feature takes advantage of the fact that most Kermit programs will accept control characters within packet data-fields literally, provided they get through at all, and provided they do not have a special meaning to the receiving Kermit program (such as, in many cases, the packet-start and packet-end characters). There is no protocol negotiation between the two Kermit programs to determine a "safe set" of control characters, and in fact any such negotiation would be largely meaningless, because in most cases the two Kermit programs don't have all the needed information. For example, there might be a terminal server or PAD between them that is sensitive to a particular control character, even though the two Kermit programs are not. If you include in your SET CONTROL UNPREFIXED list one or more control characters that are unsafe, any of several things might happen: 1. Transfer of any file containing these characters will fail. 2. The receiving Kermit program might be interrupted or halted. 3. Your connection might become hung, stuck, or broken. For example because a control character causes a PAD, terminal server, modem, or similar device to go from online mode to command mode. The set of safe control characters depends on the two Kermit programs, their settings, the host operating systems and their settings, the communication and flow control methods, and all the devices, drivers, and protocols that lie between the two Kermit programs. Therefore, this feature is recommended only for use on well-known and often-used connections, so the time invested in finding an optimal unprefixed control-character set will pay off over many file transfers. You must be willing to experiment in order to achieve the optimal safe set. Here is one way. Create a short file containing all 256 possible bytes in sequence and also in pairs, as well as several text strings surrounded by CRLFs; for example, compile and run the following program, redirecting its output to a file: ---(cut here)--- #include main() { int i; puts("\r\n256-byte test pattern:\r\n"); for (i = 0; i < 256; i++) putchar(i); /* singles */ puts("\r\n256-double-byte test pattern:\r\n"); for (i = 0; i < 256; i++) { putchar(i); putchar(i); } /* in pairs */ puts("\r\nEnd of test patterns\r\n"); } ---(cut here)--- To send the file to MS-DOS Kermit from either C-Kermit or MS-DOS Kermit, try the following settings: SET CONTROL UNPREFIXED ALL ; Turn prefixing off for all but 0 SET CONTROL PREFIXED 1 ; Turn it back on for packet-start character SET CONTROL PREFIXED 129 ; and 8-bit version thereof (HINT: Abbreviate SET CON U and SET CON P) Or to send the file from MS-DOS Kermit to C-Kermit, tell MS-DOS Kermit to: SET CON U ALL ; Turn prefixing off for all SET CON P 0 ; Turn it back on for NUL SET CON P 3 ; and for Ctrl-C SET CON P 131 ; as well as Ctrl-C + parity bit NOTE 1: 3 and 131 normally need not be prefixed when sending to C-Kermit 5A(190) or later, nor to 5A(189) if you have SET TRANSFER CANCELLATION OFF. NOTE 2: The start-of-packet character (normally 1 and 129) need not be prefixed when sending files *to* C-Kermit, but must be prefixed when sending files to MS-DOS Kermit. However, you should unprefix this character only on connections that are very clean and fast, where you know there will be no corruption or timeouts. NOTE 3: 13 (carriage return, the customary packet terminator) normally need not be prefixed when sending files to either C-Kermit or MS-DOS Kermit, except on a TELNET connection (because TELNET servers are likely to change CRLF into CR). Try to send the test file in binary mode. If it works, fine. If not, try prefixing some of the other likely control characters (see below). Once you find the minimum set of prefixed control characters for the test file, it is likely they will also work for any other file on the same connection. Try sending a large precompressed (e.g. ZIP or .Z or GZIP) file. And, of course, for maximum performance, also use a window size greater than 1 and a packet length of 1000 or more. Under ideal conditions (totally transparent and clean serial connection, no Xon/Xoff, no TELNET, no parity, and C-Kermit has been told to SET TRANSFER CANCELLATION OFF, see below), the minimum set of control characters that need to be prefixed is: SENDER RECEIVER PREFIXED CONTROLS MS-DOS Kermit MS-DOS Kermit 1 129 MS-DOS Kermit C-Kermit 0 C-Kermit MS-DOS Kermit 0 1 129 C-Kermit C-Kermit 0 For example, to set up C-Kermit to unprefix the minimum set of prefixed control characters for sending files to MS-DOS Kermit, tell C-Kermit to: SET FLOW NONE ; Or SET FLOW RTS/CTS SET CONTROL UNPREFIX ALL SET CONTROL PREFIX 1 129 ; C-Kermit always prefixes character 0 When the mininum set doesn't work, consult this list of control characters that are apt to cause trouble and are therefore likely candidates for prefixing. In particular, note that unprefixing of the packet-start character (normally 1 and 129), can cause problems when sending to C-Kermit if the communication link (including device input buffers) is noisy or apt to lose characters. set con p 0 ; Ctrl-@ = NUL, internal string terminator in C-Kermit. ; Also, often discarded as padding. set con p 1 ; Ctrl-A = Packet-start character. set con p 3 ; Ctrl-C = Packet breakout for remote-mode C-Kermit, ; packet breakout for server-mode MS-DOS Kermit, ; likely to cause interruptions on other systems. set con p 13 ; Ctrl-M = Carriage return, packet-end character. ; Always prefix on TELNET connections. set con p 14 ; Ctrl-N = Shift Out set con p 15 ; Ctrl-O = Shift In set con p 16 ; Ctrl-P = Commonly-used X.25/X.3 PAD escape character set con p 17 ; Ctrl-Q = XON, must be prefixed with Xon/Xoff flow control set con p 19 ; Ctrl-S = XOFF, must be prefixed with Xon/Xoff flow control set con p 27 ; Ctrl-[ = ESC, prefix if going through some kind of ANSI device set con p 28 ; Ctrl-\ = CONNECT-mode escape for C-Kermit set con p 29 ; Ctrl-] = CONNECT-mode escape for TELNET set con p 30 ; Ctrl-^ = Cisco terminal server escape. set con p 127 ; Ctrl-? = DEL, often discarded as padding. ; Also becomes TELNET IAC if parity bit is added. set con p 128 ; = NUL + 128 (i.e. NUL + parity bit) set con p 129 ; = Ctrl-A + 128 set con p 131 ; = Ctrl-C + 128 set con p 141 ; = CR + 128 set con p 145 ; = XON + 128 set con p 147 ; = XOFF + 128 set con p 255 ; 255 = TELNET IAC, must be prefixed on TCP/IP TELNET connections INCLUDING TELNET connections through terminal servers! Note, by the way, that nothing special need be done for SLIP connections, since the four special SLIP characters are in the G1 printable range: 192 SLIP END character 219 SLIP ESC character 220 SLIP END quote 221 SLIP ESC quote Here is a suggested (conservative) starting point for experimenting with control-character unprefixing. Tell the file sender to: SET CONTROL UNPREFIX ALL SET CONTROL PREFIX 0 1 3 13 17 19 127 129 131 141 145 147 255 Perhaps some of these can be removed, depending on the connection, and maybe others need to be added. If you are going through a terminal server or an intermediate Kermit or TELNET program, also add the appropriate escape character values (bare, and plus 128). PREFIXING NOTES: If C-Kermit or MS-DOS Kermit has initiated a TELNET connection, prefixing of 255 (TELNET IAC) is forced automatically. IMPORTANT WARNING: When you have a TELNET connection through a terminal server, neither one of the Kermit programs knows that it's a TELNET connection, and in this case unprefixing of 255 is NOT automatically disabled. This can cause file transfer failures. When in doubt, do not unprefix 255. Kermit will not let you unprefix XON (17), XOFF (19), XON+128 (145), or XOFF+128 (147) if its FLOW-CONTROL setting is XON/XOFF. If you want to unprefix these, make sure *both* Kermits have first been told to SET FLOW NONE (or RTS/CTS), and that XON/XOFF flow control is not in effect anywhere along the communication path between the two Kermits. When sending files to C-Kermit 189 or earlier, and C-Kermit is in remote mode, you should normally tell the file sender to SET CONTROL PREFIX 3 and SET CONTROL PREFIX 131, because C-Kermit 189 and earlier (by default) takes two Ctrl-C's (3 or 131) in a row as cancellation of packet-mode. However, you can UNPREFIX these characters if you know your files do not contain two Ctrl-C's in a row, or if you tell C-Kermit to SET TRANSFER CANCELLATION OFF, or SET TRANSFER CANCELLATION ON when you know that copies of do not occur in a row in the data. When sending files to edit 190 of C-Kermit and later, you can leave 3 and 131 unprefixed unless you have disabled repeat-count compression. 4.3. Keyboard Cancellation of Packet Mode When C-Kermit is in remote mode and in packet mode, the user no longer has normal control of the terminal. Characters typed at the keyboard do not echo, commands have no effect, etc. This is because C-Kermit is trying to read file-transfer protocol packets from your local Kermit program. If you have put C-Kermit into packet mode by giving a SEND, RECEIVE, SERVER, BYE, or similar command, but you did not mean to do this, or you do not have a local Kermit handy to exchange packets with (for example, because you neglected to give a SET LINE or SET HOST command first), you can force C-Kermit back to its prompt by typing a special sequence of characters. By default, the packet-mode interruption character is Control-C (ASCII 3). In edits 189 and earlier, two consecutive copies of this character were required to get out of packet mode, and the parity bit was always ignored. In edit 190 and later, three copies are required by default, and the parity bit is ignored if C-Kermit's PARITY setting is not NONE. On noisy connections, two or three Control-C's might show up as noise; or you might want to allow C-Kermit to accept Control-C characters literally in data packets during file transfer. The following command lets you control this feature: SET TRANSFER CANCELLATION { OFF, ON [ [ is the ASCII code for the control character (0 through 31 or 127) to be used for interruption (the default is 3 = Ctrl-C), and the optional is the number of consecutive copies of the character required to cause interruption. For example, "SET XFER CANCEL ON 6 5" tells C-Kermit to break out of packet mode upon receipt of 5 consecutive Ctrl-F (ASCII 6) characters. Note that the parity bit is ignored for this purpose, so (for example) 3 and 131 are treated the same. If you SET TRANSFER CANCELLATION OFF, you might still need a manual method of getting remote-mode C-Kermit out of packet mode. This can be accomplished by escaping back to your local Kermit and giving a RECEIVE command, then typing E (or Ctrl-E) to send an error packet. Or just type the following Kermit packet: # E* <-- This is a "fatal error" packet. If the remote Kermit is in server mode, you can send a FINISH command, or if you don't have a local Kermit to escape back to, type: $ GF4 <-- This is a FINISH command packet, for the server. The SET TRANSFER CANCELLATION command was installed for the UNIX, VMS, and DG versions of C-Kermit 5A(189). Use SHOW PROTOCOL to find out the current settings. It has affect only when C-Kermit is in remote mode; when C-Kermit has been used to establish a connection to another computer (i.e. when C-Kermit is in local mode), this feature is inactive -- there is no need for it because you have control of the program via the file-transfer interruption characters (X, Z, C, E, etc). In edit 190, the default number of packet-mode cancellation characters was raised from two to three. That is, if you are looking at a remote C-Kermit in packet mode, and have no other way to get back to the C-Kermit> prompt, you'll have to type three consecutive Control-C's (or whatever your transfer cancellation character is), instead of two, by default. This was done to allow SET CONTROL UNPREFIX n (where n = the ASCII code for the cancellation character) to work, even with the default TRANSFER CANCELLATION settings; three or more consecutive copies of any character are transformed by Kermit protocol into a repeat count plus one copy of the character, thus preventing three consecutive Control-C's from appearing as data in a Kermit packet, provided the other Kermit supports repeat-count compression (all popular Kermit implementations do) and it has been successfully negotiated (which it will be unless you take special measures to prevent it; see SET REPEAT above). 4.4. New RECEIVE Command Features In edit 190 and later, the RECEIVE command can accept a device or directory name as an argument, and all incoming files will go into the specified device or directory under the names they were sent with. If the argument is not a device or directory name, it is treated as before: as a name under which to store the (first) incoming file. This change also affects the '-a' ("as-name") command-line option. This feature depends on the symbol CK_TMPDIR being defined at compile time, plus the supporting code for each operating system. Type SHOW FEATURES to see if CK_TMPDIR is defined in your version. As of edit 190, this feature is available in the UNIX, OS/2, and VMS versions of C-Kermit. And of course also in Kermit 95. 4.5. Automatic Directory Creation File names are treated according to the SET FILE NAMES command (see p.114 of "Using C-Kermit"), CONVERTED (the default) or LITERAL. SET FILE NAMES LITERAL means: . When sending files, put the filespec into the outgoing file header packet exactly as the user typed it. What happens on the receiving end is entirely up to the receiver. . When receiving files, use the file specification from the incoming file header exactly as given, so if it happens to include a device or directory specification, C-Kermit attempts to use it, and if the device and/or directory does/do not exist or are not write-accessible, the transfer fails. SET FILE NAMES CONVERTED, which is the default, transforms outgoing filenames by (a) removing device, directory, and other "extraneous" information, (b) uppercasing all lowercase letters, (c) making sure there is no more than one period, and (d) translating all "uncommon" characters to X's. NOTE: As of version 6.0.192, SET FILE NAMES CONVERTED is a bit more liberal, at least on UNIX. Incoming names are lowercased only if they contained NO lowercase letters. When sending, names that contain multiple periods (like cku192.tar.gz) keep the LAST period rather than the first, and change the other ones to underscores rather than X's. A new command allows us to strike a compromise between these two methods: SET { SEND, RECEIVE } PATHNAMES { ON, OFF } SET SEND PATHNAMES ON means to leave pathnames ON outbound file names, which is the default for compatibility with earlier behavior. Note, however, that PATHNAMES are always stripped from outbound filenames when FILE NAMES are CONVERTED, and in Windows and OS/2, disk letters are always stripped. SET SEND PATHNAMES OFF means to strip OFF path information, leaving only the file's name. SET SEND PATHNAME applies only to the filename given directly to a SEND or MSEND command, and not to the "as-name", which is always sent literally and without modification, regardless of SEND PATHNAME or FILE NAMES settings. SET RECEIVE PATHNAMES applies to the filenames in incoming file header packets; ON means to leave the name alone and attempt to use it as-is, OFF means to attempt to strip the path information ON THE ASSUMPTION that any path information found there would be in the notation of the local file system, and therefore recognizable. If not, the results are unpredictable; for example, if a file called MYVAX::DUA0:[OLAF.PICS]MONA_LISA.GIF;17 arrives on a UNIX system, UNIX C-Kermit can not be expected to distinguish the path information from the name (it is a general principle of communication protocols that a particular computer must not be expected to understand the conventions and formats of some other kind of computer). In VMS, UNIX, Windows, and OS/2, SET RECEIVE PATHNAMES has an additional meaning: If the incoming file name contains directory information (such as [.KERMIT]OOFA.TXT, kermit/oofa.txt, or C:\TEXT\LETTERS\ANGRY\OOFA.TXT) -- either absolute or relative -- then, if the named directory, or any of its ancestors, does not exist, Kermit attempts to create it (or them) before opening the output file. For example, suppose your current directory (in UNIX) is /usr/olga/budget, and a file arrives under the name "aaa/bbb/ccc/ddd/bankrupt.txt", and that the /usr/olga/budget/aaa directory already exists, but it does not have a bbb subdirectory. Then Kermit will create the bbb subdirectory, and then the ccc subdirectory under bbb, and then the ddd subdirectory under ccc, and then it will store the bankrupt.txt file in the /usr/olga/budget/aaa/bbb/ccc/ddd directory. In UNIX, tilde notation for usernames (like "~olga") is recognized, and any directories that are created inherit the permissions of their parents, and the owner and group of the user who is running the Kermit program. Naturally, directory creation fails if the user lacks the appropriate permissions. Directory creation fails in Windows or OS/2 if a disk letter is included for a nonexistent or non-writable disk. Use SHOW FILE to display the SEND/RECEIVE PATHNAME settings. 4.6. Pausing Between Packets The new command: SET { SEND, RECEIVE } PAUSE tells C-Kermit to pause the given number of milliseconds (thousandths of seconds) before sending each packet. This might be necessary when communicating with certain devices or over certain kinds of connections. Don't use this except as a final resort, since it slows transfers down. SHOW PROTOCOL displays the current setting. SET SEND PAUSE and SET RECEIVE PAUSE do exactly the same thing. Edit 190. 4.7. Fullscreen File Transfer Display Improvements As of version 6.0.192, the fullscreen file transfer display is the default style in all C-Kermit versions that are capable of producing it; in all others it is the CRT style. 4.7.1. Thermometer Versions of Kermit that support SET FILE DISPLAY FULLSCREEN now are able to show a file-transfer "thermometer" (percent bar-graph) to graphically represent the progress of the file transfer. It can be explicitly selected or deselected via the new trailing argument to this command: SET FILE DISPLAY FULLSCREEN { THERMOMETER, NO-THERMOMETER } A running display of the transfer speed in characters per second (CPS) is also shown; it is computed once per second as the total actual file characters transferred so far versus elapsed time. 4.7.2. Repainting the Screen On multiuser operating systems like UNIX and VMS, it is possible for messages to be sent to your terminal screen while Kermit is in the middle of transferring a file. If you are using the fullscreen file transfer display, this will jumble the formatting. C-Kermit has no way to know this has happened. In edit 190 and later, however, you can make C-Kermit clear and repaint the file transfer display screen by typing Ctrl-L (or L or R or r) while the display is active. Control-W is also accepted for this purpose. This will result in either a full or partial reconstruction of the display, depending on the underlying operating system. Edit 190. 4.7.3. Round Trip Time and Timeout Value As of edit 192, a field labeled "RTT/Timeout" is shown on the fullscreen file transfer display. This is the average, or smoothed, observed round trip time (the time between when a packet is sent and the same packet is acknowledged), in seconds, followed by the current packet timeout, also in seconds, which is calculated dynamically on a per-packet basis based upon the statistical behavior of the round-trip time (approximately the current round-trip time plus three standard deviations). See section 4.0 for details. 4.7.4. Protocol Name In C-Kermit versions that support multiple protocols internally, the fullscreen transfer display shows which protocol is being used. 4.8. Improved Status Codes Like most other C-Kermit commands, file transfer commands such as SEND, RECEIVE, GET, etc, return a status code for use with IF SUCCESS, IF FAILURE, etc. Prior to edit 190, these codes were not always accurate. In particular, if a file was rejected (for any reason at all) via the attribute refusal mechanism, success was always indicated. In edit 190, the status codes have been improved as follows: . If the transfer completes successfully, the status is success. . If a file is refused via the attribute refusal mechanism, the status is failure UNLESS the reason was "date" or "name", in which case the file was not transferred because it was already there (SET FILE COLLISION UPDATE or DISCARD), and so the transfer is considered successful. . If the transfer terminates with an error (E packet), loss of connection, etc, the status is failure. You can use SHOW STATUS after any command to test its success or failure. Also, the \v(status) variable is set to 0 if the most recent command succeeded, and to a nonzero value if it failed. 4.9. Managing Directories MKDIR creates a directory with the given name. The name may be absolute or relative. In Windows and OS/2, forward slashes are allowed as directory separators, which simplifies matters considerably for Kermit script programs. This is in contrast to "run mkdir", which does not accept forward slashes, and therefore requires the Kermit script programmer to use doubled backslashes instead, and becomes even more complicated with the use of variable names. It also differs from "run mkdir" in returning an accurate status code (for IF SUCCESS / IF FAILURE). RMDIR removes the directory with the given name, if it is empty. Same comments about directory separators as for MKDIR. Synonym: RD. 4.10. Printing The SET PRINTER command, added in 6.0.192, controls four things: 1. In C-Kermit versions that have terminal emulators (such as Windows and OS/2), it determines where transparent-print and autoprint material are directed. This does not apply to C-Kermit versions for UNIX, VMS, etc. 2. When C-Kermit is in server mode, it determines where received REMOTE PRINT material goes. 3. It determines where the PRINT command sends its files. 4. With SET DESTINATION PRINTER in effect (section 4.12), it controls where incoming files go. The syntax is: SET PRINTER [ { devicename, filename, command } ] If "set printer" is entered by itself, your default printer is restored, which depends on your operating system and configuration. On systems such as VMS and Windows, where a printer has a device name, you can specify a device name such as LPT:, LPT1:, PRN, or NUL, using the syntax of your operating system for device names to specify a real printer or other device, or the "null" device in case you want all printer output to be discarded. If you specify a filename, then printer output is appended to the given file. To specify a command, use the "pipe" symbol, vertical bar (|), for example: set printer |lpr (UNIX) or: set printer |textps.exe>\dev\lpt1 (Windows or OS/2) If you need to include spaces, enclose the command in curly braces: set printer { | lpr -Pmyprintername } 4.11. Text-File Record-Format Control Edit 192. New command: SET FILE EOL { CR, CRLF, LF } Lets you choose one of three line terminators (Carriage Return only, Carriage Return and Line Feed, or Line Feed only) for purposes of record-format conversion during transfer of files in text mode. This is handy in case you have a text file stored on your computer that is in some other computer's format -- for example, a UNIX-format file on DOS, or vice versa. CR is used on the Macintosh and in OS-9. CRLF is used in DOS, Windows, OS/2, VMS, ... LF is used in UNIX, AOS/VS, ... 4.12. Incoming File Destination Control Added in version 6.0.192: SET [ FILE ] DESTINATION { DISK, PRINTER, SCREEN } This applies to files being received by Kermit protocol. The default is DISK, meaning incoming files are stored on disk in the normal way. PRINTER means they are sent to the current SET PRINTER device (or file, or command; see section 4.10). SCREEN means they are displayed on the screen. (5) NEW CLIENT/SERVER FEATURES 5.0. REMOTE Command Redirection Prior to version 6.0.192, output from REMOTE commands always appeared on the screen; there was no way to direct them elsewhere, such as to a file or a printer. In 6.0.192 and later, any REMOTE command can be followed by a UNIX-style "redirection indicator". Examples: remote directory ; Displays on screen remote directory > filename ; Goes to a (new) file remote directory >> filename ; Appends to a file remote directory | command ; Piped into a command remote directory | command > filename ; .. whose output goes to a file remote directory | command >> filename ; .. or is appended to a file In REMOTE HOST commands, however, redirection indicators are ambiguous: remote host ls -lt > filename Does this mean the command "ls -lt" is to be executed on the host with its output sent a file on the host, or with its output sent to a file on your your local computer? In cases like this, you can "disambiguate" redirectors using braces: remote host blah blah > file ; File on this end remote host { blah blah } > file ; File on this end remote host { blah blah > file } ; File on that end remote host { blah blah > file } > file ; Files on both ends 5.1. New REMOTE Commands The following commands are all new to edit 190. REMOTE PWD Allows the client to ask for the server's current directory in system-independent way. Formerly, this could only be done via system- dependent REMOTE HOST commands. The response is displayed on the screen. REMOTE SET FILE TYPE { TEXT, BINARY, LABELED } The LABELED option has been added to this command in the VMS and OS/2 versions only. Also, the file type specified in this command also takes effect locally. Previously, it was only sent to the server. Edit 190. REMOTE QUERY { KERMIT, SYSTEM, USER } Asks the server to send the value of the variable of the given type that has the given name. If the query succeeds, the value is displayed on your screen and it is also stored in a local read-only Kermit variable, \v(query) If the query fails, an error message is printed and the \v(query) variable is set to the empty string. In C-Kermit and MS-DOS Kermit, "KERMIT" variables are the \v(name) kind, such as \v(time), \v(version), \v(date), etc, or \f...() functions. "SYSTEM" variables are DOS or UNIX environment variables, such as PATH, USER, HOME, or VMS logical names, etc. USER variables are everything else -- \%a-z, \%1-9, and macro names used as long variable names. The of a KERMIT or SYSTEM variable must be given in an implementation-independent format without special syntax, e.g. TIME, DATE, VERSION, PATH, USER, etc, rather than (say) \v(time), \$(PATH). Similarly for functions: "remote query kermit files(oofa.*)" rather than "remote query \ffiles(oofa.*)" However, in most cases, case matters in system variables. The of a USER variable is given in the syntax of the server, e.g. \%a. Examples: C-Kermit>remote query kermit time 13:25:18 C-Kermit>echo The server's time is: \v(query) The server's time is: 13:25:18 C-Kermit>rem q k dir ; Note, abbreviations allowed. /usr/olga/letters C-Kermit>echo The server's current directory is: \v(query) The server's current directory is: /usr/olga/letters C-Kermit>rem q system USER olga C-Kermit>echo user = \v(query) user = olga C-Kermit>remote query kermit files(oofa.*) REMOTE ASSIGN [ ] Asks the server to assign the given to the remote user variable denoted by . The is fully evaluated LOCALLY before being sent to the Kermit server. The maximum length for the value is governed by the maximum negotiated packet length, i.e. the server's RECEIVE PACKET-LENGTH. Synonym: REMOTE ASG. Examples: C-Kermit>remote assign \%a \v(time) ; Assign client's time to server's \%a C-Kermit>remote query user \%a 13:41:18 ; This is the client's time C-Kermit>rem asg myname Olga ; Assign my name to server's myname macro C-Kermit>remote assign oofa \\ffiles(oofa.*) C-Kermit>remote query user oofa To force a string corresponding to a local variable name to be sent literally, use two backslashes: C-Kermit>remote assign \%a \\v(time) ; Assign "\v(time)" to server's \%a. C-Kermit>remote query user \%a 13:41:18 ; This is the server's time. C-Kermit> You can disable and enable the server's handling of REMOTE QUERY and ASSIGN with the commands: DISABLE QUERY The server should not respond to REMOTE QUERY commands DISABLE ASSIGN The server should not respond to REMOTE ASSIGN commands ENABLE QUERY The server should respond to REMOTE QUERY commands ENABLE ASSIGN The server should respond to REMOTE ASSIGN commands By default, like all other ENABLE/DISABLE items, the initial state is ENABLEd. 5.2. "WHATAMI" -- Making Kermit GET more like FTP GET Those who are accustomed to using client/server applications such as FTP expect that certain kinds of commands, when given to the client, will affect the server correspondingly. Most notable among these commands (in FTP's case) are those that set the transfer mode: BINARY, ASCII, etc. In Kermit, however, the transfer mode has always been determined by the file sender, a concept totally unrelated to the client/server distinction, and less than obvious to most people. Furthermore, Kermit programs do not always have a client/server relationship -- there is also the send/receive arrangement. C-Kermit 5A(190) (and later) and MS-DOS Kermit 3.14 (and later) implement a new "What Am I" feature, which operates transparently to the user (i.e. there are no commands to control it), and results in FTP-like operation when: 1. One Kermit program is in SERVER mode, the other is a client, AND: 2. Both Kermit programs support the WHATAMI feature. Currently, these are limited to C-Kermit 5A(190), MS-DOS Kermit 3.14. A forthcoming release of IBM Mainframe Kermit will support it too. Presently, the WHATAMI feature affects only the GET command, and addresses the following scenario: 1. User starts a Kermit server, giving it no special settings. 2. User tells the client to: SET FILE TYPE BINARY SET FILE NAMES LITERAL GET cku190.tar.Z 3. The file is transferred in text mode when the user expected a binary transfer, and the name was converted even though the user wanted it not to be changed. At the beginning of any protocol transaction, the two Kermits exchange "What Am I" information as part of the S or I packet data. This information includes (a) whether I am a client or server; (b) my transfer mode (text or binary); and (c) my file name handling (literal or converted). Then, when the server receives a GET-command packet from the client, AND if WHATAMI information has been successfully exchanged, then the server switches its file transfer mode and file name handling to the client's corresponding modes. Nothing special happens when files are sent TO the server, since this works right anyway, using the previous mechanisms. Hopefully this change will result in more pleasant surprises than unpleasant ones. One Beta tester (a seasoned Kermit user), however, was unpleasantly surprised when he sent the following commands from a client to a server: REMOTE SET FILE TYPE BINARY GET OOFA.ZIP The file arrived in text mode because the client was in text mode. The user was relying of the old rule, by which the file sender informs the file receiver of the transfer mode via the attribute packet, but since the WHATAMI exchange took place after the REMOTE SET, it changed the server's mode back to text. To cure this situation, REMOTE SET FILE TYPE now sets the local file transfer mode too. Should all this sound confusing, remember that the WHATAMI feature (and the other mechanisms for reconciling file transfer mode) make a difference only when the sender and receiver's file transfer modes do not agree. The rules can be summarized like this: 1. To be certain of the file transfer mode, give the same SET FILE TYPE command to both Kermits (exception: when VMS C-Kermit is sending a file, it determines the transfer mode for each file automatically). In case you did not do this, and the transfer modes of the two Kermit programs disagree when the file transfer starts: 2. If the file sender is VMS C-Kermit, it determines the file type automatically unless its file type has been set to IMAGE or LABELED. Otherwise: 3. If both Kermits have the WHATAMI feature, the client program's transfer mode prevails. Otherwise: 4. If both Kermit programs have Attribute-packet capability, the sender will inform the receiver of the transfer mode, and the receiver will switch to the sender's transfer mode automatically. Otherwise: 5. The transfer proceeds with each Kermit program using the transfer mode that the user has told it to use. This can result in mismatches, which are usually not what was intended. Since not all Kermit implementations -- particularly those found in commercial or shareware software packages -- implement the WHATAMI feature or Attribute packets, it is always safest to inform both Kermit programs of the transfer mode prior to file transfer. 5.3. Idle Timeout for Server Edit 192; Windows 95, Windows NT, and OS/2 only. The new command: SET SERVER IDLE-TIMEOUT [ ] Sets a limit on how long C-Kermit is to wait for a command to come in when it is in server mode. The default idle-timeout is 0, which means there is no limit. This feature allows a Kermit server to be set up for a specified amount of time, and then to shut down automatically if it is not used within that amount of time. It does not, however, impose any restriction on the amount of time the server can be in use. After each use, the idle-time limit is restarted. The idle timeout is ignored if Kermit has been told to DISABLE FINISH. 5.4. Internally Generated Directory Listings Beginning with version 6.0.192, C-Kermit, when in server mode and given REMOTE DIRECTORY, REMOTE TYPE, and similar commands, generates the results itself, rather than running a shell command to do it. This is more portable, more secure, less consumptive of resources, and faster. 5.5. Server GET Path The SET SERVER GET-PATH, command, added in edit 192, lets you specify a list of directories for the server to look in when it receives a GET request for a file whose name is not an absolute pathname. (In UNIX, an absolute pathname starts with a slash; in DOS or Windows, with a backslash possibly after a disk letter and colon, etc etc). Directory names are separated by spaces. If the trailing directory separator is omitted, C-Kermit supplies it. Example (UNIX): SET SERVER GET-PATH /usr/olga/ ~olaf /tmp results in: /usr/olga/ /usr/olaf/ (assuming olaf's login directory is /usr/olaf) /tmp/ If a SERVER GET-PATH is set, then it, and only it, is used for finding files whose names are not absolute. The filename from the GET request is appended to the first element in the GET-PATH and C-Kermit checks to see if the file exists. If not, the process repeats for the second and subsequent GET-PATH element until the file is located or the GET-PATH is exhausted. The maximum number of elements in the GET-PATH varies with the C-Kermit implementation, usually somewhere between 16 and 128. Use SHOW FEATURES and look for "MAXGETPATH=". If you want Kermit to look in its current directory when a GET-PATH is in effect, the current directory must be included in the GET-PATH. If the client sends an absolute (fully qualified) pathname, that takes precedence over the GET-PATH. If it sends a relative pathname (or simply a filename), then the directories in the GET-PATH are searched, in the order given, and the file is sent from the first directory in which it is found; if it is not found in any of them, a "File not found" error message is sent. The SERVER GET-PATH takes precedence over DISABLE CD. The GET path, if any, is shown by SHOW SERVER. (6) INTERNATIONAL CHARACTER SETS Since "Using C-Kermit" was published: . Edit 189 of C-Kermit added support for Hebrew character sets. . Edit 190 added Hebrew terminal emulation to OS/2 C-Kermit. . Edit 190 added support for the Hewlett-Packard Roman8 character set. 6.1. Hebrew File Transfer C-Kermit 5A(189) has the following new commands for Hebrew file transfer: SET TRANSFER CHARACTER-SET HEBREW-ISO = ISO 8859-8 Latin/Hebrew Alphabet SET FILE CHARACTER-SET HEBREW-ISO = ISO 8859-8 Latin/Hebrew Alphabet SET FILE CHARACTER-SET CP862 = Hebrew PC Code Page SET FILE CHARACTER-SET HEBREW-7 = DEC 7-Bit (VT100) Hebrew These commands work just like the corresponding commands for Cyrillic character sets, described in Chapter 9 of "Using C-Kermit". When receiving files, C-Kermit recognizes Hebrew files automatically if the file sender tags the file as Hebrew in the Attribute packet, which the file sender should do if it has been given the SET TRANSFER CHARACTER-SET HEBREW command; C-Kermit does not, however, switch automatically to a Hebrew file character-set, so you must choose one in advance if that's what you want. The tag is "I6/138" (these are ISO registration numbers). When sending files in Hebrew mode, of course, C-Kermit includes the same tag. An invertible translation table between Latin/Hebrew and CP862 is used during both terminal emulation and file transfer. The translation table between Hebrew-7 and Latin/Hebrew, however, is not invertible because these character sets are different sizes. Here is an example of uploading a Hebrew file from a PC to UNIX. The PC version is coded in the Hebrew PC code page, and the UNIX version is to be stored in the 7-bit Hebrew character-set so it can be sent as network e-mail: C-Kermit> set file character-set hebrew-7 ; I want a 7-bit version for email C-Kermit> receive ; Wait for the file. ; Escape back to the PC MS-Kermit> set file type text ; Make sure we are in text mode MS-Kermit> set file character-set cp862 ; File coded in Hebrew PC code page MS-Kermit> set xfer character-set hebrew ; Send using ISO Latin/Hebrew MS-Kermit> send rab.oof ; Send the file The file sender automatically tells the file receiver that the transfer character-set is Hebrew. The three Hebrew character sets are also available for use in C-Kermit's TRANSLATE command, which translates a local file from one character-set to another. Thus you can use C-Kermit to convert a local file from, say, Latin/Hebrew to Hebrew-7. C-Kermit's Hebrew file transfer features can be used in conjunction with MS-DOS Kermit 3.13 and later (with which C-Kermit shares the same translation tables to ensure consistent translations) and IBM Mainframe Kermit 4.2 or later, which translates between Latin/Hebrew and IBM CECP 424 (the Hebrew EBCDIC Country Extended Code Page). 6.2. Hebrew Terminal Emulation NOTE: See the HEBREW.DOC file that accompanies OS/2 C-Kermit and Kermit 95 for information about Hebrew terminal emulation in OS/2 C-Kermit. There is no support for right-to-left screen-writing direction or other terminal emulation features in C-Kermit, since C-Kermit (except the OS/2 and Macintosh versions) does not do terminal emulation itself, but just provides a terminal-independent "pipe" to your terminal emulator. However, you can still have C-Kermit provide the character translations during CONNECT mode: SET TERMINAL CHARACTER-SET { HEBREW-ISO, HEBREW-7, CP862 } [ local-cset ] The terminal character-set affects not only CONNECT mode, but also the session log and the TRANSMIT command. You can test for the presence of Hebrew support in your version of C-Kermit using the CHECK HEBREW command or the SHOW FEATURES command. 6.3. The Hewlett Packard Roman8 Character Set C-Kermit 5A(190) adds support for Hewlett Packard ROMAN8 as a file character-set and a terminal character-set. This is an 8-bit character-set roughly equivalent, but not identical, to Latin-1, and (of course) with entirely different encoding. The translations between HP ROMAN8 and Latin-1 are invertible. (7) SCRIPT PROGRAMMING 7.1. New IF Commands Note that all IF conditions can also be used as WHILE conditions. IF DIRECTORY succeeds if is the name of a directory or a file-structured device, fails otherwise. Available, as of edit 190, in UNIX, VMS, Windows 95 and NT, and OS/2. IF FALSE never succeeds. Edit 192. IF NEWER compares modification (or creation) date/times of two files, succeeds if first file is newer than second file. Edit 190. IF REMOTE-ONLY succeeds if C-Kermit was started with the -R (uppercase) command-line option, fails otherwise. This lets you advise C-Kermit that you only intend to use it in remote mode; the initialization and customization files can (and the standard ones do) include IF REMOTE-ONLY commands to skip over time-and-space-consuming items, such as the dialing and services directories, that will not be used in remote mode. This allows Kermit to start more quickly. For examples of use, see the standard initialization file, ckermit.ini / .kermrc. Edit 190. IF TRUE always succeeds. Edit 192. IF EQUAL, IF LLT, IF LGT string comparison commands, as of edit 190, allow the use of braces around comparands that contain imbedded spaces, for example: IF EQUAL {\%a} {sentence with four words} echo They are equal. Prior to edit 190, constructions like this would cause a parse error (see p.239, "Using C-Kermit"). Be sure to use braces around both items. 7.2. New \v() Variables \v(charset) C-Kermit's local character set. Use this (e.g.) in scripts for deciding which character set to use when printing screen messages. \v(connection) When C-Kermit has made a SET LINE or SET HOST connection, this variable tells the connection type: "serial", "tcp/ip telnet", "decnet lat", "decnet cterm", "x.25", etc. If C-Kermit is in remote mode -- i.e. it has not made a connection to another computer -- the value of this variable is "remote". \v(cps) gives speed in characters (bytes) per second of the most recent file transfer. If a group of files was transferred, the figure applies to the whole group. \v(dialnumber) the number (or directory entry name) given most recently to a DIAL command. \v(dialstatus) contains a numeric result code for the most recent DIAL command: -1 No DIAL command given yet 0 DIAL succeeded 1 Modem type not specified 2 Communication device not specified 3 Device can't be opened 4 Communication speed not specified 5 Hangup failure 6 Internal error (memory allocation, etc) 7 Device input/output error 8 DIAL TIMEOUT expired 9 Dialing interrupted by user 10 Modem not ready 11-19 (reserved) 20 Modem command error 21 Failure to initialize modem 22 Phone busy 23 No carrier 24 No dialtone 25 Ring (incoming call) 26 No answer 27 Disconnected 28 Answered by voice 29 Access denied, forbidden call 30 Blacklisted 31 Delayed 32 Fax connection 98 Unknown error 99 Unspecified failure detected by modem NOTE: The fact that these codes exist does not necessarily mean that Kermit will ever return them. That depends upon (a) the modem being configured to return the desired set of result codes (usually with the Xn command, where n is a number; see your modem manual), and (b) Kermit being programmed to know about each such response from each such modem. Example: Most Hayes-like modems will say NO CARRIER if the phone doesn't answer, but can usually be configured (with X4 or somesuch) to give a more specific reason, like BUSY or NO ANSWER. If you don't get the required level of differential of failure reasons, try using the SET MODEM DIAL-COMMAND command to add (say) X4 to the dial command -- e.g. ATD becomes ATX4D. \v(dialresult) The actual text of the message from modem in response to the most recent DIAL, REDIAL, or ANSWER command, e.g. "CONNECT 2400", "NO CARRIER", "NO DIALTONE", "CONNECT 28800/LAPM/V34" \v(download) The SET FILE DOWNLOAD-DIRECTORY value. Edit 192. \v(errno) = Value of the "errno" variable, usually the error returned by the most recent system call. Not necessarily totally reliable, but might aid in debugging scripts, especially commands that open or close devices or files, or that do file or device input or output. \v(errstring) = The error message, if any, associated with the current value of \v(errno), from the system's error-message list. \v(evaluate) = result of most recent EVALUATE command Edit 190. \v(exedir) = The directory the C-Kermit executable is located in. Edit 192. (K95 and OS/2). \v(fsize) = Size of last transfered file. Edit 190. \v(ftype) = current FILE TYPE setting: "text" or "binary". In OS/2 and VMS, also "labeled". In VMS only, also "image". \v(inidir) = directory the INI file is located in. (K95 and OS/2 only) Edit 192. \v(instatus) = result of the most recent INPUT command: -1 = No INPUT command given yet 0 = Succeeded 1 = Timed out 2 = Interrupted by user (keystroke or SIGINT) 3 = Internal error 4 = I/O error or connection lost \v(ipaddress) The IP address of the computer that C-Kermit is running on. This variable is set when you first make an IP connection; prior to that it is empty. \v(keyboard) (K95 and OS/2 only), the keyboard model: "88", "101", "102", or "122". \v(minput) = number telling which MINPUT search string was matched: 0 = none of them; 1 = the first one, etc. (see section on MINPUT below). \v(modem) = current modem type (SET MODEM TYPE value). Various modem setup strings. Edit 192: \v(m_aa_off) = Command to turn Auto Answer Off. \v(m_aa_on) = Command to turn Auto Answer On. \v(m_dc_off) = Data Compression Off. \v(m_dc_on) = Data Compression On. \v(m_dial) = Dial a number. \v(m_ec_off) = Error Correction Off. \v(m_ec_on) = Error Correction On. \v(m_fc_hw) = Flow Control Hardware. \v(m_fc_no) = Flow Control None. \v(m_fc_sw) = Flow Control Software. \v(m_hup) = Hangup. \v(m_init) = Initialization. \v(m_pulse) = Pulse Dialing. \v(m_tone) = Tone Dialing. \v(newline) is the newline character or sequence appropriate to the operating system where C-Kermit is running, for example linefeed (\10) for UNIX, carriage return (\13) for OS-9, carriage-return linefeed (\13\10) for OS/2 and Windows. \v(packetlen) = current RECEIVE PACKET-LENGTH. \v(parity) = current PARITY setting: "even", "odd", "mark", "none", or "space". \v(protocol) The SET PROTOCOL value. Edit 192. \v(rexx) (os/2 32-bit only) = the return value from the last Rexx command issued. \v(rows) = the number of rows (lines) on the console terminal / screen, i.e. its length, -1 if unknown. \v(cols) = the number of columns on the console terminal / screen, i.e. its width, -1 if unknown.. \v(terminal) = terminal type, if known, otherwise "unknown". \v(tmpdir) = directory for creating temporary files. Value is system- dependent and can be hardwired (e.g. /tmp/ for UNIX), or come from environment variables (e.g. TMP or TEMP in OS/2 or Windows), and in any case can be overriden by the user with SET TEMP-DIRECTORY. \v(query) = result of most recent REMOTE QUERY command. \v(select) (OS/2 and Kermit 95 only) Current (mouse) selection in terminal screen, if any. \v(space) = number of free bytes on current storage device (OS/2 and K95 only). \v(startup) (OS/2 & K95 only) Disk:Directory from which C-Kermit was started. \v(sysid) = Kermit system/OS code, from pp.275-278 of the Kermit book: U8 = MS-DOS (and Windows) U1 = UNIX D7 = VMS UD = OS-9 L3 = Amiga A3 = Macintosh UO = OS/2 F3 = AOS/VS K2 = Atari ST MV = Stratus VOS UN = Kermit-95 (Windows 95 and Windows NT) etc... \v(userid) = Username as reported by the Operating System (K95). Or as defined in the USER environment variable (OS/2), or as set by SET LOGIN USERID, or by the last RLOGIN command. Edit 192. \v(window) = Current SET WINDOW size. \v(xversion) = The product-specific C-Kermit version number, for versions that are given numbers other than the main C-Kermit version number, e.g. 115 for Kermit 95 1.1.5; otherwise 0 (for UNIX, VMS, etc). \v(_line) = The current line number from the current command file, if any; 1-based. If no command file is active, then 0. Dialing-related (edit 192): \v(d$ac) = SET DIAL AREA-CODE value. \v(d$cc) = DIAL COUNTRY-CODE value. \v(d$lp) = DIAL LD-PREFIX value. \v(d$ip) = DIAL INTL-PREFIX value. 7.3. New \f() Functions In edit 192, all numeric arguments are automatically treated as expressions, so it is no longer necessary to enclose expressions in numeric function argument fields within calls to \feval(). For example: Pre-192: echo \findex(x,abcxyz,\feval(1+1)) 192: echo \findex(x,abcxyz,1+1) Functions affected include: \fchar() \findex() \flpad() \fmax() \fmin() \fmod() \frepeat() \fright() \frindex() \frpad() \fsubstring() \fverify() Of course the old way still works too. In edit 192, function argument processing was corrected to allow grouping with braces, so that commas or parentheses can be included as part of a function argument. Examples: Value..... Old New \flength(abc) 3 3 \flength({abc}) 5 3 \flength(a{b}c) 5 3 \flength({{abc}}) 7 5 \flength(a,b,c) 1 1 \flength({a,b,c}) 2 5 \flength(a{,}b{,}c) 9 5 Note that only outermost braces are stripped, and inner ones are kept, so whenever you need to include braces themselves, just double them up. Note that \fliteral is an exception -- whatever goes in the parentheses is returned literally. \Fbreak(s,c) Returns the left substring of the string s up until the first occurrence of the character c, like the Snobol BREAK function. If the character c does not occur in the string s, or is omitted, the entire string s is returned. If the second argument contains more than one character, only the first character is used. \Fcapitalize(s) Returns the string s with its initial letter uppercased and all subsequent letters lowercased. Synonym: \Fcaps(). \Fdate(filename) returns the modification (or creation) date of the given file in "yyyymmdd hh:mm:ss" format, or else the empty string upon failure. As of edit 190, available in UNIX, VMS, and OS/2 versions. \Fhexify(s) Returns the hexadecimal representation of the argument string s. \Fipaddr(s,n) Finds and returns the first IP address in string s starting at position n (= 1 by default). IP address must be four decimal numeric fields of 1-3 digits each, separated by periods. No range checking is done (i.e. for 255 or less). Use with \v(input) to parse IP addresses given, e.g., during SLIP or PPP setup. Edit 192. \Fltrim(s1[,s2]) "Left trim". Returns the string that is obtained by removing all characters from the left of string s1 that are also in string s2, stopping with the first character that is not in s2. If s2 is omitted, space and tab ("whitespace") are removed. Also see \Ftrim(). \Fmodulus(n1,n2) Returns the remainder obtained after dividing n1 by n2. Equivalent to \Feval(n1%n2). \Freplace(s1,s2,s3). This function replaces all occurrences of the string s2 in the string s1 by the string s3. s1 and s2 must be at least one character long. s3 can be omitted, in which case all occurrences of s2 are removed from s1. If s2 is omitted, s1 is returned unchanged. Examples: \freplace(oofa,o,O) = OOfa \freplace(oofa,o,oo) = oooofa \freplace(oofa,o) = fa \freplace(oofa) = oofa or (more practically for DOS, Windows, and OS/2): \freplace(\v(cmdfile),\\,/) ; replace backslashes by forward slashes \Frindex(s1,s2,n) - Right index. Searches for string s1 in string s2 starting from the right. If the optional number n is included, the rightmost n characters of s2 are ignored. Returns the index (position) of the rightmost occurrence of string s2 in s1 (ignoring the rightmost n characters of s2). \Fsize(filename) tells the size, in characters (bytes), of the given file. \Fspan(s1,s2) Returns the left substring of s1 that contains only characters from s2, like the Snobol SPAN function. \Ftod2secs(hh:mm:ss) Converts a time of day, expressed in 24-hour clock notation, to seconds since midnight. Example: \Ftod2secs(12:01:01) gives 43261. Note: \ftod2secs(\v(time)) should be equal to \v(ntime). \Ftrim(s1[,s2]) Returns the string that is obtained by removing all characters from the right of s1 that are also in s2, stopping with the first character that is not in s2. If s2 is omitted, space and tab ("whitespace") are removed. Also see \Fltrim(). \Funhexify(string) Converts a hexadecimal string to its normal representation. If the string contains any non-hex characters (i.e. other than 0-9, a-f or A-F), or has an odd length, the empty string is returned. \Fverify(s1,s2,n) returns the index (position) of the first character in s2 that is not also in s1. If n is given, we only look at s2 beginning at position n. Use for preverifying hex numbers, phone numbers, etc. 7.4. INPUT and OUTPUT Command Improvements (Also see section 7.5, the MINPUT command.) (Also see section 7.6, "wait until given time of day" feature.) As of edit 192, in the Windows and OS/2 versions -- i.e. the version with terminal emulators -- INPUT material is also passed through the terminal emulator. Thus, even though Kermit is not in CONNECT mode, the virtual screen is being updated correctly, and, perhaps more important, the terminal emulator automatically responds to queries -- such as "What Are You?" and "What Is Your Screen Size?" -- from the host. Thus it is no longer necessary (or advisable :-) for script programs to look for query escape sequences and send their own responses. As of edit 190, the INPUT and OUPUT commands are buffered, which results in greater speed of execution. In edit 192, a new variable, \v(instatus) was added to hold the result of the most recent INPUT command. So now, for example, it is possible to tell whether an INPUT failed because it timed out or because the user interrupted it by pressing a key. See section 7.2, New \v() Variables. The new command: SET INPUT BUFFER-LENGTH Lets you specify the size of the INPUT buffer, in bytes. Previously it was a fixed size of 256 bytes. Normally this presents no particular problem, since the INPUT and REINPUT commands handle wraparound and so forth just fine. However, it prevents the REINPUT command from working when the search target was more than 256 bytes "behind" the "front end" of the buffer. In cases like this, you can SET INPUT BUFFER-LENGTH to be any size you want, within reason. The new command: SET OUTPUT PACING causes C-Kermit to pause for (at least) the indicated number of milliseconds (thousandths of a second) between each character in the OUTPUT string. Use this option when OUTPUT'ing characters to a device that can't receive characters at the full communication speed without losing or garbling them. The default OUTPUT PACING is 0, i.e. no pauses. Display with SHOW SCRIPTS. Edit 189. The OUTPUT command accepts three special notations for sending special signals or characters: \B or \b Send a BREAK signal. On serial connections, this is a 250 millisecond spacing condition. On network connections, it is a network-specific BREAK protocol message, such as a TELNET BREAK. \L or \l Send a Long BREAK signal. On serial connections, this is a 1.5-second spacing condition. On network connections, it is the same as \B (BREAK). \N or \n Send a NUL (ASCII 0) character. \0 can't be used for this because it is the terminator for C-language strings. (\N is new to edit 190.) If you need to send \B, \L, or \N literally (e.g. to configure certain kinds of modems), you can use either: OUTPUT \fliteral(\B) (or \fliteral(\L) or \fliteral(\N)) or: OUTPUT \\B (or \\L or \\N) Note: \fliteral() can be abbreviated, e.g. \flit(\N). Or, you can SET COMMAND QUOTING OFF. NOTE: None of this worked quite right prior to version 6.0.192. 7.5. The MINPUT Command The MINPUT command ("multiple input"), added in version 5A(190), is a variation on the INPUT command that looks for more than one string at a time. Syntax: MINPUT [ string1 [ string2 [ string2 [ ... ] ] ] ] Strings are separated by spaces. If any of the search strings is encountered within the timeout interval, the command succeeds and the \v(minput) variable is set to the number of the string that was found: 1, 2, 3, etc. If none of the search strings is found, the command times out, fails, and \v(minput) is set to 0. All SET INPUT paramaters apply - SET INPUT CASE, etc. Example: minput 30 Login: Username: Ready if success goto LBL\v(minput) end 1 Prompt didn't arrive. looks for any of the three strings "Login:", "Username:", or "Ready" and then goes to one of the labels "LBL1", "LBL2", or "LBL3", depending on which string was matched. To include a space in a string, enclose it in { braces }. minput 20 {a b} c This searches for either "a b" or "c". As in the regular INPUT and REINPUT commands, leading and trailing spaces are stripped from each search string unless it is enclosed in { braces }. Example: minput 20 { abc }, {{ def }}, ghi searches for " abc ", "{ def }", or "ghi". 7.6. Other New or Improved Script Programming Commands UNDEFINE Undefines the named variable or macro (edit 192). This is the same as giving a DEFINE or ASSIGN command for it without a definition. SET ALARM / IF ALARM / SHOW ALARM (edit 192) These work as in MS-DOS Kermit and were added for compatibility. "SET ALARM n" starts an n-second timer. "SET ALARM 22:30:00" sets a timer for the indicated time. IF ALARM succeeds if the timer has expired, fails if there is still some time left on the timer. SHOW ALARM shows the data/time at which the timer expires. SET ALARM by itself (no "n" or "hh:mm:ss") clears any pending alarm. Alarms cannot be nested. SET TEMP-DIRECTORY [ ] Lets you override the value of the \v(tmpdir) variable, which can be used in scripts in a system-independent fashion to indicate the place for creating temporary files. EVALUATE The new EVALUATE command evaluates arithmetic expressions for you, printing the answer. It is exactly like the \feval() function described in the book, but for interactive use: you can type the expression directly, and the answer is printed, e.g.: C-Kermit> evaluate 1+1 2 C-Kermit> eval 6! 720 C-Kermit> def \%a (7 + 8) C-Kermit> ev (1 + 2) * (\%a - 3) 36 For convenience in typing, the EVALUATE command accepts some special notation for the number base. If a number ends in "h" or "x", it is treated as hexadecimal. If it ends in "o" or "q", it is treated as octal. If it ends in "t", it is treated as binary, e.g.: C-Kermit> eval ffh & 0101t 5 Of course you could also use "eval \xff & 5" (C-Kermit presently does not have backslash notation for binary numbers). Note: This same special notation can also be used in the \fevaluate() function: C-Kermit> echo \feval(ffh & 0101t) 5 FORWARD