remove patch with docs shipped with 301
[ckermit.git] / ckermit80.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 C-Kermit 8.0 Update Notes
9
10    [ [11]Contents ] [ [12]C-Kermit ] [ [13]Kermit Home ]
11
12 Second Supplement to [14]Using C-Kermit, 2nd Edition
13
14 For C-Kermit 8.0
15
16    As of C-Kermit version: 8.0.211
17    Date of C-Kermit release: 10 April 2003
18    This file last updated: Mon Sep 13 08:52:36 2010
19
20      * IF YOU ARE READING A PLAIN-TEXT version of this document, note that
21        it is a plain-text dump of a Web page. You can visit the original
22        (and possibly more up-to-date) Web page here:
23   [15]http://www.columbia.edu/kermit/ckermit80.html
24
25      * If you are reading the HTML version of this file with a GUI Web
26        browser, the features added since C-Kermit 8.0.201 are shown in red
27        if your browser and monitor permit. Features that were new to
28        versions 8.0.200 and 201 are in black.
29
30 Authors: Frank da Cruz and Christine M. Gianone
31 Address: The Kermit Project
32          Columbia University
33          612 West 115th Street
34          New York NY 10025-7799
35          USA
36 Fax:     +1 (212) 662-6442
37 E-Mail:  [16]kermit-support@columbia.edu
38 Web:     [17]http://www.columbia.edu/kermit/
39 Or:      [18]http://www.kermit-project.org/
40 Or:      [19]http://www.columbia.nyc.ny.us/kermit/
41
42 NOTICES
43
44    This document:
45           Copyright © 1997, 2002, Frank da Cruz and Christine M. Gianone.
46           All rights reserved.
47
48    Kermit 95:
49           Copyright © 1995, 2002, Trustees of Columbia University in the
50           City of New York. All rights reserved.
51
52    C-Kermit:
53           Copyright © 1985, 2002,
54           Trustees of Columbia University in the City of New York. All
55           rights reserved. See the C-Kermit [20]COPYING.TXT file or the
56           copyright text in the [21]ckcmai.c module for disclaimer and
57           permissions.
58
59    When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or
60           SSL/TLS protocol are included:
61           Portions Copyright © 1990, Massachusetts Institute of
62           Technology.
63           Portions Copyright © 1991, 1993 Regents of the University of
64           California.
65           Portions Copyright © 1991, 1992, 1993, 1994, 1995 by AT&T.
66           Portions Copyright © 1997, Stanford University.
67           Portions Copyright © 1995-1997, Eric Young <eay@cryptosoft.com>.
68
69    For the full text of the third-party copyright notices, see
70    [22]Appendix V.
71
72 WHAT IS IN THIS FILE
73
74    This file lists changes made to C-Kermit since version 7.0 was released
75    in January 2000. Use this file as a supplement to:
76
77      * The second edition of [23]Using C-Kermit; and:
78      * The [24]C-Kermit 7.0 Update Notes. Also available in plain-text
79        form as [25]ckermit70.txt.
80
81    until the third edition of Using C-Kermit is published. We apologize
82    for the scattered documentation and will consolidate it when we are
83    able.
84
85 ADDITIONAL FILES
86
87    Several other files accompany this new Kermit release:
88
89    [26]ckututor.html
90           C-Kermit Tutorial (for Unix). Also distributed in Nroff form as
91           [27]ckuker.nr, the Unix C-Kermit manual page.
92
93    [28]security.htm
94           Discussion of Kermit's new authentication and encryption
95           features, updated for C-Kermit 8.0.
96
97    [29]telnet.htm
98           Detailed documentation of Kermit's Telnet client, updated for
99           C-Kermit 8.0.
100
101    [30]ftpscripts.html
102           Tutorial: Writing FTP automation scripts
103
104    [31]ckcbwr.html
105           Platform-independent C-Kermit hints and tips. Also distributed
106           in plain text form as [32]ckcbwr.txt
107
108    [33]ckubwr.html
109           Unix-specific C-Kermit hints and tips. Also distributed in plain
110           text form as [34]ckubwr.txt.
111
112    [35]ckvbwr.html
113           VMS-specific C-Kermit hints and tips. Also distributed in plain
114           text form as [36]ckvbwr.txt.
115
116    [37]ckuins.html
117           Unix C-Kermit installation instructions. Also distributed in
118           plain text form as [38]ckuins.txt.
119
120    [39]ckvins.html
121           VMS C-Kermit installation instructions. Also distributed in
122           plain text form as [40]ckvins.txt.
123
124    [41]ckccfg.html
125           Compile-time configuration options. Also distributed in plain
126           text form as [42]ckccfg.txt.
127
128    [43]ckcplm.html
129           C-Kermit Program Logic Manual. Also distributed in plain text
130           form as [44]ckcplm.txt.
131
132    [45]iksd.html
133           Internet Kermit Service Administrators Guide for Unix.
134
135    [46]skermit.html
136           C-Kermit as an SSH Subsystem (SFTP server replacement).
137
138    [ [47]Top ] [ [48]C-Kermit ] [ [49]Kermit Home ]
139
140 CONTENTS
141
142      [50]0. WHAT'S NEW
143      [51]1. FIXES SINCE VERSION 7.0.196
144      [52]2. SSH AND HTTP
145          [53]2.1. SSH Connections
146          [54]2.2. HTTP Connections
147             [55]2.2.1. HTTP Command Switches
148             [56]2.2.2. HTTP Action Commands
149             [57]2.2.3. HTTP Headers
150             [58]2.2.4. Secure HTTP Connections
151             [59]2.2.5. HTTP Variables
152             [60]2.2.6. The HTTP Command-Line Personality
153      [61]3. THE BUILT-IN FTP CLIENT
154          [62]3.1. Making and Managing FTP Connections
155             [63]3.1.1. Kermit Command-Line Options for FTP
156             [64]3.1.2. The FTP Command-Line Personality
157             [65]3.1.3. The FTP URL Interpreter
158             [66]3.1.4. Interactive FTP Session Establishment
159          [67]3.2. Making Secure FTP Connections
160          [68]3.3. Setting FTP Preferences
161          [69]3.4. Managing Directories and Files
162          [70]3.5. Uploading Files With FTP
163             [71]3.5.1. FTP PUT Switches
164             [72]3.5.2. Update Mode
165             [73]3.5.3. Recovery
166          [74]3.6. Downloading Files With FTP
167             [75]3.6.1. FTP GET Switches
168             [76]3.6.2. Filename Collisions
169             [77]3.6.3. Recovery
170          [78]3.7. Translating Character Sets
171             [79]3.7.1. Character Sets and Uploading
172             [80]3.7.2. Character Sets and Downloading
173          [81]3.8. FTP Command Shortcuts
174          [82]3.9. Dual Sessions
175          [83]3.10. Automating FTP Sessions
176             [84]3.10.1. FTP-Specific Variables and Functions
177             [85]3.10.2. Examples
178             [86]3.10.3. Automating Secure FTP Connections
179          [87]3.11. Advanced FTP Protocol Features  [88]4. FILE SCANNING
180     [89]5. FILE AND DIRECTORY NAMES CONTAINING SPACES
181     [90]6. OTHER COMMAND PARSING IMPROVEMENTS
182          [91]6.1. Grouping Macro Arguments
183          [92]6.2. Directory and File Name Completion
184          [93]6.3. Passing Arguments to Command Files
185          [94]6.4. More-Prompting
186          [95]6.5. Commas in Macro Definitions
187          [96]6.6. Arrow Keys
188     [97]7. NEW COMMANDS AND SWITCHES
189     [98]8. SCRIPTING IMPROVEMENTS
190          [99]8.1. Performance and Debugging
191          [100]8.2. Using Macros as Numeric Variables
192          [101]8.3. New IF Conditions
193          [102]8.4. The ON_UNKNOWN_COMMAND and ON_CD Macros
194          [103]8.5. The SHOW MACRO Command
195          [104]8.6. Arrays
196          [105]8.7. New or Improved Built-in Variables and Functions
197          [106]8.8. The RETURN and END Commands
198          [107]8.9. UNDEFINing Groups of Variables
199          [108]8.10. The INPUT and MINPUT Commands
200          [109]8.11. Learned Scripts
201          [110]8.12. Pattern Matching
202          [111]8.13. Dates and Times
203          [112]8.14. Trapping Keyboard Interruption
204     [113]9. S-EXPRESSIONS
205          [114]9.1. What is an S-Expression?
206          [115]9.2. Integer and Floating-Point-Arithmetic
207          [116]9.3. How to Use S-Expressions
208          [117]9.4. Summary of Built-in Constants and Operators
209          [118]9.5. Variables
210          [119]9.6. Assignments and Scope
211          [120]9.7. Conditional Expressions
212          [121]9.8. Extensibility
213          [122]9.9. Examples
214          [123]9.10. Differences from Algebraic Notation
215          [124]9.11.Differences from Lisp
216     [125]10. FILE TRANSFER
217     [126]11. MODEMS AND DIALING
218     [127]12. TERMINAL CONNECTION
219     [128]13. CHARACTER SETS
220     [129]14. DIALOUT FROM TELNET TERMINAL SERVERS
221     [130]15. COPING WITH BROKEN KERMIT PARTNERS
222     [131]16. NEW COMMAND-LINE OPTIONS
223     [132]17. LOGS
224
225    [ [133]Top ] [ [134]C-Kermit ] [ [135]Kermit Home ]
226
227 0. WHAT'S NEW
228
229    The Initialization and Customization Files
230           C-Kermit 8.0 now supports specification of the initialization
231           file name (path) in an environment variable, CKERMIT_INI. It
232           also relies far less than before on the initialization for
233           functioning. See [136]Section 5 of the Unix C-Kermit
234           [137]installation instructions for details. As of version
235           8.0.201, C-Kermit also executes your customization file (if you
236           have one) even if the initialization file was not found.
237           Previously, the customization file was executed by a TAKE
238           command in the initialization file (and it still is, if an
239           initialization is found).
240
241    Incompatible Changes
242           As always, we do our best to avoid changes that break existing
243           scripts. However, C-Kermit 8.0 does include a rather pervasive
244           syntax change that might alter the behavior of scripts that
245           depend on the previous behavior. As described in [138]Section 5,
246           C-Kermit now accepts doublequotes in most contexts where you
247           previously had to use braces to group multiple words into a
248           single field, or to force inclusion of leading or trailing
249           blanks. Most noticeably, in C-Kermit 7.0 and earlier:
250
251   echo {this is a string}
252
253           would print:
254
255   this is a string
256
257           whereas:
258
259   echo "this is a string"
260
261           printed:
262
263   "this is a string"
264
265           In C-Kermit 8.0, both print:
266
267   this is a string
268
269           To force the doublequotes to be treated as part of the string,
270           use either of the following forms:
271
272   echo {"this is a string"}
273   echo ""this is a string""
274
275           Similarly, to force braces to be treated as part of the string:
276
277   echo "{this is a string}"
278   echo {{this is a string}}
279
280           Other incompatibilities:
281
282          1. Using the SET HOST command to make HTTP connections is no
283             longer supported. Instead, use the new HTTP OPEN command,
284             described in [139]Section 2.2.
285
286    C-Kermit 7.1 Alpha.01 (8 December 2000)
287
288      Its major new features are those listed in the [140]Table of
289           Contents: the FTP client, file scanning, command parsing and
290           scripting improvements, S-Expressions, and support for the
291           Telnet Com Port Option, plus wider availability of the Kerberos,
292           SSL/TLS, and SRP security options for secure Internet
293           connections.
294
295    C-Kermit 7.1.199 Alpha.02 (4 January 2001)
296
297           + C-Kermit now accepts [141]FTP, TELNET, and IKSD URLs as its
298             first command-line argument.
299           + Character-set translation added to the FTP client for
300             [142]filenames.
301           + Optional [143]setting of date of incoming files by FTP [M]GET
302             from the server date.
303           + [144]FTP CHECK filename added to let FTP client check the
304             existence of a file on the server.
305           + [145]FTP GET /NAMELIST:filename added to get list of server
306             filenames into a local file.
307           + [146]FTP [M]PUT /SERVER-RENAME:template added to make server
308             rename a file as indicated by the template after it has
309             arrived completely.
310           + FTP [M]GET /SERVER-RENAME:template added to make server rename
311             a file as indicated by the template after it has been sent
312             completely.
313           + FTP [147]VDIRECTORY added for getting verbose directory
314             listings from TOPS-20.
315           + [148]FTP TYPE TENEX added for transferring 8-bit binary files
316             with PDP-10s.
317           + Added [149]automatic text/binary mode switching for FTP
318             [M]GET, based on filename patterns (e.g. *.zip, *.gz, *.exe
319             are binary; *.txt, *.c are text).
320           + [150]SET SEND I-PACKETS OFF added for coping with Kermit
321             servers that do not support I packets.
322           + A new option was added to [151]\fword() and \fsplit() for
323             parsing comma-separated lists that might contain empty
324             elements.
325           + Bug fixes including:
326                o {} or "" could not be used as expected to represent the
327                  empty string.
328                o ,- on a line by itself in a macro definition caused
329                  subsequent statements to be skipped.
330                o FTP [M]GET didn't work right if path segments were
331                  included in the filespec.
332                o FTP MGET, if interrupted, did not clear its file list.
333                o Various problems with FTP PUT /AS-NAME that nobody
334                  noticed.
335                o Some FTP messages and displays interfered with each
336                  other.
337                o Parsing of YESTERDAY, TODAY, and TOMORROW in date-time
338                  fields was broken.
339                o Automatic old-to-new dialing directory format conversion
340                  was broken on VMS.
341                o Various source-code portability problems fixed.
342           + Improvement of various HELP and SHOW messages.
343
344    C-Kermit 7.1.199 Alpha.04 (1 April 2001)
345
346           + Big changes:
347                o Changed default modem type from NONE to GENERIC.
348                o Generic dialing now sends no init string at all.
349                o Changed default terminal bytesize from 7 to 8.
350           + New features:
351                o SET SESSION-LOG TIMESTAMPED-TEXT for timestamped session
352                  log.
353           + New modem types:
354                o Conexant modem family
355                o Lucent VENUS chipset
356                o PCTel V.90 chipset
357                o Zoom V.90
358                o Zoom V.92
359           + FTP client:
360                o FTP OPEN /PASSIVE and /ACTIVE switches added.
361                o Now works with servers that that don't include path in
362                  NLST response.
363                o Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
364                o SET FTP VERBOSE-MODE default is now OFF instead of ON.
365           + Kermit protocol:
366                o Fixed what I hope is the last "Receive window full"
367                  error.
368                o SET PREFIXING or SET CONTROL PREFIX now automatically
369                  sets CLEARCHANNEL OFF.
370                o Fixed incorrect report of number of files transferred at
371                  end of transfer.
372                o Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
373           + UNIX:
374                o HTTP and shadow passwords enabled for SCO 5.0.6.
375                o Even with SET FILENAMES CONVERTED, spaces were still
376                  accepted in incoming filenames; now they are converted to
377                  underscores.
378                o Added support for compile-time mktemp()/mkstemp()
379                  selection.
380           + VMS:
381                o Session-log format for scripted sessions fixed.
382           + Scripting:
383                o Fixed \frdir() not to follow symlinks (UNIX).
384                o Fixed \fday() not to dump core for dates prior to 17 Mar
385                  1858.
386           + General:
387                o "Closing blah..." message upon exit could not be
388                  surpressed.
389                o Added /PAGE and /NOPAGE to DELETE switches.
390                o Added GO response for DELETE /ASK (delete all the rest
391                  without asking).
392                o Added GO response to "more?" prompt (for multi-page
393                  screen output).
394                o Updated HELP texts.
395
396    C-Kermit 7.1.199 Beta.01 (10 May 2001)
397
398           + FTP client verbosity adjustments.
399           + Bug with generic modem dialing pausing several secs fixed.
400           + SET HOST /USER:, SET LOGIN USERID, etc, fixed when given no
401             user ID.
402           + A couple \v(dm_blah) dial modifier variables added.
403           + "--version" command-line switch added.
404           + Fixed NetBSD serial-port DTR handling.
405           + Lots of syntax cleanups for Flexelint and gcc -Wall.
406           + Fixed modem-type aliases to not take precedence over real
407             names.
408           + Fixed funny treatment of doublequotes by ECHO command.
409           + Enabled SET SESSION-LOG for VMS and other non-UNIX platforms.
410           + Fixed changing direction in command history buffer.
411           + Fixed handling of IKSD URLs.
412           + Made sure DELETE prints a message if it got any errors.
413
414    C-Kermit 8.0.200 Beta.02 (28 June 2001)
415
416           + Major version number increased from 7 to 8.
417           + [152]SSH command.
418           + More-consistent Kermit protocol defaults.
419           + CONNECT idle timeout and action selection.
420           + CONNECT status variable.
421           + A way to allocate more space for filename lists.
422           + Pseudoterminal handler fixed for late-model Linuxes.
423           + Command-line option -dd for timestamped debug log.
424           + Download directory now works for external protocols too.
425           + GREP /COUNT:variable.
426           + SET ATTRIBUTE RECORD-FORMAT { OFF, ON }.
427           + Bug fixes.
428
429    C-Kermit 8.0.200 Beta.03 (9 Sep 2001)
430
431           + [153]HTTP 1.1 connections and scripting
432           + [154]ON_CTRLC macro for trapping Ctrl-C in scripts
433           + [155]Date-time parsing improvements, timezones, comparison,
434             arithmetic
435           + [156]Pattern-matching improvements
436           + FTP improvements
437           + SET EXIT HANGUP { ON, OFF }
438           + SET FILE EOF { CTRL-Z, LENGTH }
439           + ASK[Q] /TIMEOUT
440           + Bug fixes
441           + New platforms
442
443    C-Kermit 8.0.200 Beta.04 (16 Nov 2001)
444
445           + [157]New Unix man page
446           + [158]New Unix installation instructions
447           + SET TELOPT policies are now enforced on non-Telnet ports if
448             the server begins Telnet negotiations.
449           + SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }.
450           + UUCP lockfile creation race condition fixed.
451           + Dialout, modem signals, hangup, hardware flow control, etc,
452             tested extensively on many platforms, numerous problems fixed.
453           + Improved hints when dialing fails.
454           + SET STOP-BITS 2 can now be given without SET FLOW HARDWARE.
455           + Major improvements in RFC 2217 Telnet Com-Port Control.
456           + Improved ability to REDIAL a modem server port.
457           + kermit -h now shows the command name in the usage usage
458             string.
459           + kermit -h now shows ALL command-line options.
460           + kermit -s blah, where blah is a symlink, now works.
461           + --noperms command-line option = SET ATTRIBUTE PERMISSIONS OFF.
462           + HTTP and HTTPS URLs now supported on the command line.
463           + An http command-line personality is now available.
464           + Initialization file streamlined to load faster, anachronisms
465             removed.
466           + Updated NEWS, INTRO, HELP text, SHOW commands. In particular,
467             see SHOW COMM, HELP SET LINE, HELP WAIT.
468           + Date/time arithmetic routines converted from floating-point to
469             integer arithmetic (internally) for greater accuracy and
470             portability.
471           + Quoted strings containing commas no longer break macro
472             execution.
473           + Dynamic Kermit file-transfer timeouts are now much more
474             aggressive.
475           + New "hot keys" to turn debug.log on/off during file transfer.
476           + Improved hints when file transfer fails.
477           + FTP CD orientation messages are now printed.
478           + -R now accepted on the FTP command line to request Recursion.
479           + -m allows Active or Passive mode to be chosen on the FTP
480             command line.
481           + -dd on the FTP command line creates a timestamped debug.log.
482           + FTP command-line security options filled in.
483           + Improved automatic text/binary mode switching for MGET.
484           + Removed spurious error messages that sometimes occur during
485             MGET.
486           + DIRECTORY, GREP, TYPE, HEAD, and TAIL now have a /OUTPUT:file
487             option.
488           + TYPE /NUMBER adds line numbers.
489           + CAT = TYPE /NOPAGE; MORE = TYPE /PAGE.
490           + GETOK ?-help fixed.
491           + \v(timestamp) (= "\v(ndate) \v(time)")
492           + \v(hour) (hour of the day, 0-23)
493           + \funix2dospath() converts a UNIX path (/) to a DOS one (\).
494           + \fdos2unixpath() converts a DOS (Windows, OS/2) path to a UNIX
495             one.
496           + \fkeywordval() parses name=value pair, allows macro keyword
497             parameters.
498           + We now make every attempt to not write passwords to the
499             debug.log.
500           + New Certificate Authority certificates file, includes the
501             Kermit Project at Columbia University so you can accesss our
502             IKSD securely.
503           + Secure targets improved and better documented in Unix
504             makefile.
505           + All Linux (libc and glibc) builds consolidated under "make
506             linux".
507           + HP-UX makefile targets now have consistent names.
508           + New aix50 and aix51 targets added.
509
510    C-Kermit 8.0.200 Final (12 Dec 2001)
511
512           + Remote/local-mode confusion on some platforms introduced in
513             Beta.04, fixed.
514           + Many of the makefile targets adjusted, new ones added.
515           + New "make install" target should please most people.
516           + New command: SHOW IKSD.
517           + FTP over TLS.
518           + Last-minute touchups to text messages, HELP text, etc.
519           + Enable modem-signal reading for SCO OSR5 and Unixware 7.
520           + Special superfast TRANSMIT /BINARY /NOECHO /NOWAIT mode added.
521           + Fixed PBX dialing in unmarked-area-code case.
522           + Improved SHOW COMMUNICATIONS tells lockfile directory, typical
523             dialout device name.
524           + Some FTP OPEN command parsing problems fixed.
525           + Some errors in date arithmetic fixed.
526           + New command: SET TERMINAL AUTODOWNLOAD { ..., ERROR { STOP,
527             CONTINUE } }
528           + New command: HELP FIREWALL.
529           + SET MODEM HANGUP-METHOD DTR added as synonym for RS232-SIGNAL
530           + Support for secure URL protocols added: telnets:, ftps:,
531             https:.
532
533    C-Kermit 8.0.201 (8 Feb 2002)
534
535           + Installability as an [159]SSH v2 Subsystem.
536           + [160]SET LOCUS command.
537           + [161]L-versions of CD, DIR, DELETE, MKDIR, etc, to force local
538             execution.
539           + [162]USER and ACCOUNT added as synonyms for FTP USER and FTP
540             ACCOUNT.
541           + [163]SHOW VARIABLES now accepts a list of variables.
542           + Rudimentary support for [164]Caller ID when receiving phone
543             calls.
544           + Up/Down [165]Arrow-key navigation of command history buffer.
545           + [166]Automatic execution of customization file if init file is
546             missing.
547
548    C-Kermit 8.0.206 Beta.01 (11 Oct 2002)
549
550         New commands:
551
552                o ORIENTATION lists location-related variables and their
553                  values.
554                o KCD changes to special directories by their symbolic
555                  names ("kcd ?" for a list).
556                o SET CD HOME path to specify home directory for CD and KCD
557                  commands.
558                o CONTINUE given at top level is equivalent to END -- handy
559                  when PROMPT'ed out of a script, to continue the script.
560
561         New switches or operands for existing commands:
562
563                o GETOK /TIMEOUT
564                o ASK, ASKQ, GETOK /QUIET (suppresses error message on
565                  timeout)
566                o COPY /APPEND now allows concatenating multiple source
567                  files into one dest file.
568                o SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER, /PASSWORD.
569                o DIRECTORY command now accepts multiple filespecs, e.g.
570                  "dir a b c".
571
572         SET QUIET ON now also applies to:
573
574                o SET HOST connection progress messages.
575                o "Press the X or E key to cancel" file-transfer message.
576                o REMOTE CD response.
577                o REMOTE LOGIN response.
578
579         Improvements and new features:
580
581                o Numerous FTP client fixes and new features, listed below.
582                o C-Kermit, when in remote mode at the end of a file
583                  transfer, now prints a one-line "where" message. Control
584                  with SET TRANSFER REPORT.
585                o Unix makefile "install" target now creates an UNINSTALL
586                  script.
587                o Improved operation and performance on RFC 2217 Telnet
588                  connections.
589                o Improved CONNECT (interactive terminal connection)
590                  performance.
591                o HELP text updated for many commands.
592
593         New or fixed makefile targets:
594
595                o Solaris 9 (several variations)
596                o Concurrent PowerMAX
597                o Mac OS X 10.2
598                o FreeBSD 1.0
599                o FreeBSD 4.6, 5.0
600                o AIX 5.2, 5.3
601
602         Bugs fixed (general):
603
604                o Failure to run in VMS Batch fixed.
605                o LDIRECTORY fixed to run Kermit's built-in DIRECTORY
606                  command rather than an external one.
607                o Fixed Solaris and other SVORPOSIX builds to find out
608                  their full hostnames rather than just the "uname -n"
609                  name.
610                o Fixed some problems matching strings that start with ".".
611                o Fixed some problems matching pattern that contain {a,b,c}
612                  lists.
613                o Fixed erroneous reporting of text-mode reception as
614                  binary when sender did not report the file size (cosmetic
615                  only).
616                o Many problems with SWITCH statements fixed.
617                o Fixed SET OPTIONS DIRECTORY /DOTFILES to work for server
618                  too.
619                o Fixed DELETE to print an error message if the file was
620                  not found.
621                o Fixed SET CONTROL UNPREFIX ALL and SET PREFIXING NONE to
622                  do the same thing.
623                o Fixed bugs executing macros from within the ON_EXIT
624                  macro.
625                o \fday() and \fnday() fixed for dates prior to 17 Nov
626                  1858.
627                o Serial speed-changing bug in Linux fixed.
628                o "Unbalanced braces" script parsing errors when using
629                  \{number} fixed.
630                o "if defined \v(name)" fixed to behave as described in the
631                  book.
632                o Fixed Problems caused by LOCAL variables whose names are
633                  left substrings of macro names.
634                o The INPUT command was fixed to honor the PARITY setting.
635                o Fixed bug with COPY to existing file that is longer than
636                  source file.
637                o REINPUT command failed to strip braces/quotes around its
638                  target string.
639                o Network directory lookups didn't work for SSH
640                  connections.
641                o REMOTE SET { FILE, TRANSFER } CHARACTER-SET fixed.
642                o Closed some holes whereby an incompletely received file
643                  was not deleted when SET FILE INCOMPLETE is DISCARD, e.g.
644                  when the Kermit is hung up upon.
645                o SET XFER CHARACTER-SET TRANSPARENT fixed to do the same
646                  as SET XFER TRANSLATION OFF.
647                o SET HOST PTY (e.g. SSH) connection fixed to pass along
648                  window-size changes.
649                o C-Kermit search path for TAKE files was accidentally
650                  disabled.
651
652         FTP client bugs fixed:
653
654                o Character set translation was broken on little-endian
655                  (e.g. PC) architectures.
656                o FTP PUT /SERVER-RENAME:, /RENAME-TO:, /MOVE-TO: switches
657                  were sticky.
658                o Make SET TRANSFER MODE MANUAL apply to FTP.
659                o Make SET FILE INCOMPLETE { KEEP, DISCARD } apply to FTP.
660                o FTP MGET /UPDATE handled equal times incorrectly.
661                o FTP MGET /RECOVER fixed to ignore file dates, use only
662                  size.
663                o FTP MGET /RECOVER sometimes downloaded files it didn't
664                  need to.
665                o FTP downloads with TRANSFER DISPLAY BRIEF could give
666                  misleading error messages.
667                o FTP MGET temp file not deleted if FTP DEBUG set to OFF
668                  after it was ON.
669                o LOCUS not switched back when FTP connection is lost.
670                o Set incoming file date even if it was not completely
671                  received.
672                o FTP MGET sent SIZE and MDTM commands even when it didn't
673                  have to.
674                o FTP MGET sent SIZE and MDTM commands even when it knew
675                  they wouldn't work.
676                o FTP MGET failed if no files were selected for download.
677                o FTP MGET a* b* c* would fail to get any c*'s if no b*'s
678                  existed.
679                o Big problems canceling MGET with Ctrl-C.
680                o Some extraneous LOCUS dialogs squelched.
681                o Some inconsistencies in SET FTP FILENAMES AUTO fixed.
682                o Fixed file-descriptor pileup after multiple MGETs when
683                  using mkstemp().
684                o Fixed "mget foo", where foo is a directory name.
685
686         FTP improvements:
687
688                o New [167]FTP protocol features added (FEAT, MLSD).
689                o FTP MGET /RECURSIVE now works as expected if server
690                  supports MLSD.
691                o FTP MGET /DATES-DIFFER to download if local and remote
692                  file dates differ.
693                o FTP DATES default changed to ON.
694                o FTP MPUT, MGET /EXCEPT now allows up to 64 patterns (up
695                  from 8).
696                o Top-level SITE and PASSIVE commands added for
697                  convenience.
698                o MGET /COLLISION:APPEND /AS-NAME:newfile *.* puts all
699                  remote files into one local file.
700                o SET FTP SERVER-TIME-OFFSET for when server has wrong
701                  timezone set.
702                o Allow for alternative server interpretations of [M]MPUT
703                  /UNIQUE.
704                o SET FTP ANONYMOUS-PASSWORD lets you specify the default
705                  anonymous password.
706                o Allow "GET /RECURSIVE path/file" to force local
707                  subdirectory creation.
708                o SET FTP DISPLAY is like SET TRANSFER DISPLAY but applies
709                  only to FTP.
710                o FTP { ENABLE, DISABLE } new-protocol-feature-name.
711                o FTP MGET /NODOTFILES.
712                o Debug log now records FTP commands and responses in
713                  grep-able format.
714
715    [ [168]Top ] [ [169]Contents ] [ [170]C-Kermit ] [ [171]Kermit Home ]
716
717 1. FIXES SINCE VERSION 7.0.196 First, the changes from 7.0.196 to 7.0.197...
718 Source and makefile tweaks to get successful builds on platforms that were
719 not available in time for the 7.0 release:
720
721      * 4.2BSD
722      * 4.3BSD
723      * AIX 4.3
724      * AT&T 3B2 and 3B20
725      * BeOS 4.5
726      * CLIX
727      * Interactive UNIX System V/386 R3.2 V4.1.1
728      * OS-9/68000
729      * OSF/1 1.3.
730      * PS/2 AIX 1.2.1
731      * SCO OSR5.0.x
732      * SCO Xenix 2.3.4
733      * SINIX 5.41/Intel
734      * Stratus FTX
735      * Stratus VOS
736      * SunOS 4.1 with X.25
737      * Ultrix 4.2
738      * Unixware 2.0
739
740    There were no functional changes from 196 to 197.
741
742    Fixes applied after C-Kermit 7.0.197 was released:
743
744    Source code: Big flexelint and "gcc -Wall" audit and cleanup.
745
746    Configuration:
747      * Solaris RTS/CTS (hardware flow control) didn't work.
748      * BSDI RTS/CTS worked only in one direction.
749      * FreeBSD 4.0 with ncurses 5.0 broke interactive command parsing.
750      * QNX-32 build lacked -DBIGBUFOK so couldn't execute big macros.
751
752    Connections:
753      * SET HOST /PTY didn't work on some platforms.
754      * Broken SET HOST /USER:xxx /PASSWORD:yyy /ACCOUNT:zzz switches
755        fixed.
756      * Transparent printing was broken in Unix.
757      * ANSWER 0 (wait forever) didn't work.
758      * Some problems in Multitech modem command strings.
759      * Spurious "?Sorry, can't condition console terminal" errors.
760      * Disabling modem command strings by setting them to nothing broke
761        dialing.
762      * SET DIAL TIMEOUT value was usually ignored.
763      * SET DIAL METHOD PULSE didn't work.
764      * Certain modem commands, if changed, not refreshed if modem type
765        changed.
766      * SET SESSION-LOG command was missing from VMS.
767      * VMS session log format fixed for scripts.
768      * HANGUP by dropping DTR didn't work in NetBSD.
769      * SET FLOW /AUTO versus SET FLOW confusion fixed.
770      * Spurious secondary Solaris lockfile removed.
771      * SCO OSR5 DTR On/Off hangup.
772      * UUCP lockfile race condition.
773
774    Commands and scripts:
775      * Missing CAUTIOUS and FAST commands restored.
776      * Broken PTY command in late-model Linuxes fixed (API changed).
777      * Fixed off-by-one error in command recall when switching direction.
778      * Fixed recall of commands that contain '?'.
779      * COPY /SWAP-BYTES didn't work on some architectures.
780      * Various combinations of COPY switches didn't work.
781      * Various problems with COPY or RENAME with a directory name as
782        target.
783      * SHIFT didn't decrement \v(argc) if used within IF, ELSE, or SWITCH
784        block.
785      * SHIFT didn't affect the \%* variable.
786      * Divide by zero improperly handled in some \function()s.
787      * Problems with RETURN from right-recursive functions.
788      * FSEEK /LINE \%c LAST didn't work if already at end.
789      * Some buffer vulnerabilities and potential memory leaks were
790        discovered and fixed.
791      * \frdirectory() fixed not to follow symbolic links.
792      * SET EXIT WARNING OFF fixed to work when EXIT given in a script.
793      * Missing DELETE and MKDIR error message fixed.
794      * \fday() core dump for ancient dates fixed.
795
796    File transfer:
797      * SEND /COMMAND was broken.
798      * CRECEIVE was broken (but RECEIVE /COMMAND was OK).
799      * Quoting wildcard chars in filenames didn't work.
800      * Problems canceling streaming file transfers with X or Z.
801      * Problems shifting between streaming and windowing file transfer.
802      * Non-FULL file-transfer displays erroneously said STREAMING when
803        not.
804      * An active SEND-LIST prevented GET from working.
805      * SET SERVER GET-PATH interpretation of relative names like "." was
806        wrong.
807      * The MAIL command was broken.
808      * "kermit -s *" might have skipped some files.
809      * Transaction log entries were not made for external protocol
810        transfers.
811      * File count report fixed to show number of files actually
812        transferred.
813      * Fixed filename conversion to convert spaces to underscores.
814      * Made SET PREFIXING / SET CONTROL PREFIX also adjust CLEARCHANNEL.
815      * More "Receive window full" errors fixed.
816      * Broken terminal buffering after curses display in Solaris fixed.
817      * SET FILE INCOMPLETE DISCARD did not work in all cases.
818      * Packet log changed to reformat the start-of-packet character
819        printably.
820      * Dynamic timeouts could grow ridiculously large.
821
822    Character sets:
823      * Hebrew-7 translations missed the letter Tav.
824      * C1 area of CP1252 was ignored.
825      * SET TRANSFER CHARACTER-SET TRANSPARENT could give garbage
826        translations.
827      * TRANSLATE might not work on Little Endian architectures.
828      * Insufficient range checking in certain TRANSLATE operations.
829
830    The following bugs in C-Kermit 8.0.200 were fixed in 8.0.201:
831
832      * An obscure path through the code could cause the Unix version of
833        C-Kermit to dump core during its startup sequence. This happened to
834        only one person, but now it's fixed.
835      * When C-Kermit 8.0 is in Kermit server mode and the client says "get
836        blah", where blah (on the server) is a symlink rather than a real
837        file, the server unreasonably refused to send the linked-to file.
838      * When C-Kermit is an FTP client and says "get foo/bar" (i.e. a
839        filename that includes one or more path segments), it failed to
840        accept the incoming file (this happened only with GET, not MGET).
841      * Array references should be case insensitive but only lowercase
842        array letters were accepted.
843      * SHOW VARIABLES dumped core on \v(sexpression) and \v(svalue).
844      * Spurious refusals of remote directory listings if the remote
845        server's date was set in the past.
846      * In AIX, and maybe elsewhere too, Kermit's COPY command always
847        failed with "Source and destination are the same file" when the
848        destination file didn't exist.
849      * The VMS version of C-Kermit did not work in Batch or when SPAWN'd.
850        To compound the problem, it also pretty much ignored the -B and -z
851        command-line options, whose purpose is to work around such
852        problems.
853      * C-Kermit 8.0 could not be built on IRIX 5.x.
854      * The C-Kermit 8.0 build for QNX6 said it was an "(unknown version)".
855
856    Other fixes are listed in the [172]previous section.
857
858    [ [173]Top ] [ [174]Contents ] [ [175]C-Kermit ] [ [176]Kermit Home ]
859
860 2. SSH AND HTTP
861
862 2.1. SSH Connections
863
864      This section does not apply to [177]Kermit 95 2.0, which has its own
865      built-in SSH client, which is documented [178]SEPARATELY.
866
867    On most UNIX platforms, C-Kermit can make SSH (Secure SHell) connection
868    by running the external SSH command or program through its
869    pseudoterminal interface. The command is:
870
871    SSH text
872           Tells Kermit to start the external SSH client, passing the given
873           text to it on the command line. Normally the text is just the
874           hostname, but it can be anything else that is acceptable to the
875           ssh client. If the command succeeds, the connection is made and
876           Kermit automatically enters CONNECT (terminal) mode. You can use
877           the SSH command to make a connection to any host that has an SSH
878           server.
879
880    Kermit's SSH command gives you all the features of Kermit on an SSH
881    connection: command language, file transfer, character-set translation,
882    scripting, and all the rest. By default, C-Kermit invokes SSH with "-e
883    none", which disables the ssh escape character and makes the connection
884    transparent for purposes of file transfer. You can, however, change the
885    SSH invocation to whatever else you might need (an explicit path,
886    additional command-line arguments, etc) with:
887
888    SET SSH COMMAND text
889           Specifies the system command that Kermit's SSH command should
890           use to invoke the external SSH client. Use this command to
891           supply a specific path or alternative name, or to include
892           different or more command-line options.
893
894    In most cases, these connections work quite well. They can be scripted
895    like any other connection, and file transfer goes as fast as, or faster
896    than, on a regular Telnet connection. In some cases, however, the
897    underlying pseudoterminal driver is a limiting factor, resulting in
898    slow or failed file transfers. Sometimes you can work around such
899    problems by reducing the Kermit packet length. Note that Kermit does
900    not consider SSH connections to be reliable, so it does not offer to
901    use streaming in Kermit protocol transfers (but you can force it with
902    SET RELIABLE or SET STREAMING if you wish).
903
904    The SSH command is like the TELNET command: it enters CONNECT mode
905    automatically when the connection is made. Therefore, to script an SSH
906    connection, use:
907
908   set host /pty ssh -e none [ other-options ] host
909   if fail ...
910
911    to make the connection.
912
913    Here's a sequence that can be used to make a connection to a given host
914    using Telnet if the host accepts it, otherwise SSH:
915
916   if not defined \%1 exit 1 Usage: \%0 host
917   set quiet on
918   set host \%1 23 /telnet
919   if fail {
920       set host /pty ssh -l \m(user) -e none \%1
921       if fail exit 1 \%1: Telnet and SSH both fail
922       echo SSH connection to \%1 successful
923   } else {
924       echo Telnet connection to \%1 successful
925   }
926
927    In SSH v2, it is possible to make an SSH connection direct to a Kermit
928    server system if the host administrator has configured the SSH server
929    to allow this; [179]CLICK HERE for details.
930
931    Since Kermit uses external ssh client software, and since there are
932    different ssh clients (and different releases of each one), the exact
933    command to be used to make an SSH/Kermit connection can vary. Here is
934    the command for the OpenSSH 3.0.2p1 client:
935
936 set host /pipe ssh -e none [ -l username ] -T -s hostname kermit
937
938    Example:
939
940 set host /pipe ssh -e none -l olga -T -s hq.xyzcorp.com kermit
941
942    The SSH client might or might not prompt you for a password or other
943    information before it makes the connection; this depends on your SSH
944    configuration (your public and private keys, your authorized hosts
945    file, etc). Here's a brief synopsis of the OpenSSH client command
946    syntax ("man ssh" for details):
947
948    -e none
949           This tells the SSH client to use no escape character. Since we
950           will be transferring files across the connection, we don't want
951           the connection to suddenly block because some character in the
952           data.
953
954    -l username
955           This is the username on the remote host. You can omit the -l
956           option and its argument if your local and remote usernames are
957           the same. If they are different, you must supply the remote
958           username.
959
960    -T
961           This tells the SSH client to tell the SSH server not to allocate
962           a pseudoterminal. We are not making a terminal connection, we
963           don't need a terminal, and in fact if a terminal were allocated
964           on the remote end, the connection would not work.
965
966    -s ... kermit
967           This tells the SSH client to tell the SSH server to start the
968           specified subsystem ("kermit") once the connection is made. The
969           subsystem name comes after the hostname.
970
971    hostname
972           The IP host name or address of the desired host.
973
974    You might want to include other or additional ssh command-line options;
975    "man ssh" explains what they are. Here are some examples for the
976    OpenSSH 3.0.2p1 client:
977
978    -oClearAllForwardings yes
979    -oForwardAgent no
980    -oForwardX11 no
981    -oFallbackToRsh no
982           These ensure that a secure connection is used and that the
983           connection used for file transfer is not also used for
984           forwarding other things that might be specified in the
985           ssh_config file.
986
987    -oProtocol 2
988           (i.e. SSH v2) Ensures that the negotiated protocol supports
989           subsystems.
990
991    Once you have an SSH connection to a Kermit server, it's just like any
992    other connection to a Kermit server (and very similar to a connection
993    to an FTP server). You give the client file transfer and management
994    commands for the server, and the server executes them. Of course you
995    can also give the client any other commands you wish.
996
997    [ [180]SSH Kermit Server Subsystem ] [ [181]Kermit 95 Built-in SSH
998    Client ]
999
1000 2.2. HTTP Connections
1001
1002    Hypertext Transfer Protocol, or HTTP, is the application protocol of
1003    the World Wide Web (WWW), used between Web browsers (clients) and Web
1004    servers. It allows a client to get files from websites, upload files to
1005    websites, delete files from websites, get information about website
1006    directories and files, and interact with server-side CGI scripts.
1007    C-Kermit includes an HTTP client capable of both clear-text and secure
1008    HTTP connections, that can do all these tasks and can be automated
1009    through the Kermit scripting language.
1010
1011    Although C-Kermit 7.0 could make HTTP connections to Web servers, it
1012    could do so only when no other connection was open, and the procedure
1013    was somewhat awkward. C-Kermit 8.0 improves matters by:
1014
1015      * Allowing an HTTP connection to be open at the same time as a
1016        regular SET LINE or SET HOST connection, and also at the same time
1017        as an FTP connection ([182]Section 3);
1018      * Upgrading the HTTP protocol level from 1.0 to 1.1, thus allowing
1019        for persistent connections, in which a series of commands can be
1020        sent on the same connection, rather than only one as in HTTP 1.0
1021        (and C-Kermit 7.0);
1022      * Providing for "one-shot" URL-driven HTTP operations such as GET or
1023        PUT.
1024      * Providing a distinct HTTP command-line personality.
1025
1026    Persistent HTTP connections are managed with the following commands:
1027
1028    HTTP [ switches ] OPEN [ security-options ] host-or-url [ port ]
1029           Opens a persistent connection to the specified host (IP host
1030           name or address) on the specified port. If any switches
1031           (options, listed in the next section) are included, their values
1032           are saved and used for all subsequent HTTP action commands on
1033           the same connection. If no port is specified, HTTP (80) is used.
1034           A Uniform Resource Locator (URL, [183]RFC 1738) can be given
1035           instead of a hostname (or address) and port (but the URL can not
1036           include a directory/file path). The security options are
1037           explained [184]below. The HTTP OPEN command replaces the
1038           C-Kermit 7.0 SET HOST hostname HTTP command, which no longer
1039           works with HTTP GET and related commands.
1040
1041    HTTP CLOSE
1042           Closes any open HTTP connection and clears any saved switch
1043           values.
1044
1045    A URL starts with a protocol name, which must be http or https in this
1046    case; optionally includes a username and password; and must contain a
1047    host name or address:
1048
1049   protocol://[user[.password]]@host[:port][URI]
1050
1051    HTTP is Hypertext Transfer Protocol. HTTPS is the secure (SSL/TLS)
1052    version of HTTP. The TCP service port is derived from the protocol
1053    prefix (so normally the ":port" field is omitted). Thus the URL
1054    protocol name specifies a default TCP service port and the URL user and
1055    password fields can take the place of the /USER and /PASSWORD switches
1056    ([185]Section 2.2.1). The optional URI is a "compact string of
1057    characters for identifying an abstract or physical resource" ([186]RFC
1058    2396), such as a file. It must begin with a slash (/); if the URI is
1059    omitted, "/" is supplied. Examples:
1060
1061    http open http://www.columbia.edu/
1062           Equivalent to http open www.columbia.edu or http open
1063           www.columbia.edu http.
1064
1065    http open https://olga.secret@www1.xyzcorp.com/
1066           Equivalent to http /user:olga /pass:secret open www1.xyzcorp.com
1067           https.
1068
1069    Persistence is accomplished unilaterally by C-Kermit 8.0. An HTTP 1.0
1070    server closes the connection after each action. Although HTTP 1.1
1071    allows multiple actions on the same connection, an HTTP 1.1 server
1072    tends to close the connection if it is idle for more than a few
1073    seconds, to defend itself against denial-of-service attacks. But when
1074    you use Kermit's HTTP OPEN command to create a connection, Kermit
1075    reopens it automatically (if necessary) for each HTTP action until you
1076    close it with HTTP CLOSE, regardless of the server's HTTP protocol
1077    version, or how many times it closes the connection.
1078
1079    Firewalls can be negotiated through proxies with the following
1080    commands:
1081
1082    SET TCP HTTP-PROXY [ host[:port] ]
1083           If a host (by hostname or IP address) is specified, Kermit uses
1084           it as a proxy server when attempting outgoing TCP connections --
1085           not only HTTP connections, but all TCP/IP connections, Telnet
1086           and FTP included. This allows Kermit to adapt to the HTTP
1087           firewall penetration method (as opposed to other methods such as
1088           SOCKS4). If no hostname or ip-address is specified, any
1089           previously specified Proxy server is removed. If no port number
1090           is specified, the "http" service is used. This command must be
1091           given before the HTTP OPEN command if a proxy is to be used or
1092           canceled.
1093
1094    HTTP [ switches ] CONNECT host[:port]
1095           Instructs the HTTP server to act as a proxy, establishing a
1096           connection to the specified host (IP hostname or address) on the
1097           given port (80 = HTTP by default) and to redirect all data
1098           transmitted between Kermit and itself to the given host for the
1099           life of the connection. This command is to be used only for
1100           debugging HTTP proxy connections. If a proxy connection is
1101           required, instruct Kermit to use the proxy with the SET TCP
1102           HTTP-PROXY command.
1103
1104 2.2.1. HTTP Command Switches
1105
1106    HTTP switches, like all other switches, are optional. When HTTP
1107    switches are included with the HTTP OPEN command, they apply
1108    automatically to this and all subsequent HTTP actions (GET, PUT, ...)
1109    on the same connection until an HTTP CLOSE command is given. So if you
1110    include switches (or the equivalent URL fields, such as user and
1111    password) in the HTTP OPEN command, you can omit them from subsequent
1112    commands on the same connection. If the connection has closed since
1113    your last command, it is automatically reopened with the same options.
1114
1115    If you include switches with an HTTP action command (such as GET or
1116    PUT), they apply only to that command.
1117
1118    /USER:name
1119           To be used in case a page requires a username for accesss. The
1120           username is sent with page requests. If it is given with the
1121           OPEN command it is saved until needed. If a username is included
1122           in a URL, it overrides the username given in the switch.
1123           CAUTION: Username and password (and all other information,
1124           including credit card numbers and other material that you might
1125           prefer to protect from public view) are sent across the network
1126           in clear text on regular HTTP connections, but authentication is
1127           performed securely on HTTPS connections.
1128
1129    /PASSWORD:text
1130           To be used in case a web page requires a password for accesss.
1131           The password is sent with page requests. If it is given with the
1132           OPEN command it is saved until needed. If a password is given in
1133           a URL, it overrides the one given here. CAUTION: (same as for
1134           /USER:).
1135
1136    /AGENT:user-agent
1137           Identifies the client to the server. Overrides the default agent
1138           string, which is "C-Kermit" (for C-Kermit) or "Kermit-95" (for
1139           Kermit 95).
1140
1141    /ARRAY:array-designator
1142           Tells Kermit to store the response headers in the given array,
1143           one line per element. The array need not be declared in advance.
1144           Example: /array:&a.
1145
1146    /TOSCREEN
1147           Tells Kermit to display any response text on the screen. It
1148           applies independently of the output file specification; thus it
1149           is possible to have the server response go to the screen, a
1150           file, both, or neither.
1151
1152    /HEADER:header-item(s)
1153           Used for specifying any optional headers to be sent with HTTP
1154           requests.
1155
1156   /HEADER:tag:value
1157
1158           To send more than one header, use braces for grouping:
1159
1160   /HEADER:{{tag:value}{tag:value}...}
1161
1162           For a list of valid tags and value formats see [187]RFC 2616,
1163           "Hypertext Transfer Protocol -- HTTP/1.1". A maximum of eight
1164           headers may be specified.
1165
1166 2.2.2. HTTP Action Commands
1167
1168    HTTP actions can occur within a persistent connection, or they can be
1169    self-contained ("connectionless"). A persistent HTTP connection begins
1170    with an HTTP OPEN command, followed by zero or more HTTP action
1171    commands, and is terminated with an HTTP CLOSE command:
1172
1173   http open www.columbia.edu
1174   if failure stop 1 HTTP OPEN failed: \v(http_message)
1175   http get kermit/index.html
1176   if failure stop 1 HTTP GET failed: \v(http_message)
1177   (more actions possible here...)
1178   http close
1179
1180    A self-contained HTTP action occurs when a URL is given instead of a
1181    remote file name to an HTTP action command. In this case, Kermit makes
1182    the HTTP connection, takes the action, and then closes the connection.
1183    If an HTTP connection was already open, it is closed silently and
1184    automatically.
1185
1186   http get http://www.columbia.edu/kermit/index.html
1187
1188    Kermit's HTTP action commands are as follows. Switches may be included
1189    with any of these to override switch (or default) values given in the
1190    HTTP OPEN command.
1191
1192    HTTP [ switches ] GET remote-filename [ local-filename ]
1193           Retrieves the named file from the server specified in the most
1194           recent HTTP OPEN command for which a corresponding HTTP CLOSE
1195           command has not been given. The filename may not include
1196           wildcards (HTTP protocol does not support them). If no HTTP OPEN
1197           command is in effect, this form of the HTTP GET command fails.
1198           The default local filename is the same as the remote name, but
1199           with any pathname stripped. For example, the command http get
1200           kermit/index.html stores the file in the current local directory
1201           as index.html. If the /HEADERS: switch is included, information
1202           about the file is also stored in the specified array (explained
1203           in [188]Section 2.2.3). All files are transferred in binary
1204           mode. HTTP does not provide for record-format or character-set
1205           conversion.
1206
1207    HTTP [ switches ] GET url [ local-filename ]
1208           When HTTP GET is given a URL rather than a filename, Kermit
1209           opens a connection to the designated server (closing any
1210           previously open HTTP connection), gets the file, and then closes
1211           the connection. If the URL does not include a filename,
1212           index.html is supplied. This is the self-contained one-step
1213           "connectionless" method for getting a file from a Web server.
1214           The data is not interpreted; HTTP GET is like "lynx -source"
1215           rather than "lynx -dump".
1216
1217    In the remaining HTTP action commands, the distinction between a remote
1218    filename and a URL are the same as in the HTTP GET command.
1219
1220    HTTP [ switches ] HEAD remote-filename-or-url [ local-filename ]
1221           Like GET except without actually getting the file; instead it
1222           retrieves only the headers. If the /ARRAY: or /TOSCREEN switch
1223           is included, there is no default local output filename but you
1224           can still specify one. If neither of these switches is included,
1225           the default local filename is the same as the remote filename,
1226           but with any path stripped and with ".head" appended. The HEAD
1227           command can be used in a script with the /ARRAY: switch to
1228           retrieve information about the requested resource to determine
1229           whether the resource should actually be retrieved with a
1230           subsequent GET request.
1231
1232    HTTP [ switches ] INDEX remote-directory-or-url [ local-filename ]
1233           Asks the server to send a listing of the files in the given
1234           server directory. This command is not supported by most Web
1235           servers. Even when it is supported, there is no standard format
1236           for the listing.
1237
1238    HTTP [ switches ] POST [ /MIME-TYPE:type ] source-file
1239           remote-path-or-url [ result-file ]
1240           Sends data to a process running on the remote host; the result
1241           is usually an HTML file but could be anything. The data to be
1242           posted must be read from a local file (the source-file). If a
1243           result file is specified, Kermit stores the server's response in
1244           it.
1245
1246    HTTP [ switches ] PUT [ MIME-TYPE:type ] local-file [
1247           remote-file-or-url [ result-file ] ]
1248           Uploads a local file to the server. Only the name of a single
1249           file can be given; wildcards (and group transfers) are not
1250           supported by HTTP protocol. If no remote filename is given, the
1251           file is sent with the same name as the local file, but with any
1252           pathname stripped.
1253
1254    HTTP [ switches ] DELETE remote-file-or-url [ local-result-file ]
1255           Asks the server to delete the specified single file. If a result
1256           file is specified, it will contain any response data returned by
1257           the server.
1258
1259    Note the limitations of HTTP protocol compared to (say) FTP or Kermit.
1260    There is no command for changing directories, no standard way to get
1261    file or directory lists, no way to transfer file groups by using
1262    wildcard notation, etc, and therefore no good way to (say) fetch all
1263    pages, descend through subdirectories, perform automatic updates, etc.
1264    There is no assurance a connection will stay open and, as noted, there
1265    is no provision for data conversion between unlike platforms. The
1266    data's MIME headers can be used for postprocessing.
1267
1268 2.2.3. HTTP Headers
1269
1270    Each HTTP request and response contains a set of name/value pairs
1271    called headers. HTTP headers are specified in [189]RFC 2616. For
1272    example, an HTTP GET request for /index.html on www.columbia.edu
1273    contains the following headers:
1274
1275   GET /index.html HTTP/1.1
1276   Host: www.columbia.edu:80
1277   User-agent: C-Kermit 8.0
1278   Authorization: Basic base64-encoded-username-password
1279
1280    These might be followed by any others specified with a /HEADERS:
1281    switch:
1282
1283   Accept: image/gif, image/x-xbitmap, image/jpeg, *.*
1284   Accept-Encoding: gzip
1285   Accept-Language: en
1286   Accept-Charset: iso-8859-1,utf-8
1287   Cookie: cookie-data
1288
1289    The server sends back a short report about the file prior to sending
1290    the file contents. Example:
1291
1292   HTTP/1.1 200 OK
1293   Date: Fri, 24 Aug 2001 21:09:39 GMT
1294   Server: Apache/1.3.4 (Unix)
1295   Last-Modified: Mon, 06 Aug 2001 21:16:13 GMT
1296   ETag: "1fa137-10d7-3b6f091d"
1297   Accept-Ranges: bytes
1298   Content-Length: 4311
1299   Content-Type: text/html
1300
1301    If you want to have this information available to a Kermit script you
1302    can use the /ARRAY switch to have Kermit put it in array, one line per
1303    array element. Example:
1304
1305   set exit warning off
1306   http open www.columbia.edu
1307   if fail exit 1 Can't reach server
1308   http /array:&a get /index.html
1309   if fail exit 1 Can't get file
1310   echo Header lines: \fdim(&a)
1311   for \%i 1 \fdim(&a) 1 {
1312       echo \%i. \&a[\%i]
1313   }
1314
1315    Note that the "Date:" item is the current date and time; the
1316    "Last-Modified:" item is the file's modification date and time. An
1317    example showing how to use this information is presented in
1318    [190]Section 8.13.7.
1319
1320 2.2.4. Secure HTTP Connections
1321
1322    SSL/TLS (Secure Sockets Layer / Transport Layer Security) is the
1323    protocol used to secure HTTP, SMTP, and other Internet applications.
1324    See the [191]C-Kermit Reference Section 5.4 for an introduction to
1325    SSL/TLS. To make a secure HTTP connection, you need:
1326
1327     1. A secure client (a version of C-Kermit or Kermit 95 with SSL/TLS
1328        security built in). Type "check ssl" at the Kermit prompt to make
1329        sure you have it.
1330     2. A secure server to connect to.
1331     3. The CA Root Certificate used to authenticate the server to the
1332        client. (see [192]Section 15 of the security reference for an
1333        introduction to certificates).
1334
1335    And you must make a connection to the secure HTTP port: service name
1336    HTTPS, port number 443 (as opposed to service HTTP, port 80). You can
1337    also make secure connections to other ports by including the /TLS or
1338    /SSL switch with the HTTP OPEN command, if the host supports SSL/TLS on
1339    the given port:
1340
1341    The quality of the SSL/TLS connection depends on the cipher suite.
1342    There are several possibilities:
1343
1344    Anonymous cipher suite:
1345           If an anonymous cipher suite is negotiated, the connection is
1346           encrypted but there is no authentication. This connection is
1347           subject to a Man-In-The-Middle (MITM) attack.
1348
1349    X.509 certificate on the server:
1350           When you connect to certain secure servers, an X.509 certificate
1351           is returned. This certificate is issued to a special hostname,
1352           something like www1.xyzcorp.com or wwws.xyzcorp.com (rather than
1353           the normal www.xyzcorp.com). It is signed by the host's
1354           Certificate Authority (CA). If the host certificate is
1355           configured on the client, it can be used to verify the
1356           certificate received from the server. If the certificate it
1357           verified as authentic, a check is made to ensure it has not
1358           expired and it was issued to the host you were attempting to
1359           connect to. If you had asked to connect to (say) www.xyzcorp.com
1360           but were given a certificate for www1.xyzcorp.com, you would be
1361           prompted for permission to continue.
1362
1363           If the verification succeeded, the connection would be encrypted
1364           with one-way (server-to-client) authentication. This connection
1365           is not subject to a MITM attack.
1366
1367           If a username and password are transmitted over this connection,
1368           they are not subject to interception. However, the standard
1369           risks associated with passing the password to the host for
1370           verification apply; for example, if the host has been
1371           compromised, the password will be compromised.
1372
1373    X.509 client certificate:
1374           If a connection has been established with an X.509 server
1375           certificate, the server can ask the client to send a certificate
1376           of its own. This certificate must be verified against a CA Root
1377           certificate. The certificate itself (or subject info from the
1378           certificate) is used to determine the authorization for the
1379           client, and if successful, the username and password need not be
1380           sent to the server.
1381
1382    Kerberos 5:
1383           Instead of using X.509 certificates, Kerberos 5 can be used to
1384           perform the authentication and key exchange. In this situation,
1385           there is mutual authentication between the client and server.
1386           The Kerberos 5 principal is used by the server to look up the
1387           appropriate authorization data. There is no need to send
1388           username and password.
1389
1390    An HTTP connection is made with the HTTP OPEN command:
1391
1392    HTTP [ switches ] OPEN [ { /SSL, /TLS } ] host [ port ]
1393           If /SSL or /TLS switches are included (these are synonyms), or
1394           if the service is HTTPS or the port is 443, a secure connection
1395           is attempted using the current authentication settings; see HELP
1396           SET AUTHENTICATION for details ([193]Section 6.2 of the security
1397           reference). If the no /SSL or /TLS switch is included but the
1398           port is 443 or the service is HTTPS, a secure connection is
1399           attempted. If an /SSL or /TLS switch is included but a port is
1400           not specified, an SSL/TLS connection is attempted on the default
1401           port (80).
1402
1403    Certificates are covered in the separate [194]Kermit Security Reference
1404    for C-Kermit 8.0. You should let Kermit know to verify certificates
1405    with the SET AUTHENTICATION TLS command. For example:
1406
1407    SET AUTHENTICATION TLS CRL-DIR directory
1408           Specifies a directory that contains certificate revocation files
1409           where each file is named by the hash of the certificate that has
1410           been revoked.
1411
1412    SET AUTHENTICATION TLS CRL-FILE filename
1413           Specifies a file that contains a list of certificate
1414           revocations.
1415
1416    SET AUTHENTICATION TLS VERIFY-DIR directory
1417           Specifies a directory that contains root CA certificate files
1418           used to verify the certificate chains presented by the peer.
1419           Each file is named by a hash of the certificate.
1420
1421    SET AUTHENTICATION TLS VERIFY-FILE filename
1422           Specifies a file that contains root CA certificates to be used
1423           for verifying certificate chains.
1424
1425    SET AUTHENTICATION TLS VERIFY OFF
1426           Tells Kermit not to require a certificate and accept any
1427           certificate that is presented regardless of whether it is valid.
1428
1429    There are many other options; see the security document for details.
1430
1431    Now suppose you need need to fetch the file denoted by the following
1432    URL:
1433
1434   https://myuserid:mypassword@wwws.xyzcorp.com/clients/info/secret.html
1435
1436    Once you have set up the handling of certificates as desired, you can
1437    use the following Kermit commands:
1438
1439   http /user:myuserid /password:mypassword open www1.xyzcorp.com https
1440   if success {
1441       http get /clients/info/secret.html
1442       http close
1443   }
1444
1445    As another example, let's say that you have a web form you need to
1446    populate with three fields: red,white and blue.
1447
1448   <FORM ACTION="http://www.xyzcorp.com/cgi-bin/form.cgi" METHOD="POST">
1449   <INPUT NAME="Red">
1450   <INPUT NAME="White">
1451   <INPUT NAME="Blue">
1452   </FORM>
1453
1454    You can handle this with the HTTP POST command. The data to be posted
1455    is stored in the local file data.txt.
1456
1457   Red=seven stripes&White=six stripes&Blue=fifty stars
1458
1459    and the response from the server will be stored into response.txt.
1460
1461   http open www.xyzcorp.com http
1462   if success {
1463     http /array:c post data.txt /cgi-bin/form.cgi response.txt
1464     http close
1465   }
1466
1467    In this scenario, the Common Gateway Interface (CGI) sends a response
1468    whether it succeeds or fails in a script-dependent manner. The script
1469    can either report success and enclose the response data; or it might
1470    send a 302 Found error which indicates that the "Location:" header
1471    should be used to determine the URL at which the data can be found.
1472
1473 2.2.5. HTTP Variables
1474
1475    \v(http_code)
1476           The HTTP protocol code number of the most recent server reply,
1477           e.g. 404 for "not found".
1478
1479    \v(http_connected)
1480           1 when an HTTP connection is open, 0 when there is no HTTP
1481           connection.
1482
1483    \v(http_host)
1484           If an HTTP connection is open, the hostname:port, e.g.
1485           www.columbia.edu:80; otherwise, empty.
1486
1487    \v(http_message)
1488           Server error message, if any, from most recent HTTP command.
1489
1490    \v(http_security)
1491           A list of the security parameters and values for the current
1492           connection, if any. Empty if the connection is not to a secure
1493           server, or there is no connection.
1494
1495    To display all the HTTP variables at once, type SHOW VAR HTTP:
1496
1497   C-Kermit> http open www.columbia.edu
1498   C-Kermit> http get lkjlkjlkjlkj
1499   C-Kermit> sho var http
1500    \v(http_code) = 404
1501    \v(http_connected) = 1
1502    \v(http_host) = www.columbia.edu:80
1503    \v(http_message) = Not Found
1504    \v(http_security) = NULL
1505   C-Kermit>
1506
1507 2.2.6. The HTTP Command-Line Personality
1508
1509    If you invoke C-Kermit with the name "http" or "https", you can use a
1510    special set of HTTP-specific command-line options. You can do this by
1511    creating a symbolic linke "http" or "https" to the C-Kermit 8.0
1512    executable, or by having a separate copy of it called "http" or
1513    "https". Here's the usage message ("http -h"):
1514
1515   Usage: ./http host [ options... ]
1516    -h             This message.
1517    -d             Debug to debug.log.
1518    -S             Stay (issue command prompt when done).
1519    -Y             Do not execute Kermit initialization file.
1520    -q             Quiet (suppress most messages).
1521    -u name        Username.
1522    -P password    Password.
1523    -g pathname    Get remote pathname.
1524    -p pathname    Put remote pathname.
1525    -H pathname    Head remote pathname.
1526    -l pathname    Local path for -g, -p, and -H.
1527    -z opt[=value] Security options...
1528       cert=file   Client certificate file
1529       certsok     Accept all certificates
1530       key=file    Client private key file
1531       secure      Use SSL
1532       verify=n    0 = none, 1 = peer , 2 = certificate required
1533
1534    The "host" argument is the name of a Web host, e.g. www.columbia.edu.
1535    The action options are -p, -g, and -H. If you give an action option,
1536    Kermit does the action and then exits. If you give a host without an
1537    action option, Kermit makes an HTTP connection to the host and then
1538    gives you the C-Kermit prompt. Here's a simple example that fetches a
1539    publicly readable Web page:
1540
1541   http www.columbia.edu -g kermit/index.html
1542
1543    If you need to accesss a website for which a username and password are
1544    required, you can supply them on the command line with -u and -P. If
1545    you include a username but omit the password, Kermit prompts you for
1546    it:
1547
1548   http www.columbia.edu -u olga -p kermit/index.html -l index.html
1549   Password:
1550
1551    Note that when PUT'ing files to websites, you have to supply both the
1552    -p (remote pathname) and -l (local path) options.
1553
1554    If your version of Kermit is built with SSL/TLS security, you can also
1555    use the -z option to make secure HTTP (https) connections.
1556
1557    Finally, as noted in [195]Section 16, you can also give a URL instead
1558    of a host name and options.
1559
1560    [ [196]Top ] [ [197]Contents ] [ [198]C-Kermit Home ] [ [199]Kermit
1561    Home ]
1562
1563 3. KERMIT'S BUILT-IN FTP CLIENT
1564
1565      3.1.  [200]Making and Managing FTP Connections
1566      3.2.  [201]Making Secure FTP Connections
1567      3.3.  [202]Setting FTP Preferences
1568      3.4.  [203]Managing Directories and Files
1569      3.5.  [204]Uploading Files With FTP
1570      3.6.  [205]Downloading Files With FTP
1571      3.7.  [206]Translating Character Sets
1572      3.8.  [207]FTP Command Shortcuts
1573      3.9.  [208]Dual Sessions
1574      3.10. [209]Automating FTP Sessions
1575      3.11. [210]Advanced FTP Protocol Features
1576
1577    Earlier versions of C-Kermit and K95 included an FTP command, but it
1578    simply invoked an external FTP client. Now, by popular demand, Kermit
1579    includes its own built-in FTP client that offers the following
1580    advantages over traditional FTP clients (and its previous interface to
1581    them):
1582
1583      * Any of Kermit's built-in [211]security methods can be used to
1584        establish and conduct secure FTP sessions with [212]FTP servers
1585        that support these methods. (Security modules can be subject to
1586        export restrictions.)
1587      * Kermit's FTP client uses "passive mode" by default to avoid
1588        blockage by firewalls and network address translators. Of course
1589        active mode can be chosen too when needed.
1590      * [213]Character sets can be translated as part of the transfer
1591        process even when the FTP server does not support character-set
1592        translation, including to/from the new Internet standard
1593        international character set, [214]Unicode UTF-8. This includes both
1594        the file's name and (for text files only) its contents.
1595      * All of C-Kermit's [215]file-selection mechanisms are available:
1596        size, date, name patterns and lists, exception lists, etc.
1597      * [216]Atomic file movement capabilities are provided (delete, move,
1598        or rename files automatically after successful transfer).
1599      * The correct file type, "ascii" (i.e. text) or binary, is chosen
1600        automatically for each file (explained in [217]Section 4), and any
1601        mixture of text and binary files can be sent in a single operation,
1602        even across platforms.
1603      * Update mode ("don't bother transferring files that didn't change
1604        since last time") and recovery (resumption of an interrupted
1605        transfer from the point of failure) are available in both
1606        directions.
1607      * When uploading files from UNIX to UNIX, the file's permissions can
1608        be preserved if desired.
1609      * Recursive directory-tree PUTs are supported between any two
1610        platforms that have tree-structured file systems. Recursive GETs
1611        are supported between like platforms if the server cooperates and
1612        between like or unlike platforms if the server supports MLSD
1613        ([218]Section 3.11).
1614      * When receiving files, all of Kermit's file collision actions are
1615        available: backup, update, refuse, rename, etc.
1616      * Multi-file transfers can be interrupted on a per-file basis,
1617        automatically skipping to the next file.
1618      * FTP sessions are [219]fully scriptable.
1619      * An entire FTP session (connect, login, CD, upload or download,
1620        logout) can be specified on the command line without using a
1621        script.
1622      * All of Kermit's logging options and formats are available to keep
1623        an accurate and complete record of each connection and file
1624        transfer, and to aid in troubleshooting.
1625      * All of Kermit's file-transfer display options are available
1626        (fullscreen, brief, CRT, serial, none).
1627
1628    And best of all:
1629      * Kermit doesn't give you those annoying per-file prompts every time
1630        you start a multi-file transfer without remembering to give a
1631        "prompt" command first :-).
1632
1633    [ [220]Top ] [ [221]FTP Top ] [ [222]FTP Client Overview ] [ [223]FTP
1634    Script Tutorial ] [ [224]C-Kermit Home ] [ [225]Kermit Home ]
1635
1636 3.1. Making and Managing FTP Connections
1637
1638    Each copy of Kermit can have one FTP connection open at a time. FTP
1639    connections are independent of regular terminal connections; a terminal
1640    connection (serial or network via SET LINE, DIAL, SET HOST, TELNET,
1641    etc) may be, but need not be, open at the same time as an FTP
1642    connection, and terminal connections can also be closed, and new
1643    connections opened, without interfering with the FTP connection (and
1644    vice versa). Thus, for example, Kermit can have an FTP connection and a
1645    TELNET connection open to the same host simultaneously, using the
1646    TELNET connection (e.g.) to send mail or take other desired actions as
1647    various FTP actions complete. Of course, each copy of Kermit can do
1648    only one thing at a time, so it can't (for example) transfer a file
1649    with FTP and another file with Kermit protocol simultaneously.
1650
1651    A Kermit FTP session can be established by [226]command-line options,
1652    by [227]URL, or by [228]interactive commands.
1653
1654 3.1.1. Kermit Command-Line Options for FTP
1655
1656    The new command-line option '-9' (sorry, we're out of letters) can be
1657    used when starting C-Kermit, telling it to make an FTP connection:
1658
1659   kermit -9 hostname
1660
1661    or if a non-default FTP port is needed:
1662
1663   kermit -9 hostname:port
1664
1665    You can also specify the username on the command line with the -M ("My
1666    User ID") option that was already there for other connection types:
1667
1668   kermit -9 hostname -M olga
1669
1670    If you specify the username on the command line, Kermit uses it when
1671    making the connection and does not prompt you for it (but it does
1672    prompt you for the password if one is required).
1673
1674    Once the connection is made, you get the regular Kermit prompt, and can
1675    give interactive commands such as the ones described below. When you
1676    give a BYE command, Kermit closes the session and exits, just as a
1677    regular FTP client would do. If you don't want Kermit to exit when you
1678    give a BYE command, include the -S ("Stay") option on the command line.
1679
1680    Other Kermit command-line options that are not specific to non-FTP
1681    connections should affect the FTP session in the expected ways; for
1682    example, -i and -T force binary and text mode transfers, respectively.
1683
1684    File transfers can not be initiated on the "kermit -9" command line;
1685    for that you need to use Kermit's FTP personality (next section) or you
1686    can use URLs ([229]Section 3.1.3).
1687
1688 3.1.2. The FTP Command-Line Personality
1689
1690    If you want to replace your regular FTP client with C-Kermit, you can
1691    make a link called "ftp" to the C-Kermit binary (or you can store a
1692    copy of the C-Kermit binary under the name "ftp"). When C-Kermit is
1693    invoked with a program name of "ftp" (or "FTP", case doesn't matter),
1694    it assumes the command-line personality of the regular FTP client:
1695
1696   ftp [ options ] hostname [ port ]
1697
1698    In this case the options are like those of a regular FTP client:
1699
1700   -d  Debug: enables debug messages and creates a debug.log file.
1701   -n  No autologin: Kermit should not send your user ID automatically.
1702   -t  Packet trace: accepted but is treated the same as -d.
1703   -v  Verbose: accepted but ignored (operation is verbose by default).
1704   -i  Not interactive: accepted but ignored.
1705
1706    and the hostname can also be a URL (explained in [230]Section 3.1.3).
1707    To specify a non-default TCP port for the FTP server, include the port
1708    number or name after the hostname.
1709
1710    There are also some bonus options that allow you to execute an entire
1711    FTP session from the shell command line, as long as you don't include
1712    the -n option. These are not available with regular FTP clients, and at
1713    least one of these options (-g) conflicts with UNIX ftp (where -g means
1714    "no globbing", which does not apply to Kermit), and some of them (like
1715    the options above) also conflict with regular Kermit command-line
1716    options:
1717
1718   -m mode      = "passive" (default) or "active"
1719   -Y            Don't execute the Kermit initialization file [1]
1720   -q            Quiet, suppresses all but error messages [1]
1721   -S            Stay, don't exit automatically [1]
1722   -A            Autologin anonymously [2]
1723   -u name       Username for autologin [2] (synonym: -M [1])
1724   -P password   Password for autologin (see cautions below) [2]
1725   -D directory  cd after autologin [2]
1726   -b            Binary mode [2]
1727   -a            Text ("ascii") mode [2] (synonym: -T [1])
1728   -R            Recursive (works with -p) [4]
1729   -p files      Files to put (upload) after autologin [2] (synonym: -s [1])
1730   -g files      Files to get (download) after autologin [3]
1731
1732    [1] Same as Kermit, not available in regular FTP clients.
1733    [2] Conflicts with Kermit, not available in regular FTP clients.
1734    [3] Same as Kermit, conflicts with regular FTP clients.
1735    [4] Conflicts with Kermit, available in some FTP clients.
1736
1737    Fancier options such as restart, character-set translation, filename
1738    collision selection, automatic move/rename/delete, etc, are not
1739    available from the command line; for these you can use the commands
1740    described in the following sections. The -R option might also work with
1741    -g (GET) but that depends on the server.
1742
1743    The following security options are also available, explained in
1744    [231]Section 3.2:
1745
1746   -k realm      Kerberos 4 realm [4]
1747   -f            Kerberos 5 credentials forwarding [4]
1748   -x            autoencryption mode [4]
1749   -c cipher     SRP cipher type [4]
1750   -H hash       SRP encryption hash [4]
1751   -z option     Security options [4]
1752
1753    If you include -A or specify a name of "anonymous" or "ftp", you are
1754    logged in anonymously and, in the absence of -P, Kermit automatically
1755    supplies a password of "user@host", where "user" is your local user ID,
1756    and "host" is the hostname of the computer where Kermit is running. If
1757    you do not include -p or -g, Kermit enters command mode so you can type
1758    commands or execute them from a script.
1759
1760    If you include -p or -g, Kermit attempts to transfer the specified
1761    files and then exits automatically at the end of the transfer unless
1762    you also included -S (Stay). It uses the "brief" file transfer display
1763    (one line per file) unless you include the -q option to suppress it.
1764
1765    When uploading files with -p, Kermit switches automatically between
1766    text and binary mode for each file.
1767
1768    When downloading, you can either specify a particular mode (text or
1769    binary) to be used for all the files, or you can let Kermit select the
1770    type for each file automatically, based on its name (see [232]Sections
1771    3.5 and [233]3.6 for greater detail). In UNIX be sure to quote any
1772    wildcard characters to prevent the shell from expanding them, as shown
1773    in the examples just below. Filename collisions are handled according
1774    Kermit's FILE COLLISION setting (if specified in your Kermit
1775    customization file; otherwise the default, which is BACKUP).
1776
1777    It should go without saying that the -P option should be used with
1778    caution. In addition to the well-known risks of transmitting plaintext
1779    passwords over the Internet, in this case the password also echos to
1780    the screen if you type it, and can be seen in ps and w listings that
1781    show the user's currently active command and command-line arguments.
1782    Thus command-line FTP sessions are most appropriate for secure or
1783    anonymous connections (those that do not require passwords).
1784
1785    Here's an example in which you download the latest C-Kermit "tarball"
1786    from the Columbia University FTP archive:
1787
1788   ftp -A kermit.columbia.edu -bg kermit/archives/ckermit.tar.gz
1789
1790    This assumes that "ftp" is a symbolic link to C-Kermit. It logs you in
1791    anonymously and gets the ckermit.tar.gz file in binary mode from the
1792    kermit/archives directory.
1793
1794    Here's a slightly more ambitious example that illustrates CD'ing to the
1795    desired server directory to get a group of files in text mode (in this
1796    case the C-Kermit source files):
1797
1798   ftp -A kermit.columbia.edu -D kermit/f -ag "ck[cuw]*.[cwh]" makefile
1799
1800    In this case we CD to the kermit/f directory so we don't have to
1801    include it in each file specification, and we quote the ck[cuw]*.[cwh]
1802    specification so the shell doesn't expand it, since we have to pass it
1803    as-is to the server. Note also that the quotes don't go around the
1804    entire file list; only around each file specification that needs to be
1805    quoted.
1806
1807    Here's one more example, that uploads a debug log file in binary mode
1808    to the Kermit incoming directory (as we might ask you to do when
1809    following up on a problem report):
1810
1811   ftp -A kermit.columbia.edu -D kermit/incoming -bp debug.log
1812
1813    In this case the -D option is required to tell the server where to put
1814    the incoming file.
1815
1816    Unless the -Y option is included, your Kermit initialization file
1817    (.mykermrc in UNIX, K95.INI in Windows) is executed before the command
1818    line options, so you can set any FTP-related preferences there, as
1819    described in the subsequent sections.
1820
1821 3.1.3. The FTP URL Interpreter
1822
1823    If Kermit is invoked with either its regular personality (as "kermit")
1824           or its FTP personality (as "ftp"), you can also give a URL
1825           (Universal Resource Locator) instead of a hostname and options,
1826           with or without a username and password:
1827           ftp ftp://user:password@host/path
1828           ftp ftp://user@host/path
1829           ftp ftp://@host/path   (or ftp://:@host/path)
1830           ftp ftp://host/path
1831           kermit ftp://host/path
1832
1833    If the FTP personality is used, the service must be "ftp". In all
1834    cases, a hostname or address must be included. If a user is included
1835    but no password, you are prompted for the password. If a path
1836    (filename) is included:
1837      * If "@" is included without a user, Kermit prompts for the username
1838        and password.
1839      * If no user and no "@" are included, "anonymous" is used.
1840      * GET is assumed.
1841
1842    If no path (and no action options) are included, an interactive FTP
1843           session is started, as in this example:
1844           ftp ftp://kermit.columbia.edu
1845
1846    If a path is included, but a username is not included, "anonymous" is
1847    used and an appropriate user@host password is supplied automatically.
1848    If authentication is successful, Kermit attempts to GET the file
1849    indicated by the path or, if the path is the name of a directory, it
1850    asks the server for a directory listing. In both cases, Kermit
1851    disconnects from the server and exits after the operation is complete
1852    (unless you have included the -S option on the command line).
1853
1854    Here's an example that gets a listing of the Kermit directory at the
1855           Kermit ftp site:
1856           ftp ftp://kermit.columbia.edu/kermit/
1857
1858    This example gets the top-level READ.ME file from the same directory:
1859           ftp ftp://kermit.columbia.edu/kermit/READ.ME
1860
1861    Here's the same example, but requesting a text-mode transfer:
1862           ftp -T ftp://kermit.columbia.edu/kermit/READ.ME
1863           This illustrates that you can mix command-line options and URLs
1864           if you desire.
1865
1866    Here's an example that logs in as a (fictitious) real user to get a
1867           file:
1868           ftp ftp://olga@ftp.xyzcorp.com/resume.txt
1869           The password is not included, so Kermit prompts for it.
1870
1871    This scheme allows Kermit to be used as the FTP helper of other
1872    applications, such as Web browsers, with all its advantages over other
1873    FTP clients (especially the ones that are built in to most Web
1874    browsers), e.g. that it can be given wildcards, and it can pick text
1875    and binary mode automatically for each file.
1876
1877    HINT: suppose somebody sends you an FTP URL in email, or you see it in
1878    some text. If your terminal screen supports copy/paste, copy the url,
1879    and then at the shell prompt type "kermit", a space, and then paste the
1880    URL, e.g.:
1881
1882   $ kermit ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty1.1.27-O
1883
1884    "$ is the shell prompt; the part you type is underlined, the rest is
1885    pasted in. Kermit does the rest.
1886
1887 3.1.4. Interactive FTP Session Establishment
1888
1889    As you read this and the following sections, bear in mind that any
1890    command that can be given at the prompt can also be used in a script
1891    program. Kermit's script programming language is the same as its
1892    interactive command language. [234]CLICK HERE if you would like to
1893    learn a bit more about script writing.
1894
1895    An FTP session is established with the FTP OPEN command:
1896
1897    FTP [ OPEN ] [ { /SSL, /TLS } ] hostname [ switches ] [ port ]
1898           Opens an FTP connection to the given host on the given port and,
1899           if FTP AUTOLOGIN is ON, also logs you in to the server,
1900           prompting for username and password if necessary. If no port is
1901           specified, the regular FTP protocol port (21) is used. The OPEN
1902           keyword is optional (unless the hostname conflicts with one of
1903           the FTP command keywords, which you can list by typing "ftp ?").
1904
1905    The hostname can be an IP host name, numeric IP address, or if you have
1906    a network directory active (SET NETWORK DIRECTORY; see Chapter 6 of
1907    [235]Using C-Kermit), an entry name in the directory. In the latter
1908    case, if the given hostname matches exactly one entry, the associated
1909    name or address is used; if it matches more than one, Kermit cycles
1910    through them until one is found that can be opened; if it matches none,
1911    then the hostname is used as-is. If a directory is active but you want
1912    to bypass directory lookup, include an "=" sign at the beginning of the
1913    hostname, and/or use a numeric IP address.
1914
1915    When an FTP connection is opened, the default file-transfer mode is set
1916    to binary if the client and server platforms are alike (e.g. both of
1917    them are some kind of UNIX), and to text ("ascii") if they are not
1918    alike. This has no particular effect for uploading since Kermit
1919    automatically switches between text and binary mode for each file, but
1920    might be important for downloading. The connection is also set to
1921    Stream mode and File structure. Record- or page-oriented file transfers
1922    are not supported by C-Kermit's FTP client.
1923
1924    The optional FTP OPEN switches are:
1925
1926    /ANONYMOUS
1927           Logs you in anonymously, automatically supplying username
1928           "anonymous" and user@host as the password, based on your local
1929           user and host names.
1930
1931    /NOLOGIN
1932
1933           Overrides SET FTP AUTOLOGIN ON for this connection only.
1934
1935    /USER:name
1936           Uses the given username to log you in, thus avoiding the Name:
1937           prompt.
1938           Overrides SET FTP AUTOLOGIN OFF for this connection only.
1939
1940    /PASSWORD:text
1941           Uses the given text as your password, thus avoiding the
1942           Password: prompt. This switch is not recommended for use in
1943           script files, which would be a security risk.
1944
1945    /ACCOUNT:text
1946           Uses the given text as your account (or secondary password,
1947           depending on the requirements of the server; most servers do not
1948           require or accept an account name). If an account is not
1949           supplied, you are not prompted for one.
1950
1951    /PASSIVE
1952           Opens the connection in passive mode. Passive mode is the
1953           default in Kermit's FTP client, unlike in most others, since it
1954           works better through firewalls. The /PASSIVE and /ACTIVE
1955           switches apply only to the connection that is being opened, and
1956           do not affect the global FTP PASSIVE-MODE setting.
1957
1958    /ACTIVE
1959           Opens the connection in active mode. Use this switch if the
1960           server does not support passive mode, or use the command SET FTP
1961           PASSIVE-MODE OFF.
1962
1963    /NOINIT
1964           Added in C-Kermit 8.0.201.   Tells C-Kermit not to send REST,
1965           STRU, FEAT, and MODE commands to the server when the connection
1966           is opened, since these have been reported to cause confusion in
1967           certain servers.
1968
1969    When a username or password is missing, a prompt is issued at the
1970    controlling terminal and you must type the response; the response can
1971    not be scripted. Use the switches to avoid prompts, or one of the
1972    secure authentication methods described in the next section, or see
1973    [236]SET FTP AUTOLOGIN and the [237]FTP USER and similar commands
1974    described later in this section.
1975
1976    Examples:
1977
1978   ftp open kermit.columbia.edu /anonymous  ; Open and log in anonymously
1979   ftp kermit.columbia.edu /anonymous       ; The OPEN keyword can be omitted
1980   ftp xyzcorp.com                          ; Open and maybe prompt for username
1981   ftp xyzcorp.com /user:olga               ; Open and log in as olga
1982   ftp testing.abccorp.com 449              ; Specify a special TCP port number
1983   ftp testing.abccorp.com /user:olaf /password:secret 449
1984
1985    The FTP OPEN command succeeds if a connection was opened to the server
1986    (even if the given username and password were not valid) and fails
1987    otherwise (see [238]Section 3.8 for details).
1988
1989    When your FTP session is complete, you can terminate it as follows:
1990
1991    FTP BYE
1992           Closes the FTP connection if one was open. The FTP prefix can be
1993           omitted if no other connection is open at the same time (see
1994           [239]Section 3.8 for details). If a connection log is active, an
1995           FTP record is written to it. If Kermit was started with the -9
1996           command-line option or with its FTP command-line personality,
1997           and the -S (Stay) option was not given, AND there is no other
1998           active connection, the FTP BYE command also exits, just as it
1999           does on a regular FTP client. Synonyms: FTP CLOSE, FTP QUIT (but
2000           if the FTP prefix is omitted from QUIT, this becomes the regular
2001           Kermit QUIT command, which is equivalent to EXIT; i.e. it closes
2002           the connection and exits from Kermit).
2003
2004    The following commands can be used to achieve greater control over the
2005    connection and login process:
2006
2007    SET FTP ANONYMOUS-PASSWORD text
2008           Allows you to choose the password text to be sent automatically
2009           by Kermit when you open an FTP connection with the /ANONYMOUS
2010           switch.
2011
2012    SET FTP AUTOLOGIN { ON, OFF }
2013           If you give this command prior to opening an FTP connection, it
2014           controls whether Kermit tries to log you in automatically as
2015           part of the connection process. Normally ON, which means the
2016           username and password are sent automatically (and prompted for
2017           if they are not yet known). When OFF, FTP OPEN connects to the
2018           server without logging in. OFF is equivalent to the -n
2019           command-line option when using Kermit's FTP command-line
2020           personality.
2021
2022    FTP USER name [ password [ account ] ]
2023           Used to log in to an FTP server to which a connection has been
2024           made without autologin, or when autologin failed. If the
2025           password is furnished on the command line, it is used; otherwise
2026           you are prompted for a password. An account may also be
2027           furnished if required by the server; it is not required by
2028           Kermit and is not prompted for if omitted. Synonyms: USER, FTP
2029           LOGIN.
2030
2031    FTP ACCOUNT text
2032           Sends an account name to a server that supports accounts. If the
2033           server does not support accounts, an error response occurs. If
2034           the server does support accounts, the account is accepted if it
2035           is valid and rejected if it is not. The account might be used
2036           for charging purposes or it might be a secondary password, or it
2037           might be used for any other purpose, such as an accesss password
2038           for a particular disk. Servers that support accounts might or
2039           might not allow or require the account to be sent prior to
2040           login; usually it is sent after login, if at all. Synonym:
2041           ACCOUNT.
2042
2043    Example:
2044
2045 set ftp autologin off                  ; One thing at a time please
2046 ftp xyzcorp.com                        ; Try to make the connection
2047 if fail exit 1 FTP connection failed   ; Check that it was made
2048 ftp user olga secret                   ; Now log in to the server
2049 if fail exit 1 FTP login failed        ; Check that it worked
2050 ftp account 103896854                  ; Login OK - send account
2051 if fail echo WARNING - FTP ACCT failed ; Warn if problem
2052 ...                                    ; (have session here)
2053 bye                                    ; Log out and disconnect
2054
2055    The following commands are used to control or get information about the
2056    FTP connection. Any particular FTP server does not necessarily support
2057    all of them.
2058
2059    FTP RESET
2060           Terminates a user session but leaves the connection open,
2061           allowing a new login via FTP USER.
2062
2063    FTP IDLE [ number ]
2064           Most FTP servers automatically log you out and and disconnect
2065           your session if there has been no activity for a certain amount
2066           of time. Use this command to ask the server to set its idle
2067           limit to the given number of seconds. Omit the number to ask the
2068           server to inform you of its current idle limit.
2069
2070    FTP STATUS [ filename ]
2071           Asks the FTP server to send information about the current
2072           session. The result is a free-format report that might include
2073           server identification, username and login time, FTP protocol
2074           settings, and file-transfer statistics. If a filename is given,
2075           the server is supposed to send detailed information about the
2076           file.
2077
2078    FTP SYSTEM
2079           Asks the FTP server to identify its operating system (Listed in
2080           Internet Assigned Numbers, Operating System Names). Examples:
2081           UNIX, VMS, VM/CMS, WINDOWS-NT. Unfortunately many variations are
2082           allowed (e.g. LINUX-2.0, LINUX-2.2, FREEBSD, ULTRIX, etc,
2083           instead of UNIX; WINDOWS-NT-3, WINDOWS-NT-3.5, WINDOWS-NT-3.51,
2084           WINDOWS-NT-4, etc). The report might also include other
2085           information like "Type L8", "Type I", or "Type A", indicating
2086           the file-transfer mode.
2087
2088    FTP HELP [ keyword [ keyword [ ... ] ]
2089           Asks the server to list the commands it supports. The response
2090           is usually cryptic, listing FTP command mnemonics, not the
2091           commands used by the client (since the server has no way of
2092           knowing anything about the client's user interface). For
2093           example, the PUT command is STOR in FTP protocol. If a keyword
2094           is given, which should be an FTP protocol command,
2095           slightly-more- detailed help is given about the corresponding
2096           command (if the FTP server supports this feature). Examples:
2097           "ftp help", "ftp help stor".
2098
2099    FTP SITE text
2100           (Advanced) Sends an FTP SITE (site-specific) command. Usually
2101           this means that the FTP server is asked to run an external
2102           command with the given arguments. You might be able to find out
2103           what SITE commands are available by sending "ftp help site" to
2104           the server, but in general the availability of and response to
2105           SITE commands is (not surprisingly) site specific.
2106
2107    FTP QUOTE text
2108           (Advanced) Sends an FTP command in FTP protocol format. Use this
2109           command to send commands to the server that the FTP client might
2110           not know about.
2111
2112    SHOW FTP
2113           Lists client (Kermit) FTP settings and information. Also SHOW
2114           CONNECTION, SHOW COMMUNICATIONS.
2115
2116    HELP FTP [ keyword ]
2117           Asks Kermit to list and describe its built-in FTP commands.
2118
2119    HELP SET FTP [ keyword ]
2120           Asks Kermit to list and describe its built-in SET FTP commands.
2121
2122    [ [240]Top ] [ [241]FTP Top ] [ [242]C-Kermit Home ] [ [243]Kermit Home
2123    ]
2124
2125 3.2. Making Secure FTP Connections
2126
2127    Also see: [244]Accessing IBM Information Exchange with Kermit.
2128
2129    In the previous section, you can see several examples of traditional
2130    insecure authentication: username and password sent across the network
2131    in clear text. Of course this is bad practice on at least two counts:
2132    (1) storing passwords in files (such as script files) gives accesss to
2133    the target systems to anybody who can obtain read accesss to your
2134    scripts; and (2) sending this information over the network leaves it
2135    open to interception by network sniffers or compromised hosts.
2136
2137    Because of the increasing need for security on the Internet, FTP
2138    servers are beginning to appear that offer secure forms of
2139    authentication, in which no information is sent over the network that
2140    would allow anyone who intercepts it to usurp your identity and gain
2141    your accesss rights.
2142
2143    Kermit provides an equivalent form of FTP security for each type of
2144    IETF standard security implemented in Telnet. These include
2145    GSSAPI-KERBEROS5, KERBEROS4, Secure Remote Password (SRP), and
2146    Transport Layer Security (SSL and TLS). It does not presently include
2147    SSL tunneling nor any form of SSH v1 or v2. When Kermit is built with
2148    the necessary libraries, secure FTP connections are attempted by
2149    default, in which all connections are authenticated and the command and
2150    data channels are private.
2151
2152    The use of authentication and encryption for FTP connections can be
2153    adjusted with the commands listed below, which are available only if
2154    your version of Kermit was built with the corresponding security
2155    options and libraries:
2156
2157    SET FTP AUTHTYPE { AUTOMATIC, GSSAPI-KRB5, KERBEROS4, SRP, SSL, TLS }
2158           Specifies an ordered list of authentication methods to be
2159           attempted when AUTOAUTHENTICATION is ON. The default list is:
2160           GSSAPI-KRB5, SRP, KERBEROS_V4, TLS, SSL. If none of the selected
2161           methods are supported by the server, an insecure login is used
2162           as a fallback. Note, by the way, that SSL or TLS can be used to
2163           secure an anonymous connection.
2164
2165    SET FTP AUTOAUTHENTICATION { ON, OFF }
2166           Tells whether authentication should be negotiated by the FTP
2167           OPEN command. Default is ON. Use SET FTP AUTOAUTHENTICATION OFF
2168           to force a clear-text, unencrypted connection to FTP servers
2169           (such as the one at the Kermit FTP site) that normally would try
2170           to negotiate secure authentication and encryption.
2171
2172    SET FTP AUTOENCRYPTION { ON, OFF }
2173           Tells whether encryption (privacy) should be negotiated by the
2174           FTP OPEN command, which can happen only if secure authentication
2175           is also negotiated. Default is ON.
2176
2177    SET FTP AUTOLOGIN { ON, OFF }
2178           Tells Kermit whether to try logging in automatically when you
2179           make an FTP connection, as opposed to letting you do it "by
2180           hand" with the FTP USER command.
2181
2182    SET FTP COMMAND-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE }
2183           Determines the level of protection applied to the command
2184           channel:
2185
2186   CLEAR         Data is sent in plaintext and not protected against tampering.
2187   CONFIDENTIAL  Data is encrypted but not protected against tampering.
2188   PRIVATE       Data is encrypted and is protected against tampering.
2189   SAFE          Data is sent in plaintext but protected against tampering.
2190
2191           The default is PRIVATE.
2192
2193    SET FTP CREDENTIAL-FORWARDING { ON, OFF }
2194           Tells whether end-user credentials are to be forwarded to the
2195           server if supported by the authentication method (GSSAPI-KRB5
2196           only). This is often required to allow accesss to distributed
2197           file systems (e.g. AFS.)
2198
2199    SET FTP DATA-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE }
2200           Tells what level of protection is applied to subsequent data
2201           channels. The meanings of the protection-level keywords are the
2202           same as for SET FTP COMMAND-PROTECTION-LEVEL. The default is
2203           PRIVATE.
2204
2205    SET FTP SRP CIPHER name
2206           Specifies the cipher to be used for encryption when SRP
2207           authentication is in use. The list of possible choices is
2208           computed based on the capabilities of the local SRP library and
2209           includes NONE plus zero or more of the following:
2210
2211   BLOWFISH_ECB        CAST5_ECB          DES_ECB          DES3_ECB
2212   BLOWFISH_CBC        CAST5_CBC          DES_CBC          DES3_CBC
2213   BLOWFISH_CFB64      CAST5_CFB64        DES_CFB64        DES3_CFB64
2214   BLOWFISH_OFB64      CAST5_OFB64        DES_OFB64        DES3_OFB64
2215
2216           The default is DES3_ECB.
2217
2218    SET FTP SRP HASH name
2219           Specifies the hash to be used for data protection when SRP
2220           authentication is in use. The choices are MD5 and SHA. The
2221           default is SHA.
2222
2223    Command-line options:
2224
2225    -k name
2226           Specifies the realm to be used with Kerberos 4 authentication (=
2227           SET AUTH K4 REALM name).
2228
2229    -f
2230           Enables forwarding of Kerberos 5 credentials to the host when
2231           using GSSAPI authentication (= SET AUTH K5 FORWARDABLE ON).
2232
2233    -x
2234           Enables autoencryption (= SET FTP AUTOENCRYPTION ON).
2235
2236    -c cipher
2237           Specifies the kind of cipher to be used for encryption with SRP
2238           authentication. Equivalent to SET FTP SRP CIPHER, with the same
2239           choices. If this option is not given, CAST5_CBC is used.
2240
2241    -H hash
2242           Specifies the hash to be used for encryption with SRP
2243           authentication. Equivalent to SET FTP SRP HASH, with the same
2244           choices. If this option is not given, SHA is used.
2245
2246    -z debug
2247           Turns on SSL/TLS debugging.
2248
2249    -z secure
2250           Requires secure connection.
2251
2252    -z certsok
2253           Says to accept all certificates without checking validity.
2254
2255    -z verify=n
2256           Sets certificate verification mode to the given number, n:
2257             0 = no verification
2258             1 = verify certificate if presented
2259             2 = require verification of certificate
2260
2261    -z cert=filename
2262           Specifies a file containing a client certificate to be presented
2263           to the FTP server.
2264
2265    -z key=filename
2266           Specifies a file containing a private key matching the client
2267           certificate.
2268
2269    -z !krb4
2270           (nokrb4) Disables the use of Kerberos 4.
2271
2272    -z !gss
2273    -z nogss
2274           Disables the use of GSSAPI - Kerberos 5.
2275
2276    -z !srp
2277    -z nosrp
2278           Disables use of SRP.
2279
2280    -z !ssl
2281    -z nossl
2282           Disables the use of SSL.
2283
2284    -z !tls
2285    -z notls
2286           Disables the use of TLS.
2287
2288    Caution: If your FTP connection is secured via AUTH TLS, it is not
2289    possible to interrupt a file transfer. This is a limitation of all
2290    known FTP servers that support AUTH TLS.
2291
2292    Note that when using certain security methods, such as SSL or TLS, you
2293    may be prompted to confirm or verify certain actions or conditions, for
2294    example, whether to accept self-signed certificates. This can interfere
2295    with unattended operation of scripts; see [245]Section 3.10.
2296
2297    [ [246]Top ] [ [247]FTP Top ] [ [248]C-Kermit Home ] [ [249]Kermit Home
2298    ]
2299
2300 3.3. Setting FTP Preferences
2301
2302    FTP preferences can be set globally and persistently with the commands
2303    in the following sections; many of these can also be overridden on a
2304    per-command basis with switches that have the same name.
2305
2306 3.3.1. Logs, Messages, and Other Feedback
2307
2308    You can control the amount of feedback received from your FTP session
2309    with the commands in this section. First, you can create a log of your
2310    FTP transfers with the following commands:
2311
2312    SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF }
2313           Selects the log format. VERBOSE is the default, and is described
2314           in [250]the manual. FTP chooses a WU-FTPD format, the same as is
2315           used by the popular FTP server. BRIEF creates per-file records
2316           in comma-separated-list format. For greater detail, see
2317           [251]Section 4.17 of the [252]C-Kermit 7.0 Update Notes.
2318
2319    LOG TRANSACTIONS filename
2320           Records FTP (or Kermit, or any other protocol) uploads and
2321           downloads in the given file using the format selected by the
2322           most recent SET TRANSACTION-LOG command, if any, or else the
2323           default format.
2324
2325    FTP screen messages and displays are controlled by the following
2326    commands:
2327
2328    SET TRANSFER DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
2329           FTP transfers use Kermit's normal file-transfer display styles.
2330           Use this command to choose the desired format; the default on
2331           most platforms is FULLSCREEN. The display is automatically
2332           disabled if Kermit is running in the background or in batch.
2333           BRIEF is always used for command-line initiated transfers
2334           (unless suppressed by -q). While a file-transfer is in progress,
2335           you can interrupt it in the normal Kermit way by typing one of
2336           the following keys or key combinations:
2337             X - Cancel current file but go on to the next one (if any).
2338             Z - Cancel the entire transfer.   Ctrl-L or Ctrl-W - Refresh
2339           the file-transfer display (if any).
2340
2341    SET FTP DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
2342           Like SET TRANSFER DISPLAY, but applies only to FTP connections,
2343           and does not affect Kermit- or other protocol file transfers.
2344
2345    SET QUIET { ON, OFF }
2346           This command applies to Kermit in general, not just FTP. OFF by
2347           default; when ON, it surpresses most messages from most commands
2348           as well as the file-transfer display.
2349
2350    SET FTP PROGRESS-MESSAGES { ON, OFF }
2351           Tells whether Kermit should print locally-generated feedback
2352           messages for each non-file-transfer command. ON by default.
2353
2354    SET FTP VERBOSE-MODE { ON, OFF }
2355           Tells whether to display all responses from the FTP server. OFF
2356           by default. This shows all responses to all commands, except
2357           when the file-transfer display is active, and unless you have
2358           SET QUIET ON. When OFF, responses are shown only for commands
2359           such as FTP PWD whose purpose is to display a response.
2360
2361    SET FTP DEBUG { ON, OFF }
2362           Tells whether local client debugging information should be
2363           displayed. OFF by default. When ON, the commands that are sent
2364           to the server are shown, as well as its responses (even if
2365           VERBOSE-MODE is OFF), plus additional informational messages are
2366           printed regarding the progress of secure operations. Also, the
2367           temporary file created by the [253]MGET command is not deleted
2368           so you can see what's in it.
2369
2370    Set all of these to OFF when silent running is desired.
2371
2372 3.3.2. Operational Preferences
2373
2374    FTP DISABLE new-protocol-feature-name
2375    FTP ENABLE new-protocol-feature-name
2376           Explained in [254]Section 3.11.
2377
2378    SET FTP AUTOLOGIN { ON, OFF }
2379           If you give this command prior to opening an FTP connection, it
2380           controls whether Kermit tries to log you in automatically as
2381           part of the connection process. Normally ON, which means the
2382           username and password are sent automatically (and prompted for
2383           if they are not yet known). When OFF, FTP OPEN connects to the
2384           server without logging in. OFF is equivalent to the -n
2385           command-line option when using Kermit's FTP command-line
2386           personality. See [255]Section 3.1.4 for usage.
2387
2388    SET FTP PASSIVE-MODE { ON, OFF }
2389           ON by default, to avoid random TCP port assignment for data
2390           connections, which can prevent FTP protocol from working through
2391           firewalls and network address translators (for more on these
2392           topics, see the [256]Kermit security reference. Set to OFF in
2393           case the FTP server does not support passive mode, or in case
2394           the client has problems with it (it has been observed, for
2395           example, that when using passive mode, the SCO XENIX 2.3.4
2396           TCP/IP stack hangs in the connect() call forever). Synonyms:
2397           PASSIVE [ ON ], PASSIVE OFF, PASV [ ON ], PASV OFF.
2398
2399    SET FTP SEND-PORT-COMMANDS { ON, OFF }
2400           This command determines whether the FTP client sends a new PORT
2401           command to the server when accepting incoming data connections
2402           (as when not using passive mode.) When PASSIVE-MODE is OFF and
2403           SET SEND-PORT is OFF, the port that was originally specified is
2404           reused. This is the default behavior for normal FTP clients but
2405           it is not compatible with many firewalls.
2406
2407    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
2408           Whether to translate character sets when transferring files with
2409           FTP (explained in [257]Section 3.7). OFF by default.
2410
2411    SET FTP SERVER-CHARACTER-SET name
2412           Tells Kermit the character set used by the FTP server, UTF-8 by
2413           default ([258]Section 3.7).
2414
2415    SET FTP SERVER-TIME-OFFSET delta-time
2416           Tells Kermit to apply the given [259]delta time to file
2417           timestamps provided by the server for its files; for use when
2418           (for example) the server does not have its timezone set
2419           correctly.
2420
2421    SET FTP ERROR-ACTION { PROCEED, QUIT }
2422           When transferring a group of files with FTP, and an error occurs
2423           with one of the files, Kermit normally goes on the next file.
2424           Use SET FTP ERROR-ACTION to QUIT to make Kermit stop the
2425           transfer immediately and fail if an error occurs with any single
2426           file in the group. Example: you have given Kermit a list of
2427           files to send, and one of the files can not be found, or read
2428           permission is denied. Note that cancelling a file by typing 'X'
2429           during transfer is not considered an error (if you want to
2430           cancel the entire transfer, type 'Z' or Ctrl-C).
2431
2432    SET FTP PERMISSIONS { AUTO, ON, OFF }
2433           When uploading files with PUT or MPUT, this tells whether Kermit
2434           should send each file's permissions. The default is OFF, which
2435           means not to send permissions, in which case the uploaded file's
2436           permissions are set by the FTP server according to its own
2437           criteria. ON means to send them, AUTO means to send them only if
2438           the client (Kermit) and server are on like platforms (e.g. both
2439           UNIX). This command has no effect when downloading, since the
2440           FTP protocol does not include a way for the server to inform the
2441           client of a file's permissions. Also see [260]FTP PUT
2442           /PERMISSIONS. Note that setting permissions after uploading is
2443           likely to work (correctly or at all) only when the client and
2444           server platforms are alike (e.g. both of them are some form of
2445           UNIX). Also note that Windows files don't have permissions. Also
2446           see [261]FTP CHMOD.
2447
2448    SET FTP DATES { ON, OFF }
2449           When downloading files with GET or MGET, this tells whether
2450           Kermit should try to set the received file's date from the
2451           server's date. FTP DATES is ON by default. Note, however, that
2452           FTP protocol does not allow date preservation when uploading. So
2453           at best, SET FTP DATES ON can work only when downloading, and
2454           then only when the server agrees to furnish file dates.
2455
2456    SET FTP FILENAMES { AUTO, CONVERTED, LITERAL }
2457           When uploading (sending) files, this tells whether to convert
2458           outbound filenames to "common form". This means allowing only
2459           one period in a name, uppercasing any lowercase letters,
2460           replacing spaces by underscores, etc. AUTOMATIC is the default,
2461           meaning LITERAL when client and server are the same type of
2462           system (e.g. UNIX) and CONVERTED otherwise. Special case: if the
2463           setting is AUTOMATIC and the client is not UNIX and the server
2464           identifies itself as UNIX, Kermit uses a less-strict form of
2465           conversion, in which lowercase letters are not uppercased and
2466           the filename can contain any number of periods, but spaces are
2467           still converted to underscore. When receiving, conversion
2468           generally means to change all-uppercase names to lowercase and
2469           spaces to underscore.
2470
2471    SET FTP UNIQUE-SERVER-NAMES { ON, OFF }
2472           Applies only to uploads. Tells the server to create new, unique
2473           names for incoming files that have the same names as existing
2474           files. OFF by default, in which case the server overwrites
2475           existing files with new files of the same name. When ON, the
2476           server uses its own built-in method for creating new names for
2477           incoming files; for example, appending a period (.) and a number
2478           to the name. CAUTION: Use this option only if you do not need to
2479           refer to the file after it is uploaded, since FTP protocol
2480           provides no mechanism for the client to find out what name was
2481           assigned by the server.
2482
2483    SET FTP COLLISION { ... }
2484           When downloading, what to do if an incoming file has the same
2485           name as an existing file. Options are the same as for SET FILE
2486           COLLISION. If this command is not given, Kermit's regular FILE
2487           COLLISION setting is used. If this command is given, it
2488           overrides the FILE COLLISION setting for FTP transfers only. See
2489           [262]Section 3.6.2 for details.
2490
2491    SET FTP TYPE { TEXT, BINARY, TENEX }
2492           Changes the default transfer mode. When sending (uploading)
2493           files, this command has no effect unless you disable automatic
2494           text/binary mode switching ([263]Section 4) with SET FILE SCAN
2495           OFF or SET TRANSFER MODE MANUAL. When receiving (downloading)
2496           files, this command establishes the transfer mode to be used
2497           when a filename does not match any of Kermit's text or binary
2498           filename patterns, unless you use SET FTP GET-FILETYPE-SWITCHING
2499           or SET TRANSFER MODE MANUAL to disable automatic switching, in
2500           which case, this command establishes the transfer mode for all
2501           downloaded files. In all cases, however, the FTP TYPE can be
2502           overridden in any GET or PUT command by including a /TEXT
2503           (/ASCII), /BINARY, or /TENEX switch. The FTP TYPE is independent
2504           of the Kermit FILE TYPE setting. TENEX is used for sending 8-bit
2505           binary files to 36-bit platforms such as TOPS-10, TOPS-20, and
2506           TENEX, and getting them back again. Synonym: ASCII = TEXT. Note:
2507           there is also an FTP TYPE command, which does what SET FTP TYPE
2508           does but also sends a TYPE command to the server immediately if
2509           the given type is different from the current one.
2510
2511    If you want want specific FTP preference settings to be in effect for
2512    all your Kermit FTP sessions, put the desired SET FTP commands in your
2513    Kermit customization file (~/.mykermrc in UNIX, K95CUSTOM.INI in
2514    Windows).
2515
2516    [ [264]Top ] [ [265]FTP Top ] [ [266]C-Kermit Home ] [ [267]Kermit Home
2517    ]
2518
2519 3.4. Managing Directories and Files
2520
2521    In Kermit, commands for directory and file management can refer to:
2522
2523      * The local computer
2524      * A remote computer when you have a connection to a Kermit server or
2525        IKSD.
2526      * A remote computer when you have a connection to an FTP server.
2527
2528    (There can also be an HTTP connection, but the commands in this section
2529    don't apply to HTTP connections.)
2530
2531    Thus in general, each such command comes in three forms:
2532
2533     1. With no prefix in C-Kermit 8.0.200, it refers to the local computer
2534        (CD, DIR, etc). In C-Kermit 8.0.201 and later, however, the "locus"
2535        switches to automatically to the remote FTP server when you make an
2536        FTP connection (see the SET LOCUS description [268]Section 7); thus
2537        C-Kermit 8.0.201 acts almost exactly like a regular FTP client when
2538        it has an FTP connection, yet still acts like itself on other kinds
2539        of connections.
2540     2. With the REMOTE prefix, it is for a Kermit server (REMOTE CD,
2541        REMOTE DIR).
2542     3. With the FTP prefix, it's for an FTP server (FTP CD, FTP DIR).
2543     4. Also see [269]Section 3.8, which explains "R-commands" and
2544        "L-commands".
2545
2546    Kermit's FTP file and directory management commands are as follows.
2547    When an R-command is included in the Synonyms list, be sure to read
2548    [270]Section 3.8 about rules for use of R-commands.
2549
2550    FTP CD [ directory ]
2551           Tells the FTP server to change its default (working) directory
2552           to the one given, which usually must be expressed in the syntax
2553           of the server platform (UNIX, VMS, etc). If the directory is not
2554           specified, the result depends on the FTP server -- it might
2555           complain that the command is illegal, or it might change to your
2556           original login directory. Synonyms: FTP CWD (Change Wording
2557           Directory); RCD.
2558
2559    FTP CDUP
2560           Tells the FTP server to change its default (working) directory
2561           to the parent directory of its current one (equivalent to
2562           "cd .." in UNIX, or "cd [-]" in VMS). Synonyms: RCDUP, FTP UP.
2563
2564    FTP PWD
2565           Asks the FTP server to report ("print") its current working
2566           directory. Synonym: RPWD.
2567
2568    FTP MKDIR directory
2569           Asks the FTP server to create the directory whose name is given.
2570           In general, the name must be in the syntax of the server's file
2571           system, and it must be either absolute (a full pathname) or
2572           relative to the server's current (working) directory. This
2573           command fails if the directory can't be created for any reason,
2574           including that it exists already. Synonym: RMKDIR.
2575
2576    FTP RMDIR directory
2577           Asks the FTP server to remove the directory whose name is given.
2578           The rules are the same as for MKDIR, plus in most cases, the
2579           server will not remove any directory unless it is empty.
2580           Synonym: RRMDIR.
2581
2582    FTP DIRECTORY [ filespec ] [ redirectors ]
2583           Tells the FTP server to send a directory listing of the
2584           specified files. If no filespec is given, the server lists all
2585           files in its current working directory. The results are in
2586           whatever format the server chooses to send them. You can use
2587           UNIX-like redirectors to send the listing to a file or a
2588           pipeline, exactly as with the regular Kermit client/server
2589           REMOTE DIRECTORY command ([271]Using C-Kermit, Chapter 11).
2590           Synonym: RDIRECTORY. Examples:
2591
2592     ftp dir                           ; Show listing of all files on screen
2593     ftp dir *.txt                     ; List *.txt files on screen
2594     ftp dir *.txt > somefile          ; Put listing in somefile
2595     ftp dir *.txt >> somefile         ; Append listing to somefile
2596     ftp dir *.txt | sort > somefile   ; Put sorted listing in somefile
2597     ftp dir | more                    ; Runs list through "more"
2598     ftp dir | sort | more             ; Runs list through "sort" and "more"
2599
2600    FTP VDIRECTORY [ filespec ] [ redirectors ]
2601           "Verbose" directory. This is an alternative FTP DIRECTORY
2602           command primarily for use with DECSYSTEM-20 (TOPS-20) FTP
2603           servers, which send only filenames when given a DIRECTORY
2604           command; the VDIRECTORY command makes them also send file sizes,
2605           dates, and attributes.
2606
2607    FTP CHECK filespec
2608           Asks the FTP server whether the given file exists or, if the
2609           filespec contains wildcards, if any files match, and this
2610           command succeeds or fails accordingly.
2611
2612    FTP MODTIME filename
2613           Asks the FTP server, via the not-yet-standard FTP MDTM command,
2614           to send the modification date and time of the given file. The
2615           response should be a numeric string in the format:
2616           yyyymmddhhmmssxxxxx... where yyyy is the year, mm is the month,
2617           dd is the day, hh is the hour (0-23), mm is the minute, ss is
2618           the second, and xxx... is the optional fraction of the second (0
2619           or more digits). The date and time is expressed in UTC (GMT,
2620           Zulu, Zero-Meridian). The result is available programmatically
2621           in the [272]\v(ftp_message) variable, and is understandable by
2622           Kermit's date-time switches and functions. For example, suppose
2623           we want to upload all local files that are newer than a
2624           particular file on the server:
2625
2626   C-Kermit> ftp modtime signpost
2627   C-Kermit> echo \v(ftp_message)
2628   20010807113542.014
2629   C-Kermit> ftp mput /after:\v(ftp_message)GMT *
2630
2631           Note that we must append "GMT" to the date-time string to let
2632           the /AFTER switch know the time is GMT rather than local.
2633
2634    FTP SIZE filename
2635           Asks the FTP server to send the size (in bytes) of the given
2636           file. The result might vary depending on whether the current FTP
2637           TYPE is binary or text ("ascii"). For a reliable byte count, do
2638           FTP TYPE BINARY first. The result is available programmatically
2639           in the [273]\v(ftp_message) variable.
2640
2641    FTP CHMOD permissions filename
2642           Tells the FTP server to set the permissions (protection) of the
2643           given file to the ones given. The permissions and filename must
2644           be given in whatever syntax is required by the server. Example
2645           (for a UNIX-based FTP server):
2646
2647   ftp chmod 664 oofa.txt
2648
2649           Not all servers support this command. For non-UNIX-based
2650           servers, you might need to use FTP QUOTE or FTP SITE and the
2651           appropriate platform-specific FTP server command.
2652
2653    FTP UMASK [ number ]
2654           This command is probably specific to UNIX-based servers; it sets
2655           the UNIX "umask", which is the default permissions mask for new
2656           (in this case, incoming) files. Crudely put, the UNIX umask is
2657           an octal representation of a binary number in in which a 1 bit
2658           stands for a permission bit that must be 0, and a 0 bit stands
2659           for a permission bit that can be 0 or 1 depending on other
2660           factors, such as the permissions of the parent directory.
2661           Example: "umask 007" requires that new files are created without
2662           read/write/execute world permission. If the number is not
2663           specified, the server's current umask is reported.
2664
2665    FTP RENAME filename newname
2666           Asks the FTP server to rename the file whose name is "filename"
2667           to "newname". Works only for one file; can not be used with
2668           wildcards. The server's interpretation of "newname" can vary (in
2669           some cases it must be a filename, in others perhaps it can also
2670           be a directory name, in which case if the filename denote a
2671           regular file, the file might be moved to the given directory).
2672           Some servers might allow files to be renamed ("moved") between
2673           physical disks or partitions, others might not. Synonym:
2674           RRENAME.
2675
2676    FTP DELETE [ switches ] filespec [ filespec [ ... ] ]
2677           Tells the FTP server to delete the file or files listed. Each
2678           file specification may, but need not, contain wildcard
2679           characters to match multiple files. File specifications and
2680           wildcard syntax must be those of the server. Any file
2681           specifications that contain spaces must be enclosed in braces or
2682           doublequotes. FTP DELETE switches are:
2683
2684  /ERROR-ACTION:  /FILENAMES:     /NOBACKUPFILES  /QUIET
2685  /EXCEPT:        /LARGER-THAN:   /NODOTFILES     /NOPAGE
2686  /PAGE           /RECURSIVE      /SMALLER-THAN:
2687
2688           When used with FTP DELETE, the /RECURSIVE switch deletes files
2689           but not directories, and furthermore depends on the server
2690           providing recursive file lists, which is not the normal
2691           behavior. For further details, see the decriptions of these
2692           switches in [274]Section 3.6. Synonyms: FTP MDELETE (Kermit
2693           makes no distinction between DELETE and MDELETE); RDELETE.
2694
2695    FTP TYPE { TEXT, BINARY, TENEX }
2696           Tells the FTP server to change its file-transfer type to the one
2697           given, immediately. See [275]SET FTP TYPE for details.
2698
2699    [ [276]Top ] [ [277]FTP Top ] [ [278]C-Kermit Home ] [ [279]Kermit Home
2700    ]
2701
2702 3.5. Uploading Files With FTP
2703
2704    Uploading means sending files from the client (Kermit) to the FTP
2705    server. The basic command for uploading files with FTP is PUT:
2706
2707    FTP PUT [ switches ] [ filespec [ as-name ] ]
2708           Uploads (sends) the file or files that match the file
2709           specification, which may include wildcards, to the server. If no
2710           filespec is given, the names of files to send are taken from the
2711           /LISTFILE: file, if any, otherwise from the SEND-LIST, if any.
2712           Unless you go out of your way to prevent it, Kermit determines
2713           the transfer mode (text or binary) for each file automatically,
2714           and switches automatically on a per-file basis. If an as-name is
2715           given, the file is sent under that name instead of its own (if
2716           an as-name is given with a wildcard filespec, the result is a
2717           bit more complicated, and is explained later in this section).
2718
2719    Unlike normal FTP clients, Kermit does not prompt you by default (or at
2720    all) for each file; it just sends them, just as it does with Kermit
2721    protocol. The filespec can be a literal filename or a Kermit pattern,
2722    described in:
2723
2724   [280]http://www.columbia.edu/kermit/ckermit70.html#x4.9
2725
2726    Kermit patterns are equivalent to C-Shell patterns and provide a fair
2727    amount of flexibility in selecting which files to send, which is
2728    augmented by the file-selection switches presented in [281]Section
2729    3.5.1.
2730
2731    FTP MPUT [ switches ] filespec [ filespec [ ... ] ]
2732           FTP MPUT is just like FTP PUT except it allows you to give more
2733           than one file specification, and it does not allow an as-name in
2734           the file list. However, as-names can be given to either PUT or
2735           MPUT with the /AS-NAME: switch.
2736
2737    If a PUT or MPUT command results in one file being uploaded, it
2738    succeeds if the file is uploaded completely and fails otherwise. If
2739    more than one file is selected for upload, success or failure depends
2740    on the [282]FTP ERROR-ACTION setting; if it is PROCEED (the default
2741    setting), then the [M]PUT command succeeds if at least one of the files
2742    was completely uploaded, and fails otherwise, If FTP ERROR-ACTION is
2743    QUIT, the [M]PUT command succeeds if all selected files were uploaded
2744    successfully, and fails if any file failed.
2745
2746    FTP uploads may be interrupted just like Kermit uploads. While the
2747    transfer is in progress, type:
2748
2749   X to interrupt the current file and go on to the next file.
2750   Z to cancel the current file and all remaining files.
2751   ^C (Control-C): Like Z, but might act more quickly.
2752
2753    MPUT may be used as in regular FTP clients, but it is not required to
2754    send multiple files; in Kermit it is required only if you want to give
2755    multiple file specifications. Examples:
2756
2757   ftp put oofa.txt               ; Send a single file oofa.txt
2758   ftp put oofa.txt budget.txt    ; Send single file oofa.txt as budget.txt
2759   ftp put *.txt                  ; Send all *.txt files
2760   ftp mput *.txt                 ; Send all *.txt files (same as "put *.txt")
2761   ftp mput *.txt foo.bar         ; Send all *.txt files plus foo.bar
2762
2763    The distinction between PUT and MPUT is important only when more than
2764    one filespec is given, just like the distinction between Kermit SEND
2765    and MSEND:
2766
2767   ftp put oofa.txt budget.txt    ; Send oofa.txt AS budget.txt
2768   ftp mput oofa.txt budget.txt   ; Send oofa.txt AND budget.txt
2769
2770    If the source file specification includes any path segments, for
2771    example:
2772
2773   put /tmp/oofa.txt
2774   put subdir/another/andanother/oofa.txt
2775
2776    the path portion is stripped from the filename that is sent to the
2777    server. However, if an as-name contains a path, it is retained.
2778    Examples:
2779
2780   ftp put /usr/doc/oofa.txt      ; Send as "oofa.txt".
2781   ftp put oofa.txt /tmp/oofa.txt ; Send as "/tmp/oofa.txt"
2782
2783    The latter example sends the file oofa.txt from your current local
2784    directory to the server's /tmp directory. This works only if the server
2785    uses the same directory notation that you used in the as-name AND the
2786    given directory already exists on the server AND if you have write
2787    accesss to it.
2788
2789    Use caution when uploading from a case-sensitive file system, such as
2790    UNIX, to a file system that is not case sensitive, such as Windows or
2791    VMS. If you have two files in UNIX, AA and aa and upload both of them,
2792    the second one will overwrite the first. The only way around this
2793    provided by FTP protocol is its "unique server names" feature (SET FTP
2794    UNIQUE-SERVER-NAMES or the /UNIQUE switch described below).
2795
2796 3.5.1. FTP PUT Switches
2797
2798    FTP PUT and MPUT are similar in format and behavior to the regular
2799    Kermit SEND and MSEND commands, and they allow most of the same
2800    optional switches:
2801
2802 C-Kermit>ftp put ? Filename, or switch, one of the following:
2803  /after:                 /larger-than:           /rename-to:
2804  /array:                 /listfile:              /server-character-set:
2805  /as-name:               /local-character-set:   /server-rename-to:
2806  /before:                /move-to:               /simulate
2807  /binary                 /nobackupfiles          /smaller-than:
2808  /command                /nodotfiles             /tenex
2809  /delete                 /nofollowlinks          /text
2810  /dotfiles               /not-after:             /transparent
2811  /error-action:          /not-before:            /type:
2812  /except:                /permissions:           /update
2813  /filenames:             /quiet                  /unique-server-names
2814  /filter:                /recover
2815  /followlinks            /recursive
2816
2817    Since most of these switches are common to Kermit's SEND and MSEND
2818    commands, they described only briefly here. For greater detail see:
2819
2820      [283]http://www.columbia.edu/kermit/ckermit70.html#x1.5 (explanation
2821    of switches)
2822      [284]http://www.columbia.edu/kermit/ckermit70.html#x4.7
2823    (file-transfer switches)
2824
2825    First the file-selection switches:
2826
2827    /AFTER:date-time
2828    /BEFORE:date-time
2829    /NOT-AFTER:date-time
2830    /NOT-BEFORE:date-time
2831           Only send those files modified on or after or before the given
2832           date and time. These switches can be combined to select files
2833           modified between two date/times. Various date-time formats are
2834           accepted; if the date-time contains spaces, it must be enclosed
2835           in braces or doublequotes. See
2836           [285]http://www.columbia.edu/kermit/ckermit70.html#x1.6 and
2837           [286]Section 8.13 of this document for details about date-time
2838           formats. Examples:
2839
2840   ftp put /after:{1 jan 2000 0:00:00} *
2841   ftp put /after:-5days *
2842
2843    /LARGER-THAN:number
2844    /SMALLER-THAN:number
2845           Only send files larger (smaller) than the given number of bytes
2846           (octets). These switches can be combined to select files in a
2847           certain size range.
2848
2849    /TYPE:{TEXT,BINARY}
2850           Only send files that are the given type, which is determined for
2851           each file just before sending it by file scanning. BINARY
2852           includes TENEX; if you have included a /TENEX switch, or
2853           previously given a [SET] FTP TYPE TENEX command, binary files
2854           are sent in TENEX, rather than BINARY mode.
2855
2856    /[NO]DOTFILES
2857           [Don't] include files whose names begin with dot (.). By
2858           default, such files are not included unless your filespec
2859           explicitly mentions them.
2860
2861    /NOBACKUPFILES
2862           Don't include files whose names end with .~nnn~, where nnn is a
2863           number, e.g. oofa.txt.~27~. These are backup files created by
2864           Kermit, EMACS, and other applications. By default, backup files
2865           are included.
2866
2867    /NOFOLLOWLINKS
2868           (UNIX only) Skip over symbolic links rather than following them
2869           (default). This applies to wildcard and/or recursive [M]PUTs; if
2870           a single filename is given, and it happens to be a symbolic
2871           link, the file it points to is sent.
2872
2873    /FOLLOWLINKS
2874           (UNIX only) Always follow (resolve) symbolic links, even in
2875           wildcard or recursive [M]PUTs. Use with caution. Watch out for
2876           circular links, endless loops, etc.
2877
2878    /EXCEPT:pattern
2879           Exception list -- don't send files whose names match the given
2880           pattern. See [287]Section 1.5.4 of the [288]C-Kermit 7.0 Update
2881           Notes for details. If you want to exclude a directory from a
2882           recursive [M]PUT, use /EXCEPT:{dirname/*}.
2883
2884    /RECURSIVE
2885           Sends the desired files from the current (or given) directory,
2886           plus all directories beneath it, including empty directories,
2887           replicating the directory structure on the server. No special
2888           capabilities are required in the server, but of course your
2889           login ID on the server must have the appropriate accesss and
2890           permission to create directories. Recursive PUTs work not only
2891           between like platforms (e.g. UNIX to UNIX) but also between
2892           unlike ones (e.g. UNIX to VMS or Windows), in which case
2893           text-file format differences are handled by Kermit's automatic
2894           text/binary mode switching ([289]Section 4) and character-set
2895           translation ([290]Section 3.7). Synonym: /SUBDIRECTORIES.
2896
2897    /UPDATE
2898           Send only files that have changed since last time ([291]Section
2899           3.5.2).
2900
2901    /ARRAY:arrayname
2902           The "file" to be sent is an array, or a segment of one, rather
2903           than a real file. In this case the other selection switches
2904           don't apply. The array contents are sent in text mode, and each
2905           array element is treated as a line. Example:
2906
2907   ftp put /as-name:array.txt /array:&a
2908
2909           (or, to send a segment of the array, /array:&a[100:199]). If you
2910           don't include an /AS-NAME, a name of "_array_x_" is used (where
2911           x is the array letter). If you include this switch, most other
2912           switches are meaningless and ignored.
2913
2914    /COMMAND
2915           The "file" to be sent is the standard output of a command,
2916           rather than a real file. It is sent in text or binary mode
2917           according to the prevailing FTP TYPE, which can be overridden
2918           with a /TEXT or /BINARY switch. Example: Example:
2919
2920   ftp put /command /as-name:{userlist} {finger | sort -r}
2921
2922    /LISTFILE:filename
2923           Tells Kermit to obtain the list of files to be sent from the
2924           file whose name is given. This file must contain one file
2925           specification (which may be wild) per line. If the list includes
2926           files from different directories, such as a recursive listing of
2927           a directory tree, the paths are recreated on the server (if
2928           possible) if you include the /RECURSIVE switch; otherwise all
2929           the files are sent to the current directory on the server.
2930
2931    Now the other switches:
2932
2933    /AS-NAME:text
2934           If a single file is being sent, send it with the given text as
2935           its name. If multiple files are being sent, the text must be a
2936           template that includes variables such as \v(filename),
2937           \v(filenumber), \v(ntime), to allow dynamic creation of each
2938           name. The same applies to the as-name field of the FTP PUT
2939           command. If this switch is not included (and an as-name is not
2940           included as the second filename to PUT), each file is sent with
2941           its own name.
2942
2943    /BINARY
2944    /TEXT
2945    /TENEX
2946           Forces this upload to take place in the given mode, regardless
2947           of the current FTP TYPE setting, and without automatic
2948           text/binary switching. /ASCII is a synonym for /TEXT.
2949
2950    /FILTER:command
2951           Specifies that the file(s) is/are to be passed through the given
2952           command or pipeline on their way to the server. Example:
2953
2954   ftp put /binary /filter:{gzip -c \v(filename)} /as-name:\v(filename).gz *
2955
2956    /TRANSPARENT
2957    /LOCAL-CHARACTER-SET:name
2958    /SERVER-CHARACTER-SET:name
2959           Character-set translation for text files, explained in
2960           [292]Section 3.7.
2961
2962    /ERROR-ACTION:{PROCEED,QUIT}
2963           Overrides the prevailing [293]FTP ERROR-ACTION for the duration
2964           of this PUT or MPUT command only.
2965
2966    /RECOVER
2967           Resume an interrupted transfer where from the point of
2968           interruption (explained in [294]Section 3.5.2). Synonym:
2969           /RESTART.
2970
2971    /DELETE
2972           Tells Kermit to delete each source file immediately after, and
2973           only if, it has been uploaded completely and successfully. This,
2974           in effect, moves the file from the client to the server.
2975
2976    /MOVE-TO:directory
2977           Tells Kermit to move each source file to the named local
2978           directory after, and only if, it has been uploaded completely
2979           and successfully.
2980
2981    /RENAME-TO:template
2982           Tells Kermit to rename each (local) source file according to the
2983           given template after, and only if, it has been uploaded
2984           completely and successfully. The template works as in /AS-NAME.
2985
2986    /SERVER-RENAME-TO:template
2987           Tells Kermit to ask the server to rename each file according to
2988           the given template as soon as, and only if, it has been received
2989           completely and successfully. The template works as in /AS-NAME.
2990           Requires write and rename accesss on the server, so doesn't
2991           usually work with (e.g.) anonymous uploads to public incoming
2992           areas where the permissions don't allow renaming. Examples:
2993
2994         ftp mput /server-rename:\v(filename).ok *
2995                 Appends ".ok" to each filename on the server when it's
2996                 finished uploading.
2997
2998         ftp mput /as-name:\v(filename).tmp /server-rename:\v(filename) *
2999                 This is the reverse of the previous example; it uses a
3000                 temporary name while uploading is in progress and reverts
3001                 the file to its real name when uploading is complete.
3002
3003         ftp mput /as-name:\v(filename)
3004                 /server-rename:../final/\v(filename) *
3005                 Moves the file from the working directory to a final
3006                 directory when the upload is complete, but in this case
3007                 you have to know the pathname syntax of the server. If the
3008                 rename fails, the [M]PUT command fails according to the
3009                 [295]FTP ERROR-ACTION selection.
3010
3011    /FILENAMES:{AUTOMATIC,CONVERTED,LITERAL}
3012           Overrides the [296]FTP FILENAMES setting for this upload only.
3013
3014    /PERMISSIONS:{ON,OFF}
3015           Overrides the [297]FTP PERMISSIONS setting for this upload only.
3016
3017    /UNIQUE
3018           Tells Kermit to tell the server to give [298]unique names to
3019           incoming files that would otherwise overwrite existing files
3020           that have the same name. This switch conflicts with /UPDATE,
3021           /RECOVER, /PERMISSIONS, and /SERVER-RENAME since the client has
3022           no way of knowing the name assigned by the server.
3023
3024    /QUIET
3025           Don't display file-transfer progress or statistics.
3026
3027    /SIMULATE
3028           Shows which files would be sent without actually sending them.
3029           Useful (for example) with /UPDATE (next section). The results
3030           are shown in the file-transfer display (if it is not disabled)
3031           and in the transaction log (if one is active). Hint: use SET
3032           TRANSFER DISPLAY BRIEF.
3033
3034 3.5.2. Update Mode
3035
3036    When you include the /UPDATE switch, this means to skip sending any
3037    file that already exists on the server if the local file's modification
3038    date/time is not later than that of the corresponding file on the
3039    server. Here is a typical application for update mode: Suppose that on
3040    Computer A, you maintain a large set of files (say, a collection of Web
3041    pages and graphics images, or the source files for a software
3042    application), and you need to keep a parallel copy on another Computer,
3043    B. Of course you could upload the entire collection every day:
3044
3045   cd source-directory
3046   ftp computerb.xyzcorp.com
3047   ( authentication details... )
3048   ftp cd target-directory
3049   ftp put [ switches ] *
3050
3051    But if the total size is large or the network slow, this would be
3052    unnecessarily time-consuming. Worse, if other users or sites had to
3053    update whenever new files appeared in B's directory, this would cause
3054    them unnecessary work. By including the /UPDATE switch:
3055
3056   ftp put /update [ other-switches ] *
3057
3058    only those files that changed since last time are uploaded. Here's how
3059    it works. For each local file that is selected for uploading:
3060
3061      * The remote filename is determined in the normal way, according to
3062        the [299]FTP FILENAMES setting, /FILENAMES switch, or the as-name,
3063        if any.
3064      * Kermit sends an MDTM (modification time) command for the
3065        corresponding remote filename to the server.
3066      * If the server does not understand the MDTM command, the file is
3067        sent.
3068      * If the server can't find a file with the given name, the file is
3069        sent.
3070      * If the local file's modification time is later than that of the
3071        remote file, the file is sent.
3072      * Otherwise -- the remote file exists but its modification time is
3073        equal to or earlier than that of the local file -- the file is
3074        skipped.
3075
3076    All time comparisons take place in Coordinated Universal Time
3077    (UTC)([300]1), also known as GMT or Zulu time: Timezone 0; standard
3078    time, without daylight savings.
3079
3080      WARNING: Some FTP servers, such as Novell NWFTPD.NLM, ignore or
3081      misimplement the FTP specification and send local time rather than
3082      UTC.
3083
3084    Update mode is useful only when always used in the same direction. When
3085    you upload (PUT) a file with FTP, the destination file receives the
3086    current timestamp on the server's computer, not the original file's
3087    timestamp ([301]2). If you try to FTP PUT /UPDATE the same file again,
3088    it will be skipped (as expected) since the remote copy is newer.
3089    However, if you try to FTP GET /UPDATE the same file ([302]Section
3090    3.6), it will be transferred for the same reason.
3091
3092    To check the availability of PUT /UPDATE on a particular connection,
3093    issue an FTP MODTIME command for a file that is known to exist on the
3094    server. If it succeeds, PUT /UPDATE should work and in that case, you
3095    can run a procedure like the one above every day: the first time, it
3096    sends all the files; after that, it sends only the ones that changed.
3097    If a transaction log is active, a notation is included for any files
3098    that are skipped.
3099
3100    Notes:
3101     1. Why is Coordinated Universal Time abbreviated UTC? From the
3102        [303]National Institute of Standards and Technology FAQ: "In 1970
3103        the Coordinated Universal Time system was devised by an
3104        international advisory group of technical experts within the
3105        International Telecommunication Union (ITU). The ITU felt it was
3106        best to designate a single abbreviation for use in all languages in
3107        order to minimize confusion. Since unanimous agreement could not be
3108        achieved on using either the English word order, CUT, or the French
3109        word order, TUC, the acronym UTC was chosen as a compromise."
3110     2. The Kermit FTP client is unusual in that, when downloading only, it
3111        can set the received file's date from the file's date on the
3112        server, but this should not affect the update feature. When
3113        uploading to an FTP server, however, there is no mechanism for the
3114        client to set the date of the uploaded file on the server.
3115
3116 3.5.3 Recovery
3117
3118    Suppose that while you are uploading a large file over a slow
3119    connection, the connection is lost before the entire file is
3120    transferred. With most FTP clients, you would have to start over, thus
3121    resending the portion of the file that was sent already, and that is
3122    already on the server. But Kermit's /RECOVER switch (Synonym: /RESTART)
3123    lets you continue an interrupted transfer from the point of failure,
3124    thus transferring only the part that wasn't sent already. The
3125    prerequisites for recovery are:
3126
3127      * The transfer must be in BINARY mode, or else the client and server
3128        must reside on like systems (e.g. both on some form of UNIX).
3129      * The FTP server must support the SIZE command.
3130
3131    Here's how it works. When you include the /RECOVER switch:
3132
3133      * Kermit checks for conflicting switches, such as /UPDATE and
3134        /UNIQUE; if /RECOVER is given with these switches an error occurs.
3135        If /RECOVER is given in other circumstances where it could serve no
3136        useful purpose (e.g. with arrays, pipes, or filters), it is
3137        ignored.
3138
3139    If the switch is accepted, then for each selected file:
3140
3141      * If it is not binary (determined by scanning) and the client and
3142        server are not on like platforms, recovery is canceled (the entire
3143        file is sent). Otherwise:
3144      * A SIZE command is sent for the file (using its remote name). If the
3145        reply indicates the file was not found, or the SIZE command was not
3146        understood, or any other kind of error, recovery is canceled.
3147        Otherwise:
3148      * A MDTM (modification time) command is sent for the file. If a valid
3149        reply is received, and the modification time of the local file is
3150        later than that of the remote file, recovery is canceled.
3151        Otherwise:
3152      * If the sizes of the two files are identical, the file is not sent.
3153        Otherwise:
3154      * Kermit seeks to the recovery spot in the local file, tells the
3155        server to APPEND the data which is about to arrive to the remote
3156        file, and then sends the data starting at the recovery point.
3157
3158    To safeguard file integrity, recovery is not attempted unless all the
3159    preconditions are met. For the widest possible usefulness, APPEND is
3160    used rather than RESTART. For stream transfers (the only kind that
3161    Kermit supports) the results are the same.
3162
3163    By design, the /RECOVER switch can be included with any FTP PUT or MPUT
3164    command, even if it specifies a group of files. This allows you to
3165    resume an interrupted batch transfer from where it left off. The files
3166    that were already completely sent are skipped, the file that was
3167    interrupted is recovered, and the remaining files are uploaded.
3168
3169    By the way, it doesn't matter how the original partial file was
3170    uploaded -- FTP, Kermit, Zmodem, etc: as long as the preconditions are
3171    met, it can be recovered with FTP PUT /RECOVER, or for that matter also
3172    using Kermit protocol and SEND /RECOVER.
3173
3174    A word of caution, however, when the original upload was in text mode
3175    with character-set translation ([304]Section 3.7):
3176
3177      * If the original upload involved a translation from one single-byte
3178        character set to another (e.g. Code Page 850 to Latin-1), recovery
3179        is safe if you specify the same translations for the recovery. If
3180        you don't, the resulting file will contain a mixture of character
3181        sets.
3182      * If the original upload involved a translation that changed the size
3183        of the file (e.g. from an alphabetic Code Page or Latin Alphabet to
3184        Unicode, or vice versa), recovery is NOT safe, even if you specify
3185        the same translations.
3186
3187    Kermit has no way of knowing anything about the previous upload. As a
3188    safeguard, an error occurs if you include /RECOVER and also specify a
3189    character-set of UCS2 or UTF8, since recovery can't possibly work in
3190    that situation. Otherwise, it's up to you to avoid unsafe recovery
3191    operations.
3192
3193    [ [305]Top ] [ [306]FTP Top ] [ [307]C-Kermit Home ] [ [308]Kermit Home
3194    ]
3195
3196 3.6. Downloading Files With FTP
3197
3198    Although uploading files with Kermit's FTP client is just as easy and
3199    flexible as sending files with Kermit protocol, the same is not always
3200    true for downloading because FTP servers lack some of the capabilities
3201    of a Kermit server:
3202
3203      * If you want to get more than one file, you have to use MGET, not
3204        GET, since the underlying FTP protocol is different in the two
3205        cases. Kermit can't "autodetect" which one you mean, as it can with
3206        PUT and MPUT, since it can't be expected to know the wildcard
3207        syntax of the remote platform and/or FTP server (the same is true
3208        for all other FTP clients). To complicate matters, FTP protocol now
3209        includes two underlying mechanisms (NLST and MLSD) for
3210        accomplishing MGET operations and, as explained in [309]Section
3211        3.11, the two behave differently.
3212      * Automatic text-binary mode switching is not done by the server. It
3213        can be done by the client (Kermit), but in this case it is not
3214        based on a file scan (since there is no way for Kermit prescan a
3215        server file), but rather on the filename, using C-Kermit 7.0
3216        [310]filename patterns.
3217      * Some options that are available with FTP PUT can not be used with
3218        FTP [M]GET or don't work the same way:
3219          /PERMISSIONS (FTP protocol has no mechanism for this).
3220          /[NOT-]BEFORE, /[NOT-]AFTER (because of the timezone problem).
3221          /RECOVER works only in binary mode.   /RECURSIVE has limited
3222        utility.
3223
3224    The commands for downloading are:
3225
3226    SET FILE DOWNLOAD-DIRECTORY [ directory ]
3227           As with Kermit transfers, this command, if given, tells C-Kermit
3228           where to store incoming files in the absence of a specific
3229           as-name. If not given, incoming files are stored as indicated by
3230           the as-name, if any, otherwise in the current directory, just as
3231           with Kermit transfers. The more verbose transfer display formats
3232           give the full pathname of each received file, and, in case you
3233           have trouble finding a downloaded file afterwards, its full path
3234           is also listed in the transaction log (if you kept one), and you
3235           can also ask Kermit where it went with the [311]WHERE command.
3236
3237    SET FTP GET-FILETYPE-SWITCHING { ON, OFF }
3238           ON by default, causing Kermit to switch automatically into text
3239           or binary mode for each file based on whether its name matches a
3240           text pattern or binary pattern. Set this OFF, or use a /TEXT,
3241           /BINARY, or /TENEX switch to defeat this feature. Use SHOW
3242           PATTERNS to see the current pattern list.
3243
3244    [ FTP ] GET [ switches ] filename [ as-name ]
3245           Asks the server to send the given file, and if it comes, stores
3246           it locally under the given as-name, if any, otherwise under its
3247           original name (modified according to the selected filename
3248           conversion option), in your download directory, if you have
3249           specified one, otherwise in the directory indicated in the
3250           as-name, if any, otherwise in your current directory. If you
3251           accidentally use a wildcard in the filename ("get *.txt") the
3252           server will reply with a message like "File not found" (unless
3253           there is a file whose name actually is "*.txt"). If FTP
3254           GET-FILETYPE-SWITCHING is ON, and in the absence of any GET
3255           switches to override it, the file is transferred in binary mode
3256           if it matches any of Kermit's binary name patterns, and in text
3257           mode if it matches any of Kermit's text name patterns, and in
3258           the prevailing FTP TYPE if it matches none of these patterns.
3259
3260    [ FTP ] MGET [ switches ] filespec [ filespec [ filespec [ ... ] ] ]
3261           Like GET, but for multiple files. One or more file
3262           specifications can be given, and any or all (or none) of them
3263           can contain wildcards or can be directory names. The file list
3264           may not include an as-name, but you can still give one with the
3265           /AS-NAME: switch.
3266
3267    In both the FTP GET and MGET commands, any filenames that contain
3268    spaces must be enclosed in braces or doublequotes (see [312]Section 5
3269    for details).
3270
3271    FTP downloads may be interrupted just like Kermit transfers. While the
3272    transfer is in progress, type:
3273
3274      * X to interrupt the current file and go on to the next file.
3275      * Z (or Control-C) to cancel the current file and all remaining
3276        files.
3277
3278    Before proceeding, a brief word about temporary files. In FTP protocol,
3279    the MGET command works by requesting a file list from the server, and
3280    then (internally) issuing a GET command (FTP RETR protocol directive)
3281    for each file. The file list returned by the server can be any size at
3282    all, so in case it is huge, we don't store it in memory; instead we put
3283    it in a temporary file. For troubleshooting purposes, you should be
3284    aware of two points:
3285
3286     1. The location of the temporary file is chosen according the TMP or
3287        TEMP environment variables. If neither of these variables is
3288        defined, you might need to define it. In case there is not enough
3289        space on the indicated disk or partition for the server's file
3290        list, you might need to either clean up the temporary area, or
3291        redefine the environment variable to indicate a different area that
3292        has sufficient space.
3293     2. If you want to look at the list yourself, use SET FTP DEBUG ON.
3294        This tells Kermit to (a) give you the full pathname of the
3295        temporary file at the end of each MGET command, and (b) not to
3296        delete it, as it normally does.
3297
3298 3.6.1. FTP GET Switches
3299
3300    The following switches are available with FTP GET and MGET:
3301
3302    /TEXT
3303           Specifies a text-mode transfer. Overrides the global FTP TYPE
3304           setting and filename pattern-matching for the duration of the
3305           current command only, All files are downloaded in text mode.
3306           Synonym: /ASCII.
3307
3308    /BINARY
3309           Specifies a binary-mode transfer. Overrides the global FTP TYPE
3310           setting and filename pattern-matching for the duration of the
3311           current command only. All files are downloaded in binary mode.
3312
3313    /TENEX
3314           Like /BINARY but specifies a special binary transfer mode to be
3315           used when getting 8-bit binary files from a 36-bit platform such
3316           as TOPS-10, TOPS-20, or TENEX. All files are downloaded in the
3317           special binary mode.
3318
3319    /RECOVER
3320           This instructs Kermit to try to recover an incomplete download
3321           from the point of failure. Works only in binary mode, and only
3322           if the server supports the (not-yet-standard) FTP "REST"
3323           directive. See [313]Section 3.6.3 for details. Synonym:
3324           /RESTART.
3325
3326    /FILENAMES:{CONVERTED,LITERAL}
3327           Overrides the [314]FTP FILENAMES (filename conversion) setting
3328           for this download only, forcing incoming filenames to be either
3329           converted or taken literally.
3330
3331    /AS-NAME:text
3332           For GET, this is equivalent to giving an as-name after the
3333           filename. For MGET, this is the only way to specify alternative
3334           names for the incoming files. With MGET, the /AS-NAME text
3335           should (must) contain a Kermit variable, usually \v(filename) or
3336           \v(filenumber). Example:
3337
3338   mget /text /as-name:\v(filename).new *.c
3339
3340           This gets all ".c" files and stores them with "
3341
3342           .new" appended to their names. See the [315]C-Kermit 7.0 Update
3343           Notes for details.
3344
3345    /COMMAND
3346           This specifies that the incoming file is to be written to the
3347           standard input of a command, rather than to a file. The command
3348           name is the as-name from the GET command or the /AS-NAME
3349           argument. If you need to refer to the incoming file's name in
3350           the command, use \v(filename). See the description of the
3351           regular Kermit [316]GET /COMMAND command for details and
3352           examples.
3353
3354    /QUIET
3355           Transfers the files quietly; don't put up a file-transfer
3356           display.
3357
3358    /ERROR-ACTION:{QUIT,PROCEED}
3359           This switch affects only MGET. If an error occurs with a
3360           particular file, this tells whether to go on to the next file
3361           (PROCEED) or to stop right away and fail (QUIT). The default is
3362           PROCEED.
3363
3364    The file selection switches are:
3365
3366    /EXCEPT:{pattern} or /EXCEPT:{{pattern}{pattern}{...}}
3367           Exception list for MGET; skip downloading any file whose name
3368           matches any of the given patterns (when using the second format,
3369           up to 64 patterns may be specified). [317]CLICK HERE for syntax
3370           details.
3371
3372    /SMALLER-THAN:number
3373           Download only files whose size is smaller than the given number
3374           of bytes (octets). Requires that the FTP server support the SIZE
3375           or MLSD directive.
3376
3377    /LARGER-THAN:number
3378           Download only files whose size is greater than the given number
3379           of bytes. Requires that the FTP server support the SIZE or MLSD
3380           directive.
3381
3382    /NOBACKUPFILES
3383           During MGET, don't download any files whose names end with
3384           backup suffixes (.~n~ where n is a number).
3385
3386    /NODOTFILES
3387           During MGET, don't download any files whose names begin with
3388           period (.). Equivalent to /EXCEPT:{.*}.
3389
3390    /LISTFILE:local-filename
3391           The given file contains a list of files to GET, one per line.
3392           Filenames in the listfile can contain wildcard characters in the
3393           syntax of the server. There is no limit on the number of lines
3394           in the listfile.
3395
3396    /NAMELIST:local-filename
3397           If this switch is given, then instead of actually retrieving the
3398           selected files, the GET command retrieves a list of the names of
3399           the files that would be retrieved, and places it in the
3400           specified file. The resulting file is an ordinary text file,
3401           with one filename per line, suitable for reading by a person, or
3402           processing by a computer program, including Kermit itself (FOPEN
3403           / FREAD / FWRITE / FCLOSE), and as /FILELIST: file. If the
3404           filename is omitted or given as "-" (dash, hyphen), the list
3405           goes to the screen. NOTE: if you want a copy of the complete
3406           list sent by the server, use SET FTP DEBUG ON, perform an MGET,
3407           and the temporary file containing the list will be kept rather
3408           than deleted (and Kermit tells you its name).
3409
3410    /UPDATE, /COLLISION:keyword
3411           Explained in [318]Section 3.6.2.
3412
3413    /RECURSIVE
3414           This means to try to download an entire directory tree, rather
3415           than just files from a particular directory. In fact, FTP
3416           protocol does not provide a method to request a recursive
3417           download (unless the server supports MLSD; see [319]Section
3418           3.11), so this works only if the FTP server does it anyway,
3419           without being asked, as some do. In this case, Kermit detects
3420           that names in the returned file list contain directory
3421           separators, and therefore attempts to create the needed
3422           directories as the files arrive. But this can work only if the
3423           server is on the same kind of platform as the client, so the
3424           pathname syntax can be recognized, and also because the server
3425           does not switch between text and binary mode, which would be
3426           vital for cross-platform transfers. Use with caution. Synonym:
3427           /SUBDIRECTORIES.
3428
3429           Even when the server does not provide recursive file lists,
3430           [M]GET /RECURSIVE forces Kermit to replicate any directory
3431           structure implied or expressed by the server's file list. For
3432           example:
3433
3434   get somepath/somefile
3435
3436           Gets the file named somefile from the server's somepath
3437           directory and puts it Kermit's current (or download) directory,
3438           whereas:
3439
3440   get /recursive somepath/somefile
3441
3442           creates the path locally and then puts the file in it. Similarly
3443           for MGET:
3444
3445   mget */data/*
3446
3447           downloads all the files in all the data subdirectories of all
3448           the subdirectories of the server's current directory and stores
3449           them locally in Kermit's current (or download) directory,
3450           whereas:
3451
3452   mget /recursive */data/*
3453
3454           re-creates the server's directory structure locally.
3455
3456    The FTP protocol does not include explicit mechanisms for recursion, so
3457    Kermit builds upon what is available. Although an Internet draft
3458    describes a mechanism ("MLSD") that would allow protocol-driven
3459    recursion, similar to Kermit's File Attribute packets (circa 1984), it
3460    has not yet attained RFC or standard status, and servers are not yet
3461    widely available that offer this feature. In the meantime, the
3462    effectiveness of MGET /RECURSIVE depends on the FTP server
3463    implementation. If the server returns a recursive list in response to
3464    the standard NLST command (whose behavior is ill-defined), Kermit's FTP
3465    MGET /RECURSIVE command uses it to re-create the remote directory tree
3466    locally. If the server supports MLSD, C-Kermit 8.0.206 and Kermit 95
3467    2.1 and later are able to sense it automatically and use it, as
3468    described below in [320]Section 3.11.
3469
3470    The /BEFORE:, /AFTER:, /NOT-BEFORE:, and /NOT-AFTER: switches are not
3471    available for downloading because of the confusion with timezones.
3472    Would the given times be in the local timezone, the server's timezone,
3473    or GMT? The FTP server's directory listings show its own local times
3474    but since we don't know what timezone the server is in, there's no way
3475    to reconcile our local times with the server's. Similarly, /PERMISSIONS
3476    can't be preserved in downloads because FTP protocol provides no means
3477    of querying the server for a file's permission.
3478
3479    Source-file disposition switches:
3480
3481    /DELETE
3482           Each file that is downloaded successfully is to be deleted from
3483           the server. Requires the appropriate file accesss rights on the
3484           server.
3485
3486    /SERVER-RENAME-TO:template
3487           Asks the server to rename each (remote) source file immediately
3488           after, and only if, it is sent correctly. See [321]PUT
3489           /SERVER-RENAME-TO: for details.
3490
3491    Destination-file disposition switches:
3492
3493    /TO-SCREEN
3494           Displays the incoming file on the screen rather than storing it
3495           on disk. If this switch is given, the /RENAME-TO and /MOVE-TO
3496           switches are ignored, the file-transfer display is suppressed,
3497           and the given file(s) is/are shown on the screen. Can be used
3498           with /FILTER, e.g.
3499
3500   get /text /to-screen /filter:more oofa.txt
3501
3502           In fact, you should always use /TO-SCREEN with /FILTER or
3503           /COMMAND when the command would result in displaying the
3504           incoming file on the screen; otherwise C-Kermit would have no
3505           way of knowing to suppress its file transfer display (since it
3506           can't be expected to know what the command or filter does).
3507
3508    /RENAME-TO:template
3509           Each file that is downloaded is to be renamed as indicated if
3510           and only if it was received completely and without error. The
3511           template can be literal text or can contain variables that are
3512           evaluated for each file. For MGET, the text must contain
3513           variables; for GET it can be a literal string. The \v(filename)
3514           variable contains the name of the current file, so:
3515
3516   ftp mget /rename-to:\v(filename).ok *
3517
3518           causes each file that is successfully downloaded to have ".ok"
3519           appended to its name. For details see [322]Section 4.1 of the
3520           [323]C-Kermit 7.0 Update Notes.
3521
3522    /MOVE-TO:text
3523           Just like /RENAME-TO:, except the text denotes the name of a
3524           directory to which successfully downloaded files are to be
3525           moved. If the directory does not exist, it is created.
3526
3527    The file transfer display does not show the /MOVE-TO or /RENAME-TO
3528    value, since the incoming file has not yet been moved or renamed.
3529
3530 3.6.2. Filename Collisions
3531
3532    What should happen if an incoming file has the same name as an existing
3533    file in the same directory? By default, Kermit's FILE COLLISION setting
3534    applies: BACKUP, RENAME, UPDATE, DISCARD, etc, as described in
3535    [324]Using C-Kermit. Kermit's default FILE COLLISION setting is BACKUP
3536    (rename the existing file and store the incoming file under its own
3537    name) and therefore this is also the default FTP collision action.
3538
3539    The name under which an incoming file is to be stored is determined as
3540    follows:
3541
3542      * If an as-name was given, the as-name is used. Otherwise:
3543      * If the client and server platforms are alike or [325]FTP FILENAMES
3544        is set to LITERAL (or the /FILENAMES:LITERAL switch was given for
3545        this download), the incoming filename is used literally. Otherwise:
3546      * The incoming filename is converted to a form that is friendly to
3547        the local platform. For UNIX, for example, incoming filenames that
3548        are all uppercase (as they might be from, say, VMS or an IBM
3549        mainframe) are converted to lowercase.
3550
3551    If the resulting name coincides with the name of a local file that
3552    already exists, we have a filename collision. Collisions are handled
3553    according to the currently selected collision action:
3554
3555    SET FTP COLLISION { BACKUP, RENAME, UPDATE, DISCARD, APPEND, OVERWRITE
3556           }
3557           This establishes a filename collision for FTP, separate from the
3558           Kermit one. The initial FTP collision setting is inherited from
3559           Kermit's FILE COLLISION setting when the first FTP command is
3560           given, but subsequent changes to Kermit's FILE COLLISION setting
3561           do not affect the FTP COLLISION setting. SHOW FTP tells the
3562           current FTP COLLISION setting.
3563
3564    FTP GET /COLLISION:{BACKUP,RENAME,UPDATE,DISCARD,APPEND,OVERWRITE}
3565           Overrides the current FTP COLLISION action for this download
3566           only.
3567
3568    FTP GET /UPDATE
3569           This is equivalent to GET /COLLISION:UPDATE, and is included for
3570           symmetry with PUT /UPDATE
3571
3572    FTP GET /UPDATE and /COLLISION:UPDATE mean to download only those files
3573    whose modification dates on the server are later than those on the
3574    client. Date-time comparisons are done in Coordinated Universal Time
3575    (UTC, GMT, ZULU). The command:
3576
3577      FTP MGET /COLLISION:APPEND /AS-NAME:newfilename *.*
3578
3579    Downloads all matching remote files into a single local file (in
3580    whatever order the server sends them).
3581
3582 3.6.3. Recovery
3583
3584    Recovery is available for downloads too, but there are some differences
3585    from the uploading case described in [326]Section 3.5.3:
3586
3587      * The transfer must be in BINARY mode. It can not be in text mode,
3588        even if the FTP server is on the same kind of platform as Kermit,
3589        and even if there is no character-set translation. The original
3590        download must also have been in binary mode.
3591      * The FTP server must support the REST ("restart") directive.
3592        Unfortunately, this is not a standard command; at this writing, it
3593        is described only in an Internet Draft, not an RFC or Internet
3594        Standard, but nevertheless it is found in several popular FTP
3595        servers, such as [327]ProFTPD.
3596
3597    Here's how download recovery works:
3598
3599      * Kermit checks for conflicting switches, such as /UPDATE, /COMMAND,
3600        or /FILTER. If /RECOVER is given with these switches an error
3601        occurs.
3602      * The prevailing transfer mode (SET FTP TYPE) must be BINARY. If it
3603        is not, the /BINARY switch must have been included with the FTP
3604        [M]GET command.
3605
3606    If the /RECOVER switch is accepted, then for each selected file:
3607
3608      * A SIZE command is sent for the file (using its remote name). If the
3609        reply indicates the file was not found, or the SIZE command was not
3610        understood, or any other kind of error, recovery is canceled (i.e.
3611        the entire file is downloaded).
3612      * If the sizes of the two files are identical, the file is not sent.
3613        Otherwise:
3614      * Kermit sends the REST directive to the server, indicating the size
3615        of the local file. If the server responds affirmatively, Kermit
3616        opens the local file in append mode and appends the incoming data
3617        to it. Otherwise, recovery is canceled and the entire file is
3618        downloaded.
3619
3620    The /RECOVER switch can be included with any FTP GET or MGET command,
3621    even if it specifies a group of files. This lets you resume an
3622    interrupted batch transfer from where it left off. The files that were
3623    already completely sent are skipped, the file that was interrupted is
3624    recovered, and the remaining files are uploaded. BUT... unlike with
3625    uploading, where this can be done with any mixture of text and binary
3626    files, when downloading, it can only be done if all the files are
3627    binary.
3628
3629    It doesn't matter how the original partial file was downloaded -- FTP,
3630    Kermit, HTTP, Zmodem, etc: as long as the preconditions are met, it can
3631    be recovered with FTP [M]GET /RECOVER, or for that matter also with GET
3632    /RECOVER (using Kermit protocol).
3633
3634    [ [328]Top ] [ [329]FTP Top ] [ [330]C-Kermit Home ] [ [331]Kermit Home
3635    ]
3636
3637 3.7. Translating Character Sets
3638
3639    A possibly unique feature of Kermit's FTP client is its ability to
3640    convert character sets when transferring files in text mode,
3641    independent of the capabilities of the FTP server, as well as to
3642    translate the character sets of filenames regardless of transfer mode.
3643    For compatibility with existing FTP clients, and because there is a
3644    certain performance penalty, Kermit won't do this unless you ask for
3645    it. If you enable this feature, you need to inform Kermit of the
3646    character set (to be) used on the server and in some cases (explained
3647    below) also the local file character set. This discussion assumes you
3648    know a bit about character sets (as you must if you have to use them);
3649    see Chapter 16 of [332]Using C-Kermit for a detailed treatment. The
3650    Kermit commands for FTP character-set conversion are:
3651
3652    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
3653           Whether to translate character sets when transferring text files
3654           with FTP. OFF by default. Set this to ON to enable character-set
3655           translation for subsequent FTP uploads and downloads.
3656
3657    SET FTP SERVER-CHARACTER-SET [333]name
3658           Text character set (to be) used by the server. Most FTP servers
3659           are ignorant of character sets, so all translations are done
3660           unilaterally by Kermit's FTP client. This means that when
3661           downloading files, you must know in advance the character-set
3662           used in the files you are downloading (and in their names). When
3663           uploading, you must specify the character-set to which local
3664           filenames and text-file contents are to be translated for
3665           transmission to the server. If you SET FTP
3666           CHARACTER-SET-TRANSLATION ON but do not specify an FTP
3667           SERVER-CHARACTER-SET, [334]UTF8 is used, since this is the new
3668           Internet standard international character set; it is upwards
3669           compatible with ASCII and it encompasses most written languages
3670           and therefore does not favor any particular group of people, as
3671           any other default would do. If you SET FTP SERVER-CHARACTER-SET
3672           to something (anything) when FTP CHARACTER-SET TRANSLATION is
3673           OFF, this also sets the latter ON.
3674
3675    SET FILE CHARACTER-SET [335]name
3676           This is the regular Kermit (non-FTP-specific) command for
3677           identifying the character set (to be) used in local text files
3678           and filenames.
3679
3680    TO REITERATE: If you SET FTP CHARACTER-SET TRANSLATION ON but do not
3681    specify an FTP SERVER-CHARACTER-SET, outbound text files are converted
3682    to UTF-8 and inbound text files are assumed to be UTF-8. If this is not
3683    appropriate, be sure to also specify the desired FTP
3684    SERVER-CHARACTER-SET.
3685
3686    You can use "special" (non-ASCII) characters in filenames in all the
3687    client / server file management commands (FTP MKDIR, RMDIR, DIRECTORY,
3688    VDIRECTORY, DELETE, etc), and also in file-transfer commands. When
3689    giving commands such as FTP DIR (RDIR) and FTP PWD (RPWD), the reply is
3690    translated too, so you can read it. In this example, the client and
3691    server use entirely different codes to represent the special characters
3692    of German:
3693
3694   C-Kermit> ftp xyzcorp.de /anonymous
3695   C-Kermit> set ftp server-character-set latin1
3696   C-Kermit> set file character-set german
3697   C-Kermit> rcd Städte
3698   C-Kermit> rpwd
3699   "/pub/ftp/Städte is current directory"
3700   C-Kermit> rdir
3701   -rw-rw----  1 olaf     54018 Jan  6 17:58 Adenbüttel.txt
3702   -rw-rw----  1 ursula     373 Jan  5 15:19 Aßlar.txt
3703   -rw-rw----  1 gisbert    482 Jan  5 15:20 Blowatz.txt
3704   -rw-rw----  1 gudrun     124 Jan  5 15:19 Böblingen.txt
3705   -rw-rw----  1 olga     14348 Jan  7 14:23 Köln.txt
3706
3707    When the client and server file systems use different character sets,
3708    you should take care to use only those characters that the two sets
3709    share in common when creating filenames or text-file contents. For
3710    example, PC code pages contain a lot line- and box-drawing characters,
3711    and sometimes "smart quotes", etc, that are not found in ISO standard
3712    8-bit character sets. You should be especially careful to avoid using
3713    such characters in filenames.
3714
3715    [ [336]C-Kermit Character Sets ]
3716
3717 3.7.1. Character Sets and Uploading
3718
3719    Kermit's PUT and MPUT commands include full file-scanning capabilities,
3720    as described in [337]Section 4. Thus if FTP CHARACTER-SET-TRANSLATION
3721    is ON and your character-set associations are set up appropriately,
3722    Kermit automatically switches on a per-file basis between text and
3723    binary mode, and for each text file between your chosen 7-bit text
3724    character set (e.g. ASCII or ISO 646 German), 8-bit text (e.g. Latin-1
3725    or Japanese EUC), UCS-2, and UTF-8, and converts each of these
3726    automatically to the server character-set, and furthermore
3727    automatically differentiates between the Little and Big Endian forms of
3728    UCS-2, always sending in Big Endian form.
3729
3730      WARNING: It is not advisable to use UCS-2 (or any Unicode
3731      transformation other than UTF-8) "on the wire", i.e. as a server
3732      character set. Most FTP servers are not able to cope with it, since
3733      it contains lots of 0 (NUL) characters. If you do use it, Kermit
3734      does not translate filenames to or from UCS-2, for reasons well
3735      known to C programmers (for example, UNIX APIs assume filename
3736      strings are NUL-terminated). [338]UTF-8 is the preferred (and
3737      standard) Unicode format for the Internet.
3738
3739    FTP character-set translations differ from the regular Kermit ones by
3740    not restricting translations to a file-character-set /
3741    transfer-character-set pair. You can have Kermit's FTP client translate
3742    between any pair of character sets it knows about. You can see the list
3743    of supported character sets by typing either of the following:
3744
3745   set ftp server-character-set ?
3746   set file character-set ?
3747
3748    A typical list looks like this ([339]CLICK HERE for an explanation of
3749    the names):
3750
3751   C-Kermit>set file char ? One of the following:
3752    ascii            cp869-greek       hebrew-7         mazovia-pc
3753    british          cyrillic-iso      hebrew-iso       next-multinational
3754    bulgaria-pc      danish            hp-roman8        norwegian
3755    canadian-french  dec-kanji         hungarian        portuguese
3756    cp1250           dec-multinational iso2022jp-kanji  shift-jis-kanji
3757    cp1251-cyrillic  dg-international  italian          short-koi
3758    cp1252           dutch             jis7-kanji       spanish
3759    cp437            elot927-greek     koi8             swedish
3760    cp850            elot928-greek     koi8r            swiss
3761    cp852            euc-jp            koi8u            ucs2
3762    cp855-cyrillic   finnish           latin1-iso       utf8
3763    cp858            french            latin2-iso
3764    cp862-hebrew     german            latin9-iso
3765    cp866-cyrillic   greek-iso         macintosh-latin
3766   C-Kermit>
3767
3768    Thus you can translate not only between private sets (like PC code
3769    pages) and standard ones (like Latin-1) as in Kermit protocol, but also
3770    between any given pair of private sets (e.g. CP852 and Mazovia). All
3771    conversions go through Unicode as the intermediate character set,
3772    resulting in a minimum of character loss, since Unicode is a superset
3773    of all other character sets known to Kermit.
3774
3775    In addition to the SET commands listed above, the FTP PUT and MPUT
3776    commands include switches that apply only to the current command:
3777
3778    /LOCAL-CHARACTER-SET:name
3779    /SERVER-CHARACTER-SET:name
3780           Use these switches to force a particular translation. These
3781           switches override the global FTP CHARACTER-SET-TRANSLATION and
3782           SERVER-CHARACTER-SET settings and also character-set
3783           differentiation by file scanning for the duration of the PUT or
3784           MPUT command. The file scan is still performed, however, to
3785           determine whether the file is text or binary; thus these
3786           switches do not affect binary files unless you also include the
3787           /TEXT switch to force all files to be treated as text.
3788
3789    In other words, if you include one or both of these switches with a PUT
3790    or MPUT command, they are used. Similarly, the /TRANSPARENT switch
3791    disables character-set translation for the PUT or MPUT command despite
3792    the prevailing FTP CHARACTER-SET-TRANSLATION and SERVER-CHARACTER-SET
3793    settings.
3794
3795    When uploading, the FILE CHARACTER-SET setting is ignored unless you
3796    have forced Kermit not to [340]scan local files by including a /TEXT or
3797    /BINARY switch with your [M]PUT command, or by disabling automatic
3798    text/binary switching in some other way.
3799
3800    Examples:
3801
3802     1. Suppose you have a CP852 (East European) text file that you want to
3803        upload and store in ISO Latin Alphabet 2 encoding:
3804   ftp put /local-char:cp852 /server-char:latin2 magyar.txt
3805
3806     2. Suppose you always want your text files converted to Latin-2 when
3807        uploading with FTP. Then put:
3808   set ftp server-character-set latin2
3809
3810        in your Kermit customization file, and then you can omit the
3811        /SERVER-CHARACTER-SET: switch from your FTP PUT commands:
3812   ftp put /local-char:cp852 magyar.txt
3813
3814     3. Now suppose that all the text files on your PC are written in
3815        Hungarian, but they have a variety of encodings, and you don't want
3816        to have to include the /LOCAL-CHARACTER-SET: switch on every FTP
3817        PUT command, or (more to the point) you want to be able to send a
3818        mixture of these files all at once. Put these commands in your
3819        Kermit customization file:
3820   set ftp server-character-set latin2            ; ISO 8859-2
3821   set file default 7-bit-character-set hungarian ; ISO 646 Hungarian
3822   set file default 8-bit-character-set cp852     ; PC East European Code Page
3823
3824        and now PUT and MPUT will automatically detect and switch among ISO
3825        646 Hungarian, Code Page 852, UTF-8, and UCS-2 encodings,
3826        translating each one to Latin-2 for uploading:
3827   ftp put *.txt
3828
3829    And since binary files are also detected automatically, the latter can
3830    be simplified to:
3831
3832   ftp put *
3833
3834    even when "*" matches a diverse collection of binary and text files,
3835    because translations are skipped automatically for binary files.
3836
3837 3.7.2. Character Sets and Downloading
3838
3839    The commands and switches are the same as for uploading, but automatic
3840    character-set switching works differently, since Kermit can't scan the
3841    server files in advance. Instead, the transfer mode (text or binary) is
3842    based on the filenames; each name is compared with Kermit's list of
3843    text name patterns and binary name patterns. If the name matches a
3844    binary pattern (for example, if the filename is oofa.tar.gz and one of
3845    the filename patterns is "*.gz"), the file is downloaded in binary
3846    mode; otherwise if it matches a text pattern (e.g. oofa.txt matches
3847    "*.txt"), it is transferred in text ("ascii") mode. Otherwise, it is
3848    transferred in the prevailing FTP TYPE.
3849
3850    In C-Kermit 8.0, the pattern lists used with FTP GET are not the same
3851    lists used with Kermit transfers, and can not be viewed with SHOW
3852    PATTERNS, nor adjusted with ADD and REMOVE TEXT-PATTERNS and
3853    BINARY-PATTERNS, or SET FILE TEXT-PATTERNS and BINARY-PATTERNS.
3854    Configuration of the FTP patterns list will be added in a future
3855    release.
3856
3857    Examples:
3858
3859    get /server-char:latin1 /local-char:cp850 Grüße.txt
3860           In this command, the filename contains special characters, which
3861           you enter using whatever character set your local computer uses,
3862           in this case PC Code Page 850 (cp850). The command tells Kermit
3863           (in case it didn't know already from its FILE CHARACTER-SET
3864           setting) that the local character set is cp850 and the server's
3865           character-set is ISO 8859-1 Latin Alphabet 1 (latin1). Kermit
3866           translates the filename from cp850 to latin1 and sends the
3867           latin1 name to the server. Since it's a text file (matches
3868           "*.txt"), its contents are translated to cp850 on arrival, and
3869           it is saved with a cp850 name.
3870
3871    mget /text /server:latin1 /local:utf8 *.txt
3872           This command:
3873
3874           + Tells C-Kermit that the server's files are encoded in ISO
3875             8859-1 Latin Alphabet 1.
3876           + Tells C-Kermit to translate the incoming files into Unicode
3877             UTF-8 for storage.
3878           + Asks the server to send all ".txt" files in text mode.
3879
3880    mget /server:latin1 /local:utf8 *
3881           Tells Kermit to get all files from the server's directory,
3882           switching between text and binary mode based on the filename.
3883           The names of all the files are translated (to UTF-8 in this
3884           case), but contents are translated (also to UTF-8) only for text
3885           files.
3886
3887    Note that any pair of 8-bit character sets is likely to have some
3888    incompatibilities. Any characters in the source file that do not have
3889    equivalents in the destination file's character set are converted to
3890    question marks. This applies to both filenames and to text file
3891    contents.
3892
3893    Also note that the server's ability to accept special characters in
3894    filenames depends on the particular server. For example:
3895
3896   get Grüße.txt
3897
3898    works with WU-FTPD, but:
3899
3900   mget Grüß*.txt
3901
3902    does not.
3903
3904 3.7.3. RFC2640
3905
3906    [341]RFC2640, July 1999, specifies a method by which the FTP client and
3907    server can negotiate the use of UTF8. However, RFC2640-capable servers
3908    are rare to nonexistent at this writing, and in any case you don't need
3909    them to be able to transfer text in UTF8. C-Kermit lets you upload and
3910    download text files in any character set it knows about, converting to
3911    or from any other character set it knows about, without the knowledge,
3912    permission, or cooperation of the server, and regardless of its
3913    capabilities.
3914
3915    [ [342]Top ] [ [343]FTP Top ] [ [344]C-Kermit Home ] [ [345]Kermit Home
3916    ]
3917
3918 3.8. FTP Command Shortcuts
3919
3920    C-Kermit's FTP client coexists with other C-Kermit functions by
3921    requiring the "ftp" prefix for each FTP-related command: FTP OPEN, FTP
3922    GET, FTP BYE, and so on. For interactive use, however, this can be
3923    rather awkward and sometimes surprising, for example when a GET command
3924    starts a Kermit GET rather than an FTP GET. In fact, many Kermit
3925    commands might just as easily apply to an FTP connection: GET, PUT
3926    (SEND), BYE, and CLOSE. The following command lets you choose how these
3927    commands are interpreted:
3928
3929    SET GET-PUT-REMOTE { AUTO, KERMIT, FTP }
3930           Controls the orientation of GET, PUT, REMOTE and other
3931           file-transfer and client/server commands that might apply to
3932           either Kermit or FTP. The default setting is AUTO, meaning that
3933           these commands apply to FTP if an FTP connection is open, and to
3934           Kermit otherwise. KERMIT means they always apply to Kermit, FTP
3935           means they always apply to FTP.
3936
3937    Here is a complete list of affected commands:
3938
3939  Kermit Command               FTP Equivalent
3940   (none)                       FTP [ OPEN ]
3941   LOGIN                        FTP USER
3942   LOGOUT                       FTP RESET
3943   BYE                          FTP BYE
3944   FINISH                       FTP BYE
3945   CLOSE                        FTP BYE
3946   HANGUP                       FTP BYE
3947   BINARY                       FTP TYPE BINARY
3948   TEXT (or ASCII)              FTP TYPE ASCII
3949   SEND (or PUT)                FTP PUT
3950   MSEND (or MPUT)              FTP MPUT
3951   RESEND                       FTP PUT /RECOVER
3952   CSEND                        FTP PUT /COMMAND
3953   GET                          FTP GET
3954   MGET                         FTP MGET
3955   REGET                        FTP GET /RECOVER
3956   REMOTE HELP      (RHELP)     FTP HELP
3957   REMOTE CD        (RCD)       FTP CD (CWD)
3958   REMOTE PWD       (RPWD)      FTP PWD
3959   REMOTE DIRECTORY (RDIR)      FTP DIRECTORY
3960   REMOTE DELETE    (RDEL)      FTP DELETE
3961   REMOTE MKDIR     (RMKDIR)    FTP MKDIR
3962   REMOTE RMDIR     (RRMDIR)    FTP RMDIR
3963   REMOTE RENAME    (RRENAME)   FTP RENAME
3964   REMOTE TYPE      (RTYPE)     FTP TYPE
3965   REMOTE EXIT      (REXIT)     FTP BYE
3966
3967    The commands in the right-hand column always accesss FTP. The commands
3968    in the left column can accesss either Kermit protocol or FTP:
3969
3970      * When GET-PUT-REMOTE is set to KERMIT, or to AUTO when there is no
3971        FTP connection, the commands in the left-hand column accesss Kermit
3972        protocol, and those right-hand column are required for FTP.
3973      * When GET-PUT-REMOTE is set to FTP, or to AUTO when there is an
3974        active FTP connection, the commands in the left-hand column accesss
3975        the FTP connection and can not be used to accesss Kermit protocol.
3976        In this case, if you want to be able to use both Kermit protocol
3977        and the FTP connection, you must SET GET-PUT-REMOTE KERMIT, and
3978        then use the FTP commands in the right-hand column to accesss the
3979        FTP connection.
3980
3981    Note that file-management commands such as DIRECTORY, DELETE, CD, PWD,
3982    MKDIR, RMDIR, HELP, RENAME, COPY, TYPE, and so on, always apply
3983    locally, no matter what kind of connection you have. This is the
3984    opposite of most FTP clients, where these commands are intended for the
3985    server, and require an "L" prefix for local execution (e.g. "dir" gets
3986    a directory listing from the server, "ldir" gets a local directory
3987    listing). To illustrate with the CD command and a typical UNIX FTP
3988    client:
3989
3990  Client   Server      Change Local Directory     Change Remote Directory
3991   FTP      FTP         lcd                        cd (cwd)
3992   Kermit   Kermit      cd                         rcd, remote cd
3993   Kermit   FTP         cd                         ftp cd, rcd, remote cd
3994
3995    Also note that not all REMOTE commands are useful with FTP, since FTP
3996    servers do not offer the corresponding functions. These include:
3997
3998      * REMOTE ASSIGN  - FTP servers don't have variables
3999      * REMOTE COPY    - FTP servers don't copy files
4000      * REMOTE HOST    - FTP servers don't execute host (shell) commands
4001      * REMOTE KERMIT  - FTP servers don't execute Kermit commands
4002      * REMOTE PRINT   - FTP servers don't print files
4003      * REMOTE QUERY   - FTP servers don't have variables
4004      * REMOTE SET     - FTP servers don't have Kermit settings
4005      * REMOTE WHO     - FTP servers don't send user lists
4006
4007    Finally note that command shortcuts do not apply to the HELP command.
4008    For help about an FTP command, use (for example) "help ftp delete", not
4009    "help delete" or "help rdelete".
4010
4011    [ [346]Top ] [ [347]FTP Top ] [ [348]C-Kermit Home ] [ [349]Kermit Home
4012    ]
4013
4014 3.9. Dual Sessions
4015
4016    You can have an FTP session open at the same time as a regular Kermit
4017    SET LINE or SET HOST (terminal) session. In this case, the default SET
4018    GET-PUT-REMOTE AUTO setting should ensure that all "two-faced" commands
4019    like GET, PUT, REMOTE, HANGUP, BYE, etc, apply to the Kermit session,
4020    and all commands for the FTP session must include the FTP prefix. To be
4021    absolutely certain, you can use SET GET-PUT-REMOTE KERMIT.
4022
4023   ftp foo.bar.baz.com
4024   if fail ...
4025   (log in)
4026   set host foo.bar.baz.com
4027   if fail ...
4028   (log in)
4029
4030    Now you have both an FTP and Telnet connection to the same host (of
4031    course they could also be to different hosts, and you could also have a
4032    direct or dialed serial connection instead of a Telnet connection). Now
4033    assuming you have a Kermit server on the far end of the Kermit
4034    connection:
4035
4036   rcd incoming      ; Changes Kermit server's directory (= REMOTE CD)
4037   ftp cd incoming   ; Changes FTP server's directory
4038   put oofa.txt      ; Sends a file on the Kermit connection
4039   ftp put oofa.txt  ; Sends a file on the FTP connection
4040   bye               ; Shuts down the Kermit connection
4041   ftp bye           ; Shuts down the FTP connection
4042
4043    Note that PUT and SEND are synonyms for both FTP and Kermit
4044    connections.
4045
4046    You can also establish dual sessions on the Kermit command line:
4047
4048   kermit -j host1 -9 host2
4049
4050    This makes a Telnet connection to host1 and an FTP connection to host2.
4051
4052    [ [350]Top ] [ [351]FTP Top ] [ [352]C-Kermit Home ] [ [353]Kermit Home
4053    ]
4054
4055 3.10. Automating FTP Sessions
4056
4057    Most of Kermit's scripting features can be used to make and control FTP
4058    sessions: FOR and WHILE loops, IF-ELSE and SWITCH constructions,
4059    variables, arrays, built-in functions, and all the rest. You can't use
4060    INPUT, MINPUT, OUTPUT, CLEAR, or SCRIPT on an FTP session, but these
4061    are not needed since the FTP protocol is well defined.
4062
4063    [354]CLICK HERE for an FTP scripting tutorial.
4064
4065 3.10.1. FTP-Specific Variables and Functions
4066
4067    The following variable tells whether an FTP connection is open:
4068
4069    \v(ftp_connected)
4070           1 if there is an active FTP connection, 0 if there isn't.
4071
4072    The FTP OPEN command sets:
4073
4074    \v(ftp_host)
4075           The host to which the most recent FTP connection was made.
4076
4077    \v(ftp_security)
4078           The security method negotiated for the current FTP session. The
4079           value is "NULL" when no security is used. Other possibilities
4080           are GSSAPI, KERBEROS_V4, SSL, TLS, and SRP. Also see
4081           \v(authname), \v(authstate), and \v(authtype). See [355]3.2.
4082           Making Secure FTP Connections.
4083
4084    \v(ftp_server)
4085           The OS type (UNIX, VMS, etc) of the FTP server host.
4086
4087    The FTP USER command (or FTP OPEN /USER:, or FTP with automatic login)
4088    sets:
4089
4090    \v(ftp_loggedin)
4091           1 if you are logged in to an FTP server, 0 if you are not.
4092
4093    The current COMMAND-PROTECTION-LEVEL and DATA-PROTECTION-LEVEL values
4094    are reflected in:
4095
4096    \v(ftp_cpl)
4097    \v(ftp_dpl)
4098           The values are "clear", "confidential", "safe" or "private". See
4099           [356]3.2. Making Secure FTP Connections.
4100
4101    The FTP GET-PUT-REMOTE setting is reflected in:
4102
4103    \v(ftp_getputremote)
4104           The values are "auto", "ftp", or "kermit".
4105
4106    Every FTP command sets the \v(success) variable, as well as the
4107    following two FTP-specific variables:
4108
4109    \v(ftp_code)
4110           The standardized numeric FTP protocol code from the server's
4111           response to the last client command, a 3-digit decimal number
4112           defined in [357]RFC959. Briefly:
4113
4114           1xx = Positive Preliminary Reply
4115           2xx = Positive Completion Reply
4116           3xx = Positive Intermediate Reply
4117           4xx = Transient Negative Completion Reply
4118           5xx = Permanent Negative Completion Reply
4119
4120    \v(ftp_message)
4121           The text message, if any, from the server's response to the last
4122           client command. If the most recent response had multiple lines,
4123           this variable has only the final line. These messages are not
4124           standardized and vary in format and content from server to
4125           server. Synonym: \v(ftp_msg).
4126
4127    FTP file transfers set the regular Kermit transfer status variables:
4128
4129   \v(cps)         Characters per second of most recent transfer.
4130   \v(filespec)    File specification used in most recent transfer.
4131   \v(fsize)       Size of file most recently transferred.
4132   \v(tfsize)      Total size of file group most recently transferred.
4133   \v(xferstatus)  Status of most recent transfer (0 = success, 1 = failure).
4134   \v(tftime)      Elapsed time of most recent transfer, in seconds.
4135
4136    During an FTP transfer, the per-file variables are:
4137
4138   \v(filename)    Name of current file.
4139   \v(filenumber)  Ordinal file number in group (1, 2, 3, ...)
4140
4141 3.10.2. Examples
4142
4143    Let's begin with a simple example showing how to log in, send some
4144    files, and log out:
4145
4146   define error if fail { ftp bye, stop 1 Error: \%1 }
4147   set transact brief
4148   log t
4149   ftp ftp.xyzcorp.com /anonymous
4150   if fail stop 1 Connection failed
4151   if not \v(ftp_loggedin) stop 1 Login failed
4152   ftp cd incoming
4153   error {ftp cd}
4154   cd upload
4155   error {local cd}
4156   ftp put /delete *
4157   error {put}
4158   ftp bye
4159
4160    First we define an error handling macro to be used after the connection
4161    is made. Then we set up a brief-format transaction log to keep a record
4162    of our file transfers. Then we make a connection to the host and log in
4163    anonymously. The "if fail" command checks whether the connection was
4164    made. The "if not" command checks whether login was successful.
4165    Obviously the script should not continue unless both tests succeed.
4166
4167    Next we change to the server's 'incoming' directory and to our own
4168    'upload' directory, and send all the files that are in it (they can be
4169    any mixture of text and binary files), deleting each source file
4170    automatically after it is successfully uploaded. Each of these
4171    operations is checked with the ERROR macro, which prevents the script
4172    from continuing past a failure.
4173
4174    Finally we close the FTP session with the "bye" command.
4175
4176    Just like any other Kermit script, this one can be used in many ways:
4177
4178      * It can be stored in a file, and Kermit can be told to TAKE the
4179        file.
4180      * In UNIX, it can be a "[358]kerbang" script and therefore run
4181        directly from the shell prompt or as a cron job.
4182
4183    We could have used command shortcuts like "rcd", "put", and "bye", but
4184    since they can be ambiguous under certain circumstances, it is better
4185    to avoid them in scripts; they are intended mainly for convenience
4186    during interactive use. However, if you wish to use the shortcuts in a
4187    script, you can do it this way (error handling omitted for brevity):
4188
4189   local \%t                       ; Declare a local temporary variable
4190   assign \%t \v(ftp_getputremote) ; Save current FTP GET-PUT-REMOTE setting
4191   set ftp get-put-remote ftp      ; Choose FTP orientation
4192   ftp xyzcorp.com /anonymous      ; Open an FTP connection
4193   get oofa.txt                    ; GET a file
4194   put foo.bar                     ; PUT a file
4195   rdel yesterday.log              ; Delete a file on the server
4196   bye                             ; Log out and disconnect from server.
4197   set ftp get-put-remote \%t      ; Restore previous GET-PUT-REMOTE setting
4198
4199    Of course, FTP scripts can also be written as macros. This lets you
4200    pass parameters such as hostnames, usernames, and filenames to them:
4201
4202   define doftpget {
4203       if < \v(argc) 4 end 1 Usage: \%0 host user remotefile [ localfile ]
4204       ftp \%1 /user:\%2
4205       if fail end 1 FTP OPEN \%1 failed
4206       if not \v(ftp_loggedin) end 1 FTP LOGIN failed
4207       ftp get {\%3} {\%4}
4208       if fail end 1 FTP GET \%3 failed
4209       ftp bye
4210   }
4211
4212    Add this definition to your Kermit customization file, and it will
4213    always be available when you start Kermit. This macro lets you download
4214    a file with FTP by giving a single command, e.g.:
4215
4216   doftpget xyzcorp.com anonymous oofa.txt
4217
4218 3.10.3. Automating Secure FTP Sessions
4219
4220    Often when making secure connections, you are prompted interactively
4221    for certain information or permission to proceed. These prompts can
4222    stop an automated procedure. To avoid them, you must give the
4223    appropriate commands to disable them, and/or supply the prompted-for
4224    information beforehand. Here are a few hints:
4225
4226      * Make sure that SET TAKE ERROR and SET MACRO ERROR are both OFF.
4227        This is the default, but in case you have set either one of these
4228        ON in your script or initialization file, this makes the script
4229        halt on any kind of error. Normally you would want to check each
4230        operation for success or failure and take appropriate action.
4231      * On SSL and TLS connections, you may be asked whether it is OK to
4232        proceed with a connection to server that presents a self-signed
4233        certificate. You can use the SET AUTHENTICATION SSL (or TLS) VERIFY
4234        or SET AUTH SSL (or TLS) CERTS-OK commands to avoid this prompt by
4235        not requesting a certificate from the peer.
4236      * (More to be added...)
4237
4238    [ [359]Top ] [ [360]FTP Top ] [ [361]FTP Script Tutorial ] [
4239    [362]C-Kermit Home ] [ [363]Kermit Home ]
4240
4241 3.11. Advanced FTP Protocol Features
4242
4243    The remainder of the FTP documentation (through the end of Section 3)
4244    is new to C-Kermit 8.0.206, but we leave it in black to prevent
4245    headaches. Except for titles.
4246      * [364]TERMINOLOGY
4247      * [365]FEATURE NEGOTIATION
4248      * [366]USING MGET: NLST VERSUS MLSD
4249      * [367]EXAMPLES
4250      * [368]REFERENCES
4251
4252    The new releases of [369]C-Kermit (8.0.206) and [370]Kermit 95 (2.1)
4253    support new FTP protocol features from RFC 2389 as well as most of
4254    what's in the Elz and Hethmon Extensions to FTP Internet Draft (see
4255    [371]References). Some of these features, such as SIZE (request a
4256    file's size), MDTM (request file's modification time), and REST
4257    (restart interrupted transfer) have been widely implemented in FTP
4258    clients and servers for years (as well as in the initial release of the
4259    Kermit FTP clients). Others such as FEAT and MLSD are rarely seen and
4260    are new to the upcoming Kermit releases. TVFS (Trivial Virtual File
4261    Store) is supported implicitly, and the UTF-8 character-set is already
4262    fully supported at the protocol and data-interchange level.
4263
4264    For Kermit users, the main benefit of the new FTP protocol extensions
4265    is the ability to do recursive downloads. But the extensions also
4266    introduce complications and tradeoffs that you should be aware of. Of
4267    course Kermit tries to "do the right thing" automatically in every case
4268    for backwards compatibility. But (as noted later) some cases are
4269    inherently ambiguous and/or can result in nasty surprises, and for
4270    those situations new commands and switches are available to give you
4271    precise control over Kermit's behavior, in case the defaults don't
4272    produce the desired results.
4273
4274 3.11.1. Terminology
4275
4276    Command-line FTP clients such as Kermit (as well as the traditional FTP
4277    programs found on Unix, VMS, ..., even Windows) have commands like PUT,
4278    MPUT, GET, MGET, and BYE, which they convert into zero or more FTP
4279    protocol commands, such as NLST, RETR, QUIT. For clarity, we'll use
4280    "command" to refer to commands given by the user to the FTP client, and
4281    "directive" for FTP protocol commands sent by the FTP client to the FTP
4282    server.
4283
4284 3.11.2. Feature Negotiation
4285
4286    New FTP protocol features are negotiated by the client sending a FEAT
4287    directive and the server responding with a list of (new) features it
4288    supports, or else with an error indication if it does not support the
4289    FEAT directive at all, in which case the client has to guess which new
4290    features it supports (Kermit guesses that it supports SIZE and MDTM but
4291    not MLST). Note that the MLST feature includes MLSD, which is not
4292    listed separately as a feature.
4293
4294    Guessing is nice when it works, but sometimes it doesn't, and some FTP
4295    servers become confused when you send them a directive they don't
4296    understand, or they do something you didn't want, sometimes to the
4297    point of closing the connection. For this reason, Kermit lets you
4298    override default or negotiated features with the following new
4299    commands:
4300
4301    FTP { ENABLE, DISABLE } FEAT
4302           Enables or disables the automatic sending of a FEAT directive
4303           upon connection to an FTP server. Note that FTP [ OPEN ] /NOINIT
4304             also inhibits sending the FEAT directive (and several others)
4305           for the connection being OPEN'd, but without necessarily
4306           disabling FEAT for subsequent connections in the same Kermit
4307           instance. FEAT is ENABLED by default, in which case many FTP
4308           servers are likely to reply:
4309
4310 500 'FEAT': command not understood
4311
4312           which is normally harmless (but you never know). (In C-Kermit
4313           8.0.208, this error message is suppressed unless you SET FTP
4314           DEBUG ON.)
4315
4316    FTP ENABLE { MDTM, MLST, SIZE }
4317           Enables the given directive for implicit use by the FTP GET and
4318           MGET commands in case it has been disabled or erroneously
4319           omitted by the server in its FEAT response. Note: MLSD can be
4320           used in the FTP ENABLE and DISABLE commands as a synonym for
4321           MLST. YOU MUST GIVE THIS COMMAND AFTER MAKING THE FTP
4322           CONNECTION.
4323
4324    FTP DISABLE { MDTM, MLST, SIZE }
4325           Disables implicit use of the given directive by GET or MGET in
4326           case it causes problems; for example, because it makes multifile
4327           downloads take too long or the server announces it erroneously
4328           or misimplements it. Use DISABLE FEAT before making a connection
4329           to prevent Kermit from sending the FEAT directive as part of its
4330           initial sequence. Note that disabling FEAT, SIZE, or MDTM does
4331           not prevent you from executing explicit FTP FEATURES, FTP SIZE,
4332           or FTP MODTIME commands. Also note that disabling SIZE prevents
4333           PUT /RESTART (recovery of interrupted uploads) from working. YOU
4334           MUST GIVE THIS COMMAND AFTER MAKING THE FTP CONNECTION.
4335
4336    To enable or disable more than one feature, use multiple FTP ENABLE or
4337    FTP DISABLE commands. The SHOW FTP command shows which features are
4338    currently enabled and disabled.
4339
4340    FTP FEATURES
4341           This command sends a FEAT directive to the server. In case you
4342           have been disabling and enabling different features, this
4343           resynchronizes Kermit's feature list with the server's. If the
4344           server does not support the FEAT directive, Kermit's feature
4345           list is not changed.
4346
4347    FTP OPTIONS directive
4348           Informational only: the server tells what options, if any, it
4349           supports for the given directive, e.g. MLST. Fails if the server
4350           does not support the OPTS directive or if the directive for
4351           which options are requested is not valid. The directive is
4352           case-insensitive.
4353
4354    FTP SIZE filename
4355           Sends a SIZE directive to the server for the given file. The
4356           filename must not contain wildcards. The server responds with an
4357           error if the file can't be found, is not accesssible, or the
4358           SIZE directive is not supported, otherwise with the length of
4359           the file in bytes, which Kermit displays and also makes
4360           available to you in its \v(ftp_message) variable. If the
4361           directive is successful, Kermit (re-)enables it for internal use
4362           by the GET and MGET directives on this connection.
4363
4364    FTP MODTIME filename
4365           Works just like the SIZE directive except it sends an MDTM
4366           directive. Upon success, the server sends modification date-time
4367           string, which Kermit interprets for you and also makes available
4368           in its \v(ftp_message) variable.
4369
4370    Whenever a SIZE or MDTM directive is sent implicitly and rejected by
4371    the server because it is unknown, Kermit automatically disables it.
4372
4373 3.11.3. Using MGET: NLST versus MLSD
4374
4375    When you give an MGET command to an FTP client, it sends a request to
4376    the FTP server for a list of files, and then upon successful receipt of
4377    the list, goes through it and issues a RETR (retrieve) directive for
4378    each file on the list (or possibly only for selected files).
4379
4380    With the new FTP protocol extensions, now there are two ways to get the
4381    list of files: the NLST directive, which has been part of FTP protocol
4382    since the beginning, and the new MLSD directive, which is new and not
4383    yet widely implemented. When NLST is used and you give a command like
4384    "mget *.txt", the FTP client sends:
4385
4386 NLST *.txt
4387
4388    and the server sends back a list of the files whose names match, e.g.
4389
4390 foo.txt
4391 bar.txt
4392 baz.txt
4393
4394    Then when downloading each file, the client sends SIZE (if it wants
4395    have a percent-done display) and MDTM (if it wants to set the
4396    downloaded file's timestamp to match that of the original), as well as
4397    RETR (to retrieve the file).
4398
4399    But when MLSD is used, the client is not supposed to send the filename
4400    or wildcard to the server; instead it sends an MLSD directive with no
4401    argument (or the name of a directory), and the server sends back a list
4402    of all the files in the current or given directory; then the client
4403    goes through the list and checks each file to see if it matches the
4404    given pattern, the rationale being that the user knows only the local
4405    conventions for wildcards and not necessarily the server's conventions.
4406    So with NLST the server interprets wildcards; with MLSD the client
4407    does.
4408
4409      The interpretation of NLST wildcards by the server is not
4410      necessarily required or even envisioned by the FTP protocol
4411      definition (RFC 959), but in practice most clients and servers work
4412      this way.
4413
4414    The principal advantage of MLSD is that instead of sending back a
4415    simple list of filenames, it sends back a kind of database in which
4416    each entry contains a filename together with information about the
4417    file: type, size, timestamp, and so on; for example:
4418
4419 size=0;type=dir;perm=el;modify=20020409191530; bin
4420 size=3919312;type=file;perm=r;modify=20000310140400; bar.txt
4421 size=6686176;type=file;perm=r;modify=20001215181000; baz.txt
4422 size=3820092;type=file;perm=r;modify=20000310140300; foo.txt
4423 size=27439;type=file;perm=r;modify=20020923151312; foo.zip
4424 (etc etc...)
4425
4426    (If the format of the file list were the only difference between NLST
4427    and MLSD, the discussion would be finished: it would always be better
4428    to use MLSD when available, and the MGET user interface would need no
4429    changes. But there's a lot more to MLSD than the file-list format; read
4430    on...)
4431
4432    The client learns whether the server supports MLSD in FEAT exchange.
4433    But the fact that the server supports MLSD doesn't mean the client
4434    should always use it. It is better to use MLSD:
4435
4436      * On connections where the server imposes a time penalty for every
4437        command, e.g. the Red Hat Rawhide server. With MLSD, the client
4438        needs to send only one command (RETR) per file, whereas NLST
4439        requires three (SIZE, RETR, and MDTM). Suppose there is a 30-second
4440        delay for each command and 1000 files are to be fetched; in that
4441        case, MLSD saves 60,000 seconds = 1000 minutes = 16 hours and 40
4442        minutes.
4443      * For recursive downloads since there is no dependable way to
4444        download directory trees with NLST.
4445
4446    But it is better to use NLST:
4447
4448      * If you want only a couple short files out of a large directory. In
4449        this case, NLST is the better choice since the server sends a list
4450        of only the files you want, not a list of (say) a million files,
4451        which can make a big difference on slow connections. For example,
4452        suppose your wildcard matches three files of 1K each, but the
4453        million-file listing is 80MB long, and your connection is through a
4454        modem. The overhead of using MLSD is practically infinite.
4455      * If the server supports wildcarding features not known to the
4456        client, but that can be used to achieve desirable effects otherwise
4457        unobtainable, such as "[dir...]*.txt" in VMS or AOS/VS "except"
4458        clauses.
4459      * If you have been given a wildcard string by an FTP site
4460        administrator for fetching a specific group of files out of a
4461        larger directory, e.g. "mget ck[cuw]*.[cwh] makefile", that is
4462        expected to work with any client (an FTP site administrator can't
4463        be expected to know the wildcard syntax of every FTP client).
4464
4465    But when using MLSD there are complications:
4466
4467      * MLSD wants either a blank argument (meaning the current directory)
4468        or else the name of a specific directory. The client must not send
4469        it a wildcard or a filename.
4470      * But if the user's command is "mget xxx", how does the client know
4471        whether to send "xxx" in the MLSD directive? It might be the name
4472        of a directory on on the server, in which case it should be sent,
4473        or it might be the name of a file on the server (or a wildcard), in
4474        which case it must not be sent. Since the client knows its own
4475        wildcard syntax, then in most cases it would be right to send
4476        "MLSD" with no argument if xxx is wild, and to send "MLSD xxx" if
4477        it is not.
4478      * But suppose the server's file system allows filename characters
4479        that correspond with the client's wildcard syntax? For example:
4480        "[abc]" could be either a valid VMS directory name or a wildcard
4481        pattern used by the FTP client. What should the client do with
4482        "mget [abc]"? In this case there must be a way for the user to
4483        force sending the MGET argument as the MLSD argument.
4484      * If "xxx" is a regular file in the server's current directory, "mget
4485        xxx" works with NLST but not with MLSD.
4486
4487    To further complicate matters, NLST can (in theory) work just like
4488    MLSD: if sent with a blank argument or a directory name, it is supposed
4489    to return a complete list of files in the current or given directory,
4490    which the client can match locally against some pattern. It is not
4491    known if any FTP server or client does this but nevertheless, it should
4492    be possible since this behavior can be inferred from RFC 959.
4493
4494    In view of these considerations, and given the need to preserve the
4495    traditional FTP client command structure and behavior so the software
4496    will be usable by most people:
4497
4498     1. The MGET command should produce the expected result in the common
4499        cases, regardless of whether NLST or MLSD is used underneath.
4500     2. For anomalous cases, the user needs a way to control whether the
4501        MGET argument is sent to the server or kept for local use.
4502     3. At the same time, the user might need a way to send a directory
4503        name to the server, independent of any wildcard pattern.
4504     4. The user needs a way to force NLST or MLSD for a given MGET
4505        command.
4506
4507    By default, Kermit's MGET command uses MLSD if MLST is reported by the
4508    server in its FEAT list. When MLSD is used, the filespec is sent to the
4509    server if it is not wild (according to Kermit's own definition of
4510    "wild" since it can't possibly know the server's definition). If the
4511    filespec is wild it is held for local use to select files from the list
4512    returned by the server. If MLST is not reported by the server or is
4513    disabled, Kermit sends the MGET filespec with the NLST directive.
4514
4515    The default behavior can be overridden globally with FTP DISABLE MLST,
4516    which forces Kermit to use NLST to get file lists. And then for
4517    situations in which MLSD is enabled, the following MGET switches can be
4518    used to override the defaults for a specific MGET operation:
4519
4520    /NLST
4521           Forces the client to send NLST. Example:
4522
4523 mget /nlst foo.*
4524
4525    /MLSD
4526           Forces the client to send MLSD (even if MLST is disabled).
4527           Example:
4528
4529 mget /mlsd foo.*
4530
4531    /MATCH:pattern
4532           When this switch is given, it forces the client to hold the
4533           pattern for local use against the returned file list. If a
4534           remote filespec is also given (e.g. the "blah" in "mget
4535           /match:*.txt blah"), then it is sent as the NLST or MLSD
4536           argument, presumably to specify the directory whose files are to
4537           be listed. When the /MATCH switch is not given, the MGET
4538           filespec is sent to the server if the directive is NLST or if
4539           the filespec is not wild. Examples:
4540
4541   Command:                   With NLST:     With MLSD:
4542     mget                      NLST           MLSD
4543     mget *.txt                NLST *.txt     MLSD
4544     mget foo                  NLST foo       MLSD foo
4545     mget /match:*.txt         NLST           MLSD
4546     mget /match:*.txt foo     NLST foo       MLSD foo
4547
4548    In other words, the pattern is always interpreted locally unless MGET
4549    uses NLST and no /MATCH switch was given.
4550
4551 3.11.4. Examples
4552
4553 3.11.4.1. Downloading a Single File
4554
4555    There are no choices here, just use the FTP GET command. Kermit always
4556    sends the RETR directive, and possibly SIZE and/or MDTM. The small
4557    advantage of using MLST in this case is outweighed by the risk and
4558    effort of coding a special case.
4559
4560 3.11.4.2. Downloading a Group of Files from a Single Directory
4561
4562    This case presents tradeoffs, especially on slow connections:
4563
4564      * For downloading all or most of the files in a directory, MLSD is
4565        better because it eliminates the need to send SIZE and MDTM for
4566        each file. No special actions are required in this case; Kermit
4567        uses MLSD automatically if the server supports it (unless you have
4568        disabled it).
4569      * For a small number of files from a large directory, NLST is better
4570        because it bypasses downloading of a potentially huge file list
4571        prior to the files themselves. If you have a connection to a server
4572        that supports MLSD, use the /NLST switch to force NLST:
4573
4574 mget /nlst t[1234].h
4575
4576      * If the server supports MLSD but does not support separate SIZE or
4577        MDTM directives, and you need the size and/or timestamp
4578        information, MLSD is better; no special actions required.
4579      * If the server supports MLSD but does not support the "size" and
4580        "modify" facts, but it does support the SIZE or MDTM directives,
4581        and you need the size and/or timestamp information, NLST is better.
4582
4583 3.11.4.3. Downloading a Directory Tree
4584
4585    MLSD is the only choice for recursive downloads; they rarely, if ever,
4586    work with NLST (the few cases where they do work rely on extra-protocol
4587    "secret" notations for the NLST argument). No special actions are
4588    required to force MLSD when the server supports it, unless you have
4589    disabled it. Examples:
4590
4591    MGET /RECURSIVE
4592           This tells the server to send all files and directories in the
4593           tree rooted at its current directory.
4594
4595    MGET /RECURSIVE *.txt
4596           This tells the server to send all *.txt files in the tree rooted
4597           at its current directory.
4598
4599    MGET /MLSD /RECURSIVE *.txt
4600           Same as the previous example but forces Kermit to send MLSD in
4601           case it was disabled, or in case the server is known to support
4602           it even though it did not announce it in its FEAT listing.
4603
4604    MGET /RECURSIVE /MATCH:*.zip archives
4605           Tells the server to send all ZIP files in the tree rooted at its
4606           "archives" directory.
4607
4608    MGET /RECURSIVE /MATCH:* [abc]
4609           The server is running on VMS and you want it to send all the
4610           files in the directory tree rooted at [ABC]. But since "[abc]"
4611           looks just like a wildcard, you have to include a /MATCH: switch
4612           to force Kermit to send "[abc]" as the MLSD argument.
4613
4614    In all cases in which the /RECURSIVE switch is included, the server's
4615    tree is duplicated locally.
4616
4617      Although MLSD allows recursion and NLST does not, the MLSD
4618      specification places a heavy burden on the client; the obvious,
4619      straightforward, and elegant implementation (depth-first, the one
4620      that Kermit currently uses) requires as many open temporary files as
4621      the server's directory tree is deep, and therefore client resource
4622      exhaustion -- e.g. exceeding the maximum number of open files -- is
4623      a danger. Unfortunately MLSD was not designed with recursion in
4624      mind. (Breadth-first traversal could be problematic due to lack of
4625      sufficient navigation information.)
4626
4627    Of course all of Kermit's other MGET switches can be used too, e.g. for
4628    finer-grained file selection (by date, size, etc), for moving or
4629    renaming files as they arrive, to override Kermit's automatic per-file
4630    text/binary mode switching, to pass the incoming files through a
4631    filter, to convert text-file character sets, and so on.
4632
4633 3.11.4.4. NLST/MLSD Summary Table
4634
4635    Here's a table summarizing MGET behavior when the server supports both
4636    NLST and MLSD. /NLST and /MLSD switches are included for clarity to
4637    indicate which protocol is being used, and the expected effects. In
4638    practice you can omit the /NLST and /MLSD switches and the Kermit
4639    client chooses the appropriate or desired protocol as described above.
4640    Sample commands presume a Unix file system on the server, but of course
4641    the server can have any file system or syntax at all.
4642
4643    User's Command FTP Sends Remarks
4644    mget /nlst NLST Gets a list of all the files in the server's current
4645    and downloads each file. The list includes names only, so Kermit also
4646    must send SIZE and MDTM directives if size and timestamp information is
4647    required (this is always true of NLST). Sending NLST without an
4648    argument is allowed by the RFC959 NLST definition and by the Kermit FTP
4649    client, but might not work with other clients, and also might not work
4650    with every server.
4651    mget /nlst foo NLST foo If "foo" is a directory, this gets a list of
4652    all the files from the server's "foo" directory and downloads each
4653    file; otherwise this downloads the file named "foo" (if any) from the
4654    server's current directory.
4655    mget /nlst *.txt NLST *.txt Gets a list of the files in the server's
4656    current directory whose names match the pattern *.txt, and then
4657    downloads each file from the list. Because we are using NLST, we send
4658    the filespec (*.txt) to the server and the server interprets any
4659    wildcards.
4660    mget /nlst foo/*.txt NLST foo/*.txt  Gets a list of the files in the
4661    server's "foo" directory whose names match the pattern *.txt, and then
4662    downloads each file from the list (server interprets wildcards).
4663    mget /nlst /match:*.txt NLST Gets a list of all the files in the
4664    server's current directory and then downloads each one whose name
4665    matches the pattern *.txt (client interprets wildcards).
4666    mget /nlst /match:*.txt foo  NLST foo Gets a list of all the files in
4667    the server's "foo" directory and then downloads each one whose name
4668    matches the pattern *.txt (client interprets wildcards).
4669    mget /mlsd MLSD Gets a list of all the files from the server's current
4670    directory and then downloads each one. The list might include size and
4671    timestamp information, in which case Kermit does not need to send SIZE
4672    and MDTM directives for each file (this is always true of MLSD).
4673    mget /mlsd foo MLSD foo Gets a list of all the files from the server's
4674    "foo" directory (where the string "foo" does not contain wildcards) and
4675    then downloads each one. If "foo" is a regular file and not a
4676    directory, this command is supposed to fail, but some servers have been
4677    observed that send the file.
4678    mget /mlsd *.txt MLSD Gets a list of all the files from the server's
4679    current directory and then downloads only the ones whose names match
4680    the pattern "*.txt". Because we are using MLSD and the MGET filespec is
4681    wild, we do not send the filespec to the server, but treat it as though
4682    it had been given in a /MATCH: switch and use it locally to match the
4683    names in the list.
4684    mget /mlsd foo/*.txt MLSD This one won't work because MLSD requires
4685    that the notions of server directory and filename-matching pattern be
4686    separated. However, the client, which can't be expected to know the
4687    server's file-system syntax, winds up sending a request that the server
4688    will (or should) reject.
4689    mget /mlsd /match:*.txt MLSD Gets a list of all the files from the
4690    server's current directory and then downloads only the ones whose names
4691    match the pattern "*.txt" (client interprets wildcards).
4692    mget /mlsd /match:*.txt foo MLSD foo If "foo" is a directory on the
4693    server, this gets a list of all the files from the server's "foo"
4694    directory and then downloads only the ones whose names match the
4695    pattern "*.txt" (client interprets wildcards). This leaves the server
4696    CD'd to the "foo" directory; there's no way the client can restore the
4697    server's original directory because MLSD doesn't give that information,
4698    and since the client can not be expected to know the server's
4699    file-system syntax, it would not be safe to guess. If "foo" is a
4700    regular file, MLSD fails.
4701    mget /mlsd foo bar MLSD This one is problematic. You're supposed to be
4702    able to give MGET a list a filespecs; in this case we name two
4703    directories. The client must change the server's directory to "foo" to
4704    get the list of files, and then the files themselves. But then it has
4705    no way to return to the server's previous directory in order to do the
4706    same for "bar", as explained in the previous example.
4707    mget /mlsd /match:* [abc] MLSD [abc] Including a /MATCH: switch forces
4708    [abc] to be sent to the server even though the client would normally
4709    think it was a wildcard and hold it for local interpretation. In this
4710    example, [abc] might be a VMS directory name.
4711    mget /mlsd /match:* t*.h MLSD t*.h Contrary to the MLSD specification,
4712    some MLSD-capable FTP servers do interpret wildcards. This form of the
4713    MGET command can be used to force a wildcard to be sent to the server
4714    for interpretation.
4715
4716    When MLSD is used implicitly (that is, without an /MLSD switch given to
4717    force the use of MLSD) and an MGET command such as "mget foo/*.txt"
4718    fails, Kermit automatically falls back to NLST and tries again.
4719
4720 3.11.5. References
4721
4722     1. Postel, J., and J. Reynolds, File Transfer Protocol (FTP), RFC 959,
4723        October 1985: [372]ftp://ftp.isi.edu/in-notes/rfc959.txt.
4724     2. Hethmon, P, and R. Elz, Feature negotiation mechanism for the File
4725        Transfer Protocol, RFC 2389, August 1998:
4726        [373]ftp://ftp.isi.edu/in-notes/rfc2389.txt.
4727     3. Elz, R, and P. Hethmon, Extensions to FTP, Internet Draft
4728        draft-ietf-ftpext-mlst-16.txt, September 2002:
4729        [374]http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16.
4730        txt.
4731     4. [375]The Kermit FTP Client (overview).
4732
4733    [ [376]Top ] [ [377]FTP Top ] [ [378]C-Kermit Home ] [ [379]Kermit Home
4734    ]
4735
4736 4. FILE SCANNING
4737
4738    A new feature called file scanning is used in various contexts to
4739    determine if a file is text or binary, and if it is text, what kind of
4740    text. The overhead of file scanning is surprisingly tolerable, usually
4741    about a quarter second per file. File scanning is now used instead of
4742    filename patterns unless you SET FILE SCAN OFF, which restores the
4743    previous behavior.
4744
4745    The primary benefit of file scanning is in file transfer. For all
4746    practical purposes, now you can stop worrying about whether a file
4747    should be sent in binary or text mode, or about sending mixtures of
4748    text and binary files in a single operation, or configuring and
4749    fine-tuning your lists of binary-file and text-file name patterns: now
4750    it all just works.
4751
4752    File scanning is done by the file sender, which determines the type of
4753    each file before it sends it and informs the receiver (Kermit or FTP
4754    server) of the type. File scanning is NOT done by the receiver, because
4755    it is the sender's responsibility to determine each file's type, send
4756    the file in the right mode, and inform the receiver of the mode. If
4757    both transfer partners are capable of this (or any other) form of
4758    automatic text/binary mode switching, then files can be sent in both
4759    directions with no worries about corruption due to inappropriate
4760    transfer mode. (As noted in [380]Section 3, FTP servers don't do this,
4761    so this discussion does not apply when using Kermit to download from an
4762    FTP server.)
4763
4764    The rest of this section is mainly for the curious. If you don't read
4765    it and simply accept all defaults, every file you send should go in the
4766    appropriate mode automatically. As always, however, for character-set
4767    translation to work for 7- and 8-bit character-set files, the
4768    appropriate SET FILE CHARACTER-SET command(s) must have been executed
4769    to identify their encoding (Kermit's default file character-set is
4770    neutral ASCII except on platforms like HP-UX or DG/UX, where the
4771    default file character-set is known). And of course, receiving is
4772    another matter -- obviously the other Kermit must also send each file
4773    in the appropriate mode.
4774
4775    Scanning is more reliable than filename patterns simply because
4776    filenames are not reliable indicators of the file's contents. Classic
4777    examples include ".doc" files, which are binary if Microsoft Word
4778    documents but text on most other platforms, and ".com" files, which are
4779    binary on DOS and Windows but text on VMS. Anyway, nobody knows the
4780    naming conventions (if any) of all the applications (and persons!) on
4781    your computer. Scanning, on the other hand, determines each file's type
4782    by inspecting its contents rather than just looking at its name.
4783
4784    Also, file patterns -- even when they work as intended -- categorize
4785    each file only as text or binary, whereas file scanning can make finer
4786    distinctions:
4787
4788    BINARY
4789           Binary data, not to be converted in any way. Examples include
4790           binary machine code (executable programs), graphics images (GIF,
4791           JPG, etc), compressed files (Z, GZ, etc), archives and packages
4792           (ZIP, TAR, RPM, etc), object files and libraries (OBJ, DLL,
4793           etc).
4794
4795    7-BIT TEXT
4796           Text encoded in a 7-bit character set such as ASCII or one of
4797           the ISO 646 national versions. Kermit has no way to tell which
4798           character is used, only that it's 7-bit text. Typical examples
4799           include program source code, README files, Perl or Kermit
4800           scripts, plain-text email, HTML, TeX, and various textual
4801           encodings of binary files: Hex, Base64, etc. When sending such
4802           files, the FILE DEFAULT 7BIT-CHARACTER-SET is used as the file
4803           character-set, and then the appropriate transfer character set
4804           is chosen from the associations list (ASSOCIATE, SHOW
4805           ASSOCIATIONS).
4806
4807    8-BIT TEXT
4808           Text encoded in an 8-bit character set such as Latin-1, Latin-2,
4809           Latin/Hebrew, Latin/Cyrillic, KOI8, HP-Roman8, JIS X 0208, Code
4810           Page 437, or Code Page 1252. Again, Kermit has no way of knowing
4811           which particular set is in use, only that it's 8-bit text. When
4812           sending such files, the FILE DEFAULT 8BIT-CHARACTER-SET is used
4813           as the file character-set, and then the appropriate transfer
4814           character set is chosen from the associations list.
4815
4816    UCS2 TEXT
4817           Unicode in its basic form, 16 bits (2 octets) per character.
4818           When sending such files, UCS2 is the file character-set and the
4819           byte order is identified automatically; the appropriate transfer
4820           character set is chosen from the associations list. Normally
4821           this would be UTF8. UTF-16 is not supported yet; Kermit's
4822           Unicode translations are restricted to Plane 0, the Base
4823           Multilingual Plane (BMP).
4824
4825    UTF8 TEXT
4826           Unicode in its 8-bit transformation format. When sending such
4827           files, UTF8 is the file character-set; the appropriate transfer
4828           character set is chosen from the associations list, normally
4829           UCS2 or UTF8.
4830
4831    File scanning is available in UNIX C-Kermit, in K-95, and to a limited
4832    extent, in VMS C-Kermit (full scanning is problematic in VMS because
4833    even plain-text files might contain binary record-format information).
4834    The relevant commands are:
4835
4836    SET TRANSFER MODE { AUTOMATIC, MANUAL }
4837           Tells whether the file-transfer mode (text or binary) should be
4838           set by automatic or "manual" means. AUTOMATIC is the default,
4839           which allows any of the automatic methods that are enabled to do
4840           their jobs: FILE SCAN, FILE PATTERNS, peer recognition, etc.
4841           MANUAL lets you control the transfer mode with the SET FILE TYPE
4842           commands. As always, /TEXT and /BINARY switches on your
4843           file-transfer commands override all other methods; if you give
4844           one of these switches, scanning is not done. SHOW TRANSFER
4845           displays the current TRANSFER MODE setting.
4846
4847    SET FILE SCAN { ON [ number ], OFF }
4848           Turns this feature on and off. It's ON by default. When OFF, the
4849           previous rules apply (SET FILE PATTERNS, etc). When ON is given,
4850           you can also specify a number of bytes to be scanned. The
4851           default is 49152 (= 48K). If a negative number is given, the
4852           entire file is scanned, no matter how big, for maximum certainty
4853           (for example, a PostScript file that appears to be plain text
4854           might include an embedded graphic past the normal scanning
4855           limit). SHOW FILE displays the current FILE SCAN setting.
4856
4857    SET FILE DEFAULT 7BIT-CHARACTER-SET name
4858           Tells the 7-bit character-set to use if scanning identifies a
4859           7-bit text file, e.g. GERMAN. SHOW FILE displays the current SET
4860           FILE DEFAULT settings. So does SHOW CHARACTER-SETS.
4861
4862    SET FILE DEFAULT 8BIT-CHARACTER-SET name
4863           Tells the 8-bit character-set to use if scanning identifies an
4864           8-bit text file, e.g. LATIN1. SHOW FILE and SHOW CHARACTER-SET
4865           display this.
4866
4867    ASSOCIATE FILE-CHARACTER-SET fcs tcs
4868           When sending files and a file character-set (fcs) is identified
4869           by scanning, this tells C-Kermit which transfer character-set
4870           (tcs) to translate it to. It also allows C-Kermit to set the
4871           appropriate transfer character-set automatically whenever you
4872           give a SET FILE CHARACTER-SET command.
4873
4874    ASSOCIATE TRANSFER-CHARACTER-SET tcs fcs
4875           When receiving files and a file arrives whose transfer
4876           character-set (tcs) is announced by the sender, this command
4877           tells C-Kermit which file character-set (fcs) to translate it
4878           to. It also allows C-Kermit to set the appropriate file
4879           character-set whenever you give a SET TRANSFER CHARACTER-SET
4880           command.
4881
4882    SET FILE CHARACTER-SET name
4883           When given for a 7-bit set, also sets FILE DEFAULT
4884           7BIT-CHARACTER-SET to the same set. When given for an 8-bit set,
4885           also sets FILE DEFAULT 8BIT-CHARACTER-SET to the same set. If an
4886           ASSOCIATE FILE-CHARACTER-SET command has been given for this
4887           set, also sets the corresponding transfer character-set.
4888
4889    DIRECTORY /XFERMODE [ filespec ]
4890           Performs a file scan of the given files, listing the result for
4891           each file. If FILE SCAN is OFF but PATTERNS are ON, the result
4892           shown according to the current FILE TEXT-PATTERNS and
4893           BINARY-PATTERNS, and are restricted to (B) and (T). When FILE
4894           SCAN is ON, the results are:
4895
4896   (B)          Binary
4897   (T)(7BIT)    Text: 7-bit
4898   (T)(8BIT)    Text: 8-bit
4899   (T)(UTF8)    Text: Unicode UTF8
4900   (T)(UCS2BE)  Text: Unicode UCS2 Big Endian
4901   (T)(UCS2LE)  Text: Unicode UCS2 Little Endian
4902
4903           So you can use DIR /XFER to get a preview of how each file in a
4904           selected group will be transferred. Everything to the right of
4905           the (B) or (T) is new. If FILE SCAN is OFF, you only get the (B)
4906           or (T) as before.
4907
4908           Note: Big and Little Endian refer to the ordering of bytes
4909           within a computer word. Big Endian architecture is standard and
4910           is used on most non-PC computers. Little Endian architecture is
4911           used on PCs.
4912
4913    To illustrate file-transfer with scanning, suppose you have a directory
4914    containing a mixture of text and binary files, and each text file can
4915    be 7-bit German ISO 646, 8-bit Latin-1, or Unicode in any of the
4916    following forms: UCS2 Little Endian, UCS2 Big Endian, or UTF8
4917    ([381]UTF-16 is not supported yet). Assuming all the built-in defaults
4918    are in effect, the following three commands do the job:
4919
4920   set file char german   ; This sets the default for 7-bit text files
4921   set file char latin1   ; This sets the default for 8-bit text files
4922   send *
4923
4924    Each file is sent in the appropriate mode (text or binary), with text
4925    files converted to the appropriate transfer character-set and labeled
4926    so the receiver can convert them according to its own local
4927    conventions.
4928
4929    By the way, what if you want to inhibit character-set translation but
4930    still allow automatic text/binary mode switching? Previously, you could
4931    simply SET TRANSFER CHARACTER-SET TRANSPARENT. But now with file
4932    scanning, the file and transfer character-sets are set automatically
4933    per file. A new command was added for this purpose:
4934
4935    SET TRANSFER TRANSLATION { ON, OFF }
4936           Enables and disables file-transfer character-set translation. It
4937           is enabled by default.
4938
4939    When TRANSFER TRANSLATION is OFF but FILE SCAN is ON, files are still
4940    scanned to see if they are text or binary, but no character-set
4941    translation is done when they text: only the normal record-format
4942    conversion.
4943
4944    Like all SET commands, SET TRANSFER TRANSLATION is global and
4945    persistent. You can also force a particular file-transfer command
4946    (SEND, MSEND, GET, RECEIVE, TRANSMIT, etc) to not translate without
4947    affecting the global translation settings by including the new
4948    /TRANSPARENT switch, e.g.
4949
4950   send /transparent oofa.txt
4951
4952    As of C-Kermit 8.0.206, SET TRANSFER CHARACTER-SET TRANSPARENT implies
4953    SET TRANSFER TRANSLATION OFF.
4954
4955    File scanning is also used in the TYPE command. The source file type
4956    and character set are determined as above, and then the file is
4957    automatically converted to your display character-set, line by line. In
4958    Kermit 95, the display character-set is Unicode, perhaps converted to
4959    your current console code page; in other versions of C-Kermit, it is
4960    your current file character-set. Thus if you have the following set
4961    appropriately:
4962
4963   SET FILE CHARACTER-SET (necessary in Unix but not K95)
4964   SET FILE DEFAULT 7BIT CHARACTER-SET
4965   SET FILE DEFAULT 8BIT CHARACTER-SET
4966
4967    then you should be able to TYPE any text file and see something
4968    reasonable. For example, in Unix, if your DEFAULT 7BIT-CHARACTER-SET is
4969    ITALIAN and your DEFAULT 8BIT-CHARACTER-SET is LATIN1, and your FILE
4970    CHARACTER-SET is LATIN1, you can TYPE an Italian ISO 646 file, a
4971    Latin-1 file, or any kind of Unicode file, and have it translated
4972    automatically to Latin-1 for your display.
4973
4974    In the GUI version of Kermit 95, you can see mixtures of many different
4975    scripts if the file is UTF8 or UCS2: Roman, Cyrillic, Hebrew, Greek,
4976    Armenian, Georgian, etc, all on the same screen at once.
4977
4978    File scanning also adds a new criterion for file selection, i.e. to
4979    select only text (or binary) files. Several commands now include a new
4980    switch, /TYPE:{BINARY,TEXT,ALL}. BINARY means select only binary
4981    regular files (not directories). TEXT means select only text files. ALL
4982    means don't scan; select all files. Examples:
4983
4984    SEND /TYPE:BINARY *.*
4985           Sends only binary files, skipping over text files.
4986
4987    NOTE: File scanning is NOT done when using external protocols (because
4988    the external protocol programs, such as sz, are processing each file,
4989    not Kermit).
4990
4991    DIRECTORY /TYPE:TEXT
4992           Lists only text files but not binary files.
4993
4994    DELETE /TYPE:BINARY foo.*
4995           Deletes all foo.* files that are regular binary files but does
4996           not delete any text files.
4997
4998    CHMOD /TYPE:BINARY 775 *
4999           (UNIX) Changes the permissions of all binary files to 775.
5000
5001    When FILE SCAN is OFF and FILE PATTERNS are ON, behavior is as before
5002    with PATTERNS ON, but with some improvements:
5003
5004      * Pathnames are now stripped prior to pattern matching.
5005      * Backup suffixes (like .~3~) are stripped prior to pattern matching.
5006
5007    [ [382]Top ] [ [383]Contents ] [ [384]C-Kermit Home ] [ [385]Kermit
5008    Home ]
5009
5010 5. FILE AND DIRECTORY NAMES CONTAINING SPACES
5011
5012    Prior to the introduction of the graphical user interface (GUI), it was
5013    inconceivable that file or directory names could contain spaces,
5014    because space is a field delimiter in all command languages. GUIs,
5015    however, use dialog boxes for filenames, so there is never any question
5016    of distinguishing a filename from adjacent fields -- because there are
5017    no adjacent fields -- and therefore it has become quite common on
5018    computers that have GUIs to have file and directory names composed of
5019    multiple words. Of course this poses problems for command shells and
5020    other text-oriented programs.
5021
5022    Most command shells address these problems by allowing such names to be
5023    enclosed in doublequotes, e.g.:
5024
5025   cd "c:\Program Files"
5026
5027    C-Kermit previously used braces for this:
5028
5029   cd {c:\Program Files}
5030
5031    which was not what most people expected. And even when braces were
5032    used, Kermit had difficulties with completion, file menus, and so
5033    forth, within braced fields.
5034
5035    C-Kermit 8.0 allows either doublequotes or braces to be used for
5036    grouping:
5037
5038   send "this file"
5039   send {this file}
5040   rename "this file" "that file"
5041   rename {this file} "that file"
5042   rename "this file" {that file}
5043   cd {Program Files}
5044   cd "Program Files"
5045
5046    Note that the doublequotes or brackets must enclose the whole file or
5047    directory specification:
5048
5049   "c:\My Directory"
5050
5051    not:
5052
5053   c:\"My Directory"
5054
5055    In C-Kermit 8.0, you can also use completion on these filenames, in
5056    which case Kermit supplies the quotes (or braces) automatically.
5057    Example (in which the current directory contains only one file whose
5058    name starts with "th" and its full name is "this file" (without the
5059    quotes, but with the space)):
5060
5061   cat th<Tab>
5062
5063    Kermit repaints the filename field like this:
5064
5065   cat "this file"
5066
5067    That is, it backspaces over the original "th" and then writes the
5068    filename in doublequotes.
5069
5070    If completion is only partial, Kermit still supplies the quotes, but in
5071    this case also beeps. To continue the filename, you must first
5072    backspace over the closing quote. The closing quote is supplied in this
5073    case to make sure that you can see the spaces, especially if they are
5074    trailing. For example, if the current directory contains two files
5075    whose names start with "th", and their fill names are "this file" and
5076    "this other file":
5077
5078   cat th<Tab>
5079
5080    Kermit prints:
5081
5082   cat "this "<Beep>
5083
5084    If it didn't print the closing quote, you would probably wonder why it
5085    was beeping.
5086
5087    Also, if you begin a filename field with a doublequote or opening
5088    brace, now you can use completion or get ?-help; this was never
5089    possible before.
5090
5091  C-Kermit>type "thi? Input file specification, one of the following:
5092    this file        this other file
5093  C-Kermit>type "thi_
5094
5095    [ [386]Top ] [ [387]Contents ] [ [388]C-Kermit Home ] [ [389]Kermit
5096    Home ]
5097
5098 6. OTHER COMMAND PARSING IMPROVEMENTS
5099
5100 6.1. Grouping Macro Arguments
5101
5102    Doublequotes now can be used in macro invocations to group arguments
5103    containing spaces, where previously only braces could be used:
5104
5105   define xx show args
5106   xx one "this is two" three
5107
5108    Result:
5109
5110   Macro arguments at level 0 (\v(argc) = 4):
5111    \%0 = xx
5112    \%1 = one
5113    \%2 = this is two
5114    \%3 = three
5115
5116    Also, you can now quote braces and quotes in macro args (this didn't
5117    work before). Examples:
5118
5119   xx "{"  ; The argument is a single left brace
5120   xx {"}  ; The argument is a doublequote character
5121
5122    In case this new behavior interferes with your scripts, you can restore
5123    the previous behavior with:
5124
5125   SET COMMAND DOUBLEQUOTING OFF
5126
5127 6.2. Directory and File Name Completion
5128
5129    C-Kermit 8.0 also includes better completion for directory names, e.g.
5130    in the CD command. If the name typed so far uniquely matches a
5131    directory name, it is completed (as before), but now if the directory
5132    contains any subdirectories, completion is partial (allowing you to
5133    supply additional path segments without backspacing); otherwise it is
5134    complete.
5135
5136    Completion has also been improved for file and directory names that
5137    contain not only spaces (as described above) but also "metacharacters"
5138    such as asterisk (*) and tilde (~): now the field is repainted if
5139    necessary. For example, if the current directory contains only one file
5140    whose name contains "blah", then in:
5141
5142   type *blah<Tab>
5143
5144    "*blah" is replaced by the filename. In earlier releases, the part
5145    typed so far was left on the command line (and in the history buffer),
5146    so even when the original command worked, the recalled version would
5147    not. Similarly for ~ (the nearly-universal Unix notation for username):
5148
5149   type ~olga/x<Tab>
5150
5151    is repainted as (e.g.):
5152
5153   type /users/home/olga/x(Beep)
5154
5155    Speaking of command history, the new SHOW HISTORY command shows your
5156    command history and recall buffer. SAVE COMMAND HISTORY saves it into a
5157    file of your choice.
5158
5159 6.3. Passing Arguments to Command Files
5160
5161    The method for passing arguments to command files has been improved.
5162    Prior to C-Kermit 7.0 there was no provision for doing this. In
5163    C-Kermit 7.0, the TAKE command was changed to allow arguments to be
5164    given after the filename:
5165
5166   take commandfile arg1 arg2 ...
5167
5168    This was accomplished by replacing the current \%1, \%2, etc, with the
5169    given arguments, since a new set of macro argument variables is created
5170    only when a macro is executed, not a command file. It is much more
5171    intuitive, however, if arguments to command files worked like those to
5172    macros: the command file sees the arguments as its own \%1, \%2, etc,
5173    but the caller's variables are not disturbed. C-Kermit 8.0 accomplishes
5174    this by automatically creating an intermediate temporary macro to start
5175    the command file (if any arguments were given), thus creating a new
5176    level of arguments as expected.
5177
5178 6.4. More-Prompting
5179
5180    The familiar --more?-- prompt that appears at the end of each screenful
5181    of command-response output now accepts a new answer: G (Go) meaning
5182    "show all the rest without pausing and asking me any more questions". P
5183    (Proceed) is a synonym for G.
5184
5185 6.5. Commas in Macro Definitions
5186
5187    As noted in the [390]C-Kermit manual, comma is used to separate
5188    commands in a macro definition. Even when the macro is defined on
5189    multiple lines using curly-brace block-structure notation without
5190    commas, the definition is still stored internally as a comma-separated
5191    list of commands. Therefore special tricks are needed to include a
5192    comma in a command. The classic example is:
5193
5194   define foo {
5195       (some command)
5196       if fail echo Sorry, blah failed...
5197   }
5198
5199    This would result in Kermit trying to execute a "blah" command. This
5200    could always be handled by enclosing the text in braces:
5201
5202   define foo {
5203       (some command)
5204       if fail echo {Sorry, blah failed...}
5205   }
5206
5207    but doublequotes (more intuitive) should have worked too. Now they do:
5208
5209   define foo {
5210       (some command)
5211       if fail echo "Sorry, blah failed..."
5212   }
5213
5214 6.6. Arrow Keys
5215
5216    As of version 8.0.201, C-Kermit on most platforms lets you accesss the
5217    command history buffer with arrow keys, just as you always could with
5218    control characters. The restrictions are:
5219
5220     1. Only Up and Down arrow keys are accepted.
5221     2. Only 7-bit ANSI arrow-key sequences are understood (ESC followed by
5222        [ or uppercase letter O, followed by uppercase letter A or (up) B
5223        (down).
5224
5225    This change was made to facilitate command recall in Linux-based PDAs
5226    that don't have a Control key, or at least not one that's easily (or
5227    always) accesssible, such as the Sharp Zaurus SL5500.
5228
5229    [ [391]Top ] [ [392]Contents ] [ [393]C-Kermit Home ] [ [394]Kermit
5230    Home ]
5231
5232 7. NEW COMMANDS AND SWITCHES
5233
5234    See [395]Section 4 for more about file scanning and the /TYPE: switch.
5235
5236    ASK[Q] [ /TIMEOUT:number /QUIET /DEFAULT:text ] variable [ prompt ]
5237           The new optional /TIMEOUT: switch for ASK and ASKQ causes the
5238           command to time out and and fail if no response is given within
5239           the specified number of seconds, 1 or greater (0 or less means
5240           no timeout, wait forever). This works just like SET ASK-TIMER,
5241           except its effect is local to the ASK command with which it is
5242           given and it does not disturb the global ask timer setting. The
5243           new /QUIET switch tells Kermit not to print an error message if
5244           the ASK or ASKQ command times out waiting for a response.
5245
5246           Version 8.0.211 adds the /DEFAULT:text switch for ASK-Class
5247           commands (ASK, ASKQ, and GETOK). This lets you supply a default
5248           answer in case the user supplies an empty answer or the
5249           /TIMEOUT: switch was included and the time limit expired without
5250           an answer. In both these cases, the command succeeds.
5251
5252    CAT filename
5253           Equivalent to TYPE /NOPAGE.
5254
5255    CDUP
5256           Changes Kermit's local working directory to the parent of the
5257           current one. Equivalent to "cd .." in UNIX or Windows, "cd [-]"
5258           in VMS, "cd ^" in AOS/VS, etc; in other words, it's a
5259           platform-independent way of moving one level up in a directory
5260           tree.
5261
5262    CHMOD [ switches ] permission files
5263           UNIX only. Sets file permissions for one or more files or
5264           directories. The permission must be given as an octal number,
5265           e.g. 664, 755. Switches: /DIRECTORIES, /FILES, /NOLIST, /PAGE,
5266           /DOTFILES, /LIST, /NOPAGE, /RECURSIVE, /TYPE:{TEXT,BINARY,ALL},
5267           /SIMULATE. The /TYPE: switch allows selection of only text or
5268           binary files. For example, if you have a mixture of source files
5269           and executables, you can use "chmod /files /type:text 664" to
5270           give owner/group read/write and world read permission to the
5271           text files, and "chmod /files /type:binary 775" to give the same
5272           plus execute permission to the executables. Use /SIMULATE to see
5273           which files would be affected, without actually changing their
5274           permissions.
5275
5276    CLEAR KEYBOARD-BUFFER
5277           Flushes any as-yet unread characters from the keyboard input
5278           buffer. Useful for flushing typeahead in scripts.
5279
5280    CONTINUE
5281           When given at an interactive command prompt that was reached by
5282           issuing a PROMPT command (described in this section) from a
5283           script, this command returns to the script, continuing its
5284           execution at the command after the PROMPT command. In this
5285           context, CONTINUE is simply a more-intuitive synonym for END.
5286
5287    COPY, RENAME, and TRANSLATE
5288           These commands now work on file groups if the target filename is
5289           a directory, e.g. "copy oofa.* ..", "rename * ~olga/tmp/"
5290
5291    COPY /APPEND source destination
5292           The source file specification can now include wildcards, in
5293           which case all of the source files that match will go into the
5294           destination file in alphabetical order by name.
5295
5296    DELETE /ASK
5297           Asks permission to delete each file before deleting it. In
5298           C-Kermit 7.0, the answers were "yes" (or "ok") and "no".
5299           C-Kermit 8.0 adds "go" (meaning, delete all the rest without
5300           asking) and "quit" (cancel the DELETE command and return to the
5301           prompt).
5302
5303    DELETE /DIRECTORIES
5304           Deletes not only files but also directories.
5305
5306    DELETE /RECURSIVE
5307           Deletes all files that match the given file specification in the
5308           current (or given) directory and all directories beneath it.
5309
5310    DELETE /SUMMARY
5311           Prints only the number of files deleted and total size freed,
5312           without listing each file.
5313
5314    DELETE /TREE
5315           Shorthand for DELETE /RECURSIVE /DIRECTORIES /DOTFILES/.
5316           Equivalent to Windows DELTREE or Unix "rm -Rf". If no file
5317           specification is given, the contents of the current directory,
5318           plus all of its subdirectories and their contents, are deleted.
5319
5320    DELETE /TYPE:BINARY
5321           Delete only regular binary files (requires FILE SCAN ON).
5322
5323    DELETE /TYPE:TEXT
5324           Delete only regular text files (requires FILE SCAN ON).
5325
5326    DIRECTORY [ switches ] [ filespec [ filespec [ filespec ... ] ] ]
5327           The DIRECTORY command now accepts more than one file
5328           specification; e.g. "directory moon.txt sun.doc stars.*".
5329
5330    DIRECTORY /NORECURSIVE xxx
5331           If xxx is a directory name, forces listing of the directory
5332           itself rather than its contents.
5333
5334    DIRECTORY /FOLLOWLINKS xxx
5335           (UNIX only) Tells the DIRECTORY command to follow symbolic
5336           links. This not the default because it can cause endless loops.
5337
5338    DIRECTORY /NOFOLLOWLINKS xxx
5339           (UNIX only) Tells the DIRECTORY command not to follow symbolic
5340           links, but rather, merely to list them. This is the default.
5341
5342    DIRECTORY /OUTPUT:filename
5343           Sends the results of the DIRECTORY command to the given file.
5344
5345    DIRECTORY /SUMMARY
5346           Prints only the number of directories and files and the total
5347           size, without listing each file.
5348
5349    DIRECTORY /TYPE:{TEXT,BINARY}
5350           Shows only files of the selected type, based on file scan.
5351
5352    DIRECTORY /XFERMODE
5353           Now shows results of file scan (see [396]Section 4).
5354
5355    FOPEN [ switches ] channel filename
5356
5357           As of version 8.0.211, FOPEN allows /dev/tty as a filename in
5358           Unix-based operating systems.
5359
5360    FREAD /TRIM
5361           (8.0.211) Trims any trailing blanks or tabs from the item (such
5362           as a line of text) that it has read.
5363
5364    FREAD /UNTABIFY
5365           (8.0.211) Converts Horizontal Tab characters to the appropriate
5366           number of spaces, based on VT100-like tab stops (1,9,17,25,...).
5367
5368    GREP [ switches ] pattern files
5369           Similar to Unix grep command: displays file lines that match the
5370           given [397]pattern. Switches:
5371
5372         /COUNT[:variable]
5373                 Don't show the matching lines, just tell how many lines
5374                 match. If a variable name is specified, the count is
5375                 stored in the given variable.
5376
5377         /DOTFILES
5378                 Include files whose names begin with dot.
5379
5380         /LINENUMBERS
5381                 Show line numbers of matching lines.
5382
5383         /NAMEONLY
5384                 only list the names of files that contain matching lines,
5385                 but not the lines themselves.
5386
5387         /NOBACKUP
5388                 Skip backup files.
5389
5390         /NOCASE
5391                 Ignore alphabetic case while pattern matching.
5392
5393         /NODOTFILES
5394                 skip files whose names start with dot (period).
5395
5396         /NOLIST
5397                 Suppress output but set SUCCESS or FAILURE according to
5398                 search result.
5399
5400         /NOMATCH
5401                 Look for lines that do not match the pattern.
5402
5403         /NOPAGE
5404                 Don't pause between screens of output.
5405
5406         /OUTPUT:filename
5407                 Write results into the given file.
5408
5409         /PAGE
5410                 Pause between screens of output.
5411
5412         /RECURSIVE
5413                 Search files in subdirectories too.
5414
5415         /TYPE:{TEXT,BINARY}
5416                 Search only files of the specified type.
5417
5418           Synonyms: FIND, SEARCH.
5419
5420    GETOK /TIMEOUT:n /QUIET /DEFAULT:text
5421           The new /QUIET switch instructs GETOK, when given a timeout, not
5422           to print an error message if it times out. As of 8.0.211, a
5423           default answer can be supplied (see ASK).
5424
5425    HEAD [ switches ] filename
5426           Equivalent to TYPE /HEAD [ other-switches ] filename.
5427
5428    HELP DATE
5429           Explains date-time formats, including timezone notation and
5430           delta times.
5431
5432    HELP FIREWALLS
5433           Explains the firewall negotiation capabilities of your version
5434           of Kermit.
5435
5436    KCD [ symbolic-directory-name ]
5437           Changes Kermit's working directory to the named symbolic
5438           directory, such as such as exedir, inidir, startup, download, or
5439           and home. Type "kcd ?" for a list of symbolic directory names
5440           known to your copy of Kermit, or give the new ORIENTATION
5441           command for a more detailed explanation. If you give a KCD
5442           command without a directory name, Kermit returns to its "home"
5443           directory, which is determined in some way that depends on the
5444           underlying operating system, but which you can redefine with the
5445           (new) SET CD HOME command. Your home directory is shown by SHOW
5446           CD and it's also the value of the \v(home) variable.
5447
5448    LICENSE
5449           Displays the C-Kermit license.
5450
5451    L-commands
5452           When Kermit has a connection to a Kermit or FTP server, file
5453           management commands such as CD, DIRECTORY, and DELETE might be
5454           intended for the local computer or the remote server. C-Kermit
5455           8.0.200 and earlier always executes these commands on the local
5456           computer. If you want them executed by the remote server, you
5457           have to prefix them with REMOTE (e.g. REMOTE CD) or use special
5458           R-command aliases (e.g. RCD = REMOTE CD, RDIR = REMOTE DIR,
5459           etc). But this feels unnatural to FTP users, who expect
5460           unprefixed file management commands to be executed by the remote
5461           server, rather than locally. C-Kermit 8.0.201 adds automatic
5462           locus switching to present an FTP-like interface for FTP
5463           connections and the normal Kermit interface for Kermit
5464           connections, and a SET LOCUS command (described below) to
5465           control whether or how this is done. For when LOCUS is REMOTE, a
5466           new set of commands was added for local management: LCD (Local
5467           CD), LDIR (Local DIR), etc. These are described below under SET
5468           LOCUS.
5469
5470    MORE filename
5471           Equivalent to TYPE /PAGE.
5472
5473    ORIENTATION
5474           Displays symbolic directory names and the corresponding variable
5475           names and values. The symbolic names, such as exedir, inidir,
5476           startup, download, and home, can be used as arguments to the new
5477           KCD command.
5478
5479    PROMPT [ text ]
5480           For use in a macro or command file: enters interactive command
5481           mode within the current context ([398]Section 8.1). If the
5482           optional text is included, the prompt is set to it. The text can
5483           include variables, functions, etc, as in the SET PROMPT command.
5484           They are evaluated each time the prompt is printed. Unlike the
5485           SET PROMPT command, the text argument applies only to the
5486           current command level. Thus you can have different prompts at
5487           different levels.
5488
5489    REMOTE SET MATCH { DOTFILE, FIFO } { ON, OFF }
5490           Allows the client to tell the server whether wildcards sent to
5491           the server should match dot files (files whose names begin with
5492           period) or FIFOs (named pipes). See SET MATCH.
5493
5494    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
5495           Allows control of the Kermit's Record-Format attribute. Set this
5496           to OFF in case incoming file are refused due to unknown or
5497           invalid record formats if you want to accept the file anyway
5498           (and, perhaps, postprocess it to fix its record format).
5499
5500    SET CD HOME [ directory ]
5501           Specifies the target directory for the CD and KCD commands, when
5502           they are given without an argument, and also sets the value of
5503           the \v(home) variable.
5504
5505    SET EXIT HANGUP { OFF, ON }
5506           Normally ON, meaning that when Kermit exits, it also explicitly
5507           hangs up the current SET LINE / SET PORT serial port according
5508           to the current SET MODEM TYPE and SET MODEM HANGUP METHOD, and
5509           closes the port device if it was opened by Kermit in the first
5510           place (as opposed to inherited). SET EXIT HANGUP OFF tells
5511           Kermit not to do this. This can't prevent the operating system
5512           from closing the device when Kermit exits (and it's a "last
5513           close") but if the port or modem have been conditioned to
5514           somehow ignore the close and keep the connection open, at least
5515           Kermit itself won't do anything explicit to hang it up or close
5516           it.
5517
5518    SET FILE EOF { CTRL-Z, LENGTH }
5519           Specifies the end-of-file detection method to be used by
5520           C-Kermit when sending and receiving text files, and in the TYPE
5521           and similar text-file oriented commands. The normal and default
5522           method is LENGTH. You can specify CTRL-Z when handling CP/M or
5523           MS-DOS format text files, in which a Ctrl-Z (ASCII 26) character
5524           within the file marks the end of the file.
5525
5526    SET FILE LISTSIZE number
5527           Allocates space for the given number of filenames to be filled
5528           in by the wildcard expander. The current number is shown by SHOW
5529           FILE. If you give a command that includes a filename containing
5530           a wildcard (such as "*") that matches more files that Kermit's
5531           list has room for, you can adjust the list size with this
5532           command.
5533
5534    SET FILE STRINGSPACE number
5535           Allocates space for the given amount of filename strings for use
5536           by the wildcard expander. The current number is shown by SHOW
5537           FILE. The number is the total number of bytes of all the file
5538           specifications that match the given wildcard.
5539
5540      If you need to process a bigger list of files than your computer has
5541      memory for, you might be able use an external file list. The Kermit
5542      SEND and the FTP PUT and GET commands accept a /LISTFILE: switch,
5543      which gives the name of a file that contains the list of files to be
5544      transferred. Example for UNIX:
5545
5546   !find . -print | grep / > /tmp/names
5547   ftp put /update /recursive /listfile:/tmp/names
5548
5549    SET LOCUS { AUTO, LOCAL, REMOTE }
5550           Added in C-Kermit 8.0.201.   Sets the locus for unprefixed file
5551           management commands such as CD, DIRECTORY, MKDIR, etc. When
5552           LOCUS is LOCAL these commands act locally and a REMOTE (or R)
5553           prefix (e.g. REMOTE CD, RCD, RDIR) is required to send file
5554           management commands to a remote server. When LOCUS is REMOTE, an
5555           L prefix is required to issue local file management commands
5556           (e.g. LCD, LDIR). The word LOCAL can't be used as a prefix since
5557           it is already used for declaring local variables. LOCUS applies
5558           to all types of connections, and thus is orthogonal to SET
5559           GET-PUT-REMOTE, which selects between Kermit and FTP for remote
5560           file-transfer and management commands. The default LOCUS is
5561           AUTO, which means we switch to REMOTE whenever an FTP connection
5562           is made, and to LOCAL whenever a non-FTP connection is made, and
5563           switch back accordingly whenever a connection is closed. So by
5564           default, Kermit behaves in its traditional manner unless you
5565           make an FTP connection, in which case it acts like a regular FTP
5566           client (but better :-)   LOCUS applies to the following
5567           commands:
5568
5569   Unprefixed    Remote       Local        Description
5570    CD (CWD)      RCD          LCD          Change (Working) Directory
5571    CDUP          RCDUP        LCDUP        CD Up
5572    PWD           RPWD         LPWD         Print Working Directory
5573    DIRECTORY     RDIR         LDIR         Request a directory listing
5574    DELETE        RDEL         LDEL         Delete (a) file(s)
5575    RENAME        RREN         LREN         Rename a file
5576    MKDIR         RMKDIR       LMKDIR       Create a directory
5577    RMDIR         RRMDIR       LRMDIR       Remove a directory
5578
5579    SET MATCH { DOTFILE, FIFO } { ON, OFF }
5580           Whether C-Kermit filename patterns (wildcards) should match
5581           filenames that start with dot (period), or (Unix only) FIFOs
5582           (named pipes). The defaults are to skip dotfiles in Unix but
5583           match them elsewhere, and to skip FIFOs. Applies to both
5584           interactive use and to server mode, when the server receives
5585           wildcards, e.g. in a GET command. Also see REMOTE SET MATCH.
5586
5587    SET OPTIONS DIRECTORY /DOTFILES
5588           Now works for server listings too (UNIX only). Give this command
5589           prior to having Kermit enter server mode, and then it will show
5590           files whose names begin with dot (period) when sent a REMOTE
5591           DIRECTORY command.
5592
5593    SET QUIET ON
5594           (as well as the -q command-line option) Now applies also to:
5595
5596           + SET HOST connection progress messages.
5597           + "Press the X or E key to cancel" file-transfer message.
5598           + REMOTE CD response.
5599           + REMOTE LOGIN response.
5600
5601    SET RECEIVE PERMISSIONS { ON, OFF }
5602           Tells C-Kermit whether to set the permissions of incoming files
5603           (received with Kermit protocol) from the permissions supplied in
5604           the file's Attribute packet (if any). Normally ON. Also see SET
5605           SEND PERMISSIONS.
5606
5607    SET ROOT directory
5608           Like UNIX chroot, without requiring privilege. Sets the root for
5609           file accesss, does not allow reference to or creation of files
5610           outside the root, and can't be undone.
5611
5612    SET SEND PERMISSIONS { ON, OFF }
5613           Tells C-Kermit whether to include file permissions in the
5614           attributes it includes with each file when sending with Kermit
5615           protocol. Also see SET RECEIVE PERMISSIONS.
5616
5617    SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER:name /PASSWORD:text
5618           These commands now allow specification of username and password.
5619
5620    SET TERMINAL . . .
5621           (See [399]Section 12.)
5622
5623    SET TRANSFER MESSAGE [ text ]
5624           Sets an initial text message to be displayed in the
5625           file-transfer display. The transfer message is automatically
5626           deleted once used, so must be set each time a message a desired.
5627           Any variables in the message are evaluated at the time the SET
5628           command is given. If the optional text is omitted, any transfer
5629           message that is currently set is removed. Synonym: SET XFER MSG.
5630           SHOW TRANSFER displays it if it has been set but not yet used.
5631
5632    SHOW COMMUNICATIONS
5633           In C-Kermit 8.0, SHOW COMMUNICATIONS, when given in remote mode
5634           (i.e. before any connection has been established), tells the
5635           typical dialout device name for the particular platform on which
5636           it's running (e.g. TXA0: for VMS, or /dev/cua0p0 for HP-UX). On
5637           Unix platforms, it also tells the name of the lockfile
5638           directory. This way, you have an idea of what the SET LINE
5639           device name should look like, and if the SET LINE command fails,
5640           you know the name of the directory or device that is protected
5641           against you.
5642
5643    SHOW VARIABLES [ name [ name [ ... ] ] ]
5644           In C-Kermit 8.0.201 you can request values of a list of built-in
5645           (\v(xxx)) variables. Each name is a pattern, as before, but now
5646           it a free pattern rather than an anchored one (explained in
5647           [400]Section 8.12) so now "show var date time" shows the values
5648           of all variables whose names include the strings "date" or
5649           "time".
5650
5651    TAIL [ switches ] filename
5652           Equivalent to TYPE /TAIL [ other-switches ] filename.
5653
5654    TRANSMIT /NOECHO [ other switches ] filename
5655           The /NOECHO switch is equivalent to giving the command SET
5656           TRANSMIT ECHO OFF prior to the TRANSMIT command, except the
5657           switch affects only the command with which it was given and does
5658           not affect the prevailing global setting.
5659
5660    TRANSMIT /NOWAIT [ other switches ] filename
5661           The /NOWAIT switch is equivalent to giving the command SET
5662           TRANSMIT PROMPT 0 prior to the TRANSMIT command, except the
5663           switch affects only the command with which it was given and does
5664           not affect the prevailing global setting.
5665
5666    TRANSMIT /NOWAIT /NOECHO /BINARY [ other switches ] filename
5667           When the TRANSMIT command is given with the /NOWAIT, /NOECHO,
5668           and /BINARY switches, this activates a special "blast the whole
5669           file out the communications connection all at once" mode that
5670           Kermit didn't have prior to version 8.0. There has been
5671           increasing demand for this type of transmission with the advent
5672           of devices that expect image (e.g. .JPG) or sound (e.g. .MP3)
5673           files as raw input. The obvious question is: how does the
5674           receiving device know when it has the whole file? This depends
5675           on the device, of course; usually after a certain amount of time
5676           elapses with nothing arriving, or else when Kermit hangs up or
5677           closes the connection.
5678
5679    TYPE /CHARACTER-SET:name
5680           Allows you to specify the character set in which the file to be
5681           typed is encoded.
5682
5683    TYPE /NUMBER
5684           Adds line numbers.
5685
5686    TYPE /OUTPUT:filename
5687           Sends the results of the TYPE command to the given file.
5688
5689    TYPE /TRANSLATE-TO:name
5690           Used in conjunction with TYPE /CHARACTER-SET:xxx; allows you to
5691           specify the character set in which the file is to be displayed.
5692
5693    TYPE /TRANSPARENT
5694           Used to disable character-set translation in the TYPE command,
5695           which otherwise can take place automatically based on file
5696           scanning, even when /CHARACTER-SET and /TRANSLATE-TO switches
5697           are not given.
5698
5699    VOID text
5700           Parses the text, evaluating any backslash items in it (such as
5701           function calls) but doesn't do anything further, except possibly
5702           printing error messages. Useful for invoking functions that have
5703           side effects without using or printing their direct results,
5704           e.g. "void \fsplit(\%a,&a)".
5705
5706 Symbolic Links in UNIX
5707
5708    The UNIX versions of C-Kermit have had /FOLLOWLINKS and /NOFOLLOWLINKS
5709    switches added to several commands to control the treatment of symbolic
5710    links. Different commands deal differently with symbolic links:
5711
5712    Kermit SEND, FTP MPUT
5713           /NOFOLLOWLINKS is the default, which means symbolic links are
5714           skipped entirely. The alternative, /FOLLOWLINKS, should be used
5715           with caution, since an innocent link might point to a whole file
5716           system, or it might cause a loop. There is no way in Kermit or
5717           FTP protocol to send the link itself. We either skip them or
5718           follow them; we can't duplicate them.
5719
5720    DIRECTORY
5721           /NOFOLLOWLINKS is the default, which means the DIRECTORY command
5722           lists symbolic links in a way that shows they are links, but it
5723           does not follow them. The alternative, /FOLLOWLINKS, follows
5724           links and gives information about the linked-to directories and
5725           files.
5726
5727    DELETE, RMDIR
5728           The DELETE command does not have link-specific switches. DELETE
5729           never follows links. If you tell Kermit to delete a symbolic
5730           link, it deletes the link itself, not the linked-to file. Ditto
5731           for RMDIR.
5732
5733    COPY
5734           The COPY command behaves just like the UNIX cp command; it
5735           always follows links.
5736
5737    RENAME
5738           The RENAME command behaves just like the UNIX mv command; it
5739           operates on links directly rather than following.
5740
5741    [ [401]Top ] [ [402]Contents ] [ [403]C-Kermit Home ] [ [404]Kermit
5742    Home ]
5743
5744 8. OTHER SCRIPTING IMPROVEMENTS
5745
5746 8.1. Performance and Debugging
5747
5748    A command cache for frequently used commands plus some related
5749    optimizations increases the speed of compute-bound scripts by anywhere
5750    from 50% to 1000%.
5751
5752    The new PROMPT command can be used to set breakpoints for debugging
5753    scripts. If executed in a command file or macro, it gives you an
5754    interactive command prompt in the current context of the script, with
5755    all its variables, arguments, command stack, etc, available for
5756    examination or change, and the ability to resume the script at any
5757    point (END resumes it, Ctrl-C or STOP cancels it and returns to top
5758    level).
5759
5760    The new Ctrl-C trapping feature ([405]Section 8.14) lets you intercept
5761    interruption of scripts. This can be used in combination with the
5762    PROMPT command to debug scripts. Example:
5763
5764 define ON_CTRLC {
5765     echo INTERRUPTED BY CTRL-C...
5766     echo The command stack has not yet been rolled back:
5767     show stack
5768     echo Type Ctrl-C again or use the END command to return to top level.
5769     prompt Debug>
5770 }
5771
5772    Adding this ON_CTRL definition to your script lets you interrupt it at
5773    any point and get prompt that is issued at the current command level,
5774    so you can query local variables, etc.
5775
5776    [ [406]Top ] [ [407]Contents ] [ [408]C-Kermit Home ] [ [409]Kermit
5777    Home ]
5778
5779 8.2. Using Macros as Numeric Variables
5780
5781    A macro is a way to assign a value to a name, and then use the name to
5782    refer to the value. Macros are used in two ways in Kermit: as
5783    "subroutines" or functions composed of Kermit commands, which are
5784    executed, or as variables to hold arbitrary values -- text, numbers,
5785    filenames, etc.
5786
5787    When a macro is to be executed, its name is given as if it were a
5788    C-Kermit command, optionally preceded by the word "do". When a macro is
5789    used as a variable, it must be "escaped" with \m(xxx) (or equivalent
5790    function, e.g. \s(xxx), \:(xxx), \fdefinition(xxx)), where xxx is the
5791    macro name, for example:
5792
5793   define filename /usr/olga/oofa.txt
5794   send \m(filename)
5795
5796    Of course variables can also hold numbers:
5797
5798   define size 17
5799   declare \&a[\m(size)]
5800   ...
5801   define index 3
5802   if ( == \m(index) 3 ) echo The third value is: \&a[\m(index)]
5803   evaluate index (\m(index) * 4)
5804   if ( > \m(index) \m(size) ) echo Out of range!
5805
5806    But these are contexts in which only numbers are valid. C-Kermit 8.0
5807    has been changed to treat non-escaped non-numeric items in strictly
5808    numeric contexts as macro names. So it is now possible (but not
5809    required) to omit the \m(...) notation and just use the macro name in
5810    these contexts:
5811
5812   define size 17
5813   declare \&a[size]
5814   ...
5815   define index 3
5816   if ( == index 3 ) echo The third value is: \&a[index]
5817   evaluate index (index * 4)
5818   if ( > index size ) echo Out of range!
5819
5820    This is especially nice for loops that deal with arrays. Here, for
5821    example, is a loop that reverses the order of the elements in an array.
5822    Whereas formerly it was necessary to write:
5823
5824   .\%n ::= \fdim(&a)
5825   for \%i 1 \%n/2 1 {
5826       .tmp := \&a[\%n-\%i+1]
5827       .\&a[\%n-\%i+1] := \&a[\%i]
5828       .\&a[\%i] := \m(tmp)
5829   }
5830
5831    Recoding this to use macro names "i" and "n" instead of the backslash
5832    variables \%i and \%n, we have:
5833
5834   .n ::= \fdim(&a)
5835   for i 1 n/2 1 {
5836       .tmp := \&a[n-i+1]
5837       .\&a[n-i+1] := \&a[i]
5838       .\&a[i] := \m(tmp)
5839   }
5840
5841    which reduces the backslash count to less than half. The final
5842    statement in the loop could be written ".\&a[i] ::= tmp" if the array
5843    contained only numbers (since ::= indicates arithmetic expression
5844    evaluation).
5845
5846    Also, now you can use floating-point numbers in integer contexts (such
5847    as array subscripts), in which case they are truncated to an integer
5848    value (i.e. the fractional part is discarded).
5849
5850    Examples of numeric contexts include:
5851
5852      * Array subscripts.
5853      * Any numeric function argument.
5854      * Right-hand side of ::= assignments.
5855      * EVALUATE command or \fevaluate() function expression.
5856      * The INCREMENT or DECREMENT by-value.
5857      * IF =, >, <, !=, >=, and <= comparands.
5858      * The IF number construct.
5859      * FOR-loop variables.
5860      * STOP, END, and EXIT status codes.
5861      * The INPUT timeout value.
5862      * PAUSE, WAIT, SLEEP, MSLEEP intervals.
5863      * The SHIFT argument.
5864      * Numeric switch arguments, e.g. TYPE /WIDTH:number, SEND
5865        /LARGER:number.
5866      * SCREEN MOVE-TO row and column number.
5867      * Various SET DIAL parameters (timeout, retry limit, etc).
5868      * Various SET SEND or RECEIVE parameters (packet length, window size,
5869        etc).
5870      * Various other SET parameters.
5871
5872    and:
5873
5874      * S-Expressions (explained in [410]Section 9).
5875
5876    Macro names used in numeric contexts must not include mathematical
5877    operators. Although it is legal to create a macro called "foo+bar", in
5878    a numeric context this would be taken as the sum of the values of "foo"
5879    and "bar". Any such conflict can be avoided, of course, by enclosing
5880    the macro name in \m(...).
5881
5882    [ [411]Top ] [ [412]Contents ] [ [413]C-Kermit Home ] [ [414]Kermit
5883    Home ]
5884
5885 8.3. New IF Conditions
5886
5887    Several new IF conditions are available:
5888
5889    IF DECLARED arrayname
5890           Explained in [415]Section 8.6.
5891
5892    IF KBHIT
5893           Allows a script to test whether a key was pressed without
5894           actually trying to read it.
5895
5896    IF KERBANG (Unix only)
5897           True if Kermit was started from a Kerbang script. This is useful
5898           for knowing how to interpret the \&@[] and \&_[] argument vector
5899           arrays, and under what conditions to exit.
5900
5901    IF INTEGER n
5902           This is just a synonym for IF NUMERIC, which is true if n
5903           contains only digits (or, if n is a variable, its value contains
5904           only digits).
5905
5906    By contrast, IF FLOAT n succeeds if n is a floating-point number OR an
5907    integer (or a variable with floating-point or integer value).
5908    Therefore, IF FLOAT should be used whenever any kind of number is
5909    acceptable, whereas IF INTEGER (or IF NUMERIC) when only an integer can
5910    be used.
5911
5912    [ [416]Top ] [ [417]Contents ] [ [418]C-Kermit Home ] [ [419]Kermit
5913    Home ]
5914
5915 8.4. The ON_UNKNOWN_COMMAND Macro
5916
5917    The new ON_UNKNOWN_COMMAND macro, if defined, is executed whenever you
5918    give a command that is not known to C-Kermit; any operands are passed
5919    as arguments. Here are some sample definitions:
5920
5921   DEF ON_UNKNOWN_COMMAND telnet \%1 ; Treat unknown commands as hostnames
5922   DEF ON_UNKNOWN_COMMAND dial \%1   ; Treat unknown commands phone numbers
5923   DEF ON_UNKNOWN_COMMAND take \%1   ; Treat unknown commands as filenames
5924   DEF ON_UNKNOWN_COMMAND !\%*       ; Treat unknown commands as shell commands
5925
5926    The ON_CD macro, if defined, is executed whenever Kermit is given a CD
5927    (change directory) command (8.0.211). Upon entry to this macro, the
5928    directory has already changed and the new directory string is available
5929    in the \v(directory) variable, and also as the first argument (\%1).
5930
5931    [ [420]Top ] [ [421]Contents ] [ [422]C-Kermit Home ] [ [423]Kermit
5932    Home ]
5933
5934 8.5. The SHOW MACRO Command
5935
5936    The SHOW MACRO command has been changed to accept more than one macro
5937    name:
5938
5939   (setq a 1 b 2 c 3)
5940   show mac a b c
5941   a = 1
5942   b = 2
5943   c = 3
5944
5945    An exact match is required for each name (except that case doesn't
5946    matter). If you include wildcard characters, however, a pattern match
5947    is performed:
5948
5949   show mac [a-c]*x
5950
5951    shows all macros whose names start with a, b, or c, and end with x.
5952
5953    [ [424]Top ] [ [425]Contents ] [ [426]C-Kermit Home ] [ [427]Kermit
5954    Home ]
5955
5956 8.6. Arrays
5957
5958    A clarification regarding references to array names (as opposed to
5959    array elements): You can use array-name "abbreviations" like &a only in
5960    contexts that expect array names, like ARRAY commands or array-name
5961    function arguments such as the second argument of \fsplit(). In a LOCAL
5962    statement, however, you have to write \&a[], since "local &a" might
5963    refer to a macro named "&a".
5964
5965    In function arguments, however, you MUST use the abbreviated form:
5966    \fsplit(\%a,&a) or \fsplit(\%a,&a[]). If you include the backslash (as
5967    in "\fsplit(\%a,\&a[])") a parse error occurs.
5968
5969    Here are the new array-related commands:
5970
5971    IF DECLARED arrayname
5972           Allows a script to test whether an array has been declared. The
5973           arrayname can be a non-array backslash variable such as \%1 or
5974           \m(name), in which case it is evaluated first, and the result is
5975           treated as the array name. Otherwise, arrayname is treated as in
5976           the ARRAY commands: it can be a, &a, &a[], \&a, \&a[], \&a[3],
5977           \&a[3:9], etc, with the appropriate results in each case.
5978           Synonym: IF DCL.
5979
5980    UNDECLARE arrayname
5981           UNDECLARE is a new top-level command to undeclare an array.
5982           Previously this could only be done with "declare \&a[0]" (i.e.
5983           re-declare the array with a dimension of 0).
5984
5985    ARRAY LINK linkname arrayname
5986           Creates a symbolic link from the array named by linkname (which
5987           must be the name of an array that is not yet declared in the
5988           current context) to the array named by arrayname (which must the
5989           name of a currently declared array that is not itself a link, or
5990           a variable containing the name of such an array). The two names
5991           indicate the same array: if you change an array element, the
5992           change is reflected in the link too, and vice versa. If you
5993           undeclare the link, the real array is unaffected. If you
5994           undeclare the real array, all links to it disappear. If you
5995           resize an array (directly or through a link), all links to it
5996           are updated automatically.
5997
5998    Array links let you pass array names as arguments to macros. For
5999    example, suppose you had a program that needed to uppercase all the
6000    elements of different arrays at different times. You could write a
6001    macro to do this, with the array name as an argument. But without array
6002    links, there would be no way to refer to the argument array within the
6003    macro. Array links make it easy:
6004
6005   define arrayupper {
6006       local \&e[] \%i
6007       array link \&e[] \%1
6008       for i 1 \fdim(&e) 1 { .\&e[i] := \fupper(\&e[i]) }
6009   }
6010   declare \&a[] = these are some words
6011   arrayupper &a
6012   show array &a
6013
6014    The macro declares the array link LOCAL, which means it doesn't
6015    conflict with any array of the same name that might exist outside the
6016    macro, and that the link is destroyed automatically when the macro
6017    exits. This works, by the way, even if the link name and the macro
6018    argument name are the same, as long as the link is declared LOCAL.
6019
6020    As noted, you can't make a link to a nonexistent array. So when writing
6021    a macro whose job is to create an array whose name is passed as an
6022    argument, you must declare the array first (the size doesn't matter as
6023    long as it's greater than 0). Example:
6024
6025   define tryme {                ; Demonstration macro
6026       local \&e[]               ; We only need this inside the macro
6027       array link \&e[] \%1      ; Make local link
6028       shift                     ; Shift argument list
6029       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
6030   }
6031   declare \&a[1]                ; Declare target array in advance
6032   tryme &a here are some words  ; Invoke the macro with array name and words
6033   show array a                  ; See the results
6034
6035    One final improvement allows the macro itself to declare the array
6036    (this was not possible in earlier Kermit releases): if the array name
6037    in the DECLARE command is a variable (and not an array name), or
6038    includes variables, the resulting value is used as the array name. So:
6039
6040   define tryme {                ; Demonstration macro
6041       declare \%1[1]            ; Preliminary declaration for target array
6042       local \&e[]               ; We only need this inside the macro
6043       array link \&e[] \%1      ; Make local link
6044       shift                     ; Shift argument list
6045       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
6046   }
6047   tryme &a here are some words  ; Invoke the macro with array name and words
6048   show array a                  ; See the results
6049
6050    The SHOW ARRAY command now indicates whether an array name is a link.
6051
6052    Also see the descriptions of [428]\fjoin() and [429]\fsplit(), plus
6053    [430]Section 8.10 on the MINPUT command, which shows how an entire
6054    array (or segment of it) can be used as the MINPUT target list.
6055
6056    [ [431]Top ] [ [432]Contents ] [ [433]C-Kermit Home ] [ [434]Kermit
6057    Home ]
6058
6059 8.7. New or Improved Built-in Variables and Functions
6060
6061    The following new built-in variables are available:
6062
6063   \v(buildid)       A date string like "20000808" indicating when C-Kermit was b
6064 uilt.
6065   \v(ftime)         Current time, secs since midnight, including fraction of sec
6066 ond.
6067   \v(iprompt)       The current SET PROMPT value
6068   \v(sexp)          The most recent S-Expression (see [435]Section 9)
6069   \v(sdepth)        The current S-Expression invocation depth ([436]Section 9)
6070   \v(svalue)        The value of the most recent S-Expression ([437]Section 9)
6071
6072   \v(ftp_code)      Most recent FTP response code ([438]Section 3)
6073   \v(ftp_connected) FTP connection status ([439]Section 3)
6074   \v(ftp_cpl)       FTP Command Protection Level ([440]Section 3.2)
6075   \v(ftp_dpl)       FTP Data Protection Level ([441]Section 3.2)
6076   \v(ftp_getputremote) The current SET GET-PUT-REMOTE setting ([442]Section 3.8)
6077
6078   \v(ftp_host)      Name or IP address of FTP server ([443]Section 3)
6079   \v(ftp_loggedin)  FTP login status ([444]Section 3)
6080   \v(ftp_message)   Most recent FTP response message ([445]Section 3)
6081   \v(ftp_security)  FTP Security method ([446]Section 3.2)
6082   \v(ftp_server)    OS type of FTP server ([447]Section 3)
6083
6084   \v(http_code)       Most recent HTTP response code
6085   \v(http_connected)  HTTP connection status
6086   \v(http_host)       Name or IP address of HTTP server
6087   \v(http_message)    Most recent HTTP response message
6088   \v(http_security)   TLS cipher used to secure the HTTP session
6089
6090   \v(hour)            Hour of the day, 0 to 23.
6091   \v(timestamp)       Equivalent to "\v(ndate) \v(time)".
6092
6093   \v(log_debug)       Current debug log file, if any.
6094   \v(log_packet)      Current packet log file, if any.
6095   \v(log_session)     Current session log file, if any.
6096   \v(log_transaction) Current transaction log file, if any.
6097   \v(log_connection)  Current connection log file, if any.
6098
6099    The following new or improved built-in functions are available:
6100
6101   \fcmdstack()            Allows programmatic accesss to the command stack.
6102   \fcvtdate()             [448]Section 8.13, format options added
6103   \fdelta2secs()          [449]Section 8.13
6104   \fdostounixpath(s1)     Converts a DOS filename to Unix format.
6105   \fsplit()               Now allows grouping/nesting in source string.
6106   \fword()                Allows the same grouping and nesting.
6107   \fjoin(&a,s1,n1,n2)     Copies an array into a single string.
6108   \fsubstitute(s1,s2,s3)  Substitutes characters within a string.
6109   \freplace()             Has new 4th "occurrence" argument.
6110   \fsexpression()         Evaluates an S-Expression (explained in [450]Section 9
6111 ).
6112   \ftrim(), \fltrim()     Now trim CR and LF by default, as well as SP and Tab.
6113   \funixtodospath(s1)     Converts a Unix filename to DOS format.
6114   \fkeywordval(s1,c1)     Assigns values to keywords (macros) (explained below).
6115
6116    Most functions that have "2" in their names to stand for the word "to"
6117    can now also be written with "to", e.g. "\fdelta2secs(),"
6118    \fdeltatosecs()."
6119
6120    \funtabify(string)
6121           (New to 8.0.211) Replaces Horizontal Tab characters in the given
6122           string with spaces based on VT100-like tab stops.
6123
6124    \fverify(s1,s2,n)
6125           As of version 8.0.211, returns -1 if s2 is an empty string.
6126           Previously it returned 0, making \fverify(abc,\%a) look as if
6127           \%a was a string combosed of a's, b's, and/or c's when in fact
6128           it contained nothing.
6129
6130    \fcode(string)
6131           As of version 8.0.211, returns 0 if string is empty or missing.
6132           Previously it returned the empty string, which made it unsafe to
6133           use in arithmetic or boolean expressions.
6134
6135    \v(inscale)
6136           New to version 8.0.211, its value is the INPUT SCALE-FACTOR
6137           ([451]Section 8.10), default 1.0.
6138
6139 8.7.1. The \fkeywordval() Function
6140
6141    \fkeywordval(s1,c1) is new to C-Kermit 8.0. Given a string s1 of the
6142    form "name=value", it creates a macro with the given name and assigns
6143    it the given value. If no value appears after the equal sign, any
6144    existing macro of the given name is undefined. Blanks are automatically
6145    trimmed from around the name and value. The optional c1 parameter is
6146    the assignment operator character, equal sign (=) by default. This
6147    function is handy for processing keyword parameters or any other form
6148    of parameter-value pair. Suppose, for example, you want to write a
6149    macro that accepts keyword parameters rather than positional ones:
6150
6151   define MYDIAL {
6152       local \%i modem hangup method device speed number
6153       def number 5551234          ; Assign default parameter values
6154       def speed 57600
6155       def modem usrobotics
6156       def hangup rs232
6157       def method tone
6158       def country 1
6159       for \%i 1 \v(argc)-1 1 {    ; Parse any keyword parameters...
6160           if not \fkeywordval(\&_[\%i]) end 1 Bad parameter: "\&_[\%i]"
6161       }
6162       set dial country \m(country)
6163       set modem type \m(modem)
6164       set modem hang \m(hangup)
6165       set dial method \m(tone)
6166       set line \m(device)
6167       if fail stop 1
6168       set speed \m(speed)
6169       if fail stop 1
6170       show comm
6171       set dial display on
6172       dial \m(number)
6173       if success connect
6174   }
6175
6176    In this example, all the defaults are set up inside the macro, and
6177    therefore it can be invoked with no parameters at all. But if you want
6178    to have the macro dial a different number, you can supply it as
6179    follows:
6180
6181   mydial number=7654321
6182
6183    You can supply any number of keyword parameters, and you can give them
6184    in any order:
6185
6186   mydial number=7654321 hangup=modem speed=115200
6187
6188 8.7.2. The \fsplit(), \fjoin(), and \fword() Functions
6189
6190    \fjoin(&a,s1,n1,n2) is also new; it creates a string from an array (or
6191    a piece of one). &a is the name of the array (a range specifier can be
6192    included); s1 is a character or string to separate each element in the
6193    result string (can be omitted, in which case the elements are not
6194    separated at all), and n1 is a grouping mask, explained below. If s1 is
6195    empty or not specified, the array elements are separated with spaces.
6196    If you want the elements concatenated with no separator, include a
6197    nonzero n2 argument. Given the array:
6198
6199   declare \&a[] = 0 1 2 3 4 5 6 7 8 9
6200
6201    you can get effects like this:
6202
6203   \fjoin(&a)      0 1 2 3 4 5 6 7 8 9
6204   \fjoin(&a,:)    0:1:2:3:4:5:6:7:8:9
6205   \fjoin(&a,{,})  0,1,2,3,4,5,6,7,8,9
6206   \fjoin(&a,...)  0...1...2...3...4...5...6...7...8...9
6207   \fjoin(&a,,,1)  0123456789
6208
6209    \fsplit(), \fword(), \fstripb(), and \fjoin() accept a "grouping mask"
6210    argument, n1, which is a number from 0 to 63, in which:
6211
6212    1 = "" doublequotes
6213    2 = {} braces
6214    4 = '' singlequotes
6215    8 = () parentheses
6216   16 = [] square brackets
6217   32 = <> angle brackets
6218
6219    These can be OR'd (added) together to make any number 0-63 (-1 is
6220    treated the same as 63, 0 means no grouping). If a bit is on, the
6221    corresponding kind of grouping is selected. (If more than 1 bit is set
6222    for \fjoin(), only the lowest-order one is used.)
6223
6224    If you include the same character in the grouping mask and the include
6225    list, the grouping mask takes precedence. Example:
6226
6227   def \%a  a "b c d" e
6228   \fsplit(\%a,&a[],,,-1)  = 3  <-- doublequote used for grouping
6229   \fsplit(\%a,&a[],,",-1) = 3  <-- doublequote still used for grouping
6230
6231    Nesting of matched left and right grouping characters (parentheses,
6232    braces, and brackets, but not quotes) is recognized. Example:
6233
6234   def \%a a (b c <d e [f g {h i} j k] l m> n o) p
6235   \fsplit(\%a,&a,,,0)  = 16 (no grouping)
6236   \fsplit(\%a,&a,,,2)  = 15 (braces only)
6237   \fsplit(\%a,&a,,,16) = 11 (square brackets only)
6238   \fsplit(\%a,&a,,,32) =  7 (angle brackets only)
6239   \fsplit(\%a,&a,,,63) =  3 (all)
6240   \fsplit(\%a,&a,,,-1) =  3 (all)
6241
6242    \fsplit() and \fjoin() are "reciprocal" functions. You can split a
6243    string up into an array and join it back into a new string that is
6244    equivalent, as long as \fsplit() and \fjoin() are given equivalent
6245    grouping masks, except that the type of braces might change. Example:
6246
6247   def \%a a {b c [d e] f g} "h i" j <k l> m
6248   echo STRING=[\%a]
6249   echo WORDS=\fsplit(\%a,&a,,,-1)
6250   show array a
6251   asg \%b \fjoin(&a,{ },2)
6252   echo JOIN  =[\%b]
6253   echo WORDS=\fsplit(\%b,&b,,,-1)
6254   show array b
6255
6256    The arrays a and b are identical. The strings a and b are as follows:
6257
6258   \%a: a {b c [d e] f g} "h i" j <k l> m
6259   \%b: a {b c [d e] f g} {h i} j {k l} m
6260
6261    It is possible to quote separator grouping characters with backslash to
6262    override their grouping function. And of course to include backslash
6263    itself in the string, it must be quoted too. Furthermore, each
6264    backslash must be doubled, so the command parser will still pass one
6265    backslash to \fsplit() for each two that it sees. Here are some
6266    examples using \fsplit() with a grouping mask of 8 (treat parentheses
6267    as grouping characters).
6268
6269   String                  Result
6270     a b c d e f             6
6271     a b\\ c d e f           5
6272     a b (c d e) f           4
6273     a b \\(c d e\\) f       6
6274     a b \\\\(c d e\\\\) f   7
6275
6276    \fsplit() has also been changed to create its array (if one is given)
6277    each time it is called, so now it can be conveniently called in a loop
6278    without having to redeclare the array each time.
6279
6280    Incidentally... Sometimes you might want to invoke \fsplit() in a
6281    situation where you don't care about its return value, e.g. when you
6282    just want to fill the array. Now you can "call" \fsplit() or any other
6283    function with the new [452]VOID command:
6284
6285   void \fsplit(\%a,&a)
6286
6287    \fsplit() and \fjoin() also accept a new, optional 6th argument, an
6288    options flag, a number that can specify a number of options. So far
6289    there is just one option, whose value is 1:
6290
6291    separator-flag
6292           Normally separators are collapsed. So, for example,
6293
6294   \fword(Three        little          words,2)
6295
6296           returns "little" (the second word). Space is a separator, but
6297           there are multiple spaces between each word. If the value 1 is
6298           included in the option flag, however, each separator counts. If
6299           two separators are adjacent, an empty word is produced between
6300           them. This is useful for parsing (e.g.) comma-separated lists
6301           exported from databases or spreadsheets.
6302
6303 8.7.3. The \fcmdstack() Function
6304
6305    The new \fcmdstack() function gives accesss to the command stack:
6306
6307    \fcmdstack(n1,n2)
6308           Arguments: n1 is the command stack level. If omitted, the
6309           current level, \v(cmdlevel), is used. n2 is a function code
6310           specifying the desired type of information:
6311
6312   0 (default) = name of object at level n1.
6313   1 (nonzero) = object type (0 = prompt; 1 = command file; 2 = macro).
6314
6315           The default for n2 is 0.
6316
6317    The name associated with prompt is "(prompt)". Here's a loop that can
6318    be included in a macro or command file to show the stack (similar to
6319    what the SHOW STACK command does):
6320
6321   for \%i \v(cmdlevel) 0 -1 {
6322       echo \%i. [\fcmdstack(\%i,1)] \fcmdstack(\%i,0)
6323   }
6324
6325    In this connection, note that \v(cmdfile) always indicates the most
6326    recently invoked active command file (if any), even if that file is
6327    executing a macro. Similarly, \v(macro) indicates the most recently
6328    invoked macro (if any), even if the current command source is not a
6329    macro. The name of the "caller" of the currently executing object
6330    (command file or macro) is:
6331
6332   \fcmdstack(\v(cmdlevel)-1)
6333
6334    and its type is:
6335
6336   \fcmdstack(\v(cmdlevel)-1,1)
6337
6338    To find the name of the macro that invoked the currently executing
6339    object, even if one or more intermediate command files (or prompting
6340    levels) are involved, use a loop like this:
6341
6342   for \%i \v(cmdlevel)-1 0 -1 {
6343       if = \fcmdstack(\%i,1) 2 echo CALLER = \fcmdstack(\%i,0)
6344   }
6345
6346    Of course if you make a macro to do this, the macro must account for
6347    its own additional level:
6348
6349   define CALLER {
6350       for \%i \v(cmdlevel)-2 0 -1 {
6351           if = \fcmdstack(\%i,1) 2 return \fcmdstack(\%i,0)
6352       }
6353       return "(none)"
6354   }
6355
6356    The built-in variable \v(cmdsource) gives the current command source as
6357    a word ("prompt", "file", or "macro").
6358
6359 8.7.4. The VOID Command
6360
6361    VOID is like ECHO in that all functions and variables in its argument
6362    text are evaluated. but it doesn't print anything (except possibly an
6363    error message if a function was invocation contained or resulted in any
6364    errors). VOID sets FAILURE if it encounters any errors, SUCCESS
6365    otherwise.
6366
6367    [ [453]Top ] [ [454]Contents ] [ [455]C-Kermit Home ] [ [456]Kermit
6368    Home ]
6369
6370 8.8. The RETURN and END Commands
6371
6372    The execution of a macro is terminated in any of the following ways:
6373
6374      * With an END [ number [ message ] ] command. If a number is given,
6375        the macro succeeds if the number is 0, and fails if it is not zero;
6376        if a number is not given, the macro succeeds.
6377      * With a STOP command, which works just like END except it peels back
6378        the command stack all the way to top level.
6379      * With a RETURN [ text ] command, in which case the macro always
6380        succeeds.
6381      * By running out of commands to execute, in which case the macro
6382        succeeds or fails according the most recently executed command that
6383        sets success or failure.
6384
6385    The same considerations apply to command files invoked by the TAKE
6386    command.
6387
6388    If a macro does not execute any commands that set success or failure,
6389    then invoking the macro does not change the current SUCCESS/FAILURE
6390    status. It follows, then, that the mere invocation of a macro does not
6391    change the SUCCESS/FAILURE status either. This makes it possible to
6392    write macros to react to the status of other commands (or macros), for
6393    example:
6394
6395   define CHKLINE {
6396       if success end 0
6397       stop 1 SET LINE failed - please try another device.
6398   }
6399   set modem type usrobotics
6400   set line /dev/cua0
6401   chkline
6402   set speed 57600
6403   dial 7654321
6404
6405    By the way, none of this is news. But it was not explicitly documented
6406    before, and C-Kermit 7.0 and earlier did not always handle the RETURN
6407    statement as it should have.
6408
6409    [ [457]Top ] [ [458]Contents ] [ [459]C-Kermit Home ] [ [460]Kermit
6410    Home ]
6411
6412 8.9. UNDEFINing Groups of Variables
6413
6414    The UNDEFINE command, which previously accepted one variable name, now
6415    accepts a list of them, and also accepts wildcard notation to allow
6416    deletion of variables that match a given pattern.
6417
6418    UNDEFINE [ switches ] name [ name [ name [ ... ] ] ]
6419           Undefines the variables whose names are given. Up to 64 names
6420           may be given in one UNDEFINE command.
6421
6422    If you omit the switches and include only one name, the UNDEFINE
6423    command works as before.
6424
6425    Switches include:
6426
6427    /MATCHING
6428           Specifies that the names given are to treated as patterns rather
6429           than literal variable names. Note: pattern matching can't be
6430           used with array references; use the ARRAY command to manipulate
6431           arrays and subarrays.
6432
6433    /LIST
6434           List the name of each variable to be undefined, and whether it
6435           was undefined successfully ("ok" or "error"), plus a summary
6436           count at the end.
6437
6438    /SIMULATE
6439           List the names of the variables that would be deleted without
6440           actually deleting them. Implies /LIST.
6441
6442    The UNDEFINE command fails if there were any errors and succeeds
6443    otherwise.
6444
6445    The new _UNDEFINE command is like UNDEFINE, except the names are
6446    assumed to be variable names themselves, which contain the names (or
6447    parts of them) of the variables to be undefined. For example, if you
6448    have the following definitions:
6449
6450   define \%a foo
6451   define foo This is some text
6452
6453    then:
6454
6455   undef \%a
6456
6457    undefines the variable \%a, but:
6458
6459   _undef \%a
6460
6461    undefines the macro foo.
6462
6463    Normal Kermit patterns are used for matching; metacharacters include
6464    asterisk, question mark, braces, and square brackets. Thus, when using
6465    the /MATCHING switch, if the names of the macros you want to undefine
6466    contain any of these characters, you must quote them with backslash to
6467    force them to be taken literally. Also note that \%* is not the name of
6468    a variable; it is a special notation used within a macro for "all my
6469    arguments". The command "undef /match \%*" deletes all \%x variables,
6470    where x is 0..9 and a..z. Use "undef /match \%[0-9]" to delete macro
6471    argument variables or "undef /match \%[i-n]" to delete a range of \%x
6472    variables.
6473
6474    [ [461]Top ] [ [462]Contents ] [ [463]C-Kermit Home ] [ [464]Kermit
6475    Home ]
6476
6477 8.10. The INPUT and MINPUT Commands
6478
6479    As of C-Kermit 8.0.211, the INPUT and MINPUT commands accept a switch:
6480
6481    [M]INPUT /NOMATCH timeout
6482           The /NOMATCH switch allows INPUT or MINPUT to read incoming
6483           material for the specified amount of time, without attempting to
6484           match it with any text or patterns. When this switch is
6485           included, the [M]INPUT command succeeds when the timeout
6486           interval expires, with \v(instatus) set to 1, meaning "timed
6487           out", or fails upon interruption or i/o error.
6488
6489    Also in version 8.0.211, there is a new way to apply a scale factor to
6490    [M]INPUT timeouts:
6491
6492    SET INPUT SCALE-FACTOR floating-point-number
6493           This scales all [M]INPUT timeouts by the given factor, allowing
6494           time-sensitive scripts to be adjusted to changing conditions
6495           such as congested networks or different-speed modems without
6496           having to change each INPUT-class command. This affects only
6497           those timeouts that are given in seconds, not as wall-clock
6498           times. Although the scale factor can have a fractional part, the
6499           INPUT timeout is still an integer. The new built-in variable
6500           \v(inscale) tells the current INPUT SCALE-FACTOR.
6501
6502    The MINPUT command can be used to search the incoming data stream for
6503    several targets simultaneously. For example:
6504
6505   MINPUT 8 one two three
6506
6507    waits up to 8 seconds for one of the words "one", "two", or "three" to
6508    arrive. Words can be grouped to indicate targets that contain spaces:
6509
6510   MINPUT 8 nineteen twenty "twenty one"
6511
6512    And of course you can also use variables in place of (or as part of)
6513    the target names:
6514
6515   MINPUT 8 \%a \&x[3] \m(foo)
6516
6517    Until now you had to know the number of targets in advance when writing
6518    the MINPUT statement. Each of the examples above has exactly three
6519    targets.
6520
6521    But suppose your script needs to look for a variable number of targets.
6522    For this you can use arrays and \fjoin(), described in [465]Section
6523    8.7. Any number of \fjoin() invocations can be included in the MINPUT
6524    target list, and each one is expanded into the appropriate number of
6525    separate targets each time the MINPUT command is executed. Example:
6526
6527   declare \&a[10] = one two three
6528   minput 10 foo \fjoin(&a) bar
6529
6530    This declares an array of ten elements, and assigns values to the first
6531    three of them. The MINPUT command looks for these three (as well as the
6532    words "foo" and "bar"). Later, if you assign additional elements to the
6533    array, the same MINPUT command also looks for the new elements.
6534
6535    If an array element contains spaces, each word becomes a separate
6536    target. To create one target per array element, use \fjoin()'s grouping
6537    feature:
6538
6539   dcl \&a[] = {aaa bbb} {ccc ddd} {xxx yyy zzz}
6540
6541   minput 10 \fjoin(&a)     <-- 7 targets
6542   minput 10 \fjoin(&a,,2)  <-- 3 targets
6543
6544    [ [466]Top ] [ [467]Contents ] [ [468]C-Kermit Home ] [ [469]Kermit
6545    Home ]
6546
6547 8.11. Learned Scripts
6548
6549    C-Kermit now includes a simple script recorder that monitors your
6550    commands, plus your actions during CONNECT mode, and automatically
6551    generates a script program that mimics what it observed. You should
6552    think of this feature as a script-writing ASSISTANT since, as you will
6553    see [470]later in this section, the result generally needs some editing
6554    to make it both secure and flexible. The script recorder is controlled
6555    by the new LEARN command:
6556
6557    LEARN [ /ON /OFF /CLOSE ] [ filename ]
6558           If you give a filename, the file is opened for subsequent
6559           recording. The /ON switch enables recording to the current file
6560           (if any); /OFF disables recording. /CLOSE closes the current
6561           script recording file (if any). If you give a filename without
6562           any switches, /ON is assumed.
6563
6564    The /OFF and /ON switches let you turn recording off and on during a
6565    session without closing the file.
6566
6567    When recording:
6568
6569      * All commands that you type (or recall) at the prompt are recorded
6570        in the file except:
6571           + LEARN commands are not recorded.
6572           + The CONNECT command is not recorded.
6573           + The TELNET command is converted to SET HOST /NETWORK:TCP.
6574      * Commands obtained from macros or command files are not recorded.
6575      * During CONNECT:
6576           + Every line you type is converted to an OUTPUT command.
6577           + The last prompt before any line you type becomes an INPUT
6578             command.
6579           + Timeouts are calculated automatically for each INPUT command.
6580           + A PAUSE command is inserted before each OUTPUT command just to
6581             be safe.
6582
6583    Thus the script recorder is inherently line-oriented. It can't be used
6584    to script character-oriented interactions like typing Space to a
6585    "More?" prompt or editing a text file with VI or EMACS.
6586
6587    But it has advantages too; for example it takes control characters into
6588    account that might not be visible to you otherwise, and it
6589    automatically converts control characters in both the input and output
6590    streams to the appropriate notation. It can tell, for example that the
6591    "$ " prompt on the left margin in UNIX is really {\{13}\{10}$ },
6592    whereas in VMS it might be {\{13}\{10}\{13}$ }. These sequences are
6593    detected and recorded automatically.
6594
6595    A learned script should execute correctly when you give a TAKE command
6596    for it. However, it is usually appropriate to edit the script a bit.
6597    The most important change would be to remove any passwords from it. For
6598    example, if the script contains:
6599
6600   INPUT 9 {\{13}\{10}Password: }
6601   IF FAIL STOP 1 INPUT timeout
6602   PAUSE 1
6603   OUTPUT bigsecret\{13}
6604
6605    you should replace this by something like:
6606
6607   INPUT 9 {\{13}\{10}Password: }
6608   IF FAIL STOP 1 INPUT timeout
6609   ASKQ pswd Please type your password:
6610   PAUSE 1
6611   OUTPUT \m(pswd)\{13}
6612
6613    The LEARN command can't do this for you since it knows nothing about
6614    "content"; it only knows about lines and can't be expected to parse or
6615    understand them -- after all, the Password prompt might be in some
6616    other language. So remember: if you use the LEARN command to record a
6617    login script, be sure edit the resulting file to remove any passwords.
6618    Also be sure to delete any backup copies your editor or OS might have
6619    made of the file.
6620
6621    Other manual adjustments might also be appropriate:
6622
6623      * If the target of an INPUT command can vary, you can replace the
6624        INPUT command with MINPUT and the appropriate target list, and/or
6625        the target with a \fpattern(). For example, suppose you are dialing
6626        a number that can be answered by any one of 100 terminal servers,
6627        whose prompts are ts-00>, ts-01>, ts-02>, ... ts-99>. The script
6628        records a particular one of these, but you want it to work for all
6629        of them, so change (e.g.):
6630   INPUT 10 ts-23>  ; or whatever
6631
6632        to:
6633   INPUT 10 \fpattern(ts-[0-9][0-9]>)
6634
6635      * The INPUT timeout values are conservative, but they are based only
6636        on a single observation; you might need to tune them.
6637      * The PAUSE commands might not be necessary, or the PAUSE interval
6638        might need adjustment.
6639      * In case you made typographical errors during recording, they are
6640        incorporated in your script; you can edit them out if you want to.
6641
6642    Here is a sample script generated by Kermit ("learn vms.ksc") in which
6643    a Telnet connection is made to a VMS computer, the user logs in, starts
6644    Kermit on VMS, sends it a file, and then logs out:
6645
6646   ; Scriptfile: vms.ksc
6647   ; Directory:  /usr/olga
6648   ; Recorded:   20001124 15:21:23
6649
6650   SET HOST /NETWORK:TCP vms.xyzcorp.com
6651   IF FAIL STOP 1 Connection failed
6652
6653   INPUT 7 {\{13}\{10}\{13}Username: }
6654   IF FAIL STOP 1 INPUT timeout
6655   PAUSE 1
6656   OUTPUT olga\{13}
6657   INPUT 3 {\{13}\{10}\{13}Password: }
6658   IF FAIL STOP 1 INPUT timeout
6659   PAUSE 1
6660   OUTPUT secret\{13}
6661   INPUT 18 {\{13}\{10}\{13}$ }
6662   IF FAIL STOP 1 INPUT timeout
6663   PAUSE 1
6664   OUTPUT set default [.incoming]\{13}
6665   INPUT 12 {\{13}\{10}\{13}$ }
6666   IF FAIL STOP 1 INPUT timeout
6667   PAUSE 1
6668   OUTPUT kermit\{13}
6669   INPUT 15 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
6670   IF FAIL STOP 1 INPUT timeout
6671   PAUSE 1
6672   OUTPUT receive\{13}
6673   send myfile.txt
6674
6675   INPUT 18 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
6676   IF FAIL STOP 1 INPUT timeout
6677   PAUSE 1
6678   OUTPUT exit\{13}
6679   INPUT 6 {\{13}\{10}\{13}$ }
6680   IF FAIL STOP 1 INPUT timeout
6681   PAUSE 1
6682   OUTPUT logout\{13}
6683   close
6684   exit
6685
6686    The commands generated by Kermit during CONNECT (INPUT, IF FAIL, PAUSE,
6687    and OUTPUT) have uppercase keywords; the commands typed by the user are
6688    in whatever form the user typed them (in this case, lowercase).
6689
6690    [ [471]Top ] [ [472]Contents ] [ [473]C-Kermit Home ] [ [474]Kermit
6691    Home ]
6692
6693 8.12. Pattern Matching
6694
6695    A pattern is a character string that is used to match other strings.
6696    Patterns can contain metacharacters that represent special actions like
6697    "match any single character", "match zero or more characters", "match
6698    any single character from a list", and so on. The best known
6699    application of patterns is in file specifications that contain
6700    wildcards, as in "send *.txt", meaning "send all files whose names end
6701    with .txt".
6702
6703    Patterns are also used in increasingly many other ways, to the extent
6704    it is useful to point out certain important distinctions in the ways in
6705    which they are used:
6706
6707    Anchored Patterns
6708           If an anchored pattern does not begin with "*", it must match
6709           the beginning of the string, and if it does not end with "*", it
6710           must match the end of the string. For example, the anchored
6711           pattern "abc" matches only the string "abc", not "abcde" or
6712           "xyzabc" or "abcabc". The anchored pattern "abc*" matches any
6713           string that starts with "abc"; the anchored pattern "*abc"
6714           matches any string that ends with "abc"; the anchored pattern
6715           "*abc*" matches any string that contains "abc" (including any
6716           that start and/or end with it).
6717
6718    Floating Patterns
6719           A floating pattern matches any string that contains a substring
6720           that matches the pattern. In other words, a floating pattern has
6721           an implied "*" at the beginning and end. You can anchor a
6722           floating pattern to the beginning by starting it with "^", and
6723           you can anchor it to the end by ending it with "$" (see examples
6724           below).
6725
6726    Wildcards
6727           A wildcard is an anchored pattern that has the additional
6728           property that "*" does not match directory separators.
6729
6730    This terminology lets us describe Kermit's commands with a bit more
6731    precision. When a pattern is used for matching filenames, it is a
6732    wildcard, except in the TEXT-PATTERNS and BINARY-PATTERNS lists and
6733    /EXCEPT: clauses, in which case directory separators are not
6734    significant (for example, a BINARY-PATTERN of "*.exe" matches any file
6735    whose name ends in .exe, no matter how deeply it might be buried in
6736    subdirectories). When Kermit parses a file specification directly,
6737    however, it uses the strict wildcard definition. For example, "send
6738    a*b" sends all files whose names start with "a" and end with "b" in the
6739    current directory, and not any files whose names end with "b" that
6740    happen to be in subdirectories whose names start with "a". And as
6741    noted, wildcards are anchored, so "delete foo" deletes the file named
6742    "foo", and not all files whose names happen to contain "foo".
6743
6744    Most other patterns are anchored. For example:
6745
6746   if match abc bc ...
6747
6748    does not succeed (and you would be surprised if it did!). In fact, the
6749    only floating patterns are the ones used by commands or functions that
6750    search for patterns in files, arrays, or strings. These include:
6751
6752      * The GREP and TYPE /MATCH commands.
6753      * The \fsearch(), \frsearch(), and \farraylook() functions.
6754
6755    Thus these are the only contexts in which explicit anchors ("^" and
6756    "$") may be used:
6757
6758    grep abc *.txt
6759           Prints all lines containing "abc" in all files whose names end
6760           with ".txt".
6761
6762    grep ^abc *.txt
6763           Prints all lines that start with "abc" in all ".txt" files.
6764
6765    grep abc$ *.txt
6766           Prints all lines that end with "abc" in all ".txt" files.
6767
6768    grep ^a*z$ *.txt
6769           Prints all lines that start with "a" and end with "z" in all
6770           ".txt" files.
6771
6772    Similarly for TYPE /PAGE, /fsearch(), /frsearch(), and \farraylook().
6773
6774    Here is a brief summary of anchored and floating pattern equivalences:
6775
6776   Anchored   Floating
6777     abc       ^abc$
6778     *abc      abc$
6779     abc*      ^abc
6780     *abc*     abc
6781
6782    [ [475]Top ] [ [476]Contents ] [ [477]C-Kermit Home ] [ [478]Kermit
6783    Home ]
6784
6785 8.13. Dates and Times
6786
6787    C-Kermit's comprehension of date-time formats is considerably expanded
6788    in version 8.0. Any command that reads dates, including the DATE
6789    command itself, or any switch, such as the /BEFORE: and /AFTER:
6790    switches, or any function such as \fcvtdate(), now can understand dates
6791    and times expressed in any ISO 8601 format, in Unix "asctime" format,
6792    in FTP MDTM format, and in practically any format used in RFC 822 or
6793    RFC 2822 electronic mail, with or without timezones, and in a great
6794    many other formats as well. HELP DATE briefly summarizes the acceptable
6795    date-time formats.
6796
6797    Furthermore, C-Kermit 8.0 includes a new and easy-to-use form of
6798    date-time arithmetic, in which any date or time can be combined with a
6799    "delta time", to add or subtract the desired time interval (years,
6800    months, weeks, days, hours, minutes, seconds) to/from the given date.
6801    And new functions are available to compare dates and to compute their
6802    differences.
6803
6804    As you can imagine, all this requires quite a bit of "syntax". The
6805    basic format is:
6806
6807   [ date ] [ time ] [ delta ]
6808
6809    Each field is optional, but in most cases (depending on the context)
6810    there must be at least one field. If a date is given, it must come
6811    first. If no date is given, the current date is assumed. If no time is
6812    given, an appropriate time is supplied depending on whether a date was
6813    supplied. If no delta is given, no arithmetic is done. If a delta is
6814    given without a date or time, the current date and time are used as the
6815    base.
6816
6817    Date-time-delta fields are likely to contain spaces (although they need
6818    not; space-free forms are always available). Therefore, in most
6819    contexts -- and notably as switch arguments -- date-time information
6820    must be enclosed in braces or doublequotes, for example:
6821
6822   send /after:"8-Aug-2001 12:00 UTC" *.txt
6823
6824    Kermit's standard internal format for dates and times is:
6825
6826   yyyymmdd hh:mm:ss
6827
6828    for example:
6829
6830   20010208 10:28:01
6831
6832    Date-times can always be given in this format. yyyy is the 4-digit
6833    year, mm is the two-digit month (1-12; supply leading zero for
6834    Jan-Sep), dd is the 2-digit day (leading zero for 1-9), hh is the hour
6835    (0-23), mm the minute (0-59), ss the second (0-59), each with leading
6836    zero if less than the field width. The date and time can be separated
6837    by a space, an underscore, a colon, or the letter T. The time is in
6838    24-hour format. Thus the various quantities are at the following fixed
6839    positions:
6840
6841 Position  Contents
6842    1-4    Year   (4 digits, 0000-9999)
6843    5-6    Month  (2 digits, 1-12)
6844    7-8    Day    (2 digits, 1-31)
6845    9      Date-Time Separator (space, :, _, or the letter T)
6846   10-11   Hour   (2 digits, 0-23)
6847   12      Hour-Minute Separator (colon)
6848   13-14   Minute (2 digits, 0-59)
6849   15      Minute-Second Separator (colon)
6850   16-17   Second (2 digits, 0-59)
6851
6852    Example:
6853
6854   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
6855
6856    This is the format produced by the DATE command and by any function
6857    that returns a date-time. It is suitable for lexical comparison and
6858    sorting, and for use as a date-time in any Kermit command. When this
6859    format is given as input to a command or function, various date-time
6860    separators (as noted) are accepted:
6861
6862   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
6863   20010208_10:28:35  2 February 2001, 10:28:35 AM
6864   18580101:12:00:00  1 January 1858, noon
6865   20110208T00:00:00  2 February 2011, midnight
6866
6867    Certain other special date-time formats that are encountered on
6868    computer networks are recognized:
6869
6870    Asctime Format
6871           This is a fixed format used by Unix, named after Unix's
6872           asctime() ("ASCII time") function. It is always exactly 24
6873           characters long. Example: Fri Aug 10 16:38:01 2001
6874
6875    Asctime with Timezone
6876           This is like Asctime format, but includes a 3-character timezone
6877           between the time and year. It is exactly 28 characters long.
6878           Example: Fri Aug 10 16:38:01 GMT 2001
6879
6880    E-Mail Format
6881           E-mail date-time formats are defined in [479]RFC 2822 with a
6882           fair amount of flexibility and options. The following examples
6883           are typical of e-mails and HTTP (web-page) headers:
6884
6885   Sat, 14 Jul 2001 11:49:29                (No timezone)
6886   Fri, 24 Mar 2000 14:19:59 EST            (Symbolic timezone)
6887   Tue, 26 Jun 2001 10:19:45 -0400 (EDT)    (GMT Offset + comment)
6888
6889    FTP MDTM Format
6890           This is the date-time format supplied by FTP servers that
6891           support the (not yet standard but widely used nevertheless) MDTM
6892           command, by which the FTP client asks for a file's modification
6893           time:
6894
6895   yyyymmddhhmmss[.ffff]
6896
6897           where yyyy is the 4-digit year, mm is the 2-digit month, and so
6898           on, exactly 14 digits long. An optional fractional part
6899           (fraction of second) may also be included, separated by a
6900           decimal point (period). Kermit rounds to the nearest second.
6901           Example:
6902
6903   20020208102835.515                       (8 February 2002 10:28:36 AM)
6904
6905 8.13.1. The Date
6906
6907    The date, if given, must precede the time and/or delta, and can be in
6908    many, many formats. For starters, you can use several symbolic date
6909    names in place of actual dates:
6910
6911    NOW
6912           This is replaced by the current date and time. The time can not
6913           be overriden (if you want to supply a specific time, use TODAY
6914           rather than NOW).
6915
6916    TODAY
6917           This is replaced by the current date and a default time of
6918           00:00:00 is supplied, but can be overridden by a specific time;
6919           for example, if today is 8 February 2002, then "TODAY" is
6920           "20020802 00:00:00" but "TODAY 10:28" is "20020802 10:28:00".
6921
6922    TOMORROW
6923           Like TODAY, but one day later (if today is 8 February 2002, then
6924           "TOMORROW" is "20020803 00:00:00" but "TOMORROW 16:30" is
6925           "20020803 16:30:00").
6926
6927    YESTERDAY
6928           Like TODAY, but one day earlier.
6929
6930    MONDAY, TUESDAY, WEDNESDAY, ..., SUNDAY
6931           The date on the given day of the week, today or later. A default
6932           time of 00:00:00 is supplied but can be overridden. Example:
6933           "SATURDAY 12:00" means next Saturday (or today, if today is
6934           Saturday) at noon.
6935
6936    You can give an explicit date in almost any conceivable format, but
6937    there are some rules:
6938
6939      * If a date is given, it must have three fields: day, month, and
6940        year; the order can vary (except that the month can not be last).
6941      * If names are used for days, months, etc, they must be English.
6942      * The year must lie between 0000 and 9999, inclusive.
6943      * All calendar calculations use Gregorian dating, so calculated dates
6944        for years prior to 1582 (or later, depending on the country) will
6945        not agree with historical dates. Other forms of dating (e.g.
6946        Hebrew, Chinese) are not supported.
6947
6948    Various date-field separators are accepted: hyphen, slash, space,
6949    underscore, period. The same field separator (if any) must be used in
6950    both places; for example 18-Sep-2001 but not 18-Sep/2001. Months can be
6951    numeric (1-12) or English names or abbreviations. Month name
6952    abbreviations are normally three letters, e.g. Apr, May, Jun, Jul.
6953    Capitalization doesn't matter.
6954
6955    Here are a few examples:
6956
6957   18 Sep 2001                              (English month, abbreviated)
6958   18 September 2001                        (English month, spelled out)
6959   2001 Sept 18                             (Year, month, day)
6960   18-Sep-2001                              (With hyphens)
6961   18/09/2001                               (All numeric with slashes)
6962   18.09.2001                               (Ditto, with periods)
6963   18_09_2001                               (Ditto, with underscores)
6964   09/18/2001                               (See below)
6965   2001/09/18                               (See below)
6966   September 18, 2001                       (Correspondence style)
6967   Sep-18-2001                              (Month-day-year)
6968   20010918                                 (Numeric, no separators)
6969
6970    You can also include the day of the week with a specific date, in which
6971    case it is accepted (if it is a valid day name), but not verified to
6972    agree with the given date:
6973
6974   Tue, 18 Sep 2001                         (Abbreviated, with comma)
6975   Tue,18 Sep 2001                          (Comma but no space)
6976   Tue 18 Sep 2001                          (Abbreviated, no comma)
6977   Tuesday 18 Sep 2001                      (Spelled out)
6978   Tuesday, 18 Sep 2001                     (etc)
6979   Friday, 18 Sep 2001                      (Accepted even if not Friday)
6980
6981    In all-numeric dates with the year last, such as 18/09/2001, Kermit
6982    identifies the year because it's 4 digits, then decides which of the
6983    other two numbers is the month or day based on its value. If both are
6984    12 or less and are unequal, the date is ambiguous and is rejected. In
6985    all-numeric dates with the year first, the second field is always the
6986    month and the third is the day. The month never comes last. A date with
6987    no separators is accepted only if it is all numeric and has exactly
6988    eight digits, and is assumed to be in yyyymmdd format.
6989
6990   20010918                                 (18-Sep-2001 00:00:00)
6991
6992    or 14 digits (as in FTP MDTM format):
6993
6994   20010918123456                           (18-Sep-2001 12:34:56)
6995
6996    You can always avoid ambiguity by putting the year first, or by using
6997    an English, rather than numeric, month. A date such as 09/08/2001 would
6998    be ambiguous but 2001/09/08 is not, nor is 09-Aug-2001.
6999
7000    Until the late 1990s, it was common to encounter 2-digit years, and
7001    these are found to this day in old e-mails and other documents. Kermit
7002    accepts these dates if they have English months, and interprets them
7003    according to the windowing rules of [480]RFC 2822: "If a two digit year
7004    is encountered whose value is between 00 and 49, the year is
7005    interpreted by adding 2000, ending up with a value between 2000 and
7006    2049. If a two digit year is encountered with a value between 50 and
7007    99, or any three digit year is encountered, the year is interpreted by
7008    adding 1900."
7009
7010    If you need to specify a year prior to 1000, use leading zeros to
7011    ensure it is not misinterpreted as a "non-Y2K-compliant" modern year:
7012
7013   7-Oct-77                                 (19771007 00:00:00)
7014   7-Oct-0077                               (00771007 00:00:00)
7015
7016 8.13.2. The Time
7017
7018    The basic time format is hh:mm:dd; that is hours, minutes, seconds,
7019    separated by colons, perhaps with an optional fractional second
7020    separated by a decimal point (period). The hours are in 24-hour format;
7021    12 is noon, 13 is 1pm, and so on. Fields omitted from the right default
7022    to zero. Fields can be omitted from the left or middle by including the
7023    field's terminating colon. Examples:
7024
7025   11:59:59                                 (11:59:59 AM)
7026   11:59                                    (11:59:00 AM)
7027   11                                       (11:00:00 AM)
7028   11:59:59.33                              (11:59:59 AM)
7029   11:59:59.66                              (Noon)
7030   03:21:00                                 (3:21:00 AM)
7031   3:21:00                                  (3:21:00 AM)
7032   15:21:00                                 (3:21:00 PM)
7033   :21:00                                   (00:21:00 AM)
7034   ::01                                     (00:00:01 AM)
7035   11::59                                   (11:00:59 AM)
7036
7037    Leading zeros can be omitted, but it is customary and more readable to
7038    keep them in the minute and second fields:
7039
7040   03:02:01                                 (03:02:01 AM)
7041   3:02:01                                  (03:02:01 AM)
7042   3:2:1                                    (03:02:01 AM)
7043
7044    AM/PM notation is accepted if you wish to use it:
7045
7046   11:59:59                                 (11:59:59 AM)
7047   11:59:59AM                               (11:59:59 AM)
7048   11:59:59A.M.                             (11:59:59 AM)
7049   11:59:59am                               (11:59:59 AM)
7050   11:59:59a.m.                             (11:59:59 AM)
7051   11:59:59PM                               (11:59:59 PM = 23:59:59)
7052   11:59:59P.M.                             (11:59:59 PM = 23:59:59)
7053   11:59:59pm                               (11:59:59 PM = 23:59:59)
7054   11:59:59p.m.                             (11:59:59 PM = 23:59:59)
7055
7056    You can omit the colons if you wish, in which case Kermit uses the
7057    following rules to interpret the time:
7058
7059     1. 6 digits is hh:mm:ss, e.g. 123456 is 12:34:56.
7060     2. 5 digits is h:mm:ss, e.g. 12345 is 1:23:45.
7061     3. 4 digits is hh:mm, e.g. 1234 is 12:34.
7062     4. 3 digits is h:mm, e.g. 123 is 1:23.
7063     5. 2 digits is hh, e.g. 12 is 12:00.
7064     6. 1 digit is h (the hour), e.g. 1 is 1:00.
7065
7066    Examples:
7067
7068   1                                        (01:00:00 AM)
7069   10                                       (10:00:00 AM)
7070   230                                      (02:30:00 AM)
7071   230pm                                    (02:30:00 PM = 14:30:00)
7072   1115                                     (11:15:00 AM)
7073   2315                                     (11:15:00 PM = 23:15:00 PM)
7074   23150                                    (02:31:50 AM)
7075   231500                                   (23:15:00 PM)
7076
7077 8.13.3. Time Zones
7078
7079    If a time is given, it can (but need not) be followed by a time zone
7080    designator. If no time zone is included, the time is treated as local
7081    time and no timezone conversions are performed.
7082
7083    The preferred time zone designator is the UTC Offset, as specified in
7084    [481]RFC 2822: a plus sign or minus sign immediately followed by
7085    exactly four decimal digits, signifying the difference in hh (hours)
7086    and mm (minutes) from Universal Coordinated Time (UTC, also known as
7087    Greenwich Mean Time, or GMT), with negative numbers to the West and
7088    positive numbers to the East. For example:
7089
7090   Fri, 13 Jul 2001 12:54:29 -0700
7091
7092    indicates a local time of 12:54:29 that is 07 hours and 00 minutes
7093    behind (less than, East of) Universal Time. The space is optional, so
7094    the example could also be written as:
7095
7096   Fri, 13 Jul 2001 12:54:29-0700
7097
7098    The following symbolic time zones are also accepted, as specified by
7099    [482]RFC 2822 and/or in ISO 8601:
7100
7101   GMT  =  +0000       Greenwich Mean Time
7102   Z    =  +0000       Zulu (Zero Meridian) Time
7103   UTC  =  +0000       Universal Coordinated Time
7104   UT   =  +0000       Universal Time
7105   EDT  =  -0400       Eastern (USA) Daylight Time
7106   EST  =  -0500       Eastern (USA) Standard Time
7107   CDT  =  -0500       Central (USA) Daylight Time
7108   CST  =  -0600       Central (USA) Standard Time
7109   MDT  =  -0600       Mountain (USA) Daylight Time
7110   MST  =  -0700       Mountain (USA) Standard Time
7111   PDT  =  -0700       Pacific (USA) Daylight Time
7112   PST  =  -0800       Pacific (USA) Standard Time
7113
7114    Note that GMT, Z, UTC, and UT all express the same concept: standard
7115    (not daylight) time at the Zero Meridian. UTC, by the way, is an
7116    international standard symbol and does not correspond to the order of
7117    the English words, Universal Coordinated Time, but it happens to have
7118    the same initial letters as these words. Of course hundreds of other
7119    symbolic timezones and variations exist, but they are not standardized,
7120    and are therefore not supported by Kermit.
7121
7122    When a time zone is included with a time, the time is converted to
7123    local time. In case the conversion crosses a midnight boundary, the
7124    date is adjusted accordingly. Examples converting to EST (Eastern USA
7125    Standard Time = -0500):
7126
7127  11:30:00      =  11:30:00
7128  11:30:00 EST  =  11:30:00
7129  11:30:00 GMT  =  06:30:00
7130  11:30:00 PST  =  14:30:00
7131  11:30:00Z     =  06:30:00
7132  11:30PM GMT   =  18:30:00
7133  11:30 -0500   =  11:30:00
7134  11:30 -0800   =  08:30:00
7135  11:30 +0200   =  04:30:00
7136
7137    Unlike most of Kermit's other date-time conversions, timezone knowledge
7138    (specifically, the offset of local time from UTC) is embodied in the
7139    underlying operating system, not in Kermit itself, and any conversion
7140    errors in this department are the fault of the OS. For example, most
7141    UNIX platforms do not perform conversions for years prior to 1970.
7142
7143 8.13.4. Delta Time
7144
7145    Date/time expressions can be composed of a date and/or time and a delta
7146    time, or a delta time by itself. When a delta time is given by itself,
7147    it is relative to the current local date and time. Delta times have the
7148    following general format:
7149
7150   {+,-}[number units][hh[:mm[:ss]]]
7151
7152    In other words, a delta time always starts with a plus or minus sign,
7153    which is followed by a "part1", a "part2", or both. The "part1", if
7154    given, specifies a number of days, weeks, months, or years; "part2"
7155    specifies a time in hh:mm:ss notation. In arithmetic terms, these
7156    represents some number of days or other big time units, and then a
7157    fraction of a day expressed as hours, minutes, and seconds; these are
7158    to be added to or subtracted from the given (or implied) date and time.
7159    The syntax is somewhat flexible, as shown by the following examples:
7160
7161   +1 day                (Plus one day)
7162   +1day                 (Ditto)
7163   +1d                   (Ditto)
7164   + 1 day               (Ditto)
7165   + 1 day 3:00          (Plus one day and 3 hours)
7166   +1d3:00               (Ditto)
7167   +1d3                  (Ditto)
7168   +3:00:00              (Plus 3 hours)
7169   +3:00                 (Ditto)
7170   +3                    (Ditto)
7171   +2 days               (Plus 2 days)
7172   -12 days 7:14:22      (Minus 12 days, 7 hours, 14 minutes, and 22 seconds)
7173
7174    The words "week", "month", and "year" can be used like "day" in the
7175    examples above. A week is exactly equivalent to 7 days. When months are
7176    specified, the numeric month number of the date is incremented or
7177    decremented by the given number, and the year and day adjusted
7178    accordingly if necessary (for example, 31-Jan-2001 +1month =
7179    03-Mar-2001 because February does not have 31 days). When years are
7180    specified, they are added or subtracted to the base year. Examples
7181    (assuming the current date is 10-Aug-2001 and the current time is
7182    19:21:11):
7183
7184   18-Sep-2001 +1day              (20010918 00:00:00)
7185   today +1day                    (20010811 00:00:00)
7186   now+1d                         (20010811 19:21:11)
7187   + 1 day                        (20010811 19:21:11)
7188   + 1 day 3:14:42                (20010811 22:35:54)
7189   + 7 weeks                      (20010928 19:21:11)
7190   +1d3:14:42                     (20010811 22:35:54)
7191   +1w3:14:42                     (20010817 22:35:54)
7192   +1m3:14:42                     (20010910 22:35:54)
7193   +1y3:14:42                     (20020810 22:35:54)
7194   2 feb 2001 + 10 years          (20110208 00:00:00)
7195   2001-02-08 +10y12              (20110208 12:00:00)
7196   31-dec-1999 23:59:59+00:00:01  (20000101 00:00:00)
7197   28-feb-1996 +1day              (19960229 00:00:00) (leap year)
7198   28-feb-1997 +1day              (19970301 00:00:00) (nonleap year)
7199   28-feb-1997 +1month            (19970328 00:00:00)
7200   28-feb-1997 +1month 11:59:59   (19970328 11:59:59)
7201   28-feb-1997 +20years           (20170228 00:00:00)
7202   28-feb-1997 +8000years         (99970228 00:00:00)
7203
7204    For compatibility with VMS, the following special delta-time format is
7205    also accepted:
7206
7207   +number-hh:mm:ss
7208   -number-hh:mm:ss
7209
7210    (no spaces). The hyphen after the number indicates days. It corresponds
7211    exactly to the Kermit notation:
7212
7213   +numberdhh:mm:ss
7214   -numberdhh:mm:ss
7215
7216    The following forms all indicate exactly the same date and time:
7217
7218   18-Sep-2001 12:34:56 +1-3:23:01
7219   18-Sep-2001 12:34:56 +1d3:23:01
7220   18-Sep-2001 12:34:56 +1 day 3:23:01
7221
7222    and mean "add a day plus 3 hours, 23 minutes, and 1 second" to the
7223    given date.
7224
7225    Note that delta times are not at all the same as UTC offsets; the
7226    former specifies an adjustment to the given date/time and the latter
7227    specifies that the local time is a particular distance from Universal
7228    Time, for example:
7229
7230   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
7231   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
7232
7233    If you give a time followed by a modifier that starts with a + or -
7234    sign, how does Kermit know whether it's a UTC offset or a delta time?
7235    It is treated as a UTC offset if the sign is followed by exactly four
7236    decimal digits; otherwise it is a delta time. Examples (for USA Eastern
7237    Daylight Time):
7238
7239   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
7240   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
7241   11-Aug-2001 12:34:56 -800           (20010811 04:34:56 -- Delta time)
7242   11-Aug-2001 12:34:56 -8             (20010811 04:34:56 -- Delta time)
7243
7244    The first example says that at some unknown place which is 8 hours
7245    ahead of Universal Time, the time is 12:34:56, and this corresponds to
7246    16:34:56 in Eastern Daylight time. The second example says to subtract
7247    8 hours from the local time. The third and fourth are delta times
7248    because, even though a colon is not included, the time does not consist
7249    of exactly 4 digits.
7250
7251    When a delta time is written after a timezone, however, there is no
7252    ambiguity and no syntax distinction is required:
7253
7254   11-Aug-2001 12:34:56 -0800 -0800    (20010811 08:34:56)
7255   11-Aug-2001 12:34:56 -0800 -08:00   (Ditto)
7256   11-Aug-2001 12:34:56 -08:00 -08:00  (Illegal)
7257
7258 8.13.5. The DATE Command
7259
7260    Obviously a great many combinations of date, time, time zone, and delta
7261    time are possible, as well as many formatting options. The purpose of
7262    all this flexibility is to comply with as many standards as possible --
7263    Internet RFCs, ISO standards, and proven corporate standards -- as well
7264    as with notations commonly used by real people, in order that dates and
7265    times from the widest variety of sources can be assigned to a variable
7266    and used in any date-time field in any Kermit command.
7267
7268    You can test any date-and/or-time format with the DATE command, which
7269    converts it to standard yyyymmdd hh:mm:ss format if it is understood,
7270    or else gives an explicit error message (rather than just "BAD DATE" as
7271    in previous C-Kermit releases) to indicate what is wrong with it.
7272    Examples (on Tuesday, 31 July 2001 in New York City, Eastern Daylight
7273    Time, UTC -0400):
7274
7275   DATE command argument                   Result
7276   12:30                                   20010731 12:30:00
7277   12:30:01                                20010731 12:30:01
7278   12:30:01.5                              20010731 12:30:02
7279   1230                                    20010731 12:30:00
7280   230                                     20010731 02:30:00
7281   230+1d                                  20010801 02:30:00
7282   230+1d3:00                              20010801 05:30:00
7283   20010718 19:21:15                       20010718 19:21:15
7284   20010718_192115                         20010718 19:21:15
7285   20010718T192115                         20010718 19:21:15
7286   18 Jul 2001 +0400                       20010717 23:59:59
7287   18 Jul 2001 192115                      20010718 19:21:15
7288   18 Jul 2001 192115.8                    20010718 19:21:16
7289   18-Jul-2001T1921                        20010718 19:21:00
7290   18-Jul-2001 1921Z                       20010718 15:21:00
7291   18-Jul-2001 1921 GMT                    20010718 15:21:00
7292   18-Jul-2001 1921 UTC                    20010718 15:21:00
7293   18-Jul-2001 1921 Z                      20010718 15:21:00
7294   18-Jul-2001 1921Z                       20010718 15:21:00
7295   18-Jul-2001 1921 -04:00:00              20010718 19:21:00
7296   21-Jul-2001_08:20:00am                  20010721 08:20:00
7297   21-Jul-2001_8:20:00P.M.                 20010721 20:20:00
7298   Fri Jul 20 11:26:25 2001                20010720 11:26:25
7299   Fri Jul 20 11:26:25 GMT 2001            20010720 07:26:25
7300   Sun, 9 Apr 2000 06:46:46 +0100          20000409 01:46:46
7301   Sunday, 9 Apr 2000 06:46:46 +0100       20000409 01:46:46
7302   now                                     20010731 19:41:12
7303   today                                   20010731 00:00:00
7304   today 09:00                             20010731 09:00:00
7305   tomorrow                                20010801 00:00:00
7306   tomorrow 09:00                          20010801 09:00:00
7307   tomorrow 09:00 GMT                      20010801 05:00:00
7308   yesterday                               20010730 00:00:00
7309   yesterday 09:00                         20010730 09:00:00
7310   + 3 days                                20010803 00:00:00
7311   +3 days                                 20010803 00:00:00
7312   +3days                                  20010803 00:00:00
7313   + 3days                                 20010803 00:00:00
7314   + 3 days 09:00                          20010803 09:00:00
7315   + 2 weeks                               20010814 00:00:00
7316   + 1 month                               20010831 00:00:00
7317   - 7 months                              20001231 00:00:00
7318   + 10 years                              20110731 00:00:00
7319   friday                                  20010803 00:00:00
7320   saturday                                20010804 00:00:00
7321   sunday                                  20010805 00:00:00
7322   monday                                  20010806 00:00:00
7323   tuesday                                 20010731 00:00:00
7324   wednesday                               20010801 00:00:00
7325   thursday                                20010802 00:00:00
7326   friday 07:00                            20010803 07:00:00
7327   thursday 1:00pm                         20010802 13:00:00
7328   thursday 1:00pm GMT                     20010802 09:00:00
7329   Thu, 10 Nov 94 10:50:47 EST             19941110 10:50:47
7330   Fri, 20 Oct 1995 18:35:15 -0400 (EDT)   19951020 18:35:15
7331   31/12/2001                              20011231 00:00:00
7332   12/31/2001                              20011231 00:00:00
7333   2001-July-20                            20010720 00:00:00
7334   2001-September-30                       20010930 00:00:00
7335   30-September-2001                       20010930 00:00:00
7336   Sep 30, 2001 12:34:56                   20010930 12:34:56
7337   September 30, 2001                      20010930 00:00:00
7338   September 30, 2001 630                  20010930 06:30:00
7339   September 30 2001 630                   20010930 06:30:00
7340   Sep-30-2001 12:34:59                    20010930 12:34:59
7341   20010807113542.014                      20010807 11:35.42
7342   20010807113542.014Z                     20010807 07:35:42
7343
7344 8.13.6. New Date-Time Functions
7345
7346    In the following descriptions, date-time function arguments are the
7347    same free-format date-time strings discussed above, with the same
7348    defaults for missing fields. They are automatically converted to
7349    standard format internally prior to processing.
7350
7351    \fcvtdate(d1)
7352           Converts the date-time d1 to standard format and local time.
7353           This function is not new, but now it accepts a wider range of
7354           argument formats that can include timezones and/or delta times.
7355           If the first argument is omitted, the current date and time are
7356           assumed. The optional second argument is a format code for the
7357           result:
7358
7359      n1 = 1: yyyy-mmm-dd hh:mm:ss (mmm = English 3-letter month
7360      abbreviation)
7361      n1 = 2: dd-mmm-yyyy hh:mm:ss (ditto)
7362      n1 = 3: yyyymmddhhmmss (all numeric)
7363
7364    \futcdate(d1)
7365           Converts the date-time d1 to Universal Coordinated Time (UTC),
7366           also known as GMT or Zulu or Zero-Meridian time. The default d1
7367           is NOW. If d1 is a valid date-time, the UTC result is returned
7368           in standard format, yyyymmdd hh:ss:mm.
7369
7370    \fcmpdates(d1,d2)
7371           Compares two free-format date-times, d1 and d2, and, if both
7372           arguments are valid, returns a number: -1 if d1 is earlier than
7373           (before) d2; 0 if d1 is the same as d2; 1 if d1 is later than
7374           (after) d2.
7375
7376    \fdiffdates(d1,d2)
7377           Computes the difference between two free-format date-times, d1
7378           and d2. If both arguments are valid, returns a delta time which
7379           is negative if d1 is earlier than (before) d2 and positive
7380           otherwise. If d1 and d2 are equal, the result is "+0:00".
7381           Otherwise, the result consists of the number of days, hours,
7382           minutes, and seconds that separate the two date-times. If the
7383           number of days is zero, it is omitted. If the number of days is
7384           nonzero but the hours, minutes, and seconds are all zero, the
7385           time is omitted. if the seconds are zero, they are omitted.
7386
7387    \fdelta2secs(dt)
7388           Converts a delta time to seconds. For example, "+1d00:00:01" to
7389           86401. Valid delta times must start with a + or - sign. Days are
7390           accepted as time units, but not years, months, or weeks. If the
7391           result would overflow a computer long word (as would happen with
7392           32-bit long words when the number of days is greater than
7393           24854), the function fails.
7394
7395    HINT: Although Kermit has a number of built-in date and time variables,
7396    it doesn't have a single one suitable for writing a timestamp. For this
7397    you would normally use something like "\v(ndate) \v(time)". But
7398    \fcvtdate() (with no arguments) is equivalent: it returns the current
7399    date and time in yyyymmdd hh:mm:ss format, suitable for time stamping.
7400
7401 8.13.7. Date-Time Programming Examples
7402
7403    Here's a macro that converts any date-time to UTC, which you might use
7404    if C-Kermit didn't already have a \futcdate() function:
7405
7406   define utcdate {
7407       .local := \fcvtdate(\%*)                 ; 1.
7408       .tmp := \fcvtdate(\m(local)UTC)          ; 2.
7409       .offset := \fdiffdate(\m(local),\m(tmp)) ; 3.
7410       .utc := \fcvtdate(\m(local)\m(offset))   ; 4.
7411       sho mac utc                              ; 5.
7412   }
7413
7414    Brief explanation: Line 1 converts the macro argument, a free-format
7415    date-time, to standard-format local time. Line 2 appends the "UTC"
7416    timezone to the local time and converts the result to local time. In
7417    other words, we take the same time as the local time, but pretend it's
7418    UTC time, and convert it to local time. For example, if New York time
7419    is 4 hours ahead of UTC, then 6:00pm New York time is 2:00pm UTC. Line
7420    3 gets the difference of the two results (e.g. "+04:00"). Line 4
7421    appends the difference (delta time) to the local time, and converts it
7422    again, which adds (or subtracts) the UTC offset to the given time. Line
7423    5 displays the result.
7424
7425    Here's a script that opens a web page, gets its headers into an array,
7426    scans the array for the "Last-Modified:" header, and interprets it:
7427   http open www.columbia.edu
7428   if fail stop 1 HTTP OPEN failed
7429   http /array:a head index.html /dev/null
7430   if fail stop 1 HTTP GET failed
7431   show array a
7432   for \%i 1 \fdim(&a) 1 {
7433       .\%x := \findex(:,\&a[\%i])
7434       if not \%x continue
7435       .tag := \fleft(\&a[\%i],\%x-1)
7436       .val := \fltrim(\fsubstr(\&a[\%i],\%x+1))
7437       if ( eq "\m(tag)" "Last-Modified" ) {
7438           echo HTTP Date: \m(val)
7439           .rdate := \fcvtdate(\m(val))
7440           echo {Standard Date (local): \m(rdate)}
7441           echo {Standard Date (UTC):   \futcdate(\m(rdate))}
7442           break
7443       }
7444   }
7445   http close
7446
7447    The result:
7448
7449   HTTP Date: Mon, 13 Aug 2001 20:05:42 GMT
7450   Standard Date (local): 20010813 16:05:42
7451   Standard Date (UTC):   20010813 20:05:42
7452
7453    As you can see, Kermit had no trouble decoding the date-time-string
7454    from the website, converting to local time, and converting back to UTC
7455    with no conflicts or loss of information. If it had been in any other
7456    known format, the result would have been the same.
7457
7458    Now suppose we want to download the web page only if it is newer than
7459    our local copy. The \fdate(filename) function (which returns the
7460    modification date-time of the given file) and the new \fcmpdates()
7461    function make it easy. Insert the following just before the BREAK
7462    statement:
7463
7464   if ( < 0 \fcmpdates(\m(rdate),\fdate(index.html)) ) {
7465      echo GETTING index.html...
7466      http get index.html index.html
7467      if success echo HTTP GET OK
7468   } else {
7469      echo index.html: no update needed
7470   }
7471   http close
7472   exit
7473
7474    This says, "if 0 is less than the comparison of the remote file date
7475    and the local file date, get the remote file, otherwise skip it." And
7476    it automatically reconciles the time-zone difference (if any).
7477
7478    It would be nice to be able to extend this script into a
7479    general-purpose website updater, but unfortunately HTTP protocol
7480    doesn't provide any mechanism for the client to ask the server for a
7481    list of files, recursive or otherwise.
7482
7483    [ [483]Top ] [ [484]Contents ] [ [485]C-Kermit Home ] [ [486]Kermit
7484    Home ]
7485
7486 8.14. Trapping Keyboard Interruption
7487
7488    Normally when you type Ctrl-C and Kermit is in command mode (as opposed
7489    to CONNECT mode) with COMMAND INTERRUPTION ON (as it is unless you have
7490    set it OFF), Kermit interrupts any command that is currently in
7491    progress, and if a command file or macro is executing, rolls the
7492    command stack back to top level, closing all open command files,
7493    deactivating all macros, deallocating all local variables and arrays,
7494    and leaving you at the command prompt.
7495
7496    Suppose, however, you want certain actions to occur when a script is
7497    interrupted; for example, closing open files, writing log entries, or
7498    displaying summary results. You can do this by defining a macro named
7499    ON_CTRLC. When Ctrl-C is detected, and a macro with this name is
7500    defined, Kermit executes it from the current command level, thus giving
7501    it full accesss to the environment in which the interruption occurred,
7502    including local variables and open files. Only when the ON_CTRLC macro
7503    completes execution is the command stack rolled back to top level.
7504
7505    Once the ON_CTRLC macro is defined, it can be executed only once. This
7506    is to prevent recursion if the user types Ctrl-C while the ON_CTRLC
7507    macro is executing. If you type Ctrl-C while the Ctrl-C macro is
7508    active, this does not start a new copy of ON_CTRLC; rather, it returns
7509    to the top-level command prompt. After the ON_CTRLC macro returns, it
7510    has been removed from the macro table so if you want to use it again or
7511    install a different Ctrl-C trap, you must execute a new DEFINE ON_CTRLC
7512    command. In any case, as always when you interrupt a script with
7513    Ctrl-C, its completion status is FAILURE.
7514
7515    Normally the ON_CTRLC macro would be defined in the command file or
7516    macro to which it applies, and should be declared LOCAL. This way, if
7517    the command file or macro completes successfully without being
7518    interrupted, the ON_CTRLC definition disappears automatically.
7519    Otherwise the definition would still be valid and the macro would be
7520    executed, probably out of context, the next time you typed Ctrl-C.
7521
7522    Here's a simple example of a command file that sets a Ctrl-C trap for
7523    itself:
7524
7525   local on_ctrlc              ; Make Ctrl-C trap local to this command file.
7526   define on_ctrlc {           ; Define the ON_CTRLC macro.
7527       echo Interrupted at \v(time).
7528       echo Iterations: \%n
7529   }
7530   xecho Type Ctrl-C to quit
7531   for \%n 1 999 1 {           ; Prints a dot every second until interrupted.
7532       sleep 1
7533       xecho .
7534   }
7535   echo Finished normally at \v(time) ; Get here only if not interrupted.
7536   decrement \%n
7537   echo Iterations: \%n
7538
7539    This prints a summary no matter whether it completes normally or is
7540    interrupted from the keyboard. In both cases the trap is automatically
7541    removed afterwards.
7542
7543    For an example of how to use ON_CTRLC to debug scripts, see
7544    [487]Section 8.1.
7545
7546    [ [488]Top ] [ [489]Contents ] [ [490]C-Kermit Home ] [ [491]Kermit
7547    Home ]
7548
7549 9. S-EXPRESSIONS
7550
7551    This section is primarily for those who want to write
7552    calculation-intensive scripts, especially if they require
7553    floating-point arithmetic, and/or for those who are familiar with the
7554    LISP programming language.
7555
7556    Ever since C-Kermit version 5 was released in 1988, scripting has been
7557    one of its major attractions, and arithmetic is a key part of it.
7558    Versions 5 and 6 included integer arithmetic only, using traditional
7559    algebraic notation, e.g.:
7560
7561   echo \fevaluate(3*(2+7)/2)
7562   13
7563
7564    C-Kermit 7.0 added support for floating-point arithmetic, but only
7565    through function calls:
7566
7567   echo \ffpdivide(\ffpmultiply(3.0,\ffpadd(2.0,7.0)),2.0)
7568   13.5
7569
7570    C-Kermit 8.0 introduces a third form of arithmetic that treats integers
7571    and floating-point numbers uniformly, is easier to read and write, and
7572    executes very quickly:
7573
7574   (/ (* 3 (+ 2 7)) 2)
7575   13.5
7576
7577    But first some background.
7578
7579    The Kermit command and scripting language differs from true programming
7580    languages (such as C or Fortran) in many ways; one of the most
7581    prominent differences is the way in which variables are distinguished
7582    from constants. In a command language, words are taken literally; for
7583    example, the Unix shell:
7584
7585   cat foo.bar
7586
7587    displays the file named foo.bar. Whereas in a programming language like
7588    C, words are assumed to be variables:
7589
7590   s = foo.bar;    /* Assigns the value of foo.bar to the variable s */
7591
7592    To make a programming language take words literally, you have to quote
7593    or "escape" them:
7594
7595   s = "foo.bar";  /* Assigns a pointer to the string "foo.bar" to the variable s
7596  */
7597
7598    The opposite holds for command languages: to get them to treat a word
7599    as a variable rather than a constant, you have to escape them. For
7600    example, in the Unix shell:
7601
7602   foo=123         ; Assign value 123 to variable foo.
7603   echo foo        ; Prints "foo"
7604   echo $foo       ; Prints "123"
7605
7606    And in Kermit:
7607
7608   define foo 123  ; Assign value 123 to variable foo.
7609   echo 123        ; This prints "123".
7610   echo foo        ; This prints "foo".
7611   echo \m(foo)    ; This prints "123".
7612
7613    In other words, character strings (such as "foo" above) are interpreted
7614    as literal strings, rather than variable names, except in special
7615    commands like DEFINE that deal specifically with variable names (or in
7616    numeric contexts as explained in [492]Section 8.2). The special
7617    "escape" character (dollar sign ($) for the shell, backslash (\) for
7618    Kermit) indicates that a variable is to be replaced by its value.
7619
7620    The requirement to escape variable names in command languages normally
7621    does not impose any special hardship, but can add a considerable
7622    notational burden to arithmetic expressions, which are typically full
7623    of variables. Especially in Kermit when floating point numbers are
7624    involved, where you must use special \ffpxxx() functions, e.g.
7625    "\ffpadd(\m(a),\m(b))" rather than the simple "+" operator to add two
7626    floating-point numbers together, because the original arithmetic
7627    handler doesn't support floating point (this might change in the
7628    future). To illustrate, the general formula for the area of a triangle
7629    is:
7630
7631   sqrt(s * (s - a) * (s - b) * (s - c))
7632
7633    where a, b, and c are the lengths of the triangle's three sides and:
7634
7635   s = (a + b + c) / 2
7636
7637    Except in special cases (e.g. a = 3, b = 4, c = 5), the result has a
7638    fractional part so the computation must be done using floating-point
7639    arithmetic. We can create a Kermit 7.0 function for this as follows:
7640
7641   def area {
7642       local s t1 t2 t3
7643       assign s \ffpdiv(\ffpadd(\ffpadd(\%1,\%2),\%3),2.0)
7644       assign t1 \ffpsub(\m(s),\%1)
7645       assign t2 \ffpsub(\m(s),\%2)
7646       assign t3 \ffpsub(\m(s),\%3)
7647       return \ffpsqrt(\ffpmul(\m(s),\ffpmul(\m(t1),\ffpmul(\m(t2),\m(t3)))))
7648   }
7649
7650    But as you can see, this is rather cumbersome. Note, in particular,
7651    that arithmetic functions like \ffpadd(), \ffpmul(), etc, take exactly
7652    two operands (like their symbolic counterparts + and *), so obtaining
7653    the product of three or more numbers (as we do in this case) is
7654    awkward.
7655
7656    Using the alternative S-Expression notation, we can reduce this to a
7657    form that is both easier to read and executes faster (the details are
7658    explained later):
7659
7660   def newarea {
7661       (let s (/ (+ \%1 \%2 \%3) 2.0))
7662       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
7663   }
7664
7665    In both examples, the \%1..3 variables are the normal Kermit macro
7666    arguments, referenced by the normal escaping mechanism. For increased
7667    readability, we can also assign the macro arguments \%1, \%2, and \%3
7668    to the letters a, b, and c corresponding to our formula:
7669
7670 def newarea {
7671     (let a \%1 b \%2 c \%3)
7672     (let s (/ (+ a b c) 2.0))
7673     (sqrt (* s (- s a) (- s b) (- s c)))
7674 }
7675
7676    And now the Kermit function reads almost like the original formula.
7677    Here Kermit behaves more like a regular programming language. In an
7678    S-Expression, macro names need not be escaped when they are used as the
7679    names of numeric variables.
7680
7681    [ [493]Top ] [ [494]Contents ] [ [495]C-Kermit Home ] [ [496]Kermit
7682    Home ]
7683
7684 9.1. What is an S-Expression?
7685
7686    The S-Expression concept is borrowed from the Lisp programming
7687    language. "S-Expression" is short for Symbolic Expression (itself
7688    sometimes shortened to SEXP). S-Expressions provide a kind of
7689    Alternative Mini-Universe within the Kermit command language when the
7690    regular rules don't apply, a universe enclosed in parentheses.
7691
7692    C-Kermit does not pretend to be a full Lisp interpreter; only the
7693    arithmetic parts of Lisp have been incorporated: S-Expressions that
7694    operate on numbers and return numeric values (plus extensibility
7695    features described in [497]Section 9.8, which allow some degree of
7696    string processing).
7697
7698    An S-Expression is a list of zero or more items, separated by spaces,
7699    within parentheses. Examples:
7700
7701   ()
7702   (1)
7703   (a)
7704   (+ a 1)
7705   (* 2 a b)
7706
7707    If the S-Expression is empty, it has the NIL (empty) value. If it is
7708    not empty and the first item is an operator (such as + or *), there can
7709    be zero or more subsequent items, called the operands:
7710
7711   (+ 1 2)
7712
7713    Here the operator is "+" and the operands are "1" and "2", and the
7714    value of the S-Expression is the value of the operation (in this case
7715    3). The operator always comes first, which is different from the
7716    familiar algebraic notation; this because S-Expression operators can
7717    have different numbers of operands:
7718
7719   (+ 1)
7720   (+ 1 2)
7721   (+ 1 2 3 4 5 6 7 8 9)
7722
7723    If the first item in the S-Expression is not an operator, then it must
7724    be a variable or a number (or a macro; see [498]Section 9.8), and the
7725    S-Expression can only contain one item; in this case, the
7726    S-Expression's value is the value of the variable or number:
7727
7728   (a)
7729   (3)
7730
7731    Operands can be numbers, variables that have numeric values, functions
7732    that return numbers, or other S-Expressions. To illustrate an
7733    S-Expression within an S-Expression, observe that:
7734
7735   (+ 1 2)
7736
7737    is equivalent to any of the following (plus an infinite number of
7738    others):
7739
7740   (+ 1 (+ 1 1))
7741   (+ (- 3 2) (/ 14 (+ 3 4)))
7742
7743    S-Expressions can be nested to any reasonable level; for example, the
7744    value of the following S-Expression is 64:
7745
7746   (- (* (+ 2 (* 3 4)) (- 9 (* 2 2))) 6)
7747
7748    Operators have no precedence, implied or otherwise, since they can't be
7749    mixed. The only exceptions are unary + and -, which simply indicate the
7750    sign of a number:
7751
7752   (* 3 -1)
7753
7754    Order of evaluation is specified entirely by parentheses, which are
7755    required around each operator and its operands: (+ a (* b c)) instead
7756    of (a + b * c).
7757
7758    S-Expressions provide a simple and isolated environment in which
7759    Kermit's macro names can be used without the \m(...) escaping that is
7760    normally required. Given:
7761
7762   define a 1
7763   define b 2
7764   define c 3
7765
7766    Then:
7767
7768   (+ \m(a) \m(b) \m(c))
7769
7770    is equivalent to:
7771
7772   (+ a b c)
7773
7774    Within an S-Expression, as in other strictly numeric contexts
7775    ([499]Section 8.2), any operand that starts with a letter is treated as
7776    a Kermit macro name. In this context, abbreviations are not accepted;
7777    variable names must be spelled out in full. Alphabetic case is not
7778    significant; "a" and "A" are the same variable, but both are different
7779    from "area".
7780
7781    Of course, regular Kermit variables and functions can be used in
7782    S-Expressions in the normal ways:
7783
7784   (* \v(math_pi) (^ \%r 2))             ; Area of a circle with radius \%r
7785   (+ \fjoin(&a))                        ; Sum of all elements of array \&a[]
7786
7787    [ [500]Top ] [ [501]Contents ] [ [502]C-Kermit Home ] [ [503]Kermit
7788    Home ]
7789
7790 9.2. Integer and Floating-Point-Arithmetic
7791
7792    Normally, if all numbers in an S-Expression are integers, the result is
7793    an integer:
7794
7795   (+ 1 1)                               ; Result is 2
7796   (/ 9 3)                               ; Result is 3
7797
7798    If any of the operands is floating point, however, the result is also
7799    floating point:
7800
7801   (+ 1 1.0)                             ; Result is 2.0
7802   (/ 9.0 3)                             ; Result is 3.0
7803
7804    If all the operands are integers but the result has a fractional part,
7805    the result is floating point:
7806
7807   (/ 10 3)                              ; Result is 3.333333333333333
7808
7809    To force an integer result in such cases, use the TRUNCATE operator:
7810
7811   (truncate (/ 10 3))                   ; Result is 3
7812
7813    Similarly, to force a computation to occur in floating point, you can
7814    coerce one of its operands to FLOAT:
7815
7816   (+ 1 (float 1))                       ; Result is 2.0
7817
7818    The result is also floating point if the magnitude of any integer
7819    operand, intermediate result, or the result itself, is larger than the
7820    maximum for the underlying machine architecture:
7821
7822   (^ 100 100)
7823
7824    If the result is too large even for floating-point representation,
7825    "Infinity" is printed; if it is too small to be distinguished from 0,
7826    0.0 is returned.
7827
7828    Large numbers can be used and large results generated, but they are
7829    accurate only to the precision of the underlying machine. For example,
7830    the result of:
7831
7832  (+ 111111111111111111111 222222222222222222222)
7833
7834    should be 333333333333333333333, but 333333333333333300000.0 is
7835    produced instead if the machine is accurate to only about 16 decimal
7836    digits, even with coercion to floating-point. The order of magnitude is
7837    correct but the least significant digits are wrong. The imprecise
7838    nature of the result is indicated by the ".0" at the end. Contrast
7839    with:
7840
7841  (+ 111111111 222222222)
7842
7843    which produces an exact integer result.
7844
7845    [ [504]Top ] [ [505]Contents ] [ [506]C-Kermit Home ] [ [507]Kermit
7846    Home ]
7847
7848 9.3. How to Use S-Expressions
7849
7850    S-Expressions may be given as commands to C-Kermit. Any command whose
7851    first character is "(" (left parenthesis) is interpreted as an
7852    S-Expression.
7853
7854    If you enter an S-Expression at the C-Kermit> prompt, its result is
7855    printed:
7856
7857   C-Kermit>(/ 10.0 3)
7858    3.333333333333333
7859   C-Kermit>
7860
7861    If an S-Expression is executed within a macro or command file, its
7862    value is not printed. However, you can control the printing action
7863    with:
7864
7865    SET SEXPRESSION ECHO { AUTO, ON, OFF }
7866           AUTO is the default, meaning print the value at top level only;
7867           ON means always print the value; OFF means never print it.
7868
7869    In any case, the value of the most recent S-Expression (and the
7870    S-Expression itself) may be accesssed programmatically through the
7871    following variables:
7872
7873    \v(sexpression)
7874           The S-Expression most recently executed.
7875
7876    \v(svalue)
7877           The value of the S-Expression most recently executed.
7878
7879    Besides issuing S-Expressions as commands in themselves, you can also
7880    execute them anywhere within a Kermit command, but in this case they
7881    must be enclosed in a function call (otherwise they are taken
7882    literally):
7883
7884    \fsexpression(s)
7885           The argument "s" is an S-Expression; the outer parentheses may
7886           be omitted. The value of the S-Expression is returned. Note that
7887           since S-Expressions usually contain spaces, some form of
7888           grouping or quoting might be needed in some contexts:
7889
7890   echo \fsexpression((+ 1 1))            ; Outer parentheses may be included
7891   echo \fsexpr(+ 1 1)                    ; Outer parentheses may be omitted
7892   echo Value = "\fsexp(+ 1 a)"           ; Can be embedded in strings
7893   echo Value = \&a[\fsexp(/ b 2)]        ; Can be used in array subscripts
7894   if = {\fsexp(+ 1 1)} 2 {               ; Braces needed here for grouping
7895       echo One plus one still equals two
7896   }
7897
7898    The IF statement illustrates how to use S-Expressions as (or in) IF or
7899    WHILE conditions:
7900
7901      * Although S-Expressions and IF conditions are similar in appearance,
7902        they are not interchangeable. Therefore you must use \fsexpr() to
7903        let Kermit know it's an S-Expression rather than a regular IF
7904        condition, or a boolean or algebraic expression within an IF
7905        condition.
7906      * In contexts where a single "word" is expected, you must enclose the
7907        \fsexp() invocation in braces if the S-Expression contains spaces
7908        (and most of them do).
7909
7910    If an S-Expression is the last command executed in a macro, its value
7911    becomes the return value of the macro; no RETURN command is needed.
7912    Example:
7913
7914   def newarea {
7915       (let s (/ (+ \%1 \%2 \%3) 2.0))
7916       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
7917   }
7918
7919    This is equivalent to (but more efficient than):
7920
7921   def newarea {
7922       (let s (/ (+ \%1 \%2 \%3) 2.0))
7923       return \fsexp(sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
7924   }
7925
7926    When an S-Expression is entered as a command -- that is, the first
7927    nonblank character of the command is a left parenthesis -- then it is
7928    allowed to span multiple lines, as many as you like, until the first
7929    left parenthesis is matched:
7930
7931   (let s (/
7932           (+
7933            \%1
7934            \%2
7935            \%3
7936            )
7937           2.0
7938           )
7939        )
7940   (sqrt (*
7941          s
7942          (- s \%1)
7943          (- s \%2)
7944          (- s \%3)
7945          )
7946         )
7947
7948    The S-Expression concept lends itself easily to embedding and
7949    recursion, but the depth to which recursion can occur is limited by the
7950    resources of the computer (memory size, address space, swap space on
7951    disk) and other factors. There is no way that C-Kermit can know what
7952    this limit is, since it varies not only from computer to computer, but
7953    also from moment to moment. If resources are exhausted by recursion,
7954    C-Kermit simply crashes; there's no way to trap this error. However,
7955    you can set a depth limit on S-Expressions:
7956
7957    SET SEXPRESSION DEPTH-LIMIT number
7958           Limits the number of times the S-Expression reader can invoke
7959           itself without returning to the given number. The default limit
7960           is 1000. This limit applies to S-Expressions embedded within
7961           other S-Expressions as well as to S-Expressions that invoke
7962           recursive macros. If the limit is exceeded, Kermit prints
7963           "?S-Expression depth limit exceeded" and returns to its prompt.
7964           More about recursion in [508]Section 9.8.
7965
7966    You can also test the depth programmatically:
7967
7968    \v(sdepth)
7969           The current S-Expression invocation depth. The depth includes
7970           both nesting level and recursion. For example, in:
7971           (foo (foo (foo (foo (foo))))), the innermost (foo) is at depth
7972           5.
7973
7974    Help, completion, and syntax checking are not available within an
7975    S-Expression. If you type ? within an S-Expression, it says:
7976
7977   C-Kermit>(? S-Expression ("help sexp" for details)
7978
7979    As it says, typing "help sexp" will display a brief help text.
7980
7981    The SHOW SEXPRESSION command displays current SET SEXPRESSION settings
7982    and related information.
7983
7984    [ [509]Top ] [ [510]Contents ] [ [511]C-Kermit Home ] [ [512]Kermit
7985    Home ]
7986
7987 9.4. Summary of Built-in Constants and Operators
7988
7989    Three constants are built in:
7990
7991      * PI, whose value is the value of pi (the quotient of circumference
7992        of any circle and its diameter, 3.141592653...) to the underlying
7993        machine's precision;
7994      * T, which always has the value 1, which signifies truth in Kermit
7995        logical expressions or S-Expressions;
7996      * NIL, which always has the empty value, and can serve as a False
7997        truth value.
7998
7999    These constants are specific to S-Expressions and are not visible
8000    outside them. They may not be used as the target of an assignment. So,
8001    for example:
8002
8003   (setq t 0)   Fails
8004   assign t 0   Succeeds but this is not the same T!
8005
8006    E (the base of natural logarithms, 2.7182818184...) is not built in
8007    since it is not intrinsic in most Lisp dialects. If you want E to be
8008    the base of natural logarithms you can:
8009
8010   (setq e (exp 1))
8011
8012    Operators are either symbols (such as "+") or words. Words must be
8013    spelled out in full, not abbreviated. Differences of alphabetic case
8014    are ignored.
8015
8016    The most basic operation in S-Expressions is evaluation:
8017
8018    EVAL [ s-expression or variable or number [ another [ another ... ] ] ]
8019           Evaluates its operands and returns the value of the last one
8020           evaluated. Examples:
8021
8022   (eval)                                0
8023   (eval 1)                              1
8024   (eval a)                              value of a
8025   (eval (+ 1 a))                        value of a+1
8026   (eval (setq a 1) (setq b (+ a 0.5)))  value of b (= a+0.5)
8027
8028           You can use "." as a shorthand for EVAL:
8029
8030   (.)
8031   (. 1)
8032   (. a)
8033   (. (+ 1 a))
8034   (. (setq a 1) (setq b (+ a 0.5)))
8035
8036    Opposite of EVAL is the operator that suppresses evaluation of its
8037    operand:
8038
8039    QUOTE item
8040           The value (quote item) is "item". If the item is itself an
8041           S-Expression, the result is the S-Expression with the outer
8042           parentheses stripped. Examples:
8043
8044   (quote)                               (illegal)
8045   (quote a)                             a
8046   (quote hello)                         hello
8047   (quote (this is a string))            this is a string
8048   (quote this is a string)              (illegal)
8049
8050           A shorthand notation is also accepted for quoting:
8051           'a is equivalent to (quote a). And therefore:
8052           '(a b c) is equivalent to (quote (a b c)).
8053           More about quoting in [513]Section 9.8.
8054
8055    STRING item
8056           Is a combination of EVAL and QUOTE. It evaluates the item as an
8057           S-Expression, and then puts quotes around the result (more about
8058           this in [514]Section 9.8).
8059
8060    The following operators assign values to variables:
8061
8062    SETQ [ variable [ value [ variable [ value [ ... ] ] ] ] ]
8063           Applies to global variables. For each variable given: if a value
8064           is not given, the variable is undefined. If a value is given,
8065           assigns the value to the variable. The value may be a number, a
8066           variable, or anything that resolves to a number including an
8067           S-Expression. Returns the value of the last assignment.
8068           Examples:
8069
8070   (setq)             Does nothing, returns NIL.
8071   (setq a)           Undefines a, returns NIL.
8072   (setq a 1)         Assigns 1 to a, returns 1.
8073   (setq a 1 b 2)     Assigns 1 to a, 2 to b, returns 2.
8074   (setq a 1 b 2 c)   Assigns 1 to a, 2 to b, undefines c, returns NIL.
8075
8076    To undefine a variable that is not the final one in the list, give it a
8077    value of "()" or NIL:
8078
8079   (setq a () b 2)    Undefines a, assigns 2 to b, returns 2.
8080   (setq a nil b 2)   Ditto.
8081
8082    Note that a variable can be used right away once it has a value:
8083
8084   (setq a 1 b a)     Assigns 1 to a, the value of a (1) to b, returns 1.
8085
8086    The results of SETQ (when used with macro names) can be checked
8087    conveniently with SHOW MACRO, e.g:
8088
8089   show mac a b c
8090
8091    LET [ variable [ value [ variable [ value [ ... ] ] ] ] ]
8092           Like SETQ, but applies to local variables. Note that "local" is
8093           used in the Kermit sense, not the Lisp sense; it applies to the
8094           current Kermit command level, not to the current S-Expression.
8095
8096    If you want to use SETQ or LET to assign a value to a backslash
8097    variable such as \%a or \&a[2], you must double the backslash:
8098
8099   (setq \\%a 3)
8100   (setq \\%b (+ \%a 1))
8101   (setq \\&a[2] (setq (\\%c (+ \%a \%b))))
8102
8103    In other words:
8104
8105      * Double the backslash when you want to indicate the variable's NAME;
8106      * Don't double the backslash when you want its VALUE.
8107
8108    See [515]Section 9.6 for a fuller explanation of variable syntax and
8109    scope.
8110
8111    Here's a summary table of arithmetic operators; in the examples, a is 2
8112    and b is -1.3:
8113
8114   Operator  Description                            Example           Result
8115   +         Adds all operands (0 or more)          (+ a b)           0.7
8116   -         Subtracts all operands (0 or more)     (- 9 5 2 1)       1
8117   *         Multiplies all operands (0 or more)    (* a (+ b 1) 3)  -1.80
8118   /         Divides all operands (2 or more)       (/ b a 2)        -0.325
8119   ^         Raise given number to given power      (^ 3 2)           9
8120   ++        Increments variables                   (++ a 1.2)        3.2
8121   --        Decrements variables                   (-- a)            1
8122   ABS       Absolute value of 1 operand            (abs (* a b 3))   7.8
8123   MAX       Maximum of all operands (1 or more)    (max 1 2 3 4)     4
8124   MIN       Minimum of all operands (1 or more)    (min 1 2 3 4)     1
8125   MOD (%)   Modulus of all operands (1 or more)    (mod 7 4 2)       1
8126   FLOAT     Convert an integer to floating-point   (float 1)         1.0
8127   TRUNCATE  Integer part of floating-point operand (truncate 3.333)  3
8128   CEILING   Ceiling of floating-point operand      (ceiling 1.25)    2
8129   FLOOR     Floor of floating-point operand        (floor 1.25)      1
8130   ROUND     Operand rounded to nearest integer     (round 1.75)      2
8131   SQRT      Square root of 1 operand               (sqrt 2)          1.414..
8132   EXP       e (2.71828..) to the given power       (exp -1)          0.367..
8133   SIN       Sine of angle-in-radians               (sin (/ pi 2))    1.0
8134   COS       Cosine of angle-in-radians             (cos pi)         -1.0
8135   TAN       Tangent of angle-in-radians            (tan pi)          0.0
8136   LOG       Natural log (base e) of given number   (log 2.7183)      1.000..
8137   LOG10     Log base 10 of given number            (log10 1000)      3.0
8138
8139    The ++ and -- operators are also assignment operators and work just
8140    like SETQ and LET in their interpretations of operators and operands,
8141    but:
8142
8143      * Each target variable must already be defined and have a numeric
8144        value;
8145      * The assignment value is the amount by which to increment or
8146        decrement the variable.
8147      * If an assignment value is not given, 1 is used.
8148
8149    If you include more than one variable-value pair in a ++ or --
8150    expression, every variable (except, optionally, the last) must be
8151    followed by a value. Examples:
8152
8153   (++ a)                Equivalent to (setq a (+ a 1)) and to (++ a 1)
8154   (++ a 2)              Equivalent to (setq a (+ a 2))
8155   (-- a (* 2 pi))       Equivalent to (setq a (- a (* 2 pi)))
8156   (++ a 1 b 1 c 1 d)    Equivalent to four SETQs incrementing a,b,c,d by 1.
8157
8158    Another group of operators forms the predicates. These return a "truth
8159    value", in which 0 (or NIL) is false, and 1 or any other nonzero number
8160    is true.
8161
8162   Operator  Description                            Example           Result
8163   = (or ==) Operands are equal                     (= 1 1.0)         1
8164   !=        Operands are not equal                 (!= 1 1.0)        0
8165   <         Operands in strictly ascending order   (< 1 2 3)         1
8166   <=        Operands in ascending order            (<= 1 1 2 3)      1
8167   >         Operands in strictly descending order  (> 3 2 1)         1
8168   >=        Operands in descending order           (<= 3 3 2 1)      1
8169   AND (&&)  Operands are all true                  (and 1 1 1 1 0)   0
8170   OR  (||)  At least one operand is true           (or 1 1 1 1 0)    1
8171   XOR       Logical Exclusive OR                   (xor 3 1)         0
8172   NOT (!)   Reverses truth value of operand        (not 3)           0
8173
8174    The Exclusive OR of two values is true if one value is true and the
8175    other value is false.
8176
8177    And another group operates on bits within an integer word:
8178
8179   Operator  Description                            Example           Result
8180   &         Bitwise AND                            (& 7 2)           2
8181   |         Bitwise OR                             (| 1 2 3 4)       7
8182   #         Bitwise Exclusive OR                   (# 3 1)           2
8183   ~         Reverses all bits                      (~ 3)            -4
8184
8185    These operators coerce their operands to integer by truncation if
8186    necessary. The result of bit reversal is hardware dependent.
8187
8188    The final category of operator works on truth values:
8189
8190   Operator  Description                            Example           Result
8191   IF        Conditional evaluation                 (if (1) 2 3)      2
8192
8193    IF (predicate) (s1) [ (s2) ]
8194           The IF operator is similar to Kermit's IF command. If the
8195           predicate is true (i.e. evaluates to a nonzero number), the
8196           first S-Expression (s1) is evaluated and its value is returned.
8197           Otherwise, if (s2) is given, it is evaluated and its value
8198           returned; if (s2) is not given, nothing happens and the NIL
8199           (empty) value is returned.
8200
8201    You can group multiple expressions in the s1 and s2 expressions using
8202    EVAL (or "."):
8203
8204   (if (< a 0) (eval (setq x 0) (setq y 0)) (eval (setq x a) (setq y b)))
8205
8206    or equivalently:
8207
8208   (if (< a 0) (. (setq x 0) (setq y 0)) (. (setq x a) (setq y b)))
8209
8210    Each operator has its own requirement as to number and type of
8211    operands. In the following table, "number" means any kind of number --
8212    integer or floating-point -- or a variable, function, macro, or
8213    S-Expression that returns a number; "vname" means variable name,
8214    "fpnumber" means a floating-point number (or anything that resolves to
8215    one), and "integer" means integer (or anything that resolves to one).
8216    "truthvalue" means anything that resolves to a value of zero or an
8217    empty value (which indicates false) or a nonzero value (which indicates
8218    true). "any" means any kind of value, including none at all.
8219
8220   Operator  Number of operands   Type of operands    Returns
8221   EVAL  (.) 0 or more            S-Expression        Last value (default NIL)
8222   STRING    1                    S-Expression        string
8223   QUOTE (') 1                    word                string
8224   SETQ      0 or more            vname value pairs   Last value (default NIL)
8225   LET       0 or more            vname value pairs   Last value (default NIL)
8226   +         0 or more            number              number     (default 0)
8227   -         0 or more            number              number     (default 0)
8228   *         0 or more            number              number     (see note (1))
8229   /         2 or more            number              number
8230   ^         2 or more            number              number
8231   ++        1 or more            vname value pairs   Result of last increment
8232   --        1 or more            vname value pairs   Result of last decrement
8233   ABS       1                    number              number
8234   MAX       1 or more            number              number
8235   MIN       1 or more            number              number
8236   MOD (%)   2                    number              number
8237   FLOAT     1                    number              fpnumber
8238   TRUNCATE  1                    number              integer
8239   CEILING   1                    number              integer
8240   FLOOR     1                    number              integer
8241   ROUND     1                    number              integer
8242   SQRT      1                    number              fpnumber
8243   EXP       1                    number              fpnumber
8244   SIN       1                    number              fpnumber
8245   COS       1                    number              fpnumber
8246   TAN       1                    number              fpnumber
8247   LOG       1                    number              fpnumber
8248   LOG10     1                    number              fpnumber
8249   = (==)    1 or more            number              truthvalue
8250   !=        1 or more            number              truthvalue
8251   <         1 or more            number              truthvalue
8252   <=        1 or more            number              truthvalue
8253   >         1 or more            number              truthvalue
8254   >=        1 or more            number              truthvalue
8255   AND (&&)  1 or more            truthvalue          truthvalue
8256   OR  (||)  1 or more            truthvalue          truthvalue
8257   XOR       2                    truthvalue          truthvalue
8258   NOT (!)   1                    truthvalue          truthvalue
8259   &         1 or more            number (see note 2) integer
8260   |         1 or more            number (see note 2) integer
8261   #         2                    number (see note 2) integer
8262   ~         1                    number (see note 2) integer
8263   IF        2 or 3               truthvalue,any,any  any
8264
8265    Operators that don't require any arguments return the default values
8266    shown.
8267
8268     1. The value of "*", when used as an operand, is initially "1" and the
8269        value of the most recent S-Expression thereafter, as in Franz Lisp.
8270        This is handy when doing a series of calculations by hand:
8271   C-Kermit>(* 13272.42 0.40)
8272    5308.968
8273   C-Kermit>(/ * 2)
8274    2654.4840
8275   C-Kermit>
8276
8277     2. The bitwise operators coerce their operands to integer by
8278        truncation.
8279
8280    [ [516]Top ] [ [517]Contents ] [ [518]C-Kermit Home ] [ [519]Kermit
8281    Home ]
8282
8283 9.5. Variables
8284
8285    As noted elsewhere in this discussion, all backslash items (variables
8286    such as \%a, macro parameters such as \%1, array elements such as
8287    \&a[\%i], built-in variables such as \v(ndate), built-in functions such
8288    as \fjoin(), macro names enclosed in \m(), \s(), or \:(), etc) are
8289    evaluated at "top level" before the S-Expression is sent to the
8290    S-Expression reader. To use a backslash variable as the target of an
8291    assignment (e.g. by SETQ, LET, ++, or --), you must double the
8292    backslash, e.g. (setq \\%r 1234). This is discussed at greater length
8293    in the next section.
8294
8295    Thus S-Expression reader generally deals only with macro names (not
8296    backslash items) as variables. It is important to understand how the
8297    reader handles macro names. There are fundamentally two kinds of
8298    S-Expressions: those that contain a single element, such as:
8299
8300   (foo)
8301
8302    and those that contain more than one element:
8303
8304   (foo a b c)
8305
8306    If an S-Expression contains only one element, and it is the name of a
8307    macro, the macro's definition is examined. If the definition is a
8308    number (integer or floating-point, positive or negative), then this
8309    becomes the value of the expression. If the definition starts with '
8310    (apostrophe), then the quoted word or string is the value of the
8311    expression (explained in [520]Section 9.8). Otherwise, the macro is
8312    assumed to be composed of Kermit commands (possibly including
8313    S-Expressions), which are executed. If the macro has a RETURN value, or
8314    it executes an S-Expression as its last command, the result becomes the
8315    value of the S-Expression; otherwise the result is empty.
8316
8317    For S-Expressions that contain more than one element, and the first
8318    element is the name of a macro, then this macro is executed with the
8319    arguments that are given, after the arguments are evaluated by the
8320    S-Expression reader. Likewise, If the first element is a built-in
8321    operator, then it is applied to the operands after they are evaluated.
8322    In both cases, each operand is fed to the S-Expression reader
8323    recursively for evaluation. If an operand is a number or a quoted
8324    string, it is used as-is. But if it's a macro name, this degenerates
8325    into the first case, and the previous paragraph applies.
8326
8327    Examples:
8328
8329   define foo 123
8330   (foo)                                Result: 123
8331   define foo 'abc
8332   (foo)                                Result: abc
8333   define foo '(one two three)
8334   (foo)                                Result: one two three
8335   define foo return \frandom(1000)
8336   (foo)                                Result: 713 (or other number)
8337   define foo (+ a b)
8338   (foo)                                Result: The sum of a and b
8339
8340    A more difficult example:
8341
8342   define foo abc
8343   (foo)                                Result: ???
8344
8345    The result in the last example depends on the definition of abc:
8346
8347      * If it has no definition, an error occurs; otherwise:
8348      * If the definition is an S-Expression, the result is the
8349        S-Expression's value; otherwise:
8350      * If the definition consists of Kermit commands, they are executed.
8351        But in this case "(foo)" produces the empty result, because it
8352        doesn't RETURN anything.
8353
8354    The use of macros as S-Expression operators is described in
8355    [521]Section 9.8.
8356
8357    [ [522]Top ] [ [523]Contents ] [ [524]C-Kermit Home ] [ [525]Kermit
8358    Home ]
8359
8360 9.6. Assignments and Scope
8361
8362    The assignment operators SETQ and LET apply to global and local
8363    variables, respectively. SETQ and LET are standard Lisp operators
8364    adapted to Kermit scoping rules. When the operands are numeric or
8365    arithmetic, SETQ is equivalent to Kermit's EVALUATE command:
8366
8367   (setq a (+ 1 2))
8368   evaluate a 1 + 2
8369
8370    When the operand is a string, SETQ is equivalent to DEFINE:
8371
8372   (setq a '(this is a string))
8373   define a this is a string
8374
8375    In the first case, both statements create a macro named "a" with a
8376    value of 3. But in neither case is the macro "a" necessarily global. If
8377    either of these commands executes in an environment (i.e. macro
8378    invocation level) where a "local a" command has been given, the "a"
8379    macro is global to that environment, but is not visible outside it.
8380
8381    LET is equivalent to the Kermit LOCAL command, followed by the
8382    corresponding EVALUATE:
8383
8384   (let a (+ 1 2))
8385
8386    is equivalent to:
8387
8388   local a
8389   evaluate a 1 + 2
8390
8391    Again, "local" in this context applies to the Kermit macro invocation
8392    stack, not to the S-Expression nesting level. To illustrate, recall our
8393    "newarea" macro:
8394
8395 def newarea {
8396     (let a \%1 b \%2 c \%3)
8397     (let s (/ (+ a b c) 2.0))
8398     (sqrt (* s (- s a) (- s b) (- s c)))
8399 }
8400
8401    Because SETQ and LET expressions return a value, they can be placed
8402    within a larger S-Expression. In this case we can replace the first
8403    reference to the "s" variable by its defining expression:
8404
8405 def newarea {
8406     (let a \%1 b \%2 c \%3)
8407     (sqrt (* (let s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
8408 }
8409
8410    This would not work if LET were local to the S-Expression, but it works
8411    nicely in the context of Kermit macros. The previous definition is
8412    equivalent to:
8413
8414 def newarea {
8415     local a b c s
8416     (setq a \%1 b \%2 c \%3)
8417     (sqrt (* (setq s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
8418 }
8419
8420    In both cases, the variables a, b, c, and s are local to the "newarea"
8421    macro, and global within it.
8422
8423    Multiple assignments can be handled in several ways. Here is the
8424    obvious way to initialize a series of variables to the same value:
8425
8426   (setq a 0)
8427   (setq b 0)
8428   (setq c 0)
8429   (setq s 0)
8430
8431    Here is a more compact and efficient way of doing the same thing:
8432
8433   (setq a 0 b 0 c 0 s 0)
8434
8435    However, in case the value was more complex, it's better to put only
8436    one copy of it in the S-Expression; in this case we rely on the fact
8437    that SETQ returns the value of its last assignment:
8438
8439   (setq a (setq b (setq c (setq s (* x (^ y 2))))))
8440
8441    Similarly, to set a series of variables to x, x+1, x+2, ...
8442
8443   (setq c (+ (setq b (+ (setq a (+ (setq s x) 1)) 1)) 1))
8444
8445    In the last example, you can see why "last" does not always correspond
8446    to "rightmost" (the leftmost variable "c" is assigned last).
8447
8448    If you are working with backslash variables like \%a or array elements
8449    like \&a[1], remember two rules:
8450     1. Don't put spaces inside array brackets.
8451     2. You must double the backslash when using SETQ, LET, ++, or -- to
8452        assign a value to a backslash variable.
8453
8454    Examples of assigning to a backslash variable:
8455
8456   (setq x 1)
8457   (setq \\%a 0)
8458   (setq \\&a[x+1] 1)
8459   (++ \\%x)
8460   (-- \\&a[x+2])
8461
8462    Examples of referring to a backslash variable's value:
8463
8464   (setq a (+ \%a 1))
8465   (setq b (+ \%a \&a[1]))
8466   (++ a \%x)
8467   (-- b \&a[1])
8468
8469    The special notation is required because all backslashed items (\%x
8470    variables, array elements, built-in \v(xxx) variables, and \fxxx()
8471    function invocations) are evaluated in a single pass BEFORE the
8472    S-Expression is executed; any other approach would result in
8473    unacceptable performance. So, for example, in:
8474
8475   declare \&a[] = 1 2 3
8476   define \%x 4
8477   define \%y 0
8478   (setq \\%y (+ \%x \&a[1]))
8479
8480    the S-Expression becomes:
8481
8482   (setq \%y (+ 4 1))
8483
8484    before it is sent to the S-Expression evaluator. If the backslash had
8485    not been doubled on the assignment target, the result would have been:
8486
8487   (setq 0 (+ 4 1))
8488
8489    which is illegal because you can't assign a value to a number.
8490    Conversely, if backslashes were doubled on right-hand-side values:
8491
8492   (setq \\%y (+ \\%x \\&a[1])
8493
8494    this too, would give an error (not numeric - "\%x").
8495
8496    If you omit the double backslash in the assignment target, the result
8497    depends on whether the variable already has a value:
8498
8499   (setq \%a (* 3 3))
8500
8501    If \%a has a non-numeric single-word value, then this becomes the name
8502    of the variable that is assigned by SETQ. To illustrate:
8503
8504   define \%a foo
8505   echo \%a
8506   foo
8507   (setq \%a (* 3 3))
8508   echo \%a
8509   foo
8510   show macro foo
8511   foo = 9
8512
8513    If \%a has no value, a numeric value, or a multiword value, an "invalid
8514    assignment" error occurs.
8515
8516    [ [526]Top ] [ [527]Contents ] [ [528]C-Kermit Home ] [ [529]Kermit
8517    Home ]
8518
8519 9.7. Conditional Expressions
8520
8521    The IF operator provides a compact form of decision-making within
8522    S-Expressions. An IF expression can stand wherever a number might
8523    stand, as long is it returns a number. Here's a quick way to obtain the
8524    average value of all the elements in an array that contains only
8525    numbers:
8526
8527   (/ (+ \fjoin(&a)) (float \fdim(&a)))
8528
8529    This results in a "Divide by zero" error if the array is empty. If you
8530    want to define the average value of an empty array to be 0 instead of
8531    getting an error, you can use IF to check the array size:
8532
8533   (if \fdim(&a) (/ (+ \fjoin(&a)) (float \fdim(&a))) 0)
8534
8535    or equivalently:
8536
8537   (if (not \fdim(&a)) 0 (/ (+ \fjoin(&a)) (float \fdim(&a))))
8538
8539    Of course, IF can fit anywhere else into an S-Expression:
8540
8541   (setq a (+ b (if (< c 0) 0 c)))
8542
8543    and the IF expression can be as complex as you like:
8544
8545   (setq a (+ b (if (and (or (> x 0) (> y 0)) (< c 0) (> d 1) (!= e 0)) 1 0)))
8546
8547    and the "then" and "else" parts can contain multiple S-Expressions
8548    enclosed within (EVAL ...):
8549
8550   (if x (eval (...) (...) (...)) (eval (...) (...) (...)))
8551
8552    AND and OR operators are guaranteed to "short circuit". If any operand
8553    of AND is false, none of the subsequent operands is evaluated;
8554    likewise, if an OR operand is true, no further operands are evaluated.
8555
8556    Bear in mind that the S-Expression IF is not the same as Kermit IF; the
8557    condition is only allowed to be an S-Expression or a variable or
8558    number, not the whole list of possibilities you see when you type "if
8559    ?" at the C-Kermit> prompt. But keep reading...
8560
8561    [ [530]Top ] [ [531]Contents ] [ [532]C-Kermit Home ] [ [533]Kermit
8562    Home ]
8563
8564 9.8. Extensibility
8565
8566    To extend the capabilities of S-Expressions, you can use Kermit macro
8567    names as operators, with the following limitations:
8568
8569      * The macro must not have the same name as a built-in operator.
8570      * You must use the full macro name, not an abbreviation.
8571
8572    And with the following enhancement:
8573
8574      * If the last statement executed by the macro is an S-Expression, its
8575        value is returned automatically. In other words:
8576
8577   define bump (++ \%1)
8578
8579    is equivalent to:
8580
8581   define bump return \fsexpression(++ \%1)
8582
8583    Here's an example in which we define a FIBONACCI operator that returns
8584    the nth element, n >= 0, of the Fibonacci series, 0 1 1 2 3 5 8 13 21
8585    34 55, . . ., in which the first element is 0, the second is 1, and
8586    each subsequent element is the sum of the two before it. This series
8587    was devised by Leonardo Pisano, Filius Bonacci (Fibonacci for short) in
8588    1202 to describe how fast rabbits can breed, and also forms the basis
8589    for the Golden Mean, the branching behavior of plants, the spiral of a
8590    nautilus shell, etc. (Thanks to [534]Dat Thuc Nguyen for December 2003
8591    corrections to this section!)
8592
8593    We can write a FIBONACCI function as a macro easily with S-Expressions:
8594
8595   define FIBONACCI {
8596     (if (== \%1 0) 0
8597         (if (== \%1 1) 1 (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1)))))
8598   }
8599
8600    You can read this as:
8601
8602      If the argument (\%1) is 0, return a result of 0; if it is 1,
8603      return 1; otherwise:
8604      return the sum of fibonacci(argument - 2) and fibonacci(argument -
8605      1)
8606
8607    Note that a RETURN statement is not needed, since S-Expressions
8608    automatically set the return value of their containing macros.
8609
8610    For comparison, here's how it would be coded without S-Expressions:
8611
8612   define FIBONACCI {
8613       if == \%1 0 {
8614           return 0
8615       } else if == \%1 1 {
8616           return 1
8617       } else {
8618           return \feval(\fexec(fibonacci \feval(\%1-2)) -
8619                + \fexec(fibonacci \feval(\%1-1)))
8620       }
8621   }
8622
8623    Now we can use the FIBONACCI function (whichever way you write it) just
8624    as if it were a built-in operator:
8625
8626   (fibonacci 6)
8627
8628    Or:
8629
8630   (setq a 10)
8631   (fibonacci a)
8632
8633    Within S-Expressions only (not outside them), S-Expressions themselves
8634    can be used as macro arguments:
8635
8636   (setq a 2 b 4)
8637   (setq x (fibonacci (* a b )))
8638
8639    The value of the S-Expression (in this case "8"), and not the
8640    S-Expression itself, is sent to the macro.
8641
8642    Your macro is responsible for argument validation and error handling. A
8643    robust Fibonacci macro would be more like this:
8644
8645   define FIBONACCI {
8646       if < \v(argc) 2 end 1 ?\%0: Missing argument
8647       if > \v(argc) 2 end 1 ?\%0: Too many arguments
8648       if not integer \%1 end 1 ?\%0: Integers only
8649       if < \%1 1 end 1 ?\%0: Argument out of range
8650       (if (== \%1 0) 0
8651          (if (== \%1 1) 1 (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1)))))
8652   }
8653
8654    Recall that "END nonzero-number [ message ]" causes a macro invocation
8655    to fail. When the macro is the operator in an S-Expression, this makes
8656    the S-Expression fail too. Also note that our Fibonacci macro is just
8657    an illustration, not a practical example. Since it is recursive (calls
8658    itself), it won't work for large arguments because the call stack can
8659    exceed available memory. See [535]Section 9.9.2 for a practical
8660    alternative.
8661
8662    Kermit macros, when used as S-Expression operators, can do anything at
8663    all except initiate file transfers: they can print messages on the
8664    screen, read and write files, interact with the user, and so on. For
8665    example, here's a macro ASKME that asks you to enter a number, makes
8666    sure that you did, and then returns its value for use in the
8667    S-Expression:
8668
8669   define ASKME {
8670       local \%n
8671       while true {
8672           ask \%n { Number: }
8673           if not def \%n continue
8674           if not numeric \%n {
8675               echo Not numeric - "\%n"
8676               continue
8677           }
8678           break
8679       }
8680       return \%n
8681   }
8682   (setq a (* 2 (askme))) ; Get number from user, double it, assign result to a.
8683
8684    Here's a macro you can use to validate that a number is in a given
8685    range:
8686
8687   define inrange {
8688       if != \v(argc) 4 end 1 ?\%0: Wrong number of arguments
8689       if ( < \%1 \%2 || > \%1 \%3 ) return 0
8690       return 1
8691   }
8692
8693    The first argument is the number to be checked, the second is the
8694    minimum acceptable value, the third is the maximum. You can use this
8695    (for example) in IF conditions:
8696
8697   define yes echo \%1 IS OK
8698   define no echo \%1 IS NOT OK
8699
8700   (setq a -1 b 999)
8701   (if (inrange a 0 100) (yes a) (no a))
8702   (if (inrange b -1000 +1000) (yes b) (no b))
8703
8704    This is just an illustration, of course; there's already a built-in
8705    operator to let you do range checking without help from macros:
8706
8707   (if (<= 0 a 100) (yes a) (no a))
8708   (if (<= -1000 b +1000) (yes b) (no b))
8709
8710    To send string parameters to a macro, some kind of quoting is required
8711    to tell the S-Expression parser to take a given "word" literally rather
8712    than replacing it by its value. For this we use the Lisp QUOTE
8713    operator:
8714
8715   define length return \flength(\%1)
8716   (length (quote abcdefghijklmnopqrstuvwxyz))
8717   26
8718
8719    This causes the string "abcdefghijklmnopqrstuvwxyz" to be sent
8720    literally to the LENGTH macro. Kermit, like Lisp, also offers a
8721    shortcut for QUOTE, that lets us quote a word by prefixing it with a
8722    single quote (') character, also called apostrophe (ASCII 39):
8723
8724   (length 'abcdefghijklmnopqrstuvwxyz)
8725   26
8726
8727    The two forms are equivalent.
8728
8729    How the macro treats its arguments is up to the macro. In the example
8730    above, the argument is treated as a literal string. However, it can
8731    also be treated as a variable name:
8732
8733   define string This is a string
8734   define length return \flength(\m(\%1))
8735   (length 'string)
8736   16
8737
8738    Note the construct \m(\%1). This means "the value of the macro whose
8739    name is the value of
8740    \%1". The value of \%1 in this case is the word "string", and the value
8741    of the macro whose name is "string" is "This is a string".
8742
8743    What if the macro takes multiple arguments, or a variable number of
8744    them? Here's a simple macro that prints a phrase that includes its
8745    arguments:
8746
8747   define complain echo It's too \%*!
8748
8749    (Recall that \%* means "all arguments".)
8750
8751    It can be called in the traditional way:
8752
8753   complain hot                       Result: "It's too hot!"
8754   complain cold and wet              Result: "It's too cold and wet!"
8755
8756    Or from an S-Expression if you quote the arguments:
8757
8758   (complain 'hot)                    Result: "It's too hot!"
8759   (complain 'cold 'and 'wet)         Result: "It's too cold and wet!"
8760
8761    To group multiple words into a single argument, use parentheses:
8762
8763   (complain (quote (cold and wet)))  Result: "It's too cold and wet!"
8764   (complain '(cold and wet))         Result: "It's too cold and wet!"
8765
8766    Note the difference:
8767
8768   (complain 'cold 'and 'wet)         Three arguments
8769   (complain '(cold and wet))         One argument
8770
8771    Since the COMPLAIN macro uses \%* to refer to all its arguments, no
8772    matter how many, it doesn't care which form you use. But it makes a
8773    difference in cases where the macro refers to its arguments
8774    individually.
8775
8776    To illustrate, let's consider a macro that receives the name of a macro
8777    and its argument list and executes it with its arguments, without
8778    knowing how many arguments there are. The following LOOP macro is used
8779    to execute the given macro with the given argument list the requested
8780    number of times:
8781
8782   def loop { local i, for i 1 \%1 1 do \%2 \%3 }
8783
8784    Within the LOOP macro, the first argument (\%1) is the loop count, \%2
8785    is the macro name, and \%3 is the argument list. When the LOOP macro is
8786    invoked traditionally like this:
8787
8788   loop 3 complain hot
8789
8790    it prints "It's too hot!" three times. To invoke it from an
8791    S-Expression, you must quote both the macro name as well as the
8792    argument, since in this case the macro name itself is an argument:
8793
8794   (loop 3 'complain 'hot)
8795
8796    Now what if you need to send different or variable numbers of arguments
8797    to the LOOP macro? The LOOP macro can handle it already, provided you
8798    group the arguments into LOOP's third argument (\%3). In Kermit syntax,
8799    without grouping:
8800
8801   loop 3 complain cold and wet
8802
8803    prints "It's too cold!" three times ("and wet" is lost); but with
8804    grouping (either of the following two forms):
8805
8806   loop 3 complain {cold and wet}
8807   loop 3 complain "cold and wet"
8808
8809    the LOOP macro prints "It's too cold and wet!" three times as desired.
8810
8811    To do the same thing in an S-Expression, just use the Lisp forms of
8812    quoting instead of the Kermit forms; the following two are equivalent:
8813
8814   (loop 3 'complain (quote (cold and wet)))
8815   (loop 3 'complain '(cold and wet))
8816
8817    Here's a similar example in which we write a macro that shows both the
8818    name and the value of one or more other macros, whose names are given
8819    as arguments (similar to "show macro"):
8820
8821   define display {
8822       local \%i
8823       for \%i 1 \v(argc)-1 1 {
8824           echo \&_[\%i] = \m(\&_[\%i])
8825       }
8826   }
8827
8828    (Recall that \&_[] is the macro's argument vector array, equivalent to
8829    \%1, \%2, ...) The DISPLAY macro can be used in S-Expressions like
8830    this:
8831
8832   (setq a 1 b 2 c 3)
8833   (display 'a 'b 'c 'd)
8834
8835    which prints:
8836
8837   a = 1
8838   b = 2
8839   c = 3
8840   d =
8841
8842    The names must be quoted to prevent their evaluation before they are
8843    sent to the macro. This ability to pass variables "by name" to macros,
8844    rather than by value, lets you write macros that change the values of
8845    argument variables. For example, here's a macro that doubles the value
8846    of its argument variable:
8847
8848   define double (++ \%1 \%1)
8849
8850    which you can call like this:
8851
8852   (setq a 12)
8853   (double 'a)
8854
8855    In the macro, \%1 is replace by the variable name "a"; "(++ a a)" adds
8856    "a" to itself, and sets the value of "a" to the result.
8857
8858    There are no built-in operators other than QUOTE, ', and STRING for
8859    handling strings in S-Expressions, but using just these, plus macros
8860    that use Kermit's regular string-handling features, you can easily
8861    extend S-Expressions to do string manipulation:
8862
8863   define len return \flen(\%1)               Returns length of argument string
8864   define cap return \fupper(\%1)             Uppercase argument string
8865   define rev return \freverse(\%1)           Reverses argument string
8866   define sub return \fsubstr(\%1,\%2,\%3)    Returns substring of arg string
8867
8868   (len '(this is a string))                  Result: 16
8869   (rev '(this is a string))                  Result: gnirts a si siht
8870   (rev (cap '(this is a string)))            Result: GNIRTS A SI SIHT
8871   (sub (rev (cap '(this is a string))) 5 9)  Result: TS A SI S
8872
8873    You can assign a string to a macro name as follows:
8874
8875   (setq foo '(this is a string))
8876   (setq foo (quote (this is a string)))
8877
8878    The two are exactly equivalent. In both cases, the macro "foo" has the
8879    value:
8880
8881   '(this is a string)
8882
8883    so when it is retrieved it can be identified as a string rather than a
8884    number or commands to be executed. Thus:
8885
8886   (setq foo (quote (this is a string)))
8887   show macro foo
8888   foo = '(this is a string)
8889   (foo)
8890   this is a string
8891
8892    Note the different results for "show macro foo" and "(foo)". The former
8893    shows the internal definition; the latter evaluates the variable, which
8894    removes the quoting. And perhaps more important, note that if the
8895    apostrophe and surrounding parentheses were not stored as part of the
8896    definition, (foo) would try to execute "this is a string" as a command.
8897
8898    Given the assignment above, the following work as expected:
8899
8900   (len foo)                                  Result: 16
8901   (rev foo)                                  Result: gnirts a si siht
8902   (rev (cap foo))                            Result: GNIRTS A SI SIHT
8903   (sub (rev (cap foo)) 5 8)                  Result: TS A SI S
8904
8905    Note that, unlike built-in S-Expression operators that return numbers
8906    or truth values, these operators return strings. If you want to assign
8907    their return values to other variables, you can do so:
8908
8909   (setq bar (rev (cap foo)))                 Result: GNIRTS A SI SIHT
8910
8911    But now the S-Expression processor doesn't know the value of "bar" is
8912    supposed to be a string, rather than a macro to execute. For this you
8913    need one final special operator, STRING. The STRING operator takes an
8914    S-Expression as an operand, evaluates it, and then returns its value
8915    enclosed in '(), so you can use the value as a string is subsequent
8916    S-Expressions. Use STRING for referencing macros that return strings:
8917
8918   (setq bar (string (rev (cap foo))))        Result: '(GNIRTS A SI SIHT)
8919
8920    STRING is like QUOTE, except that it evaluates its operand before
8921    applying the quoting, rather than taking the operand literally.
8922
8923    To reference backslash variables or functions that return string
8924    values, you must use the regular quoting mechanisms:
8925
8926   (setq time '(\v(time)))
8927   (setq date '(\v(date)))
8928   assign \%r this is a string
8929   (setq s1 '(\%r))
8930
8931    That's because backslash items are evaluated BEFORE the S-Expression
8932    parser ever sees them, and the values of \v(time) and so on are not
8933    valid S-Expressions, so STRING won't like them.
8934
8935    Finally a brief word on the touchy topic of quoting. Suppose you want
8936    to include (say) literal parentheses in a string that will later be
8937    processed by the S-Expression reader (or \fsplit() or \fword()).
8938    Normally, you can't do this because parentheses are meaningful in these
8939    contexts. To defeat the normal parsing rules, you can quote the
8940    parentheses with backslash. However, due to the many levels of string
8941    processing involved, a surprisingly large amount of backslashes might
8942    be required, for example:
8943
8944   (setq s '(a b (c d) \\\\\\\\\\\\\\\\(e f (g h) x\\\\\\\\\\\\\\\\) j k))
8945
8946    This is nearly impossible to explain(*). Instead, just remember two
8947    points:
8948
8949      * In situations like this, it's better to use DEFINE to create the
8950        string, rather than SETQ. The example above requires only double
8951        backslashes when DEFINE is used:
8952   define s '(a b (c d) \\(e f (g h) x\\) j k)
8953
8954      * The level of quoting depends on how many levels of evaluation the
8955        string must pass through, which is not always obvious. However, the
8956        number of backslashes required in any given situation is always a
8957        power of 2. So if 1 doesn't work, try 2; if 2 doesn't work, try 4;
8958        if 4 doesn't work, try 8, 16, 32, and so on.
8959
8960    Considerations like this apply in any scripting language (shell, Tcl,
8961    Perl, Python, etc). The situation is known as "Quoting Hell".
8962
8963    (*) If you really want an explanation, here it is:
8964
8965      * Every SEXP has its backslash items evaluated in a single pass at
8966        top level before being passed to the SEXP reader, so \%1,
8967        \v(ftime), etc, can be evaluated up front, freeing the SEXP reader
8968        of having to know about such things, which in turn makes it much
8969        more efficient. Therefore one level of quoting is lost right away,
8970        and therefore you must double each backslash that is to be used as
8971        a quote.
8972      * When the SEXP reader sees '\', it treats it as a quote; discards it
8973        and keeps the next character. Thus '\\' becomes '\'. This would be
8974        the end of it, except that:
8975      * The SEXP reader must call itself recursively on its operands, so we
8976        must double any quotes in the operands: 2^2 = 4.
8977      * If the result is to be passed as an argument to a macro, the
8978        backslashes must again be doubled, because the macro processor
8979        evaluates the arguments before sending them to the macro: 2^3 = 8.
8980      * If the macro itself is to see the quotes, rather than just the
8981        result of the quoting, the quotes must be doubled again: 2^4 = 16.
8982
8983    Moral: To create string constants in which grouping characters must be
8984    quoted, use DEFINE rather than SETQ.
8985
8986    [ [536]Top ] [ [537]Contents ] [ [538]C-Kermit Home ] [ [539]Kermit
8987    Home ]
8988
8989 9.9. Examples
8990
8991 9.9.1. Statistics
8992
8993    The following program computes statistics -- means, maxima, minima,
8994    variance, standard deviation, and correlation -- from data stored in
8995    parallel arrays, \&x[] and \&y[], which can contain any mixture of
8996    integer and floating-point numbers: positive, negative, or zero. Array
8997    setup and validation are not shown. Except for the traditional FOR loop
8998    and printing the results at the end, the entire computation is done
8999    with S-Expressions:
9000
9001 ; Initialize sums, maxima, minima, and number of elements
9002
9003   (setq xsum 0 ysum 0 xsum2 0 ysum2 0 xysum 0)
9004   (setq xmin (setq xmax \&x[1]) ymin (setq ymax \&y[1]))
9005   (setq n \fdim(&x))
9006
9007 ; Loop through elements and accumulate sums, maxima, and minima
9008
9009   for i 1 n 1 {
9010       (setq x \&x[i] y \&y[i])                    ; Notational convenience
9011       (setq xmax (max xmax x) ymax (max ymax y))  ; X and Y maxima
9012       (setq xmin (min xmin x) ymin (min ymin y))  ; X and Y minima
9013       (++ xsum x ysum y)                          ; X and Y sums
9014       (++ xsum2 (^ x 2) ysum2 (^ y 2))            ; Sum of X and Y squares
9015       (++ xysum (* x y))                          ; Sum of XY products
9016   }
9017
9018 ; Calculate results
9019
9020   (setq xmean (/ xsum n) ymean (/ ysum n))        ; Mean X and Y
9021   (setq xss (- xsum2 (/ (^ xsum 2) n)))           ; Intermediate values
9022   (setq yss (- ysum2 (/ (^ ysum 2) n)))
9023   (setq xyss (- xysum (/ (* xsum ysum) n)))
9024   (setq xvar (/ xss n) yvar (/ yss n))            ; X and Y variance
9025   (setq sdx (sqrt xvar) sdy (sqrt yvar))          ; Std deviation in X and Y
9026   (setq tmp (* xss yss))
9027   (setq cc (if tmp (/ xyss (sqrt tmp)) 1.0))      ; Correlation coefficient
9028   show macro xmean ymean xvar yvar sdx sdy cc     ; Print the results
9029
9030    The final "if tmp" check accounts for the possibility that both arrays
9031    contain all 0's. Results can also be printed with "echo CC = \m(cc)",
9032    or any other desired way. Interestingly, if we had not needed the sum
9033    of the squares and products, we could have obtained the sums, maxima,
9034    and minima of the X's and Y's without a loop like this:
9035
9036   (setq xsum (+ \fjoin(&x)) ysum (+ \fjoin(&y)))
9037   (setq xmax (max \fjoin(&x)) ymax (max \fjoin(&y)))
9038   (setq xmin (min \fjoin(&x)) ymin (min \fjoin(&y)))
9039
9040    Any Kermit function that returns numbers or lists of numbers can be
9041    included in an S-Expression as an operand.
9042
9043 9.9.2. Practical Fibonacci Series
9044
9045    The recursive Fibonacci example given previously is simple and elegant,
9046    but not very useful since it causes memory occupation to grow each time
9047    it calls itself, until eventually both physical memory and disk swap
9048    space are filled and the program crashes. Even for small arguments,
9049    like 17, execution time can be prohibitive:
9050
9051   (setq t1 \v(ftime))
9052   (setq result (fibonacci 17))
9053   (setq t2 (- \v(ftime) t1))
9054   echo FIBONACCI(17) = \m(result): TIME = \ffpround(t2,3)
9055
9056    prints (on a certain rather slow computer):
9057
9058   FIBONACCI(17) = 1597: TIME = 5.861
9059
9060    Any recursive function can be recoded iteratively. The result is not as
9061    pretty, but execution is far less expensive:
9062
9063     define FIBITER {
9064         (if (== \%3 0) (\%2) (fibiter (+ \%1 \%2) \%1 (- \%3 1)))
9065     }
9066     define FIBONACCI {
9067         (fibiter 1 0 \%1)
9068     }
9069
9070    Here's the result on the same computer for the same argument of 17:
9071
9072   FIBONACCI(17) = 1597: TIME = 0.015
9073
9074    (47 times faster.) Execution time increases proportionally to the size
9075    of the argument in the iterative case, whereas in the recursive case it
9076    goes up geometrically, quickly reaching infinity.
9077
9078    [ [540]Top ] [ [541]Contents ] [ [542]C-Kermit Home ] [ [543]Kermit
9079    Home ]
9080
9081 9.10. Differences from Algebraic Notation
9082
9083    In C-Kermit:
9084
9085      * Algebraic notation uses infix operators and normal rules of
9086        operator precedence, with parentheses used to force exceptions to
9087        the rules; many operations can be included in an expression.
9088        S-Expressions use prefix operators with no intrinsic precedence;
9089        each operation is enclosed in parentheses, and the arrangement of
9090        parentheses determines precedence.
9091      * Algebraic infix operators require two operands; S-Expression prefix
9092        operators can accept a variable number of operands.
9093      * You can use algebraic notation anywhere that C-Kermit accepts a
9094        number, e.g. "echo \&a[((1+1)*2-1]", but you can use S-Expressions
9095        only as top-level commands. You can, however, use either algebraic
9096        or S-Expressions anywhere at all by enclosing them in \fevaluate()
9097        or \fsexpression(), respectively.
9098      * You can use any mixture of integer and floating-point numbers in
9099        S-Expressions, but only integers are permitted in algebraic
9100        expressions. Outside of S-Expressions, floating point arithmetic is
9101        supported only by \ffp...() function calls.
9102      * Operators and operands in S-Expressions must be separated by
9103        spaces, e.g. "(+ a b)". Spaces are not required in algebraic
9104        expressions: "((a+b)*c)".
9105      * When assigning values to backslash variables (such as \%x or
9106        \&a[2]) using SETQ or LET, you must double the backslash.
9107
9108    [ [544]Top ] [ [545]Contents ] [ [546]C-Kermit Home ] [ [547]Kermit
9109    Home ]
9110
9111 9.11. Differences from Lisp
9112
9113      * Kermit has a lot of built-in operators not found in Lisp: ++, ^,
9114        etc.
9115      * Most dialects of real Lisp do not allow S-Expressions that don't
9116        start with an operator, for example:
9117   (a)
9118
9119        This expression can cause an error in Lisp (even if "a" has a
9120        value), but is acceptable in Kermit, where it returns the value of
9121        the variable "a". Similarly, (1) returns the value "1".
9122      * In real Lisp, EVAL requires exactly one operand. In Kermit, it can
9123        have 0, 1, 2, or more operands. It returns the value of the last
9124        operand evaluated.
9125      * Real Lisp SETQ and LET usually require an even number of operands.
9126        Kermit allows an odd number, in which case the last (or only)
9127        variable is undefined (i.e. deleted, destroyed).
9128      * Kermit does not support ratios such as "7/8". Some Lisp dialects
9129        accept ratios as numbers, and generate ratios when told to divide
9130        two integers whose quotient is not a whole number; e.g. in Common
9131        Lisp:
9132   [13] USER(37): (/ (+ 1 2 3 4) 3)
9133   10/3
9134   [13] USER(38):
9135
9136      * The result of (/ 10 3) is 3.333.... Some Lisp dialects truncate the
9137        result to 3 since both operands are integers, some don't; some give
9138        the result as a ratio. C-Kermit always gives a floating point
9139        result when there is a fractional part. If you want an integer
9140        result, you can use TRUNCATE, FLOOR, or CEILING, e.g. (truncate (/
9141        10 3)).
9142      * There is currently no "bignum" support. Large numbers can be used
9143        and large results generated, but (as noted in [548]Section 9.2)
9144        they are accurate only to the precision of the underlying machine.
9145        \v(math_precision) gives the machine precision as a number of
9146        decimal digits, e.g. 16.
9147      * Scientific notation for floating-point numbers is not supported. If
9148        the magnitude of a number is greater than the precision of the
9149        underlying hardware, the less-significant digits are shown but
9150        their values are meaningless. If it the number is too small to be
9151        represented internally, it is shown as "0.0".
9152      * Many Lisp features are omitted: List processing (CAR, CDR, etc),
9153        DEFUN, Lisp-specific control structures, and so on.
9154
9155    [ [549]Top ] [ [550]Contents ] [ [551]C-Kermit Home ] [ [552]Kermit
9156    Home ]
9157
9158 10. FILE TRANSFER
9159
9160    New commands and switches:
9161
9162    SET TRANSFER REPORT { OFF, ON }
9163           Enables or disables the (new) one-line message printed by Kermit
9164           after a remote-mode file transfer to indicate the source and
9165           destination file, complete with path, to let you know where the
9166           file went.
9167
9168    SEND /TYPE:{TEXT,BINARY}
9169           Sends only files of the given type (see [553]Section 4).
9170
9171    SEND /NOFOLLOWLINKS:
9172           (UNIX only) Skip over symbolic links rather than following them
9173           (default). This applies to wildcard and/or recursive SENDs; if a
9174           single filename is given, and it happens to be a symbolic link,
9175           the file it points to is sent.
9176
9177    SEND /FOLLOWLINKS:
9178           (UNIX only) Follow (resolve) symbolic links. Watch out for
9179           circular links, endless loops, etc.
9180
9181    SET SEND I-PACKETS { OFF, ON }
9182           When sending commands to a Kermit server, this tells whether
9183           command packets should be preceded by an I (information) packet,
9184           which is used to synchronize parameters prior to executing the
9185           command. Normally ON. The only reason to set this OFF is for
9186           communicating with buggy Kermit servers that misbehave when an I
9187           packet is sent to them. There is also a SET RECEIVE I-PACKETS
9188           command, but presently it has no effect.
9189
9190    SET TRANSFER MESSAGE [ text ]
9191           Sets an initial message to be shown in the Last Message field of
9192           the fullscreen file-transfer display.
9193
9194    SET TRANSFER TRANSLATION { ON, OFF }
9195           Inhibits or re-enables text-file transfer character-set
9196           translation globally.
9197
9198    { SEND, MSEND, GET, RECEIVE } /TRANSPARENT
9199           Inhibits character-set translation for this transfer only.
9200
9201    { GET, RECEIVE } /PIPES:{ON,OFF}
9202           Overrides global TRANSFER PIPES setting for this transfer only;
9203           ON allows incoming files with names like "!tar xf -" to be
9204           opened as pipelines rather than regular files.
9205
9206    The following new "hot keys" are available when Kermit's file-transfer
9207    display is visible:
9208
9209      D: Turn on debugging, open "debug.log" if not already open.
9210      d: Turn off debugging but leave log open (if it was open).
9211      T: Turn on debug-log timestamps.
9212      t: Turn off debug-log timestamps.
9213
9214    Other improvements:
9215      * SET FILE DOWNLOAD-DIRECTORY now works for external protocols (e.g.
9216        sz/rz) too.
9217      * Improved automatic per-file text/binary switching, described in
9218        [554]Section 4.
9219      * When sending a file group (e.g. "send *.*"), failure to open a file
9220        is no longer fatal; now C-Kermit simply goes ahead to the next
9221        file.
9222      * Transaction log entries are now made for external protocols too.
9223
9224    [ [555]Top ] [ [556]Contents ] [ [557]C-Kermit Home ] [ [558]Kermit
9225    Home ]
9226
9227 11. MODEMS AND DIALING
9228
9229    In C-Kermit 8.0, the default modem type for dialing has changed from
9230    NONE (= DIRECT, meaning no modem) to GENERIC. This change should have
9231    no impact on direct connections. For dialing, it means that, unless you
9232    SET MODEM TYPE to a specific type, such as USROBOTICS or CONEXANT,
9233    Kermit assumes:
9234
9235     1. The modem uses the Hayes AT command set.
9236     2. The modem supports error correction, data compression, and hardware
9237        flow control and is already configured to use them.
9238
9239    In fact, Kermit assumes the modem is completely configured, and
9240    therefore does not send it an initialization string or any
9241    configuration commands. Instead, it sends only the simplest and most
9242    portable commands:
9243
9244      ATQ0V1          Give dial result codes.
9245      ATDTnumber      Dial the number.
9246
9247    (or ATD or ATDP, as appropriate).
9248
9249    The new defaults work for direct connections and for most modern modems
9250    on most platforms, and they work much faster than "full-treatment"
9251    dialing. If the new defaults don't work for you, or if you need to
9252    perform explicit modem configurations or interactions, then set a
9253    specific modem type and use the SET MODEM and SET DIAL commands as
9254    documented in Using C-Kermit.
9255
9256      WARNING: Don't use the generic modem on hosts that do not support
9257      RTS/CTS flow control. If Xon/Xoff is in use on the serial port,
9258      you'll need to select a particular modem type so Kermit knows what
9259      command to give it to enable Xon/Xoff flow control between itself
9260      and your serial port.
9261
9262    The following new modem types were added in C-Kermit 8.0:
9263
9264      lucent:          Lucent Venus chipset
9265      pctel:           PCTel V.90 chipset
9266      conexant:        Conexant (ex-Rockwell) modem family
9267      zoom-v32bis:     New name for "Zoom"
9268      zoom-v34         Zoom V.34
9269      zoom-v90         Zoom V.90 56K
9270      zoom-v92:        Zoom V.92 with V.44 data compression
9271      zoltrix-v34:     New name for "zoltrix"
9272      zoltrix-hsp-v90: Synonym for PCTel
9273      zoltrix-hcf-v90: Synonym for ITU-T-V250
9274      smartlink-v90:   Synonym for usrobotics (same chipset)
9275      acer-v90:        Synonym for Rockwell-v90
9276
9277    New DIAL-related variables:
9278
9279      \v(dm_hf):  Dial modifier: Wait for Hook-Flash.
9280      \v(dm_wb):  Dial modifier: Wait for Bong.
9281
9282    Finally, if dialing fails, Kermit now prints a context-sensitive hint
9283    suggesting possible reasons and remedies.
9284
9285    Added in C-Kermit 8.0.201:   Rudimentary support for Caller ID, for use
9286    with the ANSWER command. If the modem reports Caller ID information,
9287    Kermit stores it in variables that you can accesss after the call is
9288    answered:
9289
9290   \v(callid_date)   The date of the call
9291   \v(callid_time)   The time of the call
9292   \v(callid_name)   The name of the caller
9293   \v(callid_nmbr)   The telephone number of the caller
9294   \v(callid_mesg)   A message
9295
9296    The format of these items depends on the originating and answering
9297    phone companies and the modems and their configuration.
9298
9299    Not very many modems support Caller ID, and those that do (a) tend to
9300    have it disabled by default, and (b) use different commands to enable
9301    it. A quick survey shows of some current models shows:
9302
9303    - USR V.90:      No
9304    - ITU-T V.250:   No
9305    - Lucent Venus:  No
9306    - Diamond Supra: #CID=1
9307    - Rockwell 56K:  #CID=1
9308    - PCTEL:         #CID=1
9309    - Zoltrix:       +VCID=1
9310    - Conexant:      +VCID=1
9311
9312    To use Kermit's Caller ID feature, you have to set the modem to wait
9313    for at least two rings before answering, and you have to give the
9314    command to enable Caller ID; for example (after choosing a modem with
9315    SET MODEM TYPE):
9316
9317   set modem command autoanswer on ATS0=2#CID=1\{13}
9318   set modem command autoanswer on ATS0=2+VCID=1\{13}
9319
9320    These commands can be undone with:
9321
9322   set modem command autoanswer on ATS0=1#CID=0\{13}
9323   set modem command autoanswer on ATS0=1+VCID=0\{13}
9324
9325    Kermit presently has no built-in knowledge of the Caller ID
9326    capabilities or commands of the modems in its database.
9327
9328    Since the variables can be accesssed only after the call is answered,
9329    the only way to refuse a call is to answer it, inspect the variables,
9330    and then hang it up if desired.
9331
9332    [ [559]Top ] [ [560]Contents ] [ [561]C-Kermit Home ] [ [562]Kermit
9333    Home ]
9334
9335 12. TERMINAL CONNECTION
9336
9337    Now that 7-bit connections are no longer the norm, the default terminal
9338    bytesize (also called "data size" or "word size") in C-Kermit 8.0 is 8
9339    bits, rather than 7 bits as it was in C-Kermit 7.0 and earlier:
9340
9341    SET ESCAPE character
9342           This command, which specifies your CONNECT-mode escape
9343           character, allows you to specify any ASCII control character in
9344           a variety of formats. C-Kermit 8.0.201 now also lets you specify
9345           any 8-bit value, 128-255, as the escape character. In the SET
9346           ESCAPE command, you can type the 8-bit character literally or
9347           you can enter its numeric code. Here are examples that you can
9348           enter from a terminal or console that uses the ISO Latin-1
9349           character set:
9350
9351   C-Kermit> set escape Ã
9352   C-Kermit> set escape 195
9353   C-Kermit> show escape
9354    Escape character: Code 195 (Ã): enabled
9355   C-Kermit>
9356
9357           Both of these commands set the escape character value to 195
9358           (decimal), which happens to be uppercase letter A with Tilde in
9359           Latin-1. SHOW ESCAPE and SHOW TERMINAL show the value, as does
9360           the CONNECT message.
9361
9362    SET TERMINAL AUTODOWNLOAD ERROR { STOP, CONTINUE }
9363           When Kermit has a terminal connection to another computer, and a
9364           file transfer is initiated automatically because a Kermit packet
9365           was received in CONNECT mode (i.e. in the terminal screen), this
9366           command tells what Kermit should do if the transfer fails. The
9367           default is to STOP, which leaves Kermit in command mode with its
9368           file-transfer display showing, so you can see that the transfer
9369           failed and why. If you SET TERMINAL AUTODOWNLOAD ERROR CONTINUE,
9370           this causes Kermit to return automatically to its terminal
9371           screen (i.e. resume its CONNECT session) as if the transfer had
9372           succeeded; this can be desirable if the entire session is under
9373           control of a host-based script.
9374
9375    SET TERMINAL BYTESIZE { 7, 8 }
9376           The byte size to use during CONNECT and INPUT command execution,
9377           which can be more restrictive than the bytesize implied by the
9378           current PARITY setting, but not less restrictive. In C-Kermit
9379           7.0 and earlier, the terminal bytesize was 7 by default to
9380           protect against the likelihood that parity was in use on the
9381           connection without the user's knowledge. When the terminal
9382           bytesize is 8 (as it is in C-Kermit 8.0 and later), the user
9383           will see garbage in this (increasingly unlikely) situation. Note
9384           that 8 data bits are required for most character sets other than
9385           ASCII: Latin-1, UTF-8, and so on.
9386
9387    A new command has been added to produce timestamped session logs:
9388
9389    SET TERMINAL SESSION-LOG TIMESTAMPED-TEXT
9390           Records the terminal session in text mode (like SET TERMINAL
9391           SESSION-LOG TEXT) but adds a timestamp at the beginning of each
9392           line. The timestamp format is hh:mm:ss.nnn, and indicates the
9393           time at which the first character of the line appeared.
9394
9395    In most UNIX versions (those built with the select()-capable CONNECT
9396    module -- pretty much all the ones that have or could have TELNET
9397    included), an idle timeout feature has been added:
9398
9399    SET TERMINAL IDLE-TIMEOUT number
9400           If the number is not 0, then Kermit is to take an action when
9401           the given amount of time passes with no activity during CONNECT
9402           mode. If the number is positive it is the maximum number of idle
9403           seconds; if number is negative it represents milliseconds
9404           (thousandths of seconds). If 0 is given as the number, there are
9405           no idle timeouts. Synonym: SET TERMINAL IDLE-LIMIT.
9406
9407    SET TERMINAL IDLE-ACTION { RETURN, HANGUP, EXIT, OUTPUT [ string ] }
9408           The action to be taken upon an idle timeout in CONNECT mode.
9409           RETURN to the prompt, HANGUP the connection, EXIT from Kermit,
9410           or OUTPUT the given string (if no string is given, a NUL (ASCII
9411           0) character is sent).
9412
9413    SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }
9414           Actions that can be selected on Telnet connections only, that
9415           might be useful if idle limits are enforced by the Telnet server
9416           or in the TCP/IP protocol: TELNET-NOP sends a "NO Operation"
9417           (do-nothing) command, which causes no response from the server;
9418           TELNET-AYT sends an "Are You There" message to the server, which
9419           should make the server send back a message. Neither of these
9420           actions interferes with your remote session.
9421
9422    SET TERMINAL IDLE-ACTION is useful for connections to hosts or services
9423    that automatically log you out after a certain amount of idle time,
9424    e.g.:
9425
9426   set term idle-timeout 300
9427   set term idle-action output \32
9428
9429    sends a space (as if you had pressed the space bar) every 300 seconds
9430    (five minutes) while there is no activity (32 is the ASCII code for
9431    space).
9432
9433    When C-Kermit returns from CONNECT to command mode, the reason for the
9434    transition is given in a new variable, \v(cx_status):
9435
9436       0  No CONNECT command given yet.
9437       1  User escaped back manually.
9438       2  A trigger string was encountered.
9439       3  IKSD entered server mode.
9440       4  Application Program Command received from host.
9441       5  Idle timeout.
9442       6  Telnet protocol error.
9443       7  Keystroke macro.
9444       8  Time limit exceeded.
9445     100  Internal error.
9446     101  Carrier required by not detected.
9447     102  I/O error on connection.
9448     103  Disconnected by host.
9449     104  Disconnected by user.
9450     105  Session limit exceeded.
9451     106  Rejected due to Telnet policy.
9452     107  Received kill signal.
9453
9454    Values 100 and above indicate there is no connection.
9455
9456    [ [563]Top ] [ [564]Contents ] [ [565]C-Kermit Home ] [ [566]Kermit
9457    Home ]
9458
9459 13. CHARACTER SETS
9460
9461    See the section on [567]file scanning above, and the section on
9462    character-set conversion in [568]FTP. Also:
9463
9464      * True support for CP1252 (rather than treating it as Latin-1).
9465      * Proper handling of C1 values when converting ISO 8-bit text to
9466        UTF-8.
9467      * TYPE /CHARACTER-SET: /TRANSLATE-TO: allows specific translations.
9468      * The TRANSLATE command now works on multiple files.
9469      * K_CHARSET environment variable to set the file character-set.
9470      * SET TRANSFER TRANSLATION OFF.
9471      * FTP client character-set translation ([569]Section 3.7).
9472
9473    [ [570]Top ] [ [571]Contents ] [ [572]C-Kermit Home ] [ [573]Kermit
9474    Home ]
9475
9476 14. DIALOUT FROM TELNET TERMINAL SERVERS
9477
9478    For years, C-Kermit has supported dialing out from Telnet modem servers
9479    (also called reverse terminal servers or accesss servers), but until
9480    now there was no way for Kermit to control the communication parameters
9481    (speed, parity, etc) on the serial port of the terminal server; it had
9482    to use whatever was there.
9483
9484    But now, if you make a connection to a server that supports the Telnet
9485    Com Port Control Option, [574]RFC 2217, you have the same degree of
9486    control as you would have over a serial port on the computer where
9487    Kermit is running: SET SPEED, SET FLOW, SET PARITY, SET STOP-BITS, SHOW
9488    COMM, WAIT, SET CARRIER-WATCH, the modem-signal variables, sending
9489    Break, and so on, apply to the connection between the terminal server
9490    and the modem.
9491
9492    For example, using a Cisco Access Server 2509, where specifying a TCP
9493    port in the 6000's selects a serial port that can be used for dialing
9494    out:
9495
9496   set host xxx 6001      ; xxx is the IP hostname or address of the server
9497   (log in if necessary)  ; With a script or by hand
9498   set modem type usr     ; Tell Kermit what kind of modem it has
9499   set speed 57600        ; This affects the server's port
9500   set flow rts/cts       ; Ditto
9501   dial 7654321
9502
9503    The modem server might or might not require a login sequence. It might
9504    also allow for automatic authentication, e.g. via Kerberos tickets.
9505    NOTE: If the modem server requires a login sequence, then REDIAL might
9506    not work as expected.
9507
9508    When you have a Telnet Com Port connection, your SET SPEED and SET FLOW
9509    options change automatically to reflect the capabilities of the server,
9510    rather than those of your local computer.
9511
9512    See the configuration manual for your server for additional
9513    information. For example, how to set up the server to drop the Telnet
9514    connection automatically when the telephone call is hung up (e.g.
9515    "autohangup" on Cisco models).
9516
9517    For a Linux-based Telnet Com-Port server, click the Srdird link:
9518
9519    [ [575]Top ] [ [576]Contents ] [ [577]Sredird ] [ [578]C-Kermit Home ]
9520    [ [579]Kermit Home ]
9521
9522 15. COPING WITH BROKEN KERMIT PARTNERS
9523
9524    There are lots of faulty Kermit protocol implementations out there,
9525    found mainly in 3rd-party products ranging from communications software
9526    packages to file-transfer functions embedded within devices. This topic
9527    is covered [580]HERE for C-Kermit 7.0, but C-Kermit 8.0 adds some
9528    additional tricks.
9529
9530    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
9531           Allows control of the Kermit's Record-Format attribute. Set this
9532           to OFF in case incoming file are refused due to unknown or
9533           invalid record formats if you want to accept the file anyway.
9534
9535    SET ATTRIBUTES OFF
9536           This is not a new trick, but it was recently discovered that the
9537           Kermit implementation embedded within a certain kind of
9538           punching/bending machine (Salvagnini if you must know) hangs
9539           upon reception of standard format Kermit attributes when
9540           receiving files. When sending files, it sends attributes of its
9541           own, one per A-packet, which is slightly unusual but legal. When
9542           receiving files from C-Kermit, K95, MS-DOS Kermit, Kermit-370,
9543           etc, it simply exits upon reception of the first A-packet;
9544           apparently it was not coded according to the protocol
9545           specification, which allows multiple attributes per A-packet.
9546           Solution: tell the file sender to SET ATTRIBUTES OFF.
9547
9548    SET SEND I-PACKETS { ON, OFF }
9549           A Kermit server is supposed to accept I-packets; this is how the
9550           client lets the server know its capabilities and preferences
9551           before sending a command. Apparently there is at least one
9552           Kermit server implementation that does not accept I-packets, and
9553           does not properly respond with an Error packet if it gets one.
9554           To get around such situations in C-Kermit 8.0, you can use SET
9555           SEND I-PACKETS OFF to inhibit the sending of I packets. In this
9556           case, the client must be able to adjust to the server's
9557           configuration, rather than the other way around as we are used
9558           to.
9559
9560    SET PROTOCOL KERMIT {} {} {}
9561           C-Kermit 6.0 and later automatically send "autoupload" and
9562           "autodownload" commands when in local mode and you give a file
9563           transfer command. For example, if you tell kermit to "send
9564           oofa.txt", Kermit sends "kermit -r" and a carriage return, in
9565           case you had forgotten to start Kermit on the far end and told
9566           it to receive a file. If a Kermit program had already been
9567           started on the far end, it should harmlessly absorb this string.
9568           However, some Kermit programs violate the Kermit protocol
9569           definition and treat such strings as Kermit packets even though
9570           they are not. In such cases, give this command to set the Kermit
9571           protocol autoupload and download strings to nothing, which tells
9572           Kermit not to send them. (This is not a new feature, but it was
9573           not previously included in the "Coping" section of the
9574           documentation.)
9575
9576    [ [581]Top ] [ [582]Contents ] [ [583]C-Kermit Home ] [ [584]Kermit
9577    Home ]
9578
9579 16. NEW COMMAND-LINE OPTIONS
9580
9581    kermit -h Now prints a complete listing of its command-line options,
9582    rather than an abbreviated list squeezed into a 24x80 space.
9583
9584    -dd              Debug, like -d but adds timestamps
9585    --version  Shows C-Kermit version number.
9586    --noperms  Equivalent to SET ATTRIBUTE PROTECTION OFF.
9587
9588    Kermit now accepts a selection of URLs (Universal Resource Locators) as
9589    its first command-line argument. These are:
9590
9591    telnet:hostname
9592           Makes a Telnet connection to the given host (IP hostname or
9593           address).
9594
9595    ftp://[user[:password]@]hostname[/path...]
9596           Makes an FTP connection to the given host (IP hostname or
9597           address). If a username is given, Kermit tries to log you in; if
9598           a password is given, it is used; if not, you are prompted for
9599           one. If no username is given, an anonymous login is performed.
9600           If a pathname is included, Kermit tries to GET the given file.
9601           See [585]Section 3.1.3 for details.
9602
9603    ftps://[user[:password]@]hostname[/path...]
9604           Makes a secure FTP connection over SSL.
9605
9606    telnets://[user[:password]@]hostname
9607           Makes a secure Telnet connection over SSL.
9608
9609    kermit://[user[:password]@]hostname[/path...]
9610           Makes a connection to an [586]Internet Kermit Server.
9611
9612    http://[user[:password]@]hostname[/path...]
9613           Makes a connection to Web server.
9614
9615    https://[user[:password]@]hostname[/path...]
9616           Makes a connection to secure Web server.
9617
9618    [ [587]Top ] [ [588]Contents ] [ [589]C-Kermit Home ] [ [590]Kermit
9619    Home ]
9620
9621 17. LOGS
9622
9623    In C-Kermit 8.0, we make an effort to keep passwords out of the debug
9624    log. This can never be 100% effective, but it's better than before,
9625    when there were no precautions at all. Whenever Kermit knows it's
9626    prompting for, parsing, or transmitting a password, it temporarily
9627    turns off logging and then turns it back on afterwards. This keeps the
9628    debug log password-free in most common cases, but there can be no
9629    guarantees.
9630
9631    As noted elsewhere, the new "-dd" command-line option selects a
9632    timestamped debug log (equivalent to "set debug timestamps on", "log
9633    debug debug.log").
9634
9635    C-Kermit 8.0 also supports a new timestamped session log via "set
9636    session-log timestamped-text", "log session".
9637
9638    There have been requests for other kinds of logs, for example a command
9639    log. These might be added at some point. One person wanted to be able
9640    to log commands with timestamps, but only commands issued at the
9641    prompt, not commands from files or macros, and also wanted a header
9642    line at the beginning showing the date, user, and host. This can be
9643    done as follows:
9644
9645   .filename := \v(home)commands.log  ; (for example)
9646   fopen /write \%c \m(filename)
9647   if success {
9648       fwrite /line \%c \v(date): User=\v(user) Host=\v(host)
9649       fclose \%c
9650       set debug timestamps on
9651       log debug {| grep "CMD(P)" >> \m(filename)} append
9652   }
9653
9654    [ [591]Top ] [ [592]Contents ] [ [593]C-Kermit Home ] [ [594]Kermit
9655    Home ]
9656      __________________________________________________________________
9657
9658
9659     C-Kermit 8.0 Update Notes / [595]The Kermit Project / Columbia
9660     University / 15 Dec 2003 - 13 Sep 2010
9661
9662 References
9663
9664    1. http://www.columbia.edu/
9665    2. mailto:kermit@columbia.edu
9666    3. http://www.columbia.edu/kermit/index.html
9667    4. http://www.columbia.edu/kermit/k95.html
9668    5. http://www.columbia.edu/kermit/ckermit.html
9669    6. http://www.columbia.edu/kermit/ckscripts.html
9670    7. http://www.columbia.edu/kermit/current.html
9671    8. http://www.columbia.edu/kermit/whatsnew.html
9672    9. http://www.columbia.edu/kermit/faq.html
9673   10. http://www.columbia.edu/kermit/support.html
9674   11. http://www.columbia.edu/kermit/ckermit80.html#contents
9675   12. http://www.columbia.edu/kermit/ckermit.html
9676   13. http://www.columbia.edu/kermit/index.html
9677   14. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641
9678   15. http://www.columbia.edu/kermit/ckermit80.html
9679   16. mailto:kermit-support@columbia.edu
9680   17. http://www.columbia.edu/kermit/
9681   18. http://www.kermit-project.org/
9682   19. http://www.columbia.nyc.ny.us/kermit/
9683   20. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
9684   21. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
9685   22. http://www.columbia.edu/kermit/ckermit80.html#xv
9686   23. http://www.columbia.edu/kermit/ck60manual.html
9687   24. http://www.columbia.edu/kermit/ckermi70.html
9688   25. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt
9689   26. http://www.columbia.edu/kermit/ckututor.html
9690   27. ftp://kermit.columbia.edu/kermit/f/ckuker.nr
9691   28. http://www.columbia.edu/kermit/security.htm
9692   29. http://www.columbia.edu/kermit/telnet.htm
9693   30. http://www.columbia.edu/kermit/ftpscripts.html
9694   31. http://www.columbia.edu/kermit/ckcbwr.html
9695   32. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
9696   33. http://www.columbia.edu/kermit/ckubwr.html
9697   34. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
9698   35. http://www.columbia.edu/kermit/ckvbwr.html
9699   36. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
9700   37. http://www.columbia.edu/kermit/ckuins.html
9701   38. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
9702   39. http://www.columbia.edu/kermit/ckvins.html
9703   40. ftp://kermit.columbia.edu/kermit/f/ckvins.txt
9704   41. http://www.columbia.edu/kermit/ckccfg.html
9705   42. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
9706   43. http://www.columbia.edu/kermit/ckcplm.html
9707   44. ftp://kermit.columbia.edu/kermit/f/ckcplm.txt
9708   45. http://www.columbia.edu/kermit/iksd.html
9709   46. http://www.columbia.edu/kermit/skermit.html
9710   47. http://www.columbia.edu/kermit/ckermit80.html#top
9711   48. http://www.columbia.edu/kermit/ckermit.html
9712   49. http://www.columbia.edu/kermit/index.html
9713   50. http://www.columbia.edu/kermit/ckermit80.html#x0
9714   51. http://www.columbia.edu/kermit/ckermit80.html#x1
9715   52. http://www.columbia.edu/kermit/ckermit80.html#x2
9716   53. http://www.columbia.edu/kermit/ckermit80.html#x2.1
9717   54. http://www.columbia.edu/kermit/ckermit80.html#x2.2
9718   55. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
9719   56. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
9720   57. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
9721   58. http://www.columbia.edu/kermit/ckermit80.html#x2.2.4
9722   59. http://www.columbia.edu/kermit/ckermit80.html#x2.2.5
9723   60. http://www.columbia.edu/kermit/ckermit80.html#x2.2.6
9724   61. http://www.columbia.edu/kermit/ckermit80.html#x3
9725   62. http://www.columbia.edu/kermit/ckermit80.html#x3.1
9726   63. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
9727   64. http://www.columbia.edu/kermit/ckermit80.html#x3.1.2
9728   65. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
9729   66. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
9730   67. http://www.columbia.edu/kermit/ckermit80.html#x3.2
9731   68. http://www.columbia.edu/kermit/ckermit80.html#x3.3
9732   69. http://www.columbia.edu/kermit/ckermit80.html#x3.4
9733   70. http://www.columbia.edu/kermit/ckermit80.html#x3.5
9734   71. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
9735   72. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
9736   73. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
9737   74. http://www.columbia.edu/kermit/ckermit80.html#x3.6
9738   75. http://www.columbia.edu/kermit/ckermit80.html#x3.6.1
9739   76. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
9740   77. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
9741   78. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9742   79. http://www.columbia.edu/kermit/ckermit80.html#x3.7.1
9743   80. http://www.columbia.edu/kermit/ckermit80.html#x3.7.2
9744   81. http://www.columbia.edu/kermit/ckermit80.html#x3.8
9745   82. http://www.columbia.edu/kermit/ckermit80.html#x3.9
9746   83. http://www.columbia.edu/kermit/ckermit80.html#x3.10
9747   84. http://www.columbia.edu/kermit/ckermit80.html#x3.10.1
9748   85. http://www.columbia.edu/kermit/ckermit80.html#x3.10.2
9749   86. http://www.columbia.edu/kermit/ckermit80.html#x3.10.3
9750   87. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9751   88. http://www.columbia.edu/kermit/ckermit80.html#x4
9752   89. http://www.columbia.edu/kermit/ckermit80.html#x5
9753   90. http://www.columbia.edu/kermit/ckermit80.html#x6
9754   91. http://www.columbia.edu/kermit/ckermit80.html#x6.1
9755   92. http://www.columbia.edu/kermit/ckermit80.html#x6.2
9756   93. http://www.columbia.edu/kermit/ckermit80.html#x6.3
9757   94. http://www.columbia.edu/kermit/ckermit80.html#x6.4
9758   95. http://www.columbia.edu/kermit/ckermit80.html#x6.5
9759   96. http://www.columbia.edu/kermit/ckermit80.html#x6.6
9760   97. http://www.columbia.edu/kermit/ckermit80.html#x7
9761   98. http://www.columbia.edu/kermit/ckermit80.html#x8
9762   99. http://www.columbia.edu/kermit/ckermit80.html#x8.1
9763  100. http://www.columbia.edu/kermit/ckermit80.html#x8.2
9764  101. http://www.columbia.edu/kermit/ckermit80.html#x8.3
9765  102. http://www.columbia.edu/kermit/ckermit80.html#x8.4
9766  103. http://www.columbia.edu/kermit/ckermit80.html#x8.5
9767  104. http://www.columbia.edu/kermit/ckermit80.html#x8.6
9768  105. http://www.columbia.edu/kermit/ckermit80.html#x8.7
9769  106. http://www.columbia.edu/kermit/ckermit80.html#x8.8
9770  107. http://www.columbia.edu/kermit/ckermit80.html#x8.9
9771  108. http://www.columbia.edu/kermit/ckermit80.html#x8.10
9772  109. http://www.columbia.edu/kermit/ckermit80.html#x8.11
9773  110. http://www.columbia.edu/kermit/ckermit80.html#x8.12
9774  111. http://www.columbia.edu/kermit/ckermit80.html#x8.13
9775  112. http://www.columbia.edu/kermit/ckermit80.html#x8.14
9776  113. http://www.columbia.edu/kermit/ckermit80.html#x9
9777  114. http://www.columbia.edu/kermit/ckermit80.html#x9.1
9778  115. http://www.columbia.edu/kermit/ckermit80.html#x9.2
9779  116. http://www.columbia.edu/kermit/ckermit80.html#x9.3
9780  117. http://www.columbia.edu/kermit/ckermit80.html#x9.4
9781  118. http://www.columbia.edu/kermit/ckermit80.html#x9.5
9782  119. http://www.columbia.edu/kermit/ckermit80.html#x9.6
9783  120. http://www.columbia.edu/kermit/ckermit80.html#x9.7
9784  121. http://www.columbia.edu/kermit/ckermit80.html#x9.8
9785  122. http://www.columbia.edu/kermit/ckermit80.html#x9.9
9786  123. http://www.columbia.edu/kermit/ckermit80.html#x9.10
9787  124. http://www.columbia.edu/kermit/ckermit80.html#x9.11
9788  125. http://www.columbia.edu/kermit/ckermit80.html#x10
9789  126. http://www.columbia.edu/kermit/ckermit80.html#x11
9790  127. http://www.columbia.edu/kermit/ckermit80.html#x12
9791  128. http://www.columbia.edu/kermit/ckermit80.html#x13
9792  129. http://www.columbia.edu/kermit/ckermit80.html#x14
9793  130. http://www.columbia.edu/kermit/ckermit80.html#x15
9794  131. http://www.columbia.edu/kermit/ckermit80.html#x16
9795  132. http://www.columbia.edu/kermit/ckermit80.html#x17
9796  133. http://www.columbia.edu/kermit/ckermit80.html#top
9797  134. http://www.columbia.edu/kermit/ckermit.html
9798  135. http://www.columbia.edu/kermit/index.html
9799  136. http://www.columbia.edu/kermit/ckuins.html#x5
9800  137. http://www.columbia.edu/kermit/ckuins.html
9801  138. http://www.columbia.edu/kermit/ckermit80.html#x5
9802  139. http://www.columbia.edu/kermit/ckermit80.html#x2.2
9803  140. http://www.columbia.edu/kermit/ckermit80.html#contents
9804  141. http://www.columbia.edu/kermit/ckermit80.html#x15
9805  142. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9806  143. http://www.columbia.edu/kermit/ckermit80.html#ftpdates
9807  144. http://www.columbia.edu/kermit/ckermit80.html#ftpcheck
9808  145. http://www.columbia.edu/kermit/ckermit80.html#ftpnamelist
9809  146. http://www.columbia.edu/kermit/ckermit80.html#srvrename
9810  147. http://www.columbia.edu/kermit/ckermit80.html#ftpvdir
9811  148. http://www.columbia.edu/kermit/ckermit80.html#setftptype
9812  149. http://www.columbia.edu/kermit/ckermit80.html#x3.6
9813  150. http://www.columbia.edu/kermit/ckermit80.html#x15
9814  151. http://www.columbia.edu/kermit/ckermit80.html#x8.7
9815  152. http://www.columbia.edu/kermit/ckermit80.html#x2.1
9816  153. http://www.columbia.edu/kermit/ckermit80.html#x2.2
9817  154. http://www.columbia.edu/kermit/ckermit80.html#x8.14
9818  155. http://www.columbia.edu/kermit/ckermit80.html#x8.13
9819  156. http://www.columbia.edu/kermit/ckermit80.html#x8.13
9820  157. http://www.columbia.edu/kermit/ckututor.html
9821  158. http://www.columbia.edu/kermit/ckuins.html
9822  159. http://www.columbia.edu/kermit/skermit.html
9823  160. http://www.columbia.edu/kermit/ckermit80.html#setlocus
9824  161. http://www.columbia.edu/kermit/ckermit80.html#lcommands
9825  162. http://www.columbia.edu/kermit/ckermit80.html#ftpuser
9826  163. http://www.columbia.edu/kermit/ckermit80.html#showvar
9827  164. http://www.columbia.edu/kermit/ckermit80.html#callerid
9828  165. http://www.columbia.edu/kermit/ckermit80.html#x6.6
9829  166. http://www.columbia.edu/kermit/ckermit80.html#x0
9830  167. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9831  168. http://www.columbia.edu/kermit/ckermit80.html#top
9832  169. http://www.columbia.edu/kermit/ckermit80.html#contents
9833  170. http://www.columbia.edu/kermit/ckermit.html
9834  171. http://www.columbia.edu/kermit/index.html
9835  172. http://www.columbia.edu/kermit/ckermit80.html#x0
9836  173. http://www.columbia.edu/kermit/ckermit80.html#top
9837  174. http://www.columbia.edu/kermit/ckermit80.html#contents
9838  175. http://www.columbia.edu/kermit/ckermit.html
9839  176. http://www.columbia.edu/kermit/index.html
9840  177. http://www.columbia.edu/kermit/k95.html
9841  178. http://www.columbia.edu/kermit/sshclient.html
9842  179. http://www.columbia.edu/kermit/skermit.html
9843  180. http://www.columbia.edu/kermit/skermit.html
9844  181. http://www.columbia.edu/kermit/sshclien.htm
9845  182. http://www.columbia.edu/kermit/ckermit80.html#x3
9846  183. ftp://ftp.isi.edu/in-notes/rfc1738.txt
9847  184. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
9848  185. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
9849  186. ftp://ftp.isi.edu/in-notes/rfc2396.txt
9850  187. ftp://ftp.isi.edu/in-notes/rfc2616.txt
9851  188. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
9852  189. ftp://ftp.isi.edu/in-notes/rfc2616.txt
9853  190. http://www.columbia.edu/kermit/ckermit80.html#x8.13.7
9854  191. http://www.columbia.edu/kermit/security.htm#x5.4
9855  192. http://www.columbia.edu/kermit/security.htm#x15
9856  193. http://www.columbia.edu/kermit/security.htm#x6.2
9857  194. http://www.columbia.edu/kermit/security.html
9858  195. http://www.columbia.edu/kermit/ckermit80.html#x16
9859  196. http://www.columbia.edu/kermit/ckermit80.html#top
9860  197. http://www.columbia.edu/kermit/ckermit80.html#contents
9861  198. http://www.columbia.edu/kermit/ckermit.html
9862  199. http://www.columbia.edu/kermit/index.html
9863  200. http://www.columbia.edu/kermit/ckermit80.html#x3.1
9864  201. http://www.columbia.edu/kermit/ckermit80.html#x3.2
9865  202. http://www.columbia.edu/kermit/ckermit80.html#x3.3
9866  203. http://www.columbia.edu/kermit/ckermit80.html#x3.4
9867  204. http://www.columbia.edu/kermit/ckermit80.html#x3.5
9868  205. http://www.columbia.edu/kermit/ckermit80.html#x3.6
9869  206. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9870  207. http://www.columbia.edu/kermit/ckermit80.html#x3.8
9871  208. http://www.columbia.edu/kermit/ckermit80.html#x3.9
9872  209. http://www.columbia.edu/kermit/ckermit80.html#x3.10
9873  210. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9874  211. http://www.columbia.edu/kermit/security.htm
9875  212. http://www.columbia.edu/kermit/security.htm#servers
9876  213. http://www.columbia.edu/kermit/ckcsets.html
9877  214. http://www.columbia.edu/kermit/unicode.html
9878  215. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
9879  216. http://www.columbia.edu/kermit/case10.html
9880  217. http://www.columbia.edu/kermit/ckermit80.html#x4
9881  218. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9882  219. http://www.columbia.edu/kermit/ftpscripts.html
9883  220. http://www.columbia.edu/kermit/ckermit80.html#top
9884  221. http://www.columbia.edu/kermit/ckermit80.html#ftp
9885  222. http://www.columbia.edu/kermit/ftpclient.html
9886  223. http://www.columbia.edu/kermit/ftpscripts.html
9887  224. http://www.columbia.edu/kermit/ckermit.html
9888  225. http://www.columbia.edu/kermit/index.html
9889  226. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
9890  227. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
9891  228. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
9892  229. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
9893  230. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
9894  231. http://www.columbia.edu/kermit/ckermit80.html#x3.2
9895  232. http://www.columbia.edu/kermit/ckermit80.html#x3.5
9896  233. http://www.columbia.edu/kermit/ckermit80.html#x3.6
9897  234. http://www.columbia.edu/kermit/ftpscripts.html
9898  235. http://www.columbia.edu/kermit/ckb2.htm
9899  236. http://www.columbia.edu/kermit/ckermit80.html#ftpautolog
9900  237. http://www.columbia.edu/kermit/ckermit80.html#ftpuser
9901  238. http://www.columbia.edu/kermit/ckermit80.html#x3.8
9902  239. http://www.columbia.edu/kermit/ckermit80.html#x3.8
9903  240. http://www.columbia.edu/kermit/ckermit80.html#top
9904  241. http://www.columbia.edu/kermit/ckermit80.html#ftp
9905  242. http://www.columbia.edu/kermit/ckermit.html
9906  243. http://www.columbia.edu/kermit/index.html
9907  244. http://www.columbia.edu/kermit/ibm_ie.html
9908  245. http://www.columbia.edu/kermit/ckermit80.html#x3.10
9909  246. http://www.columbia.edu/kermit/ckermit80.html#top
9910  247. http://www.columbia.edu/kermit/ckermit80.html#ftp
9911  248. http://www.columbia.edu/kermit/ckermit.html
9912  249. http://www.columbia.edu/kermit/index.html
9913  250. http://www.columbia.edu/kermit/ck60manual.html
9914  251. http://www.columbia.edu/kermit/ckermit70.html#x4.17
9915  252. http://www.columbia.edu/kermit/ckermit70.html
9916  253. http://www.columbia.edu/kermit/ckermit80.html#x3.6
9917  254. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9918  255. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
9919  256. http://www.columbia.edu/kermit/security.html
9920  257. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9921  258. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9922  259. http://www.columbia.edu/kermit/ckermit80.html#x8.13.4
9923  260. http://www.columbia.edu/kermit/ckermit80.html#permswitch
9924  261. http://www.columbia.edu/kermit/ckermit80.html#ftpchmod
9925  262. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
9926  263. http://www.columbia.edu/kermit/ckermit80.html#x4
9927  264. http://www.columbia.edu/kermit/ckermit80.html#top
9928  265. http://www.columbia.edu/kermit/ckermit80.html#ftp
9929  266. http://www.columbia.edu/kermit/ckermit.html
9930  267. http://www.columbia.edu/kermit/index.html
9931  268. http://www.columbia.edu/kermit/ckermit80.html#x7
9932  269. http://www.columbia.edu/kermit/ckermit80.html#x3.8
9933  270. http://www.columbia.edu/kermit/ckermit80.html#x3.8
9934  271. http://www.columbia.edu/kermit/ckb2.htm
9935  272. http://www.columbia.edu/kermit/ckermit80.html#x3.10
9936  273. http://www.columbia.edu/kermit/ckermit80.html#x3.10
9937  274. http://www.columbia.edu/kermit/ckermit80.html#x3.6
9938  275. http://www.columbia.edu/kermit/ckermit80.html#setftptype
9939  276. http://www.columbia.edu/kermit/ckermit80.html#top
9940  277. http://www.columbia.edu/kermit/ckermit80.html#ftp
9941  278. http://www.columbia.edu/kermit/ckermit.html
9942  279. http://www.columbia.edu/kermit/index.html
9943  280. http://www.columbia.edu/kermit/ckermit70.html#x4.9
9944  281. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
9945  282. http://www.columbia.edu/kermit/ckermit80.html#erroraction
9946  283. http://www.columbia.edu/kermit/ckermit70.html#x1.5
9947  284. http://www.columbia.edu/kermit/ckermit70.html#x4.7
9948  285. http://www.columbia.edu/kermit/ckermit70.html#x1.6
9949  286. http://www.columbia.edu/kermit/ckermit80.html#x8.13
9950  287. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
9951  288. http://www.columbia.edu/kermit/ckermi70.htm
9952  289. http://www.columbia.edu/kermit/ckermit80.html#x4
9953  290. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9954  291. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
9955  292. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9956  293. http://www.columbia.edu/kermit/ckermit80.html#erroraction
9957  294. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
9958  295. http://www.columbia.edu/kermit/ckermit80.html#erroraction
9959  296. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
9960  297. http://www.columbia.edu/kermit/ckermit80.html#ftpperms
9961  298. http://www.columbia.edu/kermit/ckermit80.html#ftpunique
9962  299. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
9963  300. http://www.columbia.edu/kermit/ckermit80.html#note_utc
9964  301. http://www.columbia.edu/kermit/ckermit80.html#note_date
9965  302. http://www.columbia.edu/kermit/ckermit80.html#x3.6
9966  303. http://www.boulder.nist.gov/timefreq/faq/faq.htm#10:
9967  304. http://www.columbia.edu/kermit/ckermit80.html#x3.7
9968  305. http://www.columbia.edu/kermit/ckermit80.html#top
9969  306. http://www.columbia.edu/kermit/ckermit80.html#ftp
9970  307. http://www.columbia.edu/kermit/ckermit.html
9971  308. http://www.columbia.edu/kermit/index.html
9972  309. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9973  310. http://www.columbia.edu/kermit/ckermi70.htm#x4.3
9974  311. http://www.columbia.edu/kermit/ckermit70.html
9975  312. http://www.columbia.edu/kermit/ckermit80.html#x5
9976  313. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
9977  314. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
9978  315. http://www.columbia.edu/kermit/ckermi70.htm#x4.1
9979  316. http://www.columbia.edu/kermit/ckermi70.htm#x4.2.2
9980  317. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
9981  318. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
9982  319. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9983  320. http://www.columbia.edu/kermit/ckermit80.html#x3.11
9984  321. http://www.columbia.edu/kermit/ckermit80.html#srvrename
9985  322. http://www.columbia.edu/kermit/ckermi70.htm#x4.1
9986  323. http://www.columbia.edu/kermit/ckermi70.htm
9987  324. http://www.columbia.edu/kermit/ckb2.htm
9988  325. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
9989  326. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
9990  327. http://www.proftpd.net/
9991  328. http://www.columbia.edu/kermit/ckermit80.html#top
9992  329. http://www.columbia.edu/kermit/ckermit80.html#ftp
9993  330. http://www.columbia.edu/kermit/ckermit.html
9994  331. http://www.columbia.edu/kermit/index.html
9995  332. http://www.columbia.edu/kermit/ckb2.htm
9996  333. http://www.columbia.edu/kermit/ckcsets.html
9997  334. http://www.columbia.edu/kermit/unicode.html
9998  335. http://www.columbia.edu/kermit/ckcsets.html
9999  336. http://www.columbia.edu/kermit/ckcsets.html
10000  337. http://www.columbia.edu/kermit/ckermit80.html#x4
10001  338. http://www.columbia.edu/kermit/utf8.html
10002  339. http://www.columbia.edu/kermit/ckcsets.html
10003  340. http://www.columbia.edu/kermit/ckermit80.html#x4
10004  341. ftp://ftp.isi.edu/in-notes/rfc2640.txt
10005  342. http://www.columbia.edu/kermit/ckermit80.html#top
10006  343. http://www.columbia.edu/kermit/ckermit80.html#ftp
10007  344. http://www.columbia.edu/kermit/ckermit.html
10008  345. http://www.columbia.edu/kermit/index.html
10009  346. http://www.columbia.edu/kermit/ckermit80.html#top
10010  347. http://www.columbia.edu/kermit/ckermit80.html#ftp
10011  348. http://www.columbia.edu/kermit/ckermit.html
10012  349. http://www.columbia.edu/kermit/index.html
10013  350. http://www.columbia.edu/kermit/ckermit80.html#top
10014  351. http://www.columbia.edu/kermit/ckermit80.html#ftp
10015  352. http://www.columbia.edu/kermit/ckermit.html
10016  353. http://www.columbia.edu/kermit/index.html
10017  354. http://www.columbia.edu/kermit/ftpscripts.html
10018  355. http://www.columbia.edu/kermit/ckermit80.html#x3.2
10019  356. http://www.columbia.edu/kermit/ckermit80.html#x3.2
10020  357. ftp://ftp.isi.edu/in-notes/rfc959.txt
10021  358. http://www.columbia.edu/kermit/ckscripts.html
10022  359. http://www.columbia.edu/kermit/ckermit80.html#top
10023  360. http://www.columbia.edu/kermit/ckermit80.html#ftp
10024  361. http://www.columbia.edu/kermit/ftpscript.html
10025  362. http://www.columbia.edu/kermit/ckermit.html
10026  363. http://www.columbia.edu/kermit/index.html
10027  364. http://www.columbia.edu/kermit/ckermit80.html#x3.11.1
10028  365. http://www.columbia.edu/kermit/ckermit80.html#x3.11.2
10029  366. http://www.columbia.edu/kermit/ckermit80.html#x3.11.3
10030  367. http://www.columbia.edu/kermit/ckermit80.html#x3.11.4
10031  368. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5
10032  369. http://www.columbia.edu/kermit/ckermit.html
10033  370. http://www.columbia.edu/kermit/k95.html
10034  371. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5
10035  372. ftp://ftp.isi.edu/in-notes/rfc959.txt
10036  373. ftp://ftp.isi.edu/in-notes/rfc2389.txt
10037  374. http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16.txt
10038  375. http://www.columbia.edu/kermit/ftpclient.html
10039  376. http://www.columbia.edu/kermit/ckermit80.html#top
10040  377. http://www.columbia.edu/kermit/ckermit80.html#ftp
10041  378. http://www.columbia.edu/kermit/ckermit.html
10042  379. http://www.columbia.edu/kermit/index.html
10043  380. http://www.columbia.edu/kermit/ckermit80.html#x3
10044  381. http://www.columbia.edu/kermit/ckermit80.html#ucs2
10045  382. http://www.columbia.edu/kermit/ckermit80.html#top
10046  383. http://www.columbia.edu/kermit/ckermit80.html#contents
10047  384. http://www.columbia.edu/kermit/ckermit.html
10048  385. http://www.columbia.edu/kermit/index.html
10049  386. http://www.columbia.edu/kermit/ckermit80.html#top
10050  387. http://www.columbia.edu/kermit/ckermit80.html#contents
10051  388. http://www.columbia.edu/kermit/ckermit.html
10052  389. http://www.columbia.edu/kermit/index.html
10053  390. http://www.columbia.edu/kermit/ckb2.htm
10054  391. http://www.columbia.edu/kermit/ckermit80.html#top
10055  392. http://www.columbia.edu/kermit/ckermit80.html#contents
10056  393. http://www.columbia.edu/kermit/ckermit.html
10057  394. http://www.columbia.edu/kermit/index.html
10058  395. http://www.columbia.edu/kermit/ckermit80.html#x4
10059  396. http://www.columbia.edu/kermit/ckermit80.html#x4
10060  397. http://www.columbia.edu/kermit/ckermit80.html#x8.12
10061  398. http://www.columbia.edu/kermit/ckermit80.html#x8.1
10062  399. http://www.columbia.edu/kermit/ckermit80.html#x12
10063  400. http://www.columbia.edu/kermit/ckermit80.html#x8.12
10064  401. http://www.columbia.edu/kermit/ckermit80.html#top
10065  402. http://www.columbia.edu/kermit/ckermit80.html#contents
10066  403. http://www.columbia.edu/kermit/ckermit.html
10067  404. http://www.columbia.edu/kermit/index.html
10068  405. http://www.columbia.edu/kermit/ckermit80.html#x8.14
10069  406. http://www.columbia.edu/kermit/ckermit80.html#top
10070  407. http://www.columbia.edu/kermit/ckermit80.html#contents
10071  408. http://www.columbia.edu/kermit/ckermit.html
10072  409. http://www.columbia.edu/kermit/index.html
10073  410. http://www.columbia.edu/kermit/ckermit80.html#x9
10074  411. http://www.columbia.edu/kermit/ckermit80.html#top
10075  412. http://www.columbia.edu/kermit/ckermit80.html#contents
10076  413. http://www.columbia.edu/kermit/ckermit.html
10077  414. http://www.columbia.edu/kermit/index.html
10078  415. http://www.columbia.edu/kermit/ckermit80.html#x8.6
10079  416. http://www.columbia.edu/kermit/ckermit80.html#top
10080  417. http://www.columbia.edu/kermit/ckermit80.html#contents
10081  418. http://www.columbia.edu/kermit/ckermit.html
10082  419. http://www.columbia.edu/kermit/index.html
10083  420. http://www.columbia.edu/kermit/ckermit80.html#top
10084  421. http://www.columbia.edu/kermit/ckermit80.html#contents
10085  422. http://www.columbia.edu/kermit/ckermit.html
10086  423. http://www.columbia.edu/kermit/index.html
10087  424. http://www.columbia.edu/kermit/ckermit80.html#top
10088  425. http://www.columbia.edu/kermit/ckermit80.html#contents
10089  426. http://www.columbia.edu/kermit/ckermit.html
10090  427. http://www.columbia.edu/kermit/index.html
10091  428. http://www.columbia.edu/kermit/ckermit80.html#fjoin
10092  429. http://www.columbia.edu/kermit/ckermit80.html#fsplit
10093  430. http://www.columbia.edu/kermit/ckermit80.html#x8.10
10094  431. http://www.columbia.edu/kermit/ckermit80.html#top
10095  432. http://www.columbia.edu/kermit/ckermit80.html#contents
10096  433. http://www.columbia.edu/kermit/ckermit.html
10097  434. http://www.columbia.edu/kermit/index.html
10098  435. http://www.columbia.edu/kermit/ckermit80.html#x9
10099  436. http://www.columbia.edu/kermit/ckermit80.html#x9
10100  437. http://www.columbia.edu/kermit/ckermit80.html#x9
10101  438. http://www.columbia.edu/kermit/ckermit80.html#x3
10102  439. http://www.columbia.edu/kermit/ckermit80.html#x3
10103  440. http://www.columbia.edu/kermit/ckermit80.html#x3.2
10104  441. http://www.columbia.edu/kermit/ckermit80.html#x3.2
10105  442. http://www.columbia.edu/kermit/ckermit80.html#x3.8
10106  443. http://www.columbia.edu/kermit/ckermit80.html#x3
10107  444. http://www.columbia.edu/kermit/ckermit80.html#x3
10108  445. http://www.columbia.edu/kermit/ckermit80.html#x3
10109  446. http://www.columbia.edu/kermit/ckermit80.html#x3.2
10110  447. http://www.columbia.edu/kermit/ckermit80.html#x3
10111  448. http://www.columbia.edu/kermit/ckermit80.html#x8.13
10112  449. http://www.columbia.edu/kermit/ckermit80.html#x8.13
10113  450. http://www.columbia.edu/kermit/ckermit80.html#x9
10114  451. http://www.columbia.edu/kermit/ckermit80.html#x8.10
10115  452. http://www.columbia.edu/kermit/ckermit80.html#x8.7.4
10116  453. http://www.columbia.edu/kermit/ckermit80.html#top
10117  454. http://www.columbia.edu/kermit/ckermit80.html#contents
10118  455. http://www.columbia.edu/kermit/ckermit.html
10119  456. http://www.columbia.edu/kermit/index.html
10120  457. http://www.columbia.edu/kermit/ckermit80.html#top
10121  458. http://www.columbia.edu/kermit/ckermit80.html#contents
10122  459. http://www.columbia.edu/kermit/ckermit.html
10123  460. http://www.columbia.edu/kermit/index.html
10124  461. http://www.columbia.edu/kermit/ckermit80.html#top
10125  462. http://www.columbia.edu/kermit/ckermit80.html#contents
10126  463. http://www.columbia.edu/kermit/ckermit.html
10127  464. http://www.columbia.edu/kermit/index.html
10128  465. http://www.columbia.edu/kermit/ckermit80.html#x8.7
10129  466. http://www.columbia.edu/kermit/ckermit80.html#top
10130  467. http://www.columbia.edu/kermit/ckermit80.html#contents
10131  468. http://www.columbia.edu/kermit/ckermit.html
10132  469. http://www.columbia.edu/kermit/index.html
10133  470. http://www.columbia.edu/kermit/ckermit80.html#scriptedit
10134  471. http://www.columbia.edu/kermit/ckermit80.html#top
10135  472. http://www.columbia.edu/kermit/ckermit80.html#contents
10136  473. http://www.columbia.edu/kermit/ckermit.html
10137  474. http://www.columbia.edu/kermit/index.html
10138  475. http://www.columbia.edu/kermit/ckermit80.html#top
10139  476. http://www.columbia.edu/kermit/ckermit80.html#contents
10140  477. http://www.columbia.edu/kermit/ckermit.html
10141  478. http://www.columbia.edu/kermit/index.html
10142  479. ftp://ftp.isi.edu/in-notes/rfc2822.txt
10143  480. ftp://ftp.isi.edu/in-notes/rfc2822.txt
10144  481. ftp://ftp.isi.edu/in-notes/rfc2822.txt
10145  482. ftp://ftp.isi.edu/in-notes/rfc2822.txt
10146  483. http://www.columbia.edu/kermit/ckermit80.html#top
10147  484. http://www.columbia.edu/kermit/ckermit80.html#contents
10148  485. http://www.columbia.edu/kermit/ckermit.html
10149  486. http://www.columbia.edu/kermit/index.html
10150  487. http://www.columbia.edu/kermit/ckermit80.html#x8.1
10151  488. http://www.columbia.edu/kermit/ckermit80.html#top
10152  489. http://www.columbia.edu/kermit/ckermit80.html#contents
10153  490. http://www.columbia.edu/kermit/ckermit.html
10154  491. http://www.columbia.edu/kermit/index.html
10155  492. http://www.columbia.edu/kermit/ckermit80.html#x8.2
10156  493. http://www.columbia.edu/kermit/ckermit80.html#top
10157  494. http://www.columbia.edu/kermit/ckermit80.html#contents
10158  495. http://www.columbia.edu/kermit/ckermit.html
10159  496. http://www.columbia.edu/kermit/index.html
10160  497. http://www.columbia.edu/kermit/ckermit80.html#x9.8
10161  498. http://www.columbia.edu/kermit/ckermit80.html#x9.8
10162  499. http://www.columbia.edu/kermit/ckermit80.html#x8.2
10163  500. http://www.columbia.edu/kermit/ckermit80.html#top
10164  501. http://www.columbia.edu/kermit/ckermit80.html#contents
10165  502. http://www.columbia.edu/kermit/ckermit.html
10166  503. http://www.columbia.edu/kermit/index.html
10167  504. http://www.columbia.edu/kermit/ckermit80.html#top
10168  505. http://www.columbia.edu/kermit/ckermit80.html#contents
10169  506. http://www.columbia.edu/kermit/ckermit.html
10170  507. http://www.columbia.edu/kermit/index.html
10171  508. http://www.columbia.edu/kermit/ckermit80.html#x9.8
10172  509. http://www.columbia.edu/kermit/ckermit80.html#top
10173  510. http://www.columbia.edu/kermit/ckermit80.html#contents
10174  511. http://www.columbia.edu/kermit/ckermit.html
10175  512. http://www.columbia.edu/kermit/index.html
10176  513. http://www.columbia.edu/kermit/ckermit80.html#x9.8
10177  514. http://www.columbia.edu/kermit/ckermit80.html#x9.8
10178  515. http://www.columbia.edu/kermit/ckermit80.html#x9.6
10179  516. http://www.columbia.edu/kermit/ckermit80.html#top
10180  517. http://www.columbia.edu/kermit/ckermit80.html#contents
10181  518. http://www.columbia.edu/kermit/ckermit.html
10182  519. http://www.columbia.edu/kermit/index.html
10183  520. http://www.columbia.edu/kermit/ckermit80.html#x9.8
10184  521. http://www.columbia.edu/kermit/ckermit80.html#x9.8
10185  522. http://www.columbia.edu/kermit/ckermit80.html#top
10186  523. http://www.columbia.edu/kermit/ckermit80.html#contents
10187  524. http://www.columbia.edu/kermit/ckermit.html
10188  525. http://www.columbia.edu/kermit/index.html
10189  526. http://www.columbia.edu/kermit/ckermit80.html#top
10190  527. http://www.columbia.edu/kermit/ckermit80.html#contents
10191  528. http://www.columbia.edu/kermit/ckermit.html
10192  529. http://www.columbia.edu/kermit/index.html
10193  530. http://www.columbia.edu/kermit/ckermit80.html#top
10194  531. http://www.columbia.edu/kermit/ckermit80.html#contents
10195  532. http://www.columbia.edu/kermit/ckermit.html
10196  533. http://www.columbia.edu/kermit/index.html
10197  534. mailto:thucdat@hotmail.com
10198  535. http://www.columbia.edu/kermit/ckermit80.html#x9.9.2
10199  536. http://www.columbia.edu/kermit/ckermit80.html#top
10200  537. http://www.columbia.edu/kermit/ckermit80.html#contents
10201  538. http://www.columbia.edu/kermit/ckermit.html
10202  539. http://www.columbia.edu/kermit/index.html
10203  540. http://www.columbia.edu/kermit/ckermit80.html#top
10204  541. http://www.columbia.edu/kermit/ckermit80.html#contents
10205  542. http://www.columbia.edu/kermit/ckermit.html
10206  543. http://www.columbia.edu/kermit/index.html
10207  544. http://www.columbia.edu/kermit/ckermit80.html#top
10208  545. http://www.columbia.edu/kermit/ckermit80.html#contents
10209  546. http://www.columbia.edu/kermit/ckermit.html
10210  547. http://www.columbia.edu/kermit/index.html
10211  548. http://www.columbia.edu/kermit/ckermit80.html#x9.2
10212  549. http://www.columbia.edu/kermit/ckermit80.html#top
10213  550. http://www.columbia.edu/kermit/ckermit80.html#contents
10214  551. http://www.columbia.edu/kermit/ckermit.html
10215  552. http://www.columbia.edu/kermit/index.html
10216  553. http://www.columbia.edu/kermit/ckermit80.html#x4
10217  554. http://www.columbia.edu/kermit/ckermit80.html#x4
10218  555. http://www.columbia.edu/kermit/ckermit80.html#top
10219  556. http://www.columbia.edu/kermit/ckermit80.html#contents
10220  557. http://www.columbia.edu/kermit/ckermit.html
10221  558. http://www.columbia.edu/kermit/index.html
10222  559. http://www.columbia.edu/kermit/ckermit80.html#top
10223  560. http://www.columbia.edu/kermit/ckermit80.html#contents
10224  561. http://www.columbia.edu/kermit/ckermit.html
10225  562. http://www.columbia.edu/kermit/index.html
10226  563. http://www.columbia.edu/kermit/ckermit80.html#top
10227  564. http://www.columbia.edu/kermit/ckermit80.html#contents
10228  565. http://www.columbia.edu/kermit/ckermit.html
10229  566. http://www.columbia.edu/kermit/index.html
10230  567. http://www.columbia.edu/kermit/ckermit80.html#x4
10231  568. http://www.columbia.edu/kermit/ckermit80.html#x3.7
10232  569. http://www.columbia.edu/kermit/ckermit80.html#x3.7
10233  570. http://www.columbia.edu/kermit/ckermit80.html#top
10234  571. http://www.columbia.edu/kermit/ckermit80.html#contents
10235  572. http://www.columbia.edu/kermit/ckermit.html
10236  573. http://www.columbia.edu/kermit/index.html
10237  574. ftp://ftp.isi.edu/in-notes/rfc2217.txt
10238  575. http://www.columbia.edu/kermit/ckermit80.html#top
10239  576. http://www.columbia.edu/kermit/ckermit80.html#contents
10240  577. ftp://kermit.columbia.edu/kermit/sredird/
10241  578. http://www.columbia.edu/kermit/ckermit.html
10242  579. http://www.columbia.edu/kermit/index.html
10243  580. http://www.columbia.edu/kermit/ckermi70.htm#x4.22
10244  581. http://www.columbia.edu/kermit/ckermit80.html#top
10245  582. http://www.columbia.edu/kermit/ckermit80.html#contents
10246  583. http://www.columbia.edu/kermit/ckermit.html
10247  584. http://www.columbia.edu/kermit/index.html
10248  585. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
10249  586. http://www.columbia.edu/kermit/cuiksd.html
10250  587. http://www.columbia.edu/kermit/ckermit80.html#top
10251  588. http://www.columbia.edu/kermit/ckermit80.html#contents
10252  589. http://www.columbia.edu/kermit/ckermit.html
10253  590. http://www.columbia.edu/kermit/index.html
10254  591. http://www.columbia.edu/kermit/ckermit80.html#top
10255  592. http://www.columbia.edu/kermit/ckermit80.html#contents
10256  593. http://www.columbia.edu/kermit/ckermit.html
10257  594. http://www.columbia.edu/kermit/index.html
10258  595. http://www.columbia.edu/kermit/index.html