Imported Upstream version 302
[ckermit.git] / ckcbwr.txt
1
2    [1]The Columbia Crown The Kermit Project | Columbia University
3    612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu
4    ...since 1981
5    [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ
6    [10]Support
7
8    As of: C-Kermit 9.0.300, 30 June 2011
9    This page last updated: Tue Jun 28 08:54:30 2011 (New York USA Time)
10
11      IF YOU ARE READING A PLAIN-TEXT version of this document, it is a
12      plain-text dump of a Web page. You can visit the original (and
13      possibly more up-to-date) Web page here:
14
15   [11]http://www.columbia.edu/kermit/ckcbwr.html
16
17    This document contains platform-independent C-Kermit hints and tips.
18    Also see the platform-specific C-Kermit hints and tips document for
19    your platform, for example:
20
21   [12]http://www.columbia.edu/kermit/ckubwr.html
22
23    for Unix. This document also applies to [13]Kermit 95 for Windows,
24    which is based on C-Kermit.
25
26    [ [14]C-Kermit ] [ [15]TUTORIAL ]
27
28 CONTENTS
29
30    0. [16]PATCHES
31    1. [17]INCOMPATIBLE CHANGES
32    2. [18]THE C-KERMIT COMMAND PARSER
33    3. [19]MULTIPLE SESSIONS
34    4. [20]NETWORK CONNECTIONS
35    5. [21]MODEMS AND DIALING
36    6. [22]DIALING HINTS AND TIPS
37    7. [23]TERMINAL SERVERS
38    8. [24]TERMINAL EMULATION
39    9. [25]KEY MAPPING
40   10. [26]FILE TRANSFER
41   11. [27]SCRIPT PROGRAMMING
42
43 0. PATCHES
44
45    [ [28]Top ] [ [29]Contents ] [ [30]Next ]
46
47    Source-level patches for C-Kermit 8.0.211:
48
49      (None)
50
51 1. INCOMPATIBLE CHANGES
52
53    [ [31]Top ] [ [32]Contents ] [ [33]Next ]
54
55    These are not necessarily exhaustive lists.
56
57 1.1. C-Kermit 6.0
58
59    C-Kermit 6.0 was released 6 September 1996 and is completely documented
60    in [34]Using C-Kermit, 2nd Edition. The following incompatible changes
61    were made in C-Kermit 6.0:
62
63      * Unless you tell C-Kermit otherwise, if a serial or network
64        connection seems to be open, and you attempt to EXIT or to open a
65        new connection, C-Kermit warns you that an active connection
66        appears to be open and asks you if you really want to close it. If
67        you do not want these warnings, add SET EXIT WARNING OFF to your
68        customization file or script, or give this command at the prompt.
69      * The default for SET { SEND, RECEIVE } PATHNAMES was changed from ON
70        to OFF, to prevent unexpected creation of directories and
71        depositing of incoming files in places you might not know to look.
72      * The default for SET FILE INCOMPLETE was changed from DISCARD to
73        KEEP to allow for file transfer recovery.
74      * The default file-transfer block-check is now 3, rather than 1. If
75        the other Kermit does not support this, the two will drop back to
76        type 1 automatically unless the other Kermit fails to follow the
77        protocol specification.
78      * The default flow-control is now "auto" ("do the right thing for
79        each type of connection"), not Xon/Xoff.
80      * Backslash (\) is no longer a command continuation character. Only -
81        (hyphen, dash) may be used for this in C-Kermit 6.0 and later.
82      * Negative INPUT timeout now results in infinite wait, rather than 1
83        second.
84
85 1.2. C-Kermit 7.0
86
87    C-Kermit 7.0 was released 1 January 2000. Its new features are
88    documented in the C-Kermit 7.0 Supplement,
89    [35]http://www.columbia.edu/kermit/ckermit2.html. The following
90    incompatible changes were made in C-Kermit 7.0:
91      * The "multiline GET" command is gone. Now use either of the
92        following forms instead:
93   get remote-name local-name
94   get /as-name:local-name remote-name
95
96        If either name contains spaces, enclose it in braces (or, in
97        C-Kermit 8.0, doublequotes).
98      * To include multiple file specifications in a GET command, you must
99        now use MGET rather than GET:
100   mget file1 file2 file3 ...
101
102      * C-Kermit 7.0 and later use FAST Kermit protocol settings by
103        default. This includes "unprefixing" of certain control characters.
104        Because of this, file transfers that worked with previous releases
105        might not work in the new release especially against a
106        non-Kermit-Project Kermit protocol implementation (but it is more
107        likely that they will work, and much faster). If a transfer fails,
108        you'll get a context-sensitive hint suggesting possible causes and
109        cures. Usually SET PREFIXING ALL does the trick.
110      * By default C-Kermit 7.0 and later send files in text or binary mode
111        by looking at each file to see which is the appropriate mode. To
112        restore the previous behavior, put SET TRANSFER MODE MANUAL and the
113        desired SET FILE TYPE (TEXT or BINARY) in your C-Kermit
114        initialization file.
115      * The RESEND and REGET commands automatically switch to binary mode;
116        previously if RESEND or REGET were attempted when FILE TYPE was
117        TEXT, these commands would fail immediately, with a message telling
118        you they work only when the FILE TYPE is BINARY. Now they simply do
119        this for you.
120      * SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10 and
121        138) in case rlogin, ssh, or cu are "in the middle", since
122        otherwise <LF>~ might appear in Kermit packets, and this would
123        cause rlogin, ssh, or cu to disconnect, suspend,escape back, or
124        otherwise wreck the file transfer. Xon and Xoff are now always
125        prefixed too, even when Xon/Xoff flow control is not in effect,
126        since unprefixing them has proven dangerous on TCP/IP connections.
127      * In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built
128        into C-Kermit itself rather than implemented by running an external
129        command or program. The built-in command might not behave the way
130        the platform-specific external one did, but many options are
131        available for customization. Of course the underlying
132        platform-specific command can still be accessed with "!", "@", or
133        "RUN" wherever the installation does not forbid. In UNIX, the "ls"
134        command can be accessed directly as "ls" in C-Kermit.
135      * SEND ? prints a list of switches rather than a list of filenames.
136        If you want to see a list of filenames, use a (system-dependent)
137        construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND
138        []? (VMS), etc.
139      * In UNIX, OS-9, and Kermit 95, the wildcard characters in previous
140        versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and
141        }, with dash used inside []'s to denote ranges and comma used
142        inside {} to separate list elements. If you need to include any of
143        these characters literally in a filename, precede each one with
144        backslash (\).
145      * SET QUIET { ON, OFF } is now on the command stack, just like SET
146        INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458
147        of [36]Using C-Kermit, 2nd Edition. This allows any macro or
148        command file to SET QUIET ON or OFF without worrying about saving
149        and restoring the global QUIET value. For example, this lets you
150        write a script that tries SET LINE on lots of devices until it
151        finds one free without spewing out loads of error messages, and
152        also without disturbing the global QUIET setting, whatever it was.
153      * Because of the new "." operator (which introduces assignments),
154        macros whose names begin with "." can not be invoked "by name".
155        However, they still can be invoked with DO or \fexecute().
156      * The syntax of the EVALUATE command has changed. To restore the
157        previous syntax, use SET EVALUATE OLD.
158      * The \v(directory) variable now includes the trailing directory
159        separator; in previous releases it did not. This is to allow
160        constructions such as:
161   cd \v(dir)data.tmp
162
163        to work across platforms that might have different directory
164        notation, such as UNIX, Windows, and VMS.
165      * Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and
166        sticky. In C-Kermit 7.0, there is an array of default flow-control
167        values for each kind of connection, that are applied automatically
168        at SET LINE/PORT/HOST time. Thus a SET FLOW command given before
169        SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can
170        be guaranteed to have the desired effect only if given after the
171        SET LINE/PORT/HOST command.
172      * Character-set translation works differently in the TRANSMIT command
173        when (a) the file character-set is not the same as the local end of
174        the terminal character-set, or (b) when the terminal character-set
175        is TRANSPARENT.
176
177 1.3. C-Kermit 8.0
178
179    The following incompatible changes were made in C-Kermit 8.0:
180      * C-Kermit now accepts doublequotes in most contexts where you
181        previously had to use braces to group multiple words into a single
182        field, or to force inclusion of leading or trailing blanks. This
183        might cause problems in contexts where you wanted the doublequote
184        characters to be taken literally. Consult [37]Section 5 of the
185        [38]C-Kermit 8.0 Update Notes for further information.
186      * Using the SET HOST command to make HTTP connections is no longer
187        supported. Instead, use the new [39]HTTP OPEN command.
188
189 1.4. C-Kermit 9.0
190
191    The [40]\fsplit() function is incredibly handy, it can do almost
192    anything, up to and including parsing a LISP program (the underlying
193    code is the basis of the [41]S-Expression interpreter). But did you
194    ever try to use it to parse (say) a Tab-Separated-List (TSV file) or
195    Comma-Separated-List (CSV)? It works as expected as long as the data
196    contains only 7-bit characters. But if your data contains (say) Spanish
197    or German or Russian text written in an 8-bit character set such as ISO
198    8859-1, every 8-bit character (any value 128-255) is treated as a break
199    character. This is fixed in C-Kermit 9.0 by treating all 8-bit bytes as
200    "include" characters rather than break characters, a total reversal of
201    past behavior. I don't think it will affect anyone though, because if
202    this had happened to anyone, I would have heard about it!
203
204    Since most standard 8-bit character sets have control characters in
205    positions 128-160, it might have made sense to keep 128-160 in the
206    break set, but with the proliferation of Microsoft Windows code pages,
207    there is no telling which 8-bit character is likely to be some kind of
208    text, e.g. "smart quotes" or East European or Turkish accented letters.
209
210 2. THE C-KERMIT COMMAND PARSER
211
212    [ [42]Top ] [ [43]Contents ] [ [44]Next ] [ [45]Previous ]
213
214    Various command-related limits are shown in the following table, in
215    which the sample values are for a "large memory model" build of
216    C-Kermit, typical for modern platforms (Linux, Solaris, AIX, VMS, etc).
217    You can see the values for your version of Kermit by giving the SHOW
218    FEATURES command. The maximum length for a Kermit command (CMDBL) also
219    determines the maximum length for a macro definition, since DEFINE is
220    itself a command. The maximum length for a variable name is between 256
221    and 4096 characters, depending on the platform; for array declarations
222    and references, that includes the subscript.
223
224    Item Symbol Sample
225    Value Definition
226    Number of characters in a command CMDBL 32763 ckucmd.h
227    Number of chars in a field of a command    ATMBL 10238 ckucmd.h
228    Nesting level for command files MAXTAKE 54   ckuusr.h
229    Nesting level for macros MACLEVEL 128 ckuusr.h
230    Nesting level for FOR / WHILE loops FORDEPTH 32 ckuusr.h
231    Number of macros MAC_MAX 16384 ckuusr.h
232    Size of INPUT buffer INPBUFSIZ 4096 ckuusr.h
233    Maximum files to match a wildcard MAXWLD    102400 ckcdeb.h
234    Filespecs in MSEND command MSENDMAX 1024 ckuusr.h
235    Length for GOTO target label LBLSIZ 50 ckuusr.h
236    \fexecute() recursion depth limit CMDDEP 64 ckucmd.h
237
238    If you need to define a macro that is longer than CMDBL, you can break
239    the macro up into sub-macros or rewrite the macro as a command file. In
240    a pinch you can also redefine CMDBL and recompile C-Kermit. All of
241    these numbers represent tradeoffs: the bigger the number, the more
242    "powerful" Kermit in the corresponding area, but also the bigger the
243    program image and possibly disk footprint, and the longer it takes to
244    load and initialize.
245
246    In the interactive command parser:
247
248      * EMACS- or VI-style command line editing is not supported.
249      * Editing keys are hardwired (Ctrl-U, Ctrl-W, etc).
250
251    If you interrupt C-Kermit before it has issued its first prompt, it
252    will exit. This means that you cannot interrupt execution of the
253    initialization file, or of an "application file" (file whose name is
254    given as the first command-line argument), or of an alternative
255    initialization file ("-y filename"), and get to the prompt. There is,
256    however, one exception to this rule: you *can* interrupt commands --
257    including TAKE commands -- given in the '-C "command list"'
258    command-line argument and -- if there were no action commands among the
259    command-line arguments -- you will be returned to the C-Kermit prompt.
260    So, for example, if you want to start C-Kermit in such a way that it
261    executes a command file before issuing its first prompt, and you also
262    want to be able to interrupt the command file and get to the prompt,
263    include a TAKE command for the desired command in the -C argument, for
264    example:
265
266   kermit -C "take dial.scr"
267
268    At the command prompt, if you use the backslash (\) prefix to enter a
269    control character, space, or question mark into a command literally,
270    the backslash disappears and is replaced by the quoted character. If it
271    was a control character, it is shown as a circumflex (^). This allows
272    editing (backspace, delete, Ctrl-W) to work correctly even for control
273    characters.
274
275    Priot to C-Kermit 8.0, the only way to include a comma literally in a
276    macro definition -- as opposed to having it separate commands within
277    the definition -- is to enter its ASCII value (44) in backslash
278    notation, e.g.:
279
280   DEFINE ROWS RUN MODE CO80\{44}\%1
281
282    In C-Kermit 8.0 you can use constructions like this:
283
284   DEFINE ROWS RUN MODE "CO80,\%1"
285
286    If you quote special characters in a filename (e.g. in the SEND
287    command), filename completion may seem to work incorrectly. For
288    example, if you have a file whose name is a*b (the name really contains
289    an asterisk), and you type "send a\\*<ESC>", the "b" does not appear,
290    nor will Ctrl-R redisplay the completed name correctly. But internally
291    the file name is recognized anyway.
292
293    Question-mark help does not work during execution of an ASKQ command.
294    The question marks are simply accepted as text.
295
296    In OUTPUT commands only, \B sends a BREAK signal, \L sends a Long BREAK
297    signal, and \N sends a NUL (ASCII 0). BREAK and Long BREAK are special
298    signals, not characters, and NUL is a character that normally cannot be
299    included in a C string, since it is the C string terminator. If you
300    really want to output a backslash followed by a B, an L, or an N (as is
301    needed to configure certain modems, etc), double the backslash, e.g.
302    "output \\B". In C-Kermit 7.0 or later, you can disarm and re-arm the
303    special OUTPUT-command escapes (\B, \L, and \N) with SET OUTPUT
304    SPECIAL-ESCAPES { OFF, ON }.
305
306    When using the command-line processor ("kermit -l /dev/tty00 -b 19200",
307    etc), note that in some cases the order of the command-line options
308    makes a difference, contrary to the expectation that order of
309    command-line options should not matter. For example, the -b option must
310    be given after the -l option if it is to affect the device specified in
311    the -l option.
312
313 3. MULTIPLE SESSIONS
314
315    [ [46]Top ] [ [47]Contents ] [ [48]Next ] [ [49]Previous ]
316
317    C-Kermit 7.0 and earlier do not support multiple sessions. When you SET
318    LINE (or SET PORT, same thing) to a new device, or SET HOST to a new
319    host, the previous SET LINE device or network host connection is
320    closed, resulting in hangup of the modem or termination of the network
321    connection. In windowing environments like HP-VUE, NeXTSTEP, Windows,
322    OS/2, etc, you can run separate copies of Kermit in different windows
323    to achieve multiple sessions.
324
325    To achieve multiple sessions through a single serial port (e.g. when
326    dialing up), you can install SLIP or PPP on your computer and then use
327    C-Kermit's TCP/IP support over the SLIP or PPP connection, assuming you
328    also have TCP/IP networking installed on your computer.
329
330    C-Kermit 8.0 has the same restriction on SET LINE and SET HOST
331    sessions: only one regular session (dialout, Telnet, etc) can be open
332    at a time. However, version 8.0 adds two new kinds of sessions: FTP and
333    HTTP; one or both of these can be open at the same as a regular
334    session.
335
336 4. NETWORK CONNECTIONS
337
338    [ [50]Top ] [ [51]Contents ] [ [52]Next ] [ [53]Previous ]
339
340 FTP Client Bugs
341
342    The Unix C-Kermit 8.0.206 FTP client had the following bugs at the time
343    most of the 8.0.206 binaries were built for the C-Kermit 8.0 CDROM:
344
345     1. FTP MGET fails when directory segments contain wildcards, as in
346        "ftp mget */data/*.dat". Work around by doing a separate MGET for
347        each source directory.
348     2. FTP MGET can fail or produce random side effects if you have a
349        TMPDIR or CK_TMP environment variable definition in effect, or a
350        SET TEMP-DIRECTORY value, longer than 7 characters. Work around by
351        giving a SET TEMP-DIRECTORY command with a short value, such as
352        "/tmp".
353
354    These two bugs are fixed in the source code that is included on the
355    CDROM, and also in Kermit 95 2.1.1. You can tell if a C-Kermit 8.0.206
356    binary has these fixes by typing SHOW VERSION; if it says "FTP Client,
357    8.0.200, 24 Oct 2002" it has the fixes; if the edit number is less that
358    200, it doesn't, in which case can build a new binary from the source
359    code (or contact us and we'll try to get get one for you).
360
361 Making TCP/IP Connections Can Take a Long Time
362
363    The most frequently asked question in many newsgroups is "Why does it
364    take such a long time to make a Telnet connection to (or from) my
365    (e.g.) Linux PC?" (this applies to Kermit as well as to regular Telnet
366    clients):
367
368     1. Most Telnet servers perform reverse DNS lookups on the client for
369        security and/or logging reasons. If the Telnet client's host cannot
370        be found by the server's local DNS server, the DNS request goes out
371        to the Internet at large, and this can take quite some time. The
372        solution to this problem is to make sure that both client and host
373        are registered in DNS.
374     2. C-Kermit itself performs reverse DNS lookups unless you tell it not
375        to. This is to allow C-Kermit to let you know which host it is
376        actually connected to in case you have made a connection to a "host
377        pool" (multihomed host). You can disable C-Kermit's reverse DNS
378        lookup with SET TCP REVERSE-DNS-LOOKUP OFF.
379     3. C-Kermit 7.0 and later strictly enforce Telnet protocol rules. One
380        such rule is that certain negotiations must be responded to. If
381        C-Kermit sends a such a negotiation and the host does not respond,
382        C-Kermit waits a long time for the reply (in case the network is
383        congested or the host is slow), but eventually will time out. To
384        eliminate the waits (and therefore risk possible protocol
385        mismatches -- or worse -- between Telnet client and server), tell
386        C-Kermit to SET TELNET WAIT OFF (or include the /NOWAIT switch with
387        the TELNET command).
388
389 The Rlogin Client
390
391    In multiuser operating systems such as UNIX and VMS, TCP/IP Rlogin
392    connections are available only to privileged users, since "login" is a
393    privileged socket. Assuming you are allowed to use it in the first
394    place, it is likely to behave differently depending on what type of
395    host you are rlogging in to, due to technical reasons having to do with
396    conflicting interpretations of RFC793 (Out-Of-Band Data) and Rlogin
397    (RFC1122)... "Specifically, the TCP urgent pointer in BSD points to the
398    byte after the urgent data byte, and an RFC-compliant TCP urgent
399    pointer points to the urgent data byte. As a result, if an application
400    sends urgent data from a BSD-compatible implementation to an
401    [54]RFC-1122 compatible implementation then the receiver will read the
402    wrong urgent data byte (it will read the byte located after the correct
403    byte in the data stream as the urgent data byte)." Rlogin requires the
404    use of OOB data while Telnet does not. Therefore, it is possible for
405    Telnet to work between all systems while BSD and System V TCP/IP
406    implementations are almost always a bad mix.
407
408 The Telnet Client
409
410    On a TCP/IP TELNET connection, you should normally have PARITY set to
411    NONE and (except in VMS C-Kermit) FLOW-CONTROL also set to NONE. If
412    file transfer does not work with these settings (for example, because
413    the remote TELNET server only gives a 7-bit data path), use SET PARITY
414    SPACE. Do not use SET PARITY MARK, EVEN, or ODD on a TELNET connection
415    -- it interferes with TELNET protocol.
416
417    If echoing does not work right after connecting to a network host or
418    after dialing through a TCP/IP modem server, it probably means that the
419    TELNET server on the far end of the connection is executing the TELNET
420    protocol incorrectly. After initially connecting and discovering
421    incorrect echoing (characters are echoed twice, or not at all), escape
422    back, give the appropriate SET DUPLEX command (FULL or HALF), and then
423    CONNECT again. For a consistently misbehaving connection, you can
424    automate this process in a macro or TAKE file.
425
426    TELNET sessions are treated just like serial communications sessions as
427    far as "terminal bytesize" and "command bytesize" are concerned. If you
428    need to view and/or enter 8-bit characters during a TELNET session, you
429    must tell C-Kermit to SET TERMINAL BYTESIZE 8, SET COMMAND BYTESIZE 8,
430    and SET PARITY NONE.
431
432    If you SET TELNET DEBUG ON prior to making a connection, protocol
433    negotiations will be displayed on your screen. You can also capture
434    them in the debug log (along with everything else) and then extract
435    them easily, since all Telnet negotiations lines begin with (uppercase)
436    "TELNET".
437
438 The SSH Client
439
440    C-Kermit does not have its own built-in SSH client; instead, in the
441    Unix tradition, uses the external SSH client to do the SSH part, and
442    Kermit does its thing on top -- file transfer, scripting, etc. Under
443    certain circumstances that have not yet been identified, it sometimes
444    happens that after making an SSH connection from C-Kermit, logging out
445    from the remote host, and popping back to the local C-Kermit program,
446    subsequent SSH commands file with a message like "Network type not
447    supported". Starting a new copy of C-Kermit is the workaround.
448
449 5. MODEMS AND DIALING
450
451    [ [55]Top ] [ [56]Contents ] [ [57]Next ] [ [58]Previous ]
452
453    External modems are recommended because:
454
455      * They don't need any special drivers.
456      * They are less likely to interfere with normal operation of your
457        computer.
458      * You can use the lights and speaker to troubleshoot dialing.
459      * You can share them among all types of computers.
460      * You can easily turn them off and on when power-cycling seems
461        warranted.
462      * They are more likely to have manuals.
463
464    Modems can be used by C-Kermit only when they are visible as or through
465    a regular serial port device. Certain modems can not be used in this
466    normal way on many kinds of computers: Winmodems, RPI modems,
467    Controllerless modems, the IBM Mwave, etc; all of these require special
468    drivers that perform some, most, or all of the modem's functions in
469    software. Such drivers are generally NOT available in UNIX or other
470    non-Windows (or non-OS/2, in the case of the Mwave) platforms.
471
472    In order to dial a modem, C-Kermit must know the modem's repertoire of
473    commands and responses. Each modem make and model is likely to have a
474    different repertoire. Since Kermit has no way of knowing which kind of
475    modem will be dialed, normally you have to tell it with a SET MODEM
476    TYPE command, e.g.:
477
478   set modem type usrobotics
479   set line /dev/cua0
480   set speed 57600
481   dial 7654321
482
483    In the early days, there was a wide variety of modems and command
484    languages. Nowadays, almost every modem uses the Hayes AT command set
485    (but with some differences in the details) and its startup
486    configuration includes error correction, data compression, and hardware
487    (RTS/CTS) flow control. As long as C-Kermit is capable of hardware flow
488    control (as it is on many, but not all, the platforms where it runs,
489    since some operating systems don't support it), the modem can be dialed
490    immediately, without lengthy configuration dialogs, and in fact this is
491    what SET MODEM TYPE GENERIC-HIGH-SPEED does. In C-Kermit 8.0,
492    GENERIC-HIGH-SPEED has become the default modem type, so now it is
493    usually possible to SET LINE, SET SPEED, and DIAL without having to
494    identify your modem. If this doesn't work, of course, then you might
495    have to fall back to the traditional method: Give a SET MODEM TYPE for
496    a specific modem first, then SET LINE, SET SPEED, and DIAL.
497
498    An important change in C-Kermit 6.0 is that when you give a SET MODEM
499    TYPE command to tell Kermit what kind of modem you have, Kermit also
500    sets a number of other modem-related parameters automatically from its
501    internal modem database. Thus, the order in which you give
502    modem-related commands is significant, whereas in prior releases they
503    could be given in any order.
504
505    In particular, MODEM SPEED-MATCHING is set according to whether the
506    modem is known to be capable of speed buffering. SET MODEM TYPE
507    HAYES-2400 automatically turns SPEED-MATCHING ON, because when the
508    Hayes 2400 reports a particular speed in its CONNECT message, that
509    means its interface speed has changed to that speed, and C-Kermit's
510    must change accordingly if it is to continue communicating. This might
511    cause some confusion if you use "set modem type hayes" for dialing a
512    more advanced type of modem.
513
514    The new default for flow control is "auto", meaning "do the right thing
515    for each type of connection". So (for example) if your version of
516    C-Kermit supports SET FLOW RTS/CTS and your modem also supports
517    RTS/CTS, then Kermit automatically sets its flow control to RTS/CTS and
518    set modem's flow control to RTS/CTS too before attempting to use the
519    modem.
520
521    For these reasons, don't assume that "set modem type hayes" should be
522    used for all modems that uses the Hayes AT command set. "set modem type
523    hayes" really does mean Hayes 1200 or 2400, which in turn means no
524    hardware flow control, and no speed buffering. This choice will rarely
525    work with a modern high-speed modem.
526
527 6. DIALING HINTS AND TIPS
528
529    [ [59]Top ] [ [60]Contents ] [ [61]Next ] [ [62]Previous ]
530
531    If you have a high-speed, error-correcting, data-compressing,
532    speed-buffering modem, you should fix the modem's interface speed as
533    high as possible, preferably (at least) four times higher than its
534    maximum connection (modulation) speed to allow compression to work at
535    full advantage. In this type of setup, you must also have an effective
536    means of flow control enabled between C-Kermit and the modem,
537    preferably hardware (RTS/CTS) flow control. On platforms that do not
538    support hardware flow control, it is usually possible to select
539    software flow control (Xon/Xoff), and C-Kermit will do its best to set
540    the modem for local Xon/Xoff flow control too (but then, of course,
541    Ctrl-S and Ctrl-Q characters can not be transmitted on the connection).
542
543    If you are having trouble dialing your modem, SET DIAL DISPLAY ON to
544    watch the dialing interactions between C-Kermit and your modem. Consult
545    Chapters 3-4 of [63]Using C-Kermit (2nd Ed) for modem-dialing
546    troubleshooting instructions. The following sections offer some
547    additional hints and tips.
548
549 6.1. Syntax
550
551    If you want to dial a number that starts with #, you'll need to quote
552    the "#" character (as \# or \{35}), since it is also a comment
553    introducer:
554
555   C-Kermit>dial #98765421-1-212-5551212   ; Looks like a comment
556   ?You must specify a number to dial
557   C-Kermit>dial \#98765421-1-212-5551212  ; Works OK
558   C-Kermit>dial =#98765421-1-212-5551212  ; This works too
559
560    When using a dialing directory, remember what happens if a name is not
561    found:
562
563   C-Kermit>dial xyzcorp
564   Lookup: "xyzcorp" - not found - dialing as given
565
566    This normally does no harm, but some modems might behave strangely when
567    given dial strings that contain certain letters. For example, a certain
568    German modem treats any dial string that contains the letter "s" as a
569    command to fetch a number from its internal list, and replies OK to the
570    ATD command, which is normally not a valid response except for partial
571    dialing. To avoid this situation, use:
572
573   lookup xyzcorp
574   if success dial
575
576 6.2. The Carrier Signal
577
578    Remember: In many C-Kermit implementations (depending on the underlying
579    operating system -- mostly Windows, OS/2, and System-V-based UNIX
580    versions, and in C-Kermit 7.0, also VMS), you can't CONNECT to a modem
581    and type the modem's dialing command (like "ATDT7654321") manually,
582    unless you first tell C-Kermit to:
583
584   SET CARRIER-WATCH OFF
585
586    This is because (in these implementations), the CONNECT command
587    requires the modem's Carrier Detect (CD) signal to be on, but the CD
588    signal doesn't come on until after dialing is complete. This
589    requirement is what allows C-Kermit to pop back to its prompt
590    automatically when the connection is hung up. See the description of
591    SET CARRIER-WATCH in "Using C-Kermit".
592
593    Similarly, if your dialed connection drops when CARRIER-WATCH is set to
594    AUTO or ON, you can't CONNECT back to the (now disconnected) screen to
595    see what might have happened unless you first SET CARRIER-WATCH OFF.
596    But sometimes not even SET CARRIER-WATCH OFF will help in this
597    situation: certain platforms (for example Unixware 2.1), once carrier
598    drops, won't let the application do i/o with the device any more. In
599    that case, if you want to use the device again, you have to CLOSE it
600    and OPEN it again. Or you can have Kermit do this for you automatically
601    by telling it to SET CLOSE-ON-DISCONNECT ON.
602
603 6.3. Dialing and Flow Control
604
605    Don't SET FLOW RTS/CTS if your modem is turned off, or if it is not
606    presenting the CTS signal. Otherwise, the serial device driver can get
607    stuck waiting for this signal to appear.
608
609    Most modern modems support RTS/CTS (if they support any hardware flow
610    control at all), but some computers use different RS-232 circuits for
611    the same purposes, e.g. DTR and CD, or DTR and CTS. In such cases, you
612    might be able to make your computer work with your modem by
613    appropriately cross-wiring the circuits in the cable connector, for
614    example the computer's DTR to the modem's RTS, and modem's CD to the
615    computer's CTS. HOWEVER, C-Kermit does not know you have done this. So
616    if you have (say) SET FLOW DTR/CD, C-Kermit will make no attempt to
617    tell the modem to use RTS/CTS. You probably did this yourself when you
618    configured the modem.
619
620 6.4. The Dial Timeout
621
622    If it takes your call longer to be completed than the timeout interval
623    that C-Kermit calculates, you can use the SET DIAL TIMEOUT command to
624    override C-Kermit's value. But beware: the modem has its own timeout
625    for completing the call. If it is a Hayes-like modem, C-Kermit adjusts
626    the modem's value too by setting register S7. But the maximum value for
627    S7 might be smaller than the time you need! In that case, C-Kermit sets
628    S7 to 0, 255, or other (modem-specific) value to signify "no timeout".
629    If Kermit attempts to set register S7 to a value higher than your
630    modem's maximum, the modem will say "ERROR" and you will get a "Failure
631    to initialize modem" error. In that case, use SET DIAL TIMEOUT to
632    override C-Kermit's calculation of the timeout value with the highest
633    value that is legal for your modem, e.g. 60.
634
635 6.5. Escape Sequence Guard Time
636
637    A "TIES" (Time-Independent Escape Sequence) modem does not require any
638    guard time around its escape sequence. The following text:
639
640   +++ATH0
641
642    if sent through a TIES modem, for example because you were uploading
643    this file through it, could pop the modem back into command mode and
644    make it hang up the connection. Later versions of the Telebit T1600 and
645    T3000 (version LA3.01E firmware and later), and all WorldBlazers, use
646    TIES.
647
648    Although the probability of "+++" appearing in a Kermit packet is
649    markedly lower than with most other protocols (see the [64]File
650    Transfer section below), it can still happen under certain
651    circumstances. It can also happen when using C-Kermit's TRANSMIT
652    command. If you are using a Telebit TIES modem, you can change the
653    modem's escape sequence to an otherwise little-used control character
654    such as Ctrl-_ (Control-Underscore):
655
656   AT S2=31
657
658    A sequence of three consecutive Ctrl-_ characters will not appear in a
659    Kermit packet unless you go to extraordinary lengths to defeat more
660    than a few of Kermit's built-in safety mechanisms. And if you do this,
661    then you should also turn off the modem's escape-sequence recognition
662    altogether:
663
664   AT S48=0 S2=255
665
666    But when escape sequence recognition is turned off, "modem hangup"
667    (<pause>+++<pause>ATH0<CR>) will not work, so you should also SET MODEM
668    HANGUP RS232-SIGNAL (rather then MODEM-COMMAND).
669
670 6.6. Adaptive Dialing
671
672    Some modems have a feature called adaptive dialing. When they are told
673    to dial a number using Tone dialing, they check to make sure that
674    dialtone has gone away after dialing the first digit. If it has not,
675    the modem assumes the phone line does not accept Tone dialing and so
676    switches to Pulse. When dialing out from a PBX, there is almost always
677    a secondary dialtone. Typically you take the phone off-hook, get the
678    PBX dialtone, dial "9" to get an outside line, and then get the phone
679    company's dialtone. In a situation like this, you need to tell the
680    modem to expect the secondary dialtone. On Hayes and compatible modems,
681    this is done by putting a "W" in the dial string at the appropriate
682    place. For example, to dial 9 for an outside line, and then 7654321,
683    use ATDT9W7654321:
684
685   SET PBX-OUTSIDE-PREFIX 9W
686
687    (replace "9" with whatever your PBX's outside-line prefix is).
688
689 6.7. The Busy Signal
690
691    Some phone companies are eliminating the busy signal. Instead, they
692    issue a voice message such as "press 1 to automatically redial until
693    the number answers, or...". Obviously this is a disaster for modem
694    calls. If your service has this feature, there's nothing Kermit can do
695    about it. Your modem will respond with NO CARRIER (after a long time)
696    rather than BUSY (immediately), and Kermit will declare the call a
697    failure, rather than trying to redial the same number.
698
699 6.8. Hanging Up
700
701    There are two ways to hang up a modem: by turning off the serial port's
702    DTR signal (SET MODEM HANGUP-METHOD RS232-SIGNAL) or sending the modem
703    its escape sequence followed by its hangup command (SET MODEM
704    HANGUP-METHOD MODEM-COMMAND). If one doesn't work, try the other. If
705    the automatic hangup performed at the beginning of a DIAL command
706    causes trouble, then SET DIAL HANGUP OFF.
707
708    The HANGUP command has no effect when C-Kermit is in remote mode. This
709    is on purpose. If C-Kermit could hang up its own controlling terminal,
710    this would (a) most likely leave behind zombie processes, and (b) pose
711    a security risk.
712
713    If you DIAL a modem, disconnect, then SET HOST or TELNET, and then
714    HANGUP, Kermit sends the modem's hangup command, such as "+++ATHO".
715    There is no good way to avoid this, because this case can't reliably be
716    distinguished from the case in which the user does SET HOST
717    terminal-server, SET MODEM TYPE name, DIAL. In both cases we have a
718    valid modem type selected and we have a network connection. If you want
719    to DIAL and then later make a regular network connection, you will have
720    to SET MODEM TYPE NONE or SET DIAL HANGUP OFF to avoid this phenomenon.
721
722 7. TERMINAL SERVERS
723
724    [ [65]Top ] [ [66]Contents ] [ [67]Next ] [ [68]Previous ]
725
726    Watch out for terminal server's escape character -- usually a control
727    character such as Ctrl-Circumflex (Ctrl-^). Don't unprefix it in
728    Kermit!
729
730    Ciscos -- must often be told to "terminal download"... Cisco ASM models
731    don't have hardware flow control in both directions.
732
733    Many terminal servers only give you a 7-bit connection, so if you can't
734    make it 8-bit, tell Kermit to "set parity space".
735
736    The following story, regarding trouble transferring 8-bit files through
737    a reverse terminal server, was contributed by an Annex terminal server
738    user:
739
740      Using C-Kermit on an HP 9000 712/80 running the HP-UX 10.00
741      operating system. The HP was connected to a Xylogics Annex
742      MICRO-ELS-UX R7.1 8 port terminal server via ethernet. On the second
743      port of the terminal server is an AT&T Paradyne 3810 modem, which is
744      connected to a telephone line. There is a program which runs on the
745      HP to establish a Telnet connection between a serial line on the
746      Annex and a character special file on the HP (/dev file). This is an
747      Annex specific program called rtelnet (reverse telnet) and is
748      provided with the terminal server software. The rtelnet utility runs
749      on top of the pseudo-terminal facility provided by UNIX. It creates
750      host-originated connections to devices attached ot Annex serial
751      ports. There are several command line arguments to be specified with
752      this program: the IP address of the terminal server, the number of
753      the port to attach to, and the name of the pseudo-device to create.
754      In addition to these there are options to tell rtelnet how to
755      operate on the connect: -b requests negotiation for Telnet binary
756      mode, -d turns on socket-leve debugging, -f enables "connect on the
757      fly" mode, -r removes the device-name if it already exists, etc. The
758      most important of these to be specified when using 8 data bits and
759      no parity, as we found out, was the -t option. This creates a
760      transparent TCP connection to the terminal server. Again, what we
761      assumed to be happening was that the rtelnet program encountered a
762      character sequence special to itself and then "eating" those kermit
763      packets. I think this is all of the information I can give you on
764      the configuration, short of the values associated with the port on
765      the terminal server.
766
767    How to DIAL from a TCP/IP reverse terminal server (modem server):
768
769     1. (only if necessary) SET TELNET ECHO REMOTE
770     2. SET HOST terminal-server-ip-name-or-address [ port ]
771     3. SET MODEM TYPE modem-type
772     4. (only if necessary) SET DIAL HANGUP OFF
773     5. (for troubleshooting) SET DIAL DISPLAY ON
774     6. DIAL phone-number
775
776    The order is important: SET HOST before SET MODEM TYPE. Since this is a
777    Telnet connection, serial-port related commands such as SET SPEED, SET
778    STOP-BITS, HANGUP (when MODEM HANGUP-METHOD is RS232), etc, have no
779    effect. However, in C-Kermit 8.0, if the modem server supports
780    [69]RFC-2217 Telnet Com-Port Control protocol, these commands do indeed
781    take effect at the server's serial port.
782
783 8. TERMINAL EMULATION
784
785    [ [70]Top ] [ [71]Contents ] [ [72]Next ] [ [73]Previous ]
786
787    Except for the Windows, OS/2, and Macintosh versions, C-Kermit does not
788    emulate any kind of terminal. Rather, it acts as a "semitransparent
789    pipe", passing the characters you type during a CONNECT session to the
790    remote host, and sending the characters received from the remote host
791    to your screen. Whatever is controlling your keyboard and screen
792    provides the specific terminal emulation: a real terminal, a PC running
793    a terminal emulator, etc, or (in the case of a self-contained
794    workstation) your console driver, a terminal window, xterm, etc.
795
796    Kermit is semitransparent rather than fully transparent in the
797    following ways:
798
799      * During a TELNET ("set host") session, C-Kermit itself executes the
800        TELNET protocol and performs TELNET negotiations. (But it does not
801        perform TN3270 protocol or any other type of 3270 terminal
802        emulation.)
803      * If you have changed your keyboard mapping using SET KEY, C-Kermit
804        replaces the characters you type with the characters or strings
805        they are mapped to.
806      * If you SET your TERMINAL CHARACTER-SET to anything but TRANSPARENT,
807        C-Kermit translates your keystrokes (after applying any SET KEY
808        definitions) before transmitting them, and translates received
809        characters before showing them on your screen.
810      * If your remote and/or local TERMINAL CHARACTER-SET is an ISO 646
811        7-bit national character set, such as German, French, Italian,
812        Swedish, etc, or Short KOI used for Cyrillic, C-Kermit's CONNECT
813        command automatically skips over ANSI escape sequences to avoid
814        translating their characters. Only ANSI/ISO standard
815        (VT100/200/300-like) 7-bit escape sequence formats are supported
816        for this purpose, no proprietary schemes like H-P, Televideo,
817        Tektronix, etc.
818      * If your version of C-Kermit includes SET TERMINAL APC command, then
819        C-Kermit's CONNECT command will handle APC escape sequences if
820        TERMINAL APC is not set to OFF (which is the default).
821
822    You can make C-Kermit fully transparent by starting it with the -0
823    (dash zero) command-line option.
824
825    If you are running C-Kermit under a console driver, or in a terminal
826    window, that emulates the VT100, and use C-Kermit to log in to a VMS
827    system, the console driver or terminal window (not Kermit) is supposed
828    to reply to the "what are you?" query (ESC Z) from the VAX. If it
829    doesn't, and you can't make it do so, then you can (a) live with the
830    "unknown terminal" problem; (b) tell VMS to SET TERMINAL/DEVICE=VT100;
831    (c) program a key using SET KEY to send the appropriate sequence and
832    then punch the key at the right time; or (d) use the VMSLOGIN macro
833    that is defined in CKERMIT.INI to do this for you automatically.
834
835    SET SESSION-LOG { TEXT, BINARY }, which is effective in UNIX and AOS/VS
836    but not other C-Kermit versions, removes CR, DEL, NUL, XON, and XOFF
837    characters (Using C-Kermit neglects to mention that XON and XOFF are
838    removed). The TEXT-mode setting is ineffective during SCRIPT command
839    execution, as well as on X.25 connections.
840
841 9. KEY MAPPING
842
843    [ [74]Top ] [ [75]Contents ] [ [76]Next ] [ [77]Previous ]
844
845    Except in the terminal-emulating versions, C-Kermit's key mapping
846    facilities are limited to normal "ASCII" keys, and cannot be used with
847    function keys, arrow keys, arcane key combinations, etc. Since C-Kermit
848    runs on such a wide variety of hardware platforms (including, for
849    example, more than 360 different UNIX platforms), it is not possible
850    for C-Kermit to support every conceivable keyboard under every release
851    of every UNIX (or VMS, or ...) product on every different kind of
852    computer possibly under all manner of different console drivers, even
853    if it had the means to do so.
854
855    In technical terms, C-Kermit uses the read() function to read
856    keystrokes, and read() returns a single byte (value 0 through 255).
857    C-Kermit's SET KEY function applies to these single-byte codes.
858    "Extended function" keys, such as F-keys, arrow keys, etc, usually
859    return either a 2-byte "scan code" or else a character string (such as
860    an escape sequence like "<ESC> O p"). In both cases, C-Kermit has no
861    way to tell the difference between such multibyte key values, and the
862    corresponding series of single-byte key values. This could only be done
863    by accessing the keyboard at a much lower level in a highly
864    platform-dependent manner, probably requiring tens of thousands of
865    lines of code to support even a sampling of the most popular
866    workstation / OS combinations.
867
868    However, most workstation console drivers (terminal emulation windows,
869    etc) include their own key-mapping facility. For example in AIX, the
870    AIXterm program (in whose window you would run C-Kermit) allows
871    rebinding of the F1-F12 keys to arbitrary strings. The same is true of
872    Xterm and DECterm windows, etc. Consult the technical documentation for
873    your workstation or emulator. See sample Xterm (Xmodmap) mappings in
874    the [78]Unix C-Kermit Hints and Tips document.
875
876    The SET KEY command (except in Kermit 95) does not allow a key
877    definition to be (or contain) the NUL (\0) character.
878
879 10. FILE TRANSFER
880
881    [ [79]Top ] [ [80]Contents ] [ [81]Next ] [ [82]Previous ]
882
883    C-Kermit 7.0 is the first release of C-Kermit to use fast (rather than
884    robust and therefore slow) protocol defaults: long packets, sliding
885    windows, control-character unprefixing, and streaming where possible.
886    This makes most transfers (partner willing) dramatically faster "out of
887    the box" but might break some combinations that worked before. If
888    transfers with C-Kermit 7.0 or later fail where transfers worked with
889    earlier C-Kermit versions, try the following (one at a time, in this
890    order):
891
892     1. SET PREFIXING ALL: Disables control-character unprefixing.
893     2. SET STREAMING OFF: Disables streaming.
894     3. CAUTIOUS: Selects medium but cautious protocol settings.
895     4. ROBUST: this command reverts to the most conservative protocol
896        settings.
897
898    Execution of multiple file transfers by C-Kermit from a command file
899    when in remote mode might exhibit long delays between each transfer. To
900    avoid this, just include the command "SET DELAY 0" in your command file
901    before any of the file-transfer commands.
902
903    File transfer failures can occur for all sorts of reasons, most of them
904    listed in Chapter 10 of [83]Using C-Kermit. The following sections
905    touch on some that aren't.
906
907    The [84]C-Kermit 7.0 Release Notes document SEND /COMMAND as taking an
908    argument, but it doesn't. Instead of SEND /COMMAND:{some command}, use:
909
910 SEND /COMMAND [ other switches such as /AS-NAME: ] command [ arguments... ]
911
912 10.1. Laptops
913
914    Watch out for laptops and their assorted power-saver features; for
915    example, a built-in modem's "auto timeout delay" hanging up the
916    connection in the middle of a file transfer. Most modems, even if they
917    have this feature, do not have it enabled by default. But if you
918    experience otherwise inexplicable disconnections in the midst of your
919    Kermit sessions, check the modem manual for such things as "idle
920    timeout", "auto timeout", etc, and add the command to disable this
921    feature to Kermit's init string for this modem.
922
923 10.2. NFS
924
925    If uploading a large file to an NFS-mounted disk fails (or is painfully
926    slow), try uploading it to a local disk (e.g. /tmp on Unix) and then
927    copying to the NFS disk later.
928
929 10.3. Modems
930
931    If you are dialing out and find that downloads work but uploads don't,
932    try again with a lower serial-port speed. Case in point: dialing out on
933    a certain PC from Linux at 115200 bps using a USR Courier 56K
934    "V.Everything" external modem and RTS/CTS flow control. Downloads
935    worked flawlessly, uploads stopped dead after the first few packets
936    were sent. The modem lights showed constant retraining (ARQ light
937    blinks slowly), and the CTS light was off 95% of the time, allowing
938    nothing to get through. Reducing the serial port speed to 57600 bps
939    made the problems go away. Evidently the PC in question has a very fast
940    serial port, since dialing the same modem with a different PC at 115200
941    bps works without incident.
942
943 10.4. TCP/IP Connections
944
945    If you have trouble transferring files over a TCP/IP connection, tell
946    Kermit to SET PARITY SPACE and try again. If that doesn't work, also
947    try a shorter packet length or smaller window size (to compensate for
948    certain well-known broken Telnet servers), and/or SET RELIABLE OFF.
949
950 10.5. Multihop Connections
951
952    If you have a multihop connection, with the interior nodes in CONNECT
953    mode (Kermit, Telnet, Rlogin, or any other), you can expect (a) file
954    transfer to be slower, and (b) the connection to be less transparent
955    (to control characters, perhaps to the 8th bit) than a more direct
956    connection. C-Kermit 7.0 and later have a "-0" (dash-zero) command-line
957    option to make it 100% transparent in cases where it is to be used in
958    the middle.
959
960 10.6. Recovery
961
962    The recovery feature (RESEND command) that was added in version 5A(190)
963    works only for binary-mode transfers. In order for this feature to be
964    useful at all, the default for SET FILE INCOMPLETE was changed from
965    DISCARD to KEEP. Otherwise an interrupted transfer would leave no
966    partial file behind unless you had remembered to change the default.
967    But now you have to pay closer attention to Kermit's messages to know
968    whether a transfer succeeded or failed -- previously, if it failed, the
969    file would not show up on the receiving end at all; in 5A(190) and
970    later, you'll get a partial file which could easily be mistaken for the
971    complete file unless you change the default back to DISCARD or read the
972    screen messages, or keep a transaction log.
973
974 10.7. Filename Collisions
975
976    SET FILE COLLISION BACKUP is the default. This means:
977
978      * If you send the same file lots of times, there will be many backup
979        files. There is no automatic mechanism within Kermit to delete
980        them, no notion of a "version retention count", etc, but you can
981        use the PURGE command to clean them up.
982      * If a file arrives that has the same name as a directory, the file
983        transfer fails because Kermit will not rename a directory. Send the
984        file with another name, or use SET FILE COLLISION RENAME.
985      * If the directory lacks write permission, the file transfer fails
986        even if you have write access to the file that is being backed up;
987        in that case, switch to SET FILE COLLISION OVERWRITE or APPEND, or
988        send to a different directory.
989
990    SET FILE COLLISION UPDATE depends on the date/time stamp in the
991    attribute packet. However, this is recorded in local time, not
992    Universal Time (GMT), and there is no indication of time zone. The time
993    is expressed to the precision of 1 second, but some file systems do not
994    record with this precision -- for example, MS-DOS records the file
995    date/time only to the nearest 2 seconds. This might cause update
996    operations to send more files than necessary.
997
998    (This paragraph does NOT apply to UNIX, where, as of C-Kermit 7.0,
999    C-Kermit pipes incoming mail and print material directly the mail or
1000    print program): When C-Kermit is receiving files from another Kermit
1001    program that has been given the MAIL or REMOTE PRINT command, C-Kermit
1002    follows the current filename collision action. This can be
1003    disconcerting if the action was (for example) BACKUP, because the
1004    existing file will be renamed, and the new file will be mailed (or
1005    printed) and then deleted. Kermit cannot temporarily change to RENAME
1006    because the file collision action occurs when the filename packet is
1007    received, and the PRINT or MAIL disposition only comes later, in the
1008    Attribute packet.
1009
1010    Watch out for SET FILE COLLISION RENAME, especially when used in
1011    conjunction with recovery. Recall that this option (which is NOT the
1012    default) renames the incoming file if a file already exists with the
1013    same name (the default is to rename the previously existing file, and
1014    store the incoming file with its own name). It is strongly recommended
1015    that you do not use SET FILE COLLISION RENAME if you ever intend to use
1016    the recovery feature:
1017
1018      * When the file is first received by C-Kermit, its name is changed if
1019        another file already has the same name. When you RESEND the same
1020        file after a failure, C-Kermit will probably try to append the
1021        re-sent portion to the wrong file.
1022      * Assuming that you get RESEND to work with FILE COLLISION RENAME,
1023        C-Kermit, when receiving the remainder of the file during a RESEND
1024        operation, will report back the wrong name. Nothing can be done
1025        about this because the name is reported back before the receiving
1026        Kermit program finds out that it is a recovery operation.
1027
1028    Also watch out for DISABLE DELETE, since this implicitly sets FILE
1029    COLLISION to RENAME. And note tht DELETE is DISABLEd automatically any
1030    time you Kermit is in local mode (i.e. it makes a connection). Also
1031    note that for purposes of DISABLE and ENABLE, "set host *" connections
1032    do not count as local mode even though, strictly speaking, they are.
1033
1034 10.8. DOS Pathnames
1035
1036    When referring to foreign MS-DOS, Windows, Atari ST, OS/2, or other
1037    file specifications that contain backslash characters in a C-Kermit
1038    command, you might have to double each backslash, for example:
1039
1040   C-Kermit>get c:\\directory\\foo.txt
1041
1042    This is because backslash is used in C-Kermit commands for introducing
1043    special character codes, variables, functions, etc.
1044
1045 10.9. Cancellation
1046
1047    If attempting to cancel local-mode file reception at a very early stage
1048    (i.e. before data packets are exchanged) with X or Z does not work, use
1049    E or Ctrl-C instead, or wait until the first data packets are sent.
1050
1051    If you cancel a transfer that is underway using X or Z, and a lot of
1052    window slots are in use, it might take a while for the cancellation to
1053    take effect, especially if you do this on the receiving end; that's
1054    because a lot of packets might already be on their way to you. In that
1055    case, just be patient and let Kermit "drain" them.
1056
1057    If C-Kermit is sending a file, remote-mode packet-mode breakout (three
1058    consecutive Ctrl-C's by default) is not effective until after C-Kermit
1059    sends its first packet. If C-Kermit is receiving a file or is in server
1060    mode, it is effective right away. In the former case, the SET DELAY
1061    value determines the earliest time at which you can break out of packet
1062    mode.
1063
1064 10.10. Partner Peculiarities
1065
1066    When one or both partners is on an SCO operating system such as OSR5,
1067    you might issue the command:
1068
1069 mapchan -n
1070
1071    to disable character-set conversion by the terminal driver. Similarly
1072    for AIX:
1073
1074 setmaps -t NOMAP
1075
1076    When using C-Kermit to transfer files with the HP48SX calculator, you
1077    must SET FLOW NONE. The HP48SX does not support flow control, and
1078    evidently also becomes confused if you attempt to use it. You might
1079    also need to use SET SEND PAUSE 100 (or other number). For greater
1080    detail about transferring files the HP-48, see:
1081
1082   [85]http://www.columbia.edu/kermit/hp48.html
1083
1084    Some communication programs have errors in their implementation of
1085    Kermit attribute packets. If you get an error message from your
1086    communication program like "Attribute error", tell C-Kermit to SET
1087    ATTRIBUTES OFF. Better yet, switch to a real Kermit program.
1088
1089    Some communication software claims to implement Kermit sliding windows,
1090    but does so incorrectly. If sliding window transfers fail, set
1091    C-Kermit's window size to the smallest one that works, for example, SET
1092    WINDOW 1.
1093
1094    For lots more detail about how to cope with defective Kermit partners,
1095    see:
1096
1097      * [86]Coping with Faulty Kermit Implementations (C-Kermit 7.0 and
1098        later).
1099      * [87]Coping with Broken Kermit Partners (C-Kermit 8.0 and later).
1100
1101    The UNIX version of C-Kermit discards carriage returns when receiving
1102    files in text mode. Thus, "bare" carriage returns (sometimes used to
1103    achieve overstriking) are lost.
1104
1105 11. SCRIPT PROGRAMMING
1106
1107    [ [88]Top ] [ [89]Contents ] [ [90]Previous ]
1108
1109 11.1. Comments Versus the SCRIPT Command
1110
1111    Remember that ";" and "#" introduce comments when (a) they are the
1112    first character on the line, or (b) they are preceded by at least one
1113    blank or tab within a line. Thus constructions like:
1114
1115   INPUT 5 ;
1116   SCRIPT ~0 #--#--#
1117
1118    must be coded using backslash notation to keep the data from being
1119    ignored:
1120
1121   INPUT 5 \59                   ; 59 is the decimal ASCII code for ";"
1122   SCRIPT ~0 \35--#--#           ; 43 is the decimal ASCII code for "#"
1123
1124    or, more simply:
1125
1126   INPUT 5 \;                    ; Just quote the semicolon
1127   SCRIPT ~0 \#--#--#            ; Just quote the "#"
1128
1129 11.2. Alphabetic Case and the INPUT Command
1130
1131    INPUT and MINPUT caseless string comparisons do not work for non-ASCII
1132    (international) characters. Workaround: SET INPUT CASE OBSERVE. Even
1133    then, the "lexically less than" and "lexically greater than" operations
1134    (IF LLT, IF LGT) probably won't work as expected. The same is true for
1135    the case-conversion functions \Flower() and \Fupper(). C-Kermit does
1136    not know the collating sequence for different character sets and
1137    languages. (On the other hand, it might work depending on such items as
1138    how Kermit was linked, whether your operating supports "locales", etc)
1139
1140 11.3. NUL (0) Characters in C-Kermit Commands
1141
1142    You can't include a NUL character (\0) in C-Kermit command text without
1143    terminating the character string in which it appears. For example:
1144
1145   echo In these brackets [\0] is a NUL
1146
1147    will echo "In these brackets [". This applies to ECHO, INPUT, OUTPUT,
1148    and all other commands (but you can represent NUL by "\N" in an OUTPUT
1149    string). This is because C-language strings are terminated internally
1150    by the NUL character, and it allows all of C-Kermit's string comparison
1151    and manipulation functions to work in the normal "C" way.
1152
1153    To illustrate:
1154
1155   INPUT 5 \0
1156
1157    is equivalent to:
1158
1159   INPUT 5
1160
1161    and:
1162
1163   INPUT 5 ABC\0DEF
1164
1165    is equivalent to:
1166
1167   INPUT 5 ABC
1168
1169    INPUT operations discard and ignore NUL characters that arrive from the
1170    communication device, meaning that they do not figure into matching
1171    operations (e.g. A<NUL>B matches AB); they are not deposited in the
1172    INPUT buffer (\v(input)); and they are not counted in \v(incount), with
1173    two exceptions:
1174
1175     1. An arriving NUL character restarts the INPUT SILENCE timer.
1176     2. An arriving NUL character terminates the INPUT command with the
1177        SUCCESS condition if the INPUT command was given an empty search
1178        string. In this case \v(incount) is set to 1.
1179
1180    Also, the \v(inchar) variable is null (completely empty) if the last
1181    INPUT character was NUL. That is, there is no way to tell only by
1182    looking at \v(inchar) the difference between a NUL that was INPUT and
1183    no INPUT at all. If the INPUT command succeeded but \v(inchar) is
1184    empty, then a NUL character was input. Also, \v(incount) will be set to
1185    1.
1186
1187    Here's a sample script fragment to read characters, possibly including
1188    NUL, from the communication connection and write them to a file:
1189
1190   while true {
1191       input 1                      ; read one byte
1192       if fail break                ; timed out or connection closed
1193       fwrite /char \%c \v(inchar)  ; record the byte
1194   }
1195
1196    This works because when \v(inchar) is NUL, that's equivalent to FWRITE
1197    /CHAR having no text argument at all, in which case it writes a NUL
1198    character.
1199
1200    \v(incount) and \v(inchar) are NOT affected by the CLEAR command.
1201
1202 11.4. \ffiles() and \fnextfile() Peculiarities
1203
1204    The following script program:
1205
1206   for \%i 1 \ffiles(oofa.*) 1 {
1207       send \fnextfile()
1208   }
1209
1210    did not work as expected in C-Kermit 6.0 and earlier but does work in
1211    C-Kermit 7.0 and later.
1212
1213 11.5. Commands That Have Only Local Effect
1214
1215    Certain settings are local to each command level, meaning that
1216    subordinate command levels (macros or command files) can change them
1217    without affecting their values at higher command levels. When a new
1218    command level is invoked, the value is inherited from the previous
1219    level. These settings are:
1220
1221   CASE
1222   COUNT and \v(count)
1223   INPUT CASE
1224   INPUT TIMEOUT
1225   MACRO ERROR
1226   QUIET
1227   TAKE ERROR
1228
1229    This arrangement allows CASE, TIMEOUT, and ERROR settings, which are
1230    used to control automatic exit from a command file or macro upon error,
1231    to be automatically restored when the command file or macro exits.
1232
1233    The COUNT variable follows this rule too, which permits nested SET
1234    COUNT / IF COUNT loops, as in this example in which the inner loop
1235    counts down from the current COUNT value of the outer loop (try it):
1236
1237   DEFINE INNER WHILE COUNT { WRITE SCREEN {   Inner:}, SHOW COUNT }
1238   SET COUNT 5
1239   WHILE COUNT { WRITE SCREEN Outer:, SHOW COUNT, DO INNER }
1240
1241    Keep in mind that an inferior command level cannot manipulate the COUNT
1242    value held by a higher level. For example:
1243
1244   DEFINE OOFA SHOW COUNT, IF COUNT GOTO LOOP
1245   SET COUNT 5
1246   :LOOP
1247   OOFA
1248   ECHO Done
1249
1250    results in an infinite loop; the COUNT value remains at 5 because it is
1251    never decremented at the same level at which it was set.
1252
1253 11.6. Literal Braces in Function Calls
1254
1255    Since braces are used in function calls to indicate grouping, there is
1256    no way to pass literal braces to the function itself. Solution: Define
1257    a variable containing the string that has braces. Example:
1258
1259   define \%a ab{cd
1260   echo \fsubstring(\%a)
1261   ab{cd
1262
1263    If the string is to start with a leading brace and end with a closing
1264    brace, then double braces must appear around the string (which itself
1265    is enclosed in braces):
1266
1267   define \%a {{{foo}}}
1268   echo \fsubstring(\%a)
1269   {foo}
1270
1271    This also works for any other kind of string:
1272
1273   define \%a {{ab{cd}}
1274   echo \fsubstring(\%a)
1275   ab{cd
1276
1277 11.7. Defining Variables on the C-Kermit Command Line
1278
1279    To define variables on the C-Kermit command line, use the -C
1280    command-line option with one or more DEFINE or ASSIGN commands. Note
1281    that the C-Kermit command line must cope with the quoting rules of your
1282    shell. Examples:
1283
1284   kermit -C "define \\%a foo, define phonenumber 7654321"
1285
1286    In this case we follow UNIX quoting rules by doubling the backslash.
1287    Once C-Kermit starts, the \%a and \m(phonenumber) variables are defined
1288    as indicated and can be used in the normal way.
1289
1290    In DOS or Windows or OS/2 the command would be:
1291
1292   kermit -C "define \%%a foo, define phonenumber 7654321"
1293
1294    Here we need to double the percent sign rather than the backslash
1295    because of DOS shell quoting rules.
1296
1297 11.8. Per-Character Echo Check with the OUTPUT Command
1298
1299    Sometimes the OUTPUT command must be used to send commands or data to a
1300    device in "echoplex" mode, meaning that characters must be sent one at
1301    a time, and the next character can not be sent until the echo from the
1302    previous one has been received. For example, a certain PBX might have
1303    this characteristic. Let's say a Kermit script is used to program the
1304    PBX. If characters are sent too fast, they can be lost. It would seem
1305    that the command:
1306
1307   SET OUTPUT PACING milliseconds
1308
1309    could be used to take care of this, but the pacing interval is constant
1310    and must be set large enough to allow even the slowest echo to finish.
1311    If the script is large (an actual example is 14,000 lines long), this
1312    can cause it to take hours longer than it needs to.
1313
1314    Here is a macro you can use to OUTPUT a string in an Echoplex
1315    environment:
1316
1317   define XOUTPUT {
1318       local \%c \%i
1319       set output pacing 0
1320       for \%i 1 \flen(\%*) 1 {
1321           asg \%c \fsubstr(\%*,\%i,1)
1322           output \%c
1323           input 2 \%c
1324       }
1325   }
1326
1327    C-Kermit 7.0 or later is required.
1328
1329    It sends one character at a time and then waits up to 2 seconds for the
1330    character to be echoed back, but continues to the next character as
1331    soon as the echo appears, so no time is wasted. You can add an IF FAIL
1332    clause after the INPUT in case you want to do something special about
1333    failure to detect an echo within the timeout period. Obviously you can
1334    also change the 2-second limit, and adjust the script in any other
1335    desired way.
1336
1337 11.9. Scripted File Transfer
1338
1339    Sometimes a user complains that when she makes a connection by hand,
1340    logs in, and transfers a file, there are no problems, but when she
1341    scripts the the exact same sequence, the file transfer always fails
1342    after a few packets. Here's a scenario where this can happen:
1343
1344     1. Upon logging in to the remote computer, it sends a "What Are You?"
1345        escape sequence.
1346     2. When you log in interactively, your terminal emulator sends the
1347        response. This is invisible to you; you don't know it's happening.
1348     3. When you script the login, and begin a file transfer immediately
1349        upon logging in, the host still sends the "What Are You?" sequence.
1350        Kermit's INPUT ECHO setting is ON by default, so the escape
1351        sequence passes through to the terminal, and the terminal sends its
1352        response. But by this time Kermit has already started the file
1353        transfer.
1354     4. By default, the local Kermit program examines the keyboard for
1355        interruption characters between every packet. The "What Are You"
1356        response is sitting in the keyboard buffer. Eventually Kermit will
1357        read a character such as "c" that is a valid interruption
1358        character, and the file transfer stops with "User canceled".
1359
1360    The right way to handle this situation is to have your look for the
1361    "What Are You?" sequence and send the response itself, as described in
1362    Using C-Kermit, pp.429-431. Or you can work around it by telling the
1363    local Kermit to "set input echo off" and/or "set transfer interruption
1364    off".
1365
1366 11.10. Hexadecimal arithmetic...
1367
1368    C-Kermit can do both integer and floating-point arithmetic, in both
1369    ordinary algebraic notation and in Lisp S-Expression notation. All
1370    arithmetic operators and functions operate only on decimal numbers. It
1371    is possible, however, to write scripts that operate on hexadecimal
1372    numbers. This is done by converting them to decimal prior to any
1373    arithmetic operations, and then converting them back to hexadecimal for
1374    display. Example:
1375
1376 ; EVALUATE is a command that evaluates an arithmetic expression.
1377 ; See HELP EVALUATE for details.  This is just for demonstration.
1378 ; Arithmetic expressions can be used in any context where a number
1379 ; can be used.  Also, the special notation:
1380 ;
1381 ; .\%a ::= expression
1382 ;
1383 ; evaluations the expression and assigns the result to the variable.
1384 ;
1385 .\%a := fffe                ; Set variable to hex value
1386 set eval old                ; See HELP EVAL
1387 eval \fhex2n(\%a)           ; Show value of variable
1388 eval \fhex2n(\%a) + 1       ; Show value of expression
1389 eval \fhex2n(\%a) + 2       ; Show value of expression
1390 .\%x ::= \fhex2n(\%a) + 1   ; Assign value of expression to variable
1391 echo \fn2hex(\%x)           ; Display variable's value in hex
1392 .\%x ::= \fhex2n(\%a) + 2   : Ditto
1393 echo \fn2hex(\%x)
1394 .\%x ::= \fhex2n(\%a) | \fhex2n(ffff)  ; Similarly for logical OR
1395 echo \fn2hex(\%x)
1396 .\%x ::= \fhex2n(\%a) & \fhex2n(ffff)  ; and logical AND
1397 echo \fn2hex(\%x)
1398
1399    By the way, you might be tempted to use Kermit's \xnn notation to plug
1400    hex numbers into arithmetic expressions but this doesn't work. That
1401    notation is strictly for bytes (hex representation of character
1402    values), not for numbers.
1403
1404 11.11. Other...
1405
1406    Escape sequences (or any strings that contain control characters) can't
1407    be used as labels, GOTO targets, or SWITCH cases.
1408
1409    [ [91]Top ] [ [92]Contents ] [ [93]C-Kermit Home ] [ [94]C-Kermit 8.0
1410    Overview ] [ [95]Kermit Home ]
1411      __________________________________________________________________
1412
1413    C-Kermit 8.0 Unix Hints and Tips / [96]The Kermit Project /
1414    [97]kermit@columbia.edu / 30 June 2011
1415
1416 References
1417
1418    1. http://www.columbia.edu/
1419    2. mailto:kermit@columbia.edu
1420    3. http://www.columbia.edu/kermit/index.html
1421    4. http://www.columbia.edu/kermit/k95.html
1422    5. http://www.columbia.edu/kermit/ckermit.html
1423    6. http://www.columbia.edu/kermit/ckscripts.html
1424    7. http://www.columbia.edu/kermit/current.html
1425    8. http://www.columbia.edu/kermit/whatsnew.html
1426    9. http://www.columbia.edu/kermit/faq.html
1427   10. http://www.columbia.edu/kermit/support.html
1428   11. http://www.columbia.edu/kermit/ckcbwr.html
1429   12. http://www.columbia.edu/kermit/ckubwr.html
1430   13. http://www.columbia.edu/kermit/k95.html
1431   14. http://www.columbia.edu/kermit/ckermit.html
1432   15. http://www.columbia.edu/kermit/ckututor.html
1433   16. http://www.columbia.edu/kermit/ckcbwr.html#x0
1434   17. http://www.columbia.edu/kermit/ckcbwr.html#x1
1435   18. http://www.columbia.edu/kermit/ckcbwr.html#x2
1436   19. http://www.columbia.edu/kermit/ckcbwr.html#x3
1437   20. http://www.columbia.edu/kermit/ckcbwr.html#x4
1438   21. http://www.columbia.edu/kermit/ckcbwr.html#x5
1439   22. http://www.columbia.edu/kermit/ckcbwr.html#x6
1440   23. http://www.columbia.edu/kermit/ckcbwr.html#x7
1441   24. http://www.columbia.edu/kermit/ckcbwr.html#x8
1442   25. http://www.columbia.edu/kermit/ckcbwr.html#x9
1443   26. http://www.columbia.edu/kermit/ckcbwr.html#x10
1444   27. http://www.columbia.edu/kermit/ckcbwr.html#x11
1445   28. http://www.columbia.edu/kermit/ckcbwr.html#top
1446   29. http://www.columbia.edu/kermit/ckcbwr.html#contents
1447   30. http://www.columbia.edu/kermit/ckcbwr.html#x2
1448   31. http://www.columbia.edu/kermit/ckcbwr.html#top
1449   32. http://www.columbia.edu/kermit/ckcbwr.html#contents
1450   33. http://www.columbia.edu/kermit/ckcbwr.html#x2
1451   34. http://www.columbia.edu/kermit/ck60manual.html
1452   35. http://www.columbia.edu/kermit/ckermit2.html
1453   36. http://www.columbia.edu/kermit/ck60manual.html
1454   37. http://www.columbia.edu/kermit/ckermit80.html#x5
1455   38. http://www.columbia.edu/kermit/ckermit80.html
1456   39. http://www.columbia.edu/kermit/ckermit80.html#x2.2
1457   40. http://www.columbia.edu/kermit/ckermit80.html#x8.7.2
1458   41. http://www.columbia.edu/kermit/ckermit80.html#x9
1459   42. http://www.columbia.edu/kermit/ckcbwr.html#top
1460   43. http://www.columbia.edu/kermit/ckcbwr.html#contents
1461   44. http://www.columbia.edu/kermit/ckcbwr.html#x3
1462   45. http://www.columbia.edu/kermit/ckcbwr.html#x1
1463   46. http://www.columbia.edu/kermit/ckcbwr.html#top
1464   47. http://www.columbia.edu/kermit/ckcbwr.html#contents
1465   48. http://www.columbia.edu/kermit/ckcbwr.html#x4
1466   49. http://www.columbia.edu/kermit/ckcbwr.html#x2
1467   50. http://www.columbia.edu/kermit/ckcbwr.html#top
1468   51. http://www.columbia.edu/kermit/ckcbwr.html#contents
1469   52. http://www.columbia.edu/kermit/ckcbwr.html#x5
1470   53. http://www.columbia.edu/kermit/ckcbwr.html#x3
1471   54. ftp://ftp.isi.edu/in-notes/rfc1122.txt
1472   55. http://www.columbia.edu/kermit/ckcbwr.html#top
1473   56. http://www.columbia.edu/kermit/ckcbwr.html#contents
1474   57. http://www.columbia.edu/kermit/ckcbwr.html#x6
1475   58. http://www.columbia.edu/kermit/ckcbwr.html#x4
1476   59. http://www.columbia.edu/kermit/ckcbwr.html#top
1477   60. http://www.columbia.edu/kermit/ckcbwr.html#contents
1478   61. http://www.columbia.edu/kermit/ckcbwr.html#x7
1479   62. http://www.columbia.edu/kermit/ckcbwr.html#x5
1480   63. http://www.columbia.edu/kermit/ck60manual.html
1481   64. http://www.columbia.edu/kermit/ckcbwr.html#x10
1482   65. http://www.columbia.edu/kermit/ckcbwr.html#top
1483   66. http://www.columbia.edu/kermit/ckcbwr.html#contents
1484   67. http://www.columbia.edu/kermit/ckcbwr.html#x8
1485   68. http://www.columbia.edu/kermit/ckcbwr.html#x6
1486   69. ftp://ftp.isi.edu/in-notes/rfc2217.txt
1487   70. http://www.columbia.edu/kermit/ckcbwr.html#top
1488   71. http://www.columbia.edu/kermit/ckcbwr.html#contents
1489   72. http://www.columbia.edu/kermit/ckcbwr.html#x9
1490   73. http://www.columbia.edu/kermit/ckcbwr.html#x7
1491   74. http://www.columbia.edu/kermit/ckcbwr.html#top
1492   75. http://www.columbia.edu/kermit/ckcbwr.html#contents
1493   76. http://www.columbia.edu/kermit/ckcbwr.html#x10
1494   77. http://www.columbia.edu/kermit/ckcbwr.html#x8
1495   78. http://www.columbia.edu/kermit/ckubwr.html
1496   79. http://www.columbia.edu/kermit/ckcbwr.html#top
1497   80. http://www.columbia.edu/kermit/ckcbwr.html#contents
1498   81. http://www.columbia.edu/kermit/ckcbwr.html#x11
1499   82. http://www.columbia.edu/kermit/ckcbwr.html#x9
1500   83. http://www.columbia.edu/kermit/ck60manual.html
1501   84. http://www.columbia.edu/kermit/ckermi70.htm
1502   85. http://www.columbia.edu/kermit/hp48.html
1503   86. http://www.columbia.edu/kermit/ckermit70.html#x4.22
1504   87. http://www.columbia.edu/kermit/ckermit80.html#x15
1505   88. http://www.columbia.edu/kermit/ckcbwr.html#top
1506   89. http://www.columbia.edu/kermit/ckcbwr.html#contents
1507   90. http://www.columbia.edu/kermit/ckcbwr.html#x10
1508   91. http://www.columbia.edu/kermit/ckcbwr.html#top
1509   92. http://www.columbia.edu/kermit/ckcbwr.html#contents
1510   93. http://www.columbia.edu/kermit/ckermit.html
1511   94. http://www.columbia.edu/kermit/ck80.html
1512   95. http://www.columbia.edu/kermit/index.html
1513   96. http://www.columbia.edu/kermit/index.html
1514   97. mailto:kermit@columbia.edu