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