remove patch with docs shipped with 301
[ckermit.git] / ckermit90.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
9       [11]CLICK HERE to read about some of these items.
10
11           [12]Table of platforms   [13]Book: Using C-Kermit   [14]Download
12                                                               C-Kermit 9.0
13
14 C-Kermit 9.0 Update Notes
15
16    Note: C-Kermit 9.0.301 contains a correction that applies only to
17    Solaris 10 and 11.
18      * [15]Large Files
19      * [16]How to Test Large-File Transfer
20      * [17]Arithmetic with Large Integers
21      * [18]FORCE-3 Packet Protocol
22      * [19]Variable Evaluation
23
24      * [20]The RENAME Command You Always Wanted
25      * [21]Other New Features
26      * [22]Incompatibilities
27      * [23]What's Not In C-Kermit 9.0
28      * [24]And a Loose End
29
30      * [25]Demonstration: Secure POP mail fetcher
31      * [26]Demonstration: HP Switch Configuration Backup
32      * [27]Demonstration: HP iLO Blade Configuration
33      * [28]Demonstration: IBM/Rolm/Siemens CBX Management
34      * [29]Demonstration: CSV and TSV Files
35      * [30]Demonstration Scripts for Webmasters
36
37    This is the third supplement to [31]Using C-Kermit, Second Edition. I
38    apologize for the scattered nature of the information and I hope I can
39    organize it and gather it all into one place for easy and definitive
40    reference some day. It's a big job so it depends on the demand. For the
41    time being the definitive reference and introduction is the book (which
42    is now available also in a [32]Kindle Edition), plus the [33]C-Kermit
43    7.0 update, [34]C-Kermit 8.0 update, and now this one. Plus tons of
44    other web pages on this site, sample script programs, and so on.
45
46    In version 6.0, C-Kermit was a pretty powerful and flexible
47    communication program with scripting capabilities. By version 9.0, I'd
48    like to think of it more as a scripting language with built-in
49    communications. You can get an idea of the kinds of programs you can
50    write in Kermit language [35]here. You can develop programs quickly
51    because it's an interactive program, not a compiler. The scripting
52    language is the command language. Kind of like the Unix shell but
53    "somewhat" less cryptic, including concepts not only from C but from
54    PL/I, Snobol, LISP, and Smalltalk. The language itself is built upon
55    the command language of the much-loved [36]DECSYSTEM-20 from the 1970s
56    and 80s, the Clipper Ship of the Text Era. (Text is not a bad word.
57    Those of us who can touch-type and who are proficient in text-based
58    computing environments like Unix shell or VMS DCL are likely to be
59    orders of magnitude more productive than users of GUIs.)
60
61    Thanks to (at least) Jeff Altman, William Bader, Ian Beckwith, Nelson
62    Beebe, Gerry Belanger, Joop Boonen, Rob Brown, Christian Corti, John
63    Dunlap, Peter Eichhorn, Carl Friedberg, Terry Kennedy, Günter Knauf,
64    Jason Lehr, Arthur Marsh, Lewis McCarthy, Gary Mills, Jonathan Reams,
65    Mike Rechtman, Mark Sapiro, Steven Schweda (SMS), Kinjal Shah, Michael
66    Sokolov, Andy Tanenbaum, Seth Theriault, Zach A. Thomas, Martin
67    Vorländer, and Eric Weaver for assistance, and to Hewlett-Packard
68    Company for support.
69
70      - Frank da Cruz   [37]fdc@columbia.edu, 30 June 2011
71
72    P.S. It occurred to me just before the end of the day that maybe I
73    should back up the Kermit website on DVD, just in case. Using
74    [38]Kermit 95 on the desktop over an SSH connection to the Unix file
75    system where the website resides, I made a fresh directory on the PC,
76    CD'd to it, and on Unix cd'd to the Website directory, and told
77    C-Kermit 9.0 to:
78
79 C-Kermit> send /recursive /dotfiles /nobackup *
80
81    and it re-created the website directory tree in the PC directory, text
82    files correctly converted to Windows format and binary files correctly
83    left as-is. The /dotfiles switch means to include files such as
84    .htaccess whose names start with a dot (period), and the /nobackup
85    switch means to skip backup files created by EMACs (such as
86    index.html.~243~). And then I did the same with the FTP sites, about
87    8GB in all. Watching the file-transfer display was kind of like having
88    30 years of my life flash before my eyes in a few minutes. Then I
89    copied the two directories to DVD (the FTP site had to split over 2
90    DVDs). The whole operation took under half an hour. The directory tree
91    on the CD is directly usable in Windows, Unix, or any other operating
92    system (unlike if I had made, say, a gzipped tar archive or a zip
93    archive). I believe that, to this day, Kermit is the only software that
94    can do this. If someday I have to upload from these DVDs to Unix, VMS,
95    or any other operating system, it can be done exactly the same way,
96    with any necessary conversions on text files done automatically, and
97    binary files left intact.
98
99 What's New in General
100
101    Very briefly, the major items:
102      * [39]Open Source license.
103      * [40]64-bit file accesss and transfer and 64-bit integer arithmetic
104        on most common platforms.
105      * Support for recent releases of Linux, Mac OS X, *BSD, etc ([41]see
106        table).
107      * Support for newer OpenSSL releases up to and including 1.0.0d
108        ([42]see table).
109      * [43]Strengthened error checking for file transfer under extremely
110        harsh conditions.
111      * [44]Simplified semantics for variables used in scripts.
112      * Super-handy [45]extensions to the RENAME command.
113      * Other scripting improvements including support for reading and
114        writing [46]CSV and TSV files.
115      * [47]MIME character-set names are now recognized.
116      * Improved logging and debugging (see demo [48]here).
117      * Lots more described or listed below, and [49]here.
118
119 Open Source License
120
121    C-Kermit 9.0 has the [50]Revised 3-Clause BSD License, an open source
122    license approved by OSI, the [51]Open Source Initiative.
123
124 Large Files
125
126    Kermit is, first and foremost, a file-transfer program. One might
127    expect it to be able to transfer any kind of file, but that has been
128    decreasingly the case as file sizes began to cross the 2 gigabyte
129    threshold.
130
131    The biggest change since C-Kermit 8.0.211 is support for large files on
132    platforms that support them. A "large file" is one whose size is
133    greater than 2^31-1 (2,147,483,647) bytes (2GB-1); that is, one whose
134    size requires more than 31 bits to represent. Before now, Kermit was
135    able to accesss such files only on 100% 64-bit platforms such as
136    Digital Unix, later known as Tru64 Unix. In the new release, Kermit
137    takes advantage of the X/Open Single UNIX Specification Version 2 (UNIX
138    98) Large File Support (LFS) specification, which allows 32-bit
139    platforms to create, accesss, and manage files larger than 2GB.
140
141    Accommodating large files required code changes in many modules,
142    affecting not only file transfer, but also file management functions
143    from directory listings to local file manipulation, plus the user
144    interface itself to allow entry and display of large numbers. All this
145    had to be done in a way that would not affect pure 32-bit builds on
146    platforms that do not support large files. Large file support is
147    summarized in the [52]Table of Platforms; entries in Yellow (32-bit
148    builds that support 64-bit integers) and Green (64-bit builds) support
149    large files.
150
151    Note that VMS C-Kermit and Kermit 95 for Windows have always been able
152    to transfer large files. However their user interface used 32-bit
153    integers for statistics and the file transfer display. In C-Kermit 9.0
154    Alpha.03, VMS C-Kermit on 64-bit platforms (Alpha and Itanium) should
155    now give correct statistics and progress displays. (We'll see about
156    Kermit 95 later.)
157
158 How to Test Large-File Transfer
159
160    Several methods are available for testing large-file transfers:
161      * By transferring a real file that is more than 2147483648 bytes long
162        (a file whose length requires more than 31 bits to express); or to
163        be totally sure, that is longer than 4294967296 bytes (32 bits or
164        more). Or to be double super sure, longer than 8589934592 (33
165        bits).
166      * If you don't have such a file or there is not sufficient disk space
167        for such a file, you can create a special kind of file that takes
168        up one block on the disk but appears to be 4.3GB long by compiling
169        and running [53]THIS C PROGRAM on Linux, Solaris, HP-UX, or other
170        Unix platform that supports large files. Kermit or FTP or any other
171        file transfer program will transfer the result (BIGFILE) in such a
172        way as to actually put 4.3GB (or other desired size; see source) on
173        the wire.
174      * You can use Kermit's CALIBRATE feature to transfer a large file
175        that doesn't exist. At the receiver, use RECEIVE /CALIBRATE. At the
176        sender, use SEND /CALIBRATE:length, e.g.:
177
178      (At remote kermit...)
179      $ kermit -Y
180      C-Kermit> receive /calibrate
181      (Return to local kermit...)
182      Ctrl-\c
183      C-Kermit> send /calibrate:4300000000
184        This sends a simulated file 4.3GB in length, that does not exist on
185        the sender and will not take up any disk space on the receiver.
186        SEND /CALIBRATE: accepts big numbers only in Kermit versions that
187        support them (this does not include Kermit 95 on Windows). This
188        method tests only Kermit's ability to express and understand large
189        file sizes, but does not test Kermit's file-system interface, since
190        no files are involved.
191
192 Arithmetic with Large Integers
193
194    Because large file support requires the availability of a 64-bit signed
195    integer data type, other aspects of C-Kermit were adapted to use it
196    too, most notably Kermit's algebraic expression evaluator and its
197    [54]S-Expression interpreter, on all platforms that support large files
198    (those listed as 64 or 32/64 in the Word column of the [55]table). In
199    fact, every Kermit command that parses a number in any field can now
200    parse a large number on those platforms.
201
202    S-Expressions can now be forced to operate with integers only, without
203    floating-point conversion or having to explicitly truncate each result;
204    as an example. see the revised [56]Easter date calculation script.
205
206 FORCE-3 Packet Protocol
207
208    The Kermit protocol has proven itself over the past 30 years to be
209    robust in terms of surviving harsh transmission environments and
210    delivering the data correctly and completely. In these times of
211    Internet everywhere and error-correcting modems in the few places where
212    the Internet isn't, few people even recall the kinds of difficult
213    conditions that were common when the Kermit protocol was first
214    developed: noisy telephone lines, serial interfaces that drop
215    characters, lack of transparency to control or 8-bit characters,
216    absence of flow control, "bare" modems without error correction.
217
218    But the Internet is not everywhere, and not all modems are
219    error-correcting. Perhaps the most difficult trial so far for Kermit or
220    any other protocol is the [57]EM-APEX project, in which floats are
221    dropped into the ocean from an aircraft into the path of a hurricane;
222    these floats dive into the water measuring current, temperature, and
223    salinity at different depths and then surface to phone home, sending
224    the data to land stations using Kermit protocol over
225    non-error-correcting 300bps [58]Iridium satellite modems, with high
226    seas and winds battering the floats and heavy ([59]sometimes
227    electrical) storms between the modem and the satellite.
228
229    Because of the transmission speed and long distances involved, the
230    transfers were very slow. The Kermit software in the floats is
231    [60]Embedded Kermit, which did not implement sliding windows, which
232    would have sped up the flow considerably. John Dunlap, engineer at the
233    University of Washington's Applied Physics Laboratory, undertook the
234    task of adding sliding windows to E-Kermit. For testing, he rigged up a
235    [61]simulator in which Kermit transfers take place over a connection
236    with different amounts of noise and delay. He found that occasionally,
237    a transfer would appear to succeed, but the received file would be
238    corrupt.
239
240    According to the Kermit protocol definition, the first packet always
241    has block-check type 1, a 6-bit checksum, which is the only block check
242    type that all Kermit implementations are required to support; thus any
243    Kermit partner can process this packet. This packet itself can
244    negotiate a higher level of checking, such that subsequent packets have
245    (say) block-check type 3, a 16-bit cyclic redundancy check (CRC)
246    encoded as three printable 7-bit ASCII characters. The 16-bit CRC can
247    catch all errors of certain kinds (single-bit, double-bit, bursts of 16
248    bits or less), and more than 99.9984741210937% of all other possible
249    errors.
250
251    John's simulations revealed that file corruption could occur undetected
252    when the initial packet was corrupted in such a way that a parameter or
253    capability byte was changed and the checksum also changed to make the
254    packet appear to be correct, thus allowing the transfer to proceed with
255    the two Kermit partners out of sync as to packet encoding and
256    interpretation (the chances of two such errors producing a seemingly
257    valid packet are about 1 in 6000 when using the 6-bit checksum). For
258    example, the compression technique might be misnegotiated and then the
259    receiver might store incoming data without decompressing it.
260
261    The solution is a new option, selected by:
262
263      BLOCK-CHECK TYPE 5
264
265    to require a type 3 block check (16-bit CRC) on every packet, including
266    the initial ones, thus reducing the probability of a misnegotiation by
267    many orders of magnitude. THIS PARAMETER CAN NOT BE NEGOTIATED. Each
268    Kermit program must be given the "set block 5" command prior to
269    transfer. That's because normally every Kermit program expects the
270    first packet to have a 6-bit checksum, and if the first packet has a
271    3-byte, 16-bit CRC, the packet receiver will think it is corrupted.
272
273    In practice, however, it is possible to code the packet receiver
274    "cheat" by reading the packet data before verifying the block check.
275    Thus when the receiver is C-Kermit 9.0 Beta.01 or later or E-Kermit 1.7
276    or later, it is only necessary to give the "set block 5" command to the
277    file sender, and the receiver will check for a FORCE-3 first packet. If
278    the receiver does not support this feature, however, the the initial
279    packet will be be rejected (after several retries) and the file
280    transfer will not take place. There is no attempt to "back off" to
281    normal behavior.
282
283    CAPTION: Table 4. Kermit Protocol Packet Block Check Types
284
285    Type Command Bytes Status Explanation
286    1 SET BLOCK 1 1 Required in all Kermit implementations. Negotiated.
287    6-bit checksum, suitable for good connections.
288    2 SET BLOCK 2 2 Optional, negotiated. 12-bit checksum. 64 times
289    stronger than type 1.
290    3 SET BLOCK 3 3 Optional, negotiated. 16-bit CRC.
291    BLANK-FREE-2 SET BLOCK 4 2 Optional, negotiated. 12-bit checksum, two
292    nonblank bytes.
293    FORCE-3 SET BLOCK 5 3 Optional, not negotiated. 16-bit CRC forced all
294    packets.
295
296    BLANK-FREE-2 is for environments where Kermit packets are treated as
297    lines of text, and in which trailing blanks can be stripped; for
298    example, when transferring files with an IBM mainframe through a 3270
299    protocol converter.
300    [62]E-Kermit 1.7
301
302 Variable Evaluation
303
304      Does the strange behavior of Kermit's \%x variables puzzle or annoy
305      you?
306
307    Kermit software development has been a collaborative project over the
308    years, with contributions coming in from almost every country and every
309    sector of the economy - academic, corporate, government. Thus not all
310    versions, and not all features of a given version, are a product of
311    systematic design.
312
313    One example was the introduction of variables for text substitution,
314    first in a version of MS-DOS Kermit that was sent in by someone
315    somewhere (I could look it up, but no time...) Although the design of
316    the notation for variable names (table below) is mine, the underlying
317    code was contributed. In that code there was only one kind of variable,
318    and if I recall correctly the variable name was a backslash followed by
319    a single letter, for example \a, \b, etc. The contributed code
320    evaluated these variables recursively, meaning if the definition of a
321    variable contained variable references, then these were resolved when
322    derefencing the variable, and the process would continue as deep down
323    as necessary to resolve the thing fully.
324
325    This was sometimes handy, but it had one severe drawback: There was no
326    way to use variables in a straightforward way to represent strings that
327    contained literal backslashes; for example, DOS or Windows pathnames.
328    This gave rise to all kinds of quoting rules and conventions (e.g.
329    doubling backslashes or forcing single-level evaluation with
330    \\fcontents()), and also to the introduction of other kinds of
331    variables that were evaluated one level deep, rather than recursively.
332
333    To accommodate coexistence of different kinds of variables as well as
334    "escape sequences" for representing control and 8-bit characters, the
335    syntax for variable names was extended to include three elements: the
336    leading backslash, then a single character indicating the type of
337    variable, and then the name of the variable in a format corresponding
338    to the type designator, as shown in this somewhat simplified table:
339
340    CAPTION: Table 1. Variable-name Syntax in Kermit
341
342    Notation Meaning
343    \000 - \255 8-bit character constant (decimal)
344    \d000 - \d255 Alternative notation for 8-bit character (byte) constant
345    (decimal)
346    \o000 - \o377 8-bit character constant (octal)
347    \x00 - \xff 8-bit character constant (hexadecimal)
348    \%a - \%z Scalar variable, evaluated recursively.
349    \%0 - \%9 Macro argument, scalar, evaluated recursively.
350    \&a - \%& Array name
351    \&a[x] Array reference, evaluated recursively (x is any constant or
352    variable)
353    \v(name) Built-in scalar variable, evaluated one level deep.
354    \m(name) User-defined scalar variable, evaluated one level deep.
355    \$(name) An environment variable, evaluated one level deep.
356    \s(name[n:m]) Compact substring notation, evaluated one level deep.
357    \fname(args...) Built-in function with zero or more arguments.
358    \\ Literal backslash
359    \N OUTPUT command only: NUL, ASCII 0
360    \B OUTPUT command only: BREAK (250ms, for serial connections)
361    \L OUTPUT command only: Long BREAK (1.5sec, ditto)
362
363    Variable names in Kermit are case-independent. The simplifications in
364    the table are that the notation for decimal and octal bytes can have
365    from one to three digits, and can include braces to separate them from
366    text digits, e.g. \7, \{123}, \o{50}. Hex bytes too, except they must
367    always have exactly two hex digits, 0-9a-f. Array indices must be, or
368    must evaluate to, numbers (floating point numbers are truncated).
369    Associative arrays are also available (dynamic arrays with arbitrary
370    text as subscript), but they are really just a variation on \m()
371    variables (read about associative arrays [63]here). Also, there are
372    some alternative notations for compact substring notation.
373
374    We didn't want to have lots of "distinguished" characters, as the UNIX
375    shell does; one is enough, clarity over brevity. Although the notation
376    can be a bit cumbersome, we can use the \m(name) form to circumvent the
377    overevaluation in most contexts. But macro arguments are always
378    assigned to the \%0-9 variables, and thus always evaluated recursively,
379    making it difficult and confusing to pass (e.g.) Windows pathnames as
380    arguments to macros. The same is true for array elements, especially in
381    contexts where they are used to return results from built-in functions
382    (for example, \fsplit() used to return the elements of a
383    [64]comma-separated value list if any of the values contained
384    backslashes). An even worse scenario is when macro arguments are passed
385    from one macro to another; for some graphic illustrations see
386    [65]Taming the Wild Backslash - Part Deux from the [66]C-Kermit 7.0
387    Update Notes.
388
389    We can't just change how variables are evaluated because that would
390    break existing scripts. But we can always add Yet Another SET Command:
391
392      SET COMMAND VARIABLE-EVALUATION { RECURSIVE, SIMPLE }
393
394    This applies only to \%a-z and \%0-9 variables and to \&a-z[] arrays
395    (since all other kinds of variables are evaluated only one level deep).
396    The default, of course, for backwards compatibility, is RECURSIVE.
397    SIMPLE forces the evaluation of these variables to return their literal
398    contents, without further evaluation:
399
400      * An exception is made in the case of array subscripts, because
401        changing how they are evaluated could break a lot of scripts, and
402        anyway there should never be any harm in evaluating them
403        recursively because their final value is always (or should be)
404        numeric, not some string that might contain backslashes.
405      * The VARIABLE-EVALUTION setting is on the command stack. Thus you
406        can give this command in a macro, command file, or user-defined
407        function without affecting the calling environment.
408      * The new \frecurse() function forces recursive evaluation of its
409        argument regardless of the VARIABLE-EVALUATION setting. The
410        argument can be any string (or nothing at all); all the variables
411        in the string, even \m() ones, are evaluated recursively:
412
413 def \%a 1 \%b 3
414 def \%b 2
415 def xx easy as \%a
416 show mac xx
417 echo \frecurse(\m(xx))
418 easy as 1 2 3
419 echo \frecurse(it's as easy as \m(xx))
420 it's as easy as easy as 1 2 3
421
422      * The new \v(vareval) built-in variable contains the current setting
423        (recursive or simple) at the current command-stack level.
424
425    Here's a short script for illustration:
426
427 define path c:\users\fdc\somefile.txt
428 define test1 {        # Normal recursive argument evaluation
429   echo \%0: arg=\%1
430 }
431 define test2 {        # Simple argument evaluation
432   set var simple
433   echo \%0: arg=\%1
434 }
435 test1 \m(path)
436 test2 \m(path)
437 exit
438
439    And here's the result:
440
441 ?<ERROR:NO_SUCH_FUNCTION:\fdc\somefile.txt()>
442 test2: arg=c:\users\fdc\somefile.txt
443
444    The first line might seem surprising, but under the normal rules (see
445    table above) \f indicates a function call, with the letters following
446    the 'f' being the name of the function. But there is no function by
447    that name... and if there were, you probably didn't intend to call it!
448
449    SET COMMAND VARIABLE-EVALUATION SIMPLE has no effect on constants, only
450    on variables. Note how \m(path) is defined. The DEFINE command assigns
451    the literal value of its argument to the named variable (see Table 3
452    below), thus in this case no special syntax is needed. But in other
453    contexts, you must double the backslashes or use the \fliteral()
454    function to use literal backslashes in data:
455
456 test2 c:\\users\\fdc\\somefile.txt
457 test2 \fliteral(c:\users\fdc\somefile.txt)
458
459    C-Kermit 9.0 adds a new notation for \fliteral() which also has certain
460    advantages over it: \q(string):
461
462 test2 \q(c:\users\fdc\somefile.txt)
463
464    Since \fliteral() is a function, its argument list (the text within
465    parentheses) has special syntax of its own, in which commas and braces
466    are treated specially and introduce another set of quoting problems.
467    \q(string) doesn't have these problems. The only consideration is that
468    parentheses must be balanced or else quoted (preceded by backslash), or
469    represented as numeric character entities (left paren = \40, (right
470    paren = \41).
471
472    Or else hold the value in a simple variable as we did with \\m(path)
473    above.
474
475    SET COMMAND VARIABLE-EVALUATION SIMPLE is a big change and might have
476    repercussions that didn't show up in the initial tests; a lot more
477    testing is needed.
478
479    On the topic of variables, let's summarize in one place the ways in
480    which values can be explicitly assigned to variables. There is nothing
481    new here except the table itself:
482
483    CAPTION: Table 2. Variable Assignment in Kermit
484
485    Command Shorthand Explanation
486    DEFINE name value .name = value The literal value becomes the contents
487    of the named variable; variables names in the value are copied without
488    evaluation. This command is for defining macros that take parameters,
489    as well as for defining simple variables, especially if the values
490    contain backslashes.
491    _DEFINE name value   Like DEFINE but the name is evaluated before use.
492    ASSIGN name value .name := value The value is evaluated and the result
493    becomes the contents of the named variable.
494    _ASSIGN name value   Like ASSIGN but the name is evaluated before use.
495    EVALUATE name expression .name ::= value The expression (in regular
496    algebraic notation) is evaluated arithmetically and the result becomes
497    the contents of the named variable. If the expression contains any
498    variables they are evaluated first.
499    _EVALUATE name expression   Like EVALUATE but the name is evaluated
500    before use.
501    INCREMENT name expression   Evaluates the variables in the expression,
502    then evaluates the expression arithmetically, and then adds the value
503    to the contents of the named variable, which must be a number or an
504    algebraic expression. If the expression is empty, a value of 1 is used.
505    _INCREMENT name expression   Like INCREMENT but the name is evaluated
506    before use.
507    DECREMENT name expression   Evaluates the variables in the expression,
508    then evaluates the expression arithmetically, and then subtracts the
509    value from the contents of the named variable, which must be a number
510    or an algebraic expression. If the expression is empty, a value of 1 is
511    used.
512    _DECREMENT name expression   Like DECREMENT but the name is evaluated
513    before use.
514    DECLARE name = list   An array declaration can include an initializer
515    list; items in the list are evaluated before assignment. This can be
516    defeated by doubling any backslashes or enclosing individual arguments
517    in \fliteral().
518    DO name arguments name arguments When invoking a macro with a DO
519    command (or an implied one), the arguments are evaluated, then assigned
520    to \%1, \%2, etc, and the macro's name to \%0.
521    (SETQ name value)   Kermit also includes a mini-[67]LISP interpreter
522
523    Variables are evaluated automatically in Kermit commands simply by
524    referencing them, according to rules given in Table 1. The following
525    functions can be used to change how a a particular variable is
526    evaluated:
527
528    CAPTION: Table 3. Kermit Functions for Evaluating Variables
529
530    Function Argument Description
531    \fcontents() \%x or \&x[y] Evaluates the variable or array element
532    (which normally would be evaluated recursively) one level deep.
533    \fdefinition() name If the argument is a \%x variable or an array
534    element, it is evaluated to get the name; otherwise the argument is the
535    name. Its definition is returned with no recursion.
536    \m() name Equivalent to \fdefinition().
537    \frecurse() \m(name) Forces recursive evaluation of a macro definition
538    (a.k.a. long variable name). NOTE: \frecurse() can operate on any kind
539    of variable as well as on any string containing any mixture of
540    variables.
541
542 C-Kermit's RENAME Command
543
544    C-Kermit's RENAME command, which is used for changing the names of
545    local files or for moving files locally, has two basic forms:
546
547    RENAME [ optional-switches ] oldfilename newfilename
548           This form lets you change the name of a single file from
549           oldfilename to newfilename. Example:
550           rename thismonth.log lastmonth.log
551
552    RENAME [ optional-switches ] filespec directoryname
553           This form lets you move (without renaming) one or more files
554           (all the files that match the filespec, which may contain
555           wildcard characters such as "*") to the given directory.
556           Example:
557           rename *.txt ~/textfiles/
558
559    Traditionally, the optional switches have been:
560
561    RENAME /LIST oldname newname
562           Display the old and new name for each file while renaming.
563           Synonyms: /LOG, /VERBOSE. Example:
564           rename /list *.txt ~/textfiles/
565
566    RENAME /NOLIST oldname newname
567           Don't display the old and new name for each file while renaming.
568           This is the default behavior. Synonyms: /NOLOG, /QUIET. Example:
569           rename /nolist *.txt ~/textfiles/
570
571    Reminder: Every switch starts with a slash (/) and must be preceded by
572    a space.
573
574 New RENAME Features for C-Kermit 9.0
575
576    A series of new options (switches) have been added to let you change
577    the names of multiple files at once by case conversion, string
578    substitution, or character-set conversion, and optionally also move
579    them to a different directory:
580
581      /LOWER:      Convert the filename to lowercase
582      /UPPER:      Convert the filename to uppercase
583      /CONVERT:    Change the filename's character encoding
584      /REPLACE:    Do string substitutions on the filename
585
586    If the source-file specification includes a path or directory, any
587    changes are applied to the filenames only, not to the directory or path
588    specification.
589
590    Since name changes, when applied to many files at once, can have
591    consequences that are not easily undone, there are also some new
592    controls, safeguards, and conveniences:
593
594    RENAME /SIMULATE
595           This switch tells Kermit to show you what the RENAME command
596           would do without actually doing it. /SIMULATE implies /LIST.
597
598    RENAME /COLLISION:{FAIL,SKIP,OVERWRITE}
599           This switch governs Kermit's behavior when renaming multiple
600           files, and any of the names would collide with the name of a
601           file that already exists. The default, for compatibility with
602           earlier releases of C-Kermit, is OVERWRITE, i.e. write over the
603           existing file. The other two protect existing files. SKIP means
604           to skip (not rename) the file that would cause the collision,
605           and proceed to the next file, if any. FAIL means that no files
606           will be renamed if there would be any collisions; for this
607           Kermit makes two passes, checking each new name it constructs
608           for existence before starting the second pass (however, there is
609           no guarantee that in the second pass, it won't create the same
610           new name for more than one file; in that case, it will stop
611           before executing the second rename). Example:
612           rename /simulate /collision:proceed * ~/tmp/
613
614    Reminder: In switches such as /COLLISION that take arguments
615    (operands), the switch name and its argument(s) are separated by a
616    colon (:) with no intervening spaces. Also remember that Kermit
617    keywords can always be abbreviated by leaving off characters from the
618    right, as long as the result is still unique in its context. Thus "ren
619    /col:f" would be equivalent to "rename /collision:fail".
620
621    You can change the following preferences for the RENAME command with
622    the new SET RENAME command:
623
624    SET RENAME LIST { ON, OFF }
625           Tells the RENAME command whether to list its actions if you
626           don't include a /LIST or /NOLIST or equivalent switch.
627
628    SET RENAME COLLISION { FAIL, OVERWRITE, SKIP }
629           Tells the RENAME command how to handle filename collisions in
630           the absence of a /COLLISION switch. That is, it replaces the
631           default action of OVERWRITE with action of your choosing, which
632           is then used in any RENAME command that does not include an
633           explicit /COLLISION switch.
634
635    SHOW RENAME
636           Displays the current SET RENAME settings.
637
638 Changing the Case of Filenames
639
640    RENAME /UPPER:{ALL,LOWER} filespec [ directory ]
641           RENAME /LOWER:{ALL,UPPER} filespec [ directory ]
642           These switches let you change the alphabetic case of letters in
643           all the files whose names match the filespec. If a directory
644           name is given after the filespec, then the files are also moved
645           to the given directory.
646
647    By default, all files that match the given filespec have their names
648    changed (if necessary). This is what the ALL argument means, e.g.:
649
650      RENAME /LOWER:ALL *
651      RENAME /LOWER *
652
653    You can use either form: RENAME /LOWER is equivalent to RENAME
654    /LOWER:ALL. The other argument (/LOWER:UPPER or /UPPER:LOWER) means to
655    leave mixed-case filenames alone, and rename only those files whose
656    names contain letters of only the given case. Examples:
657
658    RENAME /UPPER:ALL foo.bar
659           Changes the filename to FOO.BAR.
660
661    RENAME /UPPER foo.bar
662           Same as "rename /upper:all foo.bar".
663
664    RENAME /UPPER foo.bar ~/old/
665           Renames foo.bar to FOO.BAR and moves it to the user's old
666           directory (Unix).
667
668    RENAME /LOWER *
669           Changes the names of all files to have only lowercase letters.
670
671    RENAME /LOWER:UPPER *
672           Changes the names of only those files whose names contain no
673           lowercase letters to have only lowercase letters. For example,
674           FOO.BAR would be changed, Foo.Bar would not be changed. foo.bar
675           would not be changed either because it's already all lowercase.
676
677    RENAME /LOWER:UPPER * ~/new/
678           Same as the previous example, but also moves each file to the
679           user's new directory (whether it was renamed or not).
680
681    Case conversion works reliably for ASCII characters only. Kermit uses
682    the C library for this, which on any given platform might or might not
683    handle non-ASCII letters, and if it does, then how it works would
684    normally depend on your locale definitions (the LC_CTYPE and/or LANG
685    environment variable in Unix). When non-ASCII letters are not handled
686    by the C library, the RENAME command does change their case. For
687    example, Olga_Tañón.txt might become OLGA_TAñóN.TXT.
688
689 String Replacement in Filenames
690
691    The RENAME command also lets you change filenames by string
692    substitution.
693
694    RENAME /FIXSPACES[:String] filespec [ directory ]
695           Replaces all spaces in each matching filename by the given
696           string, if any, or if none is given, by underscore. Examples:
697
698      RENAME /FIX *
699      RENAME /FIXSPACES:_ *
700      RENAME /FIXSPACES:"" *
701      RENAME /FIXSPACES:<040> *
702
703           The first two are equivalent, replacing each space with
704           underscore; a file called "My Favorite Photo.jpg" becomes
705           "My_Favorite_Photo.jpg". The third example removes all spaces
706           ("MyFavoritePhoto.jpg"). The fourth replaces each space with the
707           string "<040>" ("My<040>Favorite<040>Photo.jpg").
708
709    RENAME /REPLACE:{{String1}{String2}} filespec [ directory ]
710           Renames each matching file by changing occurrences of String1 in
711           its name to String2. If a directory specification is included,
712           the file is also moved to the given directory (even if the name
713           was not changed). Note that in this case, the curly braces are
714           part of the command. Example:
715
716      RENAME /REPLACE:{{.jpeg}{.jpg}} *
717
718           changes all *.jpeg files to *.jpg.
719
720    By default, RENAME /REPLACE changes all occurrences of String1 in each
721    filename to String2 so, for example, if you had a file called
722    abcjpegxyz.jpeg, the command just shown would change its name to
723    abcjpgxyz.jpg.
724
725    For greater control and flexibility, the /REPLACE: switch argument can
726    take several distinct forms:
727
728    RENAME /REPLACE:String1 filespec [ directory ]
729           This means to remove all occurrences of String1 from the given
730           filenames name. It is equivalent to /REPLACE:{{String1}{}}. A
731           handy use for this option is to remove spaces from filenames.
732
733    RENAME /REPLACE:{{String1}{String2}} filespec [ directory ]
734           As already noted, this replaces every occurrence of String1 with
735           String2 in each filename. Alphabetic case in string matching is
736           done according to the current SET CASE setting.
737
738    RENAME /REPLACE:{{ }{_}} filespec [ directory ]
739           This replaces all spaces in the given filenames with underscore,
740           equivalent to RENAME /FIXSPACES.
741
742    RENAME /REPLACE:{{String1}{String2}{Options}} filespec [ directory ]
743           Options can be included that add more control to the process.
744           The option string is a sequence of characters; each character in
745           the string is an option. The choices are:
746
747    A String matching is to be case-sensitive, regardless of SET CASE.
748    a String matching is to be case-independent, regardless of SET CASE.
749    ^ String replacement will occur only at the beginning of the filename.
750    $ String replacement will occur only at the end of the filename.
751    1 Only the first occurrence of the string will be replaced.
752    2 Only the second occurrence of the string will be replaced.
753    3 4 5 6 7 8 ...
754    9 Only the ninth occurrence of the string will be replaced.
755    - (hyphen, minus sign) Before a digit: occurrences will be counted from
756    the right.
757    ~ (tilde) Before digit or minus sign: all occurrences but the given one
758    will be replaced.
759
760    The tilde modifier works only with single-byte character sets such as
761    ASCII, CP437, ISO 8859-1, etc, but not with multibyte character sets
762    such as UCS2, UTF8, or any of the Japanese Kanji sets.
763
764    Here are some examples showing how to use the /REPLACE options:
765
766    RENAME /REPLACE:{{foo}{bar}{^}} *
767           For all files whose names start with "foo", replaces the "foo"
768           at the beginning with "bar".
769
770    RENAME /REPLACE:{{}{New-}{^}} *
771           Prepends "New-" to the name of each file.
772
773    RENAME /REPLACE:{{.jpeg}{.jpg}{$}} *
774           Replaces ".jpeg" at the end of each filename with ".jpg".
775
776    RENAME /REPLACE:{{}{-Old}{$}} *
777           Appends "-Old" to the name of each file.
778
779    RENAME /REPLACE:{{foo}{bar}{a}} *
780           Replaces "foo", "FOO", "Foo", "fOO", etc, with "bar" in each
781           filename.
782
783    RENAME /REPLACE:{{foo}{bar}{A}} *
784           Replaces only (lowercase) "foo" in filenames with "bar".
785
786    RENAME /REPLACE:{{a}{XX}} *
787           Changes every "a" to "XX". For example a file called "a.a.a.a"
788           would become "XX.XX.XX.XX".
789
790    RENAME /REPLACE:{{a}{X}{2}}
791           Changes only the second "a" to "X". For example a file called
792           "a.a.a.a" would become "a.X.a.a".
793
794    RENAME /REPLACE:{{a}{X}{-1}}
795           Changes only the final "a" in the filename (it doesn't have to
796           be at the end) to "X". For example a file called "a.b.a.c.a.d"
797           would become "a.b.a.c.X.d".
798
799    RENAME /REPLACE:{{foo}{NOTFOO}{-2}}
800           Changes the second-to-last "foo" (if any) in the filename to
801           "NOTFOO".
802
803    RENAME /REPLACE:{{foo}{}{-2}}
804           Deletes the second-to-last "foo" (if any) from the filename.
805
806    RENAME /REPLACE:{{.}{_}{~1}}
807           Changes all but the first period to an underscore; for example,
808           "a.b.c.d.e" would become "a.b_c_d_e".
809
810    RENAME /REPLACE:{{.}{_}{~-1}}
811           Changes all but the final period to an underscore; for example,
812           "a.b.c.d.e" would become "a_b_c_d.e".
813
814    In the Options field, digits (and their modifiers), ^, and $ are
815    mutually exclusive. If you include more than one of these in the option
816    string, only the last one is used. Similarly for 'a' and 'A':
817
818    RENAME /REPLACE:{{foo}{bar}{Aa2$^}} *
819           This replaces "foo" with "bar" no matter what combination of
820           upper and lower case letters are used in "foo" ('a' overrides
821           'A' in the option string), but only if "foo" is at the beginning
822           of the filename ('^' overrides '$' and '2').
823
824    If you give an /UPPER or /LOWER switch and a /REPLACE switch in the
825    same RENAME command, the /REPLACE action occurs first, then the case
826    conversion:
827
828    RENAME /REPLACE:{{foo}{bar}} /UPPER * /tmp
829           For each file: changes all occurrences of "foo" in the name to
830           "bar", then converts the result to uppercase, and then moves the
831           file to the /tmp directory. So (for example) "foot.txt" would
832           become "/tmp/BART.TXT".
833
834 Changing the Character Encoding of Filenames
835
836    As you know, text is represented on the computer as a series of
837    numbers, with a given number corresponding to a given character
838    according to some convention or standard. Filenames are represented the
839    same way. The trouble is, different computers, or even different
840    applications on the same computer, might use different standards or
841    conventions ("character sets") for representing the same characters.
842    Usually ASCII is safe, but anything beyond that -- non-ASCII characters
843    such as accented or non-Roman letters -- is likely to vary. Sometimes
844    you have text that's in the "wrong" character set and you need to
845    convert it to something you can can use. Kermit has always been able to
846    handle this as part of file transfer and terminal emulation, as well as
847    being able to convert text files locally with its TRANSLATE command.
848    Now there's a way to convert filenames too, for example after copying
849    files from a CD that uses a different encoding:
850
851    RENAME /CONVERT:charset1:charset2 filespec [ directory ]
852           Converts filenames from the first character set to the second
853           one. The two character sets can be chosen from the SET FILE
854           CHARACTER-SET list; for complete details see [68]this page. For
855           example suppose you have a file called "Olga_Tañón.txt" on a
856           computer where ISO 8859-1 Latin Alphabet 1 is used, and you have
857           transported it (e.g. on CDROM) to another computer where the
858           text encoding is UTF8. Maybe you also have a lot of other files
859           with similar names in the same directory. You can convert the
860           filenames to UTF8 like this:
861
862      RENAME /CONVERT:latin1:utf8 *
863
864    /CONVERT can not be combined with /UPPER, /LOWER, or /REPLACE.
865
866    You should NOT use UCS2 for filenames since this encoding is not
867    compatible with C strings used in Unix and elsewhere.
868
869    RENAME /CONVERT affects only the filename, not the file's contents. You
870    can use the TRANSLATE command to convert the encoding of the contents
871    of a text file.
872
873 Other New Features
874
875    See the [69]C-Kermit Daily Builds page for details. Very briefly:
876
877      * Perhaps most important, modernized makefile targets for the major
878        Unix platforms: Linux, Mac OS X, AIX, Solaris, etc. These are
879        somewhat automated; not autoconf exactly, but they cut down
880        significantly on redundant targets. For example, one single "linux"
881        target works on many (hopefully all) different Linux
882        configurations, where before different targets were required for
883        different combinations of (e.g.) curses / ncurses / no curses;
884        32-bit / 64-bit; different feature sets and library locations.
885        (Separate targets are still required for Kerberos and/or SSL
886        builds, but they are "subroutinized".)
887      * Bigger buffers, more storage for commands, macros, scripts,
888        strings, and filename expansion in 64-bit versions and in 32-bit
889        versions that support large files.
890      * User-settable FTP timeout, works on both the data and control
891        connection.
892      * FTP accesss to ports higher than 16383.
893      * Built-in FTP client for VMS. This is the [70]same FTP client Unix
894        C-Kermit has had since version 8.0, minimally adapted to VMS by
895        SMS, supporting binary and Stream_LF file transfer only (in other
896        words, nothing to handle RMS files), but otherwise fully functional
897        (and scriptable) and theoretically capable of making connections
898        secured by SSL (at least it compiles and links OK with SSL - HP SSL
899        1.3 in this case).
900      * Large file support in VMS, also by SMS. Alpha and Itanium only (not
901        VAX). VMS C-Kermit was already able to transfer large files, but
902        the file-transfer display (numbers and progress bar) and statistics
903        were wrong because they used ints. In the present Alpha test
904        release, this is an optional feature requested by including the "f"
905        option in P1.
906      * New PUTENV command that allows Kermit to pass environment variables
907        to subprocesses (Unix only, "help putenv").
908      * New TOUCH command, many file selection options ("help touch").
909      * New DIRECTORY command options and switches (/TOP, /COUNT;
910        HDIRECTORY, WDIRECTORY...). To see the ten biggest files in the
911        current directory: "dir /top:10 /sort:size /reverse *" or
912        equivalently, "hdir /top:10 *". WDIR lists files in reverse
913        chronological order, shorthand for "dir /sort:date /reverse".
914      * New command FSEEK /FIND:string-or-pattern, seeks to the first line
915        in an FOPEN'd file that contains the given string or matches the
916        given pattern. Example: Suppose you have a file of lines like this:
917
918      quantity   description...
919        in which the first "word" is a number, followed by a description
920        (for example, the name of an item). Here is how to use FSEEK to
921        quickly get the total quantity of any given item, which is passed
922        as a parameter (either a literal string or a pattern) on the
923        command line:
924
925 #!/usr/local/bin/kermit +
926 if not def \%1 exit 1 Usage: \fbasename(\%0) string-or-pattern
927
928 .filename = /usr/local/data/items.log        # Substitute the actual filename
929 set case off                                 # Searches are case-independent
930 fopen /read \%c \m(filename)                 # Open the file
931 if fail exit 1 "\m(filename): \v(errstring)" # Fail: exit with error message
932 .total = 0                                   # OK: Initialize the total
933 echo Searching "\%1"...
934
935 while true {
936     fseek /line /relative /find:\%1 \%c 0    # Get next line that has target
937     if fail break                            # Failure indicates EOF
938     fread /line \%c line                     # Read it
939     if fail break                            # (shouldn't happen)
940     increment total \fword(\m(line),1)       # Increment the total
941 }
942 fclose \%c                                   # Close the file
943 echo Total for "\%1" : \m(total)             # Print the result
944 exit 0
945
946        The syntax of the FSEEK command in this example indicates that each
947        search should start relative to the current file line. Since Kermit
948        is an interpretive language, FSEEK is a lot faster than FREAD'ing
949        each line and checking it for the target, especially for big files.
950        An especially handy use for FSEEK is for use with potentially huge
951        sequentially timestamped logs, to seek directly to the date-time
952        where you want to start processing. Some other improvements for the
953        FOPEN/FREAD/FWRITE/FCLOSE family of commands are included also
954        (performance, bug fixes, convenience features), listed in the
955        [71]change log. (Prior to 9.0.299 Alpha.02, the FSEEK /FIND:
956        command always started from the top.)
957      * MIME synonyms for character-set names: A new equivalence between
958        MIME names and Kermit names for character sets, with a new table
959        showing the supported sets [72]HERE (this feature is also
960        illustrated in the [73]Weblog script).
961      * Unix C-Kermit SET TERMINAL TYPE now passes its arguments to
962        subprocesses as an environment variable.
963      * SET SESSION-LOG TEXT now strips out ANSI escape sequences from the
964        session log.
965      * For interacting with POP servers over clear-text or SSL-secured
966        connections:
967           + New SSL and TLS "raw" connections (no Telnet protocol).
968           + New INPUT command options for reading and capturing (perhaps
969             while scanning) continuous incoming text, such as INPUT
970             /NOWRAP (explained [74]HERE).
971           + New \femailaddress() command to extract the e-mail address
972             from an Internet mail message To: or From: line, used in
973             fetching mail from POP servers.
974           + Improved date parsing commands and functions for parsing the
975             different date formats that can appear in e-mail.
976           + Production scripts for fetching mail from a secure POP server,
977             available [75]HERE.
978      * Various features added to make Kermit more useful for writing CGI
979        scripts such as INPUT /COUNT:n to INPUT exactly n characters
980        (useful for reading form data).
981      * New \fpictureinfo() function for getting orientation and dimensions
982        of JPG and GIF images, described [76]HERE.
983      * New \fgetpidinfo() function for testing whether a given process
984        exists.
985      * \fkwdvalue() function fixed to allow multiword values.
986      * New function \fcount(s1,s2) to tell the number of occurrences of s1
987        in s2.
988      * New \flopx() function returns rightmost field from string (such as
989        a file's extension).
990      * New function \ffunction(s1) to tell whether a built-in s1 function
991        exists.
992      * New \fsqueeze(s1) function removes leading and trailing whitespace
993        from string s1, changes tabs to spaces, squeezing each run of
994        repeated whitespace characters to a single space.
995      * Compact substring notation: \s(somestring[12:18]) is the same as
996        \fsubstring(\m(somestring),12,18), i.e. the substring starting at
997        position 12, 18 characters long. \s(somestring[12_18]) means
998        characters 12 through 18 of the string (7 characters). Also,
999        \s(somestring[17.]) returns character number 17 of somestring.
1000      * The string indexing functions now accept an optional trailing
1001        argument specifying the occurrence number of the target string.
1002        Likewise, \fword() can fetch words from the right as well as the
1003        left.
1004      * The COPY command in Unix C-Kermit has a new /PRESERVE switch,
1005        equivalent to Unix "cp -p".
1006      * ASKQ /ECHO:c can be used to make the characters the user types echo
1007        as the character c, e.g. asterisk when typing a password.
1008      * IF LINK filename to test if the filename is a symlink.
1009      * Ctrl-K, when typed at the command parser, replaces itself with most
1010        recently entered file specification.
1011      * In Unix, the ability to log a terminal session to a serial port,
1012        for use with speaking devices or serial printers; described
1013        [77]HERE. Also for the same purpose, SET SESSION-LOG
1014        NULL-PADDED-LINES for a speech synthesizer than needed this.
1015      * Adaptation to OpenSSL 0.9.8 and 1.0.0.
1016      * Lifted the restriction on having a remote Kermit program send
1017        REMOTE commands to the local. A very big ex-client needed to be
1018        able to do this (branches would connect to headquarters and upload
1019        files; HQ would then download patches, a REMOTE HOST command was
1020        necessary to allow the remote headquarters machines to install the
1021        patches on the local client; of course the client first has to
1022        ENABLE HOST because this is a risky scenario). The reason for the
1023        restriction was that the server, upon receiving any REMOTE command
1024        would send the results (output) back to the client as a file
1025        transfer with "destination screen", but of course the remote has no
1026        screen.
1027      * Added XMESSAGE, which is to [78]MESSAGE as XECHO is ECHO: it
1028        outputs a string with no line terminator DEBUG MESSAGE is ON.
1029      * Fixed \frecurse() to not dump core when invoked with no arguments.
1030      * Improved text for HELP FUNCTION SPLIT and HELP FUNCTION WORD.
1031      * Patches for Debian 6.0 "Squeeze" from Ian Beckwith.
1032      * \fcontents(\&a[3]) got an error if the array was declared but its
1033        dimension was less than 3. Now it simply returns and empty string.
1034      * \fsplit(), when parsing lines from CSV and TSV files, was treating
1035        backslash in the data the same way it treats backslash in Kermit
1036        commands. This was fixed to treat backslash like any other
1037        character.
1038      * Builds for Solaris 9 and later now use streams ptys rather then the
1039        old BSD-style ptys. Thanks to Gary Mills for this one, who noticed
1040        that he couldn't have more than 48 C-Kermit SSH sessions going at
1041        once and figured out why.
1042      * As noted [79]below DES encryption is being retired from many
1043        platforms and libraries that once used it. I changed the Solaris
1044        and Linux OpenSSL builds to account for this by testing for it. I
1045        probably should also add a OMITDES option to omit DES even if it is
1046        installed, but "KFLAGS=-UCK_DES" seems to do the job for now.
1047      * I changed the Linux build to test for the OpenSSL version (like the
1048        Solaris version already did), rather than assuming OpenSSL 0.9.7.
1049      * A couple minor changes for Tru64 Unix 5.1B from Steven Schweda but
1050        we still have some trouble on that platform. As a workaround "make
1051        osf1" can be used there.
1052      * Unix makefile and man page are now included in the Zip
1053        distribution.
1054      * \fjoin(), which is the inverse function of fsplit() now accepts CSV
1055        and TSV as a second argument, to transform an array into a
1056        comma-separated or tab-separated value list, as described [80]HERE.
1057      * Even in 2010, Unix distributions continue to change their UUCP
1058        lockfile conventions. C-Kermit 9.0 contains support from Joop
1059        Boonen for OpenSuSE >= 11.3 and recent Debian, which no longer have
1060        baudboy.h, which first appeared in Red Hat 7.2 in 2003.
1061      * From Lewis McCarthy:
1062
1063      Based on code inspection, C-Kermit appears to have an SSL-related
1064      security vulnerability analogous to that identified as CVE-2009-3767
1065      (see e.g.
1066      [81]http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3767).
1067
1068      I'm attaching a patch for this issue relative to the revision of
1069      ck_ssl.c obtained from a copy of
1070      [82]http://www.columbia.edu/kermit/ftp/test/tar/x.zip downloaded on
1071      2010/07/30, which I believe is the latest.
1072      When this flaw was first widely publicized at last year's Black Hat
1073      conference, it was claimed that some public certificate authorities
1074      had indeed issued certificates that could be used to exploit this
1075      class of vulnerability. As far as I know they have not revealed
1076      specifically which public CA(s) had been found issuing such
1077      certificates. Some references:
1078           + [83]http://www.mseclab.com/?p=180
1079           + [84]http://www.theregister.co.uk/2009/07/30/universal_ssl_cert
1080             ificate/
1081
1082      * Peter Eichhorn reported that "RENAME ../x ." didn't work; fixed
1083        now.
1084      * If only one file is FOPEN'd, FCLOSE given with no arguments would
1085        close it; this was a "convenience feature" that turned out to be
1086        dangerous. For safety FCLOSE has to require a specific channel
1087        number or the word ALL.
1088      * Added \fstrcmp(s1,s2,case,start,length), which has the advantage
1089        over IF EQU,LGT,LLT that case sensitivity can be specified as a
1090        function arg, and also substrings can be specified.
1091      * New built-in functions:
1092
1093         \fcvtcsets(string,cs1,cs2)
1094                 Function to convert a string from one character set to
1095                 another.
1096
1097         \fdecodehex(string[,prefix])
1098                 Function to decode a string containing hex escapes.
1099
1100         \fstringtype(string)
1101                 Function to tell whether a string is 7-bit, 8-bit, or
1102                 UTF-8.
1103
1104        For the motivation for these features and an application that uses
1105        them to analyze web logs, see the Weblog script below.
1106      *
1107
1108         Lazy IF Conditions: Third, now you can do this:
1109                 define foo some number
1110                 if foo command
1111
1112         instead of this:
1113                 define foo some number
1114                 if \m(foo) command
1115
1116        Of course the old way still works too. But watch out because if the
1117        variable name is the same as a symbolic IF condition (for example
1118        COUNT), it won't do what you expected. (IF COUNT was used for loop
1119        control in early versions of MS-DOS Kermit, before it got true FOR
1120        and WHILE loops; it was added to C-Kermit for compatibility, and it
1121        can't be removed because it could break existing scripts).
1122      * Escape sequences are now stripped from text-mode session logs not
1123        only in CONNECT sessions but also in whatever is logged by the
1124        INPUT command; described in the [85]next section.
1125      * New commands for selectively issuing progress or debugging messages
1126        from scripts, also described in the next section.
1127      * Fix from [86]John Dunlap to prevent the fixed packet-timeout
1128        interval from going to an unexpected value.
1129      * Alpha.04 fixes a problem with FTP connections made from 64-bit Unix
1130        platforms. All the other changes in this section were to Alpha.03.
1131      * Relaunching a closed SSH connection with the CONNECT command is now
1132        possible, as it always has been with Telnet and other connection
1133        types; suggested by Peter Eichhorn (needs testing).
1134      * A symbol conflict fixed that prevented successful build on
1135        [87]FreeBSD 8.0.
1136      * Fixes from Christian Corti for building on SunOS 4.1.
1137      * New aixg target for building on AIX with gcc.
1138      * New aix+ibmssl target. This is nice because the IBM-supplied SSL
1139        libraries and header files are in a known location; no need to
1140        [88]set environment variables giving their locations.
1141      * "Large File Support" is now included by default on Alpha and IA64
1142        hardware on VMS 7.3 and later, and it should work much better than
1143        before.
1144      * Kermit's internal FTP client is now included by default in any
1145        build that also includes TCP/IP networking. At present, the FTP
1146        client seems to work well for binary-mode transfers; text (ASCII)
1147        mode transfers still need some work. In builds that also include
1148        Secure Sockets Layer (SSL) security (next item) the FTP client
1149        should be able to make securely authenticated and encrypted
1150        connections.
1151      * In network builds that request OpenSSL support, e.g.:
1152
1153      $ @ckvker  ""  ""  "CK_SSL"
1154        the OpenSSL version is detected automatically and the appropriate
1155        compile-time options are emitted (such as
1156        OPENSSL_DISABLE_OLD_DES_SUPPORT).
1157      * Preliminary / limited support for the ODS-5 file system on VMS 7.2
1158        and later, Alpha and Itanium only (needs testing): Filenames can be
1159        mixed case and can be longer.
1160      * Support for older and older VMS versions.
1161      * In the VMS build procedure, CKVKER.COM, the "i" option in P1 now
1162        means don't include the internal FTP client, and the "f" option
1163        means do not include "Large File" support. Large File support in
1164        VMS really only applies to the file-transfer display and
1165        statistics, which would go out of whack as soon as the byte count
1166        overflowed 31 bits because this is C-Kermit, built with the C
1167        compiler and the C library (runtime system), which did not support
1168        long integers until VMS 7.3.
1169      * The [89]LISP Operator ROUND now takes an optional second argument
1170        that specifies the number of places to round to, e.g.
1171        (ROUND dollars 2) rounds dollars to 2 decimal places.
1172      * Improved pattern matching in many commands for both strings and
1173        filenames.
1174      * Various minor new features, plus numerous bug fixes and speedups.
1175
1176 Incompatibilities
1177
1178    A top priority for new Kermit software releases has always been
1179    backwards compatibility. A script written for a previous Kermit release
1180    should run the same way in the new release.
1181
1182    There's one exception this time. The [90]\fsplit() function is
1183    incredibly handy, it can do almost anything, up to and including
1184    parsing a LISP program (the underlying code is the basis of the
1185    [91]S-Expression interpreter). But did you ever try to use it to parse
1186    (say) a Tab-Separated-List (TSV file) or Comma-Separated-List (CSV)? It
1187    works as expected as long as the data contains only 7-bit characters.
1188    But if your data contains (say) Spanish or German or Russian text
1189    written in an 8-bit character set such as ISO 8859-1, every 8-bit
1190    character (any value 128-255) is treated as a break character. This is
1191    fixed in C-Kermit 9.0 by treating all 8-bit bytes as "include"
1192    characters rather than break characters, a total reversal of past
1193    behavior. I don't think it will affect anyone though, because if this
1194    had happened to anyone, I would have heard about it!
1195
1196    Since most standard 8-bit character sets have control characters in
1197    positions 128-160, it might have made sense to keep 128-160 in the
1198    break set, but with the proliferation of Microsoft Windows code pages,
1199    there is no telling which 8-bit character is likely to be some kind of
1200    text, e.g. "smart quotes" or East European or Turkish accented letters.
1201
1202 What's Not In C-Kermit 9.0
1203
1204    Some large projects that were contemplated have not been done,
1205    including:
1206      * IPv6. Honestly, there has been zero demand for this, and it would
1207        be a lot of work and disruption to the code base. Volunteers
1208        welcome, I guess. It could be a CS project.
1209      * A database interface - MySQL or ODBC. For this one, there is some
1210        demand but I haven't had a chance to even look into it.
1211      * There's a looming issue with DES encryption; major vendors are
1212        removing it from their platforms, starting with Apple in Mac OS X
1213        10.6, with Microsoft to follow suit. A secure version of Kermit can
1214        be built without DES, but in limited testing successful connections
1215        were spotty (e.g. with Kerberos 5).
1216      * Cleaning up the Unix makefile. It has 25 years' worth of targets in
1217        it. It is very likely safe to remove most of them, since (a) most
1218        old platforms have gone away by now, or have been upgraded, due to
1219        hacking vulnerabilities; (b) the market has consolidated
1220        considerably; and (c) most of the new features of C-Kermit 9.0,
1221        such as large files, won't be of any use on older platforms and
1222        previous C-Kermit versions will remain available.
1223      * Packages. Everybody wants an install package custom made for their
1224        own computer, Linux RPMs being the prime example but far from the
1225        only one. These will come, I suppose (especially with some Linux
1226        sites having a policy against installing any application that does
1227        not come as an RPM). In the meantime, here's a page that describes
1228        some Kermit-specific issues in package construction:
1229        [92]ckpackages.html.
1230
1231 And a Loose End...
1232 Using External File-Transfer Protocols on Secure Connections
1233
1234    After C-Kermit 8.0.212 Dev.27 (2006/12/22), I spent a big chunk of time
1235    trying to solve a particular problem that some of you have complained
1236    about and others might be familiar with: If you use C-Kermit to make a
1237    secure Telnet connection to another host (e.g. with Telnet SSL/TLS,
1238    Kerberos, or SRP) and then attempt to transfer a file using an external
1239    protocol such as Zmodem, it doesn't work.
1240
1241    That's because as coded (through 8.0.211), C-Kermit simply starts the
1242    external protocol in a fork with its standard i/o redirected to the
1243    connection. This completely bypasses the encryption and decryption that
1244    is done by C-Kermit itself, and of course it doesn't work. The same
1245    thing occurs if you use the REDIRECT command. The routine that handles
1246    this is ttruncmd() in ckutio.c.
1247
1248    In order to allow (say) Zmodem transfers on secure connections, it is
1249    necessary for C-Kermit to interpose itself between the external Zmodem
1250    program and the connection, decrypting the incoming stream before
1251    feeding it to Zmodem and encrypting Zmodem's output before sending out
1252    the connection.
1253
1254    In principal, this is simple enough. We open a pseudoterminal pair
1255    ("master" and "slave") for Zmodem's i/o and we create a fork and start
1256    Zmodem in it; we read from the fork pty's standard output, encrypt, and
1257    send to the net; we read from the net, decrypt, and write to the fork
1258    pty's standard input.
1259
1260    In practice, it's not so simple. First of all, pseudoterminals (ptys)
1261    don't seem to interface correctly with certain crucial APIs, at least
1262    not in the OS's I have tried (Mac OS X, Linux, NetBSD, etc), such as
1263    select(). And i/o with the pty often - perhaps always - fails to
1264    indicate errors when they occur; for example, when the fork has exited.
1265
1266    But, even after coding around the apparent uselessness of select() for
1267    multiplexing pty and net, and using various tricks to detect when the
1268    external protocol exits and what its exit status is, I'm still left
1269    with a show-stopping problem: I just simply can not download (receive)
1270    a file with Zmodem, which is the main thing that people would probably
1271    want to do. I can send files just fine, but not receive. The incoming
1272    stream is delivered to Zmodem (to the pty slave) but upon arrival at
1273    the Zmodem process itself, pieces are always missing and/or corrupt.
1274    Yet I can receive files just fine if I use Kermit itself (C-Kermit or
1275    G-Kermit) as the external protocol, rather than Zmodem.
1276
1277    I can think of two reasons why this might be the case:
1278
1279     1. Zmodem sends all 8-bit bytes and control codes in the clear, and
1280        maybe the pty is choking on them because it thinks it is a real
1281        terminal.
1282
1283    But Zmodem puts its controlling terminal into raw mode. And C-Kermit
1284    puts the pty into raw mode too, just for good measure. If any 0xFF
1285    codes are in the Zmodem data stream, and it's a Telnet session, Kermit
1286    does any needed byte stuffing/unstuffing automatically. Anyway, if I
1287    tell Zmodem to prefix everything, it makes no difference.
1288
1289     2. Zmodem is a streaming protocol and perhaps the pty driver can't
1290        keep up with a sustained stream of input at network speeds. What
1291        would be the method of flow control?
1292
1293    I can vary the size of the i/o buffers used for writing to the pty, and
1294    get different effects, but I am not able to get a clean download, no
1295    matter what buffer size I use. write()'ing to the pty does not return
1296    an error, and I can't see the errors because they happen on the master
1297    side. It's as if the path between the pty slave and master lacks flow
1298    control; I deliver a valid data stream to the pty slave and the master
1299    gets bits and pieces. This impression is bolstered somewhat by the
1300    "[93]man 7 pty" page in HP-UX, which talks about some special modes for
1301    ptys that turn off all termio processing and guarantee a
1302    flow-controlled reliable stream of bytes in both directions - a feature
1303    that seems to be specific to HP-UX, and exactly the one we need
1304    everywhere.
1305
1306    Well, in Pass One I used C-Kermit's existing pty routines from
1307    ckupty.[ch], which are well-proven in terms of portability and of
1308    actually working. They are currently used by SET HOST /PTY for making
1309    terminal connections to external processes. But these routines are
1310    written on the assumption that the pty is to be accesssed
1311    interactively, and maybe they are setting the fork/pty arrangement up
1312    in such a way that that's not suitable for file transfer. The Pass One
1313    routine is called xttptycmd() in ckutio.c.
1314
1315    So in Pass Two I made a second copy of the routine, yttptycmd(), that
1316    manages the pty and fork itself, so all the code is in one place and
1317    it's simple and understandable. But it still doesn't work for Zmodem
1318    downloads. In this routine, I use openpty() to get the pty pair, which
1319    is not portable, so I can have accesss to both the master and slave pty
1320    file descriptors. This version can be used only a platforms that have
1321    openpty(): Linux, Mac OS X, NetBSD, etc.
1322
1323    In Pass Three, zttptycmd(), I tried using pipes instead of ptys, in
1324    case ptys are simply not up to this task (but that can't be true
1325    because if I make a Telnet or SSH connection into a host, I can send
1326    files to it with Zmodem, and the remote Zmodem receiver is, indeed,
1327    running on a pty). But pipes didn't work either.
1328
1329    In Pass Four, I extracted the relevant routines into a standalone
1330    program based on yttptycmd() (the openpty() version, for simplicity),
1331    which I tested on Mac OS X, the idea being to rule out any
1332    "environmental" effects of running inside the C-Kermit process. There
1333    was no difference -- Kermit transfers (with C-Kermit itself as the
1334    external protocol) worked; Zmodem transfers (neither sz or lsz) did
1335    not.
1336
1337    Well, it's a much longer story. As the external protocol, I've tried
1338    rzsz, crzsz, and lrzsz. We know that some of these have quirks
1339    regarding standard i/o, etc, which is one of the reasons for using ptys
1340    in the first place, and i/o does work - just not reliably. Anyway, the
1341    1100 lines or so of [94]ckc299.txt, starting just below where it says
1342    "--- Dev.27 ---" tell the full story. At this point I have to give up
1343    and move on; it might be more productive to let somebody else who has
1344    more experience with ptys take a look at it - if indeed anyone still
1345    cares about being able to do Zmodem transfers over secure Telnet
1346    connections.
1347
1348    C-Kermit 9.0 contains the three new routines (and some auxiliary ones),
1349    but they are not compiled or called unless you build it specially:
1350
1351      make targetname KFLAGS=-DXTTPTYCMD (builds with xttptycmd())
1352      make targetname KFLAGS=-DYTTPTYCMD (builds with yttptycmd())
1353      make targetname KFLAGS=-DZTTPTYCMD (builds with zttptycmd())
1354
1355    These are all in [95]ckutio.c. As noted, the second one works only for
1356    Linux, FreeBSD, NetBSD, and Mac OS X, because it uses non-POSIX,
1357    non-portable openpty(). If you want to try it on some other platform
1358    that has openpty(), you can build it like this:
1359
1360      make targetname "KFLAGS=-DYTTPTYCMD -DHAVE_OPENPTY"
1361
1362    (and let me know, so I can have HAVE_OPENPTY predefined for that
1363    platform too). The best strategy to get this working, I think, would be
1364    to concentrate on yttptycmd(), which is the simpler of the two
1365    pty-based routines. If it can be made to work, then we'll see if we can
1366    retrofit it to use the ckupty.c routines so it will be portable to
1367    non-BSD platforms.
1368
1369    By the way, if you build with any of [XYZ]TTPTYCMD defined, then the
1370    selected routine will always be used in place of ttruncmd(). This is to
1371    allow testing on all kinds of connections, not just secure ones, in
1372    both local and remote mode. Once the thing works, if it ever does, I'll
1373    add the appropriate tests and/or commands.
1374
1375    By default, in the initial test release, C-Kermit 9.0 uses ttruncmd()
1376    on serial connections and ttyptycmd() on network connections. Even when
1377    a network connection is not encrypted, Kermit still needs to handle the
1378    network protocol, e.g. the quoting of 0xff bytes on Telnet connections.
1379
1380 Demonstration: Fetch Mail from POP Server Secured by SSL
1381
1382    [96]pop.ksc is a fully elaborated production script for fetching one's
1383    mail from a POP3 server over a connection secured by SSL. For
1384    explanation and documentation, [97]CLICK HERE. [98]mailcheck is a
1385    wrapper for the pop.ksc script, which collects your password one time,
1386    and then checks for new mail every 5 minutes (or other selected
1387    interval) and calls pop.ksc to fetch it if there is any.
1388
1389 Demonstration: HP Switch Configuration Backup
1390
1391    A common use for Kermit software is to make automated backups of the
1392    configuration of network switches and routers, such as those made by
1393    Cisco or Hewlett-Packard (although [99]tftp can be used for this, it is
1394    not available in all such devices; Kermit, however, works with those
1395    that have tftp as well as those that don't).
1396
1397    Typically a backup can be done by making a Telnet, SSH, or serial
1398    connection to the device with Kermit and giving a command such as "show
1399    config" at the command-line prompt of the device with Kermit's session
1400    log activated. The result is a list of the commands that were used to
1401    establish the current configuration, suitable for feeding back to the
1402    device's console (e.g. with C-Kermit's TRANSMIT command) to reestablish
1403    the same configuration or to duplicate it on another device.
1404
1405    At an HP installation it was noted, however, that while the HP switches
1406    (various ProCurve models) produced the desired list of commands, they
1407    were interspersed with escape sequences for special effects, thus
1408    rendering the recorded sessions unsuitable for feeding back into the
1409    switches.
1410
1411    C-Kermit 9.0 introduces a new feature to strip the offending sequences
1412    out of a session log, leaving just the text. The command SET
1413    SESSION-LOG TEXT activates this feature. In C-Kermit 9.0 Alpha.02 and
1414    earlier, escape sequence stripping occurred only while logging
1415    interactive (CONNECT) sessions; beginning with Alpha.03 it is done also
1416    for data that is read by INPUT commands and therefore works for scripts
1417    too.
1418
1419    A sample HP Switch Configuration Backup script is [100]HERE, and its
1420    data file is [101]HERE. This script also illustrates some other new
1421    features of Alpha.03:
1422
1423    MESSAGE text
1424           This lets you put debugging messages in your script that can be
1425           displayed or not, according to SET DEBUG MESSAGE (below). This
1426           way you don't have to change your script for debugging.  Hint:
1427           In Unix, invoke the script like this:
1428
1429      $ DEBUG=1 scriptname arg1 arg2...
1430
1431           and then include the following command in your script:
1432
1433      if defined \$(DEBUG) set debug message on
1434
1435    XMESSAGE text
1436           Like MESSAGE but prints the text with no line terminator, so it
1437           can be continued by subsequent messages.
1438
1439    SET DEBUG MESSAGE { ON, OFF, STDERR }
1440           ON means MESSAGE commands should print to standard output; OFF
1441           means they shouldn't print anything; STDERR means the messages
1442           should be printed to [102]stderr. DEBUG MESSAGE is OFF by
1443           default, i.e. unless you SET it to ON or STDERR.
1444
1445    IF DEBUG command
1446           Executes the command if SET DEBUG MESSAGE is not OFF.
1447
1448    The \v(lastcommand) variable
1449           This variable contains the previous command. You can use it in
1450           debugging and error message to show (for example) exactly what
1451           the command was that just failed, without having to make a copy
1452           of the command:
1453
1454 set host somehost.somecompany.com
1455 if fail exit 1 "FATAL - \v(lastcommand)"
1456
1457           which, if the SET HOST command fails, prints "FATAL - set host
1458           somehost.somecompany.com" and then exits with status 1 (which
1459           normally indicates failure).
1460
1461 Demonstration: HP iLO Blade Configuration
1462
1463    [103]THIS DOCUMENT describes a script in production use at Columbia
1464    University for configuring and deploying racks full of HP blade servers
1465    through their "integrated Lights Out" (iLO) management interface,
1466    bypassing the tedious and error-prone process of configuring the
1467    servers one by one through the vendor-provided point-and-click Web
1468    interface, which is ill-suited to configuring large numbers of blades.
1469    The script illustrates some of C-Kermit 9.0's new features; source code
1470    is available through the link. The code is apt to change from time to
1471    time as new requirements surface.
1472
1473 Demonstration: IBM/Rolm/Siemens CBX Management
1474
1475    [104]THIS DOCUMENT describes a suite of scripts (some in production,
1476    some in development) used to manage the Columbia campus 20,000-line
1477    main telephone switch, along with about 10 satellite switches at
1478    off-campus locations. These switches are 1980s technology*, their
1479    management consoles are serial ports. Access is via Telnet to reverse
1480    terminal servers. The scripts allow for interactive sessions as well as
1481    automatic production (and in some cases formatting) of different
1482    reports required by different groups at different intervals. These
1483    scripts replace a whole assortment of ad-hoc ProComm ASPECT scripts
1484    that were scattered all over the place, with passwords embedded. The
1485    new scripts are intended to be run from a centralized server where
1486    there is a single well-secured configuration file, and where they can
1487    be used on demand, or in cron jobs. They are modular so code
1488    duplication is minimal.
1489    __________________________
1490    *  Of course the University is deploying new technology but the but the
1491    old system will be used in parallel for some time to come.
1492
1493 Demonstration: CSV and TSV Files
1494
1495    Contents
1496
1497      * [105]Reading a CSV or TSV Record and Converting it to an Array
1498      * [106]Using \fjoin() to create a Comma- or Tab-Separated Value List
1499        from an Array
1500      * [107]Using CSV or TSV Files
1501
1502    Comma-Separated Value (CSV) format is commonly output by spreadsheets
1503    and databases when exporting data into plain-text files for import into
1504    other applications. Here are the details:
1505
1506    Comma-Separated List Syntax
1507
1508     1. Each record is a series of fields.
1509     2. Records are in whatever format is used by the underlying file
1510        system for lines of text.
1511     3. Fields within records are separated by commas, with zero or more
1512        whitespace characters (space or tab) before and/or after the comma;
1513        such whitespace is considered part of the separator.
1514     4. Fields with embedded commas must be enclosed in ASCII doublequote
1515        characters.
1516     5. Fields with leading or trailing spaces must be enclosed in ASCII
1517        doublequotes.
1518     6. Any field may be enclosed in ASCII doublequotes.
1519     7. Fields with embedded doublequotes must be enclosed in doublequotes
1520        and each interior doublequote is doubled.
1521
1522    Here is an example:
1523
1524 aaa, bbb, has spaces,,"ddd,eee,fff", " has spaces ","Muhammad ""The Greatest"" A
1525 li"
1526
1527    The first two are regular fields. The second is a field that has an
1528    embedded space but in which any leading or trailing spaces are to be
1529    ignored. The fourth is an empty field, but still a field. The fifth is
1530    a field that contains embedded commas. The sixth has leading and
1531    trailing spaces. The last field has embedded quotation marks.
1532
1533    Prior to C-Kermit 9.0 Alpha.06, C-Kermit did not handle CSV files
1534    according to the specification above. Most seriously, there was no
1535    provision for a separator to be surrounded by whitespace that was to be
1536    considered part of the separator. Also there was no provision for
1537    quoting doublequotes inside of a quoted string.
1538
1539 Reading a CSV record
1540
1541    Now the \fsplit() function can handle any CSV-format string if you
1542    include the symbolic include set "CSV" as the 4th parameter. To
1543    illustrate, this program:
1544
1545 def xx {
1546    echo [\fcontents(\%1)]
1547    .\%9 := \fsplit(\fcontents(\%1), &a, \44, CSV)
1548    for \%i 1 \%9 1 { echo "\flpad(\%i,3). [\&a[\%i]]" }
1549    echo "-----------"
1550 }
1551 xx {a,b,c}
1552 xx { a , b , c }
1553 xx { aaa,,ccc," with spaces ",zzz }
1554 xx { "1","2","3","","5" }
1555 xx { this is a single field }
1556 xx { this is one field, " and this is another  " }
1557 xx { name,"Mohammad ""The Greatest"" Ali", age, 67 }
1558 xx { """field enclosed in doublequotes""" }
1559 exit
1560
1561    gives the following results:
1562
1563 [a,b,c]
1564   1. [a]
1565   2. [b]
1566   3. [c]
1567 -----------
1568 [ a , b , c ]
1569   1. [a]
1570   2. [b]
1571   3. [c]
1572 -----------
1573 [ aaa,,ccc," with spaces ",zzz ]
1574   1. [aaa]
1575   2. []
1576   3. [ccc]
1577   4. [ with spaces ]
1578   5. [zzz]
1579 -----------
1580 [ "1","2","3","","5" ]
1581   1. [1]
1582   2. [2]
1583   3. [3]
1584   4. []
1585   5. [5]
1586 -----------
1587 [ this is a single field ]
1588   1. [this is a single field]
1589 -----------
1590 [ this is one field, " and this is another  " ]
1591   1. [this is one field]
1592   2. [ and this is another  ]
1593 -----------
1594 [ name,"Mohammad ""The Greatest"" Ali", age, 67 ]
1595   1. [name]
1596   2. [Mohammad "The Greatest" Ali]
1597   3. [age]
1598   4. [67]
1599 -----------
1600 [ """field enclosed in doublequotes""" ]
1601   1. ["field enclosed in doublequotes"]
1602 -----------
1603
1604    The separator \44 (comma) must still be specified as the break set (3rd
1605    \fsplit() parameter). When "CSV" is specified as the include set:
1606      * The Grouping Mask is automatically set to 1 (which specifies that
1607        the ASCII doublequote character (") is used for grouping;
1608      * The Separator Flag is automatically set to 1 so that adjacent field
1609        separators will not be collapsed;
1610      * All bytes (values 0 through 255) other than the break character are
1611        added to the include set;
1612      * Any leading whitespace is stripped from the first element unless it
1613        is enclosed in doublequotes;
1614      * Any trailing whitespace is trimmed from the end of the last element
1615        unless it is enclosed in doublequotes;
1616      * If the separator character has any spaces or tabs preceding it or
1617        following it, they are ignored and discarded;
1618      * The separator character is treated as an ordinary data character if
1619        it appears in a quoted field;
1620      * A sequence of two doublequote characters ("") within a quoted field
1621        is converted to a single doublequote.
1622
1623    There is also a new TSV symbolic include set, which is like CSV except
1624    without the quoting rules or the stripping of whitespace around the
1625    separator because, by definition, TSV fields do not contain tabs.
1626
1627    Of course you can specify any separator(s) you want with either the
1628    CSV, TSV, or ALL symbolic include sets. For example, if you have a TSV
1629    file in which you want the spaces around each Tab to be discarded, you
1630    can use:
1631
1632 \fsplit(variable, &a, \9, CSV)
1633
1634    \9 is Tab.
1635
1636    The new symbolic include sets can also be used with \fword(), which is
1637    just like \fsplit() except that it retrieves the nth word from the
1638    argument string, rather than an array of all the words. In C-Kermit you
1639    can get information about these or any other functions with the HELP
1640    FUNCTION command, e.g.:
1641
1642 C-Kermit> help func word
1643
1644 Function \fword(s1,n1,s2,s3,n2,n3) - Extracts a word from a string.
1645     s1 = source string.
1646     n1 = word number (1-based) counting from left; if negative, from right.
1647     s2 = optional break set.
1648     s3 = optional include set (or ALL, CSV, or TSV).
1649     n2 = optional grouping mask.
1650     n3 = optional separator flag:
1651        0 = collapse adjacent separators;
1652        1 = don't collapse adjacent separators.
1653
1654   \fword() returns the n1th "word" of the string s1, according to the
1655   criteria specified by the other parameters.
1656
1657   The BREAK SET is the set of all characters that separate words. The
1658   default break set is all characters except ASCII letters and digits.
1659   ASCII (C0) control characters are treated as break characters by default,
1660   as are spacing and punctuation characters, brackets, and so on, and
1661   all 8-bit characters.
1662
1663   The INCLUDE SET is the set of characters that are to be treated as
1664   parts of words even though they normally would be separators.  The
1665   default include set is empty.  Three special symbolic include sets are
1666   also allowed:
1667
1668     ALL (meaning include all bytes that are not in the break set)
1669     CSV (special treatment for Comma-Separated-Value records)
1670     TSV (special treatment for Tab-Separated-Value records)
1671
1672   For operating on 8-bit character sets, the include set should be ALL.
1673
1674   If the GROUPING MASK is given and is nonzero, words can be grouped by
1675   quotes or brackets selected by the sum of the following:
1676
1677      1 = doublequotes:    "a b c"
1678      2 = braces:          {a b c}
1679      4 = apostrophes:     'a b c'
1680      8 = parentheses:     (a b c)
1681     16 = square brackets: [a b c]
1682     32 = angle brackets:  <a b c>
1683
1684   Nesting is possible with {}()[]<> but not with quotes or apostrophes.
1685
1686 Returns string:
1687   Word number n1, if there is one, otherwise an empty string.
1688
1689 Also see:
1690   HELP FUNCTION SPLIT
1691
1692 C-Kermit>
1693
1694 Using \fjoin() to create Comma- or Tab-Separated Value Lists from Arrays
1695
1696    In C-Kermit 9.0, \fsplit()'s inverse function, [108]\fjoin() received
1697    the capability of converting an array into a comma-separated or a
1698    tab-separated value list. Thus, given a CSV, if you split it into an
1699    array with \fsplit() and then join the array with \fjoin(), giving each
1700    function the new CSV parameter in the appropriate argument position,
1701    the result will be will be equivalent to the original, according to the
1702    CSV definition. It might not be identical, because if the result had
1703    extraneous spaces before or after the separating commas, these are
1704    discarded, but that does not affect the elements themselves. The new
1705    syntax for \fjoin() is:
1706
1707    \fjoin(&a,CSV)
1708           Given the array \&a[] or any other valid array designator, joins
1709           its elements into a comma-separated list according to the
1710           [109]rules listed above.
1711
1712    \fjoin(&a,TSV)
1713           Joins the elements of the given array into a tab-separated list,
1714           also described above.
1715
1716    [110]Previous calling conventions for \fjoin() are undisturbed,
1717    including the ability to specify a portion of an array, rather than the
1718    whole array:
1719
1720 declare \&a[] = 1 2 3 4 5 6 7 8 9
1721 echo \fjoin(&a[3:7],CSV)
1722 3,4,5,6,7
1723
1724    Using \fsplit() and \fjoin() it is now possible to convert a
1725    comma-separated value list into a tab-separated value list, and vice
1726    versa (which is not a simple matter of changing commas to tabs or vice
1727    versa).
1728
1729 Applications for CSV Files
1730
1731    Databases such as MS Access or MySQL can export tables or reports in
1732    CSV format, and then Kermit can read the resulting CSV file and do
1733    whatever you like with it; typically something that could not be done
1734    with the database query language itself (or that you didn't know how to
1735    do that way): create reports or datasets based on complex criteria or
1736    procedures, edit or modify some fields, etc, and then use \fjoin() to
1737    put each record back in CSV form so it can be reimported into a
1738    spreadsheet or database.
1739
1740    Here is a simple example in which we purge all records of customers who
1741    have two or more unpaid bills. The file is sorted so that each license
1742    purchase record is followed by its annual maintenance payment records
1743    in chronological order.
1744
1745 #!/usr/local/bin/kermit
1746 .filename = somefile.csv        # Input file in CSV format
1747 fopen /read \%c \m(filename)    # Open it
1748 if fail exit                    # Don't go on if open failed
1749 copy \m(filename) ./new         # Make a copy of the file
1750
1751 .oldserial = 00000000000        # Multiple records for each serial number
1752 .zeros = 0                      # Unpaid bill counter
1753
1754 while true {                    # Loop
1755     fread /line \%c line        # Get a record
1756     if fail exit                # End of file
1757     .n := \fsplit(\m(line),&a,\44,CSV)    # Split the fields into an array
1758     if not equ "\m(oldserial)" "\&a[6]" { # Have new serial number?
1759         # Remove all records for previous serial number
1760         # if two or more bills were not paid...
1761         if > \m(zeros) 1 {
1762             grep /nomatch \m(oldserial) /output:./new2 ./new
1763             rename ./new2 ./new
1764         }
1765         .oldserial := \&a[6]    # To detect next time serial number changes
1766         .zeros = 0              # Reset unpaid bill counter
1767     }
1768     if equ "\&a[5]" "$0.00" {   # Element 5 is amount paid
1769         increment zeros         # If it's zero, count it.
1770     }
1771 }
1772 fclose \%c
1773
1774    Rewriting the file multiple times is inelegant, but this is a quick and
1775    dirty use-once-and-discard script, so elegance doesn't count. The
1776    example is interesting in that it purges certain records based on the
1777    contents of other records. Maybe there is a way to do this directly
1778    with SQL, but why use SQL when you can use Kermit?
1779
1780    Here is the same task but this time no shelling out, and this time we
1781    do change and add some fields and then join the result back into a CSV
1782    record and write it out to a new file. The object is to create a record
1783    for each license that shows not only the date and purchase price of the
1784    license but also the date and amount of the last maintenance payment,
1785    and to add new fields for sorting by anniversary (month and day):
1786
1787 #!usr/local/bin/kermit +
1788 cd ~/somedirectory                      # CD to appropriate directory
1789 if fail exit 1                          # Make sure we did
1790 .filename := \%1                        # Filename from command line
1791 if not def filename {                   # If none give usage message
1792     exit 1 "Usage: \%0: infile [ outfile ]"
1793 }
1794 fopen /read \%c \m(filename)            # Open the input CSV file
1795 if fail exit                            # Make sure we did
1796
1797 .output := \%2                          # Output filename from command line
1798 if not def output {                     # Supply one if not given
1799     .output := New_\m(filename)
1800 }
1801 fopen /write \%o \m(output)             # Open output file
1802 if fail exit                            # Check that we did
1803
1804 .serial = 00000000000                   # Initialize serial number
1805 .licenses = 0                           # and license counter
1806
1807 fread /line \%c line                        # First line is column labels
1808 if fail exit                                # Check
1809 fwrite /line \%o "\m(line),AMM_DD,AYYYY"    # Write new labels line
1810
1811 # Remaining lines are license purchases (K95B) followed by zero or more
1812 # maintenance invoices (K95BM) for each license.
1813
1814 .datepaid = 00/00/0000                  # Initialize last maint payment date
1815 .amtpaid = $0.00                        # Initialize last maint payment amount
1816 set flag off                            # For remembering we're at end of file
1817 while not flag {                        # Loop to read all records
1818     fread /line \%c line                # Read a record
1819     if fail set flag on                 # If EOF set flag for later
1820     .n := \fsplit(\m(line),&a,\44,CSV)  # Break record into array
1821     if ( flag || equ "\&a[3]" "K95B" ) { # License or EOF
1822         if fail exit 1 "FAILED: \v(lastcommand)"
1823         if licenses {                   # If this is not the first license
1824             .\&x[5] := \m(amtpaid)      # Substitute most recent amount paid
1825             .\&x[21] := \m(datepaid)    # Substitute most recent date paid
1826             void \fsplit(\&x[18],&d,/)  # Break up original (anniversary) date
1827             # and put mm_dd and yyyy in separate fields for sorting...
1828             fwrite /line \%o "\fjoin(&x,CSV),\flpad(\&d[1],2,0)_\flpad(\&d[2],2,
1829 0),\&d[3]"
1830             if fail exit 1 WRITE        # Check for error
1831             xecho .                     # Show progress as one dot per record
1832         }
1833         if flag break                   # We're at EOF so we're finished
1834         increment licenses              # New license - count it
1835         array copy &a &x                # Keep this record while reading next
1836         .serial := \&a[6]               # Remember serial number
1837         .datepaid = 00/00/0000          # Initial maintenance payment date
1838         .amtpaid = $0.00                # and amount
1839         continue                        # and go back to read next record
1840     }
1841     if not eq "\m(serial)" "\&a[6]" {   # Catch out-of-sequence record
1842         echo
1843         echo "SEQUENCE: \m(serial)..\&a[6]: \&a[7] [\&a[1]]"
1844         continue
1845     }
1846     if equ "\&a[5]" "" .\&a[5] = $0.00  # If amount is empty make it $0.00
1847     if not equ "\&a[5]" "$0.00" {       # If amount is not $0.00
1848         .datepaid := \&a[21]            # remember date paid
1849         .amtpaid := \&a[5]              # and amount paid
1850     }
1851 }
1852 fclose ALL                              # Done - close all files and exit
1853 exit 0 Done.
1854
1855
1856    The result imports back into Excel, where it can be sorted, formatted,
1857    or otherwise manipulated as desired.
1858
1859 Using CSV Files: Extending Kermit's Data Structures
1860
1861    Now that we can parse a CSV record, what would we do with a CSV file -
1862    that is, a sequence of records? If we needed all the data available at
1863    once, we would want to load it into a matrix of (row,column) values.
1864    But Kermit doesn't have matrices. Or does it?
1865
1866    Kermit has several built-in data types, but you can invent your own
1867    data types as needed using Kermit's macro feature:
1868
1869 define variablename value
1870
1871    For example:
1872
1873 define alphabet abcdefghijklmnopqrstuvwxyz
1874
1875    This defines a macro named alphabet and gives it the value
1876    abcdefghijklmnopqrstuvwxyz. A more convenient notation (added in
1877    C-Kermit 7.0, see [111]Table 2) for this is:
1878
1879 .alphabet = abcdefghijklmnopqrstuvwxyz
1880
1881    The two are exactly equivalent: they make a literal copy the "right
1882    hand side" as the value of the macro. Then you can refer to the macro
1883    anywhere in a Kermit command as "\m(macroname)":
1884
1885 echo "Alphabet = \m(alphabet)"
1886
1887    There is a second way to define a macro, which is like the first except
1888    that the right-hand side is evaluated first; that is, any variable
1889    references or function calls in the right-hand side are replaced by
1890    their values before the result is assigned to the macro. The command
1891    for this is ASSIGN rather than DEFINE:
1892
1893 define alphabet abcdefghijklmnopqrstuvwxyz
1894 assign backwards \freverse(\m(alphabet))
1895 echo "Alphabet backwards = \m(backwards)"
1896
1897    which prints:
1898
1899 Alphabet backwards = zyxwvutsrqponmlkjihgfedcba
1900
1901    This kind of assignment can also be done like this:
1902
1903 .alphabet = abcdefghijklmnopqrstuvwxyz
1904 .backwards := \freverse(\m(alphabet))
1905
1906    [112]Any command starting with a period is an assignment, and the
1907    operator (= or :=) tells what to do with the right-hand side before
1908    making the assignment.
1909
1910    In both the DEFINE and ASSIGN commands, the variable name itself is
1911    taken literally. It is also possible, however, to have Kermit compute
1912    the variable name. This is done (as described in [113]Using C-Kermit,
1913    2nd Ed., p.457), using parallel commands that start with underscore:
1914    _DEFINE and _ASSIGN (alias _DEF and _ASG). These are just like DEFINE
1915    and ASSIGN except they evaluate the variable name before making the
1916    assignment. For example:
1917
1918 define \%a one
1919 _define \%a\%a\%a 111
1920
1921    would create a macro named ONEONEONE with a value of 111, and:
1922
1923 define \%a one
1924 define number 111
1925 _assign \%a\%a\%a \m(number)
1926
1927    would create the same macro with the same value, but:
1928
1929 define \%a one
1930 define number 111
1931 _define \%a\%a\%a \m(number)
1932
1933    would give the macro a value of "\m(number)".
1934
1935    You can use the _ASSIGN command to create any kind of data structure
1936    you want; you can find some examples in the [114]Object-Oriented
1937    Programming section of the [115]Kermit Script Library. In the following
1938    program we use this capability to create a two-dimensional array, or
1939    matrix, to hold the all the elements of the CSV file, and then to
1940    display the matrix:
1941
1942 fopen /read \%c data.csv                # Open CSV file
1943 if fail exit 1
1944
1945 .\%r = 0                                # Row
1946 .\%m = 0                                # Maximum columns
1947 while true {
1948     fread /line \%c line                # Read a record
1949     if fail break                       # End of file
1950     .\%n := \fsplit(\m(line),&a,\44,CSV) # Split record into items
1951     incr \%r                            # Count this row
1952     for \%i 1 \%n 1 {                   # Assign items to this row of matrix
1953         _asg a[\%r][\%i] \&a[\%i]
1954     }
1955     if > \%i \%m { .\%m := \%i }        # Remember width of widest row
1956 }
1957 fclose \%c                              # Close CSV file
1958 decrement \%m                           # (because of how FOR loop works)
1959 echo MATRIX A ROWS: \%r COLUMNS: \%m    # Show the matrix
1960
1961 for \%i 1 \%r 1 {                       # Loop through rows
1962     for \%j 1 \%m 1 {                   # Loop through columns of each row
1963         xecho "\flpad(\m(a[\%i][\%j]),6)"
1964     }
1965     echo
1966 }
1967 exit 0
1968
1969    The matrix is called a and its elements are a[1][1], a[1][2], a[1][3],
1970    ... a[2][1], etc, and you can treat this data structure exactly like a
1971    two-dimensional array, in which you can refer to any element by its "X
1972    and Y coordinates". For example, if the CSV file contained numeric data
1973    you could compute row and column sums using simple FOR loops and
1974    Kermit's built-in one-dimensional array data type:
1975
1976 declare \&r[\%r]                        # Make an array for the row sums
1977 declare \&c[\%m]                        # Make an array for the column sums
1978 for \%i 1 \%r 1 {                       # Loop through rows
1979     for \%j 1 \%m 1 {                   # Loop through columns of each row
1980         increment \&r[\%i] \m(a[\%i][\%j]) # Accumulate row sum
1981         increment \&c[\%j] \m(a[\%i][\%j]) # Accumulate column sum
1982     }
1983 }
1984
1985    Note that the sum arrays don't have to be initialized to zero because
1986    Kermit's INCREMENT command treats empty definitions as zero.
1987
1988 Demonstration Scripts for Webmasters
1989
1990    These scripts all use new features of C-Kermit 9.0.
1991
1992    [116]ksitemap
1993           A C-Kermit 9.0 script to build sitemap.xml for a website,
1994           complete with Google image extensions (this is the file used by
1995           webmasters to get their sites crawled and indexed optimally).
1996
1997    [117]The Weblog Script
1998           Reads a web log, extracts the Google searches, normalizes the
1999           search strings, and prints the top 20 searches, along with their
2000           counts.
2001
2002    [118]The Amazon Script
2003           Reads an Amazon Associate orders report and lists the products
2004           according to the number of orders for each, or the number of
2005           clicks on each.
2006
2007    [119]Photoalbum
2008           Makes a website from a collection of JPG images.
2009
2010             [120]Home [121]Kermit 95 [122]C-Kermit [123]Scripts [124]Current
2011    [125]New [126]FAQ  [127]Support
2012
2013
2014     C-Kermit 9.0 / [128]The Kermit Project / [129]Columbia University /
2015     [130]kermit@columbia.edu / [131]validate
2016
2017 References
2018
2019    1. http://www.columbia.edu/
2020    2. mailto:kermit@columbia.edu
2021    3. http://www.columbia.edu/kermit/index.html
2022    4. http://www.columbia.edu/kermit/k95.html
2023    5. http://www.columbia.edu/kermit/ckermit.html
2024    6. http://www.columbia.edu/kermit/ckscripts.html
2025    7. http://www.columbia.edu/kermit/current.html
2026    8. http://www.columbia.edu/kermit/whatsnew.html
2027    9. http://www.columbia.edu/kermit/faq.html
2028   10. http://www.columbia.edu/kermit/support.html
2029   11. http://www.columbia.edu/cu/computinghistory/books/#menagerie
2030   12. http://www.columbia.edu/kermit/ck90tables.html
2031   13. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641
2032   14. http://www.columbia.edu/kermit/ckermit.html#download
2033   15. http://www.columbia.edu/kermit/ckermit90.html#LargeFiles
2034   16. http://www.columbia.edu/kermit/ckermit90.html#TestLargeFiles
2035   17. http://www.columbia.edu/kermit/ckermit90.html#Bignums
2036   18. http://www.columbia.edu/kermit/ckermit90.html#force3
2037   19. http://www.columbia.edu/kermit/ckermit90.html#Vareval
2038   20. http://www.columbia.edu/kermit/ckermit90.html#rename
2039   21. http://www.columbia.edu/kermit/ckermit90.html#Other
2040   22. http://www.columbia.edu/kermit/ckermit90.html#Incompatibilities
2041   23. http://www.columbia.edu/kermit/ckermit90.html#NotIn9.0
2042   24. http://www.columbia.edu/kermit/ckermit90.html#LooseEnd
2043   25. http://www.columbia.edu/kermit/ckermit90.html#pop
2044   26. http://www.columbia.edu/kermit/ckermit90.html#HPswitch
2045   27. http://www.columbia.edu/kermit/ckermit90.html#iLO
2046   28. http://www.columbia.edu/kermit/ckermit90.html#Rolm
2047   29. http://www.columbia.edu/kermit/ckermit90.html#CSV
2048   30. http://www.columbia.edu/kermit/ckermit90.html#Otherdemos
2049   31. http://www.columbia.edu/kermit/ck60manual.html
2050   32. http://www.amazon.com/gp/product/B002ACPF9M?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B002ACPF9M
2051   33. http://www.columbia.edu/kermit/ckermit70.html
2052   34. http://www.columbia.edu/kermit/ckermit80.html
2053   35. http://www.columbia.edu/kermit/ckscripts.html
2054   36. http://www.columbia.edu/cu/computinghistory/dec20.html
2055   37. mailto:fdc@columbia.edu
2056   38. http://www.columbia.edu/kermit/k95.html
2057   39. http://www.columbia.edu/kermit/cu-bsd-license.html
2058   40. http://www.columbia.edu/kermit/ckermit90.html#LargeFiles
2059   41. http://www.columbia.edu/kermit/ck90tables.html
2060   42. http://www.columbia.edu/kermit/ck90tables.html
2061   43. http://www.columbia.edu/kermit/ckermit90.html#force3
2062   44. http://www.columbia.edu/kermit/ckermit90.html#Vareval
2063   45. http://www.columbia.edu/kermit/ckrename.html
2064   46. http://www.columbia.edu/kermit/csv.html
2065   47. http://www.columbia.edu/kermit/csetnames.html
2066   48. http://www.columbia.edu/kermit/ckermit90.html#HPswitch
2067   49. http://www.columbia.edu/kermit/ckdaily.html
2068   50. http://www.columbia.edu/kermit/cu-bsd-license.html
2069   51. http://www.opensource.org/
2070   52. http://kermit.columbia.edu/ck90tables.html#LF
2071   53. ftp://kermit.columbia.edu/kermit/utils/bigfile.c
2072   54. http://www.columbia.edu/kermit/ckermit80.html#x9
2073   55. http://www.columbia.edu/kermit/ck90tables.html#LF
2074   56. ftp://kermit.columbia.edu/kermit/scripts/ckermit/easter2
2075   57. http://www.columbia.edu/kermit/em-apex.html
2076   58. http://www.iridium.com/
2077   59. http://science1.nasa.gov/science-news/science-at-nasa/2006/09jan_electrichurricanes/
2078   60. http://www.columbia.edu/kermit/ek.html
2079   61. ftp://kermit.columbia.edu/kermit/ek/simirid/
2080   62. http://www.columbia.edu/kermit/ek.html
2081   63. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
2082   64. http://www.columbia.edu/kermit/csv.html
2083   65. http://www.columbia.edu/kermit/ckermit70.html#x1.11
2084   66. http://www.columbia.edu/kermit/ckermit70.html
2085   67. http://www.columbia.edu/kermit/ckermit80.html#x9
2086   68. http://www.columbia.edu/kermit/csetnames.html
2087   69. http://www.columbia.edu/kermit/ckdaily.html
2088   70. http://www.columbia.edu/kermit/ftpclient.html
2089   71. http://www.columbia.edu/kermit/ckdaily.html
2090   72. http://www.columbia.edu/kermit/csetnames.html
2091   73. http://www.columbia.edu/kermit/ckermit90.html#Otherdemos
2092   74. http://www.columbia.edu/kermit/input_nowrap.html
2093   75. http://www.columbia.edu/~fdc/mm/index.html
2094   76. http://www.columbia.edu/kermit/photoalbum.html
2095   77. http://www.columbia.edu/~fdc/kermit/logserial.html
2096   78. http://www.columbia.edu/kermit/ckermit90.html#message
2097   79. http://www.columbia.edu/kermit/ckermit90.html#NotIn9.0
2098   80. http://www.columbia.edu/kermit/csv.html#join
2099   81. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-3767
2100   82. http://www.columbia.edu/kermit/ftp/test/tar/x.zip
2101   83. http://www.mseclab.com/?p=180
2102   84. http://www.theregister.co.uk/2009/07/30/universal_ssl_certificate/
2103   85. http://www.columbia.edu/kermit/ckermit90.html#HPswitch
2104   86. http://www.columbia.edu/kermit/em-apex.html
2105   87. http://www.freebsd.org/releases/8.0R/announce.html
2106   88. http://www.columbia.edu/kermit/security81.html#x4.2.3
2107   89. http://www.columbia.edu/kermit/ckermit80.html#x9
2108   90. http://www.columbia.edu/kermit/ckermit80.html#x8.7.2
2109   91. http://www.columbia.edu/kermit/ckermit80.html#x9
2110   92. http://www.columbia.edu/kermit/ckpackages.html
2111   93. http://docs.hp.com/en/B9106-90013/pty.7.html
2112   94. http://www.columbia.edu/kermit/test/text/ckc299.txt
2113   95. http://www.columbia.edu/kermit/test/text/ckutio.c
2114   96. http://www.columbia.edu/~fdc/mm/pop
2115   97. http://www.columbia.edu/~fdc/mm/
2116   98. http://www.columbia.edu/~fdc/mm/mailcheck
2117   99. http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol
2118  100. http://www.columbia.edu/kermit/ftp/scripts/ckermit/gethpconfig
2119  101. http://www.columbia.edu/kermit/ftp/scripts/ckermit/TestSwitches.txt
2120  102. http://en.wikipedia.org/wiki/Standard_streams
2121  103. http://kermit.columbia.edu/cudocs/ilosetup.html
2122  104. http://www.columbia.edu/kermit/cudocs/cbx.html
2123  105. http://www.columbia.edu/kermit/ckermit90.html#record
2124  106. http://www.columbia.edu/kermit/ckermit90.html#join
2125  107. http://www.columbia.edu/kermit/ckermit90.html#file
2126  108. http://www.columbia.edu/kermit/ckermit80.html#fjoin
2127  109. http://www.columbia.edu/kermit/ckermit90.html#rules
2128  110. http://www.columbia.edu/kermit/ckermit80.html#fjoin
2129  111. http://www.columbia.edu/kermit/ckermit90.html#varasg
2130  112. http://www.columbia.edu/kermit/ckermit70.html#x7.9
2131  113. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641
2132  114. http://www.columbia.edu/kermit/ckscripts.html#oops
2133  115. http://www.columbia.edu/kermit/ckscripts.html
2134  116. http://www.columbia.edu/kermit/ksitemap.html
2135  117. http://www.columbia.edu/kermit/weblog.html
2136  118. http://kermit.columbia.edu/ftp/scripts/ckermit/amazon
2137  119. http://www.columbia.edu/kermit/photoalbum.html
2138  120. http://www.columbia.edu/kermit/index.html
2139  121. http://www.columbia.edu/kermit/k95.html
2140  122. http://www.columbia.edu/kermit/ckermit.html
2141  123. http://www.columbia.edu/kermit/ckscripts.html
2142  124. http://www.columbia.edu/kermit/current.html
2143  125. http://www.columbia.edu/kermit/whatsnew.html
2144  126. http://www.columbia.edu/kermit/faq.html
2145  127. http://www.columbia.edu/kermit/support.html
2146  128. http://www.columbia.edu/kermit/index.html
2147  129. http://www.columbia.edu/
2148  130. mailto:kermit@columbia.edu
2149  131. http://validator.w3.org/check?uri=http%3A%2F%2Fkermit.columbia.edu%2Fckermit90.html