home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / cku211.zi_ / ckermit80.txt < prev    next >
Text File  |  2004-04-11  |  479KB  |  10,350 lines

  1.  
  2.                            C-Kermit 8.0 Update Notes
  3.  
  4.    [ [1]Contents ] [ [2]C-Kermit ] [ [3]Kermit Home ]
  5.  
  6.               Second Supplement to Using C-Kermit, Second Edition
  7.  
  8. For C-Kermit 8.0
  9.  
  10.    As of C-Kermit version: 8.0.211
  11.    Date of C-Kermit release: 10 April 2003
  12.    This file last updated: Sat Apr 10 16:36:11 2004
  13.  
  14.      * IF YOU ARE READING A PLAIN-TEXT version of this document, note
  15.        that it is a plain-text dump of a Web page. You can visit the
  16.        original (and possibly more up-to-date) Web page here:
  17.   [4]http://www.columbia.edu/kermit/ckermit80.html
  18.      * If you are reading the HTML version of this file with a GUI Web
  19.        browser, the features added since C-Kermit 8.0.201 are shown in
  20.        red if your browser and monitor permit. Features that were new to
  21.        versions 8.0.200 and 201 are in black.
  22.  
  23. Authors: Frank da Cruz and Christine M. Gianone
  24. Address: The Kermit Project
  25.          Columbia University
  26.          612 West 115th Street
  27.          New York NY 10025-7799
  28.          USA
  29. Fax:     +1 (212) 662-6442
  30. E-Mail:  [5]kermit-support@columbia.edu
  31. Web:     [6]http://www.columbia.edu/kermit/
  32. Or:      [7]http://www.kermit-project.org/
  33. Or:      [8]http://www.columbia.nyc.ny.us/kermit/
  34.      _________________________________________________________________
  35.  
  36.   NOTICES
  37.  
  38.    This document:
  39.           Copyright ⌐ 1997, 2002, Frank da Cruz and Christine M. Gianone.
  40.           All rights reserved.
  41.  
  42.    Kermit 95:
  43.           Copyright ⌐ 1995, 2002, Trustees of Columbia University in the
  44.           City of New York. All rights reserved.
  45.  
  46.    C-Kermit:
  47.           Copyright ⌐ 1985, 2002,
  48.           Trustees of Columbia University in the City of New York. All
  49.           rights reserved. See the C-Kermit [9]COPYING.TXT file or the
  50.           copyright text in the [10]ckcmai.c module for disclaimer and
  51.           permissions.
  52.  
  53.    When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or
  54.           SSL/TLS protocol are included:
  55.           Portions Copyright ⌐ 1990, Massachusetts Institute of
  56.           Technology.
  57.           Portions Copyright ⌐ 1991, 1993 Regents of the University of
  58.           California.
  59.           Portions Copyright ⌐ 1991, 1992, 1993, 1994, 1995 by AT&T.
  60.           Portions Copyright ⌐ 1997, Stanford University.
  61.           Portions Copyright ⌐ 1995-1997, Eric Young
  62.           <eay@cryptosoft.com>.
  63.  
  64.    For the full text of the third-party copyright notices, see
  65.    [11]Appendix V.
  66.      _________________________________________________________________
  67.  
  68.   WHAT IS IN THIS FILE
  69.  
  70.    This file lists changes made to C-Kermit since version 7.0 was
  71.    released in January 2000. Use this file as a supplement to:
  72.  
  73.      * The second edition of [12]Using C-Kermit; and:
  74.      * The [13]C-Kermit 7.0 Update Notes. Also available in plain-text
  75.        form as [14]ckermit70.txt.
  76.  
  77.    until the third edition of Using C-Kermit is published. We apologize
  78.    for the scattered documentation and will consolidate it when we are
  79.    able.
  80.      _________________________________________________________________
  81.  
  82.    ADDITIONAL FILES Several other files accompany this new Kermit
  83.    release:
  84.  
  85.    [15]ckututor.html
  86.           C-Kermit Tutorial (for Unix). Also distributed in Nroff form as
  87.           [16]ckuker.nr, the Unix C-Kermit manual page.
  88.  
  89.    [17]security.htm
  90.           Discussion of Kermit's new authentication and encryption
  91.           features, updated for C-Kermit 8.0.
  92.  
  93.    [18]telnet.htm
  94.           Detailed documentation of Kermit's Telnet client, updated for
  95.           C-Kermit 8.0.
  96.  
  97.    [19]ftpscripts.html
  98.           Tutorial: Writing FTP automation scripts
  99.  
  100.    [20]ckcbwr.html
  101.           Platform-independent C-Kermit hints and tips. Also distributed
  102.           in plain text form as [21]ckcbwr.txt
  103.  
  104.    [22]ckubwr.html
  105.           Unix-specific C-Kermit hints and tips. Also distributed in
  106.           plain text form as [23]ckubwr.txt.
  107.  
  108.    [24]ckvbwr.html
  109.           VMS-specific C-Kermit hints and tips. Also distributed in plain
  110.           text form as [25]ckvbwr.txt.
  111.  
  112.    [26]ckuins.html
  113.           Unix C-Kermit installation instructions. Also distributed in
  114.           plain text form as [27]ckuins.txt.
  115.  
  116.    [28]ckvins.html
  117.           VMS C-Kermit installation instructions. Also distributed in
  118.           plain text form as [29]ckvins.txt.
  119.  
  120.    [30]ckccfg.html
  121.           Compile-time configuration options. Also distributed in plain
  122.           text form as [31]ckccfg.txt.
  123.  
  124.    [32]ckcplm.html
  125.           C-Kermit Program Logic Manual. Also distributed in plain text
  126.           form as [33]ckcplm.txt.
  127.  
  128.    [34]iksd.html
  129.           Internet Kermit Service Aministrators Guide for Unix.
  130.  
  131.    [35]skermit.html
  132.           C-Kermit as an SSH Subsystem (SFTP server replacement).
  133.  
  134.    [ [36]Top ] [ [37]C-Kermit ] [ [38]Kermit Home ]
  135.   __________________________________________________________________________
  136.  
  137. CONTENTS
  138.  
  139.      [39]0. WHAT'S NEW
  140.      [40]1. FIXES SINCE VERSION 7.0.196
  141.      [41]2. SSH AND HTTP 
  142.          [42]2.1. SSH Connections
  143.          [43]2.2. HTTP Connections
  144.             [44]2.2.1. HTTP Command Switches
  145.             [45]2.2.2. HTTP Action Commands
  146.             [46]2.2.3. HTTP Headers
  147.             [47]2.2.4. Secure HTTP Connections
  148.             [48]2.2.5. HTTP Variables
  149.             [49]2.2.6. The HTTP Command-Line Personality
  150.      [50]3. THE BUILT-IN FTP CLIENT
  151.          [51]3.1. Making and Managing FTP Connections
  152.             [52]3.1.1. Kermit Command-Line Options for FTP
  153.             [53]3.1.2. The FTP Command-Line Personality
  154.             [54]3.1.3. The FTP URL Interpreter
  155.             [55]3.1.4. Interactive FTP Session Establishment
  156.          [56]3.2. Making Secure FTP Connections
  157.          [57]3.3. Setting FTP Preferences
  158.          [58]3.4. Managing Directories and Files
  159.          [59]3.5. Uploading Files With FTP
  160.             [60]3.5.1. FTP PUT Switches
  161.             [61]3.5.2. Update Mode
  162.             [62]3.5.3. Recovery
  163.          [63]3.6. Downloading Files With FTP
  164.             [64]3.6.1. FTP GET Switches
  165.             [65]3.6.2. Filename Collisions
  166.             [66]3.6.3. Recovery
  167.          [67]3.7. Translating Character Sets
  168.             [68]3.7.1. Character Sets and Uploading
  169.             [69]3.7.2. Character Sets and Downloading
  170.          [70]3.8. FTP Command Shortcuts
  171.          [71]3.9. Dual Sessions
  172.          [72]3.10. Automating FTP Sessions
  173.             [73]3.10.1. FTP-Specific Variables and Functions
  174.             [74]3.10.2. Examples
  175.             [75]3.10.3. Automating Secure FTP Connections
  176.          [76]3.11. Advanced FTP Protocol Features  [77]4. FILE SCANNING
  177.     [78]5. FILE AND DIRECTORY NAMES CONTAINING SPACES
  178.     [79]6. OTHER COMMAND PARSING IMPROVEMENTS
  179.          [80]6.1. Grouping Macro Arguments
  180.          [81]6.2. Directory and File Name Completion
  181.          [82]6.3. Passing Arguments to Command Files
  182.          [83]6.4. More-Prompting
  183.          [84]6.5. Commas in Macro Definitions
  184.          [85]6.6. Arrow Keys
  185.     [86]7. NEW COMMANDS AND SWITCHES
  186.     [87]8. SCRIPTING IMPROVEMENTS
  187.          [88]8.1. Performance and Debugging
  188.          [89]8.2. Using Macros as Numeric Variables
  189.          [90]8.3. New IF Conditions
  190.          [91]8.4. The ON_UNKNOWN_COMMAND and ON_CD Macros
  191.          [92]8.5. The SHOW MACRO Command
  192.          [93]8.6. Arrays
  193.          [94]8.7. New or Improved Built-in Variables and Functions
  194.          [95]8.8. The RETURN and END Commands
  195.          [96]8.9. UNDEFINing Groups of Variables
  196.          [97]8.10. The INPUT and MINPUT Commands
  197.          [98]8.11. Learned Scripts
  198.          [99]8.12. Pattern Matching
  199.          [100]8.13. Dates and Times
  200.          [101]8.14. Trapping Keyboard Interruption
  201.     [102]9. S-EXPRESSIONS
  202.          [103]9.1. What is an S-Expression?
  203.          [104]9.2. Integer and Floating-Point-Arithmetic
  204.          [105]9.3. How to Use S-Expressions
  205.          [106]9.4. Summary of Built-in Constants and Operators
  206.          [107]9.5. Variables
  207.          [108]9.6. Assignments and Scope
  208.          [109]9.7. Conditional Expressions
  209.          [110]9.8. Extensibility
  210.          [111]9.9. Examples
  211.          [112]9.10. Differences from Algebraic Notation
  212.          [113]9.11.Differences from Lisp
  213.     [114]10. FILE TRANSFER
  214.     [115]11. MODEMS AND DIALING
  215.     [116]12. TERMINAL CONNECTION
  216.     [117]13. CHARACTER SETS
  217.     [118]14. DIALOUT FROM TELNET TERMINAL SERVERS
  218.     [119]15. COPING WITH BROKEN KERMIT PARTNERS
  219.     [120]16. NEW COMMAND-LINE OPTIONS
  220.     [121]17. LOGS
  221.  
  222.    [ [122]Top ] [ [123]C-Kermit ] [ [124]Kermit Home ]
  223.   __________________________________________________________________________
  224.  
  225. 0. WHAT'S NEW
  226.  
  227.    The Initialization and Customization Files
  228.           C-Kermit 8.0 now supports specification of the initialization
  229.           file name (path) in an environment variable, CKERMIT_INI. It
  230.           also relies far less than before on the initialization for
  231.           functioning. See [125]Section 5 of the Unix C-Kermit
  232.           [126]installation instructions for details. As of version
  233.           8.0.201, C-Kermit also executes your customization file (if you
  234.           have one) even if the initialization file was not found.
  235.           Previously, the customization file was executed by a TAKE
  236.           command in the initialization file (and it still is, if an
  237.           initialization is found).
  238.  
  239.    Incompatible Changes
  240.           As always, we do our best to avoid changes that break existing
  241.           scripts. However, C-Kermit 8.0 does include a rather pervasive
  242.           syntax change that might alter the behavior of scripts that
  243.           depend on the previous behavior. As described in [127]Section
  244.           5, C-Kermit now accepts doublequotes in most contexts where you
  245.           previously had to use braces to group multiple words into a
  246.           single field, or to force inclusion of leading or trailing
  247.           blanks. Most noticeably, in C-Kermit 7.0 and earlier:
  248.  
  249.   echo {this is a string}
  250.  
  251.           would print:
  252.  
  253.   this is a string
  254.  
  255.           whereas:
  256.  
  257.   echo "this is a string"
  258.  
  259.           printed:
  260.  
  261.   "this is a string"
  262.  
  263.           In C-Kermit 8.0, both print:
  264.  
  265.   this is a string
  266.  
  267.           To force the doublequotes to be treated as part of the string,
  268.           use either of the following forms:
  269.  
  270.   echo {"this is a string"}
  271.   echo ""this is a string""
  272.  
  273.           Similarly, to force braces to be treated as part of the string:
  274.  
  275.   echo "{this is a string}"
  276.   echo {{this is a string}}
  277.  
  278.           Other incompatibilities:
  279.  
  280.          1. Using the SET HOST command to make HTTP connections is no
  281.             longer supported. Instead, use the new HTTP OPEN command,
  282.             described in [128]Section 2.2.
  283.  
  284.    C-Kermit 7.1 Alpha.01 (8 December 2000)
  285.  
  286.      Its major new features are those listed in the [129]Table of
  287.           Contents: the FTP client, file scanning, command parsing and
  288.           scripting improvements, S-Expressions, and support for the
  289.           Telnet Com Port Option, plus wider availability of the
  290.           Kerberos, SSL/TLS, and SRP security options for secure Internet
  291.           connections.
  292.  
  293.    C-Kermit 7.1.199 Alpha.02 (4 January 2001)
  294.  
  295.           + C-Kermit now accepts [130]FTP, TELNET, and IKSD URLs as its
  296.             first command-line argument.
  297.           + Character-set translation added to the FTP client for
  298.             [131]filenames. 
  299.           + Optional [132]setting of date of incoming files by FTP [M]GET
  300.             from the server date.
  301.           + [133]FTP CHECK filename added to let FTP client check the
  302.             existence of a file on the server.
  303.           + [134]FTP GET /NAMELIST:filename added to get list of server
  304.             filenames into a local file.
  305.           + [135]FTP [M]PUT /SERVER-RENAME:template added to make server
  306.             rename a file as indicated by the template after it has
  307.             arrived completely.
  308.           + FTP [M]GET /SERVER-RENAME:template added to make server
  309.             rename a file as indicated by the template after it has been
  310.             sent completely.
  311.           + FTP [136]VDIRECTORY added for getting verbose directory
  312.             listings from TOPS-20.
  313.           + [137]FTP TYPE TENEX added for transferring 8-bit binary files
  314.             with PDP-10s.
  315.           + Added [138]automatic text/binary mode switching for FTP
  316.             [M]GET, based on filename patterns (e.g. *.zip, *.gz, *.exe
  317.             are binary; *.txt, *.c are text).
  318.           + [139]SET SEND I-PACKETS OFF added for coping with Kermit
  319.             servers that do not support I packets.
  320.           + A new option was added to [140]\fword() and \fsplit() for
  321.             parsing comma-separated lists that might contain empty
  322.             elements.
  323.           + Bug fixes including:
  324.                o {} or "" could not be used as expected to represent the
  325.                  empty string.
  326.                o ,- on a line by itself in a macro definition caused
  327.                  subsequent statements to be skipped.
  328.                o FTP [M]GET didn't work right if path segments were
  329.                  included in the filespec.
  330.                o FTP MGET, if interrupted, did not clear its file list.
  331.                o Various problems with FTP PUT /AS-NAME that nobody
  332.                  noticed.
  333.                o Some FTP messages and displays interfered with each
  334.                  other.
  335.                o Parsing of YESTERDAY, TODAY, and TOMORROW in date-time
  336.                  fields was broken.
  337.                o Automatic old-to-new dialing directory format conversion
  338.                  was broken on VMS.
  339.                o Various source-code portability problems fixed.
  340.           + Improvement of various HELP and SHOW messages.
  341.  
  342.    C-Kermit 7.1.199 Alpha.04 (1 April 2001)
  343.  
  344.           + Big changes:
  345.                o Changed default modem type from NONE to GENERIC.
  346.                o Generic dialing now sends no init string at all.
  347.                o Changed default terminal bytesize from 7 to 8.
  348.           + New features:
  349.                o SET SESSION-LOG TIMESTAMPED-TEXT for timestamped session
  350.                  log.
  351.           + New modem types:
  352.                o Conexant modem family
  353.                o Lucent VENUS chipset
  354.                o PCTel V.90 chipset
  355.                o Zoom V.90
  356.                o Zoom V.92
  357.           + FTP client:
  358.                o FTP OPEN /PASSIVE and /ACTIVE switches added.
  359.                o Now works with servers that that don't include path in
  360.                  NLST response.
  361.                o Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
  362.                o SET FTP VERBOSE-MODE default is now OFF instead of ON.
  363.           + Kermit protocol:
  364.                o Fixed what I hope is the last "Receive window full"
  365.                  error.
  366.                o SET PREFIXING or SET CONTROL PREFIX now automatically
  367.                  sets CLEARCHANNEL OFF.
  368.                o Fixed incorrect report of number of files transferred at
  369.                  end of transfer.
  370.                o Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
  371.           + UNIX:
  372.                o HTTP and shadow passwords enabled for SCO 5.0.6.
  373.                o Even with SET FILENAMES CONVERTED, spaces were still
  374.                  accepted in incoming filenames; now they are converted
  375.                  to underscores.
  376.                o Added support for compile-time mktemp()/mkstemp()
  377.                  selection.
  378.           + VMS:
  379.                o Session-log format for scripted sessions fixed.
  380.           + Scripting:
  381.                o Fixed \frdir() not to follow symlinks (UNIX).
  382.                o Fixed \fday() not to dump core for dates prior to 17 Mar
  383.                  1858.
  384.           + General:
  385.                o "Closing blah..." message upon exit could not be
  386.                  surpressed.
  387.                o Added /PAGE and /NOPAGE to DELETE switches.
  388.                o Added GO response for DELETE /ASK (delete all the rest
  389.                  without asking).
  390.                o Added GO response to "more?" prompt (for multi-page
  391.                  screen output).
  392.                o Updated HELP texts.
  393.  
  394.    C-Kermit 7.1.199 Beta.01 (10 May 2001)
  395.  
  396.           + FTP client verbosity adjustments.
  397.           + Bug with generic modem dialing pausing several secs fixed.
  398.           + SET HOST /USER:, SET LOGIN USERID, etc, fixed when given no
  399.             user ID.
  400.           + A couple \v(dm_blah) dial modifier variables added.
  401.           + "--version" command-line switch added.
  402.           + Fixed NetBSD serial-port DTR handling.
  403.           + Lots of syntax cleanups for Flexelint and gcc -Wall.
  404.           + Fixed modem-type aliases to not take precedence over real
  405.             names.
  406.           + Fixed funny treatment of doublequotes by ECHO command.
  407.           + Enabled SET SESSION-LOG for VMS and other non-UNIX platorms.
  408.           + Fixed changing direction in command history buffer.
  409.           + Fixed handling of IKSD URLs.
  410.           + Made sure DELETE prints a message if it got any errors.
  411.  
  412.    C-Kermit 8.0.200 Beta.02 (28 June 2001)
  413.  
  414.           + Major version number increased from 7 to 8.
  415.           + [141]SSH command.
  416.           + More-consistent Kermit protocol defaults.
  417.           + CONNECT idle timeout and action selection.
  418.           + CONNECT status variable.
  419.           + A way to allocate more space for filename lists.
  420.           + Pseudoterminal handler fixed for late-model Linuxes.
  421.           + Command-line option -dd for timestamped debug log.
  422.           + Download directory now works for external protocols too.
  423.           + GREP /COUNT:variable.
  424.           + SET ATTRIBUTE RECORD-FORMAT { OFF, ON }.
  425.           + Bug fixes.
  426.  
  427.    C-Kermit 8.0.200 Beta.03 (9 Sep 2001)
  428.  
  429.           + [142]HTTP 1.1 connections and scripting
  430.           + [143]ON_CTRLC macro for trapping Ctrl-C in scripts
  431.           + [144]Date-time parsing improvements, timezones, comparison,
  432.             arithmetic
  433.           + [145]Pattern-matching improvements
  434.           + FTP improvements
  435.           + SET EXIT HANGUP { ON, OFF }
  436.           + SET FILE EOF { CTRL-Z, LENGTH }
  437.           + ASK[Q] /TIMEOUT
  438.           + Bug fixes
  439.           + New platforms
  440.  
  441.    C-Kermit 8.0.200 Beta.04 (16 Nov 2001)
  442.  
  443.           + [146]New Unix man page
  444.           + [147]New Unix installation instructions
  445.           + SET TELOPT policies are now enforced on non-Telnet ports if
  446.             the server begins Telnet negotiations.
  447.           + SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }.
  448.           + UUCP lockfile creation race condition fixed.
  449.           + Dialout, modem signals, hangup, hardware flow control, etc,
  450.             tested extensively on many platforms, numerous problems
  451.             fixed.
  452.           + Improved hints when dialing fails.
  453.           + SET STOP-BITS 2 can now be given without SET FLOW HARDWARE.
  454.           + Major improvements in RFC 2217 Telnet Com-Port Control.
  455.           + Improved ability to REDIAL a modem server port.
  456.           + kermit -h now shows the command name in the usage usage
  457.             string.
  458.           + kermit -h now shows ALL command-line options.
  459.           + kermit -s blah, where blah is a symlink, now works.
  460.           + --noperms command-line option = SET ATTRIBUTE PERMISSIONS
  461.             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
  469.             to 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
  495.             UNIX 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 Certficate Authority certificates file, includes the
  501.             Kermit Project at Columbia University so you can access 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
  521.             added.
  522.           + Fixed PBX dialing in unmarked-area-code case.
  523.           + Improved SHOW COMMUNICATIONS tells lockfile directory,
  524.             typical dialout device name.
  525.           + Some FTP OPEN command parsing problems fixed.
  526.           + Some errors in date arithmetic fixed.
  527.           + New command: SET TERMINAL AUTODOWNLOAD { ..., ERROR { STOP,
  528.             CONTINUE } }
  529.           + New command: HELP FIREWALL.
  530.           + SET MODEM HANGUP-METHOD DTR added as synomym for RS232-SIGNAL
  531.           + Support for secure URL protocols added: telnets:, ftps:,
  532.             https:.
  533.  
  534.    C-Kermit 8.0.201 (8 Feb 2002)
  535.  
  536.           + Installability as an [148]SSH v2 Subsystem.
  537.           + [149]SET LOCUS command.
  538.           + [150]L-versions of CD, DIR, DELETE, MKDIR, etc, to force
  539.             local execution.
  540.           + [151]USER and ACCOUNT added as synonyms for FTP USER and FTP
  541.             ACCOUNT.
  542.           + [152]SHOW VARIABLES now accepts a list of variables.
  543.           + Rudimentary support for [153]Caller ID when receiving phone
  544.             calls.
  545.           + Up/Down [154]Arrow-key navigation of command history buffer.
  546.           + [155]Automatic execution of customization file if init file
  547.             is missing.
  548.  
  549.    C-Kermit 8.0.206 Beta.01 (11 Oct 2002)
  550.  
  551.         New commands:
  552.  
  553.                o ORIENTATION lists location-related variables and their
  554.                  values.
  555.                o KCD changes to special directories by their symbolic
  556.                  names ("kcd ?" for a list).
  557.                o SET CD HOME path to specify home directory for CD and
  558.                  KCD commands.
  559.                o CONTINUE given at top level is equivalent to END --
  560.                  handy when PROMPT'ed out of a script, to continue the
  561.                  script.
  562.  
  563.         New switches or operands for existing commands:
  564.  
  565.                o GETOK /TIMEOUT
  566.                o ASK, ASKQ, GETOK /QUIET (suppresses error message on
  567.                  timeout)
  568.                o COPY /APPEND now allows concatenating multiple source
  569.                  files into one dest file.
  570.                o SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER, /PASSWORD.
  571.                o DIRECTORY command now accepts multiple filespecs, e.g.
  572.                  "dir a b c".
  573.  
  574.         SET QUIET ON now also applies to:
  575.  
  576.                o SET HOST connection progress messages.
  577.                o "Press the X or E key to cancel" file-transfer message.
  578.                o REMOTE CD response.
  579.                o REMOTE LOGIN response.
  580.  
  581.         Improvements and new features:
  582.  
  583.                o Numerous FTP client fixes and new features, listed
  584.                  below.
  585.                o C-Kermit, when in remote mode at the end of a file
  586.                  transfer, now prints a one-line "where" message. Control
  587.                  with SET TRANSFER REPORT.
  588.                o Unix makefile "install" target now creates an UNINSTALL
  589.                  script.
  590.                o Improved operation and performance on RFC 2217 Telnet
  591.                  connections.
  592.                o Improved CONNECT (interactive terminal connection)
  593.                  performance.
  594.                o HELP text updated for many commands.
  595.  
  596.         New or fixed makefile targets:
  597.  
  598.                o Solaris 9 (several variations)
  599.                o Concurrent PowerMAX
  600.                o Mac OS X 10.2
  601.                o FreeBSD 1.0
  602.                o FreeBSD 4.6, 5.0
  603.                o AIX 5.2, 5.3
  604.  
  605.         Bugs fixed (general):
  606.  
  607.                o Failure to run in VMS Batch fixed.
  608.                o LDIRECTORY fixed to run Kermit's built-in DIRECTORY
  609.                  command rather than an external one.
  610.                o Fixed Solaris and other SVORPOSIX builds to find out
  611.                  their full hostnames rather than just the "uname -n"
  612.                  name.
  613.                o Fixed some problems matching strings that start with
  614.                  ".".
  615.                o Fixed some problems matching pattern that contain
  616.                  {a,b,c} lists.
  617.                o Fixed erroneous reporting of text-mode reception as
  618.                  binary when sender did not report the file size
  619.                  (cosmetic only).
  620.                o Many problems with SWITCH statements fixed.
  621.                o Fixed SET OPTIONS DIRECTORY /DOTFILES to work for server
  622.                  too.
  623.                o Fixed DELETE to print an error message if the file was
  624.                  not found.
  625.                o Fixed SET CONTROL UNPREFIX ALL and SET PREFIXING NONE to
  626.                  do the same thing.
  627.                o Fixed bugs executing macros from within the ON_EXIT
  628.                  macro.
  629.                o \fday() and \fnday() fixed for dates prior to 17 Nov
  630.                  1858.
  631.                o Serial speed-changing bug in Linux fixed.
  632.                o "Unbalanced braces" script parsing errors when using
  633.                  \{number} fixed.
  634.                o "if defined \v(name)" fixed to behave as described in
  635.                  the book.
  636.                o Fixed Problems caused by LOCAL variables whose names are
  637.                  left substrings of macro names.
  638.                o The INPUT command was fixed to honor the PARITY setting.
  639.                o Fixed bug with COPY to existing file that is longer than
  640.                  source file.
  641.                o REINPUT command failed to strip braces/quotes around its
  642.                  target string.
  643.                o Network directory lookups didn't work for SSH
  644.                  connections.
  645.                o REMOTE SET { FILE, TRANSFER } CHARACTER-SET fixed.
  646.                o Closed some holes whereby an incompletely received file
  647.                  was not deleted when SET FILE INCOMPLETE is DISCARD,
  648.                  e.g. when the Kermit is hung up upon.
  649.                o SET XFER CHARACTER-SET TRANSPARENT fixed to do the same
  650.                  as SET XFER TRANSLATION OFF.
  651.                o SET HOST PTY (e.g. SSH) connection fixed to pass along
  652.                  window-size changes.
  653.                o C-Kermit search path for TAKE files was accidentally
  654.                  disabled.
  655.  
  656.         FTP client bugs fixed:
  657.  
  658.                o Character set translation was broken on little-endian
  659.                  (e.g. PC) architectures.
  660.                o FTP PUT /SERVER-RENAME:, /RENAME-TO:, /MOVE-TO: switches
  661.                  were sticky.
  662.                o Make SET TRANSFER MODE MANUAL apply to FTP.
  663.                o Make SET FILE INCOMPLETE { KEEP, DISCARD } apply to FTP.
  664.                o FTP MGET /UPDATE handled equal times incorrectly.
  665.                o FTP MGET /RECOVER fixed to ignore file dates, use only
  666.                  size.
  667.                o FTP MGET /RECOVER sometimes downloaded files it didn't
  668.                  need to.
  669.                o FTP downloads with TRANSFER DISPLAY BRIEF could give
  670.                  misleading error messages.
  671.                o FTP MGET temp file not deleted if FTP DEBUG set to OFF
  672.                  after it was ON.
  673.                o LOCUS not switched back when FTP connection is lost.
  674.                o Set incoming file date even if it was not completely
  675.                  received.
  676.                o FTP MGET sent SIZE and MDTM commands even when it didn't
  677.                  have to.
  678.                o FTP MGET sent SIZE and MDTM commands even when it knew
  679.                  they wouldn't work.
  680.                o FTP MGET failed if no files were selected for download.
  681.                o FTP MGET a* b* c* would fail to get any c*'s if no b*'s
  682.                  existed.
  683.                o Big problems canceling MGET with Ctrl-C.
  684.                o Some extraneous LOCUS dialogs squelched.
  685.                o Some inconsistencies in SET FTP FILENAMES AUTO fixed.
  686.                o Fixed file-descriptor pileup after multiple MGETs when
  687.                  using mkstemp().
  688.                o Fixed "mget foo", where foo is a directory name.
  689.  
  690.         FTP improvements:
  691.  
  692.                o New [156]FTP protocol features added (FEAT, MLSD).
  693.                o FTP MGET /RECURSIVE now works as expected if server
  694.                  supports MLSD.
  695.                o FTP MGET /DATES-DIFFER to download if local and remote
  696.                  file dates differ.
  697.                o FTP DATES default changed to ON.
  698.                o FTP MPUT, MGET /EXCEPT now allows up to 64 patterns (up
  699.                  from 8).
  700.                o Top-level SITE and PASSIVE commands added for
  701.                  convenience.
  702.                o MGET /COLLISION:APPEND /AS-NAME:newfile *.* puts all
  703.                  remote files into one local file.
  704.                o SET FTP SERVER-TIME-OFFSET for when server has wrong
  705.                  timezone set.
  706.                o Allow for alternative server interpretations of [M]MPUT
  707.                  /UNIQUE.
  708.                o SET FTP ANONOMOUS-PASSWORD lets you specify the default
  709.                  anonymous password.
  710.                o Allow "GET /RECURSIVE path/file" to force local
  711.                  subdirectory creation.
  712.                o SET FTP DISPLAY is like SET TRANSFER DISPLAY but applies
  713.                  only to FTP.
  714.                o FTP { ENABLE, DISABLE } new-protocol-feature-name.
  715.                o FTP MGET /NODOTFILES.
  716.                o Debug log now records FTP commands and responses in
  717.                  grep-able format.
  718.  
  719.    [ [157]Top ] [ [158]Contents ] [ [159]C-Kermit ] [ [160]Kermit Home ]
  720.   __________________________________________________________________________
  721.  
  722. 1. FIXES SINCE VERSION 7.0.196 First, the changes from 7.0.196 to 7.0.197...
  723. Source and makefile tweaks to get successful builds on platforms that were not
  724. available in time for the 7.0 release:
  725.  
  726.      * 4.2BSD
  727.      * 4.3BSD
  728.      * AIX 4.3
  729.      * AT&T 3B2 and 3B20
  730.      * BeOS 4.5
  731.      * CLIX
  732.      * Interactive UNIX System V/386 R3.2 V4.1.1
  733.      * OS-9/68000
  734.      * OSF/1 1.3.
  735.      * PS/2 AIX 1.2.1
  736.      * SCO OSR5.0.x
  737.      * SCO Xenix 2.3.4
  738.      * SINIX 5.41/Intel
  739.      * Stratus FTX
  740.      * Stratus VOS
  741.      * SunOS 4.1 with X.25
  742.      * Ultrix 4.2
  743.      * Unixware 2.0
  744.  
  745.    There were no functional changes from 196 to 197.
  746.  
  747.    Fixes applied after C-Kermit 7.0.197 was released:
  748.  
  749.    Source code: Big flexelint and "gcc -Wall" audit and cleanup.
  750.  
  751.    Configuration:
  752.      * Solaris RTS/CTS (hardware flow control) didn't work.
  753.      * BSDI RTS/CTS worked only in one direction.
  754.      * FreeBSD 4.0 with ncurses 5.0 broke interactive command parsing.
  755.      * QNX-32 build lacked -DBIGBUFOK so couldn't execute big macros.
  756.  
  757.    Connections:
  758.      * SET HOST /PTY didn't work on some platforms.
  759.      * Broken SET HOST /USER:xxx /PASSWORD:yyy /ACCOUNT:zzz switches
  760.        fixed.
  761.      * Transparent printing was broken in Unix.
  762.      * ANSWER 0 (wait forever) didn't work.
  763.      * Some problems in Multitech modem command strings.
  764.      * Spurious "?Sorry, can't condition console terminal" errors.
  765.      * Disabling modem command strings by setting them to nothing broke
  766.        dialing.
  767.      * SET DIAL TIMEOUT value was usually ignored.
  768.      * SET DIAL METHOD PULSE didn't work.
  769.      * Certain modem commands, if changed, not refreshed if modem type
  770.        changed.
  771.      * SET SESSION-LOG command was missing from VMS.
  772.      * VMS session log format fixed for scripts.
  773.      * HANGUP by dropping DTR didn't work in NetBSD.
  774.      * SET FLOW /AUTO versus SET FLOW confusion fixed.
  775.      * Spurious secondary Solaris lockfile removed.
  776.      * SCO OSR5 DTR On/Off hangup.
  777.      * UUCP lockfile race condition.
  778.  
  779.    Commands and scripts:
  780.      * Missing CAUTIOUS and FAST commands restored.
  781.      * Broken PTY command in late-model Linuxes fixed (API changed).
  782.      * Fixed off-by-one error in command recall when switching direction.
  783.      * Fixed recall of commands that contain '?'.
  784.      * COPY /SWAP-BYTES didn't work on some architectures.
  785.      * Various combinations of COPY switches didn't work.
  786.      * Various problems with COPY or RENAME with a directory name as
  787.        target.
  788.      * SHIFT didn't decrement \v(argc) if used within IF, ELSE, or SWITCH
  789.        block.
  790.      * SHIFT didn't affect the \%* variable.
  791.      * Divide by zero improperly handled in some \function()s.
  792.      * Problems with RETURN from right-recursive functions.
  793.      * FSEEK /LINE \%c LAST didn't work if already at end.
  794.      * Some buffer vulnerabilities and potential memory leaks were
  795.        discovered and fixed.
  796.      * \frdirectory() fixed not to follow symbolic links.
  797.      * SET EXIT WARNING OFF fixed to work when EXIT given in a script.
  798.      * Missing DELETE and MKDIR error message fixed.
  799.      * \fday() core dump for ancient dates fixed.
  800.  
  801.    File transfer:
  802.      * SEND /COMMAND was broken.
  803.      * CRECEIVE was broken (but RECEIVE /COMMAND was OK).
  804.      * Quoting wildcard chars in filenames didn't work.
  805.      * Problems canceling streaming file transfers with X or Z.
  806.      * Problems shifting between streaming and windowing file transfer.
  807.      * Non-FULL file-transfer displays erroneously said STREAMING when
  808.        not.
  809.      * An active SEND-LIST prevented GET from working.
  810.      * SET SERVER GET-PATH interpretation of relative names like "." was
  811.        wrong.
  812.      * The MAIL command was broken.
  813.      * "kermit -s *" might have skipped some files.
  814.      * Transaction log entries were not made for external protocol
  815.        transfers.
  816.      * File count report fixed to show number of files actually
  817.        transferred.
  818.      * Fixed filename conversion to convert spaces to underscores.
  819.      * Made SET PREFIXING / SET CONTROL PREFIX also adjust CLEARCHANNEL.
  820.      * More "Receive window full" errors fixed.
  821.      * Broken terminal buffering after curses display in Solaris fixed.
  822.      * SET FILE INCOMPLETE DISCARD did not work in all cases.
  823.      * Packet log changed to reformat the start-of-packet character
  824.        printably.
  825.      * Dynamic timeouts could grow ridiculously large.
  826.  
  827.    Character sets:
  828.      * Hebrew-7 translations missed the letter Tav.
  829.      * C1 area of CP1252 was ignored.
  830.      * SET TRANSFER CHARACTER-SET TRANSPARENT could give garbage
  831.        translations.
  832.      * TRANSLATE might not work on Little Endian architectures.
  833.      * Insufficient range checking in certain TRANSLATE operations.
  834.  
  835.    The following bugs in C-Kermit 8.0.200 were fixed in 8.0.201:
  836.  
  837.      * An obscure path through the code could cause the Unix version of
  838.        C-Kermit to dump core during its startup sequence. This happened
  839.        to only one person, but now it's fixed.
  840.      * When C-Kermit 8.0 is in Kermit server mode and the client says
  841.        "get blah", where blah (on the server) is a symlink rather than a
  842.        real file, the server unreasonably refused to send the linked-to
  843.        file.
  844.      * When C-Kermit is an FTP client and says "get foo/bar" (i.e. a
  845.        filename that includes one or more path segments), it failed to
  846.        accept the incoming file (this happened only with GET, not MGET).
  847.      * Array references should be case insensitive but only lowercase
  848.        array letters were accepted.
  849.      * SHOW VARIABLES dumped core on \v(sexpression) and \v(svalue).
  850.      * Spurious refusals of remote directory listings if the remote
  851.        server's date was set in the past.
  852.      * In AIX, and maybe elsewhere too, Kermit's COPY command always
  853.        failed with "Source and destination are the same file" when the
  854.        destination file didn't exist.
  855.      * The VMS version of C-Kermit did not work in Batch or when SPAWN'd.
  856.        To compound the problem, it also pretty much ignored the -B and -z
  857.        command-line options, whose purpose is to work around such
  858.        problems.
  859.      * C-Kermit 8.0 could not be built on IRIX 5.x.
  860.      * The C-Kermit 8.0 build for QNX6 said it was an "(unknown
  861.        version)".
  862.  
  863.    Other fixes are listed in the [161]previous section.
  864.  
  865.    [ [162]Top ] [ [163]Contents ] [ [164]C-Kermit ] [ [165]Kermit Home ]
  866.   __________________________________________________________________________
  867.  
  868. 2. SSH AND HTTP
  869.  
  870.   2.1. SSH Connections
  871.  
  872.      This section does not apply to [166]Kermit 95 2.0, which has its
  873.      own built-in SSH client, which is documented [167]SEPARATELY. 
  874.  
  875.    On most UNIX platforms, C-Kermit can make SSH (Secure SHell)
  876.    connection by running the external SSH command or program through its
  877.    pseudoterminal interface. The command is:
  878.  
  879.    SSH text
  880.           Tells Kermit to start the external SSH client, passing the
  881.           given text to it on the command line. Normally the text is just
  882.           the hostname, but it can be anything else that is acceptable to
  883.           the ssh client. If the command succeeds, the connection is made
  884.           and Kermit automatically enters CONNECT (terminal) mode. You
  885.           can use the SSH command to make a connection to any host that
  886.           has an SSH server.
  887.  
  888.    Kermit's SSH command gives you all the features of Kermit on an SSH
  889.    connection: command language, file transfer, character-set
  890.    translation, scripting, and all the rest. By default, C-Kermit invokes
  891.    SSH with "-e none", which disables the ssh escape character and makes
  892.    the connection transparent for purposes of file transfer. You can,
  893.    however, change the SSH invocation to whatever else you might need (an
  894.    explicit path, additional command-line arguments, etc) with:
  895.  
  896.    SET SSH COMMAND text
  897.           Specifies the system command that Kermit's SSH command should
  898.           use to invoke the external SSH client. Use this command to
  899.           supply a specific path or alternative name, or to include
  900.           different or more command-line options.
  901.  
  902.    In most cases, these connections work quite well. They can be scripted
  903.    like any other connection, and file transfer goes as fast as, or
  904.    faster than, on a regular Telnet connection. In some cases, however,
  905.    the underlying pseudoterminal driver is a limiting factor, resulting
  906.    in slow or failed file transfers. Sometimes you can work around such
  907.    problems by reducing the Kermit packet length. Note that Kermit does
  908.    not consider SSH connections to be reliable, so it does not offer to
  909.    use streaming in Kermit protocol transfers (but you can force it with
  910.    SET RELIABLE or SET STREAMING if you wish).
  911.  
  912.    The SSH command is like the TELNET command: it enters CONNECT mode
  913.    automatically when the connection is made. Therefore, to script an SSH
  914.    connection, use:
  915.  
  916.   set host /pty ssh -e none [ other-options ] host
  917.   if fail ...
  918.  
  919.    to make the connection.
  920.  
  921.    Here's a sequence that can be used to make a connection to a given
  922.    host using Telnet if the host accepts it, otherwise SSH:
  923.  
  924.   if not defined \%1 exit 1 Usage: \%0 host
  925.   set quiet on
  926.   set host \%1 23 /telnet
  927.   if fail {
  928.       set host /pty ssh -l \m(user) -e none \%1
  929.       if fail exit 1 \%1: Telnet and SSH both fail
  930.       echo SSH connection to \%1 successful
  931.   } else {
  932.       echo Telnet connection to \%1 successful
  933.   }
  934.  
  935.    In SSH v2, it is possible to make an SSH connection direct to a Kermit
  936.    server system if the host administrator has configured the SSH server
  937.    to allow this; [168]CLICK HERE for details.
  938.  
  939.    Since Kermit uses external ssh client software, and since there are
  940.    different ssh clients (and different releases of each one), the exact
  941.    command to be used to make an SSH/Kermit connection can vary. Here is
  942.    the command for the OpenSSH 3.0.2p1 client:
  943.  
  944. set host /pipe ssh -e none [ -l username ] -T -s hostname kermit
  945.  
  946.    Example:
  947.  
  948. set host /pipe ssh -e none -l olga -T -s hq.xyzcorp.com kermit
  949.  
  950.    The SSH client might or might not prompt you for a password or other
  951.    information before it makes the connection; this depends on your SSH
  952.    configuration (your public and private keys, your authorized hosts
  953.    file, etc). Here's a brief synopsis of the OpenSSH client command
  954.    syntax ("man ssh" for details):
  955.  
  956.    -e none
  957.           This tells the SSH client to use no escape character. Since we
  958.           will be transferring files across the connection, we don't want
  959.           the connection to suddenly block because some character in the
  960.           data.
  961.  
  962.    -l username
  963.           This is the username on the remote host. You can omit the -l
  964.           option and its argument if your local and remote usernames are
  965.           the same. If they are different, you must supply the remote
  966.           username.
  967.  
  968.    -T
  969.           This tells the SSH client to tell the SSH server not to
  970.           allocate a pseudoterminal. We are not making a terminal
  971.           connection, we don't need a terminal, and in fact if a terminal
  972.           were allocated on the remote end, the connection would not
  973.           work.
  974.  
  975.    -s ... kermit
  976.           This tells the SSH client to tell the SSH server to start the
  977.           specified subsystem ("kermit") once the connection is made. The
  978.           subsystem name comes after the hostname.
  979.  
  980.    hostname
  981.           The IP host name or address of the desired host.
  982.  
  983.    You might want to include other or additional ssh command-line
  984.    options; "man ssh" explains what they are. Here are some examples for
  985.    the OpenSSH 3.0.2p1 client:
  986.  
  987.    -oClearAllForwardings yes
  988.    -oForwardAgent no
  989.    -oForwardX11 no
  990.    -oFallbackToRsh no
  991.           These ensure that a secure connection is used and that the
  992.           connection used for file transfer is not also used for
  993.           forwarding other things that might be specified in the
  994.           ssh_config file.
  995.  
  996.    -oProtocol 2
  997.           (i.e. SSH v2) Ensures that the negotiated protocol supports
  998.           subsystems.
  999.  
  1000.    Once you have an SSH connection to a Kermit server, it's just like any
  1001.    other connection to a Kermit server (and very similar to a connection
  1002.    to an FTP server). You give the client file transfer and management
  1003.    commands for the server, and the server executes them. Of course you
  1004.    can also give the client any other commands you wish.
  1005.  
  1006.    [ [169]SSH Kermit Server Subsystem ] [ [170]Kermit 95 Built-in SSH
  1007.    Client ]
  1008.      _________________________________________________________________
  1009.  
  1010.   2.2. HTTP Connections
  1011.  
  1012.    Hypertext Transfer Protocol, or HTTP, is the application protocol of
  1013.    the World Wide Web (WWW), used between Web browsers (clients) and Web
  1014.    servers. It allows a client to get files from websites, upload files
  1015.    to websites, delete files from websites, get information about website
  1016.    directories and files, and interact with server-side CGI scripts.
  1017.    C-Kermit includes an HTTP client capable of both clear-text and secure
  1018.    HTTP connections, that can do all these tasks and can be automated
  1019.    through the Kermit scripting language.
  1020.  
  1021.    Although C-Kermit 7.0 could make HTTP connections to Web servers, it
  1022.    could do so only when no other connection was open, and the procedure
  1023.    was somewhat awkward. C-Kermit 8.0 improves matters by:
  1024.  
  1025.      * Allowing an HTTP connection to be open at the same time as a
  1026.        regular SET LINE or SET HOST connection, and also at the same time
  1027.        as an FTP connection ([171]Section 3);
  1028.      * Upgrading the HTTP protocol level from 1.0 to 1.1, thus allowing
  1029.        for persistent connections, in which a series of commands can be
  1030.        sent on the same connection, rather than only one as in HTTP 1.0
  1031.        (and C-Kermit 7.0);
  1032.      * Providing for "one-shot" URL-driven HTTP operations such as GET or
  1033.        PUT.
  1034.      * Providing a distinct HTTP command-line personality.
  1035.  
  1036.    Persistent HTTP connections are managed with the following commands:
  1037.  
  1038.    HTTP [ switches ] OPEN [ security-options ] host-or-url [ port ] 
  1039.           Opens a persistent connection to the specified host (IP host
  1040.           name or address) on the specified port. If any switches
  1041.           (options, listed in the next section) are included, their
  1042.           values are saved and used for all subsequent HTTP action
  1043.           commands on the same connection. If no port is specified, HTTP
  1044.           (80) is used. A Uniform Resource Locator (URL, [172]RFC 1738)
  1045.           can be given instead of a hostname (or address) and port (but
  1046.           the URL can not include a directory/file path). The security
  1047.           options are explained [173]below. The HTTP OPEN command
  1048.           replaces the C-Kermit 7.0 SET HOST hostname HTTP command, which
  1049.           no longer works with HTTP GET and related commands.
  1050.  
  1051.    HTTP CLOSE
  1052.           Closes any open HTTP connection and clears any saved switch
  1053.           values.
  1054.  
  1055.    A URL starts with a protocol name, which must be http or https in this
  1056.    case; optionally includes a username and password; and must contain a
  1057.    host name or address:
  1058.  
  1059.   protocol://[user[.password]]@host[:port][URI]
  1060.  
  1061.    HTTP is Hypertext Transfer Protocol. HTTPS is the secure (SSL/TLS)
  1062.    version of HTTP. The TCP service port is derived from the protocol
  1063.    prefix (so normally the ":port" field is omitted). Thus the URL
  1064.    protocol name specifies a default TCP service port and the URL user
  1065.    and password fields can take the place of the /USER and /PASSWORD
  1066.    switches ([174]Section 2.2.1). The optional URI is a "compact string
  1067.    of characters for identifying an abstract or physical resource"
  1068.    ([175]RFC 2396), such as a file. It must begin with a slash (/); if
  1069.    the URI is omitted, "/" is supplied. Examples:
  1070.  
  1071.    http open http://www.columbia.edu/
  1072.           Equivalent to http open www.columbia.edu or http open
  1073.           www.columbia.edu http.
  1074.  
  1075.    http open https://olga.secret@www1.xyzcorp.com/
  1076.           Equivalent to http /user:olga /pass:secret open
  1077.           www1.xyzcorp.com https.
  1078.  
  1079.    Persistence is accomplished unilaterally by C-Kermit 8.0. An HTTP 1.0
  1080.    server closes the connection after each action. Although HTTP 1.1
  1081.    allows multiple actions on the same connection, an HTTP 1.1 server
  1082.    tends to close the connection if it is idle for more than a few
  1083.    seconds, to defend itself against denial-of-service attacks. But when
  1084.    you use Kermit's HTTP OPEN command to create a connection, Kermit
  1085.    reopens it automatically (if necessary) for each HTTP action until you
  1086.    close it with HTTP CLOSE, regardless of the server's HTTP protocol
  1087.    version, or how many times it closes the connection.
  1088.  
  1089.    Firewalls can be negotiated through proxies with the following
  1090.    commands:
  1091.  
  1092.    SET TCP HTTP-PROXY [ host[:port] ]
  1093.           If a host (by hostname or IP address) is specified, Kermit uses
  1094.           it as a proxy server when attempting outgoing TCP connections
  1095.           -- not only HTTP connections, but all TCP/IP connections,
  1096.           Telnet and FTP included. This allows Kermit to adapt to the
  1097.           HTTP firewall penetration method (as opposed to other methods
  1098.           such as SOCKS4). If no hostname or ip-address is specified, any
  1099.           previously specified Proxy server is removed. If no port number
  1100.           is specified, the "http" service is used. This command must be
  1101.           given before the HTTP OPEN command if a proxy is to be used or
  1102.           canceled.
  1103.  
  1104.    HTTP [ switches ] CONNECT host[:port]
  1105.           Instructs the HTTP server to act as a proxy, establishing a
  1106.           connection to the specified host (IP hostname or address) on
  1107.           the given port (80 = HTTP by default) and to redirect all data
  1108.           transmitted between Kermit and itself to the given host for the
  1109.           life of the connection. This command is to be used only for
  1110.           debugging HTTP proxy connections. If a proxy connection is
  1111.           required, instruct Kermit to use the proxy with the SET TCP
  1112.           HTTP-PROXY command.
  1113.  
  1114.     2.2.1. HTTP Command Switches
  1115.  
  1116.    HTTP switches, like all other switches, are optional. When HTTP
  1117.    switches are included with the HTTP OPEN command, they apply
  1118.    automatically to this and all subsequent HTTP actions (GET, PUT, ...)
  1119.    on the same connection until an HTTP CLOSE command is given. So if you
  1120.    include switches (or the equivalent URL fields, such as user and
  1121.    password) in the HTTP OPEN command, you can omit them from subsequent
  1122.    commands on the same connection. If the connection has closed since
  1123.    your last command, it is automatically reopened with the same options.
  1124.  
  1125.    If you include switches with an HTTP action command (such as GET or
  1126.    PUT), they apply only to that command.
  1127.  
  1128.    /USER:name
  1129.           To be used in case a page requires a username for access. The
  1130.           username is sent with page requests. If it is given with the
  1131.           OPEN command it is saved until needed. If a username is
  1132.           included in a URL, it overrides the username given in the
  1133.           switch. CAUTION: Username and password (and all other
  1134.           information, including credit card numbers and other material
  1135.           that you might prefer to protect from public view) are sent
  1136.           across the network in clear text on regular HTTP connections,
  1137.           but authentication is performed securely on HTTPS connections.
  1138.  
  1139.    /PASSWORD:text
  1140.           To be used in case a web page requires a password for access.
  1141.           The password is sent with page requests. If it is given with
  1142.           the OPEN command it is saved until needed. If a password is
  1143.           given in a URL, it overrides the one given here. CAUTION: (same
  1144.           as for /USER:).
  1145.  
  1146.    /AGENT:user-agent
  1147.           Identifies the client to the server. Overrides the default
  1148.           agent string, which is "C-Kermit" (for C-Kermit) or "Kermit-95"
  1149.           (for Kermit 95).
  1150.  
  1151.    /ARRAY:array-designator
  1152.           Tells Kermit to store the response headers in the given array,
  1153.           one line per element. The array need not be declared in
  1154.           advance. Example: /array:&a.
  1155.  
  1156.    /TOSCREEN
  1157.           Tells Kermit to display any response text on the screen. It
  1158.           applies independently of the output file specification; thus it
  1159.           is possible to have the server response go to the screen, a
  1160.           file, both, or neither.
  1161.  
  1162.    /HEADER:header-item(s)
  1163.           Used for specifying any optional headers to be sent with HTTP
  1164.           requests.
  1165.  
  1166.   /HEADER:tag:value
  1167.  
  1168.           To send more than one header, use braces for grouping:
  1169.  
  1170.   /HEADER:{{tag:value}{tag:value}...}
  1171.  
  1172.           For a list of valid tags and value formats see [176]RFC 2616,
  1173.           "Hypertext Transfer Protocol -- HTTP/1.1". A maximum of eight
  1174.           headers may be specified.
  1175.  
  1176.     2.2.2. HTTP Action Commands
  1177.  
  1178.    HTTP actions can occur within a persistent connection, or they can be
  1179.    self-contained ("connectionless"). A persistent HTTP connection begins
  1180.    with an HTTP OPEN command, followed by zero or more HTTP action
  1181.    commands, and is terminated with an HTTP CLOSE command:
  1182.  
  1183.   http open www.columbia.edu
  1184.   if failure stop 1 HTTP OPEN failed: \v(http_message)
  1185.   http get kermit/index.html
  1186.   if failure stop 1 HTTP GET failed: \v(http_message)
  1187.   (more actions possible here...)
  1188.   http close
  1189.  
  1190.    A self-contained HTTP action occurs when a URL is given instead of a
  1191.    remote file name to an HTTP action command. In this case, Kermit makes
  1192.    the HTTP connection, takes the action, and then closes the connection.
  1193.    If an HTTP connection was already open, it is closed silently and
  1194.    automatically.
  1195.  
  1196.   http get http://www.columbia.edu/kermit/index.html
  1197.  
  1198.    Kermit's HTTP action commands are as follows. Switches may be included
  1199.    with any of these to override switch (or default) values given in the
  1200.    HTTP OPEN command.
  1201.  
  1202.    HTTP [ switches ] GET remote-filename [ local-filename ]
  1203.           Retrieves the named file from the server specified in the most
  1204.           recent HTTP OPEN command for which a corresponding HTTP CLOSE
  1205.           command has not been given. The filename may not include
  1206.           wildcards (HTTP protocol does not support them). If no HTTP
  1207.           OPEN command is in effect, this form of the HTTP GET command
  1208.           fails. The default local filename is the same as the remote
  1209.           name, but with any pathname stripped. For example, the command
  1210.           http get kermit/index.html stores the file in the current local
  1211.           directory as index.html. If the /HEADERS: switch is included,
  1212.           information about the file is also stored in the specified
  1213.           array (explained in [177]Section 2.2.3). All files are
  1214.           transferred in binary mode. HTTP does not provide for
  1215.           record-format or character-set conversion.
  1216.  
  1217.    HTTP [ switches ] GET url [ local-filename ]
  1218.           When HTTP GET is given a URL rather than a filename, Kermit
  1219.           opens a connection to the designated server (closing any
  1220.           previously open HTTP connection), gets the file, and then
  1221.           closes the connection. If the URL does not include a filename,
  1222.           index.html is supplied. This is the self-contained one-step
  1223.           "connectionless" method for getting a file from a Web server.
  1224.           The data is not interpreted; HTTP GET is like "lynx -source"
  1225.           rather than "lynx -dump".
  1226.  
  1227.    In the remaining HTTP action commands, the distinction between a
  1228.    remote filename and a URL are the same as in the HTTP GET command.
  1229.  
  1230.    HTTP [ switches ] HEAD remote-filename-or-url [ local-filename ]
  1231.           Like GET except without actually getting the file; instead it
  1232.           retrieves only the headers. If the /ARRAY: or /TOSCREEN switch
  1233.           is included, there is no default local output filename but you
  1234.           can still specify one. If neither of these switches is
  1235.           included, the default local filename is the same as the remote
  1236.           filename, but with any path stripped and with ".head" appended.
  1237.           The HEAD command can be used in a script with the /ARRAY:
  1238.           switch to retrieve information about the requested resource to
  1239.           determine whether the resource should actually be retrieved
  1240.           with a subsequent GET request.
  1241.  
  1242.    HTTP [ switches ] INDEX remote-directory-or-url [ local-filename ]
  1243.           Asks the server to send a listing of the files in the given
  1244.           server directory. This command is not supported by most Web
  1245.           servers. Even when it is supported, there is no standard format
  1246.           for the listing.
  1247.  
  1248.    HTTP [ switches ] POST [ /MIME-TYPE:type ] source-file
  1249.           remote-path-or-url [ result-file ]
  1250.           Sends data to a process running on the remote host; the result
  1251.           is usually an HTML file but could be anything. The data to be
  1252.           posted must be read from a local file (the source-file). If a
  1253.           result file is specified, Kermit stores the server's response
  1254.           in it.
  1255.  
  1256.    HTTP [ switches ] PUT [ MIME-TYPE:type ] local-file [
  1257.           remote-file-or-url [ result-file ] ]
  1258.           Uploads a local file to the server. Only the name of a single
  1259.           file can be given; wildcards (and group transfers) are not
  1260.           supported by HTTP protocol. If no remote filename is given, the
  1261.           file is sent with the same name as the local file, but with any
  1262.           pathname stripped.
  1263.  
  1264.    HTTP [ switches ] DELETE remote-file-or-url [ local-result-file ]
  1265.           Asks the server to delete the specified single file. If a
  1266.           result file is specified, it will contain any response data
  1267.           returned by the server.
  1268.  
  1269.    Note the limitations of HTTP protocol compared to (say) FTP or Kermit.
  1270.    There is no command for changing directories, no standard way to get
  1271.    file or directory lists, no way to transfer file groups by using
  1272.    wildcard notation, etc, and therefore no good way to (say) fetch all
  1273.    pages, descend through subdirectories, perform automatic updates, etc.
  1274.    There is no assurrance a connection will stay open and, as noted,
  1275.    there is no provision for data conversion between unlike platforms.
  1276.    The data's MIME headers can be used for postprocessing.
  1277.  
  1278.     2.2.3. HTTP Headers
  1279.  
  1280.    Each HTTP request and response contains a set of name/value pairs
  1281.    called headers. HTTP headers are specified in [178]RFC 2616. For
  1282.    example, an HTTP GET request for /index.html on www.columbia.edu
  1283.    contains the following headers:
  1284.  
  1285.   GET /index.html HTTP/1.1
  1286.   Host: www.columbia.edu:80
  1287.   User-agent: C-Kermit 8.0
  1288.   Authorization: Basic base64-encoded-username-password
  1289.  
  1290.    These might be followed by any others specified with a /HEADERS:
  1291.    switch:
  1292.  
  1293.   Accept: image/gif, image/x-xbitmap, image/jpeg, *.*
  1294.   Accept-Encoding: gzip
  1295.   Accept-Language: en
  1296.   Accept-Charset: iso-8859-1,utf-8
  1297.   Cookie: cookie-data
  1298.  
  1299.    The server sends back a short report about the file prior to sending
  1300.    the file contents. Example:
  1301.  
  1302.   HTTP/1.1 200 OK
  1303.   Date: Fri, 24 Aug 2001 21:09:39 GMT
  1304.   Server: Apache/1.3.4 (Unix)
  1305.   Last-Modified: Mon, 06 Aug 2001 21:16:13 GMT
  1306.   ETag: "1fa137-10d7-3b6f091d"
  1307.   Accept-Ranges: bytes
  1308.   Content-Length: 4311
  1309.   Content-Type: text/html
  1310.  
  1311.    If you want to have this information available to a Kermit script you
  1312.    can use the /ARRAY switch to have Kermit put it in array, one line per
  1313.    array element. Example:
  1314.  
  1315.   set exit warning off
  1316.   http open www.columbia.edu
  1317.   if fail exit 1 Can't reach server
  1318.   http /array:&a get /index.html
  1319.   if fail exit 1 Can't get file
  1320.   echo Header lines: \fdim(&a)
  1321.   for \%i 1 \fdim(&a) 1 {
  1322.       echo \%i. \&a[\%i]
  1323.   }
  1324.  
  1325.    Note that the "Date:" item is the current date and time; the
  1326.    "Last-Modifed:" item is the file's modification date and time. An
  1327.    example showing how to use this information is presented in
  1328.    [179]Section 8.13.7.
  1329.  
  1330.     2.2.4. Secure HTTP Connections
  1331.  
  1332.    SSL/TLS (Secure Sockets Layer / Transport Layer Security) is the
  1333.    protocol used to secure HTTP, SMTP, and other Internet applications.
  1334.    See the [180]C-Kermit Reference Section 5.4 for an introduction to
  1335.    SSL/TLS. To make a secure HTTP connection, you need:
  1336.  
  1337.     1. A secure client (a version of C-Kermit or Kermit 95 with SSL/TLS
  1338.        security built in). Type "check ssl" at the Kermit prompt to make
  1339.        sure you have it.
  1340.     2. A secure server to connect to.
  1341.     3. The CA Root Certificate used to authenticate the server to the
  1342.        client. (see [181]Section 15 of the security reference for an
  1343.        introduction to certificates).
  1344.  
  1345.    And you must make a connection to the secure HTTP port: service name
  1346.    HTTPS, port number 443 (as opposed to service HTTP, port 80). You can
  1347.    also make secure connections to other ports by including the /TLS or
  1348.    /SSL switch with the HTTP OPEN command, if the host supports SSL/TLS
  1349.    on the given port:
  1350.  
  1351.    The quality of the SSL/TLS connection depends on the cipher suite.
  1352.    There are several possibilities:
  1353.  
  1354.    Anonymous cipher suite:
  1355.           If an anonymous cipher suite is negotiated, the connection is
  1356.           encrypted but there is no authentication. This connection is
  1357.           subject to a Man-In-The-Middle (MITM) attack.
  1358.  
  1359.    X.509 certificate on the server:
  1360.           When you connect to certain secure servers, an X.509
  1361.           certificate is returned. This certificate is issued to a
  1362.           special hostname, something like www1.xyzcorp.com or
  1363.           wwws.xyzcorp.com (rather than the normal www.xyzcorp.com). It
  1364.           is signed by the host's Certificate Authority (CA). If the host
  1365.           certificate is configured on the client, it can be used to
  1366.           verify the certificate received from the server. If the
  1367.           certificate it verified as authentic, a check is made to ensure
  1368.           it has not expired and it was issued to the host you were
  1369.           attempting to connect to. If you had asked to connect to (say)
  1370.           www.xyzcorp.com but were given a certificate for
  1371.           www1.xyzcorp.com, you would be prompted for permission to
  1372.           continue.
  1373.  
  1374.           If the verification succeeded, the connection would be
  1375.           encrypted with one-way (server-to-client) authentication. This
  1376.           connection is not subject to a MITM attack.
  1377.  
  1378.           If a username and password are transmitted over this
  1379.           connection, they are not subject to interception. However, the
  1380.           standard risks associated with passing the password to the host
  1381.           for verification apply; for example, if the host has been
  1382.           compromised, the password will be compromised.
  1383.  
  1384.    X.509 client certificate:
  1385.           If a connection has been established with an X.509 server
  1386.           certificate, the server can ask the client to send a
  1387.           certificate of its own. This certificate must be verified
  1388.           against a CA Root certificate. The certificate itself (or
  1389.           subject info from the certificate) is used to determine the
  1390.           authorization for the client, and if successful, the username
  1391.           and password need not be sent to the server.
  1392.  
  1393.    Kerberos 5:
  1394.           Instead of using X.509 certifcates, Kerberos 5 can be used to
  1395.           perform the authentication and key exchange. In this situation,
  1396.           there is mutual authentication between the client and server.
  1397.           The Kerberos 5 principal is used by the server to look up the
  1398.           appropriate authorization data. There is no need to send
  1399.           username and password.
  1400.  
  1401.    An HTTP connection is made with the HTTP OPEN command:
  1402.  
  1403.    HTTP [ switches ] OPEN [ { /SSL, /TLS } ] host [ port ] 
  1404.           If /SSL or /TLS switches are included (these are synonyms), or
  1405.           if the service is HTTPS or the port is 443, a secure connection
  1406.           is attempted using the current authentication settings; see
  1407.           HELP SET AUTHENTICATION for details ([182]Section 6.2 of the
  1408.           security reference). If the no /SSL or /TLS switch is included
  1409.           but the port is 443 or the service is HTTPS, a secure
  1410.           connection is attempted. If an /SSL or /TLS switch is included
  1411.           but a port is not specified, an SSL/TLS connection is attempted
  1412.           on the default port (80).
  1413.  
  1414.    Certificates are covered in the separate [183]Kermit Security
  1415.    Reference for C-Kermit 8.0. You should let Kermit know to verify
  1416.    certificates with the SET AUTHENTICATION TLS command. For example:
  1417.  
  1418.    SET AUTHENTICATION TLS CRL-DIR directory
  1419.           Specifies a directory that contains certificate revocation
  1420.           files where each file is named by the hash of the certificate
  1421.           that has been revoked.
  1422.  
  1423.    SET AUTHENTICATION TLS CRL-FILE filename
  1424.           Specifies a file that contains a list of certificate
  1425.           revocations.
  1426.  
  1427.    SET AUTHENTICATION TLS VERIFY-DIR directory
  1428.           Specifies a directory that contains root CA certificate files
  1429.           used to verify the certificate chains presented by the peer.
  1430.           Each file is named by a hash of the certificate.
  1431.  
  1432.    SET AUTHENTICATION TLS VERIFY-FILE filename
  1433.           Specifies a file that contains root CA certificates to be used
  1434.           for verifying certificate chains.
  1435.  
  1436.    SET AUTHENTICATION TLS VERIFY OFF
  1437.           Tells Kermit not to require a certificate and accept any
  1438.           certificate that is presented regardless of whether it is
  1439.           valid.
  1440.  
  1441.    There are many other options; see the security document for details.
  1442.  
  1443.    Now suppose you need need to fetch the file denoted by the following
  1444.    URL:
  1445.  
  1446.   https://myuserid:mypassword@wwws.xyzcorp.com/clients/info/secret.html
  1447.  
  1448.    Once you have set up the handling of certificates as desired, you can
  1449.    use the following Kermit commands:
  1450.  
  1451.   http /user:myuserid /password:mypassword open www1.xyzcorp.com https
  1452.   if success {
  1453.       http get /clients/info/secret.html
  1454.       http close
  1455.   }
  1456.  
  1457.    As another example, let's say that you have a web form you need to
  1458.    populate with three fields: red,white and blue.
  1459.  
  1460.   <FORM ACTION="http://www.xyzcorp.com/cgi-bin/form.cgi" METHOD="POST">
  1461.   <INPUT NAME="Red">
  1462.   <INPUT NAME="White">
  1463.   <INPUT NAME="Blue">
  1464.   </FORM>
  1465.  
  1466.    You can handle this with the HTTP POST command. The data to be posted
  1467.    is stored in the local file data.txt.
  1468.  
  1469.   Red=seven stripes&White=six stripes&Blue=fifty stars
  1470.  
  1471.    and the response from the server will be stored into response.txt.
  1472.  
  1473.   http open www.xyzcorp.com http
  1474.   if success {
  1475.     http /array:c post data.txt /cgi-bin/form.cgi response.txt
  1476.     http close
  1477.   }
  1478.  
  1479.    In this scenario, the Common Gateway Interface (CGI) sends a response
  1480.    whether it succeeds or fails in a script-dependent manner. The script
  1481.    can either report success and enclose the response data; or it might
  1482.    send a 302 Found error which indicates that the "Location:" header
  1483.    should be used to determine the URL at which the data can be found.
  1484.  
  1485.     2.2.5. HTTP Variables
  1486.  
  1487.    \v(http_code)
  1488.           The HTTP protocol code number of the most recent server reply,
  1489.           e.g. 404 for "not found".
  1490.  
  1491.    \v(http_connected)
  1492.           1 when an HTTP connection is open, 0 when there is no HTTP
  1493.           connection.
  1494.  
  1495.    \v(http_host)
  1496.           If an HTTP connection is open, the hostname:port, e.g.
  1497.           www.columbia.edu:80; otherwise, empty.
  1498.  
  1499.    \v(http_message)
  1500.           Server error message, if any, from most recent HTTP command.
  1501.  
  1502.    \v(http_security)
  1503.           A list of the security parameters and values for the current
  1504.           connection, if any. Empty if the connection is not to a secure
  1505.           server, or there is no connection.
  1506.  
  1507.    To display all the HTTP variables at once, type SHOW VAR HTTP:
  1508.  
  1509.   C-Kermit> http open www.columbia.edu
  1510.   C-Kermit> http get lkjlkjlkjlkj 
  1511.   C-Kermit> sho var http
  1512.    \v(http_code) = 404
  1513.    \v(http_connected) = 1
  1514.    \v(http_host) = www.columbia.edu:80
  1515.    \v(http_message) = Not Found
  1516.    \v(http_security) = NULL
  1517.   C-Kermit>
  1518.  
  1519.     2.2.6. The HTTP Command-Line Personality
  1520.  
  1521.    If you invoke C-Kermit with the name "http" or "https", you can use a
  1522.    special set of HTTP-specific command-line options. You can do this by
  1523.    creating a symbolic linke "http" or "https" to the C-Kermit 8.0
  1524.    executable, or by having a separate copy of it called "http" or
  1525.    "https". Here's the usage message ("http -h"):
  1526.  
  1527.   Usage: ./http host [ options... ]
  1528.    -h             This message.
  1529.    -d             Debug to debug.log.
  1530.    -S             Stay (issue command prompt when done).
  1531.    -Y             Do not execute Kermit initialization file.
  1532.    -q             Quiet (suppress most messages).
  1533.    -u name        Username.
  1534.    -P password    Password.
  1535.    -g pathname    Get remote pathname.
  1536.    -p pathname    Put remote pathname.
  1537.    -H pathname    Head remote pathname.
  1538.    -l pathname    Local path for -g, -p, and -H.
  1539.    -z opt[=value] Security options...
  1540.       cert=file   Client certificate file
  1541.       certsok     Accept all certificates
  1542.       key=file    Client private key file
  1543.       secure      Use SSL
  1544.       verify=n    0 = none, 1 = peer , 2 = certificate required
  1545.  
  1546.    The "host" argument is the name of a Web host, e.g. www.columbia.edu.
  1547.    The action options are -p, -g, and -H. If you give an action option,
  1548.    Kermit does the action and then exits. If you give a host without an
  1549.    action option, Kermit makes an HTTP connection to the host and then
  1550.    gives you the C-Kermit prompt. Here's a simple example that fetches a
  1551.    publicly readable Web page:
  1552.  
  1553.   http www.columbia.edu -g kermit/index.html
  1554.  
  1555.    If you need to access a website for which a username and password are
  1556.    required, you can supply them on the command line with -u and -P. If
  1557.    you include a username but omit the password, Kermit prompts you for
  1558.    it:
  1559.  
  1560.   http www.columbia.edu -u olga -p kermit/index.html -l index.html
  1561.   Password:
  1562.  
  1563.    Note that when PUT'ing files to websites, you have to supply both the
  1564.    -p (remote pathname) and -l (local path) options.
  1565.  
  1566.    If your version of Kermit is built with SSL/TLS security, you can also
  1567.    use the -z option to make secure HTTP (https) connections.
  1568.  
  1569.    Finally, as noted in [184]Section 16, you can also give a URL instead
  1570.    of a host name and options.
  1571.  
  1572.    [ [185]Top ] [ [186]Contents ] [ [187]C-Kermit Home ] [ [188]Kermit
  1573.    Home ]
  1574.   __________________________________________________________________________
  1575.  
  1576. 3. THE BUILT-IN FTP CLIENT
  1577.  
  1578.      3.1.  [189]Making and Managing FTP Connections
  1579.      3.2.  [190]Making Secure FTP Connections
  1580.      3.3.  [191]Setting FTP Preferences
  1581.      3.4.  [192]Managing Directories and Files
  1582.      3.5.  [193]Uploading Files With FTP
  1583.      3.6.  [194]Downloading Files With FTP
  1584.      3.7.  [195]Translating Character Sets
  1585.      3.8.  [196]FTP Command Shortcuts
  1586.      3.9.  [197]Dual Sessions
  1587.      3.10. [198]Automating FTP Sessions
  1588.      3.11. [199]Advanced FTP Protocol Features
  1589.  
  1590.    Earlier versions of C-Kermit and K95 included an FTP command, but it
  1591.    simply invoked an external FTP client. Now, by popular demand, Kermit
  1592.    includes its own built-in FTP client that offers the following
  1593.    advantages over traditional FTP clients (and its previous interface to
  1594.    them):
  1595.  
  1596.      * Any of Kermit's built-in [200]security methods can be used to
  1597.        establish and conduct secure FTP sessions with [201]FTP servers
  1598.        that support these methods. (Security modules can be subject to
  1599.        export restrictions.)
  1600.      * Kermit's FTP client uses "passive mode" by default to avoid
  1601.        blockage by firewalls and network address translators. Of course
  1602.        active mode can be chosen too when needed.
  1603.      * [202]Character sets can be translated as part of the transfer
  1604.        process even when the FTP server does not support character-set
  1605.        translation, including to/from the new Internet standard
  1606.        international character set, [203]Unicode UTF-8. This includes
  1607.        both the file's name and (for text files only) its contents.
  1608.      * All of C-Kermit's [204]file-selection mechanisms are available:
  1609.        size, date, name patterns and lists, exception lists, etc.
  1610.      * [205]Atomic file movement capabilities are provided (delete, move,
  1611.        or rename files automatically after successful transfer).
  1612.      * The correct file type, "ascii" (i.e. text) or binary, is chosen
  1613.        automatically for each file (explained in [206]Section 4), and any
  1614.        mixture of text and binary files can be sent in a single
  1615.        operation, even across platforms.
  1616.      * Update mode ("don't bother transferring files that didn't change
  1617.        since last time") and recovery (resumption of an interrupted
  1618.        transfer from the point of failure) are available in both
  1619.        directions.
  1620.      * When uploading files from UNIX to UNIX, the file's permissions can
  1621.        be preserved if desired.
  1622.      * Recursive directory-tree PUTs are supported between any two
  1623.        platforms that have tree-structured file systems. Recursive GETs
  1624.        are supported between like platforms if the server cooperates and
  1625.        between like or unlike platforms if the server supports MLSD
  1626.        ([207]Section 3.11).
  1627.      * When receiving files, all of Kermit's file collision actions are
  1628.        available: backup, update, refuse, rename, etc.
  1629.      * Multi-file transfers can be interrupted on a per-file basis,
  1630.        automatically skipping to the next file.
  1631.      * FTP sessions are [208]fully scriptable.
  1632.      * An entire FTP session (connect, login, CD, upload or download,
  1633.        logout) can be specified on the command line without using a
  1634.        script.
  1635.      * All of Kermit's logging options and formats are available to keep
  1636.        an accurate and complete record of each connection and file
  1637.        transfer, and to aid in troubleshooting.
  1638.      * All of Kermit's file-transfer display options are available
  1639.        (fullscreen, brief, CRT, serial, none).
  1640.  
  1641.    And best of all:
  1642.      * Kermit doesn't give you those annoying per-file prompts every time
  1643.        you start a multi-file transfer without remembering to give a
  1644.        "prompt" command first :-).
  1645.  
  1646.    [ [209]Top ] [ [210]FTP Top ] [ [211]FTP Client Overview ] [ [212]FTP
  1647.    Script Tutorial ] [ [213]C-Kermit Home ] [ [214]Kermit Home ]
  1648.      _________________________________________________________________
  1649.  
  1650.   3.1. Making and Managing FTP Connections
  1651.  
  1652.    Each copy of Kermit can have one FTP connection open at a time. FTP
  1653.    connections are independent of regular terminal connections; a
  1654.    terminal connection (serial or network via SET LINE, DIAL, SET HOST,
  1655.    TELNET, etc) may be, but need not be, open at the same time as an FTP
  1656.    connection, and terminal connections can also be closed, and new
  1657.    connections opened, without interfering with the FTP connection (and
  1658.    vice versa). Thus, for example, Kermit can have an FTP connection and
  1659.    a TELNET connection open to the same host simultaneously, using the
  1660.    TELNET connection (e.g.) to send mail or take other desired actions as
  1661.    various FTP actions complete. Of course, each copy of Kermit can do
  1662.    only one thing at a time, so it can't (for example) transfer a file
  1663.    with FTP and another file with Kermit protocol simultaneously.
  1664.  
  1665.    A Kermit FTP session can be established by [215]command-line options,
  1666.    by [216]URL, or by [217]interactive commands.
  1667.  
  1668.     3.1.1. Kermit Command-Line Options for FTP
  1669.  
  1670.    The new command-line option '-9' (sorry, we're out of letters) can be
  1671.    used when starting C-Kermit, telling it to make an FTP connection:
  1672.  
  1673.   kermit -9 hostname
  1674.  
  1675.    or if a non-default FTP port is needed:
  1676.  
  1677.   kermit -9 hostname:port
  1678.  
  1679.    You can also specify the username on the command line with the -M ("My
  1680.    User ID") option that was already there for other connection types:
  1681.  
  1682.   kermit -9 hostname -M olga
  1683.  
  1684.    If you specify the username on the command line, Kermit uses it when
  1685.    making the connection and does not prompt you for it (but it does
  1686.    prompt you for the password if one is required).
  1687.  
  1688.    Once the connection is made, you get the regular Kermit prompt, and
  1689.    can give interactive commands such as the ones described below. When
  1690.    you give a BYE command, Kermit closes the session and exits, just as a
  1691.    regular FTP client would do. If you don't want Kermit to exit when you
  1692.    give a BYE command, include the -S ("Stay") option on the command
  1693.    line.
  1694.  
  1695.    Other Kermit command-line options that are not specific to non-FTP
  1696.    connections should affect the FTP session in the expected ways; for
  1697.    example, -i and -T force binary and text mode transfers, respectively.
  1698.  
  1699.    File transfers can not be initiated on the "kermit -9" command line;
  1700.    for that you need to use Kermit's FTP personality (next section) or
  1701.    you can use URLs ([218]Section 3.1.3).
  1702.      _________________________________________________________________
  1703.  
  1704.     3.1.2. The FTP Command-Line Personality
  1705.  
  1706.    If you want to replace your regular FTP client with C-Kermit, you can
  1707.    make a link called "ftp" to the C-Kermit binary (or you can store a
  1708.    copy of the C-Kermit binary under the name "ftp"). When C-Kermit is
  1709.    invoked with a program name of "ftp" (or "FTP", case doesn't matter),
  1710.    it assumes the command-line personality of the regular FTP client:
  1711.  
  1712.   ftp [ options ] hostname [ port ]
  1713.  
  1714.    In this case the options are like those of a regular FTP client:
  1715.  
  1716.   -d  Debug: enables debug messages and creates a debug.log file.
  1717.   -n  No autologin: Kermit should not send your user ID automatically.
  1718.   -t  Packet trace: accepted but is treated the same as -d.
  1719.   -v  Verbose: accepted but ignored (operation is verbose by default).
  1720.   -i  Not interactive: accepted but ignored.
  1721.  
  1722.    and the hostname can also be a URL (explained in [219]Section 3.1.3).
  1723.    To specify a non-default TCP port for the FTP server, include the port
  1724.    number or name after the hostname.
  1725.  
  1726.    There are also some bonus options that allow you to execute an entire
  1727.    FTP session from the shell command line, as long as you don't include
  1728.    the -n option. These are not available with regular FTP clients, and
  1729.    at least one of these options (-g) conflicts with UNIX ftp (where -g
  1730.    means "no globbing", which does not apply to Kermit), and some of them
  1731.    (like the options above) also conflict with regular Kermit
  1732.    command-line options:
  1733.  
  1734.   -m mode      = "passive" (default) or "active"
  1735.   -Y            Don't execute the Kermit initialization file [1]
  1736.   -q            Quiet, suppresses all but error messages [1]
  1737.   -S            Stay, don't exit automatically [1]
  1738.   -A            Autologin anonymously [2]
  1739.   -u name       Username for autologin [2] (synonym: -M [1])
  1740.   -P password   Password for autologin (see cautions below) [2]
  1741.   -D directory  cd after autologin [2]
  1742.   -b            Binary mode [2]
  1743.   -a            Text ("ascii") mode [2] (synonym: -T [1])
  1744.   -R            Recursive (works with -p) [4]
  1745.   -p files      Files to put (upload) after autologin [2] (synonym: -s [1])
  1746.   -g files      Files to get (download) after autologin [3]
  1747.  
  1748.    [1] Same as Kermit, not available in regular FTP clients.
  1749.    [2] Conflicts with Kermit, not available in regular FTP clients.
  1750.    [3] Same as Kermit, conflicts with regular FTP clients.
  1751.    [4] Conflicts with Kermit, available in some FTP clients.
  1752.  
  1753.    Fancier options such as restart, character-set translation, filename
  1754.    collision selection, automatic move/rename/delete, etc, are not
  1755.    available from the command line; for these you can use the commands
  1756.    described in the following sections. The -R option might also work
  1757.    with -g (GET) but that depends on the server.
  1758.  
  1759.    The following security options are also available, explained in
  1760.    [220]Section 3.2:
  1761.  
  1762.   -k realm      Kerberos 4 realm [4]
  1763.   -f            Kerberos 5 credentials forwarding [4]
  1764.   -x            autoencryption mode [4]
  1765.   -c cipher     SRP cipher type [4]
  1766.   -H hash       SRP encryption hash [4]
  1767.   -z option     Security options [4]
  1768.  
  1769.    If you include -A or specify a name of "anonymous" or "ftp", you are
  1770.    logged in anonymously and, in the absence of -P, Kermit automatically
  1771.    supplies a password of "user@host", where "user" is your local user
  1772.    ID, and "host" is the hostname of the computer where Kermit is
  1773.    running. If you do not include -p or -g, Kermit enters command mode so
  1774.    you can type commands or execute them from a script.
  1775.  
  1776.    If you include -p or -g, Kermit attempts to transfer the specified
  1777.    files and then exits automatically at the end of the transfer unless
  1778.    you also included -S (Stay). It uses the "brief" file transfer display
  1779.    (one line per file) unless you include the -q option to suppress it.
  1780.  
  1781.    When uploading files with -p, Kermit switches automatically between
  1782.    text and binary mode for each file.
  1783.  
  1784.    When downloading, you can either specify a particular mode (text or
  1785.    binary) to be used for all the files, or you can let Kermit select the
  1786.    type for each file automatically, based on its name (see [221]Sections
  1787.    3.5 and [222]3.6 for greater detail). In UNIX be sure to quote any
  1788.    wildcard characters to prevent the shell from expanding them, as shown
  1789.    in the examples just below. Filename collisions are handled according
  1790.    Kermit's FILE COLLISION setting (if specified in your Kermit
  1791.    customization file; otherwise the default, which is BACKUP).
  1792.  
  1793.    It should go without saying that the -P option should be used with
  1794.    caution. In addition to the well-known risks of transmitting plaintext
  1795.    passwords over the Internet, in this case the password also echos to
  1796.    the screen if you type it, and can be seen in ps and w listings that
  1797.    show the user's currently active command and command-line arguments.
  1798.    Thus command-line FTP sessions are most appropriate for secure or
  1799.    anonymous connections (those that do not require passwords).
  1800.  
  1801.    Here's an example in which you download the latest C-Kermit "tarball"
  1802.    from the Columbia University FTP archive:
  1803.  
  1804.   ftp -A kermit.columbia.edu -bg kermit/archives/ckermit.tar.gz
  1805.  
  1806.    This assumes that "ftp" is a symbolic link to C-Kermit. It logs you in
  1807.    anonymously and gets the ckermit.tar.gz file in binary mode from the
  1808.    kermit/archives directory.
  1809.  
  1810.    Here's a slightly more ambitious example that illustrates CD'ing to
  1811.    the desired server directory to get a group of files in text mode (in
  1812.    this case the C-Kermit source files):
  1813.  
  1814.   ftp -A kermit.columbia.edu -D kermit/f -ag "ck[cuw]*.[cwh]" makefile
  1815.  
  1816.    In this case we CD to the kermit/f directory so we don't have to
  1817.    include it in each file specification, and we quote the ck[cuw]*.[cwh]
  1818.    specification so the shell doesn't expand it, since we have to pass it
  1819.    as-is to the server. Note also that the quotes don't go around the
  1820.    entire file list; only around each file specification that needs to be
  1821.    quoted.
  1822.  
  1823.    Here's one more example, that uploads a debug log file in binary mode
  1824.    to the Kermit incoming directory (as we might ask you to do when
  1825.    following up on a problem report):
  1826.  
  1827.   ftp -A kermit.columbia.edu -D kermit/incoming -bp debug.log
  1828.  
  1829.    In this case the -D option is required to tell the server where to put
  1830.    the incoming file.
  1831.  
  1832.    Unless the -Y option is included, your Kermit initialization file
  1833.    (.mykermrc in UNIX, K95.INI in Windows) is executed before the command
  1834.    line options, so you can set any FTP-related preferences there, as
  1835.    described in the subsequent sections.
  1836.      _________________________________________________________________
  1837.  
  1838.     3.1.3. The FTP URL Interpreter
  1839.  
  1840.    If Kermit is invoked with either its regular personality (as "kermit")
  1841.           or its FTP personality (as "ftp"), you can also give a URL
  1842.           (Universal Resource Locator) instead of a hostname and options,
  1843.           with or without a username and password:
  1844.           ftp ftp://user:password@host/path
  1845.           ftp ftp://user@host/path
  1846.           ftp ftp://@host/path   (or ftp://:@host/path)
  1847.           ftp ftp://host/path
  1848.           kermit ftp://host/path
  1849.  
  1850.    If the FTP personality is used, the service must be "ftp". In all
  1851.    cases, a hostname or address must be included. If a user is included
  1852.    but no password, you are prompted for the password. If a path
  1853.    (filename) is included:
  1854.      * If "@" is included without a user, Kermit prompts for the username
  1855.        and password.
  1856.      * If no user and no "@" are included, "anonymous" is used.
  1857.      * GET is assumed.
  1858.  
  1859.    If no path (and no action options) are included, an interactive FTP
  1860.           session is started, as in this example:
  1861.           ftp ftp://kermit.columbia.edu
  1862.  
  1863.    If a path is included, but a username is not included, "anonymous" is
  1864.    used and an appropriate user@host password is supplied automatically.
  1865.    If authentication is successful, Kermit attempts to GET the file
  1866.    indicated by the path or, if the path is the name of a directory, it
  1867.    asks the server for a directory listing. In both cases, Kermit
  1868.    disconnects from the server and exits after the operation is complete
  1869.    (unless you have included the -S option on the command line).
  1870.  
  1871.    Here's an example that gets a listing of the Kermit directory at the
  1872.           Kermit ftp site:
  1873.           ftp ftp://kermit.columbia.edu/kermit/
  1874.  
  1875.    This example gets the top-level READ.ME file from the same directory:
  1876.           ftp ftp://kermit.columbia.edu/kermit/READ.ME
  1877.  
  1878.    Here's the same example, but requesting a text-mode transfer:
  1879.           ftp -T ftp://kermit.columbia.edu/kermit/READ.ME
  1880.           This illustrates that you can mix command-line options and URLs
  1881.           if you desire.
  1882.  
  1883.    Here's an example that logs in as a (fictitious) real user to get a
  1884.           file:
  1885.           ftp ftp://olga@ftp.xyzcorp.com/resume.txt
  1886.           The password is not included, so Kermit prompts for it.
  1887.  
  1888.    This scheme allows Kermit to be used as the FTP helper of other
  1889.    applications, such as Web browsers, with all its advantages over other
  1890.    FTP clients (especially the ones that are built in to most Web
  1891.    browsers), e.g. that it can be given wildcards, and it can pick text
  1892.    and binary mode automatically for each file.
  1893.  
  1894.    HINT: suppose somebody sends you an FTP URL in email, or you see it in
  1895.    some text. If your terminal screen supports copy/paste, copy the url,
  1896.    and then at the shell prompt type "kermit", a space, and then paste
  1897.    the URL, e.g.:
  1898.  
  1899.   $ kermit ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty1.1.27-O
  1900.  
  1901.    "$ is the shell prompt; the part you type is underlined, the rest is
  1902.    pasted in. Kermit does the rest.
  1903.      _________________________________________________________________
  1904.  
  1905.     3.1.4. Interactive FTP Session Establishment
  1906.  
  1907.    As you read this and the following sections, bear in mind that any
  1908.    command that can be given at the prompt can also be used in a script
  1909.    program. Kermit's script programming language is the same as its
  1910.    interactive command language. [223]CLICK HERE if you would like to
  1911.    learn a bit more about script writing.
  1912.  
  1913.    An FTP session is established with the FTP OPEN command:
  1914.  
  1915.    FTP [ OPEN ] [ { /SSL, /TLS } ] hostname [ switches ] [ port ]
  1916.           Opens an FTP connection to the given host on the given port
  1917.           and, if FTP AUTOLOGIN is ON, also logs you in to the server,
  1918.           prompting for username and password if necessary. If no port is
  1919.           specified, the regular FTP protocol port (21) is used. The OPEN
  1920.           keyword is optional (unless the hostname conflicts with one of
  1921.           the FTP command keywords, which you can list by typing "ftp
  1922.           ?").
  1923.  
  1924.    The hostname can be an IP host name, numeric IP address, or if you
  1925.    have a network directory active (SET NETWORK DIRECTORY; see Chapter 6
  1926.    of [224]Using C-Kermit), an entry name in the directory. In the latter
  1927.    case, if the given hostname matches exactly one entry, the associated
  1928.    name or address is used; if it matches more than one, Kermit cycles
  1929.    through them until one is found that can be opened; if it matches
  1930.    none, then the hostname is used as-is. If a directory is active but
  1931.    you want to bypass directory lookup, include an "=" sign at the
  1932.    beginning of the hostname, and/or use a numeric IP address.
  1933.  
  1934.    When an FTP connection is opened, the default file-transfer mode is
  1935.    set to binary if the client and server platforms are alike (e.g. both
  1936.    of them are some kind of UNIX), and to text ("ascii") if they are not
  1937.    alike. This has no particular effect for uploading since Kermit
  1938.    automatically switches between text and binary mode for each file, but
  1939.    might be important for downloading. The connection is also set to
  1940.    Stream mode and File structure. Record- or page-oriented file
  1941.    transfers are not supported by C-Kermit's FTP client.
  1942.  
  1943.    The optional FTP OPEN switches are:
  1944.  
  1945.    /ANONYMOUS
  1946.           Logs you in anonymously, automatically supplying username
  1947.           "anonymous" and user@host as the password, based on your local
  1948.           user and host names.
  1949.  
  1950.    /NOLOGIN
  1951.  
  1952.           Overrides SET FTP AUTOLOGIN ON for this connection only.
  1953.  
  1954.    /USER:name
  1955.           Uses the given username to log you in, thus avoiding the Name:
  1956.           prompt.
  1957.           Overrides SET FTP AUTOLOGIN OFF for this connection only.
  1958.  
  1959.    /PASSWORD:text
  1960.           Uses the given text as your password, thus avoiding the
  1961.           Password: prompt. This switch is not recommended for use in
  1962.           script files, which would be a security risk.
  1963.  
  1964.    /ACCOUNT:text
  1965.           Uses the given text as your account (or secondary password,
  1966.           depending on the requirements of the server; most servers do
  1967.           not require or accept an account name). If an account is not
  1968.           supplied, you are not prompted for one.
  1969.  
  1970.    /PASSIVE
  1971.           Opens the connection in passive mode. Passive mode is the
  1972.           default in Kermit's FTP client, unlike in most others, since it
  1973.           works better through firewalls. The /PASSIVE and /ACTIVE
  1974.           switches apply only to the connection that is being opened, and
  1975.           do not affect the global FTP PASSIVE-MODE setting.
  1976.  
  1977.    /ACTIVE
  1978.           Opens the connection in active mode. Use this switch if the
  1979.           server does not support passive mode, or use the command SET
  1980.           FTP PASSIVE-MODE OFF.
  1981.  
  1982.    /NOINIT
  1983.           Added in C-Kermit 8.0.201.   Tells C-Kermit not to send REST,
  1984.           STRU, FEAT, and MODE commands to the server when the connection
  1985.           is opened, since these have been reported to cause confusion in
  1986.           certain servers.
  1987.  
  1988.    When a username or password is missing, a prompt is issued at the
  1989.    controlling terminal and you must type the response; the response can
  1990.    not be scripted. Use the switches to avoid prompts, or one of the
  1991.    secure authentication methods described in the next section, or see
  1992.    [225]SET FTP AUTOLOGIN and the [226]FTP USER and similar commands
  1993.    described later in this section.
  1994.  
  1995.    Examples:
  1996.  
  1997.   ftp open kermit.columbia.edu /anonymous  ; Open and log in anonymously
  1998.   ftp kermit.columbia.edu /anonymous       ; The OPEN keyword can be omitted
  1999.   ftp xyzcorp.com                          ; Open and maybe prompt for username
  2000.   ftp xyzcorp.com /user:olga               ; Open and log in as olga
  2001.   ftp testing.abccorp.com 449              ; Specify a special TCP port number
  2002.   ftp testing.abccorp.com /user:olaf /password:secret 449
  2003.  
  2004.    The FTP OPEN command succeeds if a connection was opened to the server
  2005.    (even if the given username and password were not valid) and fails
  2006.    otherwise (see [227]Section 3.8 for details).
  2007.  
  2008.    When your FTP session is complete, you can terminate it as follows:
  2009.  
  2010.    FTP BYE
  2011.           Closes the FTP connection if one was open. The FTP prefix can
  2012.           be omitted if no other connection is open at the same time (see
  2013.           [228]Section 3.8 for details). If a connection log is active,
  2014.           an FTP record is written to it. If Kermit was started with the
  2015.           -9 command-line option or with its FTP command-line
  2016.           personality, and the -S (Stay) option was not given, AND there
  2017.           is no other active connection, the FTP BYE command also exits,
  2018.           just as it does on a regular FTP client. Synonyms: FTP CLOSE,
  2019.           FTP QUIT (but if the FTP prefix is omitted from QUIT, this
  2020.           becomes the regular Kermit QUIT command, which is equivalent to
  2021.           EXIT; i.e. it closes the connection and exits from Kermit).
  2022.  
  2023.    The following commands can be used to achieve greater control over the
  2024.    connection and login process:
  2025.  
  2026.    SET FTP ANONYMOUS-PASSWORD text
  2027.           Allows you to choose the password text to be sent automatically
  2028.           by Kermit when you open an FTP connection with the /ANONYMOUS
  2029.           switch.
  2030.  
  2031.    SET FTP AUTOLOGIN { ON, OFF }
  2032.           If you give this command prior to opening an FTP connection, it
  2033.           controls whether Kermit tries to log you in automatically as
  2034.           part of the connection process. Normally ON, which means the
  2035.           username and password are sent automatically (and prompted for
  2036.           if they are not yet known). When OFF, FTP OPEN connects to the
  2037.           server without logging in. OFF is equivalent to the -n
  2038.           command-line option when using Kermit's FTP command-line
  2039.           personality.
  2040.  
  2041.    FTP USER name [ password [ account ] ]
  2042.           Used to log in to an FTP server to which a connection has been
  2043.           made without autologin, or when autologin failed. If the
  2044.           password is furnished on the command line, it is used;
  2045.           otherwise you are prompted for a password. An account may also
  2046.           be furnished if required by the server; it is not required by
  2047.           Kermit and is not prompted for if omitted. Synonyms: USER, FTP
  2048.           LOGIN.
  2049.  
  2050.    FTP ACCOUNT text
  2051.           Sends an account name to a server that supports accounts. If
  2052.           the server does not support accounts, an error response occurs.
  2053.           If the server does support accounts, the account is accepted if
  2054.           it is valid and rejected if it is not. The account might be
  2055.           used for charging purposes or it might be a secondary password,
  2056.           or it might be used for any other purpose, such as an access
  2057.           password for a particular disk. Servers that support accounts
  2058.           might or might not allow or require the account to be sent
  2059.           prior to login; usually it is sent after login, if at all.
  2060.           Synonym: ACCOUNT.
  2061.  
  2062.    Example:
  2063.  
  2064. set ftp autologin off                  ; One thing at a time please
  2065. ftp xyzcorp.com                        ; Try to make the connection
  2066. if fail exit 1 FTP connection failed   ; Check that it was made
  2067. ftp user olga secret                   ; Now log in to the server
  2068. if fail exit 1 FTP login failed        ; Check that it worked
  2069. ftp account 103896854                  ; Login OK - send account
  2070. if fail echo WARNING - FTP ACCT failed ; Warn if problem
  2071. ...                                    ; (have session here)
  2072. bye                                    ; Log out and disconnect
  2073.  
  2074.    The following commands are used to control or get information about
  2075.    the FTP connection. Any particular FTP server does not necessarily
  2076.    support all of them.
  2077.  
  2078.    FTP RESET
  2079.           Terminates a user session but leaves the connection open,
  2080.           allowing a new login via FTP USER.
  2081.  
  2082.    FTP IDLE [ number ]
  2083.           Most FTP servers automatically log you out and and disconnect
  2084.           your session if there has been no activity for a certain amount
  2085.           of time. Use this command to ask the server to set its idle
  2086.           limit to the given number of seconds. Omit the number to ask
  2087.           the server to inform you of its current idle limit.
  2088.  
  2089.    FTP STATUS [ filename ]
  2090.           Asks the FTP server to send information about the current
  2091.           session. The result is a free-format report that might include
  2092.           server identification, username and login time, FTP protocol
  2093.           settings, and file-transfer statistics. If a filename is given,
  2094.           the server is supposed to send detailed information about the
  2095.           file.
  2096.  
  2097.    FTP SYSTEM
  2098.           Asks the FTP server to identify its operating system (Listed in
  2099.           Internet Assigned Numbers, Operating System Names). Examples:
  2100.           UNIX, VMS, VM/CMS, WINDOWS-NT. Unfortunately many variations
  2101.           are allowed (e.g. LINUX-2.0, LINUX-2.2, FREEBSD, ULTRIX, etc,
  2102.           instead of UNIX; WINDOWS-NT-3, WINDOWS-NT-3.5, WINDOWS-NT-3.51,
  2103.           WINDOWS-NT-4, etc). The report might also include other
  2104.           information like "Type L8", "Type I", or "Type A", indicating
  2105.           the file-transfer mode.
  2106.  
  2107.    FTP HELP [ keyword [ keyword [ ... ] ]
  2108.           Asks the server to list the commands it supports. The response
  2109.           is usually cryptic, listing FTP command mnemonics, not the
  2110.           commands used by the client (since the server has no way of
  2111.           knowing anything about the client's user interface). For
  2112.           example, the PUT command is STOR in FTP protocol. If a keyword
  2113.           is given, which should be an FTP protocol command,
  2114.           slightly-more- detailed help is given about the corresponding
  2115.           command (if the FTP server supports this feature). Examples:
  2116.           "ftp help", "ftp help stor".
  2117.  
  2118.    FTP SITE text
  2119.           (Advanced) Sends an FTP SITE (site-specific) command. Usually
  2120.           this means that the FTP server is asked to run an external
  2121.           command with the given arguments. You might be able to find out
  2122.           what SITE commands are available by sending "ftp help site" to
  2123.           the server, but in general the availability of and response to
  2124.           SITE commands is (not surprisingly) site specific.
  2125.  
  2126.    FTP QUOTE text
  2127.           (Advanced) Sends an FTP command in FTP protocol format. Use
  2128.           this command to send commands to the server that the FTP client
  2129.           might not know about.
  2130.  
  2131.    SHOW FTP
  2132.           Lists client (Kermit) FTP settings and information. Also SHOW
  2133.           CONNECTION, SHOW COMMUNICATIONS.
  2134.  
  2135.    HELP FTP [ keyword ]
  2136.           Asks Kermit to list and describe its built-in FTP commands.
  2137.  
  2138.    HELP SET FTP [ keyword ]
  2139.           Asks Kermit to list and describe its built-in SET FTP commands.
  2140.  
  2141.    [ [229]Top ] [ [230]FTP Top ] [ [231]C-Kermit Home ] [ [232]Kermit
  2142.    Home ]
  2143.      _________________________________________________________________
  2144.  
  2145.   3.2. Making Secure FTP Connections
  2146.  
  2147.    Also see: [233]Accessing IBM Information Exchange with Kermit.
  2148.  
  2149.    In the previous section, you can see several examples of traditional
  2150.    insecure authentication: username and password sent across the network
  2151.    in clear text. Of course this is bad practice on at least two counts:
  2152.    (1) storing passwords in files (such as script files) gives access to
  2153.    the target systems to anybody who can obtain read access to your
  2154.    scripts; and (2) sending this information over the network leaves it
  2155.    open to interception by network sniffers or compromised hosts.
  2156.  
  2157.    Because of the increasing need for security on the Internet, FTP
  2158.    servers are beginning to appear that offer secure forms of
  2159.    authentication, in which no information is sent over the network that
  2160.    would allow anyone who intercepts it to usurp your identity and gain
  2161.    your access rights.
  2162.  
  2163.    Kermit provides an equivalent form of FTP security for each type of
  2164.    IETF standard security implemented in Telnet. These include
  2165.    GSSAPI-KERBEROS5, KERBEROS4, Secure Remote Password (SRP), and
  2166.    Transport Layer Security (SSL and TLS). It does not presently include
  2167.    SSL tunneling nor any form of SSH v1 or v2. When Kermit is built with
  2168.    the necessary libraries, secure FTP connections are attempted by
  2169.    default, in which all connections are authenticated and the command
  2170.    and data channels are private.
  2171.  
  2172.    The use of authentication and encryption for FTP connections can be
  2173.    adjusted with the commands listed below, which are available only if
  2174.    your version of Kermit was built with the corresponding security
  2175.    options and libraries:
  2176.  
  2177.    SET FTP AUTHTYPE { AUTOMATIC, GSSAPI-KRB5, KERBEROS4, SRP, SSL, TLS }
  2178.           Specifies an ordered list of authentication methods to be
  2179.           attempted when AUTOAUTHENTICATION is ON. The default list is:
  2180.           GSSAPI-KRB5, SRP, KERBEROS_V4, TLS, SSL. If none of the
  2181.           selected methods are supported by the server, an insecure login
  2182.           is used as a fallback. Note, by the way, that SSL or TLS can be
  2183.           used to secure an anonymous connection.
  2184.  
  2185.    SET FTP AUTOAUTHENTICATION { ON, OFF }
  2186.           Tells whether authentication should be negotiated by the FTP
  2187.           OPEN command. Default is ON. Use SET FTP AUTOAUTHENTICATION OFF
  2188.           to force a clear-text, unencrypted connection to FTP servers
  2189.           (such as the one at the Kermit FTP site) that normally would
  2190.           try to negotiate secure authentication and encryption.
  2191.  
  2192.    SET FTP AUTOENCRYPTION { ON, OFF }
  2193.           Tells whether encryption (privacy) should be negotiated by the
  2194.           FTP OPEN command, which can happen only if secure
  2195.           authentication is also negotiated. Default is ON.
  2196.  
  2197.    SET FTP AUTOLOGIN { ON, OFF }
  2198.           Tells Kermit whether to try logging in automatically when you
  2199.           make an FTP connection, as opposed to letting you do it "by
  2200.           hand" with the FTP USER command.
  2201.  
  2202.    SET FTP COMMAND-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE
  2203.           }
  2204.           Determines the level of protection applied to the command
  2205.           channel:
  2206.  
  2207.   CLEAR         Data is sent in plaintext and not protected against tampering.
  2208.   CONFIDENTIAL  Data is encrypted but not protected against tampering.
  2209.   PRIVATE       Data is encrypted and is protected against tampering.
  2210.   SAFE          Data is sent in plaintext but protected against tampering.
  2211.  
  2212.           The default is PRIVATE.
  2213.  
  2214.    SET FTP CREDENTIAL-FORWARDING { ON, OFF }
  2215.           Tells whether end-user credentials are to be forwarded to the
  2216.           server if supported by the authentication method (GSSAPI-KRB5
  2217.           only). This is often required to allow access to distributed
  2218.           file systems (e.g. AFS.)
  2219.  
  2220.    SET FTP DATA-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE }
  2221.           Tells what level of protection is applied to subsequent data
  2222.           channels. The meanings of the protection-level keywords are the
  2223.           same as for SET FTP COMMAND-PROTECTION-LEVEL. The default is
  2224.           PRIVATE.
  2225.  
  2226.    SET FTP SRP CIPHER name
  2227.           Specifies the cipher to be used for encryption when SRP
  2228.           authentication is in use. The list of possible choices is
  2229.           computed based on the capabilities of the local SRP library and
  2230.           includes NONE plus zero or more of the following:
  2231.  
  2232.   BLOWFISH_ECB        CAST5_ECB          DES_ECB          DES3_ECB
  2233.   BLOWFISH_CBC        CAST5_CBC          DES_CBC          DES3_CBC
  2234.   BLOWFISH_CFB64      CAST5_CFB64        DES_CFB64        DES3_CFB64
  2235.   BLOWFISH_OFB64      CAST5_OFB64        DES_OFB64        DES3_OFB64
  2236.  
  2237.           The default is DES3_ECB.
  2238.  
  2239.    SET FTP SRP HASH name
  2240.           Specifies the hash to be used for data protection when SRP
  2241.           authentication is in use. The choices are MD5 and SHA. The
  2242.           default is SHA.
  2243.  
  2244.    Command-line options:
  2245.  
  2246.    -k name
  2247.           Specifies the realm to be used with Kerberos 4 authentication
  2248.           (= SET AUTH K4 REALM name).
  2249.  
  2250.    -f
  2251.           Enables forwarding of Kerberos 5 credentials to the host when
  2252.           using GSSAPI authentication (= SET AUTH K5 FORWARDABLE ON).
  2253.  
  2254.    -x
  2255.           Enables autoencryption (= SET FTP AUTOENCRYPTION ON).
  2256.  
  2257.    -c cipher
  2258.           Specifies the kind of cipher to be used for encryption with SRP
  2259.           authentication. Equivalent to SET FTP SRP CIPHER, with the same
  2260.           choices. If this option is not given, CAST5_CBC is used.
  2261.  
  2262.    -H hash
  2263.           Specifies the hash to be used for encryption with SRP
  2264.           authentication. Equivalent to SET FTP SRP HASH, with the same
  2265.           choices. If this option is not given, SHA is used.
  2266.  
  2267.    -z debug
  2268.           Turns on SSL/TLS debugging.
  2269.  
  2270.    -z secure
  2271.           Requires secure connection.
  2272.  
  2273.    -z certsok
  2274.           Says to accept all certificates without checking validity.
  2275.  
  2276.    -z verify=n
  2277.           Sets certificate verification mode to the given number, n:
  2278.             0 = no verification
  2279.             1 = verify certificate if presented
  2280.             2 = require verification of certificate
  2281.  
  2282.    -z cert=filename
  2283.           Specifies a file containing a client certificate to be
  2284.           presented to the FTP server.
  2285.  
  2286.    -z key=filename
  2287.           Specifies a file containing a private key matching the client
  2288.           certificate.
  2289.  
  2290.    -z !krb4
  2291.           (nokrb4) Disables the use of Kerberos 4.
  2292.  
  2293.    -z !gss
  2294.    -z nogss
  2295.           Disables the use of GSSAPI - Kerberos 5.
  2296.  
  2297.    -z !srp
  2298.    -z nosrp
  2299.           Disables use of SRP.
  2300.  
  2301.    -z !ssl
  2302.    -z nossl
  2303.           Disables the use of SSL.
  2304.  
  2305.    -z !tls
  2306.    -z notls
  2307.           Disables the use of TLS.
  2308.  
  2309.    Caution: If your FTP connection is secured via AUTH TLS, it is not
  2310.    possible to interrupt a file transfer. This is a limitation of all
  2311.    known FTP servers that support AUTH TLS.
  2312.  
  2313.    Note that when using certain security methods, such as SSL or TLS, you
  2314.    may be prompted to confirm or verify certain actions or conditions,
  2315.    for example, whether to accept self-signed certificates. This can
  2316.    interfere with unattended operation of scripts; see [234]Section 3.10.
  2317.  
  2318.    [ [235]Top ] [ [236]FTP Top ] [ [237]C-Kermit Home ] [ [238]Kermit
  2319.    Home ]
  2320.      _________________________________________________________________
  2321.  
  2322.    3.3. Setting FTP Preferences FTP preferences can be set globally and
  2323.    persistently with the commands in the following sections; many of
  2324.    these can also be overridden on a per-command basis with switches that
  2325.    have the same name.
  2326.  
  2327.     3.3.1. Logs, Messages, and Other Feedback
  2328.  
  2329.    You can control the amount of feedback received from your FTP session
  2330.    with the commands in this section. First, you can create a log of your
  2331.    FTP transfers with the following commands:
  2332.  
  2333.    SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF }
  2334.           Selects the log format. VERBOSE is the default, and is
  2335.           described in [239]the manual. FTP chooses a WU-FTPD format, the
  2336.           same as is used by the popular FTP server. BRIEF creates
  2337.           per-file records in comma-separated-list format. For greater
  2338.           detail, see [240]Section 4.17 of the [241]C-Kermit 7.0 Update
  2339.           Notes.
  2340.  
  2341.    LOG TRANSACTIONS filename
  2342.           Records FTP (or Kermit, or any other protocol) uploads and
  2343.           downloads in the given file using the format selected by the
  2344.           most recent SET TRANSACTION-LOG command, if any, or else the
  2345.           default format.
  2346.  
  2347.    FTP screen messages and displays are controlled by the following
  2348.    commands:
  2349.  
  2350.    SET TRANSFER DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
  2351.           FTP transfers use Kermit's normal file-transfer display styles.
  2352.           Use this command to choose the desired format; the default on
  2353.           most platforms is FULLSCREEN. The display is automatically
  2354.           disabled if Kermit is running in the background or in batch.
  2355.           BRIEF is always used for command-line initiated transfers
  2356.           (unless suppressed by -q). While a file-transfer is in
  2357.           progress, you can interrupt it in the normal Kermit way by
  2358.           typing one of the following keys or key combinations:
  2359.             X - Cancel current file but go on to the next one (if any).
  2360.             Z - Cancel the entire transfer.   Ctrl-L or Ctrl-W - Refresh
  2361.           the file-transfer display (if any).
  2362.  
  2363.    SET FTP DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
  2364.           Like SET TRANSFER DISPLAY, but applies only to FTP connections,
  2365.           and does not affect Kermit- or other protocol file transfers.
  2366.  
  2367.    SET QUIET { ON, OFF }
  2368.           This command applies to Kermit in general, not just FTP. OFF by
  2369.           default; when ON, it surpresses most messages from most
  2370.           commands as well as the file-transfer display.
  2371.  
  2372.    SET FTP PROGRESS-MESSAGES { ON, OFF }
  2373.           Tells whether Kermit should print locally-generated feedback
  2374.           messages for each non-file-transfer command. ON by default.
  2375.  
  2376.    SET FTP VERBOSE-MODE { ON, OFF }
  2377.           Tells whether to display all responses from the FTP server. OFF
  2378.           by default. This shows all responses to all commands, except
  2379.           when the file-transfer display is active, and unless you have
  2380.           SET QUIET ON. When OFF, responses are shown only for commands
  2381.           such as FTP PWD whose purpose is to display a response.
  2382.  
  2383.    SET FTP DEBUG { ON, OFF }
  2384.           Tells whether local client debugging information should be
  2385.           displayed. OFF by default. When ON, the commands that are sent
  2386.           to the server are shown, as well as its responses (even if
  2387.           VERBOSE-MODE is OFF), plus additional informational messages
  2388.           are printed regarding the progress of secure operations. Also,
  2389.           the temporary file created by the [242]MGET command is not
  2390.           deleted so you can see what's in it.
  2391.  
  2392.    Set all of these to OFF when silent running is desired.
  2393.  
  2394.     3.3.2. Operational Preferences
  2395.  
  2396.    FTP DISABLE new-protocol-feature-name
  2397.    FTP ENABLE new-protocol-feature-name
  2398.           Explained in [243]Section 3.11.
  2399.  
  2400.    SET FTP AUTOLOGIN { ON, OFF }
  2401.           If you give this command prior to opening an FTP connection, it
  2402.           controls whether Kermit tries to log you in automatically as
  2403.           part of the connection process. Normally ON, which means the
  2404.           username and password are sent automatically (and prompted for
  2405.           if they are not yet known). When OFF, FTP OPEN connects to the
  2406.           server without logging in. OFF is equivalent to the -n
  2407.           command-line option when using Kermit's FTP command-line
  2408.           personality. See [244]Section 3.1.4 for usage.
  2409.  
  2410.    SET FTP PASSIVE-MODE { ON, OFF }
  2411.           ON by default, to avoid random TCP port assignment for data
  2412.           connections, which can prevent FTP protocol from working
  2413.           through firewalls and network address translators (for more on
  2414.           these topics, see the [245]Kermit security reference. Set to
  2415.           OFF in case the FTP server does not support passive mode, or in
  2416.           case the client has problems with it (it has been observed, for
  2417.           example, that when using passive mode, the SCO XENIX 2.3.4
  2418.           TCP/IP stack hangs in the connect() call forever). Synonyms:
  2419.           PASSIVE [ ON ], PASSIVE OFF, PASV [ ON ], PASV OFF.
  2420.  
  2421.    SET FTP SEND-PORT-COMMANDS { ON, OFF }
  2422.           This command determines whether the FTP client sends a new PORT
  2423.           command to the server when accepting incoming data connections
  2424.           (as when not using passive mode.) When PASSIVE-MODE is OFF and
  2425.           SET SEND-PORT is OFF, the port that was originally specified is
  2426.           reused. This is the default behavior for normal FTP clients but
  2427.           it is not compatible with many firewalls.
  2428.  
  2429.    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
  2430.           Whether to translate character sets when transferring files
  2431.           with FTP (explained in [246]Section 3.7). OFF by default.
  2432.  
  2433.    SET FTP SERVER-CHARACTER-SET name
  2434.           Tells Kermit the character set used by the FTP server, UTF-8 by
  2435.           default ([247]Section 3.7).
  2436.  
  2437.    SET FTP SERVER-TIME-OFFSET delta-time
  2438.           Tells Kermit to apply the given [248]delta time to file
  2439.           timestamps provided by the server for its files; for use when
  2440.           (for example) the server does not have its timezone set
  2441.           correctly.
  2442.  
  2443.    SET FTP ERROR-ACTION { PROCEED, QUIT }
  2444.           When transferring a group of files with FTP, and an error
  2445.           occurs with one of the files, Kermit normally goes on the next
  2446.           file. Use SET FTP ERROR-ACTION to QUIT to make Kermit stop the
  2447.           transfer immediately and fail if an error occurs with any
  2448.           single file in the group. Example: you have given Kermit a list
  2449.           of files to send, and one of the files can not be found, or
  2450.           read permission is denied. Note that cancelling a file by
  2451.           typing 'X' during transfer is not considered an error (if you
  2452.           want to cancel the entire transfer, type 'Z' or Ctrl-C).
  2453.  
  2454.    SET FTP PERMISSIONS { AUTO, ON, OFF }
  2455.           When uploading files with PUT or MPUT, this tells whether
  2456.           Kermit should send each file's permissions. The default is OFF,
  2457.           which means not to send permissions, in which case the uploaded
  2458.           file's permissions are set by the FTP server according to its
  2459.           own criteria. ON means to send them, AUTO means to send them
  2460.           only if the client (Kermit) and server are on like platforms
  2461.           (e.g. both UNIX). This command has no effect when downloading,
  2462.           since the FTP protocol does not include a way for the server to
  2463.           inform the client of a file's permissions. Also see [249]FTP
  2464.           PUT /PERMISSIONS. Note that setting permissions after uploading
  2465.           is likely to work (correctly or at all) only when the client
  2466.           and server platforms are alike (e.g. both of them are some form
  2467.           of UNIX). Also note that Windows files don't have permissions.
  2468.           Also see [250]FTP CHMOD.
  2469.  
  2470.    SET FTP DATES { ON, OFF }
  2471.           When downloading files with GET or MGET, this tells whether
  2472.           Kermit should try to set the received file's date from the
  2473.           server's date. FTP DATES is ON by default. Note, however, that
  2474.           FTP protocol does not allow date preservation when uploading.
  2475.           So at best, SET FTP DATES ON can work only when downloading,
  2476.           and then only when the server agrees to furnish file dates.
  2477.  
  2478.    SET FTP FILENAMES { AUTO, CONVERTED, LITERAL }
  2479.           When uploading (sending) files, this tells whether to convert
  2480.           outbound filenames to "common form". This means allowing only
  2481.           one period in a name, uppercasing any lowercase letters,
  2482.           replacing spaces by underscores, etc. AUTOMATIC is the default,
  2483.           meaning LITERAL when client and server are the same type of
  2484.           system (e.g. UNIX) and CONVERTED otherwise. Special case: if
  2485.           the setting is AUTOMATIC and the client is not UNIX and the
  2486.           server identifies itself as UNIX, Kermit uses a less-strict
  2487.           form of conversion, in which lowercase letters are not
  2488.           uppercased and the filename can contain any number of periods,
  2489.           but spaces are still converted to underscore. When receiving,
  2490.           conversion generally means to change all-uppercase names to
  2491.           lowercase and spaces to underscore.
  2492.  
  2493.    SET FTP UNIQUE-SERVER-NAMES { ON, OFF }
  2494.           Applies only to uploads. Tells the server to create new, unique
  2495.           names for incoming files that have the same names as existing
  2496.           files. OFF by default, in which case the server overwrites
  2497.           existing files with new files of the same name. When ON, the
  2498.           server uses its own built-in method for creating new names for
  2499.           incoming files; for example, appending a period (.) and a
  2500.           number to the name. CAUTION: Use this option only if you do not
  2501.           need to refer to the file after it is uploaded, since FTP
  2502.           protocol provides no mechanism for the client to find out what
  2503.           name was assigned by the server.
  2504.  
  2505.    SET FTP COLLISION { ... }
  2506.           When downloading, what to do if an incoming file has the same
  2507.           name as an existing file. Options are the same as for SET FILE
  2508.           COLLISION. If this command is not given, Kermit's regular FILE
  2509.           COLLISION setting is used. If this command is given, it
  2510.           overrides the FILE COLLISION setting for FTP transfers only.
  2511.           See [251]Section 3.6.2 for details.
  2512.  
  2513.    SET FTP TYPE { TEXT, BINARY, TENEX }
  2514.           Changes the default transfer mode. When sending (uploading)
  2515.           files, this command has no effect unless you disable automatic
  2516.           text/binary mode switching ([252]Section 4) with SET FILE SCAN
  2517.           OFF or SET TRANSFER MODE MANUAL. When receiving (downloading)
  2518.           files, this command establishes the transfer mode to be used
  2519.           when a filename does not match any of Kermit's text or binary
  2520.           filename patterns, unless you use SET FTP
  2521.           GET-FILETYPE-SWITCHING or SET TRANSFER MODE MANUAL to disable
  2522.           automatic switching, in which case, this command establishes
  2523.           the transfer mode for all downloaded files. In all cases,
  2524.           however, the FTP TYPE can be overridden in any GET or PUT
  2525.           command by including a /TEXT (/ASCII), /BINARY, or /TENEX
  2526.           switch. The FTP TYPE is independent of the Kermit FILE TYPE
  2527.           setting. TENEX is used for sending 8-bit binary files to 36-bit
  2528.           platforms such as TOPS-10, TOPS-20, and TENEX, and getting them
  2529.           back again. Synonym: ASCII = TEXT. Note: there is also an FTP
  2530.           TYPE command, which does what SET FTP TYPE does but also sends
  2531.           a TYPE command to the server immediately if the given type is
  2532.           different from the current one.
  2533.  
  2534.    If you want want specific FTP preference settings to be in effect for
  2535.    all your Kermit FTP sessions, put the desired SET FTP commands in your
  2536.    Kermit customization file (~/.mykermrc in UNIX, K95CUSTOM.INI in
  2537.    Windows).
  2538.  
  2539.    [ [253]Top ] [ [254]FTP Top ] [ [255]C-Kermit Home ] [ [256]Kermit
  2540.    Home ]
  2541.      _________________________________________________________________
  2542.  
  2543.   3.4. Managing Directories and Files
  2544.  
  2545.    In Kermit, commands for directory and file management can refer to:
  2546.  
  2547.      * The local computer
  2548.      * A remote computer when you have a connection to a Kermit server or
  2549.        IKSD.
  2550.      * A remote computer when you have a connection to an FTP server.
  2551.  
  2552.    (There can also be an HTTP connection, but the commands in this
  2553.    section don't apply to HTTP connections.)
  2554.  
  2555.    Thus in general, each such command comes in three forms:
  2556.  
  2557.     1. With no prefix in C-Kermit 8.0.200, it refers to the local
  2558.        computer (CD, DIR, etc). In C-Kermit 8.0.201 and later, however,
  2559.        the "locus" switches to automatically to the remote FTP server
  2560.        when you make an FTP connection (see the SET LOCUS description
  2561.        [257]Section 7); thus C-Kermit 8.0.201 acts almost exactly like a
  2562.        regular FTP client when it has an FTP connection, yet still acts
  2563.        like itself on other kinds of connections.
  2564.     2. With the REMOTE prefix, it is for a Kermit server (REMOTE CD,
  2565.        REMOTE DIR).
  2566.     3. With the FTP prefix, it's for an FTP server (FTP CD, FTP DIR).
  2567.     4. Also see [258]Section 3.8, which explains "R-commands" and
  2568.        "L-commands".
  2569.  
  2570.    Kermit's FTP file and directory management commands are as follows.
  2571.    When an R-command is included in the Synonyms list, be sure to read
  2572.    [259]Section 3.8 about rules for use of R-commands.
  2573.  
  2574.    FTP CD [ directory ]
  2575.           Tells the FTP server to change its default (working) directory
  2576.           to the one given, which usually must be expressed in the syntax
  2577.           of the server platform (UNIX, VMS, etc). If the directory is
  2578.           not specified, the result depends on the FTP server -- it might
  2579.           complain that the command is illegal, or it might change to
  2580.           your original login directory. Synonyms: FTP CWD (Change
  2581.           Wording Directory); RCD.
  2582.  
  2583.    FTP CDUP
  2584.           Tells the FTP server to change its default (working) directory
  2585.           to the parent directory of its current one (equivalent to
  2586.           "cd .." in UNIX, or "cd [-]" in VMS). Synonyms: RCDUP, FTP UP.
  2587.  
  2588.    FTP PWD
  2589.           Asks the FTP server to report ("print") its current working
  2590.           directory. Synonym: RPWD.
  2591.  
  2592.    FTP MKDIR directory
  2593.           Asks the FTP server to create the directory whose name is
  2594.           given. In general, the name must be in the syntax of the
  2595.           server's file system, and it must be either absolute (a full
  2596.           pathname) or relative to the server's current (working)
  2597.           directory. This command fails if the directory can't be created
  2598.           for any reason, including that it exists already. Synonym:
  2599.           RMKDIR.
  2600.  
  2601.    FTP RMDIR directory
  2602.           Asks the FTP server to remove the directory whose name is
  2603.           given. The rules are the same as for MKDIR, plus in most cases,
  2604.           the server will not remove any directory unless it is empty.
  2605.           Synonym: RRMDIR.
  2606.  
  2607.    FTP DIRECTORY [ filespec ] [ redirectors ]
  2608.           Tells the FTP server to send a directory listing of the
  2609.           specified files. If no filespec is given, the server lists all
  2610.           files in its current working directory. The results are in
  2611.           whatever format the server chooses to send them. You can use
  2612.           UNIX-like redirectors to send the listing to a file or a
  2613.           pipeline, exactly as with the regular Kermit client/server
  2614.           REMOTE DIRECTORY command ([260]Using C-Kermit, Chapter 11).
  2615.           Synonym: RDIRECTORY. Examples:
  2616.  
  2617.     ftp dir                           ; Show listing of all files on screen
  2618.     ftp dir *.txt                     ; List *.txt files on screen
  2619.     ftp dir *.txt > somefile          ; Put listing in somefile
  2620.     ftp dir *.txt >> somefile         ; Append listing to somefile
  2621.     ftp dir *.txt | sort > somefile   ; Put sorted listing in somefile
  2622.     ftp dir | more                    ; Runs list through "more"
  2623.     ftp dir | sort | more             ; Runs list through "sort" and "more"
  2624.  
  2625.    FTP VDIRECTORY [ filespec ] [ redirectors ]
  2626.           "Verbose" directory. This is an alternative FTP DIRECTORY
  2627.           command primarily for use with DECSYSTEM-20 (TOPS-20) FTP
  2628.           servers, which send only filenames when given a DIRECTORY
  2629.           command; the VDIRECTORY command makes them also send file
  2630.           sizes, dates, and attributes.
  2631.  
  2632.    FTP CHECK filespec
  2633.           Asks the FTP server whether the given file exists or, if the
  2634.           filespec contains wildcards, if any files match, and this
  2635.           command succeeds or fails accordingly.
  2636.  
  2637.    FTP MODTIME filename
  2638.           Asks the FTP server, via the not-yet-standard FTP MDTM command,
  2639.           to send the modification date and time of the given file. The
  2640.           response should be a numeric string in the format:
  2641.           yyyymmddhhmmssxxxxx... where yyyy is the year, mm is the month,
  2642.           dd is the day, hh is the hour (0-23), mm is the minute, ss is
  2643.           the second, and xxx... is the optional fraction of the second
  2644.           (0 or more digits). The date and time is expressed in UTC (GMT,
  2645.           Zulu, Zero-Meridian). The result is available programmatically
  2646.           in the [261]\v(ftp_message) variable, and is understandable by
  2647.           Kermit's date-time switches and functions. For example, suppose
  2648.           we want to upload all local files that are newer than a
  2649.           particular file on the server:
  2650.  
  2651.   C-Kermit> ftp modtime signpost
  2652.   C-Kermit> echo \v(ftp_message)
  2653.   20010807113542.014
  2654.   C-Kermit> ftp mput /after:\v(ftp_message)GMT *
  2655.  
  2656.           Note that we must append "GMT" to the date-time string to let
  2657.           the /AFTER switch know the time is GMT rather than local.
  2658.  
  2659.    FTP SIZE filename
  2660.           Asks the FTP server to send the size (in bytes) of the given
  2661.           file. The result might vary depending on whether the current
  2662.           FTP TYPE is binary or text ("ascii"). For a reliable byte
  2663.           count, do FTP TYPE BINARY first. The result is available
  2664.           programmatically in the [262]\v(ftp_message) variable.
  2665.  
  2666.    FTP CHMOD permissions filename
  2667.           Tells the FTP server to set the permissions (protection) of the
  2668.           given file to the ones given. The permissions and filename must
  2669.           be given in whatever syntax is required by the server. Example
  2670.           (for a UNIX-based FTP server):
  2671.  
  2672.   ftp chmod 664 oofa.txt
  2673.  
  2674.           Not all servers support this command. For non-UNIX-based
  2675.           servers, you might need to use FTP QUOTE or FTP SITE and the
  2676.           appropriate platform-specific FTP server command.
  2677.  
  2678.    FTP UMASK [ number ]
  2679.           This command is probably specific to UNIX-based servers; it
  2680.           sets the UNIX "umask", which is the default permissions mask
  2681.           for new (in this case, incoming) files. Crudely put, the UNIX
  2682.           umask is an octal representation of a binary number in in which
  2683.           a 1 bit stands for a permission bit that must be 0, and a 0 bit
  2684.           stands for a permission bit that can be 0 or 1 depending on
  2685.           other factors, such as the permissions of the parent directory.
  2686.           Example: "umask 007" requires that new files are created
  2687.           without read/write/execute world permission. If the number is
  2688.           not specified, the server's current umask is reported.
  2689.  
  2690.    FTP RENAME filename newname
  2691.           Asks the FTP server to rename the file whose name is "filename"
  2692.           to "newname". Works only for one file; can not be used with
  2693.           wildcards. The server's interpretation of "newname" can vary
  2694.           (in some cases it must be a filename, in others perhaps it can
  2695.           also be a directory name, in which case if the filename denote
  2696.           a regular file, the file might be moved to the given
  2697.           directory). Some servers might allow files to be renamed
  2698.           ("moved") between physical disks or partitions, others might
  2699.           not. Synonym: RRENAME.
  2700.  
  2701.    FTP DELETE [ switches ] filespec [ filespec [ ... ] ]
  2702.           Tells the FTP server to delete the file or files listed. Each
  2703.           file specification may, but need not, contain wildcard
  2704.           characters to match multiple files. File specifications and
  2705.           wildcard syntax must be those of the server. Any file
  2706.           specifications that contain spaces must be enclosed in braces
  2707.           or doublequotes. FTP DELETE switches are:
  2708.  
  2709.  /ERROR-ACTION:  /FILENAMES:     /NOBACKUPFILES  /QUIET
  2710.  /EXCEPT:        /LARGER-THAN:   /NODOTFILES     /NOPAGE
  2711.  /PAGE           /RECURSIVE      /SMALLER-THAN:
  2712.  
  2713.           When used with FTP DELETE, the /RECURSIVE switch deletes files
  2714.           but not directories, and furthermore depends on the server
  2715.           providing recursive file lists, which is not the normal
  2716.           behavior. For further details, see the decriptions of these
  2717.           switches in [263]Section 3.6. Synonyms: FTP MDELETE (Kermit
  2718.           makes no distinction between DELETE and MDELETE); RDELETE.
  2719.  
  2720.    FTP TYPE { TEXT, BINARY, TENEX }
  2721.           Tells the FTP server to change its file-transfer type to the
  2722.           one given, immediately. See [264]SET FTP TYPE for details.
  2723.  
  2724.    [ [265]Top ] [ [266]FTP Top ] [ [267]C-Kermit Home ] [ [268]Kermit
  2725.    Home ]
  2726.      _________________________________________________________________
  2727.  
  2728.   3.5. Uploading Files With FTP
  2729.  
  2730.    Uploading means sending files from the client (Kermit) to the FTP
  2731.    server. The basic command for uploading files with FTP is PUT:
  2732.  
  2733.    FTP PUT [ switches ] [ filespec [ as-name ] ]
  2734.           Uploads (sends) the file or files that match the file
  2735.           specification, which may include wildcards, to the server. If
  2736.           no filespec is given, the names of files to send are taken from
  2737.           the /LISTFILE: file, if any, otherwise from the SEND-LIST, if
  2738.           any. Unless you go out of your way to prevent it, Kermit
  2739.           determines the transfer mode (text or binary) for each file
  2740.           automatically, and switches automatically on a per-file basis.
  2741.           If an as-name is given, the file is sent under that name
  2742.           instead of its own (if an as-name is given with a wildcard
  2743.           filespec, the result is a bit more complicated, and is
  2744.           explained later in this section).
  2745.  
  2746.    Unlike normal FTP clients, Kermit does not prompt you by default (or
  2747.    at all) for each file; it just sends them, just as it does with Kermit
  2748.    protocol. The filespec can be a literal filename or a Kermit pattern,
  2749.    described in:
  2750.  
  2751.   [269]http://www.columbia.edu/kermit/ckermit70.html#x4.9
  2752.  
  2753.    Kermit patterns are equivalent to C-Shell patterns and provide a fair
  2754.    amount of flexibility in selecting which files to send, which is
  2755.    augmented by the file-selection switches presented in [270]Section
  2756.    3.5.1.
  2757.  
  2758.    FTP MPUT [ switches ] filespec [ filespec [ ... ] ]
  2759.           FTP MPUT is just like FTP PUT except it allows you to give more
  2760.           than one file specification, and it does not allow an as-name
  2761.           in the file list. However, as-names can be given to either PUT
  2762.           or MPUT with the /AS-NAME: switch.
  2763.  
  2764.    If a PUT or MPUT command results in one file being uploaded, it
  2765.    succeeds if the file is uploaded completely and fails otherwise. If
  2766.    more than one file is selected for upload, success or failure depends
  2767.    on the [271]FTP ERROR-ACTION setting; if it is PROCEED (the default
  2768.    setting), then the [M]PUT command succeeds if at least one of the
  2769.    files was completely uploaded, and fails otherwise, If FTP
  2770.    ERROR-ACTION is QUIT, the [M]PUT command succeeds if all selected
  2771.    files were uploaded successfully, and fails if any file failed.
  2772.  
  2773.    FTP uploads may be interrupted just like Kermit uploads. While the
  2774.    transfer is in progress, type:
  2775.  
  2776.   X to interrupt the current file and go on to the next file.
  2777.   Z to cancel the current file and all remaining files.
  2778.   ^C (Control-C): Like Z, but might act more quickly.
  2779.  
  2780.    MPUT may be used as in regular FTP clients, but it is not required to
  2781.    send multiple files; in Kermit it is required only if you want to give
  2782.    multiple file specifications. Examples:
  2783.  
  2784.   ftp put oofa.txt               ; Send a single file oofa.txt
  2785.   ftp put oofa.txt budget.txt    ; Send single file oofa.txt as budget.txt
  2786.   ftp put *.txt                  ; Send all *.txt files
  2787.   ftp mput *.txt                 ; Send all *.txt files (same as "put *.txt")
  2788.   ftp mput *.txt foo.bar         ; Send all *.txt files plus foo.bar
  2789.  
  2790.    The distinction between PUT and MPUT is important only when more than
  2791.    one filespec is given, just like the distinction between Kermit SEND
  2792.    and MSEND:
  2793.  
  2794.   ftp put oofa.txt budget.txt    ; Send oofa.txt AS budget.txt
  2795.   ftp mput oofa.txt budget.txt   ; Send oofa.txt AND budget.txt
  2796.  
  2797.    If the source file specification includes any path segments, for
  2798.    example:
  2799.  
  2800.   put /tmp/oofa.txt
  2801.   put subdir/another/andanother/oofa.txt
  2802.  
  2803.    the path portion is stripped from the filename that is sent to the
  2804.    server. However, if an as-name contains a path, it is retained.
  2805.    Examples:
  2806.  
  2807.   ftp put /usr/doc/oofa.txt      ; Send as "oofa.txt".
  2808.   ftp put oofa.txt /tmp/oofa.txt ; Send as "/tmp/oofa.txt"
  2809.  
  2810.    The latter example sends the file oofa.txt from your current local
  2811.    directory to the server's /tmp directory. This works only if the
  2812.    server uses the same directory notation that you used in the as-name
  2813.    AND the given directory already exists on the server AND if you have
  2814.    write access to it.
  2815.  
  2816.    Use caution when uploading from a case-sensitive file system, such as
  2817.    UNIX, to a file system that is not case sensitive, such as Windows or
  2818.    VMS. If you have two files in UNIX, AA and aa and upload both of them,
  2819.    the second one will overwrite the first. The only way around this
  2820.    provided by FTP protocol is its "unique server names" feature (SET FTP
  2821.    UNIQUE-SERVER-NAMES or the /UNIQUE switch described below).
  2822.      _________________________________________________________________
  2823.  
  2824.     3.5.1. FTP PUT Switches
  2825.  
  2826.    FTP PUT and MPUT are similar in format and behavior to the regular
  2827.    Kermit SEND and MSEND commands, and they allow most of the same
  2828.    optional switches:
  2829.  
  2830. C-Kermit>ftp put ? Filename, or switch, one of the following:
  2831.  /after:                 /larger-than:           /rename-to:
  2832.  /array:                 /listfile:              /server-character-set:
  2833.  /as-name:               /local-character-set:   /server-rename-to:
  2834.  /before:                /move-to:               /simulate
  2835.  /binary                 /nobackupfiles          /smaller-than:
  2836.  /command                /nodotfiles             /tenex
  2837.  /delete                 /nofollowlinks          /text
  2838.  /dotfiles               /not-after:             /transparent
  2839.  /error-action:          /not-before:            /type:
  2840.  /except:                /permissions:           /update
  2841.  /filenames:             /quiet                  /unique-server-names
  2842.  /filter:                /recover
  2843.  /followlinks            /recursive
  2844.  
  2845.    Since most of these switches are common to Kermit's SEND and MSEND
  2846.    commands, they described only briefly here. For greater detail see:
  2847.  
  2848.      [272]http://www.columbia.edu/kermit/ckermit70.html#x1.5 (explanation
  2849.    of switches)
  2850.      [273]http://www.columbia.edu/kermit/ckermit70.html#x4.7
  2851.    (file-transfer switches)
  2852.  
  2853.    First the file-selection switches:
  2854.  
  2855.    /AFTER:date-time
  2856.    /BEFORE:date-time
  2857.    /NOT-AFTER:date-time
  2858.    /NOT-BEFORE:date-time
  2859.           Only send those files modified on or after or before the given
  2860.           date and time. These switches can be combined to select files
  2861.           modified between two date/times. Various date-time formats are
  2862.           accepted; if the date-time contains spaces, it must be enclosed
  2863.           in braces or doublequotes. See
  2864.           [274]http://www.columbia.edu/kermit/ckermit70.html#x1.6 and
  2865.           [275]Section 8.13 of this document for details about date-time
  2866.           formats. Examples:
  2867.  
  2868.   ftp put /after:{1 jan 2000 0:00:00} *
  2869.   ftp put /after:-5days *
  2870.  
  2871.    /LARGER-THAN:number
  2872.    /SMALLER-THAN:number
  2873.           Only send files larger (smaller) than the given number of bytes
  2874.           (octets). These switches can be combined to select files in a
  2875.           certain size range.
  2876.  
  2877.    /TYPE:{TEXT,BINARY}
  2878.           Only send files that are the given type, which is determined
  2879.           for each file just before sending it by file scanning. BINARY
  2880.           includes TENEX; if you have included a /TENEX switch, or
  2881.           previously given a [SET] FTP TYPE TENEX command, binary files
  2882.           are sent in TENEX, rather than BINARY mode.
  2883.  
  2884.    /[NO]DOTFILES
  2885.           [Don't] include files whose names begin with dot (.). By
  2886.           default, such files are not included unless your filespec
  2887.           explicitly mentions them.
  2888.  
  2889.    /NOBACKUPFILES
  2890.           Don't include files whose names end with .~nnn~, where nnn is a
  2891.           number, e.g. oofa.txt.~27~. These are backup files created by
  2892.           Kermit, EMACS, and other applications. By default, backup files
  2893.           are included.
  2894.  
  2895.    /NOFOLLOWLINKS
  2896.           (UNIX only) Skip over symbolic links rather than following them
  2897.           (default). This applies to wildcard and/or recursive [M]PUTs;
  2898.           if a single filename is given, and it happens to be a symbolic
  2899.           link, the file it points to is sent.
  2900.  
  2901.    /FOLLOWLINKS
  2902.           (UNIX only) Always follow (resolve) symbolic links, even in
  2903.           wildcard or recursive [M]PUTs. Use with caution. Watch out for
  2904.           circular links, endless loops, etc.
  2905.  
  2906.    /EXCEPT:pattern
  2907.           Exception list -- don't send files whose names match the given
  2908.           pattern. See [276]Section 1.5.4 of the [277]C-Kermit 7.0 Update
  2909.           Notes for details. If you want to exclude a directory from a
  2910.           recursive [M]PUT, use /EXCEPT:{dirname/*}.
  2911.  
  2912.    /RECURSIVE
  2913.           Sends the desired files from the current (or given) directory,
  2914.           plus all directories beneath it, including empty directories,
  2915.           replicating the directory structure on the server. No special
  2916.           capabilities are required in the server, but of course your
  2917.           login ID on the server must have the appropriate access and
  2918.           permission to create directories. Recursive PUTs work not only
  2919.           between like platforms (e.g. UNIX to UNIX) but also between
  2920.           unlike ones (e.g. UNIX to VMS or Windows), in which case
  2921.           text-file format differences are handled by Kermit's automatic
  2922.           text/binary mode switching ([278]Section 4) and character-set
  2923.           translation ([279]Section 3.7). Synonym: /SUBDIRECTORIES.
  2924.  
  2925.    /UPDATE
  2926.           Send only files that have changed since last time ([280]Section
  2927.           3.5.2).
  2928.  
  2929.    /ARRAY:arrayname
  2930.           The "file" to be sent is an array, or a segment of one, rather
  2931.           than a real file. In this case the other selection switches
  2932.           don't apply. The array contents are sent in text mode, and each
  2933.           array element is treated as a line. Example:
  2934.  
  2935.   ftp put /as-name:array.txt /array:&a
  2936.  
  2937.           (or, to send a segment of the array, /array:&a[100:199]). If
  2938.           you don't include an /AS-NAME, a name of "_array_x_" is used
  2939.           (where x is the array letter). If you include this switch, most
  2940.           other switches are meaningless and ignored.
  2941.  
  2942.    /COMMAND
  2943.           The "file" to be sent is the standard output of a command,
  2944.           rather than a real file. It is sent in text or binary mode
  2945.           according to the prevailing FTP TYPE, which can be overridden
  2946.           with a /TEXT or /BINARY switch. Example: Example:
  2947.  
  2948.   ftp put /command /as-name:{userlist} {finger | sort -r}
  2949.  
  2950.    /LISTFILE:filename
  2951.           Tells Kermit to obtain the list of files to be sent from the
  2952.           file whose name is given. This file must contain one file
  2953.           specification (which may be wild) per line. If the list
  2954.           includes files from different directories, such as a recursive
  2955.           listing of a directory tree, the paths are recreated on the
  2956.           server (if possible) if you include the /RECURSIVE switch;
  2957.           otherwise all the files are sent to the current directory on
  2958.           the server.
  2959.  
  2960.    Now the other switches:
  2961.  
  2962.    /AS-NAME:text
  2963.           If a single file is being sent, send it with the given text as
  2964.           its name. If multiple files are being sent, the text must be a
  2965.           template that includes variables such as \v(filename),
  2966.           \v(filenumber), \v(ntime), to allow dynamic creation of each
  2967.           name. The same applies to the as-name field of the FTP PUT
  2968.           command. If this switch is not included (and an as-name is not
  2969.           included as the second filename to PUT), each file is sent with
  2970.           its own name.
  2971.  
  2972.    /BINARY
  2973.    /TEXT
  2974.    /TENEX
  2975.           Forces this upload to take place in the given mode, regardless
  2976.           of the current FTP TYPE setting, and without automatic
  2977.           text/binary switching. /ASCII is a synonym for /TEXT.
  2978.  
  2979.    /FILTER:command
  2980.           Specifies that the file(s) is/are to be passed through the
  2981.           given command or pipeline on their way to the server. Example:
  2982.  
  2983.   ftp put /binary /filter:{gzip -c \v(filename)} /as-name:\v(filename).gz *
  2984.  
  2985.    /TRANSPARENT
  2986.    /LOCAL-CHARACTER-SET:name
  2987.    /SERVER-CHARACTER-SET:name
  2988.           Character-set translation for text files, explained in
  2989.           [281]Section 3.7.
  2990.  
  2991.    /ERROR-ACTION:{PROCEED,QUIT}
  2992.           Overrides the prevailing [282]FTP ERROR-ACTION for the duration
  2993.           of this PUT or MPUT command only.
  2994.  
  2995.    /RECOVER
  2996.           Resume an interrupted transfer where from the point of
  2997.           interruption (explained in [283]Section 3.5.2). Synonym:
  2998.           /RESTART.
  2999.  
  3000.    /DELETE
  3001.           Tells Kermit to delete each source file immediately after, and
  3002.           only if, it has been uploaded completely and successfully.
  3003.           This, in effect, moves the file from the client to the server.
  3004.  
  3005.    /MOVE-TO:directory
  3006.           Tells Kermit to move each source file to the named local
  3007.           directory after, and only if, it has been uploaded completely
  3008.           and successfully.
  3009.  
  3010.    /RENAME-TO:template
  3011.           Tells Kermit to rename each (local) source file according to
  3012.           the given template after, and only if, it has been uploaded
  3013.           completely and successfully. The template works as in /AS-NAME.
  3014.  
  3015.    /SERVER-RENAME-TO:template
  3016.           Tells Kermit to ask the server to rename each file according to
  3017.           the given template as soon as, and only if, it has been
  3018.           received completely and successfully. The template works as in
  3019.           /AS-NAME. Requires write and rename access on the server, so
  3020.           doesn't usually work with (e.g.) anonymous uploads to public
  3021.           incoming areas where the permissions don't allow renaming.
  3022.           Examples:
  3023.  
  3024.         ftp mput /server-rename:\v(filename).ok *
  3025.                 Appends ".ok" to each filename on the server when it's
  3026.                 finished uploading.
  3027.  
  3028.         ftp mput /as-name:\v(filename).tmp /server-rename:\v(filename) *
  3029.                 This is the reverse of the previous example; it uses a
  3030.                 temporary name while uploading is in progress and reverts
  3031.                 the file to its real name when uploading is complete.
  3032.  
  3033.         ftp mput /as-name:\v(filename)
  3034.                 /server-rename:../final/\v(filename) *
  3035.                 Moves the file from the working directory to a final
  3036.                 directory when the upload is complete, but in this case
  3037.                 you have to know the pathname syntax of the server. If
  3038.                 the rename fails, the [M]PUT command fails according to
  3039.                 the [284]FTP ERROR-ACTION selection.
  3040.  
  3041.    /FILENAMES:{AUTOMATIC,CONVERTED,LITERAL}
  3042.           Overrides the [285]FTP FILENAMES setting for this upload only.
  3043.  
  3044.    /PERMISSIONS:{ON,OFF}
  3045.           Overrides the [286]FTP PERMISSIONS setting for this upload
  3046.           only.
  3047.  
  3048.    /UNIQUE
  3049.           Tells Kermit to tell the server to give [287]unique names to
  3050.           incoming files that would otherwise overwrite existing files
  3051.           that have the same name. This switch conflicts with /UPDATE,
  3052.           /RECOVER, /PERMISSIONS, and /SERVER-RENAME since the client has
  3053.           no way of knowing the name assigned by the server.
  3054.  
  3055.    /QUIET
  3056.           Don't display file-transfer progress or statistics.
  3057.  
  3058.    /SIMULATE
  3059.           Shows which files would be sent without actually sending them.
  3060.           Useful (for example) with /UPDATE (next section). The results
  3061.           are shown in the file-transfer display (if it is not disabled)
  3062.           and in the transaction log (if one is active). Hint: use SET
  3063.           TRANSFER DISPLAY BRIEF.
  3064.      _________________________________________________________________
  3065.  
  3066.     3.5.2. Update Mode
  3067.  
  3068.    When you include the /UPDATE switch, this means to skip sending any
  3069.    file that already exists on the server if the local file's
  3070.    modification date/time is not later than that of the corresponding
  3071.    file on the server. Here is a typical application for update mode:
  3072.    Suppose that on Computer A, you maintain a large set of files (say, a
  3073.    collection of Web pages and graphics images, or the source files for a
  3074.    software application), and you need to keep a parallel copy on another
  3075.    Computer, B. Of course you could upload the entire collection every
  3076.    day:
  3077.  
  3078.   cd source-directory
  3079.   ftp computerb.xyzcorp.com
  3080.   ( authentication details... )
  3081.   ftp cd target-directory
  3082.   ftp put [ switches ] *
  3083.  
  3084.    But if the total size is large or the network slow, this would be
  3085.    unnecessarily time-consuming. Worse, if other users or sites had to
  3086.    update whenever new files appeared in B's directory, this would cause
  3087.    them unnecessary work. By including the /UPDATE switch:
  3088.  
  3089.   ftp put /update [ other-switches ] *
  3090.  
  3091.    only those files that changed since last time are uploaded. Here's how
  3092.    it works. For each local file that is selected for uploading:
  3093.  
  3094.      * The remote filename is determined in the normal way, according to
  3095.        the [288]FTP FILENAMES setting, /FILENAMES switch, or the as-name,
  3096.        if any.
  3097.      * Kermit sends an MDTM (modification time) command for the
  3098.        corresponding remote filename to the server.
  3099.      * If the server does not understand the MDTM command, the file is
  3100.        sent.
  3101.      * If the server can't find a file with the given name, the file is
  3102.        sent.
  3103.      * If the local file's modification time is later than that of the
  3104.        remote file, the file is sent.
  3105.      * Otherwise -- the remote file exists but its modification time is
  3106.        equal to or earlier than that of the local file -- the file is
  3107.        skipped.
  3108.  
  3109.    All time comparisons take place in Coordinated Universal Time
  3110.    (UTC)([289]1), also known as GMT or Zulu time: Timezone 0; standard
  3111.    time, without daylight savings.
  3112.  
  3113.      WARNING: Some FTP servers, such as Novell NWFTPD.NLM, ignore or
  3114.      misimplement the FTP specification and send local time rather than
  3115.      UTC.
  3116.  
  3117.    Update mode is useful only when always used in the same direction.
  3118.    When you upload (PUT) a file with FTP, the destination file receives
  3119.    the current timestamp on the server's computer, not the original
  3120.    file's timestamp ([290]2). If you try to FTP PUT /UPDATE the same file
  3121.    again, it will be skipped (as expected) since the remote copy is
  3122.    newer. However, if you try to FTP GET /UPDATE the same file
  3123.    ([291]Section 3.6), it will be transferred for the same reason.
  3124.  
  3125.    To check the availability of PUT /UPDATE on a particular connection,
  3126.    issue an FTP MODTIME command for a file that is known to exist on the
  3127.    server. If it succeeds, PUT /UPDATE should work and in that case, you
  3128.    can run a procedure like the one above every day: the first time, it
  3129.    sends all the files; after that, it sends only the ones that changed.
  3130.    If a transaction log is active, a notation is included for any files
  3131.    that are skipped.
  3132.  
  3133.    Notes:
  3134.     1. Why is Coordinated Universal Time abbreviated UTC? From the
  3135.        [292]National Institute of Standards and Technology FAQ: "In 1970
  3136.        the Coordinated Universal Time system was devised by an
  3137.        international advisory group of technical experts within the
  3138.        International Telecommunication Union (ITU). The ITU felt it was
  3139.        best to designate a single abbreviation for use in all languages
  3140.        in order to minimize confusion. Since unanimous agreement could
  3141.        not be achieved on using either the English word order, CUT, or
  3142.        the French word order, TUC, the acronym UTC was chosen as a
  3143.        compromise."
  3144.     2. The Kermit FTP client is unusual in that, when downloading only,
  3145.        it can set the received file's date from the file's date on the
  3146.        server, but this should not affect the update feature. When
  3147.        uploading to an FTP server, however, there is no mechanism for the
  3148.        client to set the date of the uploaded file on the server.
  3149.      _________________________________________________________________
  3150.  
  3151.     3.5.3 Recovery
  3152.  
  3153.    Suppose that while you are uploading a large file over a slow
  3154.    connection, the connection is lost before the entire file is
  3155.    transferred. With most FTP clients, you would have to start over, thus
  3156.    resending the portion of the file that was sent already, and that is
  3157.    already on the server. But Kermit's /RECOVER switch (Synonym:
  3158.    /RESTART) lets you continue an interrupted transfer from the point of
  3159.    failure, thus transferring only the part that wasn't sent already. The
  3160.    prerequisites for recovery are:
  3161.  
  3162.      * The transfer must be in BINARY mode, or else the client and server
  3163.        must reside on like systems (e.g. both on some form of UNIX).
  3164.      * The FTP server must support the SIZE command.
  3165.  
  3166.    Here's how it works. When you include the /RECOVER switch:
  3167.  
  3168.      * Kermit checks for conflicting switches, such as /UPDATE and
  3169.        /UNIQUE; if /RECOVER is given with these switches an error occurs.
  3170.        If /RECOVER is given in other circumstances where it could serve
  3171.        no useful purpose (e.g. with arrays, pipes, or filters), it is
  3172.        ignored.
  3173.  
  3174.    If the switch is accepted, then for each selected file:
  3175.  
  3176.      * If it is not binary (determined by scanning) and the client and
  3177.        server are not on like platforms, recovery is canceled (the entire
  3178.        file is sent). Otherwise:
  3179.      * A SIZE command is sent for the file (using its remote name). If
  3180.        the reply indicates the file was not found, or the SIZE command
  3181.        was not understood, or any other kind of error, recovery is
  3182.        canceled. Otherwise:
  3183.      * A MDTM (modification time) command is sent for the file. If a
  3184.        valid reply is received, and the modification time of the local
  3185.        file is later than that of the remote file, recovery is canceled.
  3186.        Otherwise:
  3187.      * If the sizes of the two files are identical, the file is not sent.
  3188.        Otherwise:
  3189.      * Kermit seeks to the recovery spot in the local file, tells the
  3190.        server to APPEND the data which is about to arrive to the remote
  3191.        file, and then sends the data starting at the recovery point.
  3192.  
  3193.    To safeguard file integrity, recovery is not attempted unless all the
  3194.    preconditions are met. For the widest possible usefulness, APPEND is
  3195.    used rather than RESTART. For stream transfers (the only kind that
  3196.    Kermit supports) the results are the same.
  3197.  
  3198.    By design, the /RECOVER switch can be included with any FTP PUT or
  3199.    MPUT command, even if it specifies a group of files. This allows you
  3200.    to resume an interrupted batch transfer from where it left off. The
  3201.    files that were already completely sent are skipped, the file that was
  3202.    interrupted is recovered, and the remaining files are uploaded.
  3203.  
  3204.    By the way, it doesn't matter how the original partial file was
  3205.    uploaded -- FTP, Kermit, Zmodem, etc: as long as the preconditions are
  3206.    met, it can be recovered with FTP PUT /RECOVER, or for that matter
  3207.    also using Kermit protocol and SEND /RECOVER.
  3208.  
  3209.    A word of caution, however, when the original upload was in text mode
  3210.    with character-set translation ([293]Section 3.7):
  3211.  
  3212.      * If the original upload involved a translation from one single-byte
  3213.        character set to another (e.g. Code Page 850 to Latin-1), recovery
  3214.        is safe if you specify the same translations for the recovery. If
  3215.        you don't, the resulting file will contain a mixture of character
  3216.        sets.
  3217.      * If the original upload involved a translation that changed the
  3218.        size of the file (e.g. from an alphabetic Code Page or Latin
  3219.        Alphabet to Unicode, or vice versa), recovery is NOT safe, even if
  3220.        you specify the same translations.
  3221.  
  3222.    Kermit has no way of knowing anything about the previous upload. As a
  3223.    safeguard, an error occurs if you include /RECOVER and also specify a
  3224.    character-set of UCS2 or UTF8, since recovery can't possibly work in
  3225.    that situation. Otherwise, it's up to you to avoid unsafe recovery
  3226.    operations.
  3227.  
  3228.    [ [294]Top ] [ [295]FTP Top ] [ [296]C-Kermit Home ] [ [297]Kermit
  3229.    Home ]
  3230.      _________________________________________________________________
  3231.  
  3232.   3.6. Downloading Files With FTP
  3233.  
  3234.    Although uploading files with Kermit's FTP client is just as easy and
  3235.    flexible as sending files with Kermit protocol, the same is not always
  3236.    true for downloading because FTP servers lack some of the capabilities
  3237.    of a Kermit server:
  3238.  
  3239.      * If you want to get more than one file, you have to use MGET, not
  3240.        GET, since the underlying FTP protocol is different in the two
  3241.        cases. Kermit can't "autodetect" which one you mean, as it can
  3242.        with PUT and MPUT, since it can't be expected to know the wildcard
  3243.        syntax of the remote platform and/or FTP server (the same is true
  3244.        for all other FTP clients). To complicate matters, FTP protocol
  3245.        now includes two underlying mechanisms (NLST and MLSD) for
  3246.        accomplishing MGET operations and, as explained in [298]Section
  3247.        3.11, the two behave differently.
  3248.      * Automatic text-binary mode switching is not done by the server. It
  3249.        can be done by the client (Kermit), but in this case it is not
  3250.        based on a file scan (since there is no way for Kermit prescan a
  3251.        server file), but rather on the filename, using C-Kermit 7.0
  3252.        [299]filename patterns.
  3253.      * Some options that are available with FTP PUT can not be used with
  3254.        FTP [M]GET or don't work the same way:
  3255.          /PERMISSIONS (FTP protocol has no mechanism for this).
  3256.          /[NOT-]BEFORE, /[NOT-]AFTER (because of the timezone problem).
  3257.          /RECOVER works only in binary mode.   /RECURSIVE has limited
  3258.        utility.
  3259.  
  3260.    The commands for downloading are:
  3261.  
  3262.    SET FILE DOWNLOAD-DIRECTORY [ directory ]
  3263.           As with Kermit transfers, this command, if given, tells
  3264.           C-Kermit where to store incoming files in the absence of a
  3265.           specific as-name. If not given, incoming files are stored as
  3266.           indicated by the as-name, if any, otherwise in the current
  3267.           directory, just as with Kermit transfers. The more verbose
  3268.           transfer display formats give the full pathname of each
  3269.           received file, and, in case you have trouble finding a
  3270.           downloaded file afterwards, its full path is also listed in the
  3271.           transaction log (if you kept one), and you can also ask Kermit
  3272.           where it went with the [300]WHERE command.
  3273.  
  3274.    SET FTP GET-FILETYPE-SWITCHING { ON, OFF }
  3275.           ON by default, causing Kermit to switch automatically into text
  3276.           or binary mode for each file based on whether its name matches
  3277.           a text pattern or binary pattern. Set this OFF, or use a /TEXT,
  3278.           /BINARY, or /TENEX switch to defeat this feature. Use SHOW
  3279.           PATTERNS to see the current pattern list.
  3280.  
  3281.    [ FTP ] GET [ switches ] filename [ as-name ]
  3282.           Asks the server to send the given file, and if it comes, stores
  3283.           it locally under the given as-name, if any, otherwise under its
  3284.           original name (modified according to the selected filename
  3285.           conversion option), in your download directory, if you have
  3286.           specified one, otherwise in the directory indicated in the
  3287.           as-name, if any, otherwise in your current directory. If you
  3288.           accidentally use a wildcard in the filename ("get *.txt") the
  3289.           server will reply with a message like "File not found" (unless
  3290.           there is a file whose name actually is "*.txt"). If FTP
  3291.           GET-FILETYPE-SWITCHING is ON, and in the absence of any GET
  3292.           switches to override it, the file is transferred in binary mode
  3293.           if it matches any of Kermit's binary name patterns, and in text
  3294.           mode if it matches any of Kermit's text name patterns, and in
  3295.           the prevailing FTP TYPE if it matches none of these patterns.
  3296.  
  3297.    [ FTP ] MGET [ switches ] filespec [ filespec [ filespec [ ... ] ] ]
  3298.           Like GET, but for multiple files. One or more file
  3299.           specifications can be given, and any or all (or none) of them
  3300.           can contain wildcards or can be directory names. The file list
  3301.           may not include an as-name, but you can still give one with the
  3302.           /AS-NAME: switch.
  3303.  
  3304.    In both the FTP GET and MGET commands, any filenames that contain
  3305.    spaces must be enclosed in braces or doublequotes (see [301]Section 5
  3306.    for details).
  3307.  
  3308.    FTP downloads may be interrupted just like Kermit transfers. While the
  3309.    transfer is in progress, type:
  3310.  
  3311.      * X to interrupt the current file and go on to the next file.
  3312.      * Z (or Control-C) to cancel the current file and all remaining
  3313.        files.
  3314.  
  3315.    Before proceeding, a brief word about temporary files. In FTP
  3316.    protocol, the MGET command works by requesting a file list from the
  3317.    server, and then (internally) issuing a GET command (FTP RETR protocol
  3318.    directive) for each file. The file list returned by the server can be
  3319.    any size at all, so in case it is huge, we don't store it in memory;
  3320.    instead we put it in a temporary file. For troubleshooting purposes,
  3321.    you should be aware of two points:
  3322.  
  3323.     1. The location of the temporary file is chosen according the TMP or
  3324.        TEMP environment variables. If neither of these variables is
  3325.        defined, you might need to define it. In case there is not enough
  3326.        space on the indicated disk or partition for the server's file
  3327.        list, you might need to either clean up the temporary area, or
  3328.        redefine the environment variable to indicate a different area
  3329.        that has sufficient space.
  3330.     2. If you want to look at the list yourself, use SET FTP DEBUG ON.
  3331.        This tells Kermit to (a) give you the full pathname of the
  3332.        temporary file at the end of each MGET command, and (b) not to
  3333.        delete it, as it normally does.
  3334.      _________________________________________________________________
  3335.  
  3336.     3.6.1. FTP GET Switches
  3337.  
  3338.    The following switches are available with FTP GET and MGET:
  3339.  
  3340.    /TEXT
  3341.           Specifies a text-mode transfer. Overrides the global FTP TYPE
  3342.           setting and filename pattern-matching for the duration of the
  3343.           current command only, All files are downloaded in text mode.
  3344.           Synonym: /ASCII.
  3345.  
  3346.    /BINARY
  3347.           Specifies a binary-mode transfer. Overrides the global FTP TYPE
  3348.           setting and filename pattern-matching for the duration of the
  3349.           current command only. All files are downloaded in binary mode.
  3350.  
  3351.    /TENEX
  3352.           Like /BINARY but specifies a special binary transfer mode to be
  3353.           used when getting 8-bit binary files from a 36-bit platform
  3354.           such as TOPS-10, TOPS-20, or TENEX. All files are downloaded in
  3355.           the special binary mode.
  3356.  
  3357.    /RECOVER
  3358.           This instructs Kermit to try to recover an incomplete download
  3359.           from the point of failure. Works only in binary mode, and only
  3360.           if the server supports the (not-yet-standard) FTP "REST"
  3361.           directive. See [302]Section 3.6.3 for details. Synonym:
  3362.           /RESTART.
  3363.  
  3364.    /FILENAMES:{CONVERTED,LITERAL}
  3365.           Overrides the [303]FTP FILENAMES (filename conversion) setting
  3366.           for this download only, forcing incoming filenames to be either
  3367.           converted or taken literally.
  3368.  
  3369.    /AS-NAME:text
  3370.           For GET, this is equivalent to giving an as-name after the
  3371.           filename. For MGET, this is the only way to specify alternative
  3372.           names for the incoming files. With MGET, the /AS-NAME text
  3373.           should (must) contain a Kermit variable, usually \v(filename)
  3374.           or \v(filenumber). Example:
  3375.  
  3376.   mget /text /as-name:\v(filename).new *.c
  3377.  
  3378.           This gets all ".c" files and stores them with "
  3379.  
  3380.           .new" appended to their names. See the [304]C-Kermit 7.0 Update
  3381.           Notes for details.
  3382.  
  3383.    /COMMAND
  3384.           This specifies that the incoming file is to be written to the
  3385.           standard input of a command, rather than to a file. The command
  3386.           name is the as-name from the GET command or the /AS-NAME
  3387.           argument. If you need to refer to the incoming file's name in
  3388.           the command, use \v(filename). See the description of the
  3389.           regular Kermit [305]GET /COMMAND command for details and
  3390.           examples.
  3391.  
  3392.    /QUIET
  3393.           Transfers the files quietly; don't put up a file-transfer
  3394.           display.
  3395.  
  3396.    /ERROR-ACTION:{QUIT,PROCEED}
  3397.           This switch affects only MGET. If an error occurs with a
  3398.           particular file, this tells whether to go on to the next file
  3399.           (PROCEED) or to stop right away and fail (QUIT). The default is
  3400.           PROCEED.
  3401.  
  3402.    The file selection switches are:
  3403.  
  3404.    /EXCEPT:{pattern} or /EXCEPT:{{pattern}{pattern}{...}}
  3405.           Exception list for MGET; skip downloading any file whose name
  3406.           matches any of the given patterns (when using the second
  3407.           format, up to 64 patterns may be specified). [306]CLICK HERE
  3408.           for syntax details.
  3409.  
  3410.    /SMALLER-THAN:number
  3411.           Download only files whose size is smaller than the given number
  3412.           of bytes (octets). Requires that the FTP server support the
  3413.           SIZE or MLSD directive.
  3414.  
  3415.    /LARGER-THAN:number
  3416.           Download only files whose size is greater than the given number
  3417.           of bytes. Requires that the FTP server support the SIZE or MLSD
  3418.           directive.
  3419.  
  3420.    /NOBACKUPFILES
  3421.           During MGET, don't download any files whose names end with
  3422.           backup suffixes (.~n~ where n is a number).
  3423.  
  3424.    /NODOTFILES
  3425.           During MGET, don't download any files whose names begin with
  3426.           period (.). Equivalent to /EXCEPT:{.*}.
  3427.  
  3428.    /LISTFILE:local-filename
  3429.           The given file contains a list of files to GET, one per line.
  3430.           Filenames in the listfile can contain wildcard characters in
  3431.           the syntax of the server. There is no limit on the number of
  3432.           lines in the listfile.
  3433.  
  3434.    /NAMELIST:local-filename
  3435.           If this switch is given, then instead of actually retrieving
  3436.           the selected files, the GET command retrieves a list of the
  3437.           names of the files that would be retrieved, and places it in
  3438.           the specifed file. The resulting file is an ordinary text file,
  3439.           with one filename per line, suitable for reading by a person,
  3440.           or processing by a computer program, including Kermit itself
  3441.           (FOPEN / FREAD / FWRITE / FCLOSE), and as /FILELIST: file. If
  3442.           the filename is omitted or given as "-" (dash, hyphen), the
  3443.           list goes to the screen. NOTE: if you want a copy of the
  3444.           complete list sent by the server, use SET FTP DEBUG ON, perform
  3445.           an MGET, and the temporary file containing the list will be
  3446.           kept rather than deleted (and Kermit tells you its name).
  3447.  
  3448.    /UPDATE, /COLLISION:keyword
  3449.           Explained in [307]Section 3.6.2.
  3450.  
  3451.    /RECURSIVE
  3452.           This means to try to download an entire directory tree, rather
  3453.           than just files from a particular directory. In fact, FTP
  3454.           protocol does not provide a method to request a recursive
  3455.           download (unless the server supports MLSD; see [308]Section
  3456.           3.11), so this works only if the FTP server does it anyway,
  3457.           without being asked, as some do. In this case, Kermit detects
  3458.           that names in the returned file list contain directory
  3459.           separators, and therefore attempts to create the needed
  3460.           directories as the files arrive. But this can work only if the
  3461.           server is on the same kind of platform as the client, so the
  3462.           pathname syntax can be recognized, and also because the server
  3463.           does not switch between text and binary mode, which would be
  3464.           vital for cross-platform transfers. Use with caution. Synonym:
  3465.           /SUBDIRECTORIES.
  3466.  
  3467.           Even when the server does not provide recursive file lists,
  3468.           [M]GET /RECURSIVE forces Kermit to replicate any directory
  3469.           structure implied or expressed by the server's file list. For
  3470.           example:
  3471.  
  3472.   get somepath/somefile
  3473.  
  3474.           Gets the file named somefile from the server's somepath
  3475.           directory and puts it Kermit's current (or download) directory,
  3476.           whereas:
  3477.  
  3478.   get /recursive somepath/somefile
  3479.  
  3480.           creates the path locally and then puts the file in it.
  3481.           Similarly for MGET:
  3482.  
  3483.   mget */data/*
  3484.  
  3485.           downloads all the files in all the data subdirectories of all
  3486.           the subdirectories of the server's current directory and stores
  3487.           them locally in Kermit's current (or download) directory,
  3488.           whereas:
  3489.  
  3490.   mget /recursive */data/*
  3491.  
  3492.           re-creates the server's directory structure locally.
  3493.  
  3494.    The FTP protocol does not include explicit mechanisms for recursion,
  3495.    so Kermit builds upon what is available. Although an Internet draft
  3496.    describes a mechanism ("MLSD") that would allow protocol-driven
  3497.    recursion, similar to Kermit's File Attribute packets (circa 1984), it
  3498.    has not yet attained RFC or standard status, and servers are not yet
  3499.    widely available that offer this feature. In the meantime, the
  3500.    effectiveness of MGET /RECURSIVE depends on the FTP server
  3501.    implementation. If the server returns a recursive list in response to
  3502.    the standard NLST command (whose behavior is ill-defined), Kermit's
  3503.    FTP MGET /RECURSIVE command uses it to re-create the remote directory
  3504.    tree locally. If the server supports MLSD, C-Kermit 8.0.206 and Kermit
  3505.    95 2.1 and later are able to sense it automatically and use it, as
  3506.    described below in [309]Section 3.11.
  3507.  
  3508.    The /BEFORE:, /AFTER:, /NOT-BEFORE:, and /NOT-AFTER: switches are not
  3509.    available for downloading because of the confusion with timezones.
  3510.    Would the given times be in the local timezone, the server's timezone,
  3511.    or GMT? The FTP server's directory listings show its own local times
  3512.    but since we don't know what timezone the server is in, there's no way
  3513.    to reconcile our local times with the server's. Similarly,
  3514.    /PERMISSIONS can't be preserved in downloads because FTP protocol
  3515.    provides no means of querying the server for a file's permission.
  3516.  
  3517.    Source-file disposition switches:
  3518.  
  3519.    /DELETE
  3520.           Each file that is downloaded successfully is to be deleted from
  3521.           the server. Requires the appropriate file access rights on the
  3522.           server.
  3523.  
  3524.    /SERVER-RENAME-TO:template
  3525.           Asks the server to rename each (remote) source file immediately
  3526.           after, and only if, it is sent correctly. See [310]PUT
  3527.           /SERVER-RENAME-TO: for details.
  3528.  
  3529.    Destination-file disposition switches:
  3530.  
  3531.    /TO-SCREEN
  3532.           Displays the incoming file on the screen rather than storing it
  3533.           on disk. If this switch is given, the /RENAME-TO and /MOVE-TO
  3534.           switches are ignored, the file-transfer display is suppressed,
  3535.           and the given file(s) is/are shown on the screen. Can be used
  3536.           with /FILTER, e.g.
  3537.  
  3538.   get /text /to-screen /filter:more oofa.txt
  3539.  
  3540.           In fact, you should always use /TO-SCREEN with /FILTER or
  3541.           /COMMAND when the command would result in displaying the
  3542.           incoming file on the screen; otherwise C-Kermit would have no
  3543.           way of knowing to suppress its file transfer display (since it
  3544.           can't be expected to know what the command or filter does).
  3545.  
  3546.    /RENAME-TO:template
  3547.           Each file that is downloaded is to be renamed as indicated if
  3548.           and only if it was received completely and without error. The
  3549.           template can be literal text or can contain variables that are
  3550.           evaluated for each file. For MGET, the text must contain
  3551.           variables; for GET it can be a literal string. The \v(filename)
  3552.           variable contains the name of the current file, so:
  3553.  
  3554.   ftp mget /rename-to:\v(filename).ok *
  3555.  
  3556.           causes each file that is successfully downloaded to have ".ok"
  3557.           appended to its name. For details see [311]Section 4.1 of the
  3558.           [312]C-Kermit 7.0 Update Notes.
  3559.  
  3560.    /MOVE-TO:text
  3561.           Just like /RENAME-TO:, except the text denotes the name of a
  3562.           directory to which successfully downloaded files are to be
  3563.           moved. If the directory does not exist, it is created.
  3564.  
  3565.    The file transfer display does not show the /MOVE-TO or /RENAME-TO
  3566.    value, since the incoming file has not yet been moved or renamed.
  3567.      _________________________________________________________________
  3568.  
  3569.     3.6.2. Filename Collisions
  3570.  
  3571.    What should happen if an incoming file has the same name as an
  3572.    existing file in the same directory? By default, Kermit's FILE
  3573.    COLLISION setting applies: BACKUP, RENAME, UPDATE, DISCARD, etc, as
  3574.    described in [313]Using C-Kermit. Kermit's default FILE COLLISION
  3575.    setting is BACKUP (rename the existing file and store the incoming
  3576.    file under its own name) and therefore this is also the default FTP
  3577.    collision action.
  3578.  
  3579.    The name under which an incoming file is to be stored is determined as
  3580.    follows:
  3581.  
  3582.      * If an as-name was given, the as-name is used. Otherwise:
  3583.      * If the client and server platforms are alike or [314]FTP FILENAMES
  3584.        is set to LITERAL (or the /FILENAMES:LITERAL switch was given for
  3585.        this download), the incoming filename is used literally.
  3586.        Otherwise:
  3587.      * The incoming filename is converted to a form that is friendly to
  3588.        the local platform. For UNIX, for example, incoming filenames that
  3589.        are all uppercase (as they might be from, say, VMS or an IBM
  3590.        mainframe) are converted to lowercase.
  3591.  
  3592.    If the resulting name coincides with the name of a local file that
  3593.    already exists, we have a filename collision. Collisions are handled
  3594.    according to the currently selected collision action:
  3595.  
  3596.    SET FTP COLLISION { BACKUP, RENAME, UPDATE, DISCARD, APPEND, OVERWRITE
  3597.           }
  3598.           This establishes a filename collision for FTP, separate from
  3599.           the Kermit one. The initial FTP collision setting is inherited
  3600.           from Kermit's FILE COLLISION setting when the first FTP command
  3601.           is given, but subsequent changes to Kermit's FILE COLLISION
  3602.           setting do not affect the FTP COLLISION setting. SHOW FTP tells
  3603.           the current FTP COLLISION setting.
  3604.  
  3605.    FTP GET /COLLISION:{BACKUP,RENAME,UPDATE,DISCARD,APPEND,OVERWRITE}
  3606.           Overrides the current FTP COLLISION action for this download
  3607.           only.
  3608.  
  3609.    FTP GET /UPDATE
  3610.           This is equivalent to GET /COLLISION:UPDATE, and is included
  3611.           for symmetry with PUT /UPDATE
  3612.  
  3613.    FTP GET /UPDATE and /COLLISION:UPDATE mean to download only those
  3614.    files whose modification dates on the server are later than those on
  3615.    the client. Date-time comparisons are done in Coordinated Universal
  3616.    Time (UTC, GMT, ZULU). The command:
  3617.  
  3618.      FTP MGET /COLLISION:APPEND /AS-NAME:newfilename *.*
  3619.  
  3620.    Downloads all matching remote files into a single local file (in
  3621.    whatever order the server sends them).
  3622.      _________________________________________________________________
  3623.  
  3624.     3.6.3. Recovery
  3625.  
  3626.    Recovery is available for downloads too, but there are some
  3627.    differences from the uploading case described in [315]Section 3.5.3:
  3628.  
  3629.      * The transfer must be in BINARY mode. It can not be in text mode,
  3630.        even if the FTP server is on the same kind of platform as Kermit,
  3631.        and even if there is no character-set translation. The original
  3632.        download must also have been in binary mode.
  3633.      * The FTP server must support the REST ("restart") directive.
  3634.        Unfortunately, this is not a standard command; at this writing, it
  3635.        is described only in an Internet Draft, not an RFC or Internet
  3636.        Standard, but nevertheless it is found in several popular FTP
  3637.        servers, such as [316]ProFTPD.
  3638.  
  3639.    Here's how download recovery works:
  3640.  
  3641.      * Kermit checks for conflicting switches, such as /UPDATE, /COMMAND,
  3642.        or /FILTER. If /RECOVER is given with these switches an error
  3643.        occurs.
  3644.      * The prevailing transfer mode (SET FTP TYPE) must be BINARY. If it
  3645.        is not, the /BINARY switch must have been included with the FTP
  3646.        [M]GET command.
  3647.  
  3648.    If the /RECOVER switch is accepted, then for each selected file:
  3649.  
  3650.      * A SIZE command is sent for the file (using its remote name). If
  3651.        the reply indicates the file was not found, or the SIZE command
  3652.        was not understood, or any other kind of error, recovery is
  3653.        canceled (i.e. the entire file is downloaded).
  3654.      * If the sizes of the two files are identical, the file is not sent.
  3655.        Otherwise:
  3656.      * Kermit sends the REST directive to the server, indicating the size
  3657.        of the local file. If the server responds affirmatively, Kermit
  3658.        opens the local file in append mode and appends the incoming data
  3659.        to it. Otherwise, recovery is canceled and the entire file is
  3660.        downloaded.
  3661.  
  3662.    The /RECOVER switch can be included with any FTP GET or MGET command,
  3663.    even if it specifies a group of files. This lets you resume an
  3664.    interrupted batch transfer from where it left off. The files that were
  3665.    already completely sent are skipped, the file that was interrupted is
  3666.    recovered, and the remaining files are uploaded. BUT... unlike with
  3667.    uploading, where this can be done with any mixture of text and binary
  3668.    files, when downloading, it can only be done if all the files are
  3669.    binary.
  3670.  
  3671.    It doesn't matter how the original partial file was downloaded -- FTP,
  3672.    Kermit, HTTP, Zmodem, etc: as long as the preconditions are met, it
  3673.    can be recovered with FTP [M]GET /RECOVER, or for that matter also
  3674.    with GET /RECOVER (using Kermit protocol).
  3675.  
  3676.    [ [317]Top ] [ [318]FTP Top ] [ [319]C-Kermit Home ] [ [320]Kermit
  3677.    Home ]
  3678.      _________________________________________________________________
  3679.  
  3680.   3.7. Translating Character Sets
  3681.  
  3682.    A possibly unique feature of Kermit's FTP client is its ability to
  3683.    convert character sets when transferring files in text mode,
  3684.    independent of the capabilites of the FTP server, as well as to
  3685.    translate the character sets of filenames regardless of transfer mode.
  3686.    For compatibility with existing FTP clients, and because there is a
  3687.    certain performance penalty, Kermit won't do this unless you ask for
  3688.    it. If you enable this feature, you need to inform Kermit of the
  3689.    character set (to be) used on the server and in some cases (explained
  3690.    below) also the local file character set. This discussion assumes you
  3691.    know a bit about character sets (as you must if you have to use them);
  3692.    see Chapter 16 of [321]Using C-Kermit for a detailed treatment. The
  3693.    Kermit commands for FTP character-set conversion are:
  3694.  
  3695.    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
  3696.           Whether to translate character sets when transferring text
  3697.           files with FTP. OFF by default. Set this to ON to enable
  3698.           character-set translation for subsequent FTP uploads and
  3699.           downloads.
  3700.  
  3701.    SET FTP SERVER-CHARACTER-SET [322]name
  3702.           Text character set (to be) used by the server. Most FTP servers
  3703.           are ignorant of character sets, so all translations are done
  3704.           unilaterally by Kermit's FTP client. This means that when
  3705.           downloading files, you must know in advance the character-set
  3706.           used in the files you are downloading (and in their names).
  3707.           When uploading, you must specify the character-set to which
  3708.           local filenames and text-file contents are to be translated for
  3709.           transmission to the server. If you SET FTP
  3710.           CHARACTER-SET-TRANSLATION ON but do not specify an FTP
  3711.           SERVER-CHARACTER-SET, [323]UTF8 is used, since this is the new
  3712.           Internet standard international character set; it is upwards
  3713.           compatible with ASCII and it encompasses most written languages
  3714.           and therefore does not favor any particular group of people, as
  3715.           any other default would do. If you SET FTP SERVER-CHARACTER-SET
  3716.           to something (anything) when FTP CHARACTER-SET TRANSLATION is
  3717.           OFF, this also sets the latter ON.
  3718.  
  3719.    SET FILE CHARACTER-SET [324]name
  3720.           This is the regular Kermit (non-FTP-specific) command for
  3721.           identifying the character set (to be) used in local text files
  3722.           and filenames.
  3723.  
  3724.    TO REITERATE: If you SET FTP CHARACTER-SET TRANSLATION ON but do not
  3725.    specify an FTP SERVER-CHARACTER-SET, outbound text files are converted
  3726.    to UTF-8 and inbound text files are assumed to be UTF-8. If this is
  3727.    not appropriate, be sure to also specify the desired FTP
  3728.    SERVER-CHARACTER-SET.
  3729.  
  3730.    You can use "special" (non-ASCII) characters in filenames in all the
  3731.    client / server file management commands (FTP MKDIR, RMDIR, DIRECTORY,
  3732.    VDIRECTORY, DELETE, etc), and also in file-transfer commands. When
  3733.    giving commands such as FTP DIR (RDIR) and FTP PWD (RPWD), the reply
  3734.    is translated too, so you can read it. In this example, the client and
  3735.    server use entirely different codes to represent the special
  3736.    characters of German:
  3737.  
  3738.   C-Kermit> ftp xyzcorp.de /anonymous
  3739.   C-Kermit> set ftp server-character-set latin1
  3740.   C-Kermit> set file character-set german
  3741.   C-Kermit> rcd StΣdte
  3742.   C-Kermit> rpwd
  3743.   "/pub/ftp/StΣdte is current directory"
  3744.   C-Kermit> rdir
  3745.   -rw-rw----  1 olaf     54018 Jan  6 17:58 Adenbⁿttel.txt
  3746.   -rw-rw----  1 ursula     373 Jan  5 15:19 A▀lar.txt
  3747.   -rw-rw----  1 gisbert    482 Jan  5 15:20 Blowatz.txt
  3748.   -rw-rw----  1 gudrun     124 Jan  5 15:19 B÷blingen.txt
  3749.   -rw-rw----  1 olga     14348 Jan  7 14:23 K÷ln.txt
  3750.  
  3751.    When the client and server file systems use different character sets,
  3752.    you should take care to use only those characters that the two sets
  3753.    share in common when creating filenames or text-file contents. For
  3754.    example, PC code pages contain a lot line- and box-drawing characters,
  3755.    and sometimes "smart quotes", etc, that are not found in ISO standard
  3756.    8-bit character sets. You should be especially careful to avoid using
  3757.    such characters in filenames.
  3758.  
  3759.    [ [325]C-Kermit Character Sets ]
  3760.      _________________________________________________________________
  3761.  
  3762.     3.7.1. Character Sets and Uploading
  3763.  
  3764.    Kermit's PUT and MPUT commands include full file-scanning
  3765.    capabilities, as described in [326]Section 4. Thus if FTP
  3766.    CHARACTER-SET-TRANSLATION is ON and your character-set associations
  3767.    are set up appropriately, Kermit automatically switches on a per-file
  3768.    basis between text and binary mode, and for each text file between
  3769.    your chosen 7-bit text character set (e.g. ASCII or ISO 646 German),
  3770.    8-bit text (e.g. Latin-1 or Japanese EUC), UCS-2, and UTF-8, and
  3771.    converts each of these automatically to the server character-set, and
  3772.    furthermore automatically differentiates between the Little and Big
  3773.    Endian forms of UCS-2, always sending in Big Endian form.
  3774.  
  3775.      WARNING: It is not advisable to use UCS-2 (or any Unicode
  3776.      transformation other than UTF-8) "on the wire", i.e. as a server
  3777.      character set. Most FTP servers are not able to cope with it, since
  3778.      it contains lots of 0 (NUL) characters. If you do use it, Kermit
  3779.      does not translate filenames to or from UCS-2, for reasons well
  3780.      known to C programmers (for example, UNIX APIs assume filename
  3781.      strings are NUL-terminated). [327]UTF-8 is the preferred (and
  3782.      standard) Unicode format for the Internet.
  3783.  
  3784.    FTP character-set translations differ from the regular Kermit ones by
  3785.    not restricting translations to a file-character-set /
  3786.    transfer-character-set pair. You can have Kermit's FTP client
  3787.    translate between any pair of character sets it knows about. You can
  3788.    see the list of supported character sets by typing either of the
  3789.    following:
  3790.  
  3791.   set ftp server-character-set ?
  3792.   set file character-set ?
  3793.  
  3794.    A typical list looks like this ([328]CLICK HERE for an explanation of
  3795.    the names):
  3796.  
  3797.   C-Kermit>set file char ? One of the following:
  3798.    ascii            cp869-greek       hebrew-7         mazovia-pc
  3799.    british          cyrillic-iso      hebrew-iso       next-multinational
  3800.    bulgaria-pc      danish            hp-roman8        norwegian
  3801.    canadian-french  dec-kanji         hungarian        portuguese
  3802.    cp1250           dec-multinational iso2022jp-kanji  shift-jis-kanji
  3803.    cp1251-cyrillic  dg-international  italian          short-koi
  3804.    cp1252           dutch             jis7-kanji       spanish
  3805.    cp437            elot927-greek     koi8             swedish
  3806.    cp850            elot928-greek     koi8r            swiss
  3807.    cp852            euc-jp            koi8u            ucs2
  3808.    cp855-cyrillic   finnish           latin1-iso       utf8
  3809.    cp858            french            latin2-iso
  3810.    cp862-hebrew     german            latin9-iso
  3811.    cp866-cyrillic   greek-iso         macintosh-latin
  3812.   C-Kermit>
  3813.  
  3814.    Thus you can translate not only between private sets (like PC code
  3815.    pages) and standard ones (like Latin-1) as in Kermit protocol, but
  3816.    also between any given pair of private sets (e.g. CP852 and Mazovia).
  3817.    All conversions go through Unicode as the intermediate character set,
  3818.    resulting in a minimum of character loss, since Unicode is a superset
  3819.    of all other character sets known to Kermit.
  3820.  
  3821.    In addition to the SET commands listed above, the FTP PUT and MPUT
  3822.    commands include switches that apply only to the current command:
  3823.  
  3824.    /LOCAL-CHARACTER-SET:name
  3825.    /SERVER-CHARACTER-SET:name
  3826.           Use these switches to force a particular translation. These
  3827.           switches override the global FTP CHARACTER-SET-TRANSLATION and
  3828.           SERVER-CHARACTER-SET settings and also character-set
  3829.           differentiation by file scanning for the duration of the PUT or
  3830.           MPUT command. The file scan is still performed, however, to
  3831.           determine whether the file is text or binary; thus these
  3832.           switches do not affect binary files unless you also include the
  3833.           /TEXT switch to force all files to be treated as text.
  3834.  
  3835.    In other words, if you include one or both of these switches with a
  3836.    PUT or MPUT command, they are used. Similarly, the /TRANSPARENT switch
  3837.    disables character-set translation for the PUT or MPUT command despite
  3838.    the prevailing FTP CHARACTER-SET-TRANSLATION and SERVER-CHARACTER-SET
  3839.    settings.
  3840.  
  3841.    When uploading, the FILE CHARACTER-SET setting is ignored unless you
  3842.    have forced Kermit not to [329]scan local files by including a /TEXT
  3843.    or /BINARY switch with your [M]PUT command, or by disabling automatic
  3844.    text/binary switching in some other way.
  3845.  
  3846.    Examples:
  3847.  
  3848.     1. Suppose you have a CP852 (East European) text file that you want
  3849.        to upload and store in ISO Latin Alphabet 2 encoding:
  3850.   ftp put /local-char:cp852 /server-char:latin2 magyar.txt
  3851.     2. Suppose you always want your text files converted to Latin-2 when
  3852.        uploading with FTP. Then put:
  3853.   set ftp server-character-set latin2
  3854.        in your Kermit customization file, and then you can omit the
  3855.        /SERVER-CHARACTER-SET: switch from your FTP PUT commands:
  3856.   ftp put /local-char:cp852 magyar.txt
  3857.     3. Now suppose that all the text files on your PC are written in
  3858.        Hungarian, but they have a variety of encodings, and you don't
  3859.        want to have to include the /LOCAL-CHARACTER-SET: switch on every
  3860.        FTP PUT command, or (more to the point) you want to be able to
  3861.        send a mixture of these files all at once. Put these commands in
  3862.        your Kermit customization file:
  3863.   set ftp server-character-set latin2            ; ISO 8859-2
  3864.   set file default 7-bit-character-set hungarian ; ISO 646 Hungarian
  3865.   set file default 8-bit-character-set cp852     ; PC East European Code Page
  3866.        and now PUT and MPUT will automatically detect and switch among
  3867.        ISO 646 Hungarian, Code Page 852, UTF-8, and UCS-2 encodings,
  3868.        translating each one to Latin-2 for uploading:
  3869.   ftp put *.txt
  3870.  
  3871.    And since binary files are also detected automatically, the latter can
  3872.    be simplified to:
  3873.  
  3874.   ftp put *
  3875.  
  3876.    even when "*" matches a diverse collection of binary and text files,
  3877.    because translations are skipped automatically for binary files.
  3878.      _________________________________________________________________
  3879.  
  3880.     3.7.2. Character Sets and Downloading
  3881.  
  3882.    The commands and switches are the same as for uploading, but automatic
  3883.    character-set switching works differently, since Kermit can't scan the
  3884.    server files in advance. Instead, the transfer mode (text or binary)
  3885.    is based on the filenames; each name is compared with Kermit's list of
  3886.    text name patterns and binary name patterns. If the name matches a
  3887.    binary pattern (for example, if the filename is oofa.tar.gz and one of
  3888.    the filename patterns is "*.gz"), the file is downloaded in binary
  3889.    mode; otherwise if it matches a text pattern (e.g. oofa.txt matches
  3890.    "*.txt"), it is transferred in text ("ascii") mode. Otherwise, it is
  3891.    transferred in the prevailing FTP TYPE.
  3892.  
  3893.    In C-Kermit 8.0, the pattern lists used with FTP GET are not the same
  3894.    lists used with Kermit transfers, and can not be viewed with SHOW
  3895.    PATTERNS, nor adjusted with ADD and REMOVE TEXT-PATTERNS and
  3896.    BINARY-PATTERNS, or SET FILE TEXT-PATTERNS and BINARY-PATTERNS.
  3897.    Configuration of the FTP patterns list will be added in a future
  3898.    release.
  3899.  
  3900.    Examples:
  3901.  
  3902.    get /server-char:latin1 /local-char:cp850 Grⁿ▀e.txt
  3903.           In this command, the filename contains special characters,
  3904.           which you enter using whatever character set your local
  3905.           computer uses, in this case PC Code Page 850 (cp850). The
  3906.           command tells Kermit (in case it didn't know already from its
  3907.           FILE CHARACTER-SET setting) that the local character set is
  3908.           cp850 and the server's character-set is ISO 8859-1 Latin
  3909.           Alphabet 1 (latin1). Kermit translates the filename from cp850
  3910.           to latin1 and sends the latin1 name to the server. Since it's a
  3911.           text file (matches "*.txt"), its contents are translated to
  3912.           cp850 on arrival, and it is saved with a cp850 name.
  3913.  
  3914.    mget /text /server:latin1 /local:utf8 *.txt
  3915.           This command:
  3916.  
  3917.           + Tells C-Kermit that the server's files are encoded in ISO
  3918.             8859-1 Latin Alphabet 1.
  3919.           + Tells C-Kermit to translate the incoming files into Unicode
  3920.             UTF-8 for storage.
  3921.           + Asks the server to send all ".txt" files in text mode.
  3922.  
  3923.    mget /server:latin1 /local:utf8 *
  3924.           Tells Kermit to get all files from the server's directory,
  3925.           switching between text and binary mode based on the filename.
  3926.           The names of all the files are translated (to UTF-8 in this
  3927.           case), but contents are translated (also to UTF-8) only for
  3928.           text files.
  3929.  
  3930.    Note that any pair of 8-bit character sets is likely to have some
  3931.    incompatibilities. Any characters in the source file that do not have
  3932.    equivalents in the destination file's character set are converted to
  3933.    question marks. This applies to both filenames and to text file
  3934.    contents.
  3935.  
  3936.    Also note that the server's ability to accept special characters in
  3937.    filenames depends on the particular server. For example:
  3938.  
  3939.   get Grⁿ▀e.txt
  3940.  
  3941.    works with WU-FTPD, but:
  3942.  
  3943.   mget Grⁿ▀*.txt
  3944.  
  3945.    does not.
  3946.      _________________________________________________________________
  3947.  
  3948.     3.7.3. RFC2640
  3949.  
  3950.    [330]RFC2640, July 1999, specifies a method by which the FTP client
  3951.    and server can negotiate the use of UTF8. However, RFC2640-capable
  3952.    servers are rare to nonexistent at this writing, and in any case you
  3953.    don't need them to be able to transfer text in UTF8. C-Kermit lets you
  3954.    upload and download text files in any character set it knows about,
  3955.    converting to or from any other character set it knows about, without
  3956.    the knowledge, permission, or cooperation of the server, and
  3957.    regardless of its capabilities.
  3958.  
  3959.    [ [331]Top ] [ [332]FTP Top ] [ [333]C-Kermit Home ] [ [334]Kermit
  3960.    Home ]
  3961.      _________________________________________________________________
  3962.  
  3963.   3.8. FTP Command Shortcuts
  3964.  
  3965.    C-Kermit's FTP client coexists with other C-Kermit functions by
  3966.    requiring the "ftp" prefix for each FTP-related command: FTP OPEN, FTP
  3967.    GET, FTP BYE, and so on. For interactive use, however, this can be
  3968.    rather awkward and sometimes surprising, for example when a GET
  3969.    command starts a Kermit GET rather than an FTP GET. In fact, many
  3970.    Kermit commands might just as easily apply to an FTP connection: GET,
  3971.    PUT (SEND), BYE, and CLOSE. The following command lets you choose how
  3972.    these commands are interpreted:
  3973.  
  3974.    SET GET-PUT-REMOTE { AUTO, KERMIT, FTP }
  3975.           Controls the orientation of GET, PUT, REMOTE and other
  3976.           file-transfer and client/server commands that might apply to
  3977.           either Kermit or FTP. The default setting is AUTO, meaning that
  3978.           these commands apply to FTP if an FTP connection is open, and
  3979.           to Kermit otherwise. KERMIT means they always apply to Kermit,
  3980.           FTP means they always apply to FTP.
  3981.  
  3982.    Here is a complete list of affected commands:
  3983.  
  3984.  Kermit Command               FTP Equivalent
  3985.   (none)                       FTP [ OPEN ]
  3986.   LOGIN                        FTP USER
  3987.   LOGOUT                       FTP RESET
  3988.   BYE                          FTP BYE
  3989.   FINISH                       FTP BYE
  3990.   CLOSE                        FTP BYE
  3991.   HANGUP                       FTP BYE
  3992.   BINARY                       FTP TYPE BINARY
  3993.   TEXT (or ASCII)              FTP TYPE ASCII
  3994.   SEND (or PUT)                FTP PUT
  3995.   MSEND (or MPUT)              FTP MPUT
  3996.   RESEND                       FTP PUT /RECOVER
  3997.   CSEND                        FTP PUT /COMMAND
  3998.   GET                          FTP GET
  3999.   MGET                         FTP MGET
  4000.   REGET                        FTP GET /RECOVER
  4001.   REMOTE HELP      (RHELP)     FTP HELP
  4002.   REMOTE CD        (RCD)       FTP CD (CWD)
  4003.   REMOTE PWD       (RPWD)      FTP PWD
  4004.   REMOTE DIRECTORY (RDIR)      FTP DIRECTORY
  4005.   REMOTE DELETE    (RDEL)      FTP DELETE
  4006.   REMOTE MKDIR     (RMKDIR)    FTP MKDIR
  4007.   REMOTE RMDIR     (RRMDIR)    FTP RMDIR
  4008.   REMOTE RENAME    (RRENAME)   FTP RENAME
  4009.   REMOTE TYPE      (RTYPE)     FTP TYPE
  4010.   REMOTE EXIT      (REXIT)     FTP BYE
  4011.  
  4012.    The commands in the right-hand column always access FTP. The commands
  4013.    in the left column can access either Kermit protocol or FTP:
  4014.  
  4015.      * When GET-PUT-REMOTE is set to KERMIT, or to AUTO when there is no
  4016.        FTP connection, the commands in the left-hand column access Kermit
  4017.        protocol, and those right-hand column are required for FTP.
  4018.      * When GET-PUT-REMOTE is set to FTP, or to AUTO when there is an
  4019.        active FTP connection, the commands in the left-hand column access
  4020.        the FTP connection and can not be used to access Kermit protocol.
  4021.        In this case, if you want to be able to use both Kermit protocol
  4022.        and the FTP connection, you must SET GET-PUT-REMOTE KERMIT, and
  4023.        then use the FTP commands in the right-hand column to access the
  4024.        FTP connection.
  4025.  
  4026.    Note that file-management commands such as DIRECTORY, DELETE, CD, PWD,
  4027.    MKDIR, RMDIR, HELP, RENAME, COPY, TYPE, and so on, always apply
  4028.    locally, no matter what kind of connection you have. This is the
  4029.    opposite of most FTP clients, where these commands are intended for
  4030.    the server, and require an "L" prefix for local execution (e.g. "dir"
  4031.    gets a directory listing from the server, "ldir" gets a local
  4032.    directory listing). To illustrate with the CD command and a typical
  4033.    UNIX FTP client:
  4034.  
  4035.  Client   Server      Change Local Directory     Change Remote Directory
  4036.   FTP      FTP         lcd                        cd (cwd)
  4037.   Kermit   Kermit      cd                         rcd, remote cd
  4038.   Kermit   FTP         cd                         ftp cd, rcd, remote cd
  4039.  
  4040.    Also note that not all REMOTE commands are useful with FTP, since FTP
  4041.    servers do not offer the corresponding functions. These include:
  4042.  
  4043.      * REMOTE ASSIGN  - FTP servers don't have variables
  4044.      * REMOTE COPY    - FTP servers don't copy files
  4045.      * REMOTE HOST    - FTP servers don't execute host (shell) commands
  4046.      * REMOTE KERMIT  - FTP servers don't execute Kermit commands
  4047.      * REMOTE PRINT   - FTP servers don't print files
  4048.      * REMOTE QUERY   - FTP servers don't have variables
  4049.      * REMOTE SET     - FTP servers don't have Kermit settings
  4050.      * REMOTE WHO     - FTP servers don't send user lists
  4051.  
  4052.    Finally note that command shortcuts do not apply to the HELP command.
  4053.    For help about an FTP command, use (for example) "help ftp delete",
  4054.    not "help delete" or "help rdelete".
  4055.  
  4056.    [ [335]Top ] [ [336]FTP Top ] [ [337]C-Kermit Home ] [ [338]Kermit
  4057.    Home ]
  4058.      _________________________________________________________________
  4059.  
  4060.   3.9. Dual Sessions
  4061.  
  4062.    You can have an FTP session open at the same time as a regular Kermit
  4063.    SET LINE or SET HOST (terminal) session. In this case, the default SET
  4064.    GET-PUT-REMOTE AUTO setting should ensure that all "two-faced"
  4065.    commands like GET, PUT, REMOTE, HANGUP, BYE, etc, apply to the Kermit
  4066.    session, and all commands for the FTP session must include the FTP
  4067.    prefix. To be absolutely certain, you can use SET GET-PUT-REMOTE
  4068.    KERMIT.
  4069.  
  4070.   ftp foo.bar.baz.com
  4071.   if fail ...
  4072.   (log in)
  4073.   set host foo.bar.baz.com
  4074.   if fail ...
  4075.   (log in)
  4076.  
  4077.    Now you have both an FTP and Telnet connection to the same host (of
  4078.    course they could also be to different hosts, and you could also have
  4079.    a direct or dialed serial connection instead of a Telnet connection).
  4080.    Now assuming you have a Kermit server on the far end of the Kermit
  4081.    connection:
  4082.  
  4083.   rcd incoming      ; Changes Kermit server's directory (= REMOTE CD)
  4084.   ftp cd incoming   ; Changes FTP server's directory
  4085.   put oofa.txt      ; Sends a file on the Kermit connection
  4086.   ftp put oofa.txt  ; Sends a file on the FTP connection
  4087.   bye               ; Shuts down the Kermit connection
  4088.   ftp bye           ; Shuts down the FTP connection
  4089.  
  4090.    Note that PUT and SEND are synonyms for both FTP and Kermit
  4091.    connections.
  4092.  
  4093.    You can also establish dual sessions on the Kermit command line:
  4094.  
  4095.   kermit -j host1 -9 host2
  4096.  
  4097.    This makes a Telnet connection to host1 and an FTP connection to
  4098.    host2.
  4099.  
  4100.    [ [339]Top ] [ [340]FTP Top ] [ [341]C-Kermit Home ] [ [342]Kermit
  4101.    Home ]
  4102.      _________________________________________________________________
  4103.  
  4104.   3.10. Automating FTP Sessions
  4105.  
  4106.    Most of Kermit's scripting features can be used to make and control
  4107.    FTP sessions: FOR and WHILE loops, IF-ELSE and SWITCH constructions,
  4108.    variables, arrays, built-in functions, and all the rest. You can't use
  4109.    INPUT, MINPUT, OUTPUT, CLEAR, or SCRIPT on an FTP session, but these
  4110.    are not needed since the FTP protocol is well defined.
  4111.  
  4112.    [343]CLICK HERE for an FTP scripting tutorial.
  4113.  
  4114.     3.10.1. FTP-Specific Variables and Functions
  4115.  
  4116.    The following variable tells whether an FTP connection is open:
  4117.  
  4118.    \v(ftp_connected)
  4119.           1 if there is an active FTP connection, 0 if there isn't.
  4120.  
  4121.    The FTP OPEN command sets:
  4122.  
  4123.    \v(ftp_host)
  4124.           The host to which the most recent FTP connection was made.
  4125.  
  4126.    \v(ftp_security)
  4127.           The security method negotiated for the current FTP session. The
  4128.           value is "NULL" when no security is used. See [344]3.2. Making
  4129.           Secure FTP Connections.
  4130.  
  4131.    \v(ftp_server)
  4132.           The OS type (UNIX, VMS, etc) of the FTP server host.
  4133.  
  4134.    The FTP USER command (or FTP OPEN /USER:, or FTP with automatic login)
  4135.    sets:
  4136.  
  4137.    \v(ftp_loggedin)
  4138.           1 if you are logged in to an FTP server, 0 if you are not.
  4139.  
  4140.    The current COMMAND-PROTECTION-LEVEL and DATA-PROTECTION-LEVEL values
  4141.    are reflected in:
  4142.  
  4143.    \v(ftp_cpl)
  4144.    \v(ftp_dpl)
  4145.           The values are "clear", "confidential", "safe" or "private".
  4146.           See [345]3.2. Making Secure FTP Connections.
  4147.  
  4148.    The FTP GET-PUT-REMOTE setting is reflected in:
  4149.  
  4150.    \v(ftp_getputremote)
  4151.           The values are "auto", "ftp", or "kermit".
  4152.  
  4153.    Every FTP command sets the \v(success) variable, as well as the
  4154.    following two FTP-specific variables:
  4155.  
  4156.    \v(ftp_code)
  4157.           The standardized numeric FTP protocol code from the server's
  4158.           response to the last client command, a 3-digit decimal number
  4159.           defined in [346]RFC959. Briefly:
  4160.  
  4161.           1xx = Positive Preliminary Reply
  4162.           2xx = Positive Completion Reply
  4163.           3xx = Positive Intermediate Reply
  4164.           4xx = Transient Negative Completion Reply
  4165.           5xx = Permanent Negative Completion Reply
  4166.  
  4167.    \v(ftp_message)
  4168.           The text message, if any, from the server's response to the
  4169.           last client command. If the most recent response had multiple
  4170.           lines, this variable has only the final line. These messages
  4171.           are not standardized and vary in format and content from server
  4172.           to server. Synonym: \v(ftp_msg).
  4173.  
  4174.    FTP file transfers set the regular Kermit transfer status variables:
  4175.  
  4176.   \v(cps)         Characters per second of most recent transfer.
  4177.   \v(filespec)    File specification used in most recent transfer.
  4178.   \v(fsize)       Size of file most recently transferred.
  4179.   \v(tfsize)      Total size of file group most recently transferred.
  4180.   \v(xferstatus)  Status of most recent transfer (0 = success, 1 = failure).
  4181.   \v(tftime)      Elapsed time of most recent transfer, in seconds.
  4182.  
  4183.    During an FTP transfer, the per-file variables are:
  4184.  
  4185.   \v(filename)    Name of current file.
  4186.   \v(filenumber)  Ordinal file number in group (1, 2, 3, ...)
  4187.      _________________________________________________________________
  4188.  
  4189.     3.10.2. Examples
  4190.  
  4191.    Let's begin with a simple example showing how to log in, send some
  4192.    files, and log out:
  4193.  
  4194.   define error if fail { ftp bye, stop 1 Error: \%1 }
  4195.   set transact brief
  4196.   log t
  4197.   ftp ftp.xyzcorp.com /anonymous
  4198.   if fail stop 1 Connection failed
  4199.   if not \v(ftp_loggedin) stop 1 Login failed
  4200.   ftp cd incoming
  4201.   error {ftp cd}
  4202.   cd upload
  4203.   error {local cd}
  4204.   ftp put /delete *
  4205.   error {put}
  4206.   ftp bye
  4207.  
  4208.    First we define an error handling macro to be used after the
  4209.    connection is made. Then we set up a brief-format transaction log to
  4210.    keep a record of our file transfers. Then we make a connection to the
  4211.    host and log in anonymously. The "if fail" command checks whether the
  4212.    connection was made. The "if not" command checks whether login was
  4213.    successful. Obviously the script should not continue unless both tests
  4214.    succeed.
  4215.  
  4216.    Next we change to the server's 'incoming' directory and to our own
  4217.    'upload' directory, and send all the files that are in it (they can be
  4218.    any mixture of text and binary files), deleting each source file
  4219.    automatically after it is successfully uploaded. Each of these
  4220.    operations is checked with the ERROR macro, which prevents the script
  4221.    from continuing past a failure.
  4222.  
  4223.    Finally we close the FTP session with the "bye" command.
  4224.  
  4225.    Just like any other Kermit script, this one can be used in many ways:
  4226.  
  4227.      * It can be stored in a file, and Kermit can be told to TAKE the
  4228.        file.
  4229.      * In UNIX, it can be a "[347]kerbang" script and therefore run
  4230.        directly from the shell prompt or as a cron job.
  4231.  
  4232.    We could have used command shortcuts like "rcd", "put", and "bye", but
  4233.    since they can be ambiguous under certain circumstances, it is better
  4234.    to avoid them in scripts; they are intended mainly for convenience
  4235.    during interactive use. However, if you wish to use the shortcuts in a
  4236.    script, you can do it this way (error handling omitted for brevity):
  4237.  
  4238.   local \%t                       ; Declare a local temporary veriable
  4239.   assign \%t \v(ftp_getputremote) ; Save current FTP GET-PUT-REMOTE setting
  4240.   set ftp get-put-remote ftp      ; Choose FTP orientation
  4241.   ftp xyzcorp.com /anonymous      ; Open an FTP connection
  4242.   get oofa.txt                    ; GET a file
  4243.   put foo.bar                     ; PUT a file
  4244.   rdel yesterday.log              ; Delete a file on the server
  4245.   bye                             ; Log out and disconnect from server.
  4246.   set ftp get-put-remote \%t      ; Restore previous GET-PUT-REMOTE setting
  4247.  
  4248.    Of course, FTP scripts can also be written as macros. This lets you
  4249.    pass parameters such as hostnames, usernames, and filenames to them:
  4250.  
  4251.   define doftpget {
  4252.       if < \v(argc) 4 end 1 Usage: \%0 host user remotefile [ localfile ]
  4253.       ftp \%1 /user:\%2
  4254.       if fail end 1 FTP OPEN \%1 failed
  4255.       if not \v(ftp_loggedin) end 1 FTP LOGIN failed
  4256.       ftp get {\%3} {\%4}
  4257.       if fail end 1 FTP GET \%3 failed
  4258.       ftp bye
  4259.   }
  4260.  
  4261.    Add this definition to your Kermit customization file, and it will
  4262.    always be available when you start Kermit. This macro lets you
  4263.    download a file with FTP by giving a single command, e.g.:
  4264.  
  4265.   doftpget xyzcorp.com anonymous oofa.txt
  4266.      _________________________________________________________________
  4267.  
  4268.     3.10.3. Automating Secure FTP Sessions
  4269.  
  4270.    Often when making secure connections, you are prompted interactively
  4271.    for certain information or permission to proceed. These prompts can
  4272.    stop an automated procedure. To avoid them, you must give the
  4273.    appropriate commands to disable them, and/or supply the prompted-for
  4274.    information beforehand. Here are a few hints:
  4275.  
  4276.      * Make sure that SET TAKE ERROR and SET MACRO ERROR are both OFF.
  4277.        This is the default, but in case you have set either one of these
  4278.        ON in your script or initialization file, this makes the script
  4279.        halt on any kind of error. Normally you would want to check each
  4280.        operation for success or failure and take appropriate action.
  4281.      * On SSL and TLS connections, you may be asked whether it is OK to
  4282.        proceed with a connection to server that presents a self-signed
  4283.        certificate. You can use the SET AUTHENTICATION SSL (or TLS)
  4284.        VERIFY or SET AUTH SSL (or TLS) CERTS-OK commands to avoid this
  4285.        prompt by not requesting a certificate from the peer.
  4286.      * (More to be added...)
  4287.  
  4288.    [ [348]Top ] [ [349]FTP Top ] [ [350]FTP Script Tutorial ] [
  4289.    [351]C-Kermit Home ] [ [352]Kermit Home ]
  4290.      _________________________________________________________________
  4291.  
  4292.   3.11. Advanced FTP Protocol Features
  4293.  
  4294.    The remainder of the FTP documention (through the end of Section 3) is
  4295.    new to C-Kermit 8.0.206, but we leave it in black to prevent
  4296.    headaches. Except for titles.
  4297.      * [353]TERMINOLOGY
  4298.      * [354]FEATURE NEGOTIATION
  4299.      * [355]USING MGET: NLST VERSUS MLSD
  4300.      * [356]EXAMPLES
  4301.      * [357]REFERENCES
  4302.  
  4303.    The new releases of [358]C-Kermit (8.0.206) and [359]Kermit 95 (2.1)
  4304.    support new FTP protocol features from RFC 2389 as well as most of
  4305.    what's in the Elz and Hethmon Extensions to FTP Internet Draft (see
  4306.    [360]References). Some of these features, such as SIZE (request a
  4307.    file's size), MDTM (request file's modification time), and REST
  4308.    (restart interrupted transfer) have been widely implemented in FTP
  4309.    clients and servers for years (as well as in the initial release of
  4310.    the Kermit FTP clients). Others such as FEAT and MLSD are rarely seen
  4311.    and are new to the upcoming Kermit releases. TVFS (Trivial Virtual
  4312.    File Store) is supported implicitly, and the UTF-8 character-set is
  4313.    already fully supported at the protocol and data-interchange level.
  4314.  
  4315.    For Kermit users, the main benefit of the new FTP protocol extensions
  4316.    is the ability to do recursive downloads. But the extensions also
  4317.    introduce complications and tradeoffs that you should be aware of. Of
  4318.    course Kermit tries to "do the right thing" automatically in every
  4319.    case for backwards compatibility. But (as noted later) some cases are
  4320.    inherently ambiguous and/or can result in nasty surprises, and for
  4321.    those situations new commands and switches are available to give you
  4322.    precise control over Kermit's behavior, in case the defaults don't
  4323.    produce the desired results.
  4324.      _________________________________________________________________
  4325.  
  4326.    3.11.1. Terminology Command-line FTP clients such as Kermit (as well
  4327.    as the traditional FTP programs found on Unix, VMS, ..., even Windows)
  4328.    have commands like PUT, MPUT, GET, MGET, and BYE, which they convert
  4329.    into zero or more FTP protocol commands, such as NLST, RETR, QUIT. For
  4330.    clarity, we'll use "command" to refer to commands given by the user to
  4331.    the FTP client, and "directive" for FTP protocol commands sent by the
  4332.    FTP client to the FTP server.
  4333.      _________________________________________________________________
  4334.  
  4335.    3.11.2. Feature Negotiation New FTP protocol features are negotiated
  4336.    by the client sending a FEAT directive and the server responding with
  4337.    a list of (new) features it supports, or else with an error indication
  4338.    if it does not support the FEAT directive at all, in which case the
  4339.    client has to guess which new features it supports (Kermit guesses
  4340.    that it supports SIZE and MDTM but not MLST). Note that the MLST
  4341.    feature includes MLSD, which is not listed separately as a feature.
  4342.  
  4343.    Guessing is nice when it works, but sometimes it doesn't, and some FTP
  4344.    servers become confused when you send them a directive they don't
  4345.    understand, or they do something you didn't want, sometimes to the
  4346.    point of closing the connection. For this reason, Kermit lets you
  4347.    override default or negotiated features with the following new
  4348.    commands:
  4349.  
  4350.    FTP { ENABLE, DISABLE } FEAT
  4351.           Enables or disables the automatic sending of a FEAT directive
  4352.           upon connection to an FTP server. Note that
  4353.           FTP [ OPEN ] /NOINIT   also inhibits sending the FEAT directive
  4354.           (and several others) for the connection being OPEN'd, but
  4355.           without necessarily disabling FEAT for subsequent connections
  4356.           in the same Kermit instance. FEAT is ENABLED by default, in
  4357.           which case many FTP servers are likely to reply:
  4358.  
  4359. 500 'FEAT': command not understood
  4360.  
  4361.           which is normally harmless (but you never know). (In C-Kermit
  4362.           8.0.208, this error message is suppressed unless you SET FTP
  4363.           DEBUG ON.)
  4364.  
  4365.    FTP ENABLE { MDTM, MLST, SIZE }
  4366.           Enables the given directive for implicit use by the FTP GET and
  4367.           MGET commands in case it has been disabled or erroneously
  4368.           omitted by the server in its FEAT response. Note: MLSD can be
  4369.           used in the FTP ENABLE and DISABLE commands as a synonym for
  4370.           MLST. YOU MUST GIVE THIS COMMAND AFTER MAKING THE FTP
  4371.           CONNECTION.
  4372.  
  4373.    FTP DISABLE { MDTM, MLST, SIZE }
  4374.           Disables implicit use of the given directive by GET or MGET in
  4375.           case it causes problems; for example, because it makes
  4376.           multifile downloads take too long or the server announces it
  4377.           erroneously or misimplements it. Use DISABLE FEAT before making
  4378.           a connection to prevent Kermit from sending the FEAT directive
  4379.           as part of its initial sequence. Note that disabling FEAT,
  4380.           SIZE, or MDTM does not prevent you from executing explicit FTP
  4381.           FEATURES, FTP SIZE, or FTP MODTIME commands. Also note that
  4382.           disabling SIZE prevents PUT /RESTART (recovery of interrupted
  4383.           uploads) from working. YOU MUST GIVE THIS COMMAND AFTER MAKING
  4384.           THE FTP CONNECTION.
  4385.  
  4386.    To enable or disable more than one feature, use multiple FTP ENABLE or
  4387.    FTP DISABLE commands. The SHOW FTP command shows which features are
  4388.    currently enabled and disabled.
  4389.  
  4390.    FTP FEATURES
  4391.           This command sends a FEAT directive to the server. In case you
  4392.           have been disabling and enabling different features, this
  4393.           resynchronizes Kermit's feature list with the server's. If the
  4394.           server does not support the FEAT directive, Kermit's feature
  4395.           list is not changed.
  4396.  
  4397.    FTP OPTIONS directive
  4398.           Informational only: the server tells what options, if any, it
  4399.           supports for the given directive, e.g. MLST. Fails if the
  4400.           server does not support the OPTS directive or if the directive
  4401.           for which options are requested is not valid. The directive is
  4402.           case-insensitive.
  4403.  
  4404.    FTP SIZE filename
  4405.           Sends a SIZE directive to the server for the given file. The
  4406.           filename must not contain wildcards. The server responds with
  4407.           an error if the file can't be found, is not accessible, or the
  4408.           SIZE directive is not supported, otherwise with the length of
  4409.           the file in bytes, which Kermit displays and also makes
  4410.           available to you in its \v(ftp_message) variable. If the
  4411.           directive is successful, Kermit (re-)enables it for internal
  4412.           use by the GET and MGET directives on this connection.
  4413.  
  4414.    FTP MODTIME filename
  4415.           Works just like the SIZE directive except it sends an MDTM
  4416.           directive. Upon success, the server sends modification
  4417.           date-time string, which Kermit interprets for you and also
  4418.           makes available in its \v(ftp_message) variable.
  4419.  
  4420.    Whenever a SIZE or MDTM directive is sent implicitly and rejected by
  4421.    the server because it is unknown, Kermit automatically disables it.
  4422.      _________________________________________________________________
  4423.  
  4424.    3.11.3. Using MGET: NLST versus MLSD When you give an MGET command to
  4425.    an FTP client, it sends a request to the FTP server for a list of
  4426.    files, and then upon successful receipt of the list, goes through it
  4427.    and issues a RETR (retrieve) directive for each file on the list (or
  4428.    possibly only for selected files).
  4429.  
  4430.    With the new FTP protocol extensions, now there are two ways to get
  4431.    the list of files: the NLST directive, which has been part of FTP
  4432.    protocol since the beginning, and the new MLSD directive, which is new
  4433.    and not yet widely implemented. When NLST is used and you give a
  4434.    command like "mget *.txt", the FTP client sends:
  4435.  
  4436. NLST *.txt
  4437.  
  4438.    and the server sends back a list of the files whose names match, e.g.
  4439.  
  4440. foo.txt
  4441. bar.txt
  4442. baz.txt
  4443.  
  4444.    Then when downloading each file, the client sends SIZE (if it wants
  4445.    have a percent-done display) and MDTM (if it wants to set the
  4446.    downloaded file's timestamp to match that of the original), as well as
  4447.    RETR (to retrieve the file).
  4448.  
  4449.    But when MLSD is used, the client is not supposed to send the filename
  4450.    or wildcard to the server; instead it sends an MLSD directive with no
  4451.    argument (or the name of a directory), and the server sends back a
  4452.    list of all the files in the current or given directory; then the
  4453.    client goes through the list and checks each file to see if it matches
  4454.    the given pattern, the rationale being that the user knows only the
  4455.    local conventions for wildcards and not necessarily the server's
  4456.    conventions. So with NLST the server interprets wildcards; with MLSD
  4457.    the client does.
  4458.  
  4459.      The interpretation of NLST wildcards by the server is not
  4460.      necessarily required or even envisioned by the FTP protocol
  4461.      definition (RFC 959), but in practice most clients and servers work
  4462.      this way. 
  4463.  
  4464.    The principal advantage of MLSD is that instead of sending back a
  4465.    simple list of filenames, it sends back a kind of database in which
  4466.    each entry contains a filename together with information about the
  4467.    file: type, size, timestamp, and so on; for example:
  4468.  
  4469. size=0;type=dir;perm=el;modify=20020409191530; bin
  4470. size=3919312;type=file;perm=r;modify=20000310140400; bar.txt
  4471. size=6686176;type=file;perm=r;modify=20001215181000; baz.txt
  4472. size=3820092;type=file;perm=r;modify=20000310140300; foo.txt
  4473. size=27439;type=file;perm=r;modify=20020923151312; foo.zip
  4474. (etc etc...)
  4475.  
  4476.    (If the format of the file list were the only difference between NLST
  4477.    and MLSD, the discussion would be finished: it would always be better
  4478.    to use MLSD when available, and the MGET user interface would need no
  4479.    changes. But there's a lot more to MLSD than the file-list format;
  4480.    read on...)
  4481.  
  4482.    The client learns whether the server supports MLSD in FEAT exchange.
  4483.    But the fact that the server supports MLSD doesn't mean the client
  4484.    should always use it. It is better to use MLSD:
  4485.  
  4486.      * On connections where the server imposes a time penalty for every
  4487.        command, e.g. the Red Hat Rawhide server. With MLSD, the client
  4488.        needs to send only one command (RETR) per file, whereas NLST
  4489.        requires three (SIZE, RETR, and MDTM). Suppose there is a
  4490.        30-second delay for each command and 1000 files are to be fetched;
  4491.        in that case, MLSD saves 60,000 seconds = 1000 minutes = 16 hours
  4492.        and 40 minutes.
  4493.      * For recursive downloads since there is no dependable way to
  4494.        download directory trees with NLST.
  4495.  
  4496.    But it is better to use NLST:
  4497.  
  4498.      * If you want only a couple short files out of a large directory. In
  4499.        this case, NLST is the better choice since the server sends a list
  4500.        of only the files you want, not a list of (say) a million files,
  4501.        which can make a big difference on slow connections. For example,
  4502.        suppose your wildcard matches three files of 1K each, but the
  4503.        million-file listing is 80MB long, and your connection is through
  4504.        a modem. The overhead of using MLSD is practically infinite.
  4505.      * If the server supports wildcarding features not known to the
  4506.        client, but that can be used to achieve desirable effects
  4507.        otherwise unobtainable, such as "[dir...]*.txt" in VMS or AOS/VS
  4508.        "except" clauses.
  4509.      * If you have been given a wildcard string by an FTP site
  4510.        administrator for fetching a specific group of files out of a
  4511.        larger directory, e.g. "mget ck[cuw]*.[cwh] makefile", that is
  4512.        expected to work with any client (an FTP site administrator can't
  4513.        be expected to know the wildcard syntax of every FTP client).
  4514.  
  4515.    But when using MLSD there are complications:
  4516.  
  4517.      * MLSD wants either a blank argument (meaning the current directory)
  4518.        or else the name of a specific directory. The client must not send
  4519.        it a wildcard or a filename.
  4520.      * But if the user's command is "mget xxx", how does the client know
  4521.        whether to send "xxx" in the MLSD directive? It might be the name
  4522.        of a directory on on the server, in which case it should be sent,
  4523.        or it might be the name of a file on the server (or a wildcard),
  4524.        in which case it must not be sent. Since the client knows its own
  4525.        wildcard syntax, then in most cases it would be right to send
  4526.        "MLSD" with no argument if xxx is wild, and to send "MLSD xxx" if
  4527.        it is not.
  4528.      * But suppose the server's file system allows filename characters
  4529.        that correspond with the client's wildcard syntax? For example:
  4530.        "[abc]" could be either a valid VMS directory name or a wildcard
  4531.        pattern used by the FTP client. What should the client do with
  4532.        "mget [abc]"? In this case there must be a way for the user to
  4533.        force sending the MGET argument as the MLSD argument.
  4534.      * If "xxx" is a regular file in the server's current directory,
  4535.        "mget xxx" works with NLST but not with MLSD.
  4536.  
  4537.    To further complicate matters, NLST can (in theory) work just like
  4538.    MLSD: if sent with a blank argument or a directory name, it is
  4539.    supposed to return a complete list of files in the current or given
  4540.    directory, which the client can match locally against some pattern. It
  4541.    is not known if any FTP server or client does this but nevertheless,
  4542.    it should be possible since this behavior can be inferred from RFC
  4543.    959.
  4544.  
  4545.    In view of these considerations, and given the need to preserve the
  4546.    traditional FTP client command structure and behavior so the software
  4547.    will be usable by most people:
  4548.  
  4549.     1. The MGET command should produce the expected result in the common
  4550.        cases, regardless of whether NLST or MLSD is used underneath.
  4551.     2. For anomalous cases, the user needs a way to control whether the
  4552.        MGET argument is sent to the server or kept for local use.
  4553.     3. At the same time, the user might need a way to send a directory
  4554.        name to the server, independent of any wildcard pattern.
  4555.     4. The user needs a way to force NLST or MLSD for a given MGET
  4556.        command.
  4557.  
  4558.    By default, Kermit's MGET command uses MLSD if MLST is reported by the
  4559.    server in its FEAT list. When MLSD is used, the filespec is sent to
  4560.    the server if it is not wild (according to Kermit's own definition of
  4561.    "wild" since it can't possibly know the server's definition). If the
  4562.    filespec is wild it is held for local use to select files from the
  4563.    list returned by the server. If MLST is not reported by the server or
  4564.    is disabled, Kermit sends the MGET filespec with the NLST directive.
  4565.  
  4566.    The default behavior can be overridden globally with FTP DISABLE MLST,
  4567.    which forces Kermit to use NLST to get file lists. And then for
  4568.    situations in which MLSD is enabled, the following MGET switches can
  4569.    be used to override the defaults for a specific MGET operation:
  4570.  
  4571.    /NLST
  4572.           Forces the client to send NLST. Example:
  4573.  
  4574. mget /nlst foo.*
  4575.  
  4576.    /MLSD
  4577.           Forces the client to send MLSD (even if MLST is disabled).
  4578.           Example:
  4579.  
  4580. mget /mlsd foo.*
  4581.  
  4582.    /MATCH:pattern
  4583.           When this switch is given, it forces the client to hold the
  4584.           pattern for local use against the returned file list. If a
  4585.           remote filespec is also given (e.g. the "blah" in "mget
  4586.           /match:*.txt blah"), then it is sent as the NLST or MLSD
  4587.           argument, presumably to specify the directory whose files are
  4588.           to be listed. When the /MATCH switch is not given, the MGET
  4589.           filespec is sent to the server if the directive is NLST or if
  4590.           the filespec is not wild. Examples:
  4591.  
  4592.   Command:                   With NLST:     With MLSD:
  4593.     mget                      NLST           MLSD
  4594.     mget *.txt                NLST *.txt     MLSD
  4595.     mget foo                  NLST foo       MLSD foo
  4596.     mget /match:*.txt         NLST           MLSD
  4597.     mget /match:*.txt foo     NLST foo       MLSD foo
  4598.  
  4599.    In other words, the pattern is always intepreted locally unless MGET
  4600.    uses NLST and no /MATCH switch was given.
  4601.      _________________________________________________________________
  4602.  
  4603.    3.11.4. Examples
  4604.  
  4605.   3.11.4.1. Downloading a Single File
  4606.  
  4607.    There are no choices here, just use the FTP GET command. Kermit always
  4608.    sends the RETR directive, and possibly SIZE and/or MDTM. The small
  4609.    advantage of using MLST in this case is outweighed by the risk and
  4610.    effort of coding a special case.
  4611.  
  4612.   3.11.4.2. Downloading a Group of Files from a Single Directory
  4613.  
  4614.    This case presents tradeoffs, especially on slow connections:
  4615.  
  4616.      * For downloading all or most of the files in a directory, MLSD is
  4617.        better because it eliminates the need to send SIZE and MDTM for
  4618.        each file. No special actions are required in this case; Kermit
  4619.        uses MLSD automatically if the server supports it (unless you have
  4620.        disabled it).
  4621.      * For a small number of files from a large directory, NLST is better
  4622.        because it bypasses downloading of a potentially huge file list
  4623.        prior to the files themselves. If you have a connection to a
  4624.        server that supports MLSD, use the /NLST switch to force NLST:
  4625.  
  4626. mget /nlst t[1234].h
  4627.  
  4628.      * If the server supports MLSD but does not support separate SIZE or
  4629.        MDTM directives, and you need the size and/or timestamp
  4630.        information, MLSD is better; no special actions required.
  4631.      * If the server supports MLSD but does not support the "size" and
  4632.        "modify" facts, but it does support the SIZE or MDTM directives,
  4633.        and you need the size and/or timestamp information, NLST is
  4634.        better.
  4635.  
  4636.   3.11.4.3. Downloading a Directory Tree
  4637.  
  4638.    MLSD is the only choice for recursive downloads; they rarely, if ever,
  4639.    work with NLST (the few cases where they do work rely on
  4640.    extra-protocol "secret" notations for the NLST argument). No special
  4641.    actions are required to force MLSD when the server supports it, unless
  4642.    you have disabled it. Examples:
  4643.  
  4644.    MGET /RECURSIVE
  4645.           This tells the server to send all files and directories in the
  4646.           tree rooted at its current directory.
  4647.  
  4648.    MGET /RECURSIVE *.txt
  4649.           This tells the server to send all *.txt files in the tree
  4650.           rooted at its current directory.
  4651.  
  4652.    MGET /MLSD /RECURSIVE *.txt
  4653.           Same as the previous example but forces Kermit to send MLSD in
  4654.           case it was disabled, or in case the server is known to support
  4655.           it even though it did not announce it in its FEAT listing.
  4656.  
  4657.    MGET /RECURSIVE /MATCH:*.zip archives
  4658.           Tells the server to send all ZIP files in the tree rooted at
  4659.           its "archives" directory.
  4660.  
  4661.    MGET /RECURSIVE /MATCH:* [abc]
  4662.           The server is running on VMS and you want it to send all the
  4663.           files in the directory tree rooted at [ABC]. But since "[abc]"
  4664.           looks just like a wildcard, you have to include a /MATCH:
  4665.           switch to force Kermit to send "[abc]" as the MLSD argument.
  4666.  
  4667.    In all cases in which the /RECURSIVE switch is included, the server's
  4668.    tree is duplicated locally.
  4669.  
  4670.      Although MLSD allows recursion and NLST does not, the MLSD
  4671.      specification places a heavy burden on the client; the obvious,
  4672.      straightforward, and elegant implementation (depth-first, the one
  4673.      that Kermit currently uses) requires as many open temporary files
  4674.      as the server's directory tree is deep, and therefore client
  4675.      resource exhaustion -- e.g. exceeding the maximum number of open
  4676.      files -- is a danger. Unfortunately MLSD was not designed with
  4677.      recursion in mind. (Breadth-first traversal could be problematic
  4678.      due to lack of sufficient navigation information.) 
  4679.  
  4680.    Of course all of Kermit's other MGET switches can be used too, e.g.
  4681.    for finer-grained file selection (by date, size, etc), for moving or
  4682.    renaming files as they arrive, to override Kermit's automatic per-file
  4683.    text/binary mode switching, to pass the incoming files through a
  4684.    filter, to convert text-file character sets, and so on.
  4685.  
  4686.   3.11.4.4. NLST/MLSD Summary Table
  4687.  
  4688.    Here's a table summarizing MGET behavior when the server supports both
  4689.    NLST and MLSD. /NLST and /MLSD switches are included for clarity to
  4690.    indicate which protocol is being used, and the expected effects. In
  4691.    practice you can omit the /NLST and /MLSD switches and the Kermit
  4692.    client chooses the appropriate or desired protocol as described above.
  4693.    Sample commands presume a Unix file system on the server, but of
  4694.    course the server can have any file system or syntax at all.
  4695.  
  4696.    User's Command FTP Sends Remarks
  4697.    mget /nlst NLST Gets a list of all the files in the server's current
  4698.    and downloads each file. The list includes names only, so Kermit also
  4699.    must send SIZE and MDTM directives if size and timestamp information
  4700.    is required (this is always true of NLST). Sending NLST without an
  4701.    argument is allowed by the RFC959 NLST definition and by the Kermit
  4702.    FTP client, but might not work with other clients, and also might not
  4703.    work with every server.
  4704.    mget /nlst foo NLST foo If "foo" is a directory, this gets a list of
  4705.    all the files from the server's "foo" directory and downloads each
  4706.    file; otherwise this downloads the file named "foo" (if any) from the
  4707.    server's current directory.
  4708.    mget /nlst *.txt NLST *.txt Gets a list of the files in the server's
  4709.    current directory whose names match the pattern *.txt, and then
  4710.    downloads each file from the list. Because we are using NLST, we send
  4711.    the filespec (*.txt) to the server and the server interprets any
  4712.    wildcards.
  4713.    mget /nlst foo/*.txt NLST foo/*.txt  Gets a list of the files in the
  4714.    server's "foo" directory whose names match the pattern *.txt, and then
  4715.    downloads each file from the list (server interprets wildcards).
  4716.    mget /nlst /match:*.txt NLST Gets a list of all the files in the
  4717.    server's current directory and then downloads each one whose name
  4718.    matches the pattern *.txt (client interprets wildcards).
  4719.    mget /nlst /match:*.txt foo  NLST foo Gets a list of all the files in
  4720.    the server's "foo" directory and then downloads each one whose name
  4721.    matches the pattern *.txt (client interprets wildcards).
  4722.    mget /mlsd MLSD Gets a list of all the files from the server's current
  4723.    directory and then downloads each one. The list might include size and
  4724.    timestamp information, in which case Kermit does not need to send SIZE
  4725.    and MDTM directives for each file (this is always true of MLSD).
  4726.    mget /mlsd foo MLSD foo Gets a list of all the files from the server's
  4727.    "foo" directory (where the string "foo" does not contain wildcards)
  4728.    and then downloads each one. If "foo" is a regular file and not a
  4729.    directory, this command is supposed to fail, but some servers have
  4730.    been observed that send the file.
  4731.    mget /mlsd *.txt MLSD Gets a list of all the files from the server's
  4732.    current directory and then downloads only the ones whose names match
  4733.    the pattern "*.txt". Because we are using MLSD and the MGET filespec
  4734.    is wild, we do not send the filespec to the server, but treat it as
  4735.    though it had been given in a /MATCH: switch and use it locally to
  4736.    match the names in the list.
  4737.    mget /mlsd foo/*.txt MLSD This one won't work because MLSD requires
  4738.    that the notions of server directory and filename-matching pattern be
  4739.    separated. However, the client, which can't be expected to know the
  4740.    server's file-system syntax, winds up sending a request that the
  4741.    server will (or should) reject.
  4742.    mget /mlsd /match:*.txt MLSD Gets a list of all the files from the
  4743.    server's current directory and then downloads only the ones whose
  4744.    names match the pattern "*.txt" (client interprets wildcards).
  4745.    mget /mlsd /match:*.txt foo MLSD foo If "foo" is a directory on the
  4746.    server, this gets a list of all the files from the server's "foo"
  4747.    directory and then downloads only the ones whose names match the
  4748.    pattern "*.txt" (client interprets wildcards). This leaves the server
  4749.    CD'd to the "foo" directory; there's no way the client can restore the
  4750.    server's original directory because MLSD doesn't give that
  4751.    information, and since the client can not be expected to know the
  4752.    server's file-system syntax, it would not be safe to guess. If "foo"
  4753.    is a regular file, MLSD fails.
  4754.    mget /mlsd foo bar MLSD This one is problematic. You're supposed to be
  4755.    able to give MGET a list a filespecs; in this case we name two
  4756.    directories. The client must change the server's directory to "foo" to
  4757.    get the list of files, and then the files themselves. But then it has
  4758.    no way to return to the server's previous directory in order to do the
  4759.    same for "bar", as explained in the previous example.
  4760.    mget /mlsd /match:* [abc] MLSD [abc] Including a /MATCH: switch forces
  4761.    [abc] to be sent to the server even though the client would normally
  4762.    think it was a wildcard and hold it for local interpretation. In this
  4763.    example, [abc] might be a VMS directory name.
  4764.    mget /mlsd /match:* t*.h MLSD t*.h Contrary to the MLSD specification,
  4765.    some MLSD-capable FTP servers do interpret wildcards. This form of the
  4766.    MGET command can be used to force a wildcard to be sent to the server
  4767.    for interpretation.
  4768.  
  4769.    When MLSD is used implicitly (that is, without an /MLSD switch given
  4770.    to force the use of MLSD) and an MGET command such as "mget foo/*.txt"
  4771.    fails, Kermit automatically falls back to NLST and tries again.
  4772.      _________________________________________________________________
  4773.  
  4774.    3.11.5. References
  4775.  
  4776.     1. Postel, J., and J. Reynolds, File Transfer Protocol (FTP), RFC
  4777.        959, October 1985: [361]ftp://ftp.isi.edu/in-notes/rfc959.txt.
  4778.     2. Hethmon, P, and R. Elz, Feature negotiation mechanism for the File
  4779.        Transfer Protocol, RFC 2389, August 1998:
  4780.        [362]ftp://ftp.isi.edu/in-notes/rfc2389.txt.
  4781.     3. Elz, R, and P. Hethmon, Extensions to FTP, Internet Draft
  4782.        draft-ietf-ftpext-mlst-16.txt, September 2002:
  4783.        [363]http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16
  4784.        .txt.
  4785.     4. [364]The Kermit FTP Client (overview).
  4786.  
  4787.    [ [365]Top ] [ [366]FTP Top ] [ [367]C-Kermit Home ] [ [368]Kermit
  4788.    Home ]
  4789.   __________________________________________________________________________
  4790.  
  4791. 4. FILE SCANNING
  4792.  
  4793.    A new feature called file scanning is used in various contexts to
  4794.    determine if a file is text or binary, and if it is text, what kind of
  4795.    text. The overhead of file scanning is surprisingly tolerable, usually
  4796.    about a quarter second per file. File scanning is now used instead of
  4797.    filename patterns unless you SET FILE SCAN OFF, which restores the
  4798.    previous behavior.
  4799.  
  4800.    The primary benefit of file scanning is in file transfer. For all
  4801.    practical purposes, now you can stop worrying about whether a file
  4802.    should be sent in binary or text mode, or about sending mixtures of
  4803.    text and binary files in a single operation, or configuring and
  4804.    fine-tuning your lists of binary-file and text-file name patterns: now
  4805.    it all just works.
  4806.  
  4807.    File scanning is done by the file sender, which determines the type of
  4808.    each file before it sends it and informs the receiver (Kermit or FTP
  4809.    server) of the type. File scanning is NOT done by the receiver,
  4810.    because it is the sender's responsibility to determine each file's
  4811.    type, send the file in the right mode, and inform the receiver of the
  4812.    mode. If both transfer partners are capable of this (or any other)
  4813.    form of automatic text/binary mode switching, then files can be sent
  4814.    in both directions with no worries about corruption due to
  4815.    inappropriate transfer mode. (As noted in [369]Section 3, FTP servers
  4816.    don't do this, so this discussion does not apply when using Kermit to
  4817.    download from an FTP server.)
  4818.  
  4819.    The rest of this section is mainly for the curious. If you don't read
  4820.    it and simply accept all defaults, every file you send should go in
  4821.    the appropriate mode automatically. As always, however, for
  4822.    character-set translation to work for 7- and 8-bit character-set
  4823.    files, the appropriate SET FILE CHARACTER-SET command(s) must have
  4824.    been executed to identify their encoding (Kermit's default file
  4825.    character-set is neutral ASCII except on platforms like HP-UX or
  4826.    DG/UX, where the default file character-set is known). And of course,
  4827.    receiving is another matter -- obviously the other Kermit must also
  4828.    send each file in the appropriate mode.
  4829.  
  4830.    Scanning is more reliable than filename patterns simply because
  4831.    filenames are not reliable indicators of the file's contents. Classic
  4832.    examples include ".doc" files, which are binary if Microsoft Word
  4833.    documents but text on most other platforms, and ".com" files, which
  4834.    are binary on DOS and Windows but text on VMS. Anyway, nobody knows
  4835.    the naming conventions (if any) of all the applications (and persons!)
  4836.    on your computer. Scanning, on the other hand, determines each file's
  4837.    type by inspecting its contents rather than just looking at its name.
  4838.  
  4839.    Also, file patterns -- even when they work as intended -- categorize
  4840.    each file only as text or binary, whereas file scanning can make finer
  4841.    distinctions:
  4842.  
  4843.    BINARY
  4844.           Binary data, not to be converted in any way. Examples include
  4845.           binary machine code (executable programs), graphics images
  4846.           (GIF, JPG, etc), compressed files (Z, GZ, etc), archives and
  4847.           packages (ZIP, TAR, RPM, etc), object files and libraries (OBJ,
  4848.           DLL, etc).
  4849.  
  4850.    7-BIT TEXT
  4851.           Text encoded in a 7-bit character set such as ASCII or one of
  4852.           the ISO 646 national versions. Kermit has no way to tell which
  4853.           character is used, only that it's 7-bit text. Typical examples
  4854.           include program source code, README files, Perl or Kermit
  4855.           scripts, plain-text email, HTML, TeX, and various textual
  4856.           encodings of binary files: Hex, Base64, etc. When sending such
  4857.           files, the FILE DEFAULT 7BIT-CHARACTER-SET is used as the file
  4858.           character-set, and then the appropriate transfer character set
  4859.           is chosen from the associations list (ASSOCIATE, SHOW
  4860.           ASSOCIATIONS).
  4861.  
  4862.    8-BIT TEXT
  4863.           Text encoded in an 8-bit character set such as Latin-1,
  4864.           Latin-2, Latin/Hebrew, Latin/Cyrillic, KOI8, HP-Roman8, JIS X
  4865.           0208, Code Page 437, or Code Page 1252. Again, Kermit has no
  4866.           way of knowing which particular set is in use, only that it's
  4867.           8-bit text. When sending such files, the FILE DEFAULT
  4868.           8BIT-CHARACTER-SET is used as the file character-set, and then
  4869.           the appropriate transfer character set is chosen from the
  4870.           associations list.
  4871.  
  4872.    UCS2 TEXT
  4873.           Unicode in its basic form, 16 bits (2 octets) per character.
  4874.           When sending such files, UCS2 is the file character-set and the
  4875.           byte order is identified automatically; the appropriate
  4876.           transfer character set is chosen from the associations list.
  4877.           Normally this would be UTF8. UTF-16 is not supported yet;
  4878.           Kermit's Unicode translations are restricted to Plane 0, the
  4879.           Base Multilingual Plane (BMP).
  4880.  
  4881.    UTF8 TEXT
  4882.           Unicode in its 8-bit transformation format. When sending such
  4883.           files, UTF8 is the file character-set; the appropriate transfer
  4884.           character set is chosen from the associations list, normally
  4885.           UCS2 or UTF8.
  4886.  
  4887.    File scanning is available in UNIX C-Kermit, in K-95, and to a limited
  4888.    extent, in VMS C-Kermit (full scanning is problematic in VMS because
  4889.    even plain-text files might contain binary record-format information).
  4890.    The relevant commands are:
  4891.  
  4892.    SET TRANSFER MODE { AUTOMATIC, MANUAL }
  4893.           Tells whether the file-transfer mode (text or binary) should be
  4894.           set by automatic or "manual" means. AUTOMATIC is the default,
  4895.           which allows any of the automatic methods that are enabled to
  4896.           do their jobs: FILE SCAN, FILE PATTERNS, peer recognition, etc.
  4897.           MANUAL lets you control the transfer mode with the SET FILE
  4898.           TYPE commands. As always, /TEXT and /BINARY switches on your
  4899.           file-transfer commands override all other methods; if you give
  4900.           one of these switches, scanning is not done. SHOW TRANSFER
  4901.           displays the current TRANSFER MODE setting.
  4902.  
  4903.    SET FILE SCAN { ON [ number ], OFF }
  4904.           Turns this feature on and off. It's ON by default. When OFF,
  4905.           the previous rules apply (SET FILE PATTERNS, etc). When ON is
  4906.           given, you can also specify a number of bytes to be scanned.
  4907.           The default is 49152 (= 48K). If a negative number is given,
  4908.           the entire file is scanned, no matter how big, for maximum
  4909.           certainty (for example, a PostScript file that appears to be
  4910.           plain text might include an embedded graphic past the normal
  4911.           scanning limit). SHOW FILE displays the current FILE SCAN
  4912.           setting.
  4913.  
  4914.    SET FILE DEFAULT 7BIT-CHARACTER-SET name
  4915.           Tells the 7-bit character-set to use if scanning identifies a
  4916.           7-bit text file, e.g. GERMAN. SHOW FILE displays the current
  4917.           SET FILE DEFAULT settings. So does SHOW CHARACTER-SETS.
  4918.  
  4919.    SET FILE DEFAULT 8BIT-CHARACTER-SET name
  4920.           Tells the 8-bit character-set to use if scanning identifies an
  4921.           8-bit text file, e.g. LATIN1. SHOW FILE and SHOW CHARACTER-SET
  4922.           display this.
  4923.  
  4924.    ASSOCIATE FILE-CHARACTER-SET fcs tcs
  4925.           When sending files and a file character-set (fcs) is identified
  4926.           by scanning, this tells C-Kermit which transfer character-set
  4927.           (tcs) to translate it to. It also allows C-Kermit to set the
  4928.           appropriate transfer character-set automatically whenever you
  4929.           give a SET FILE CHARACTER-SET command.
  4930.  
  4931.    ASSOCIATE TRANSFER-CHARACTER-SET tcs fcs
  4932.           When receivinging files and a file arrives whose transfer
  4933.           character-set (tcs) is announced by the sender, this command
  4934.           tells C-Kermit which file character-set (fcs) to translate it
  4935.           to. It also allows C-Kermit to set the appropriate file
  4936.           character-set whenever you give a SET TRANSFER CHARACTER-SET
  4937.           command.
  4938.  
  4939.    SET FILE CHARACTER-SET name
  4940.           When given for a 7-bit set, also sets FILE DEFAULT
  4941.           7BIT-CHARACTER-SET to the same set. When given for an 8-bit
  4942.           set, also sets FILE DEFAULT 8BIT-CHARACTER-SET to the same set.
  4943.           If an ASSOCIATE FILE-CHARACTER-SET command has been given for
  4944.           this set, also sets the corresponding transfer character-set.
  4945.  
  4946.    DIRECTORY /XFERMODE [ filespec ]
  4947.           Performs a file scan of the given files, listing the result for
  4948.           each file. If FILE SCAN is OFF but PATTERNS are ON, the result
  4949.           shown according to the current FILE TEXT-PATTERNS and
  4950.           BINARY-PATTERNS, and are restricted to (B) and (T). When FILE
  4951.           SCAN is ON, the results are:
  4952.  
  4953.   (B)          Binary
  4954.   (T)(7BIT)    Text: 7-bit
  4955.   (T)(8BIT)    Text: 8-bit
  4956.   (T)(UTF8)    Text: Unicode UTF8
  4957.   (T)(UCS2BE)  Text: Unicode UCS2 Big Endian
  4958.   (T)(UCS2LE)  Text: Unicode UCS2 Little Endian
  4959.  
  4960.           So you can use DIR /XFER to get a preview of how each file in a
  4961.           selected group will be transferred. Everything to the right of
  4962.           the (B) or (T) is new. If FILE SCAN is OFF, you only get the
  4963.           (B) or (T) as before.
  4964.  
  4965.           Note: Big and Little Endian refer to the ordering of bytes
  4966.           within a computer word. Big Endian architecture is standard and
  4967.           is used on most non-PC computers. Little Endian architecture is
  4968.           used on PCs.
  4969.  
  4970.    To illustrate file-transfer with scanning, suppose you have a
  4971.    directory containing a mixture of text and binary files, and each text
  4972.    file can be 7-bit German ISO 646, 8-bit Latin-1, or Unicode in any of
  4973.    the following forms: UCS2 Little Endian, UCS2 Big Endian, or UTF8
  4974.    ([370]UTF-16 is not supported yet). Assuming all the built-in defaults
  4975.    are in effect, the following three commands do the job:
  4976.  
  4977.   set file char german   ; This sets the default for 7-bit text files
  4978.   set file char latin1   ; This sets the default for 8-bit text files
  4979.   send *
  4980.  
  4981.    Each file is sent in the appropriate mode (text or binary), with text
  4982.    files converted to the appropriate transfer character-set and labeled
  4983.    so the receiver can convert them according to its own local
  4984.    conventions.
  4985.  
  4986.    By the way, what if you want to inhibit character-set translation but
  4987.    still allow automatic text/binary mode switching? Previously, you
  4988.    could simply SET TRANSFER CHARACTER-SET TRANSPARENT. But now with file
  4989.    scanning, the file and transfer character-sets are set automatically
  4990.    per file. A new command was added for this purpose:
  4991.  
  4992.    SET TRANSFER TRANSLATION { ON, OFF }
  4993.           Enables and disables file-transfer character-set translation.
  4994.           It is enabled by default.
  4995.  
  4996.    When TRANSFER TRANSLATION is OFF but FILE SCAN is ON, files are still
  4997.    scanned to see if they are text or binary, but no character-set
  4998.    translation is done when they text: only the normal record-format
  4999.    conversion.
  5000.  
  5001.    Like all SET commands, SET TRANSFER TRANSLATION is global and
  5002.    persistent. You can also force a particular file-transfer command
  5003.    (SEND, MSEND, GET, RECEIVE, TRANSMIT, etc) to not translate without
  5004.    affecting the global translation settings by including the new
  5005.    /TRANSPARENT switch, e.g.
  5006.  
  5007.   send /transparent oofa.txt
  5008.  
  5009.    As of C-Kermit 8.0.206, SET TRANSFER CHARACTER-SET TRANSPARENT implies
  5010.    SET TRANSFER TRANSLATION OFF.
  5011.  
  5012.    File scanning is also used in the TYPE command. The source file type
  5013.    and character set are determined as above, and then the file is
  5014.    automatically converted to your display character-set, line by line.
  5015.    In Kermit 95, the display character-set is Unicode, perhaps converted
  5016.    to your current console code page; in other versions of C-Kermit, it
  5017.    is your current file character-set. Thus if you have the following set
  5018.    appriately:
  5019.  
  5020.   SET FILE CHARACTER-SET (necessary in Unix but not K95)
  5021.   SET FILE DEFAULT 7BIT CHARACTER-SET
  5022.   SET FILE DEFAULT 8BIT CHARACTER-SET
  5023.  
  5024.    then you should be able to TYPE any text file and see something
  5025.    reasonable. For example, in Unix, if your DEFAULT 7BIT-CHARACTER-SET
  5026.    is ITALIAN and your DEFAULT 8BIT-CHARACTER-SET is LATIN1, and your
  5027.    FILE CHARACTER-SET is LATIN1, you can TYPE an Italian ISO 646 file, a
  5028.    Latin-1 file, or any kind of Unicode file, and have it translated
  5029.    automatically to Latin-1 for your display.
  5030.  
  5031.    In the GUI version of Kermit 95, you can see mixtures of many
  5032.    different scripts if the file is UTF8 or UCS2: Roman, Cyrillic,
  5033.    Hebrew, Greek, Armenian, Georgian, etc, all on the same screen at
  5034.    once.
  5035.  
  5036.    File scanning also adds a new criterion for file selection, i.e. to
  5037.    select only text (or binary) files. Several commands now include a new
  5038.    switch, /TYPE:{BINARY,TEXT,ALL}. BINARY means select only binary
  5039.    regular files (not directories). TEXT means select only text files.
  5040.    ALL means don't scan; select all files. Examples:
  5041.  
  5042.    SEND /TYPE:BINARY *.*
  5043.           Sends only binary files, skipping over text files.
  5044.  
  5045.    NOTE: File scanning is NOT done when using external protocols (because
  5046.    the external protocol programs, such as sz, are processing each file,
  5047.    not Kermit).
  5048.  
  5049.    DIRECTORY /TYPE:TEXT
  5050.           Lists only text files but not binary files.
  5051.  
  5052.    DELETE /TYPE:BINARY foo.*
  5053.           Deletes all foo.* files that are regular binary files but does
  5054.           not delete any text files.
  5055.  
  5056.    CHMOD /TYPE:BINARY 775 *
  5057.           (UNIX) Changes the permissions of all binary files to 775.
  5058.  
  5059.    When FILE SCAN is OFF and FILE PATTERNS are ON, behavior is as before
  5060.    with PATTERNS ON, but with some improvements:
  5061.  
  5062.      * Pathnames are now stripped prior to pattern matching.
  5063.      * Backup suffixes (like .~3~) are stripped prior to pattern
  5064.        matching.
  5065.  
  5066.    [ [371]Top ] [ [372]Contents ] [ [373]C-Kermit Home ] [ [374]Kermit
  5067.    Home ]
  5068.   __________________________________________________________________________
  5069.  
  5070. 5. FILE AND DIRECTORY NAMES CONTAINING SPACES
  5071.  
  5072.    Prior to the introduction of the graphical user interface (GUI), it
  5073.    was inconceivable that file or directory names could contain spaces,
  5074.    because space is a field delimiter in all command languages. GUIs,
  5075.    however, use dialog boxes for filenames, so there is never any
  5076.    question of distinguishing a filename from adjacent fields -- because
  5077.    there are no adjacent fields -- and therefore it has become quite
  5078.    common on computers that have GUIs to have file and directory names
  5079.    composed of multiple words. Of course this poses problems for command
  5080.    shells and other text-oriented programs.
  5081.  
  5082.    Most command shells address these problems by allowing such names to
  5083.    be enclosed in doublequotes, e.g.:
  5084.  
  5085.   cd "c:\Program Files"
  5086.  
  5087.    C-Kermit previously used braces for this:
  5088.  
  5089.   cd {c:\Program Files}
  5090.  
  5091.    which was not what most people expected. And even when braces were
  5092.    used, Kermit had difficulties with completion, file menus, and so
  5093.    forth, within braced fields.
  5094.  
  5095.    C-Kermit 8.0 allows either doublequotes or braces to be used for
  5096.    grouping:
  5097.  
  5098.   send "this file"
  5099.   send {this file}
  5100.   rename "this file" "that file"
  5101.   rename {this file} "that file"
  5102.   rename "this file" {that file}
  5103.   cd {Program Files}
  5104.   cd "Program Files"
  5105.  
  5106.    Note that the doublequotes or brackets must enclose the whole file or
  5107.    directory specification:
  5108.  
  5109.   "c:\My Directory"
  5110.  
  5111.    not:
  5112.  
  5113.   c:\"My Directory"
  5114.  
  5115.    In C-Kermit 8.0, you can also use completion on these filenames, in
  5116.    which case Kermit supplies the quotes (or braces) automatically.
  5117.    Example (in which the current directory contains only one file whose
  5118.    name starts with "th" and its full name is "this file" (without the
  5119.    quotes, but with the space)):
  5120.  
  5121.   cat th<Tab>
  5122.  
  5123.    Kermit repaints the filename field like this:
  5124.  
  5125.   cat "this file"
  5126.  
  5127.    That is, it backspaces over the original "th" and then writes the
  5128.    filename in doublequotes.
  5129.  
  5130.    If completion is only partial, Kermit still supplies the quotes, but
  5131.    in this case also beeps. To continue the filename, you must first
  5132.    backspace over the closing quote. The closing quote is supplied in
  5133.    this case to make sure that you can see the spaces, especially if they
  5134.    are trailing. For example, if the current directory contains two files
  5135.    whose names start with "th", and their fill names are "this file" and
  5136.    "this other file":
  5137.  
  5138.   cat th<Tab>
  5139.  
  5140.    Kermit prints:
  5141.  
  5142.   cat "this "<Beep>
  5143.  
  5144.    If it didn't print the closing quote, you would probably wonder why it
  5145.    was beeping.
  5146.  
  5147.    Also, if you begin a filename field with a doublequote or opening
  5148.    brace, now you can use completion or get ?-help; this was never
  5149.    possible before.
  5150.  
  5151.  C-Kermit>type "thi? Input file specification, one of the following:
  5152.    this file        this other file
  5153.  C-Kermit>type "thi_
  5154.  
  5155.    [ [375]Top ] [ [376]Contents ] [ [377]C-Kermit Home ] [ [378]Kermit
  5156.    Home ]
  5157.   __________________________________________________________________________
  5158.  
  5159. 6. OTHER COMMAND PARSING IMPROVEMENTS
  5160.  
  5161.   6.1. Grouping Macro Arguments
  5162.  
  5163.    Doublequotes now can be used in macro invocations to group arguments
  5164.    containing spaces, where previously only braces could be used:
  5165.  
  5166.   define xx show args
  5167.   xx one "this is two" three
  5168.  
  5169.    Result:
  5170.  
  5171.   Macro arguments at level 0 (\v(argc) = 4):
  5172.    \%0 = xx
  5173.    \%1 = one
  5174.    \%2 = this is two
  5175.    \%3 = three
  5176.  
  5177.    Also, you can now quote braces and quotes in macro args (this didn't
  5178.    work before). Examples:
  5179.  
  5180.   xx "{"  ; The argument is a single left brace
  5181.   xx {"}  ; The argument is a doublequote character
  5182.  
  5183.    In case this new behavior interferes with your scripts, you can
  5184.    restore the previous behavior with:
  5185.  
  5186.   SET COMMAND DOUBLEQUOTING OFF
  5187.  
  5188.   6.2. Directory and File Name Completion
  5189.  
  5190.    C-Kermit 8.0 also includes better completion for directory names, e.g.
  5191.    in the CD command. If the name typed so far uniquely matches a
  5192.    directory name, it is completed (as before), but now if the directory
  5193.    contains any subdirectories, completion is partial (allowing you to
  5194.    supply additional path segments without backspacing); otherwise it is
  5195.    complete.
  5196.  
  5197.    Completion has also been improved for file and directory names that
  5198.    contain not only spaces (as described above) but also "metacharacters"
  5199.    such as asterisk (*) and tilde (~): now the field is repainted if
  5200.    necessary. For example, if the current directory contains only one
  5201.    file whose name contains "blah", then in:
  5202.  
  5203.   type *blah<Tab>
  5204.  
  5205.    "*blah" is replaced by the filename. In earlier releases, the part
  5206.    typed so far was left on the command line (and in the history buffer),
  5207.    so even when the original command worked, the recalled version would
  5208.    not. Similarly for ~ (the nearly-universal Unix notation for
  5209.    username):
  5210.  
  5211.   type ~olga/x<Tab>
  5212.  
  5213.    is repainted as (e.g.):
  5214.  
  5215.   type /users/home/olga/x(Beep)
  5216.  
  5217.    Speaking of command history, the new SHOW HISTORY command shows your
  5218.    command history and recall buffer. SAVE COMMAND HISTORY saves it into
  5219.    a file of your choice.
  5220.  
  5221.   6.3. Passing Arguments to Command Files
  5222.  
  5223.    The method for passing arguments to command files has been improved.
  5224.    Prior to C-Kermit 7.0 there was no provision for doing this. In
  5225.    C-Kermit 7.0, the TAKE command was changed to allow arguments to be
  5226.    given after the filename:
  5227.  
  5228.   take commandfile arg1 arg2 ...
  5229.  
  5230.    This was accomplished by replacing the current \%1, \%2, etc, with the
  5231.    given arguments, since a new set of macro argument variables is
  5232.    created only when a macro is executed, not a command file. It is much
  5233.    more intuitive, however, if arguments to command files worked like
  5234.    those to macros: the command file sees the arguments as its own \%1,
  5235.    \%2, etc, but the caller's variables are not disturbed. C-Kermit 8.0
  5236.    accomplishes this by automatically creating an intermediate temporary
  5237.    macro to start the command file (if any arguments were given), thus
  5238.    creating a new level of arguments as expected.
  5239.  
  5240.   6.4. More-Prompting
  5241.  
  5242.    The familiar --more?-- prompt that appears at the end of each
  5243.    screenful of command-response output now accepts a new answer: G (Go)
  5244.    meaning "show all the rest without pausing and asking me any more
  5245.    questions". P (Proceed) is a synonym for G.
  5246.  
  5247.   6.5. Commas in Macro Definitions
  5248.  
  5249.    As noted in the [379]C-Kermit manual, comma is used to separate
  5250.    commands in a macro definition. Even when the macro is defined on
  5251.    multiple lines using curly-brace block-structure notation without
  5252.    commas, the definition is still stored internally as a comma-separated
  5253.    list of commands. Therefore special tricks are needed to include a
  5254.    comma in a command. The classic example is:
  5255.  
  5256.   define foo {
  5257.       (some command)
  5258.       if fail echo Sorry, blah failed...
  5259.   }
  5260.  
  5261.    This would result in Kermit trying to execute a "blah" command. This
  5262.    could always be handled by enclosing the text in braces:
  5263.  
  5264.   define foo {
  5265.       (some command)
  5266.       if fail echo {Sorry, blah failed...}
  5267.   }
  5268.  
  5269.    but doublequotes (more intuitive) should have worked too. Now they do:
  5270.  
  5271.   define foo {
  5272.       (some command)
  5273.       if fail echo "Sorry, blah failed..."
  5274.   }
  5275.  
  5276.   6.6. Arrow Keys
  5277.  
  5278.    As of version 8.0.201, C-Kermit on most platforms lets you access the
  5279.    command history buffer with arrow keys, just as you always could with
  5280.    control characters. The restrictions are:
  5281.  
  5282.     1. Only Up and Down arrow keys are accepted.
  5283.     2. Only 7-bit ANSI arrow-key sequences are understood (ESC followed
  5284.        by [ or uppercase letter O, followed by uppercase letter A or (up)
  5285.        B (down).
  5286.  
  5287.    This change was made to facilitate command recall in Linux-based PDAs
  5288.    that don't have a Control key, or at least not one that's easily (or
  5289.    always) accessible, such as the Sharp Zaurus SL5500.
  5290.  
  5291.    [ [380]Top ] [ [381]Contents ] [ [382]C-Kermit Home ] [ [383]Kermit
  5292.    Home ]
  5293.   __________________________________________________________________________
  5294.  
  5295. 7. NEW COMMANDS AND SWITCHES
  5296.  
  5297.    See [384]Section 4 for more about file scanning and the /TYPE: switch.
  5298.  
  5299.    ASK[Q] [ /TIMEOUT:number /QUIET /DEFAULT:text ] variable [ prompt ]
  5300.           The new optional /TIMEOUT: switch for ASK and ASKQ causes the
  5301.           command to time out and and fail if no response is given within
  5302.           the specified number of seconds, 1 or greater (0 or less means
  5303.           no timeout, wait forever). This works just like SET ASK-TIMER,
  5304.           except its effect is local to the ASK command with which it is
  5305.           given and it does not disturb the global ask timer setting. The
  5306.           new /QUIET switch tells Kermit not to print an error message if
  5307.           the ASK or ASKQ command times out waiting for a response.
  5308.  
  5309.           Version 8.0.211 adds the /DEFAULT:text switch for ASK-Class
  5310.           commands (ASK, ASKQ, and GETOK). This lets you supply a default
  5311.           answer in case the user supplies an empty answer or the
  5312.           /TIMEOUT: switch was included and the time limit expired
  5313.           without an answer. In both these cases, the command succeeds.
  5314.  
  5315.    CAT filename
  5316.           Equivalent to TYPE /NOPAGE.
  5317.  
  5318.    CDUP
  5319.           Changes Kermit's local working directory to the parent of the
  5320.           current one. Equivalent to "cd .." in UNIX or Windows, "cd [-]"
  5321.           in VMS, "cd ^" in AOS/VS, etc; in other words, it's a
  5322.           platform-independent way of moving one level up in a directory
  5323.           tree.
  5324.  
  5325.    CHMOD [ switches ] permission files
  5326.           UNIX only. Sets file permissions for one or more files or
  5327.           directories. The permission must be given as an octal number,
  5328.           e.g. 664, 755. Switches: /DIRECTORIES, /FILES, /NOLIST, /PAGE,
  5329.           /DOTFILES, /LIST, /NOPAGE, /RECURSIVE, /TYPE:{TEXT,BINARY,ALL},
  5330.           /SIMULATE. The /TYPE: switch allows selection of only text or
  5331.           binary files. For example, if you have a mixture of source
  5332.           files and executables, you can use "chmod /files /type:text
  5333.           664" to give owner/group read/write and world read permission
  5334.           to the text files, and "chmod /files /type:binary 775" to give
  5335.           the same plus execute permission to the executables. Use
  5336.           /SIMULATE to see which files would be affected, without
  5337.           actually changing their permissions.
  5338.  
  5339.    CLEAR KEYBOARD-BUFFER
  5340.           Flushes any as-yet unread characters from the keyboard input
  5341.           buffer. Useful for flushing typeahead in scripts.
  5342.  
  5343.    CONTINUE
  5344.           When given at an interactive command prompt that was reached by
  5345.           issuing a PROMPT command (described in this section) from a
  5346.           script, this command returns to the script, continuing its
  5347.           execution at the command after the PROMPT command. In this
  5348.           context, CONTINUE is simply a more-intuitive synonym for END.
  5349.  
  5350.    COPY, RENAME, and TRANSLATE
  5351.           These commands now work on file groups if the target filename
  5352.           is a directory, e.g. "copy oofa.* ..", "rename * ~olga/tmp/"
  5353.  
  5354.    COPY /APPEND source destination
  5355.           The source file specification can now include wildcards, in
  5356.           which case all of the source files that match will go into the
  5357.           destination file in alphabetical order by name.
  5358.  
  5359.    DELETE /ASK
  5360.           Asks permission to delete each file before deleting it. In
  5361.           C-Kermit 7.0, the answers were "yes" (or "ok") and "no".
  5362.           C-Kermit 8.0 adds "go" (meaning, delete all the rest without
  5363.           asking) and "quit" (cancel the DELETE command and return to the
  5364.           prompt).
  5365.  
  5366.    DELETE /DIRECTORIES
  5367.           Deletes not only files but also directories.
  5368.  
  5369.    DELETE /RECURSIVE
  5370.           Deletes all files that match the given file specification in
  5371.           the current (or given) directory and all directories beneath
  5372.           it.
  5373.  
  5374.    DELETE /SUMMARY
  5375.           Prints only the number of files deleted and total size freed,
  5376.           without listing each file.
  5377.  
  5378.    DELETE /TREE
  5379.           Shorthand for DELETE /RECURSIVE /DIRECTORIES /DOTFILES/.
  5380.           Equivalent to Windows DELTREE or Unix "rm -Rf". If no file
  5381.           specification is given, the contents of the current directory,
  5382.           plus all of its subdirectories and their contents, are deleted.
  5383.  
  5384.    DELETE /TYPE:BINARY
  5385.           Delete only regular binary files (requires FILE SCAN ON).
  5386.  
  5387.    DELETE /TYPE:TEXT
  5388.           Delete only regular text files (requires FILE SCAN ON).
  5389.  
  5390.    DIRECTORY [ switches ] [ filespec [ filespec [ filespec ... ] ] ]
  5391.           The DIRECTORY command now accepts more than one file
  5392.           specification; e.g. "directory moon.txt sun.doc stars.*".
  5393.  
  5394.    DIRECTORY /NORECURSIVE xxx
  5395.           If xxx is a directory name, forces listing of the directory
  5396.           itself rather than its contents.
  5397.  
  5398.    DIRECTORY /FOLLOWLINKS xxx
  5399.           (UNIX only) Tells the DIRECTORY command to follow symbolic
  5400.           links. This not the default because it can cause endless loops.
  5401.  
  5402.    DIRECTORY /NOFOLLOWLINKS xxx
  5403.           (UNIX only) Tells the DIRECTORY command not to follow symbolic
  5404.           links, but rather, merely to list them. This is the default.
  5405.  
  5406.    DIRECTORY /OUTPUT:filename
  5407.           Sends the results of the DIRECTORY command to the given file.
  5408.  
  5409.    DIRECTORY /SUMMARY
  5410.           Prints only the number of directories and files and the total
  5411.           size, without listing each file.
  5412.  
  5413.    DIRECTORY /TYPE:{TEXT,BINARY}
  5414.           Shows only files of the selected type, based on file scan.
  5415.  
  5416.    DIRECTORY /XFERMODE
  5417.           Now shows results of file scan (see [385]Section 4).
  5418.  
  5419.    FOPEN [ switches ] channel filename
  5420.  
  5421.           As of version 8.0.211, FOPEN allows /dev/tty as a filename in
  5422.           Unix-based operating systems.
  5423.  
  5424.    FREAD /TRIM
  5425.           (8.0.211) Trims any trailing blanks or tabs from the item (such
  5426.           as a line of text) that it has read.
  5427.  
  5428.    FREAD /UNTABIFY
  5429.           (8.0.211) Converts Horizontal Tab characters to the appropriate
  5430.           number of spaces, based on VT100-like tab stops
  5431.           (1,9,17,25,...).
  5432.  
  5433.    GREP [ switches ] pattern files
  5434.           Similar to Unix grep command: displays file lines that match
  5435.           the given [386]pattern. Switches:
  5436.  
  5437.         /COUNT[:variable]
  5438.                 Don't show the matching lines, just tell how many lines
  5439.                 match. If a variable name is specified, the count is
  5440.                 stored in the given variable.
  5441.  
  5442.         /DOTFILES
  5443.                 Include files whose names begin with dot.
  5444.  
  5445.         /LINENUMBERS
  5446.                 Show line numbers of matching lines.
  5447.  
  5448.         /NAMEONLY
  5449.                 only list the names of files that contain matching lines,
  5450.                 but not the lines themselves.
  5451.  
  5452.         /NOBACKUP
  5453.                 Skip backup files.
  5454.  
  5455.         /NOCASE
  5456.                 Ignore alphabetic case while pattern matching.
  5457.  
  5458.         /NODOTFILES
  5459.                 skip files whose names start with dot (period).
  5460.  
  5461.         /NOLIST
  5462.                 Suppress output but set SUCCESS or FAILURE according to
  5463.                 search result.
  5464.  
  5465.         /NOMATCH
  5466.                 Look for lines that do not match the pattern.
  5467.  
  5468.         /NOPAGE
  5469.                 Don't pause between screens of output.
  5470.  
  5471.         /OUTPUT:filename
  5472.                 Write results into the given file.
  5473.  
  5474.         /PAGE
  5475.                 Pause between screens of output.
  5476.  
  5477.         /RECURSIVE
  5478.                 Search files in subdirectories too.
  5479.  
  5480.         /TYPE:{TEXT,BINARY}
  5481.                 Search only files of the specified type.
  5482.  
  5483.           Synonyms: FIND, SEARCH.
  5484.  
  5485.    GETOK /TIMEOUT:n /QUIET /DEFAULT:text
  5486.           The new /QUIET switch instructs GETOK, when given a timeout,
  5487.           not to print an error message if it times out. As of 8.0.211, a
  5488.           default answer can be supplied (see ASK).
  5489.  
  5490.    HEAD [ switches ] filename
  5491.           Equivalent to TYPE /HEAD [ other-switches ] filename.
  5492.  
  5493.    HELP DATE
  5494.           Explains date-time formats, including timezone notation and
  5495.           delta times.
  5496.  
  5497.    HELP FIREWALLS
  5498.           Explains the firewall negotiation capabilities of your version
  5499.           of Kermit.
  5500.  
  5501.    KCD [ symbolic-directory-name ]
  5502.           Changes Kermit's working directory to the named symbolic
  5503.           directory, such as such as exedir, inidir, startup, download,
  5504.           or and home. Type "kcd ?" for a list of symbolic directory
  5505.           names known to your copy of Kermit, or give the new ORIENTATION
  5506.           command for a more detailed explanation. If you give a KCD
  5507.           command without a directory name, Kermit returns to its "home"
  5508.           directory, which is determined in some way that depends on the
  5509.           underlying operating system, but which you can redefine with
  5510.           the (new) SET CD HOME command. Your home directory is shown by
  5511.           SHOW CD and it's also the value of the \v(home) variable.
  5512.  
  5513.    LICENSE
  5514.           Displays the C-Kermit license.
  5515.  
  5516.    L-commands
  5517.           When Kermit has a connection to a Kermit or FTP server, file
  5518.           managment commands such as CD, DIRECTORY, and DELETE might be
  5519.           intended for the local computer or the remote server. C-Kermit
  5520.           8.0.200 and earlier always executes these commands on the local
  5521.           computer. If you want them executed by the remote server, you
  5522.           have to prefix them with REMOTE (e.g. REMOTE CD) or use special
  5523.           R-command aliases (e.g. RCD = REMOTE CD, RDIR = REMOTE DIR,
  5524.           etc). But this feels unnatural to FTP users, who expect
  5525.           unprefixed file management commands to be executed by the
  5526.           remote server, rather than locally. C-Kermit 8.0.201 adds
  5527.           automatic locus switching to present an FTP-like interface for
  5528.           FTP connections and the normal Kermit interface for Kermit
  5529.           connections, and a SET LOCUS command (described below) to
  5530.           control whether or how this is done. For when LOCUS is REMOTE,
  5531.           a new set of commands was added for local management: LCD
  5532.           (Local CD), LDIR (Local DIR), etc. These are described below
  5533.           under SET LOCUS.
  5534.  
  5535.    MORE filename
  5536.           Equivalent to TYPE /PAGE.
  5537.  
  5538.    ORIENTATION
  5539.           Displays symbolic directory names and the corresponding
  5540.           variable names and values. The symbolic names, such as exedir,
  5541.           inidir, startup, download, and home, can be used as arguments
  5542.           to the new KCD command.
  5543.  
  5544.    PROMPT [ text ]
  5545.           For use in a macro or command file: enters interactive command
  5546.           mode within the current context ([387]Section 8.1). If the
  5547.           optional text is included, the prompt is set to it. The text
  5548.           can include variables, functions, etc, as in the SET PROMPT
  5549.           command. They are evaluated each time the prompt is printed.
  5550.           Unlike the SET PROMPT command, the text argument applies only
  5551.           to the current command level. Thus you can have different
  5552.           prompts at different levels.
  5553.  
  5554.    REMOTE SET MATCH { DOTIFILE, FIFO } { ON, OFF }
  5555.           Allows the client to tell the server whether wildcards sent to
  5556.           the server should match dot files (files whose names begin with
  5557.           period) or FIFOs (named pipes). See SET MATCH.
  5558.  
  5559.    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
  5560.           Allows control of the Kermit's Record-Format attribute. Set
  5561.           this to OFF in case incoming file are refused due to unknown or
  5562.           invalid record formats if you want to accept the file anyway
  5563.           (and, perhaps, postprocess it to fix its record format).
  5564.  
  5565.    SET CD HOME [ directory ]
  5566.           Specifies the target directory for the CD and KCD commands,
  5567.           when they are given without an argument, and also sets the
  5568.           value of the \v(home) variable.
  5569.  
  5570.    SET EXIT HANGUP { OFF, ON }
  5571.           Normally ON, meaning that when Kermit exits, it also explicitly
  5572.           hangs up the current SET LINE / SET PORT serial port according
  5573.           to the current SET MODEM TYPE and SET MODEM HANGUP METHOD, and
  5574.           closes the port device if it was opened by Kermit in the first
  5575.           place (as opposed to inherited). SET EXIT HANGUP OFF tells
  5576.           Kermit not to do this. This can't prevent the operating system
  5577.           from closing the device when Kermit exits (and it's a "last
  5578.           close") but if the port or modem have been conditioned to
  5579.           somehow ignore the close and keep the connection open, at least
  5580.           Kermit itself won't do anything explicit to hang it up or close
  5581.           it.
  5582.  
  5583.    SET FILE EOF { CTRL-Z, LENGTH }
  5584.           Specifies the end-of-file detection method to be used by
  5585.           C-Kermit when sending and receiving text files, and in the TYPE
  5586.           and similar text-file oriented commands. The normal and default
  5587.           method is LENGTH. You can specify CTRL-Z when handling CP/M or
  5588.           MS-DOS format text files, in which a Ctrl-Z (ASCII 26)
  5589.           character within the file marks the end of the file.
  5590.  
  5591.    SET FILE LISTSIZE number
  5592.           Allocates space for the given number of filenames to be filled
  5593.           in by the wildcard expander. The current number is shown by
  5594.           SHOW FILE. If you give a command that includes a filename
  5595.           containing a wildcard (such as "*") that matches more files
  5596.           that Kermit's list has room for, you can adjust the list size
  5597.           with this command.
  5598.  
  5599.    SET FILE STRINGSPACE number
  5600.           Allocates space for the given amount of filename strings for
  5601.           use by the wildcard expander. The current number is shown by
  5602.           SHOW FILE. The number is the total number of bytes of all the
  5603.           file specifications that match the given wildcard.
  5604.  
  5605.      If you need to process a bigger list of files than your computer
  5606.      has memory for, you might be able use an external file list. The
  5607.      Kermit SEND and the FTP PUT and GET commands accept a /LISTFILE:
  5608.      switch, which gives the name of a file that contains the list of
  5609.      files to be transferred. Example for UNIX:
  5610.  
  5611.   !find . -print | grep / > /tmp/names
  5612.   ftp put /update /recursive /listfile:/tmp/names
  5613.  
  5614.    SET LOCUS { AUTO, LOCAL, REMOTE }
  5615.           Added in C-Kermit 8.0.201.   Sets the locus for unprefixed file
  5616.           management commands such as CD, DIRECTORY, MKDIR, etc. When
  5617.           LOCUS is LOCAL these commands act locally and a REMOTE (or R)
  5618.           prefix (e.g. REMOTE CD, RCD, RDIR) is required to send file
  5619.           management commands to a remote server. When LOCUS is REMOTE,
  5620.           an L prefix is required to issue local file management commands
  5621.           (e.g. LCD, LDIR). The word LOCAL can't be used as a prefix
  5622.           since it is already used for declaring local variables. LOCUS
  5623.           applies to all types of connections, and thus is orthogonal to
  5624.           SET GET-PUT-REMOTE, which selects between Kermit and FTP for
  5625.           remote file-transfer and management commands. The default LOCUS
  5626.           is AUTO, which means we switch to REMOTE whenever an FTP
  5627.           connection is made, and to LOCAL whenever a non-FTP connection
  5628.           is made, and switch back accordingly whenever a connnection is
  5629.           closed. So by default, Kermit behaves in its traditional manner
  5630.           unless you make an FTP connection, in which case it acts like a
  5631.           regular FTP client (but better :-)   LOCUS applies to the
  5632.           following commands:
  5633.  
  5634.   Unprefixed    Remote       Local        Description        
  5635.    CD (CWD)      RCD          LCD          Change (Working) Directory
  5636.    CDUP          RCDUP        LCDUP        CD Up
  5637.    PWD           RPWD         LPWD         Print Working Directory
  5638.    DIRECTORY     RDIR         LDIR         Request a directory listinga
  5639.    DELETE        RDEL         LDEL         Delete (a) file(s)
  5640.    RENEME        RREN         LREN         Rename a file
  5641.    MKDIR         RMKDIR       LMKDIR       Create a directory
  5642.    RMDIR         RRMDIR       LRMDIR       Remove a directory
  5643.  
  5644.    SET MATCH { DOTIFILE, FIFO } { ON, OFF }
  5645.           Whether C-Kermit filename patterns (wildcards) should match
  5646.           filenames that start with dot (period), or (Unix only) FIFOs
  5647.           (named pipes). The defaults are to skip dotfiles in Unix but
  5648.           match them elsewhere, and to skip FIFOs. Applies to both
  5649.           interactive use and to server mode, when the server receives
  5650.           wildcards, e.g. in a GET command. Also see REMOTE SET MATCH.
  5651.  
  5652.    SET OPTIONS DIRECTORY /DOTFILES
  5653.           Now works for server listings too (UNIX only). Give this
  5654.           command prior to having Kermit enter server mode, and then it
  5655.           will show files whose names begin with dot (period) when sent a
  5656.           REMOTE DIRECTORY command.
  5657.  
  5658.    SET QUIET ON
  5659.           (as well as the -q command-line option) Now applies also to:
  5660.  
  5661.           + SET HOST connection progress messages.
  5662.           + "Press the X or E key to cancel" file-transfer message.
  5663.           + REMOTE CD response.
  5664.           + REMOTE LOGIN response.
  5665.  
  5666.    SET RECEIVE PERMISSIONS { ON, OFF }
  5667.           Tells C-Kermit whether to set the permissions of incoming files
  5668.           (received with Kermit protocol) from the permissions supplied
  5669.           in the file's Attribute packet (if any). Normally ON. Also see
  5670.           SET SEND PERMISSIONS.
  5671.  
  5672.    SET ROOT directory
  5673.           Like UNIX chroot, without requiring privilege. Sets the root
  5674.           for file access, does not allow reference to or creation of
  5675.           files outside the root, and can't be undone.
  5676.  
  5677.    SET SEND PERMISSIONS { ON, OFF }
  5678.           Tells C-Kermit whether to include file permissions in the
  5679.           attributes it includes with each file when sending with Kermit
  5680.           protocol. Also see SET RECEIVE PERMISSIONS.
  5681.  
  5682.    SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER:name /PASSWORD:text
  5683.           These commands now allow specification of username and
  5684.           password.
  5685.  
  5686.    SET TERMINAL . . .
  5687.           (See [388]Section 12.)
  5688.  
  5689.    SET TRANSFER MESSAGE [ text ]
  5690.           Sets an initial text message to be displayed in the
  5691.           file-transfer display. The transfer message is automatically
  5692.           deleted once used, so must be set each time a message a
  5693.           desired. Any variables in the message are evaluated at the time
  5694.           the SET command is given. If the optional text is omitted, any
  5695.           transfer message that is currently set is removed. Synonym: SET
  5696.           XFER MSG. SHOW TRANSFER displays it if it has been set but not
  5697.           yet used.
  5698.  
  5699.    SHOW COMMUNICATIONS
  5700.           In C-Kermit 8.0, SHOW COMMUNICATIONS, when given in remote mode
  5701.           (i.e. before any connection has been established), tells the
  5702.           typical dialout device name for the particular platform on
  5703.           which it's running (e.g. TXA0: for VMS, or /dev/cua0p0 for
  5704.           HP-UX). On Unix platforms, it also tells the name of the
  5705.           lockfile directory. This way, you have an idea of what the SET
  5706.           LINE device name should look like, and if the SET LINE command
  5707.           fails, you know the name of the directory or device that is
  5708.           protected against you.
  5709.  
  5710.    SHOW VARIABLES [ name [ name [ ... ] ] ]
  5711.           In C-Kermit 8.0.201 you can request values of a list of
  5712.           built-in (\v(xxx)) variables. Each name is a pattern, as
  5713.           before, but now it a free pattern rather than an anchored one
  5714.           (explained in [389]Section 8.12) so now "show var date time"
  5715.           shows the values of all variables whose names include the
  5716.           strings "date" or "time".
  5717.  
  5718.    TAIL [ switches ] filename
  5719.           Equivalent to TYPE /TAIL [ other-switches ] filename.
  5720.  
  5721.    TRANSMIT /NOECHO [ other switches ] filename
  5722.           The /NOECHO switch is equivalent to giving the command SET
  5723.           TRANSMIT ECHO OFF prior to the TRANSMIT command, except the
  5724.           switch affects only the command with which it was given and
  5725.           does not affect the prevailing global setting.
  5726.  
  5727.    TRANSMIT /NOWAIT [ other switches ] filename
  5728.           The /NOWAIT switch is equivalent to giving the command SET
  5729.           TRANSMIT PROMPT 0 prior to the TRANSMIT command, except the
  5730.           switch affects only the command with which it was given and
  5731.           does not affect the prevailing global setting.
  5732.  
  5733.    TRANSMIT /NOWAIT /NOECHO /BINARY [ other switches ] filename
  5734.           When the TRANSMIT command is given with the /NOWAIT, /NOECHO,
  5735.           and /BINARY switches, this activates a special "blast the whole
  5736.           file out the communications connection all at once" mode that
  5737.           Kermit didn't have prior to version 8.0. There has been
  5738.           increasing demand for this type of transmission with the advent
  5739.           of devices that expect image (e.g. .JPG) or sound (e.g. .MP3)
  5740.           files as raw input. The obvious question is: how does the
  5741.           receiving device know when it has the whole file? This depends
  5742.           on the device, of course; usually after a certain amount of
  5743.           time elapses with nothing arriving, or else when Kermit hangs
  5744.           up or closes the connection.
  5745.  
  5746.    TYPE /CHARACTER-SET:name
  5747.           Allows you to specify the character set in which the file to be
  5748.           typed is encoded.
  5749.  
  5750.    TYPE /NUMBER
  5751.           Adds line numbers.
  5752.  
  5753.    TYPE /OUTPUT:filename
  5754.           Sends the results of the TYPE command to the given file.
  5755.  
  5756.    TYPE /TRANSLATE-TO:name
  5757.           Used in conjunction with TYPE /CHARACTER-SET:xxx; allows you to
  5758.           specify the character set in which the file is to be displayed.
  5759.  
  5760.    TYPE /TRANSPARENT
  5761.           Used to disable character-set translation in the TYPE command,
  5762.           which otherwise can take place automatically based on file
  5763.           scanning, even when /CHARACTER-SET and /TRANSLATE-TO switches
  5764.           are not given.
  5765.  
  5766.    VOID text
  5767.           Parses the text, evaluating any backslash items in it (such as
  5768.           function calls) but doesn't do anything further, except
  5769.           possibly printing error messages. Useful for invoking functions
  5770.           that have side effects without using or printing their direct
  5771.           results, e.g. "void \fsplit(\%a,&a)".
  5772.  
  5773.   Symbolic Links in UNIX
  5774.  
  5775.    The UNIX versions of C-Kermit have had /FOLLOWLINKS and /NOFOLLOWLINKS
  5776.    switches added to several commands to control the treatment of
  5777.    symbolic links. Different commands deal differently with symbolic
  5778.    links:
  5779.  
  5780.    Kermit SEND, FTP MPUT
  5781.           /NOFOLLOWLINKS is the default, which means symbolic links are
  5782.           skipped entirely. The alternative, /FOLLOWLINKS, should be used
  5783.           with caution, since an innocent link might point to a whole
  5784.           file system, or it might cause a loop. There is no way in
  5785.           Kermit or FTP protocol to send the link itself. We either skip
  5786.           them or follow them; we can't duplicate them.
  5787.  
  5788.    DIRECTORY
  5789.           /NOFOLLOWLINKS is the default, which means the DIRECTORY
  5790.           command lists symbolic links in a way that shows they are
  5791.           links, but it does not follow them. The alternative,
  5792.           /FOLLOWLINKS, follows links and gives information about the
  5793.           linked-to directories and files.
  5794.  
  5795.    DELETE, RMDIR
  5796.           The DELETE command does not have link-specific switches. DELETE
  5797.           never follows links. If you tell Kermit to delete a symbolic
  5798.           link, it deletes the link itself, not the linked-to file. Ditto
  5799.           for RMDIR.
  5800.  
  5801.    COPY
  5802.           The COPY command behaves just like the UNIX cp command; it
  5803.           always follows links.
  5804.  
  5805.    RENAME
  5806.           The RENAME command behaves just like the UNIX mv command; it
  5807.           operates on links directly rather than following.
  5808.  
  5809.    [ [390]Top ] [ [391]Contents ] [ [392]C-Kermit Home ] [ [393]Kermit
  5810.    Home ]
  5811.   __________________________________________________________________________
  5812.  
  5813. 8. OTHER SCRIPTING IMPROVEMENTS
  5814.  
  5815.   8.1. Performance and Debugging
  5816.  
  5817.    A command cache for frequently used commands plus some related
  5818.    optimizations increases the speed of compute-bound scripts by anywhere
  5819.    from 50% to 1000%.
  5820.  
  5821.    The new PROMPT command can be used to set breakpoints for debugging
  5822.    scripts. If executed in a command file or macro, it gives you an
  5823.    interactive command prompt in the current context of the script, with
  5824.    all its variables, arguments, command stack, etc, available for
  5825.    examination or change, and the ability to resume the script at any
  5826.    point (END resumes it, Ctrl-C or STOP cancels it and returns to top
  5827.    level).
  5828.  
  5829.    The new Ctrl-C trapping feature ([394]Section 8.14) lets you intercept
  5830.    interruption of scripts. This can be used in combination with the
  5831.    PROMPT command to debug scripts. Example:
  5832.  
  5833. define ON_CTRLC {
  5834.     echo INTERRUPTED BY CTRL-C...
  5835.     echo The command stack has not yet been rolled back:
  5836.     show stack
  5837.     echo Type Ctrl-C again or use the END command to return to top level.
  5838.     prompt Debug>
  5839. }
  5840.  
  5841.    Adding this ON_CTRL definition to your script lets you interrupt it at
  5842.    any point and get prompt that is issued at the current command level,
  5843.    so you can query local variables, etc.
  5844.  
  5845.    [ [395]Top ] [ [396]Contents ] [ [397]C-Kermit Home ] [ [398]Kermit
  5846.    Home ]
  5847.      _________________________________________________________________
  5848.  
  5849.   8.2. Using Macros as Numeric Variables
  5850.  
  5851.    A macro is a way to assign a value to a name, and then use the name to
  5852.    refer to the value. Macros are used in two ways in Kermit: as
  5853.    "subroutines" or functions composed of Kermit commands, which are
  5854.    executed, or as variables to hold arbitrary values -- text, numbers,
  5855.    filenames, etc.
  5856.  
  5857.    When a macro is to be executed, its name is given as if it were a
  5858.    C-Kermit command, optionally preceded by the word "do". When a macro
  5859.    is used as a variable, it must be "escaped" with \m(xxx) (or
  5860.    equivalent function, e.g. \s(xxx), \:(xxx), \fdefinition(xxx)), where
  5861.    xxx is the macro name, for example:
  5862.  
  5863.   define filename /usr/olga/oofa.txt
  5864.   send \m(filename)
  5865.  
  5866.    Of course variables can also hold numbers:
  5867.  
  5868.   define size 17
  5869.   declare \&a[\m(size)]
  5870.   ...
  5871.   define index 3
  5872.   if ( == \m(index) 3 ) echo The third value is: \&a[\m(index)]
  5873.   evaluate index (\m(index) * 4)
  5874.   if ( > \m(index) \m(size) ) echo Out of range!
  5875.  
  5876.    But these are contexts in which only numbers are valid. C-Kermit 8.0
  5877.    has been changed to treat non-escaped non-numeric items in strictly
  5878.    numeric contexts as macro names. So it is now possible (but not
  5879.    required) to omit the \m(...) notation and just use the macro name in
  5880.    these contexts:
  5881.  
  5882.   define size 17
  5883.   declare \&a[size]
  5884.   ...
  5885.   define index 3
  5886.   if ( == index 3 ) echo The third value is: \&a[index]
  5887.   evaluate index (index * 4)
  5888.   if ( > index size ) echo Out of range!
  5889.  
  5890.    This is especially nice for loops that deal with arrays. Here, for
  5891.    example, is a loop that reverses the order of the elements in an
  5892.    array. Whereas formerly it was necessary to write:
  5893.  
  5894.   .\%n ::= \fdim(&a)
  5895.   for \%i 1 \%n/2 1 {
  5896.       .tmp := \&a[\%n-\%i+1]
  5897.       .\&a[\%n-\%i+1] := \&a[\%i]
  5898.       .\&a[\%i] := \m(tmp)
  5899.   }
  5900.  
  5901.    Recoding this to use macro names "i" and "n" instead of the backslash
  5902.    variables \%i and \%n, we have:
  5903.  
  5904.   .n ::= \fdim(&a)
  5905.   for i 1 n/2 1 {
  5906.       .tmp := \&a[n-i+1]
  5907.       .\&a[n-i+1] := \&a[i]
  5908.       .\&a[i] := \m(tmp)
  5909.   }
  5910.  
  5911.    which reduces the backslash count to less than half. The final
  5912.    statement in the loop could be written ".\&a[i] ::= tmp" if the array
  5913.    contained only numbers (since ::= indicates arithmetic expression
  5914.    evaluation).
  5915.  
  5916.    Also, now you can use floating-point numbers in integer contexts (such
  5917.    as array subscripts), in which case they are truncated to an integer
  5918.    value (i.e. the fractional part is discarded).
  5919.  
  5920.    Examples of numeric contexts include:
  5921.  
  5922.      * Array subscripts.
  5923.      * Any numeric function argument.
  5924.      * Right-hand side of ::= assignments.
  5925.      * EVALUATE command or \fevaluate() function expression.
  5926.      * The INCREMENT or DECREMENT by-value.
  5927.      * IF =, >, <, !=, >=, and <= comparands.
  5928.      * The IF number construct.
  5929.      * FOR-loop variables.
  5930.      * STOP, END, and EXIT status codes.
  5931.      * The INPUT timeout value.
  5932.      * PAUSE, WAIT, SLEEP, MSLEEP intervals.
  5933.      * The SHIFT argument.
  5934.      * Numeric switch arguments, e.g. TYPE /WIDTH:number, SEND
  5935.        /LARGER:number.
  5936.      * SCREEN MOVE-TO row and column number.
  5937.      * Various SET DIAL parameters (timeout, retry limit, etc).
  5938.      * Various SET SEND or RECEIVE parameters (packet length, window
  5939.        size, etc).
  5940.      * Various other SET parameters.
  5941.  
  5942.    and:
  5943.  
  5944.      * S-Expressions (explained in [399]Section 9).
  5945.  
  5946.    Macro names used in numeric contexts must not include mathematical
  5947.    operators. Although it is legal to create a macro called "foo+bar", in
  5948.    a numeric context this would be taken as the sum of the values of
  5949.    "foo" and "bar". Any such conflict can be avoided, of course, by
  5950.    enclosing the macro name in \m(...).
  5951.  
  5952.    [ [400]Top ] [ [401]Contents ] [ [402]C-Kermit Home ] [ [403]Kermit
  5953.    Home ]
  5954.      _________________________________________________________________
  5955.  
  5956.   8.3. New IF Conditions
  5957.  
  5958.    Several new IF conditions are available:
  5959.  
  5960.    IF DECLARED arrayname
  5961.           Explained in [404]Section 8.6.
  5962.  
  5963.    IF KBHIT
  5964.           Allows a script to test whether a key was pressed without
  5965.           actually trying to read it.
  5966.  
  5967.    IF KERBANG (Unix only)
  5968.           True if Kermit was started from a Kerbang script. This is
  5969.           useful for knowing how to interpret the \&@[] and \&_[]
  5970.           argument vector arrays, and under what conditions to exit.
  5971.  
  5972.    IF INTEGER n
  5973.           This is just a synonym for IF NUMERIC, which is true if n
  5974.           contains only digits (or, if n is a variable, its value
  5975.           contains only digits).
  5976.  
  5977.    By contrast, IF FLOAT n succeeds if n is a floating-point number OR an
  5978.    integer (or a variable with floating-point or integer value).
  5979.    Therefore, IF FLOAT should be used whenever any kind of number is
  5980.    acceptable, whereas IF INTEGER (or IF NUMERIC) when only an integer
  5981.    can be used.
  5982.  
  5983.    [ [405]Top ] [ [406]Contents ] [ [407]C-Kermit Home ] [ [408]Kermit
  5984.    Home ]
  5985.      _________________________________________________________________
  5986.  
  5987.   8.4. The ON_UNKNOWN_COMMAND Macro
  5988.  
  5989.    The new ON_UNKNOWN_COMMAND macro, if defined, is executed whenever you
  5990.    give a command that is not known to C-Kermit; any operands are passed
  5991.    as arguments. Here are some sample definitions:
  5992.  
  5993.   DEF ON_UNKNOWN_COMMAND telnet \%1 ; Treat unknown commands as hostnames
  5994.   DEF ON_UNKNOWN_COMMAND dial \%1   ; Treat unknown commands phone numbers
  5995.   DEF ON_UNKNOWN_COMMAND take \%1   ; Treat unknown commands as filenames
  5996.   DEF ON_UNKNOWN_COMMAND !\%*       ; Treat unknown commands as shell commands
  5997.  
  5998.    The ON_CD macro, if defined, is executed whenever Kermit is given a CD
  5999.    (change directory) command (8.0.211). Upon entry to this macro, the
  6000.    directory has already changed and the new directory string is
  6001.    available in the \v(directory) variable, and also as the first
  6002.    argument (\%1).
  6003.  
  6004.    [ [409]Top ] [ [410]Contents ] [ [411]C-Kermit Home ] [ [412]Kermit
  6005.    Home ]
  6006.      _________________________________________________________________
  6007.  
  6008.   8.5. The SHOW MACRO Command
  6009.  
  6010.    The SHOW MACRO command has been changed to accept more than one macro
  6011.    name:
  6012.  
  6013.   (setq a 1 b 2 c 3)
  6014.   show mac a b c
  6015.   a = 1
  6016.   b = 2
  6017.   c = 3
  6018.  
  6019.    An exact match is required for each name (except that case doesn't
  6020.    matter). If you include wildcard characters, however, a pattern match
  6021.    is performed:
  6022.  
  6023.   show mac [a-c]*x
  6024.  
  6025.    shows all macros whose names start with a, b, or c, and end with x.
  6026.  
  6027.    [ [413]Top ] [ [414]Contents ] [ [415]C-Kermit Home ] [ [416]Kermit
  6028.    Home ]
  6029.      _________________________________________________________________
  6030.  
  6031.   8.6. Arrays
  6032.  
  6033.    A clarification regarding references to array names (as opposed to
  6034.    array elements): You can use array-name "abbreviations" like &a only
  6035.    in contexts that expect array names, like ARRAY commands or array-name
  6036.    function arguments such as the second argument of \fsplit(). In a
  6037.    LOCAL statement, however, you have to write \&a[], since "local &a"
  6038.    might refer to a macro named "&a".
  6039.  
  6040.    In function arguments, however, you MUST use the abbreviated form:
  6041.    \fsplit(\%a,&a) or \fsplit(\%a,&a[]). If you include the backslash (as
  6042.    in "\fsplit(\%a,\&a[])") a parse error occurs.
  6043.  
  6044.    Here are the new array-related commands:
  6045.  
  6046.    IF DECLARED arrayname
  6047.           Allows a script to test whether an array has been declared. The
  6048.           arrayname can be a non-array backslash variable such as \%1 or
  6049.           \m(name), in which case it is evaluated first, and the result
  6050.           is treated as the array name. Otherwise, arrayname is treated
  6051.           as in the ARRAY commands: it can be a, &a, &a[], \&a, \&a[],
  6052.           \&a[3], \&a[3:9], etc, with the appropriate results in each
  6053.           case. Synonym: IF DCL.
  6054.  
  6055.    UNDECLARE arrayname
  6056.           UNDECLARE is a new top-level command to undeclare an array.
  6057.           Previously this could only be done with "declare \&a[0]" (i.e.
  6058.           re-declare the array with a dimension of 0).
  6059.  
  6060.    ARRAY LINK linkname arrayname
  6061.           Creates a symbolic link from the array named by linkname (which
  6062.           must be the name of an array that is not yet declared in the
  6063.           current context) to the array named by arrayname (which must
  6064.           the name of a currently declared array that is not itself a
  6065.           link, or a variable containing the name of such an array). The
  6066.           two names indicate the same array: if you change an array
  6067.           element, the change is reflected in the link too, and vice
  6068.           versa. If you undeclare the link, the real array is unaffected.
  6069.           If you undeclare the real array, all links to it disappear. If
  6070.           you resize an array (directly or through a link), all links to
  6071.           it are updated automatically.
  6072.  
  6073.    Array links let you pass array names as arguments to macros. For
  6074.    example, suppose you had a program that needed to uppercase all the
  6075.    elements of different arrays at different times. You could write a
  6076.    macro to do this, with the array name as an argument. But without
  6077.    array links, there would be no way to refer to the argument array
  6078.    within the macro. Array links make it easy:
  6079.  
  6080.   define arrayupper {
  6081.       local \&e[] \%i
  6082.       array link \&e[] \%1
  6083.       for i 1 \fdim(&e) 1 { .\&e[i] := \fupper(\&e[i]) }
  6084.   }
  6085.   declare \&a[] = these are some words
  6086.   arrayupper &a
  6087.   show array &a
  6088.  
  6089.    The macro declares the array link LOCAL, which means it doesn't
  6090.    conflict with any array of the same name that might exist outside the
  6091.    macro, and that the link is destroyed automatically when the macro
  6092.    exits. This works, by the way, even if the link name and the macro
  6093.    argument name are the same, as long as the link is declared LOCAL.
  6094.  
  6095.    As noted, you can't make a link to a nonexistent array. So when
  6096.    writing a macro whose job is to create an array whose name is passed
  6097.    as an argument, you must declare the array first (the size doesn't
  6098.    matter as long as it's greater than 0). Example:
  6099.  
  6100.   define tryme {                ; Demonstration macro
  6101.       local \&e[]               ; We only need this inside the macro
  6102.       array link \&e[] \%1      ; Make local link
  6103.       shift                     ; Shift argument list
  6104.       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
  6105.   }
  6106.   declare \&a[1]                ; Declare target array in advance
  6107.   tryme &a here are some words  ; Invoke the macro with array name and words
  6108.   show array a                  ; See the results
  6109.  
  6110.    One final improvement allows the macro itself to declare the array
  6111.    (this was not possible in earlier Kermit releases): if the array name
  6112.    in the DECLARE command is a variable (and not an array name), or
  6113.    includes variables, the resulting value is used as the array name. So:
  6114.  
  6115.   define tryme {                ; Demonstration macro
  6116.       declare \%1[1]            ; Preliminary declaration for target array
  6117.       local \&e[]               ; We only need this inside the macro
  6118.       array link \&e[] \%1      ; Make local link
  6119.       shift                     ; Shift argument list
  6120.       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
  6121.   }
  6122.   tryme &a here are some words  ; Invoke the macro with array name and words
  6123.   show array a                  ; See the results
  6124.  
  6125.    The SHOW ARRAY command now indicates whether an array name is a link.
  6126.  
  6127.    Also see the descriptions of [417]\fjoin() and [418]\fsplit(), plus
  6128.    [419]Section 8.10 on the MINPUT command, which shows how an entire
  6129.    array (or segment of it) can be used as the MINPUT target list.
  6130.  
  6131.    [ [420]Top ] [ [421]Contents ] [ [422]C-Kermit Home ] [ [423]Kermit
  6132.    Home ]
  6133.      _________________________________________________________________
  6134.  
  6135.   8.7. New or Improved Built-in Variables and Functions
  6136.  
  6137.    The following new built-in variables are available:
  6138.  
  6139.   \v(buildid)       A date string like "20000808" indicating when C-Kermit was
  6140. built.
  6141.   \v(ftime)         Current time, secs since midnight, including fraction of se
  6142. cond.
  6143.   \v(iprompt)       The current SET PROMPT value
  6144.   \v(sexp)          The most recent S-Expression (see [424]Section 9)
  6145.   \v(sdepth)        The current S-Expression invocation depth ([425]Section 9)
  6146.   \v(svalue)        The value of the most recent S-Expression ([426]Section 9)
  6147.  
  6148.   \v(ftp_code)      Most recent FTP response code ([427]Section 3)
  6149.   \v(ftp_connected) FTP connection status ([428]Section 3)
  6150.   \v(ftp_cpl)       FTP Command Protection Level ([429]Section 3.2)
  6151.   \v(ftp_dpl)       FTP Data Protection Level ([430]Section 3.2)
  6152.   \v(ftp_getputremote) The current SET GET-PUT-REMOTE setting ([431]Section 3.8
  6153. )
  6154.   \v(ftp_host)      Name or IP address of FTP server ([432]Section 3)
  6155.   \v(ftp_loggedin)  FTP login status ([433]Section 3)
  6156.   \v(ftp_message)   Most recent FTP response message ([434]Section 3)
  6157.   \v(ftp_security)  FTP Security method ([435]Section 3.2)
  6158.   \v(ftp_server)    OS type of FTP server ([436]Section 3)
  6159.  
  6160.   \v(http_code)       Most recent HTTP response code
  6161.   \v(http_connected)  HTTP connection status
  6162.   \v(http_host)       Name or IP address of HTTP server
  6163.   \v(http_message)    Most recent HTTP response message
  6164.   \v(http_security)   TLS cipher used to secure the HTTP session
  6165.  
  6166.   \v(hour)            Hour of the day, 0 to 23.
  6167.   \v(timestamp)       Equivalent to "\v(ndate) \v(time)".
  6168.  
  6169.   \v(log_debug)       Current debug log file, if any.
  6170.   \v(log_packet)      Current packet log file, if any.
  6171.   \v(log_session)     Current session log file, if any.
  6172.   \v(log_transaction) Current transaction log file, if any.
  6173.   \v(log_connection)  Current connection log file, if any.
  6174.  
  6175.    The following new or improved built-in functions are available:
  6176.  
  6177.   \fcmdstack()            Allows programmatic access to the command stack.
  6178.   \fcvtdate()             [437]Section 8.13, format options added
  6179.   \fdelta2secs()          [438]Section 8.13
  6180.   \fdostounixpath(s1)     Converts a DOS filename to Unix format.
  6181.   \fsplit()               Now allows grouping/nesting in source string.
  6182.   \fword()                Allows the same grouping and nesting.
  6183.   \fjoin(&a,s1,n1,n2)     Copies an array into a single string.
  6184.   \fsubstitute(s1,s2,s3)  Substitutes characters within a string.
  6185.   \freplace()             Has new 4th "occurrence" argument.
  6186.   \fsexpression()         Evaluates an S-Expression (explained in [439]Section
  6187. 9).
  6188.   \ftrim(), \fltrim()     Now trim CR and LF by default, as well as SP and Tab.
  6189.   \funixtodospath(s1)     Converts a Unix filename to DOS format.
  6190.   \fkeywordval(s1,c1)     Assigns values to keywords (macros) (explained below)
  6191. .
  6192.  
  6193.    Most functions that have "2" in their names to stand for the word "to"
  6194.    can now also be written with "to", e.g. "\fdelta2secs(),"
  6195.    \fdeltatosecs()."
  6196.  
  6197.    \funtabify(string)
  6198.           (New to 8.0.211) Replaces Horizontal Tab characters in the
  6199.           given string with spaces based on VT100-like tab stops.
  6200.  
  6201.    \fverify(s1,s2,n)
  6202.           As of version 8.0.211, returns -1 if s2 is an empty string.
  6203.           Previously it returned 0, making \fverify(abc,\%a) look as if
  6204.           \%a was a string combosed of a's, b's, and/or c's when in fact
  6205.           it contained nothing.
  6206.  
  6207.    \fcode(string)
  6208.           As of version 8.0.211, returns 0 if string is empty or missing.
  6209.           Previously it returned the empty string, which made it unsafe
  6210.           to use in arithmetic or boolean expressions.
  6211.  
  6212.    \v(inscale)
  6213.           New to version 8.0.211, its value is the INPUT SCALE-FACTOR
  6214.           ([440]Section 8.10), default 1.0.
  6215.  
  6216.   8.7.1. The \fkeywordval() Function
  6217.  
  6218.    \fkeywordval(s1,c1) is new to C-Kermit 8.0. Given a string s1 of the
  6219.    form "name=value", it creates a macro with the given name and assigns
  6220.    it the given value. If no value appears after the equal sign, any
  6221.    existing macro of the given name is undefined. Blanks are
  6222.    automatically trimmed from around the name and value. The optional c1
  6223.    parameter is the assignment operator character, equal sign (=) by
  6224.    default. This function is handy for processing keyword parameters or
  6225.    any other form of parameter-value pair. Suppose, for example, you want
  6226.    to write a macro that accepts keyword parameters rather than
  6227.    positional ones:
  6228.  
  6229.   define MYDIAL {
  6230.       local \%i modem hangup method device speed number
  6231.       def number 5551234          ; Assign default parameter values
  6232.       def speed 57600
  6233.       def modem usrobotics
  6234.       def hangup rs232
  6235.       def method tone
  6236.       def country 1
  6237.       for \%i 1 \v(argc)-1 1 {    ; Parse any keyword parameters...
  6238.           if not \fkeywordval(\&_[\%i]) end 1 Bad parameter: "\&_[\%i]"
  6239.       }
  6240.       set dial country \m(country)
  6241.       set modem type \m(modem)
  6242.       set modem hang \m(hangup)
  6243.       set dial method \m(tone)
  6244.       set line \m(device)
  6245.       if fail stop 1
  6246.       set speed \m(speed)
  6247.       if fail stop 1
  6248.       show comm
  6249.       set dial display on
  6250.       dial \m(number)
  6251.       if success connect
  6252.   }
  6253.  
  6254.    In this example, all the defaults are set up inside the macro, and
  6255.    therefore it can be invoked with no parameters at all. But if you want
  6256.    to have the macro dial a different number, you can supply it as
  6257.    follows:
  6258.  
  6259.   mydial number=7654321
  6260.  
  6261.    You can supply any number of keyword parameters, and you can give them
  6262.    in any order:
  6263.  
  6264.   mydial number=7654321 hangup=modem speed=115200
  6265.  
  6266.   8.7.2. The \fsplit(), \fjoin(), and \fword() Functions
  6267.  
  6268.    \fjoin(&a,s1,n1,n2) is also new; it creates a string from an array (or
  6269.    a piece of one). &a is the name of the array (a range specifier can be
  6270.    included); s1 is a character or string to separate each element in the
  6271.    result string (can be omitted, in which case the elements are not
  6272.    separated at all), and n1 is a grouping mask, explained below. If s1
  6273.    is empty or not specified, the array elements are separated with
  6274.    spaces. If you want the elements concatenated with no separator,
  6275.    include a nonzero n2 argument. Given the array:
  6276.  
  6277.   declare \&a[] = 0 1 2 3 4 5 6 7 8 9
  6278.  
  6279.    you can get effects like this:
  6280.  
  6281.   \fjoin(&a)      0 1 2 3 4 5 6 7 8 9
  6282.   \fjoin(&a,:)    0:1:2:3:4:5:6:7:8:9
  6283.   \fjoin(&a,{,})  0,1,2,3,4,5,6,7,8,9
  6284.   \fjoin(&a,...)  0...1...2...3...4...5...6...7...8...9
  6285.   \fjoin(&a,,,1)  0123456789
  6286.  
  6287.    \fsplit(), \fword(), \fstripb(), and \fjoin() accept a "grouping mask"
  6288.    argument, n1, which is a number from 0 to 63, in which:
  6289.  
  6290.    1 = "" doublequotes
  6291.    2 = {} braces
  6292.    4 = '' singlequotes
  6293.    8 = () parentheses
  6294.   16 = [] square brackets
  6295.   32 = <> angle brackets
  6296.  
  6297.    These can be OR'd (added) together to make any number 0-63 (-1 is
  6298.    treated the same as 63, 0 means no grouping). If a bit is on, the
  6299.    corresponding kind of grouping is selected. (If more than 1 bit is set
  6300.    for \fjoin(), only the lowest-order one is used.)
  6301.  
  6302.    If you include the same character in the grouping mask and the include
  6303.    list, the grouping mask takes precedence. Example:
  6304.  
  6305.   def \%a  a "b c d" e
  6306.   \fsplit(\%a,&a[],,,-1)  = 3  <-- doublequote used for grouping
  6307.   \fsplit(\%a,&a[],,",-1) = 3  <-- doublequote still used for grouping
  6308.  
  6309.    Nesting of matched left and right grouping characters (parentheses,
  6310.    braces, and brackets, but not quotes) is recognized. Example:
  6311.  
  6312.   def \%a a (b c <d e [f g {h i} j k] l m> n o) p
  6313.   \fsplit(\%a,&a,,,0)  = 16 (no grouping)
  6314.   \fsplit(\%a,&a,,,2)  = 15 (braces only)
  6315.   \fsplit(\%a,&a,,,16) = 11 (square brackets only)
  6316.   \fsplit(\%a,&a,,,32) =  7 (angle brackets only)
  6317.   \fsplit(\%a,&a,,,63) =  3 (all)
  6318.   \fsplit(\%a,&a,,,-1) =  3 (all)
  6319.  
  6320.    \fsplit() and \fjoin() are "reciprocal" functions. You can split a
  6321.    string up into an array and join it back into a new string that is
  6322.    equivalent, as long as \fsplit() and \fjoin() are given equivalent
  6323.    grouping masks, except that the type of braces might change. Example:
  6324.  
  6325.   def \%a a {b c [d e] f g} "h i" j <k l> m
  6326.   echo STRING=[\%a]
  6327.   echo WORDS=\fsplit(\%a,&a,,,-1)
  6328.   show array a
  6329.   asg \%b \fjoin(&a,{ },2)
  6330.   echo JOIN  =[\%b]
  6331.   echo WORDS=\fsplit(\%b,&b,,,-1)
  6332.   show array b
  6333.  
  6334.    The arrays a and b are identical. The strings a and b are as follows:
  6335.  
  6336.   \%a: a {b c [d e] f g} "h i" j <k l> m
  6337.   \%b: a {b c [d e] f g} {h i} j {k l} m
  6338.  
  6339.    It is possible to quote separator grouping characters with backslash
  6340.    to override their grouping function. And of course to include
  6341.    backslash itself in the string, it must be quoted too. Furthermore,
  6342.    each backslash must be doubled, so the command parser will still pass
  6343.    one backslash to \fsplit() for each two that it sees. Here are some
  6344.    examples using \fsplit() with a grouping mask of 8 (treat parentheses
  6345.    as grouping characters).
  6346.  
  6347.   String                  Result
  6348.     a b c d e f             6
  6349.     a b\\ c d e f           5
  6350.     a b (c d e) f           4
  6351.     a b \\(c d e\\) f       6
  6352.     a b \\\\(c d e\\\\) f   7
  6353.  
  6354.    \fsplit() has also been changed to create its array (if one is given)
  6355.    each time it is called, so now it can be conveniently called in a loop
  6356.    without having to redeclare the array each time.
  6357.  
  6358.    Incidentally... Sometimes you might want to invoke \fsplit() in a
  6359.    situation where you don't care about its return value, e.g. when you
  6360.    just want to fill the array. Now you can "call" \fsplit() or any other
  6361.    function with the new [441]VOID command:
  6362.  
  6363.   void \fsplit(\%a,&a)
  6364.  
  6365.    \fsplit() and \fjoin() also accept a new, optional 6th argument, an
  6366.    options flag, a number that can specify a number of options. So far
  6367.    there is just one option, whose value is 1:
  6368.  
  6369.    separator-flag
  6370.           Normally separators are collapsed. So, for example,
  6371.  
  6372.   \fword(Three        little          words,2)
  6373.  
  6374.           returns "little" (the second word). Space is a separator, but
  6375.           there are multiple spaces between each word. If the value 1 is
  6376.           included in the option flag, however, each separator counts. If
  6377.           two separators are adjacent, an empty word is produced between
  6378.           them. This is useful for parsing (e.g.) comma-separated lists
  6379.           exported from databases or spreadsheets.
  6380.  
  6381.   8.7.3. The \fcmdstack() Function
  6382.  
  6383.    The new \fcmdstack() function gives access to the command stack:
  6384.  
  6385.    \fcmdstack(n1,n2)
  6386.           Arguments: n1 is the command stack level. If omitted, the
  6387.           current level, \v(cmdlevel), is used. n2 is a function code
  6388.           specifying the desired type of information:
  6389.  
  6390.   0 (default) = name of object at level n1.
  6391.   1 (nonzero) = object type (0 = prompt; 1 = command file; 2 = macro).
  6392.  
  6393.           The default for n2 is 0.
  6394.  
  6395.    The name associated with prompt is "(prompt)". Here's a loop that can
  6396.    be included in a macro or command file to show the stack (similar to
  6397.    what the SHOW STACK command does):
  6398.  
  6399.   for \%i \v(cmdlevel) 0 -1 {
  6400.       echo \%i. [\fcmdstack(\%i,1)] \fcmdstack(\%i,0)
  6401.   }
  6402.  
  6403.    In this connection, note that \v(cmdfile) always indicates the most
  6404.    recently invoked active command file (if any), even if that file is
  6405.    executing a macro. Similarly, \v(macro) indicates the most recently
  6406.    invoked macro (if any), even if the current command source is not a
  6407.    macro. The name of the "caller" of the currently executing object
  6408.    (command file or macro) is:
  6409.  
  6410.   \fcmdstack(\v(cmdlevel)-1)
  6411.  
  6412.    and its type is:
  6413.  
  6414.   \fcmdstack(\v(cmdlevel)-1,1)
  6415.  
  6416.    To find the name of the macro that invoked the currently executing
  6417.    object, even if one or more intermediate command files (or prompting
  6418.    levels) are involved, use a loop like this:
  6419.  
  6420.   for \%i \v(cmdlevel)-1 0 -1 {
  6421.       if = \fcmdstack(\%i,1) 2 echo CALLER = \fcmdstack(\%i,0)
  6422.   }
  6423.  
  6424.    Of course if you make a macro to do this, the macro must account for
  6425.    its own additional level:
  6426.  
  6427.   define CALLER {
  6428.       for \%i \v(cmdlevel)-2 0 -1 {
  6429.           if = \fcmdstack(\%i,1) 2 return \fcmdstack(\%i,0)
  6430.       }
  6431.       return "(none)"
  6432.   }
  6433.  
  6434.    The built-in variable \v(cmdsource) gives the current command source
  6435.    as a word ("prompt", "file", or "macro").
  6436.  
  6437.   8.7.4. The VOID Command
  6438.  
  6439.    VOID is like ECHO in that all functions and variables in its argument
  6440.    text are evaluated. but it doesn't print anything (except possibly an
  6441.    error message if a function was invocation contained or resulted in
  6442.    any errors). VOID sets FAILURE if it encounters any errors, SUCCESS
  6443.    otherwise.
  6444.  
  6445.    [ [442]Top ] [ [443]Contents ] [ [444]C-Kermit Home ] [ [445]Kermit
  6446.    Home ]
  6447.      _________________________________________________________________
  6448.  
  6449.   8.8. The RETURN and END Commands
  6450.  
  6451.    The execution of a macro is terminated in any of the following ways:
  6452.  
  6453.      * With an END [ number [ message ] ] command. If a number is given,
  6454.        the macro succeeds if the number is 0, and fails if it is not
  6455.        zero; if a number is not given, the macro succeeds.
  6456.      * With a STOP command, which works just like END except it peels
  6457.        back the command stack all the way to top level.
  6458.      * With a RETURN [ text ] command, in which case the macro always
  6459.        succeeds.
  6460.      * By running out of commands to execute, in which case the macro
  6461.        succeeds or fails according the most recently executed command
  6462.        that sets success or failure.
  6463.  
  6464.    The same considerations apply to command files invoked by the TAKE
  6465.    command.
  6466.  
  6467.    If a macro does not execute any commands that set success or failure,
  6468.    then invoking the macro does not change the current SUCCESS/FAILURE
  6469.    status. It follows, then, that the mere invocation of a macro does not
  6470.    change the SUCCESS/FAILURE status either. This makes it possible to
  6471.    write macros to react to the status of other commands (or macros), for
  6472.    example:
  6473.  
  6474.   define CHKLINE {
  6475.       if success end 0
  6476.       stop 1 SET LINE failed - please try another device.
  6477.   }
  6478.   set modem type usrobotics
  6479.   set line /dev/cua0
  6480.   chkline
  6481.   set speed 57600
  6482.   dial 7654321
  6483.  
  6484.    By the way, none of this is news. But it was not explicitly documented
  6485.    before, and C-Kermit 7.0 and earlier did not always handle the RETURN
  6486.    statement as it should have.
  6487.  
  6488.    [ [446]Top ] [ [447]Contents ] [ [448]C-Kermit Home ] [ [449]Kermit
  6489.    Home ]
  6490.      _________________________________________________________________
  6491.  
  6492.   8.9. UNDEFINing Groups of Variables
  6493.  
  6494.    The UNDEFINE command, which previously accepted one variable name, now
  6495.    accepts a list of them, and also accepts wildcard notation to allow
  6496.    deletion of variables that match a given pattern.
  6497.  
  6498.    UNDEFINE [ switches ] name [ name [ name [ ... ] ] ]
  6499.           Undefines the variables whose names are given. Up to 64 names
  6500.           may be given in one UNDEFINE command.
  6501.  
  6502.    If you omit the switches and include only one name, the UNDEFINE
  6503.    command works as before.
  6504.  
  6505.    Switches include:
  6506.  
  6507.    /MATCHING
  6508.           Specifies that the names given are to treated as patterns
  6509.           rather than literal variable names. Note: pattern matching
  6510.           can't be used with array references; use the ARRAY command to
  6511.           manipulate arrays and subarrays.
  6512.  
  6513.    /LIST
  6514.           List the name of each variable to be undefined, and whether it
  6515.           was undefined successfully ("ok" or "error"), plus a summary
  6516.           count at the end.
  6517.  
  6518.    /SIMULATE
  6519.           List the names of the variables that would be deleted without
  6520.           actually deleting them. Implies /LIST.
  6521.  
  6522.    The UNDEFINE command fails if there were any errors and succeeds
  6523.    otherwise.
  6524.  
  6525.    The new _UNDEFINE command is like UNDEFINE, except the names are
  6526.    assumed to be variable names themselves, which contain the names (or
  6527.    parts of them) of the variables to be undefined. For example, if you
  6528.    have the following definitions:
  6529.  
  6530.   define \%a foo
  6531.   define foo This is some text
  6532.  
  6533.    then:
  6534.  
  6535.   undef \%a
  6536.  
  6537.    undefines the variable \%a, but:
  6538.  
  6539.   _undef \%a
  6540.  
  6541.    undefines the macro foo.
  6542.  
  6543.    Normal Kermit patterns are used for matching; metacharacters include
  6544.    asterisk, question mark, braces, and square brackets. Thus, when using
  6545.    the /MATCHING switch, if the names of the macros you want to undefine
  6546.    contain any of these characters, you must quote them with backslash to
  6547.    force them to be taken literally. Also note that \%* is not the name
  6548.    of a variable; it is a special notation used within a macro for "all
  6549.    my arguments". The command "undef /match \%*" deletes all \%x
  6550.    variables, where x is 0..9 and a..z. Use "undef /match \%[0-9]" to
  6551.    delete macro argument variables or "undef /match \%[i-n]" to delete a
  6552.    range of \%x variables.
  6553.  
  6554.    [ [450]Top ] [ [451]Contents ] [ [452]C-Kermit Home ] [ [453]Kermit
  6555.    Home ]
  6556.      _________________________________________________________________
  6557.  
  6558.   8.10. The INPUT and MINPUT Commands
  6559.  
  6560.    As of C-Kermit 8.0.211, the INPUT and MINPUT commands accept a switch:
  6561.  
  6562.    [M]INPUT /NOMATCH timeout
  6563.           The /NOMATCH switch allows INPUT or MINPUT to read incoming
  6564.           material for the specified amount of time, without attempting
  6565.           to match it with any text or patterns. When this switch is
  6566.           included, the [M]INPUT command succeeds when the timeout
  6567.           interval expires, with \v(instatus) set to 1, meaning "timed
  6568.           out", or fails upon interruption or i/o error.
  6569.  
  6570.    Also in version 8.0.211, there is a new way to apply a scale factor to
  6571.    [M]INPUT timeouts:
  6572.  
  6573.    SET INPUT SCALE-FACTOR floating-point-number
  6574.           This scales all [M]INPUT timeouts by the given factor, allowing
  6575.           time-sensitive scripts to be adjusted to changing conditions
  6576.           such as congested networks or different-speed modems without
  6577.           having to change each INPUT-class command. This affects only
  6578.           those timeouts that are given in seconds, not as wall-clock
  6579.           times. Although the scale factor can have a fractional part,
  6580.           the INPUT timeout is still an integer. The new built-in
  6581.           variable \v(inscale) tells the current INPUT SCALE-FACTOR.
  6582.  
  6583.    The MINPUT command can be used to search the incoming data stream for
  6584.    several targets simultaneously. For example:
  6585.  
  6586.   MINPUT 8 one two three
  6587.  
  6588.    waits up to 8 seconds for one of the words "one", "two", or "three" to
  6589.    arrive. Words can be grouped to indicate targets that contain spaces:
  6590.  
  6591.   MINPUT 8 nineteeen twenty "twenty one"
  6592.  
  6593.    And of course you can also use variables in place of (or as part of)
  6594.    the target names:
  6595.  
  6596.   MINPUT 8 \%a \&x[3] \m(foo)
  6597.  
  6598.    Until now you had to know the number of targets in advance when
  6599.    writing the MINPUT statement. Each of the examples above has exactly
  6600.    three targets.
  6601.  
  6602.    But suppose your script needs to look for a variable number of
  6603.    targets. For this you can use arrays and \fjoin(), described in
  6604.    [454]Section 8.7. Any number of \fjoin() invocations can be included
  6605.    in the MINPUT target list, and each one is expanded into the
  6606.    appropriate number of separate targets each time the MINPUT command is
  6607.    executed. Example:
  6608.  
  6609.   declare \&a[10] = one two three
  6610.   minput 10 foo \fjoin(&a) bar
  6611.  
  6612.    This declares an array of ten elements, and assigns values to the
  6613.    first three of them. The MINPUT command looks for these three (as well
  6614.    as the words "foo" and "bar"). Later, if you assign additional
  6615.    elements to the array, the same MINPUT command also looks for the new
  6616.    elements.
  6617.  
  6618.    If an array element contains spaces, each word becomes a separate
  6619.    target. To create one target per array element, use \fjoin()'s
  6620.    grouping feature:
  6621.  
  6622.   dcl \&a[] = {aaa bbb} {ccc ddd} {xxx yyy zzz}
  6623.  
  6624.   minput 10 \fjoin(&a)     <-- 7 targets
  6625.   minput 10 \fjoin(&a,,2)  <-- 3 targets
  6626.  
  6627.    [ [455]Top ] [ [456]Contents ] [ [457]C-Kermit Home ] [ [458]Kermit
  6628.    Home ]
  6629.      _________________________________________________________________
  6630.  
  6631.   8.11. Learned Scripts
  6632.  
  6633.    C-Kermit now includes a simple script recorder that monitors your
  6634.    commands, plus your actions during CONNECT mode, and automatically
  6635.    generates a script program that mimics what it observed. You should
  6636.    think of this feature as a script-writing ASSISTANT since, as you will
  6637.    see [459]later in this section, the result generally needs some
  6638.    editing to make it both secure and flexible. The script recorder is
  6639.    controlled by the new LEARN command:
  6640.  
  6641.    LEARN [ /ON /OFF /CLOSE ] [ filename ]
  6642.           If you give a filename, the file is opened for subsequent
  6643.           recording. The /ON switch enables recording to the current file
  6644.           (if any); /OFF disables recording. /CLOSE closes the current
  6645.           script recording file (if any). If you give a filename without
  6646.           any switches, /ON is assumed.
  6647.  
  6648.    The /OFF and /ON switches let you turn recording off and on during a
  6649.    session without closing the file.
  6650.  
  6651.    When recording:
  6652.  
  6653.      * All commands that you type (or recall) at the prompt are recorded
  6654.        in the file except:
  6655.           + LEARN commands are not recorded.
  6656.           + The CONNECT command is not recorded.
  6657.           + The TELNET command is converted to SET HOST /NETWORK:TCP.
  6658.      * Commands obtained from macros or command files are not recorded.
  6659.      * During CONNECT:
  6660.           + Every line you type is converted to an OUTPUT command.
  6661.           + The last prompt before any line you type becomes an INPUT
  6662.             command.
  6663.           + Timeouts are calculated automatically for each INPUT command.
  6664.           + A PAUSE command is inserted before each OUTPUT command just
  6665.             to be safe.
  6666.  
  6667.    Thus the script recorder is inherently line-oriented. It can't be used
  6668.    to script character-oriented interactions like typing Space to a
  6669.    "More?" prompt or editing a text file with VI or EMACS.
  6670.  
  6671.    But it has advantages too; for example it takes control characters
  6672.    into account that might not be visible to you otherwise, and it
  6673.    automatically converts control characters in both the input and output
  6674.    streams to the appropriate notation. It can tell, for example that the
  6675.    "$ " prompt on the left margin in UNIX is really {\{13}\{10}$ },
  6676.    whereas in VMS it might be {\{13}\{10}\{13}$ }. These sequences are
  6677.    detected and recorded automatically.
  6678.  
  6679.    A learned script should execute correctly when you give a TAKE command
  6680.    for it. However, it is usually appropriate to edit the script a bit.
  6681.    The most important change would be to remove any passwords from it.
  6682.    For example, if the script contains:
  6683.  
  6684.   INPUT 9 {\{13}\{10}Password: }
  6685.   IF FAIL STOP 1 INPUT timeout
  6686.   PAUSE 1
  6687.   OUTPUT bigsecret\{13}
  6688.  
  6689.    you should replace this by something like:
  6690.  
  6691.   INPUT 9 {\{13}\{10}Password: }
  6692.   IF FAIL STOP 1 INPUT timeout
  6693.   ASKQ pswd Please type your password:
  6694.   PAUSE 1
  6695.   OUTPUT \m(pswd)\{13}
  6696.  
  6697.    The LEARN command can't do this for you since it knows nothing about
  6698.    "content"; it only knows about lines and can't be expected to parse or
  6699.    understand them -- after all, the Password prompt might be in some
  6700.    other language. So remember: if you use the LEARN command to record a
  6701.    login script, be sure edit the resulting file to remove any passwords.
  6702.    Also be sure to delete any backup copies your editor or OS might have
  6703.    made of the file.
  6704.  
  6705.    Other manual adjustments might also be appropriate:
  6706.  
  6707.      * If the target of an INPUT command can vary, you can replace the
  6708.        INPUT command with MINPUT and the appropriate target list, and/or
  6709.        the target with a \fpattern(). For example, suppose you are
  6710.        dialing a number that can be answered by any one of 100 terminal
  6711.        servers, whose prompts are ts-00>, ts-01>, ts-02>, ... ts-99>. The
  6712.        script records a particular one of these, but you want it to work
  6713.        for all of them, so change (e.g.):
  6714.   INPUT 10 ts-23>  ; or whatever
  6715.        to:
  6716.   INPUT 10 \fpattern(ts-[0-9][0-9]>)
  6717.      * The INPUT timeout values are conservative, but they are based only
  6718.        on a single observation; you might need to tune them.
  6719.      * The PAUSE commands might not be necessary, or the PAUSE interval
  6720.        might need adjustment.
  6721.      * In case you made typographical errors during recording, they are
  6722.        incorporated in your script; you can edit them out if you want to.
  6723.  
  6724.    Here is a sample script generated by Kermit ("learn vms.ksc") in which
  6725.    a Telnet connection is made to a VMS computer, the user logs in,
  6726.    starts Kermit on VMS, sends it a file, and then logs out:
  6727.  
  6728.   ; Scriptfile: vms.ksc
  6729.   ; Directory:  /usr/olga
  6730.   ; Recorded:   20001124 15:21:23
  6731.  
  6732.   SET HOST /NETWORK:TCP vms.xyzcorp.com
  6733.   IF FAIL STOP 1 Connection failed
  6734.  
  6735.   INPUT 7 {\{13}\{10}\{13}Username: }
  6736.   IF FAIL STOP 1 INPUT timeout
  6737.   PAUSE 1
  6738.   OUTPUT olga\{13}
  6739.   INPUT 3 {\{13}\{10}\{13}Password: }
  6740.   IF FAIL STOP 1 INPUT timeout
  6741.   PAUSE 1
  6742.   OUTPUT secret\{13}
  6743.   INPUT 18 {\{13}\{10}\{13}$ }
  6744.   IF FAIL STOP 1 INPUT timeout
  6745.   PAUSE 1
  6746.   OUTPUT set default [.incoming]\{13}
  6747.   INPUT 12 {\{13}\{10}\{13}$ }
  6748.   IF FAIL STOP 1 INPUT timeout
  6749.   PAUSE 1
  6750.   OUTPUT kermit\{13}
  6751.   INPUT 15 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
  6752.   IF FAIL STOP 1 INPUT timeout
  6753.   PAUSE 1
  6754.   OUTPUT receive\{13}
  6755.   send myfile.txt
  6756.  
  6757.   INPUT 18 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
  6758.   IF FAIL STOP 1 INPUT timeout
  6759.   PAUSE 1
  6760.   OUTPUT exit\{13}
  6761.   INPUT 6 {\{13}\{10}\{13}$ }
  6762.   IF FAIL STOP 1 INPUT timeout
  6763.   PAUSE 1
  6764.   OUTPUT logout\{13}
  6765.   close
  6766.   exit
  6767.  
  6768.    The commands generated by Kermit during CONNECT (INPUT, IF FAIL,
  6769.    PAUSE, and OUTPUT) have uppercase keywords; the commands typed by the
  6770.    user are in whatever form the user typed them (in this case,
  6771.    lowercase).
  6772.  
  6773.    [ [460]Top ] [ [461]Contents ] [ [462]C-Kermit Home ] [ [463]Kermit
  6774.    Home ]
  6775.      _________________________________________________________________
  6776.  
  6777.   8.12. Pattern Matching
  6778.  
  6779.    A pattern is a character string that is used to match other strings.
  6780.    Patterns can contain metacharacters that represent special actions
  6781.    like "match any single character", "match zero or more characters",
  6782.    "match any single character from a list", and so on. The best known
  6783.    application of patterns is in file specifications that contain
  6784.    wildcards, as in "send *.txt", meaning "send all files whose names end
  6785.    with .txt".
  6786.  
  6787.    Patterns are also used in increasingly many other ways, to the extent
  6788.    it is useful to point out certain important distinctions in the ways
  6789.    in which they are used:
  6790.  
  6791.    Anchored Patterns
  6792.           If an anchored pattern does not begin with "*", it must match
  6793.           the beginning of the string, and if it does not end with "*",
  6794.           it must match the end of the string. For example, the anchored
  6795.           pattern "abc" matches only the string "abc", not "abcde" or
  6796.           "xyzabc" or "abcabc". The anchored pattern "abc*" matches any
  6797.           string that starts with "abc"; the anchored pattern "*abc"
  6798.           matches any string that ends with "abc"; the anchored pattern
  6799.           "*abc*" matches any string that contains "abc" (including any
  6800.           that start and/or end with it).
  6801.  
  6802.    Floating Patterns
  6803.           A floating pattern matches any string that contains a substring
  6804.           that matches the pattern. In other words, a floating pattern
  6805.           has an implied "*" at the beginning and end. You can anchor a
  6806.           floating pattern to the beginning by starting it with "^", and
  6807.           you can anchor it to the end by ending it with "$" (see
  6808.           examples below).
  6809.  
  6810.    Wildcards
  6811.           A wildcard is an anchored pattern that has the additional
  6812.           property that "*" does not match directory separators.
  6813.  
  6814.    This terminology lets us describe Kermit's commands with a bit more
  6815.    precision. When a pattern is used for matching filenames, it is a
  6816.    wildcard, except in the TEXT-PATTERNS and BINARY-PATTERNS lists and
  6817.    /EXCEPT: clauses, in which case directory separators are not
  6818.    significant (for example, a BINARY-PATTERN of "*.exe" matches any file
  6819.    whose name ends in .exe, no matter how deeply it might be buried in
  6820.    subdirectories). When Kermit parses a file specification directly,
  6821.    however, it uses the strict wildcard definition. For example, "send
  6822.    a*b" sends all files whose names start with "a" and end with "b" in
  6823.    the current directory, and not any files whose names end with "b" that
  6824.    happen to be in subdirectories whose names start with "a". And as
  6825.    noted, wildcards are anchored, so "delete foo" deletes the file named
  6826.    "foo", and not all files whose names happen to contain "foo".
  6827.  
  6828.    Most other patterns are anchored. For example:
  6829.  
  6830.   if match abc bc ...
  6831.  
  6832.    does not succeed (and you would be surprised if it did!). In fact, the
  6833.    only floating patterns are the ones used by commands or functions that
  6834.    search for patterns in files, arrays, or strings. These include:
  6835.  
  6836.      * The GREP and TYPE /MATCH commands.
  6837.      * The \fsearch(), \frsearch(), and \farraylook() functions.
  6838.  
  6839.    Thus these are the only contexts in which explicit anchors ("^" and
  6840.    "$") may be used:
  6841.  
  6842.    grep abc *.txt
  6843.           Prints all lines containing "abc" in all files whose names end
  6844.           with ".txt".
  6845.  
  6846.    grep ^abc *.txt
  6847.           Prints all lines that start with "abc" in all ".txt" files.
  6848.  
  6849.    grep abc$ *.txt
  6850.           Prints all lines that end with "abc" in all ".txt" files.
  6851.  
  6852.    grep ^a*z$ *.txt
  6853.           Prints all lines that start with "a" and end with "z" in all
  6854.           ".txt" files.
  6855.  
  6856.    Similarly for TYPE /PAGE, /fsearch(), /frsearch(), and \farraylook().
  6857.  
  6858.    Here is a brief summary of anchored and floating pattern equivalences:
  6859.  
  6860.   Anchored   Floating
  6861.     abc       ^abc$
  6862.     *abc      abc$
  6863.     abc*      ^abc
  6864.     *abc*     abc
  6865.  
  6866.    [ [464]Top ] [ [465]Contents ] [ [466]C-Kermit Home ] [ [467]Kermit
  6867.    Home ]
  6868.      _________________________________________________________________
  6869.  
  6870.   8.13. Dates and Times
  6871.  
  6872.    C-Kermit's comprehension of date-time formats is considerably expanded
  6873.    in version 8.0. Any command that reads dates, including the DATE
  6874.    command itself, or any switch, such as the /BEFORE: and /AFTER:
  6875.    switches, or any function such as \fcvtdate(), now can understand
  6876.    dates and times expressed in any ISO 8601 format, in Unix "asctime"
  6877.    format, in FTP MDTM format, and in practically any format used in RFC
  6878.    822 or RFC 2822 electronic mail, with or without timezones, and in a
  6879.    great many other formats as well. HELP DATE briefly summarizes the
  6880.    acceptable date-time formats.
  6881.  
  6882.    Furthermore, C-Kermit 8.0 includes a new and easy-to-use form of
  6883.    date-time arithmetic, in which any date or time can be combined with a
  6884.    "delta time", to add or subtract the desired time interval (years,
  6885.    months, weeks, days, hours, minutes, seconds) to/from the given date.
  6886.    And new functions are available to compare dates and to compute their
  6887.    differences.
  6888.  
  6889.    As you can imagine, all this requires quite a bit of "syntax". The
  6890.    basic format is:
  6891.  
  6892.   [ date ] [ time ] [ delta ]
  6893.  
  6894.    Each field is optional, but in most cases (depending on the context)
  6895.    there must be at least one field. If a date is given, it must come
  6896.    first. If no date is given, the current date is assumed. If no time is
  6897.    given, an appropriate time is supplied depending on whether a date was
  6898.    supplied. If no delta is given, no arithmetic is done. If a delta is
  6899.    given without a date or time, the current date and time are used as
  6900.    the base.
  6901.  
  6902.    Date-time-delta fields are likely to contain spaces (although they
  6903.    need not; space-free forms are always available). Therefore, in most
  6904.    contexts -- and notably as switch arguments -- date-time information
  6905.    must be enclosed in braces or doublequotes, for example:
  6906.  
  6907.   send /after:"8-Aug-2001 12:00 UTC" *.txt
  6908.  
  6909.    Kermit's standard internal format for dates and times is:
  6910.  
  6911.   yyyymmdd hh:mm:ss
  6912.  
  6913.    for example:
  6914.  
  6915.   20010208 10:28:01
  6916.  
  6917.    Date-times can always be given in this format. yyyy is the 4-digit
  6918.    year, mm is the two-digit month (1-12; supply leading zero for
  6919.    Jan-Sep), dd is the 2-digit day (leading zero for 1-9), hh is the hour
  6920.    (0-23), mm the minute (0-59), ss the second (0-59), each with leading
  6921.    zero if less than the field width. The date and time can be separated
  6922.    by a space, an underscore, a colon, or the letter T. The time is in
  6923.    24-hour format. Thus the various quantites are at the following fixed
  6924.    positions:
  6925.  
  6926. Position  Contents                    
  6927.    1-4    Year   (4 digits, 0000-9999)
  6928.    5-6    Month  (2 digits, 1-12)
  6929.    7-8    Day    (2 digits, 1-31)
  6930.    9      Date-Time Separator (space, :, _, or the letter T)
  6931.   10-11   Hour   (2 digits, 0-23)
  6932.   12      Hour-Minute Separator (colon)
  6933.   13-14   Minute (2 digits, 0-59)
  6934.   15      Minute-Second Separator (colon)
  6935.   16-17   Second (2 digits, 0-59)
  6936.  
  6937.    Example:
  6938.  
  6939.   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
  6940.  
  6941.    This is the format produced by the DATE command and by any function
  6942.    that returns a date-time. It is suitable for lexical comparison and
  6943.    sorting, and for use as a date-time in any Kermit command. When this
  6944.    format is given as input to a command or function, various date-time
  6945.    separators (as noted) are accepted:
  6946.  
  6947.   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
  6948.   20010208_10:28:35  2 February 2001, 10:28:35 AM
  6949.   18580101:12:00:00  1 January 1858, noon
  6950.   20110208T00:00:00  2 February 2011, midnight
  6951.  
  6952.    Certain other special date-time formats that are encountered on
  6953.    computer networks are recognized:
  6954.  
  6955.    Asctime Format
  6956.           This is a fixed format used by Unix, named after Unix's
  6957.           asctime() ("ASCII time") function. It is always exactly 24
  6958.           characters long. Example: Fri Aug 10 16:38:01 2001
  6959.  
  6960.    Asctime with Timezone
  6961.           This is like Asctime format, but includes a 3-character
  6962.           timezone between the time and year. It is exactly 28 characters
  6963.           long. Example: Fri Aug 10 16:38:01 GMT 2001
  6964.  
  6965.    E-Mail Format
  6966.           E-mail date-time formats are defined in [468]RFC 2822 with a
  6967.           fair amount of flexibility and options. The following examples
  6968.           are typical of e-mails and HTTP (web-page) headers:
  6969.  
  6970.   Sat, 14 Jul 2001 11:49:29                (No timezone)
  6971.   Fri, 24 Mar 2000 14:19:59 EST            (Symbolic timezone)
  6972.   Tue, 26 Jun 2001 10:19:45 -0400 (EDT)    (GMT Offset + comment)
  6973.  
  6974.    FTP MDTM Format
  6975.           This is the date-time format supplied by FTP servers that
  6976.           support the (not yet standard but widely used nevertheless)
  6977.           MDTM command, by which the FTP client asks for a file's
  6978.           modification time:
  6979.  
  6980.   yyyymmddhhmmss[.ffff]
  6981.  
  6982.           where yyyy is the 4-digit year, mm is the 2-digit month, and so
  6983.           on, exactly 14 digits long. An optional fractional part
  6984.           (fraction of second) may also be included, separated by a
  6985.           decimal point (period). Kermit rounds to the nearest second.
  6986.           Example:
  6987.  
  6988.   20020208102835.515                       (8 February 2002 10:28:36 AM)
  6989.  
  6990.     8.13.1. The Date
  6991.  
  6992.    The date, if given, must precede the time and/or delta, and can be in
  6993.    many, many formats. For starters, you can use several symbolic date
  6994.    names in place of actual dates:
  6995.  
  6996.    NOW
  6997.           This is replaced by the current date and time. The time can not
  6998.           be overriden (if you want to supply a specific time, use TODAY
  6999.           rather than NOW).
  7000.  
  7001.    TODAY
  7002.           This is replaced by the current date and a default time of
  7003.           00:00:00 is supplied, but can be overridden by a specific time;
  7004.           for example, if today is 8 February 2002, then "TODAY" is
  7005.           "20020802 00:00:00" but "TODAY 10:28" is "20020802 10:28:00".
  7006.  
  7007.    TOMORROW
  7008.           Like TODAY, but one day later (if today is 8 February 2002,
  7009.           then "TOMORROW" is "20020803 00:00:00" but "TOMORROW 16:30" is
  7010.           "20020803 16:30:00").
  7011.  
  7012.    YESTERDAY
  7013.           Like TODAY, but one day earlier.
  7014.  
  7015.    MONDAY, TUESDAY, WEDNESDAY, ..., SUNDAY
  7016.           The date on the given day of the week, today or later. A
  7017.           default time of 00:00:00 is supplied but can be overridden.
  7018.           Example: "SATURDAY 12:00" means next Saturday (or today, if
  7019.           today is Saturday) at noon.
  7020.  
  7021.    You can give an explicit date in almost any conceivable format, but
  7022.    there are some rules:
  7023.  
  7024.      * If a date is given, it must have three fields: day, month, and
  7025.        year; the order can vary (except that the month can not be last).
  7026.      * If names are used for days, months, etc, they must be English.
  7027.      * The year must lie between 0000 and 9999, inclusive.
  7028.      * All calendar calculations use Gregorian dating, so calculated
  7029.        dates for years prior to 1582 (or later, depending on the country)
  7030.        will not agree with historical dates. Other forms of dating (e.g.
  7031.        Hebrew, Chinese) are not supported.
  7032.  
  7033.    Various date-field separators are accepted: hyphen, slash, space,
  7034.    underscore, period. The same field separator (if any) must be used in
  7035.    both places; for example 18-Sep-2001 but not 18-Sep/2001. Months can
  7036.    be numeric (1-12) or English names or abbreviations. Month name
  7037.    abbreviations are normally three letters, e.g. Apr, May, Jun, Jul.
  7038.    Capitalization doesn't matter.
  7039.  
  7040.    Here are a few examples:
  7041.  
  7042.   18 Sep 2001                              (English month, abbreviated)
  7043.   18 September 2001                        (English month, spelled out)
  7044.   2001 Sept 18                             (Year, month, day)
  7045.   18-Sep-2001                              (With hyphens)
  7046.   18/09/2001                               (All numeric with slashes)
  7047.   18.09.2001                               (Ditto, with periods)
  7048.   18_09_2001                               (Ditto, with underscores)
  7049.   09/18/2001                               (See below)
  7050.   2001/09/18                               (See below)
  7051.   September 18, 2001                       (Correspondence style)
  7052.   Sep-18-2001                              (Month-day-year)
  7053.   20010918                                 (Numeric, no separators)
  7054.  
  7055.    You can also include the day of the week with a specific date, in
  7056.    which case it is accepted (if it is a valid day name), but not
  7057.    verified to agree with the given date:
  7058.  
  7059.   Tue, 18 Sep 2001                         (Abbreviated, with comma)
  7060.   Tue,18 Sep 2001                          (Comma but no space)
  7061.   Tue 18 Sep 2001                          (Abbreviated, no comma)
  7062.   Tuesday 18 Sep 2001                      (Spelled out)
  7063.   Tuesday, 18 Sep 2001                     (etc)
  7064.   Friday, 18 Sep 2001                      (Accepted even if not Friday)
  7065.  
  7066.    In all-numeric dates with the year last, such as 18/09/2001, Kermit
  7067.    identifies the year because it's 4 digits, then decides which of the
  7068.    other two numbers is the month or day based on its value. If both are
  7069.    12 or less and are unequal, the date is ambiguous and is rejected. In
  7070.    all-numeric dates with the year first, the second field is always the
  7071.    month and the third is the day. The month never comes last. A date
  7072.    with no separators is accepted only if it is all numeric and has
  7073.    exactly eight digits, and is assumed to be in yyyymmdd format.
  7074.  
  7075.   20010918                                 (18-Sep-2001 00:00:00)
  7076.  
  7077.    or 14 digits (as in FTP MDTM format):
  7078.  
  7079.   20010918123456                           (18-Sep-2001 12:34:56)
  7080.  
  7081.    You can always avoid ambiguity by putting the year first, or by using
  7082.    an English, rather than numeric, month. A date such as 09/08/2001
  7083.    would be ambiguous but 2001/09/08 is not, nor is 09-Aug-2001.
  7084.  
  7085.    Until the late 1990s, it was common to encounter 2-digit years, and
  7086.    these are found to this day in old e-mails and other documents. Kermit
  7087.    accepts these dates if they have English months, and interprets them
  7088.    according to the windowing rules of [469]RFC 2822: "If a two digit
  7089.    year is encountered whose value is between 00 and 49, the year is
  7090.    interpreted by adding 2000, ending up with a value between 2000 and
  7091.    2049. If a two digit year is encountered with a value between 50 and
  7092.    99, or any three digit year is encountered, the year is interpreted by
  7093.    adding 1900."
  7094.  
  7095.    If you need to specify a year prior to 1000, use leading zeros to
  7096.    ensure it is not misinterpreted as a "non-Y2K-compliant" modern year:
  7097.  
  7098.   7-Oct-77                                 (19771007 00:00:00)
  7099.   7-Oct-0077                               (00771007 00:00:00)
  7100.  
  7101.     8.13.2. The Time
  7102.  
  7103.    The basic time format is hh:mm:dd; that is hours, minutes, seconds,
  7104.    separated by colons, perhaps with an optional fractional second
  7105.    separated by a decimal point (period). The hours are in 24-hour
  7106.    format; 12 is noon, 13 is 1pm, and so on. Fields omitted from the
  7107.    right default to zero. Fields can be omitted from the left or middle
  7108.    by including the field's terminating colon. Examples:
  7109.  
  7110.   11:59:59                                 (11:59:59 AM)
  7111.   11:59                                    (11:59:00 AM)
  7112.   11                                       (11:00:00 AM)
  7113.   11:59:59.33                              (11:59:59 AM)
  7114.   11:59:59.66                              (Noon)
  7115.   03:21:00                                 (3:21:00 AM)
  7116.   3:21:00                                  (3:21:00 AM)
  7117.   15:21:00                                 (3:21:00 PM)
  7118.   :21:00                                   (00:21:00 AM)
  7119.   ::01                                     (00:00:01 AM)
  7120.   11::59                                   (11:00:59 AM)
  7121.  
  7122.    Leading zeros can be omitted, but it is customary and more readable to
  7123.    keep them in the minute and second fields:
  7124.  
  7125.   03:02:01                                 (03:02:01 AM)
  7126.   3:02:01                                  (03:02:01 AM)
  7127.   3:2:1                                    (03:02:01 AM)
  7128.  
  7129.    AM/PM notation is accepted if you wish to use it:
  7130.  
  7131.   11:59:59                                 (11:59:59 AM)
  7132.   11:59:59AM                               (11:59:59 AM)
  7133.   11:59:59A.M.                             (11:59:59 AM)
  7134.   11:59:59am                               (11:59:59 AM)
  7135.   11:59:59a.m.                             (11:59:59 AM)
  7136.   11:59:59PM                               (11:59:59 PM = 23:59:59)
  7137.   11:59:59P.M.                             (11:59:59 PM = 23:59:59)
  7138.   11:59:59pm                               (11:59:59 PM = 23:59:59)
  7139.   11:59:59p.m.                             (11:59:59 PM = 23:59:59)
  7140.  
  7141.    You can omit the colons if you wish, in which case Kermit uses the
  7142.    following rules to interpret the time:
  7143.  
  7144.     1. 6 digits is hh:mm:ss, e.g. 123456 is 12:34:56.
  7145.     2. 5 digits is h:mm:ss, e.g. 12345 is 1:23:45.
  7146.     3. 4 digits is hh:mm, e.g. 1234 is 12:34.
  7147.     4. 3 digits is h:mm, e.g. 123 is 1:23.
  7148.     5. 2 digits is hh, e.g. 12 is 12:00.
  7149.     6. 1 digit is h (the hour), e.g. 1 is 1:00.
  7150.  
  7151.    Examples:
  7152.  
  7153.   1                                        (01:00:00 AM)
  7154.   10                                       (10:00:00 AM)
  7155.   230                                      (02:30:00 AM)
  7156.   230pm                                    (02:30:00 PM = 14:30:00)
  7157.   1115                                     (11:15:00 AM)
  7158.   2315                                     (11:15:00 PM = 23:15:00 PM)
  7159.   23150                                    (02:31:50 AM)
  7160.   231500                                   (23:15:00 PM)
  7161.  
  7162.     8.13.3. Time Zones
  7163.  
  7164.    If a time is given, it can (but need not) be followed by a time zone
  7165.    designator. If no time zone is included, the time is treated as local
  7166.    time and no timezone conversions are performed.
  7167.  
  7168.    The preferred time zone designator is the UTC Offset, as specified in
  7169.    [470]RFC 2822: a plus sign or minus sign immediately followed by
  7170.    exactly four decimal digits, signifying the difference in hh (hours)
  7171.    and mm (minutes) from Universal Coordinated Time (UTC, also known as
  7172.    Greenwich Mean Time, or GMT), with negative numbers to the West and
  7173.    positive numbers to the East. For example:
  7174.  
  7175.   Fri, 13 Jul 2001 12:54:29 -0700
  7176.  
  7177.    indicates a local time of 12:54:29 that is 07 hours and 00 minutes
  7178.    behind (less than, East of) Universal Time. The space is optional, so
  7179.    the example could also be written as:
  7180.  
  7181.   Fri, 13 Jul 2001 12:54:29-0700
  7182.  
  7183.    The following symbolic time zones are also accepted, as specified by
  7184.    [471]RFC 2822 and/or in ISO 8601:
  7185.  
  7186.   GMT  =  +0000       Greenwich Mean Time
  7187.   Z    =  +0000       Zulu (Zero Meridian) Time
  7188.   UTC  =  +0000       Universal Coordinated Time
  7189.   UT   =  +0000       Universal Time
  7190.   EDT  =  -0400       Eastern (USA) Daylight Time
  7191.   EST  =  -0500       Eastern (USA) Standard Time
  7192.   CDT  =  -0500       Central (USA) Daylight Time
  7193.   CST  =  -0600       Central (USA) Standard Time
  7194.   MDT  =  -0600       Mountain (USA) Daylight Time
  7195.   MST  =  -0700       Mountain (USA) Standard Time
  7196.   PDT  =  -0700       Pacific (USA) Daylight Time
  7197.   PST  =  -0800       Pacific (USA) Standard Time
  7198.  
  7199.    Note that GMT, Z, UTC, and UT all express the same concept: standard
  7200.    (not daylight) time at the Zero Meridian. UTC, by the way, is an
  7201.    international standard symbol and does not correspond to the order of
  7202.    the English words, Universal Coordinated Time, but it happens to have
  7203.    the same initial letters as these words. Of course hundreds of other
  7204.    symbolic timezones and variations exist, but they are not
  7205.    standardized, and are therefore not supported by Kermit.
  7206.  
  7207.    When a time zone is included with a time, the time is converted to
  7208.    local time. In case the conversion crosses a midnight boundary, the
  7209.    date is adjusted accordingly. Examples converting to EST (Eastern USA
  7210.    Standard Time = -0500):
  7211.  
  7212.  11:30:00      =  11:30:00
  7213.  11:30:00 EST  =  11:30:00
  7214.  11:30:00 GMT  =  06:30:00
  7215.  11:30:00 PST  =  14:30:00
  7216.  11:30:00Z     =  06:30:00
  7217.  11:30PM GMT   =  18:30:00
  7218.  11:30 -0500   =  11:30:00
  7219.  11:30 -0800   =  08:30:00
  7220.  11:30 +0200   =  04:30:00
  7221.  
  7222.    Unlike most of Kermit's other date-time conversions, timezone
  7223.    knowledge (specifically, the offset of local time from UTC) is
  7224.    embodied in the underlying operating system, not in Kermit itself, and
  7225.    any conversion errors in this department are the fault of the OS. For
  7226.    example, most UNIX platforms do not perform conversions for years
  7227.    prior to 1970.
  7228.  
  7229.     8.13.4. Delta Time
  7230.  
  7231.    Date/time expressions can be composed of a date and/or time and a
  7232.    delta time, or a delta time by itself. When a delta time is given by
  7233.    itself, it is relative to the current local date and time. Delta times
  7234.    have the following general format:
  7235.  
  7236.   {+,-}[number units][hh[:mm[:ss]]]
  7237.  
  7238.    In other words, a delta time always starts with a plus or minus sign,
  7239.    which is followed by a "part1", a "part2", or both. The "part1", if
  7240.    given, specifies a number of days, weeks, months, or years; "part2"
  7241.    specifies a time in hh:mm:ss notation. In arithmetic terms, these
  7242.    represents some number of days or other big time units, and then a
  7243.    fraction of a day expressed as hours, minutes, and seconds; these are
  7244.    to be added to or subtracted from the given (or implied) date and
  7245.    time. The syntax is somewhat flexible, as shown by the following
  7246.    examples:
  7247.  
  7248.   +1 day                (Plus one day)
  7249.   +1day                 (Ditto)
  7250.   +1d                   (Ditto)
  7251.   + 1 day               (Ditto)
  7252.   + 1 day 3:00          (Plus one day and 3 hours)
  7253.   +1d3:00               (Ditto)
  7254.   +1d3                  (Ditto)
  7255.   +3:00:00              (Plus 3 hours)
  7256.   +3:00                 (Ditto)
  7257.   +3                    (Ditto)
  7258.   +2 days               (Plus 2 days)
  7259.   -12 days 7:14:22      (Minus 12 days, 7 hours, 14 minutes, and 22 seconds)
  7260.  
  7261.    The words "week", "month", and "year" can be used like "day" in the
  7262.    examples above. A week is exactly equivalent to 7 days. When months
  7263.    are specified, the numeric month number of the date is incremented or
  7264.    decremented by the given number, and the year and day adjusted
  7265.    accordingly if necessary (for example, 31-Jan-2001 +1month =
  7266.    03-Mar-2001 because February does not have 31 days). When years are
  7267.    specified, they are added or subtracted to the base year. Examples
  7268.    (assuming the current date is 10-Aug-2001 and the current time is
  7269.    19:21:11):
  7270.  
  7271.   18-Sep-2001 +1day              (20010918 00:00:00)
  7272.   today +1day                    (20010811 00:00:00)
  7273.   now+1d                         (20010811 19:21:11)
  7274.   + 1 day                        (20010811 19:21:11)
  7275.   + 1 day 3:14:42                (20010811 22:35:54)
  7276.   + 7 weeks                      (20010928 19:21:11)
  7277.   +1d3:14:42                     (20010811 22:35:54)
  7278.   +1w3:14:42                     (20010817 22:35:54)
  7279.   +1m3:14:42                     (20010910 22:35:54)
  7280.   +1y3:14:42                     (20020810 22:35:54)
  7281.   2 feb 2001 + 10 years          (20110208 00:00:00)
  7282.   2001-02-08 +10y12              (20110208 12:00:00)
  7283.   31-dec-1999 23:59:59+00:00:01  (20000101 00:00:00)
  7284.   28-feb-1996 +1day              (19960229 00:00:00) (leap year)
  7285.   28-feb-1997 +1day              (19970301 00:00:00) (nonleap year)
  7286.   28-feb-1997 +1month            (19970328 00:00:00)
  7287.   28-feb-1997 +1month 11:59:59   (19970328 11:59:59)
  7288.   28-feb-1997 +20years           (20170228 00:00:00)
  7289.   28-feb-1997 +8000years         (99970228 00:00:00)
  7290.  
  7291.    For compatibility with VMS, the following special delta-time format is
  7292.    also accepted:
  7293.  
  7294.   +number-hh:mm:ss
  7295.   -number-hh:mm:ss
  7296.  
  7297.    (no spaces). The hyphen after the number indicates days. It
  7298.    corresponds exactly to the Kermit notation:
  7299.  
  7300.   +numberdhh:mm:ss
  7301.   -numberdhh:mm:ss
  7302.  
  7303.    The following forms all indicate exactly the same date and time:
  7304.  
  7305.   18-Sep-2001 12:34:56 +1-3:23:01
  7306.   18-Sep-2001 12:34:56 +1d3:23:01
  7307.   18-Sep-2001 12:34:56 +1 day 3:23:01
  7308.  
  7309.    and mean "add a day plus 3 hours, 23 minutes, and 1 second" to the
  7310.    given date.
  7311.  
  7312.    Note that delta times are not at all the same as UTC offsets; the
  7313.    former specifies an adjustment to the given date/time and the latter
  7314.    specifies that the local time is a particular distance from Universal
  7315.    Time, for example:
  7316.  
  7317.   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
  7318.   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
  7319.  
  7320.    If you give a time followed by a modifer that starts with a + or -
  7321.    sign, how does Kermit know whether it's a UTC offset or a delta time?
  7322.    It is treated as a UTC offset if the sign is followed by exactly four
  7323.    decimal digits; otherwise it is a delta time. Examples (for USA
  7324.    Eastern Daylight Time):
  7325.  
  7326.   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
  7327.   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
  7328.   11-Aug-2001 12:34:56 -800           (20010811 04:34:56 -- Delta time)
  7329.   11-Aug-2001 12:34:56 -8             (20010811 04:34:56 -- Delta time)
  7330.  
  7331.    The first example says that at some unknown place which is 8 hours
  7332.    ahead of Universal Time, the time is 12:34:56, and this corresponds to
  7333.    16:34:56 in Eastern Daylight time. The second example says to subtract
  7334.    8 hours from the local time. The third and fourth are delta times
  7335.    because, even though a colon is not included, the time does not
  7336.    consist of exactly 4 digits.
  7337.  
  7338.    When a delta time is written after a timezone, however, there is no
  7339.    ambiguity and no syntax distinction is required:
  7340.  
  7341.   11-Aug-2001 12:34:56 -0800 -0800    (20010811 08:34:56)
  7342.   11-Aug-2001 12:34:56 -0800 -08:00   (Ditto)
  7343.   11-Aug-2001 12:34:56 -08:00 -08:00  (Illegal)
  7344.  
  7345.     8.13.5. The DATE Command
  7346.  
  7347.    Obviously a great many combinations of date, time, time zone, and
  7348.    delta time are possible, as well as many formatting options. The
  7349.    purpose of all this flexibility is to comply with as many standards as
  7350.    possible -- Internet RFCs, ISO standards, and proven corporate
  7351.    standards -- as well as with notations commonly used by real people,
  7352.    in order that dates and times from the widest variety of sources can
  7353.    be assigned to a variable and used in any date-time field in any
  7354.    Kermit command.
  7355.  
  7356.    You can test any date-and/or-time format with the DATE command, which
  7357.    converts it to standard yyyymmdd hh:mm:ss format if it is understood,
  7358.    or else gives an explicit error message (rather than just "BAD DATE"
  7359.    as in previous C-Kermit releases) to indicate what is wrong with it.
  7360.    Examples (on Tuesday, 31 July 2001 in New York City, Eastern Daylight
  7361.    Time, UTC -0400):
  7362.  
  7363.   DATE command argument                   Result           
  7364.   12:30                                   20010731 12:30:00
  7365.   12:30:01                                20010731 12:30:01
  7366.   12:30:01.5                              20010731 12:30:02
  7367.   1230                                    20010731 12:30:00
  7368.   230                                     20010731 02:30:00
  7369.   230+1d                                  20010801 02:30:00
  7370.   230+1d3:00                              20010801 05:30:00
  7371.   20010718 19:21:15                       20010718 19:21:15
  7372.   20010718_192115                         20010718 19:21:15
  7373.   20010718T192115                         20010718 19:21:15
  7374.   18 Jul 2001 +0400                       20010717 23:59:59
  7375.   18 Jul 2001 192115                      20010718 19:21:15
  7376.   18 Jul 2001 192115.8                    20010718 19:21:16
  7377.   18-Jul-2001T1921                        20010718 19:21:00
  7378.   18-Jul-2001 1921Z                       20010718 15:21:00
  7379.   18-Jul-2001 1921 GMT                    20010718 15:21:00
  7380.   18-Jul-2001 1921 UTC                    20010718 15:21:00
  7381.   18-Jul-2001 1921 Z                      20010718 15:21:00
  7382.   18-Jul-2001 1921Z                       20010718 15:21:00
  7383.   18-Jul-2001 1921 -04:00:00              20010718 19:21:00
  7384.   21-Jul-2001_08:20:00am                  20010721 08:20:00
  7385.   21-Jul-2001_8:20:00P.M.                 20010721 20:20:00
  7386.   Fri Jul 20 11:26:25 2001                20010720 11:26:25
  7387.   Fri Jul 20 11:26:25 GMT 2001            20010720 07:26:25
  7388.   Sun, 9 Apr 2000 06:46:46 +0100          20000409 01:46:46
  7389.   Sunday, 9 Apr 2000 06:46:46 +0100       20000409 01:46:46
  7390.   now                                     20010731 19:41:12
  7391.   today                                   20010731 00:00:00
  7392.   today 09:00                             20010731 09:00:00
  7393.   tomorrow                                20010801 00:00:00
  7394.   tomorrow 09:00                          20010801 09:00:00
  7395.   tomorrow 09:00 GMT                      20010801 05:00:00
  7396.   yesterday                               20010730 00:00:00
  7397.   yesterday 09:00                         20010730 09:00:00
  7398.   + 3 days                                20010803 00:00:00
  7399.   +3 days                                 20010803 00:00:00
  7400.   +3days                                  20010803 00:00:00
  7401.   + 3days                                 20010803 00:00:00
  7402.   + 3 days 09:00                          20010803 09:00:00
  7403.   + 2 weeks                               20010814 00:00:00
  7404.   + 1 month                               20010831 00:00:00
  7405.   - 7 months                              20001231 00:00:00
  7406.   + 10 years                              20110731 00:00:00
  7407.   friday                                  20010803 00:00:00
  7408.   saturday                                20010804 00:00:00
  7409.   sunday                                  20010805 00:00:00
  7410.   monday                                  20010806 00:00:00
  7411.   tuesday                                 20010731 00:00:00
  7412.   wednesday                               20010801 00:00:00
  7413.   thursday                                20010802 00:00:00
  7414.   friday 07:00                            20010803 07:00:00
  7415.   thursday 1:00pm                         20010802 13:00:00
  7416.   thursday 1:00pm GMT                     20010802 09:00:00
  7417.   Thu, 10 Nov 94 10:50:47 EST             19941110 10:50:47
  7418.   Fri, 20 Oct 1995 18:35:15 -0400 (EDT)   19951020 18:35:15
  7419.   31/12/2001                              20011231 00:00:00
  7420.   12/31/2001                              20011231 00:00:00
  7421.   2001-July-20                            20010720 00:00:00
  7422.   2001-September-30                       20010930 00:00:00
  7423.   30-September-2001                       20010930 00:00:00
  7424.   Sep 30, 2001 12:34:56                   20010930 12:34:56
  7425.   September 30, 2001                      20010930 00:00:00
  7426.   September 30, 2001 630                  20010930 06:30:00
  7427.   September 30 2001 630                   20010930 06:30:00
  7428.   Sep-30-2001 12:34:59                    20010930 12:34:59
  7429.   20010807113542.014                      20010807 11:35.42
  7430.   20010807113542.014Z                     20010807 07:35:42
  7431.  
  7432.     8.13.6. New Date-Time Functions
  7433.  
  7434.    In the following descriptions, date-time function arguments are the
  7435.    same free-format date-time strings discussed above, with the same
  7436.    defaults for missing fields. They are automatically converted to
  7437.    standard format internally prior to processing.
  7438.  
  7439.    \fcvtdate(d1)
  7440.           Converts the date-time d1 to standard format and local time.
  7441.           This function is not new, but now it accepts a wider range of
  7442.           argument formats that can include timezones and/or delta times.
  7443.           If the first argument is omitted, the current date and time are
  7444.           assumed. The optional second argument is a format code for the
  7445.           result:
  7446.  
  7447.      n1 = 1: yyyy-mmm-dd hh:mm:ss (mmm = English 3-letter month
  7448.      abbreviation)
  7449.      n1 = 2: dd-mmm-yyyy hh:mm:ss (ditto)
  7450.      n1 = 3: yyyymmddhhmmss (all numeric)
  7451.  
  7452.    \futcdate(d1)
  7453.           Converts the date-time d1 to Universal Coordinated Time (UTC),
  7454.           also known as GMT or Zulu or Zero-Meridian time. The default d1
  7455.           is NOW. If d1 is a valid date-time, the UTC result is returned
  7456.           in standard format, yyyymmdd hh:ss:mm.
  7457.  
  7458.    \fcmpdates(d1,d2)
  7459.           Compares two free-format date-times, d1 and d2, and, if both
  7460.           arguments are valid, returns a number: -1 if d1 is earlier than
  7461.           (before) d2; 0 if d1 is the same as d2; 1 if d1 is later than
  7462.           (after) d2.
  7463.  
  7464.    \fdiffdates(d1,d2)
  7465.           Computes the difference between two free-format date-times, d1
  7466.           and d2. If both arguments are valid, returns a delta time which
  7467.           is negative if d1 is earlier than (before) d2 and positive
  7468.           otherwise. If d1 and d2 are equal, the result is "+0:00".
  7469.           Otherwise, the result consists of the number of days, hours,
  7470.           minutes, and seconds that separate the two date-times. If the
  7471.           number of days is zero, it is omitted. If the number of days is
  7472.           nonzero but the hours, minutes, and seconds are all zero, the
  7473.           time is omitted. if the seconds are zero, they are omitted.
  7474.  
  7475.    \fdelta2secs(dt)
  7476.           Converts a delta time to seconds. For example, "+1d00:00:01" to
  7477.           86401. Valid delta times must start with a + or - sign. Days
  7478.           are accepted as time units, but not years, months, or weeks. If
  7479.           the result would overflow a computer long word (as would happen
  7480.           with 32-bit long words when the number of days is greater than
  7481.           24854), the function fails.
  7482.  
  7483.    HINT: Although Kermit has a number of built-in date and time
  7484.    variables, it doesn't have a single one suitable for writing a
  7485.    timestamp. For this you would normally use something like "\v(ndate)
  7486.    \v(time)". But \fcvtdate() (with no arguments) is equivalent: it
  7487.    returns the current date and time in yyyymmdd hh:mm:ss format,
  7488.    suitable for time stamping.
  7489.  
  7490.     8.13.7. Date-Time Programming Examples
  7491.  
  7492.    Here's a macro that converts any date-time to UTC, which you might use
  7493.    if C-Kermit didn't already have a \futcdate() function:
  7494.  
  7495.   define utcdate {
  7496.       .local := \fcvtdate(\%*)                 ; 1.
  7497.       .tmp := \fcvtdate(\m(local)UTC)          ; 2.
  7498.       .offset := \fdiffdate(\m(local),\m(tmp)) ; 3.
  7499.       .utc := \fcvtdate(\m(local)\m(offset))   ; 4.
  7500.       sho mac utc                              ; 5.
  7501.   }
  7502.  
  7503.    Brief explanation: Line 1 converts the macro argument, a free-format
  7504.    date-time, to standard-format local time. Line 2 appends the "UTC"
  7505.    timezone to the local time and converts the result to local time. In
  7506.    other words, we take the same time as the local time, but pretend it's
  7507.    UTC time, and convert it to local time. For example, if New York time
  7508.    is 4 hours ahead of UTC, then 6:00pm New York time is 2:00pm UTC. Line
  7509.    3 gets the difference of the two results (e.g. "+04:00"). Line 4
  7510.    appends the difference (delta time) to the local time, and converts it
  7511.    again, which adds (or subtracts) the UTC offset to the given time.
  7512.    Line 5 displays the result.
  7513.  
  7514.    Here's a script that opens a web page, gets its headers into an array,
  7515.    scans the array for the "Last-Modified:" header, and inteprets it:
  7516.   http open www.columbia.edu
  7517.   if fail stop 1 HTTP OPEN failed
  7518.   http /array:a head index.html /dev/null
  7519.   if fail stop 1 HTTP GET failed
  7520.   show array a
  7521.   for \%i 1 \fdim(&a) 1 {
  7522.       .\%x := \findex(:,\&a[\%i])
  7523.       if not \%x continue
  7524.       .tag := \fleft(\&a[\%i],\%x-1)
  7525.       .val := \fltrim(\fsubstr(\&a[\%i],\%x+1))
  7526.       if ( eq "\m(tag)" "Last-Modified" ) {
  7527.           echo HTTP Date: \m(val)
  7528.           .rdate := \fcvtdate(\m(val))
  7529.           echo {Standard Date (local): \m(rdate)}
  7530.           echo {Standard Date (UTC):   \futcdate(\m(rdate))}
  7531.           break
  7532.       }
  7533.   }
  7534.   http close
  7535.  
  7536.    The result:
  7537.  
  7538.   HTTP Date: Mon, 13 Aug 2001 20:05:42 GMT
  7539.   Standard Date (local): 20010813 16:05:42
  7540.   Standard Date (UTC):   20010813 20:05:42
  7541.  
  7542.    As you can see, Kermit had no trouble decoding the date-time-string
  7543.    from the website, converting to local time, and converting back to UTC
  7544.    with no conflicts or loss of information. If it had been in any other
  7545.    known format, the result would have been the same.
  7546.  
  7547.    Now suppose we want to download the web page only if it is newer than
  7548.    our local copy. The \fdate(filename) function (which returns the
  7549.    modification date-time of the given file) and the new \fcmpdates()
  7550.    function make it easy. Insert the following just before the BREAK
  7551.    statement:
  7552.  
  7553.   if ( < 0 \fcmpdates(\m(rdate),\fdate(index.html)) ) {
  7554.      echo GETTING index.html...
  7555.      http get index.html index.html
  7556.      if success echo HTTP GET OK
  7557.   } else {
  7558.      echo index.html: no update needed
  7559.   }
  7560.   http close
  7561.   exit
  7562.  
  7563.    This says, "if 0 is less than the comparison of the remote file date
  7564.    and the local file date, get the remote file, otherwise skip it." And
  7565.    it automatically reconciles the time-zone difference (if any).
  7566.  
  7567.    It would be nice to be able to extend this script into a
  7568.    general-purpose website updater, but unfortunately HTTP protocol
  7569.    doesn't provide any mechanism for the client to ask the server for a
  7570.    list of files, recursive or otherwise.
  7571.  
  7572.    [ [472]Top ] [ [473]Contents ] [ [474]C-Kermit Home ] [ [475]Kermit
  7573.    Home ]
  7574.      _________________________________________________________________
  7575.  
  7576.   8.14. Trapping Keyboard Interruption
  7577.  
  7578.    Normally when you type Ctrl-C and Kermit is in command mode (as
  7579.    opposed to CONNECT mode) with COMMAND INTERRUPTION ON (as it is unless
  7580.    you have set it OFF), Kermit interrupts any command that is currently
  7581.    in progress, and if a command file or macro is executing, rolls the
  7582.    command stack back to top level, closing all open command files,
  7583.    deactivating all macros, deallocating all local variables and arrays,
  7584.    and leaving you at the command prompt.
  7585.  
  7586.    Suppose, however, you want certain actions to occur when a script is
  7587.    interrupted; for example, closing open files, writing log entries, or
  7588.    displaying summary results. You can do this by defining a macro named
  7589.    ON_CTRLC. When Ctrl-C is detected, and a macro with this name is
  7590.    defined, Kermit executes it from the current command level, thus
  7591.    giving it full access to the environment in which the interruption
  7592.    occurred, including local variables and open files. Only when the
  7593.    ON_CTRLC macro completes execution is the command stack rolled back to
  7594.    top level.
  7595.  
  7596.    Once the ON_CTRLC macro is defined, it can be executed only once. This
  7597.    is to prevent recursion if the user types Ctrl-C while the ON_CTRLC
  7598.    macro is executing. If you type Ctrl-C while the Ctrl-C macro is
  7599.    active, this does not start a new copy of ON_CTRLC; rather, it returns
  7600.    to the top-level command prompt. After the ON_CTRLC macro returns, it
  7601.    has been removed from the macro table so if you want to use it again
  7602.    or install a different Ctrl-C trap, you must execute a new DEFINE
  7603.    ON_CTRLC command. In any case, as always when you interrupt a script
  7604.    with Ctrl-C, its completion status is FAILURE.
  7605.  
  7606.    Normally the ON_CTRLC macro would be defined in the command file or
  7607.    macro to which it applies, and should be declared LOCAL. This way, if
  7608.    the command file or macro completes successfully without being
  7609.    interrupted, the ON_CTRLC definition disappears automatically.
  7610.    Otherwise the definition would still be valid and the macro would be
  7611.    executed, probably out of context, the next time you typed Ctrl-C.
  7612.  
  7613.    Here's a simple example of a command file that sets a Ctrl-C trap for
  7614.    itself:
  7615.  
  7616.   local on_ctrlc              ; Make Ctrl-C trap local to this command file.
  7617.   define on_ctrlc {           ; Define the ON_CTRLC macro.
  7618.       echo Interrupted at \v(time).
  7619.       echo Iterations: \%n
  7620.   }
  7621.   xecho Type Ctrl-C to quit
  7622.   for \%n 1 999 1 {           ; Prints a dot every second until interrupted.
  7623.       sleep 1
  7624.       xecho .
  7625.   }
  7626.   echo Finished normally at \v(time) ; Get here only if not interrupted.
  7627.   decrement \%n
  7628.   echo Iterations: \%n
  7629.  
  7630.    This prints a summary no matter whether it completes normally or is
  7631.    interrupted from the keyboard. In both cases the trap is automatically
  7632.    removed afterwards.
  7633.  
  7634.    For an example of how to use ON_CTRLC to debug scripts, see
  7635.    [476]Section 8.1.
  7636.  
  7637.    [ [477]Top ] [ [478]Contents ] [ [479]C-Kermit Home ] [ [480]Kermit
  7638.    Home ]
  7639.   __________________________________________________________________________
  7640.  
  7641. 9. S-EXPRESSIONS
  7642.  
  7643.    This section is primarily for those who want to write
  7644.    calculation-intensive scripts, especially if they require
  7645.    floating-point arithmetic, and/or for those who are familiar with the
  7646.    LISP programming language.
  7647.  
  7648.    Ever since C-Kermit version 5 was released in 1988, scripting has been
  7649.    one of its major attractions, and arithmetic is a key part of it.
  7650.    Versions 5 and 6 included integer arithmetic only, using traditional
  7651.    algebraic notation, e.g.:
  7652.  
  7653.   echo \fevaluate(3*(2+7)/2)
  7654.   13
  7655.  
  7656.    C-Kermit 7.0 added support for floating-point arithmetic, but only
  7657.    through function calls:
  7658.  
  7659.   echo \ffpdivide(\ffpmultiply(3.0,\ffpadd(2.0,7.0)),2.0)
  7660.   13.5
  7661.  
  7662.    C-Kermit 8.0 introduces a third form of arithmetic that treats
  7663.    integers and floating-point numbers uniformly, is easier to read and
  7664.    write, and executes very quickly:
  7665.  
  7666.   (/ (* 3 (+ 2 7)) 2)
  7667.   13.5
  7668.  
  7669.    But first some background.
  7670.  
  7671.    The Kermit command and scripting language differs from true
  7672.    programming languages (such as C or Fortran) in many ways; one of the
  7673.    most prominent differences is the way in which variables are
  7674.    distinguished from constants. In a command language, words are taken
  7675.    literally; for example, the Unix shell:
  7676.  
  7677.   cat foo.bar
  7678.  
  7679.    displays the file named foo.bar. Whereas in a programming language
  7680.    like C, words are assumed to be variables:
  7681.  
  7682.   s = foo.bar;    /* Assigns the value of foo.bar to the variable s */
  7683.  
  7684.    To make a programming language take words literally, you have to quote
  7685.    or "escape" them:
  7686.  
  7687.   s = "foo.bar";  /* Assigns a pointer to the string "foo.bar" to the variable
  7688. s */
  7689.  
  7690.    The opposite holds for command languages: to get them to treat a word
  7691.    as a variable rather than a constant, you have to escape them. For
  7692.    example, in the Unix shell:
  7693.  
  7694.   foo=123         ; Assign value 123 to variable foo.
  7695.   echo foo        ; Prints "foo"
  7696.   echo $foo       ; Prints "123"
  7697.  
  7698.    And in Kermit:
  7699.  
  7700.   define foo 123  ; Assign value 123 to variable foo.
  7701.   echo 123        ; This prints "123".
  7702.   echo foo        ; This prints "foo".
  7703.   echo \m(foo)    ; This prints "123".
  7704.  
  7705.    In other words, character strings (such as "foo" above) are
  7706.    interpreted as literal strings, rather than variable names, except in
  7707.    special commands like DEFINE that deal specifically with variable
  7708.    names (or in numeric contexts as explained in [481]Section 8.2). The
  7709.    special "escape" character (dollar sign ($) for the shell, backslash
  7710.    (\) for Kermit) indicates that a variable is to be replaced by its
  7711.    value.
  7712.  
  7713.    The requirement to escape variable names in command languages normally
  7714.    does not impose any special hardship, but can add a considerable
  7715.    notational burden to arithmetic expressions, which are typically full
  7716.    of variables. Especially in Kermit when floating point numbers are
  7717.    involved, where you must use special \ffpxxx() functions, e.g.
  7718.    "\ffpadd(\m(a),\m(b))" rather than the simple "+" operator to add two
  7719.    floating-point numbers together, because the original arithmetic
  7720.    handler doesn't support floating point (this might change in the
  7721.    future). To illustrate, the general formula for the area of a triangle
  7722.    is:
  7723.  
  7724.   sqrt(s * (s - a) * (s - b) * (s - c))
  7725.  
  7726.    where a, b, and c are the lengths of the triangle's three sides and:
  7727.  
  7728.   s = (a + b + c) / 2
  7729.  
  7730.    Except in special cases (e.g. a = 3, b = 4, c = 5), the result has a
  7731.    fractional part so the computation must be done using floating-point
  7732.    arithmetic. We can create a Kermit 7.0 function for this as follows:
  7733.  
  7734.   def area {
  7735.       local s t1 t2 t3
  7736.       assign s \ffpdiv(\ffpadd(\ffpadd(\%1,\%2),\%3),2.0)
  7737.       assign t1 \ffpsub(\m(s),\%1)
  7738.       assign t2 \ffpsub(\m(s),\%2)
  7739.       assign t3 \ffpsub(\m(s),\%3)
  7740.       return \ffpsqrt(\ffpmul(\m(s),\ffpmul(\m(t1),\ffpmul(\m(t2),\m(t3)))))
  7741.   }
  7742.  
  7743.    But as you can see, this is rather cumbersome. Note, in particular,
  7744.    that arithmetic functions like \ffpadd(), \ffpmul(), etc, take exactly
  7745.    two operands (like their symbolic counterparts + and *), so obtaining
  7746.    the product of three or more numbers (as we do in this case) is
  7747.    awkward.
  7748.  
  7749.    Using the alternative S-Expression notation, we can reduce this to a
  7750.    form that is both easier to read and executes faster (the details are
  7751.    explained later):
  7752.  
  7753.   def newarea {
  7754.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  7755.       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  7756.   }
  7757.  
  7758.    In both examples, the \%1..3 variables are the normal Kermit macro
  7759.    arguments, referenced by the normal escaping mechanism. For increased
  7760.    readability, we can also assign the macro arguments \%1, \%2, and \%3
  7761.    to the letters a, b, and c corresponding to our formula:
  7762.  
  7763. def newarea {
  7764.     (let a \%1 b \%2 c \%3)
  7765.     (let s (/ (+ a b c) 2.0))
  7766.     (sqrt (* s (- s a) (- s b) (- s c)))
  7767. }
  7768.  
  7769.    And now the Kermit function reads almost like the original formula.
  7770.    Here Kermit behaves more like a regular programming language. In an
  7771.    S-Expression, macro names need not be escaped when they are used as
  7772.    the names of numeric variables.
  7773.  
  7774.    [ [482]Top ] [ [483]Contents ] [ [484]C-Kermit Home ] [ [485]Kermit
  7775.    Home ]
  7776.      _________________________________________________________________
  7777.  
  7778.   9.1. What is an S-Expression?
  7779.  
  7780.    The S-Expression concept is borrowed from the Lisp programming
  7781.    language. "S-Expression" is short for Symbolic Expression (itself
  7782.    sometimes shortened to SEXP). S-Expressions provide a kind of
  7783.    Alternative Mini-Universe within the Kermit command language when the
  7784.    regular rules don't apply, a universe enclosed in parentheses.
  7785.  
  7786.    C-Kermit does not pretend to be a full Lisp interpreter; only the
  7787.    arithmetic parts of Lisp have been incorporated: S-Expressions that
  7788.    operate on numbers and return numeric values (plus extensibility
  7789.    features described in [486]Section 9.8, which allow some degree of
  7790.    string processing).
  7791.  
  7792.    An S-Expression is a list of zero or more items, separated by spaces,
  7793.    within parentheses. Examples:
  7794.  
  7795.   ()
  7796.   (1)
  7797.   (a)
  7798.   (+ a 1)
  7799.   (* 2 a b)
  7800.  
  7801.    If the S-Expression is empty, it has the NIL (empty) value. If it is
  7802.    not empty and the first item is an operator (such as + or *), there
  7803.    can be zero or more subsequent items, called the operands:
  7804.  
  7805.   (+ 1 2)
  7806.  
  7807.    Here the operator is "+" and the operands are "1" and "2", and the
  7808.    value of the S-Expression is the value of the operation (in this case
  7809.    3). The operator always comes first, which is different from the
  7810.    familiar algebraic notation; this because S-Expression operators can
  7811.    have different numbers of operands:
  7812.  
  7813.   (+ 1)
  7814.   (+ 1 2)
  7815.   (+ 1 2 3 4 5 6 7 8 9)
  7816.  
  7817.    If the first item in the S-Expression is not an operator, then it must
  7818.    be a variable or a number (or a macro; see [487]Section 9.8), and the
  7819.    S-Expression can only contain one item; in this case, the
  7820.    S-Expression's value is the value of the variable or number:
  7821.  
  7822.   (a)
  7823.   (3)
  7824.  
  7825.    Operands can be numbers, variables that have numeric values, functions
  7826.    that return numbers, or other S-Expressions. To illustrate an
  7827.    S-Expression within an S-Expression, observe that:
  7828.  
  7829.   (+ 1 2)
  7830.  
  7831.    is equivalent to any of the following (plus an infinite number of
  7832.    others):
  7833.  
  7834.   (+ 1 (+ 1 1))
  7835.   (+ (- 3 2) (/ 14 (+ 3 4)))
  7836.  
  7837.    S-Expressions can be nested to any reasonable level; for example, the
  7838.    value of the following S-Expression is 64:
  7839.  
  7840.   (- (* (+ 2 (* 3 4)) (- 9 (* 2 2))) 6)
  7841.  
  7842.    Operators have no precedence, implied or otherwise, since they can't
  7843.    be mixed. The only exceptions are unary + and -, which simply indicate
  7844.    the sign of a number:
  7845.  
  7846.   (* 3 -1)
  7847.  
  7848.    Order of evaluation is specified entirely by parentheses, which are
  7849.    required around each operator and its operands: (+ a (* b c)) instead
  7850.    of (a + b * c).
  7851.  
  7852.    S-Expressions provide a simple and isolated environment in which
  7853.    Kermit's macro names can be used without the \m(...) escaping that is
  7854.    normally required. Given:
  7855.  
  7856.   define a 1
  7857.   define b 2
  7858.   define c 3
  7859.  
  7860.    Then:
  7861.  
  7862.   (+ \m(a) \m(b) \m(c))
  7863.  
  7864.    is equivalent to:
  7865.  
  7866.   (+ a b c)
  7867.  
  7868.    Within an S-Expression, as in other strictly numeric contexts
  7869.    ([488]Section 8.2), any operand that starts with a letter is treated
  7870.    as a Kermit macro name. In this context, abbreviations are not
  7871.    accepted; variable names must be spelled out in full. Alphabetic case
  7872.    is not significant; "a" and "A" are the same variable, but both are
  7873.    different from "area".
  7874.  
  7875.    Of course, regular Kermit variables and functions can be used in
  7876.    S-Expressions in the normal ways:
  7877.  
  7878.   (* \v(math_pi) (^ \%r 2))             ; Area of a circle with radius \%r
  7879.   (+ \fjoin(&a))                        ; Sum of all elements of array \&a[]
  7880.  
  7881.    [ [489]Top ] [ [490]Contents ] [ [491]C-Kermit Home ] [ [492]Kermit
  7882.    Home ]
  7883.      _________________________________________________________________
  7884.  
  7885.   9.2. Integer and Floating-Point-Arithmetic
  7886.  
  7887.    Normally, if all numbers in an S-Expression are integers, the result
  7888.    is an integer:
  7889.  
  7890.   (+ 1 1)                               ; Result is 2
  7891.   (/ 9 3)                               ; Result is 3
  7892.  
  7893.    If any of the operands is floating point, however, the result is also
  7894.    floating point:
  7895.  
  7896.   (+ 1 1.0)                             ; Result is 2.0
  7897.   (/ 9.0 3)                             ; Result is 3.0
  7898.  
  7899.    If all the operands are integers but the result has a fractional part,
  7900.    the result is floating point:
  7901.  
  7902.   (/ 10 3)                              ; Result is 3.333333333333333
  7903.  
  7904.    To force an integer result in such cases, use the TRUNCATE operator:
  7905.  
  7906.   (truncate (/ 10 3))                   ; Result is 3
  7907.  
  7908.    Similarly, to force a computation to occur in floating point, you can
  7909.    coerce one of its operands to FLOAT:
  7910.  
  7911.   (+ 1 (float 1))                       ; Result is 2.0
  7912.  
  7913.    The result is also floating point if the magnitude of any integer
  7914.    operand, intermediate result, or the result itself, is larger than the
  7915.    maximum for the underlying machine architecture:
  7916.  
  7917.   (^ 100 100)
  7918.  
  7919.    If the result is too large even for floating-point representation,
  7920.    "Infinity" is printed; if it is too small to be distinguished from 0,
  7921.    0.0 is returned.
  7922.  
  7923.    Large numbers can be used and large results generated, but they are
  7924.    accurate only to the precision of the underlying machine. For example,
  7925.    the result of:
  7926.  
  7927.  (+ 111111111111111111111 222222222222222222222)
  7928.  
  7929.    should be 333333333333333333333, but 333333333333333300000.0 is
  7930.    produced instead if the machine is accurate to only about 16 decimal
  7931.    digits, even with coercion to floating-point. The order of magnitude
  7932.    is correct but the least significant digits are wrong. The imprecise
  7933.    nature of the result is indicated by the ".0" at the end. Contrast
  7934.    with:
  7935.  
  7936.  (+ 111111111 222222222)
  7937.  
  7938.    which produces an exact integer result.
  7939.  
  7940.    [ [493]Top ] [ [494]Contents ] [ [495]C-Kermit Home ] [ [496]Kermit
  7941.    Home ]
  7942.      _________________________________________________________________
  7943.  
  7944.   9.3. How to Use S-Expressions
  7945.  
  7946.    S-Expressions may be given as commands to C-Kermit. Any command whose
  7947.    first character is "(" (left parenthesis) is interpreted as an
  7948.    S-Expression.
  7949.  
  7950.    If you enter an S-Expression at the C-Kermit> prompt, its result is
  7951.    printed:
  7952.  
  7953.   C-Kermit>(/ 10.0 3)
  7954.    3.333333333333333
  7955.   C-Kermit>
  7956.  
  7957.    If an S-Expression is executed within a macro or command file, its
  7958.    value is not printed. However, you can control the printing action
  7959.    with:
  7960.  
  7961.    SET SEXPRESSION ECHO { AUTO, ON, OFF }
  7962.           AUTO is the default, meaning print the value at top level only;
  7963.           ON means always print the value; OFF means never print it.
  7964.  
  7965.    In any case, the value of the most recent S-Expression (and the
  7966.    S-Expression itself) may be accessed programmatically through the
  7967.    following variables:
  7968.  
  7969.    \v(sexpression)
  7970.           The S-Expression most recently executed.
  7971.  
  7972.    \v(svalue)
  7973.           The value of the S-Expression most recently executed.
  7974.  
  7975.    Besides issuing S-Expressions as commands in themselves, you can also
  7976.    execute them anywhere within a Kermit command, but in this case they
  7977.    must be enclosed in a function call (otherwise they are taken
  7978.    literally):
  7979.  
  7980.    \fsexpression(s)
  7981.           The argument "s" is an S-Expression; the outer parentheses may
  7982.           be omitted. The value of the S-Expression is returned. Note
  7983.           that since S-Expressions usually contain spaces, some form of
  7984.           grouping or quoting might be needed in some contexts:
  7985.  
  7986.   echo \fsexpression((+ 1 1))            ; Outer parentheses may be included
  7987.   echo \fsexpr(+ 1 1)                    ; Outer parentheses may be omitted
  7988.   echo Value = "\fsexp(+ 1 a)"           ; Can be embedded in strings
  7989.   echo Value = \&a[\fsexp(/ b 2)]        ; Can be used in array subscripts
  7990.   if = {\fsexp(+ 1 1)} 2 {               ; Braces needed here for grouping
  7991.       echo One plus one still equals two
  7992.   }
  7993.  
  7994.    The IF statement illustrates how to use S-Expressions as (or in) IF or
  7995.    WHILE conditions:
  7996.  
  7997.      * Although S-Expressions and IF conditions are similar in
  7998.        appearance, they are not interchangeable. Therefore you must use
  7999.        \fsexpr() to let Kermit know it's an S-Expression rather than a
  8000.        regular IF condition, or a boolean or algebraic expression within
  8001.        an IF condition.
  8002.      * In contexts where a single "word" is expected, you must enclose
  8003.        the \fsexp() invocation in braces if the S-Expression contains
  8004.        spaces (and most of them do).
  8005.  
  8006.    If an S-Expression is the last command executed in a macro, its value
  8007.    becomes the return value of the macro; no RETURN command is needed.
  8008.    Example:
  8009.  
  8010.   def newarea {
  8011.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  8012.       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  8013.   }
  8014.  
  8015.    This is equivalent to (but more efficient than):
  8016.  
  8017.   def newarea {
  8018.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  8019.       return \fsexp(sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  8020.   }
  8021.  
  8022.    When an S-Expression is entered as a command -- that is, the first
  8023.    nonblank character of the command is a left parenthesis -- then it is
  8024.    allowed to span multiple lines, as many as you like, until the first
  8025.    left parenthesis is matched:
  8026.  
  8027.   (let s (/
  8028.           (+
  8029.            \%1
  8030.            \%2
  8031.            \%3
  8032.            )
  8033.           2.0
  8034.           )
  8035.        )
  8036.   (sqrt (*
  8037.          s
  8038.          (- s \%1)
  8039.          (- s \%2)
  8040.          (- s \%3)
  8041.          )
  8042.         )
  8043.  
  8044.    The S-Expression concept lends itself easily to embedding and
  8045.    recursion, but the depth to which recursion can occur is limited by
  8046.    the resources of the computer (memory size, address space, swap space
  8047.    on disk) and other factors. There is no way that C-Kermit can know
  8048.    what this limit is, since it varies not only from computer to
  8049.    computer, but also from moment to moment. If resources are exhausted
  8050.    by recursion, C-Kermit simply crashes; there's no way to trap this
  8051.    error. However, you can set a depth limit on S-Expressions:
  8052.  
  8053.    SET SEXPRESSION DEPTH-LIMIT number
  8054.           Limits the number of times the S-Expression reader can invoke
  8055.           itself without returning to the given number. The default limit
  8056.           is 1000. This limit applies to S-Expressions embedded within
  8057.           other S-Expressions as well as to S-Expressions that invoke
  8058.           recursive macros. If the limit is exceeded, Kermit prints
  8059.           "?S-Expression depth limit exceeded" and returns to its prompt.
  8060.           More about recursion in [497]Section 9.8.
  8061.  
  8062.    You can also test the depth programmatically:
  8063.  
  8064.    \v(sdepth)
  8065.           The current S-Expression invocation depth. The depth includes
  8066.           both nesting level and recursion. For example, in:
  8067.           (foo (foo (foo (foo (foo))))), the innermost (foo) is at depth
  8068.           5.
  8069.  
  8070.    Help, completion, and syntax checking are not available within an
  8071.    S-Expression. If you type ? within an S-Expression, it says:
  8072.  
  8073.   C-Kermit>(? S-Expression ("help sexp" for details)
  8074.  
  8075.    As it says, typing "help sexp" will display a brief help text.
  8076.  
  8077.    The SHOW SEXPRESSION command displays current SET SEXPRESSION settings
  8078.    and related information.
  8079.  
  8080.    [ [498]Top ] [ [499]Contents ] [ [500]C-Kermit Home ] [ [501]Kermit
  8081.    Home ]
  8082.      _________________________________________________________________
  8083.  
  8084.   9.4. Summary of Built-in Constants and Operators
  8085.  
  8086.    Three constants are built in:
  8087.  
  8088.      * PI, whose value is the value of pi (the quotient of circumference
  8089.        of any circle and its diameter, 3.141592653...) to the underlying
  8090.        machine's precision;
  8091.      * T, which always has the value 1, which signifies truth in Kermit
  8092.        logical expressions or S-Expressions;
  8093.      * NIL, which always has the empty value, and can serve as a False
  8094.        truth value.
  8095.  
  8096.    These constants are specific to S-Expressions and are not visible
  8097.    outside them. They may not be used as the target of an assignment. So,
  8098.    for example:
  8099.  
  8100.   (setq t 0)   Fails
  8101.   assign t 0   Succeeds but this is not the same T!
  8102.  
  8103.    E (the base of natural logarithms, 2.7182818184...) is not built in
  8104.    since it is not intrinsic in most Lisp dialects. If you want E to be
  8105.    the base of natural logarithms you can:
  8106.  
  8107.   (setq e (exp 1))
  8108.  
  8109.    Operators are either symbols (such as "+") or words. Words must be
  8110.    spelled out in full, not abbreviated. Differences of alphabetic case
  8111.    are ignored.
  8112.  
  8113.    The most basic operation in S-Expressions is evaluation:
  8114.  
  8115.    EVAL [ s-expression or variable or number [ another [ another ... ] ]
  8116.           ]
  8117.           Evaluates its operands and returns the value of the last one
  8118.           evaluated. Examples:
  8119.  
  8120.   (eval)                                0
  8121.   (eval 1)                              1
  8122.   (eval a)                              value of a
  8123.   (eval (+ 1 a))                        value of a+1
  8124.   (eval (setq a 1) (setq b (+ a 0.5)))  value of b (= a+0.5)
  8125.  
  8126.           You can use "." as a shorthand for EVAL:
  8127.  
  8128.   (.)
  8129.   (. 1)
  8130.   (. a)
  8131.   (. (+ 1 a))
  8132.   (. (setq a 1) (setq b (+ a 0.5)))
  8133.  
  8134.    Opposite of EVAL is the operator that suppresses evaluation of its
  8135.    operand:
  8136.  
  8137.    QUOTE item
  8138.           The value (quote item) is "item". If the item is itself an
  8139.           S-Expression, the result is the S-Expression with the outer
  8140.           parentheses stripped. Examples:
  8141.  
  8142.   (quote)                               (illegal)
  8143.   (quote a)                             a
  8144.   (quote hello)                         hello
  8145.   (quote (this is a string))            this is a string
  8146.   (quote this is a string)              (illegal)
  8147.  
  8148.           A shorthand notation is also accepted for quoting:
  8149.           'a is equivalent to (quote a). And therefore:
  8150.           '(a b c) is equivalent to (quote (a b c)).
  8151.           More about quoting in [502]Section 9.8.
  8152.  
  8153.    STRING item
  8154.           Is a combination of EVAL and QUOTE. It evaluates the item as an
  8155.           S-Expression, and then puts quotes around the result (more
  8156.           about this in [503]Section 9.8).
  8157.  
  8158.    The following operators assign values to variables:
  8159.  
  8160.    SETQ [ variable [ value [ variable [ value [ ... ] ] ] ] ]
  8161.           Applies to global variables. For each variable given: if a
  8162.           value is not given, the variable is undefined. If a value is
  8163.           given, assigns the value to the variable. The value may be a
  8164.           number, a variable, or anything that resolves to a number
  8165.           including an S-Expression. Returns the value of the last
  8166.           assignment. Examples:
  8167.  
  8168.   (setq)             Does nothing, returns NIL.
  8169.   (setq a)           Undefines a, returns NIL.
  8170.   (setq a 1)         Assigns 1 to a, returns 1.
  8171.   (setq a 1 b 2)     Assigns 1 to a, 2 to b, returns 2.
  8172.   (setq a 1 b 2 c)   Assigns 1 to a, 2 to b, undefines c, returns NIL.
  8173.  
  8174.    To undefine a variable that is not the final one in the list, give it
  8175.    a value of "()" or NIL:
  8176.  
  8177.   (setq a () b 2)    Undefines a, assigns 2 to b, returns 2.
  8178.   (setq a nil b 2)   Ditto.
  8179.  
  8180.    Note that a variable can be used right away once it has a value:
  8181.  
  8182.   (setq a 1 b a)     Assigns 1 to a, the value of a (1) to b, returns 1.
  8183.  
  8184.    The results of SETQ (when used with macro names) can be checked
  8185.    conveniently with SHOW MACRO, e.g:
  8186.  
  8187.   show mac a b c
  8188.  
  8189.    LET [ variable [ value [ variable [ value [ ... ] ] ] ] ]
  8190.           Like SETQ, but applies to local variables. Note that "local" is
  8191.           used in the Kermit sense, not the Lisp sense; it applies to the
  8192.           current Kermit command level, not to the current S-Expression.
  8193.  
  8194.    If you want to use SETQ or LET to assign a value to a backslash
  8195.    variable such as \%a or \&a[2], you must double the backslash:
  8196.  
  8197.   (setq \\%a 3)
  8198.   (setq \\%b (+ \%a 1))
  8199.   (setq \\&a[2] (setq (\\%c (+ \%a \%b))))
  8200.  
  8201.    In other words:
  8202.  
  8203.      * Double the backslash when you want to indicate the variable's
  8204.        NAME;
  8205.      * Don't double the backslash when you want its VALUE.
  8206.  
  8207.    See [504]Section 9.6 for a fuller explanation of variable syntax and
  8208.    scope.
  8209.  
  8210.    Here's a summary table of arithmetic operators; in the examples, a is
  8211.    2 and b is -1.3:
  8212.  
  8213.   Operator  Description                            Example           Result
  8214.   +         Adds all operands (0 or more)          (+ a b)           0.7
  8215.   -         Subtracts all operands (0 or more)     (- 9 5 2 1)       1
  8216.   *         Multiplies all operands (0 or more)    (* a (+ b 1) 3)  -1.80
  8217.   /         Divides all operands (2 or more)       (/ b a 2)        -0.325
  8218.   ^         Raise given number to given power      (^ 3 2)           9
  8219.   ++        Increments variables                   (++ a 1.2)        3.2
  8220.   --        Decrements variables                   (-- a)            1
  8221.   ABS       Absolute value of 1 operand            (abs (* a b 3))   7.8
  8222.   MAX       Maximum of all operands (1 or more)    (max 1 2 3 4)     4
  8223.   MIN       Minimum of all operands (1 or more)    (min 1 2 3 4)     1
  8224.   MOD (%)   Modulus of all operands (1 or more)    (mod 7 4 2)       1
  8225.   FLOAT     Convert an integer to floating-point   (float 1)         1.0
  8226.   TRUNCATE  Integer part of floating-point operand (truncate 3.333)  3
  8227.   CEILING   Ceiling of floating-point operand      (ceiling 1.25)    2
  8228.   FLOOR     Floor of floating-point operand        (floor 1.25)      1
  8229.   ROUND     Operand rounded to nearest integer     (round 1.75)      2
  8230.   SQRT      Square root of 1 operand               (sqrt 2)          1.414..
  8231.   EXP       e (2.71828..) to the given power       (exp -1)          0.367..
  8232.   SIN       Sine of angle-in-radians               (sin (/ pi 2))    1.0
  8233.   COS       Cosine of angle-in-radians             (cos pi)         -1.0
  8234.   TAN       Tangent of angle-in-radians            (tan pi)          0.0
  8235.   LOG       Natural log (base e) of given number   (log 2.7183)      1.000..
  8236.   LOG10     Log base 10 of given number            (log10 1000)      3.0
  8237.  
  8238.    The ++ and -- operators are also assignment operators and work just
  8239.    like SETQ and LET in their interpretations of operators and operands,
  8240.    but:
  8241.  
  8242.      * Each target variable must already be defined and have a numeric
  8243.        value;
  8244.      * The assignment value is the amount by which to increment or
  8245.        decrement the variable.
  8246.      * If an assignment value is not given, 1 is used.
  8247.  
  8248.    If you include more than one variable-value pair in a ++ or --
  8249.    expression, every variable (except, optionally, the last) must be
  8250.    followed by a value. Examples:
  8251.  
  8252.   (++ a)                Equivalent to (setq a (+ a 1)) and to (++ a 1)
  8253.   (++ a 2)              Equivalent to (setq a (+ a 2))
  8254.   (-- a (* 2 pi))       Equivalent to (setq a (- a (* 2 pi)))
  8255.   (++ a 1 b 1 c 1 d)    Equivalent to four SETQs incrementing a,b,c,d by 1.
  8256.  
  8257.    Another group of operators forms the predicates. These return a "truth
  8258.    value", in which 0 (or NIL) is false, and 1 or any other nonzero
  8259.    number is true.
  8260.  
  8261.   Operator  Description                            Example           Result
  8262.   = (or ==) Operands are equal                     (= 1 1.0)         1
  8263.   !=        Operands are not equal                 (!= 1 1.0)        0
  8264.   <         Operands in strictly ascending order   (< 1 2 3)         1
  8265.   <=        Operands in ascending order            (<= 1 1 2 3)      1
  8266.   >         Operands in strictly descending order  (> 3 2 1)         1
  8267.   >=        Operands in descending order           (<= 3 3 2 1)      1
  8268.   AND (&&)  Operands are all true                  (and 1 1 1 1 0)   0
  8269.   OR  (||)  At least one operand is true           (or 1 1 1 1 0)    1
  8270.   XOR       Logical Exclusive OR                   (xor 3 1)         0
  8271.   NOT (!)   Reverses truth value of operand        (not 3)           0
  8272.  
  8273.    The Exclusive OR of two values is true if one value is true and the
  8274.    other value is false.
  8275.  
  8276.    And another group operates on bits within an integer word:
  8277.  
  8278.   Operator  Description                            Example           Result
  8279.   &         Bitwise AND                            (& 7 2)           2
  8280.   |         Bitwise OR                             (| 1 2 3 4)       7
  8281.   #         Bitwise Exclusive OR                   (# 3 1)           2
  8282.   ~         Reverses all bits                      (~ 3)            -4
  8283.  
  8284.    These operators coerce their operands to integer by truncation if
  8285.    necessary. The result of bit reversal is hardware dependent.
  8286.  
  8287.    The final category of operator works on truth values:
  8288.  
  8289.   Operator  Description                            Example           Result
  8290.   IF        Conditional evaluation                 (if (1) 2 3)      2
  8291.  
  8292.    IF (predicate) (s1) [ (s2) ]
  8293.           The IF operator is similar to Kermit's IF command. If the
  8294.           predicate is true (i.e. evaluates to a nonzero number), the
  8295.           first S-Expression (s1) is evaluated and its value is returned.
  8296.           Otherwise, if (s2) is given, it is evaluated and its value
  8297.           returned; if (s2) is not given, nothing happens and the NIL
  8298.           (empty) value is returned.
  8299.  
  8300.    You can group multiple expressions in the s1 and s2 expressions using
  8301.    EVAL (or "."):
  8302.  
  8303.   (if (< a 0) (eval (setq x 0) (setq y 0)) (eval (setq x a) (setq y b)))
  8304.  
  8305.    or equivalently:
  8306.  
  8307.   (if (< a 0) (. (setq x 0) (setq y 0)) (. (setq x a) (setq y b)))
  8308.  
  8309.    Each operator has its own requirement as to number and type of
  8310.    operands. In the following table, "number" means any kind of number --
  8311.    integer or floating-point -- or a variable, function, macro, or
  8312.    S-Expression that returns a number; "vname" means variable name,
  8313.    "fpnumber" means a floating-point number (or anything that resolves to
  8314.    one), and "integer" means integer (or anything that resolves to one).
  8315.    "truthvalue" means anything that resolves to a value of zero or an
  8316.    empty value (which indicates false) or a nonzero value (which
  8317.    indicates true). "any" means any kind of value, including none at all.
  8318.  
  8319.   Operator  Number of operands   Type of operands    Returns
  8320.   EVAL  (.) 0 or more            S-Expression        Last value (default NIL)
  8321.   STRING    1                    S-Expression        string
  8322.   QUOTE (') 1                    word                string
  8323.   SETQ      0 or more            vname value pairs   Last value (default NIL)
  8324.   LET       0 or more            vname value pairs   Last value (default NIL)
  8325.   +         0 or more            number              number     (default 0)
  8326.   -         0 or more            number              number     (default 0)
  8327.   *         0 or more            number              number     (see note (1))
  8328.   /         2 or more            number              number
  8329.   ^         2 or more            number              number
  8330.   ++        1 or more            vname value pairs   Result of last increment
  8331.   --        1 or more            vname value pairs   Result of last decrement
  8332.   ABS       1                    number              number
  8333.   MAX       1 or more            number              number
  8334.   MIN       1 or more            number              number
  8335.   MOD (%)   2                    number              number
  8336.   FLOAT     1                    number              fpnumber
  8337.   TRUNCATE  1                    number              integer
  8338.   CEILING   1                    number              integer
  8339.   FLOOR     1                    number              integer
  8340.   ROUND     1                    number              integer
  8341.   SQRT      1                    number              fpnumber
  8342.   EXP       1                    number              fpnumber
  8343.   SIN       1                    number              fpnumber
  8344.   COS       1                    number              fpnumber
  8345.   TAN       1                    number              fpnumber
  8346.   LOG       1                    number              fpnumber
  8347.   LOG10     1                    number              fpnumber
  8348.   = (==)    1 or more            number              truthvalue
  8349.   !=        1 or more            number              truthvalue
  8350.   <         1 or more            number              truthvalue
  8351.   <=        1 or more            number              truthvalue
  8352.   >         1 or more            number              truthvalue
  8353.   >=        1 or more            number              truthvalue
  8354.   AND (&&)  1 or more            truthvalue          truthvalue
  8355.   OR  (||)  1 or more            truthvalue          truthvalue
  8356.   XOR       2                    truthvalue          truthvalue
  8357.   NOT (!)   1                    truthvalue          truthvalue
  8358.   &         1 or more            number (see note 2) integer
  8359.   |         1 or more            number (see note 2) integer
  8360.   #         2                    number (see note 2) integer
  8361.   ~         1                    number (see note 2) integer
  8362.   IF        2 or 3               truthvalue,any,any  any
  8363.  
  8364.    Operators that don't require any arguments return the default values
  8365.    shown.
  8366.  
  8367.     1. The value of "*", when used as an operator, is initially "1" and
  8368.        the value of the most recent S-Expression thereafter, as in Franz
  8369.        Lisp. This is handy when doing a series of calculations by hand:
  8370.   C-Kermit>(* 13272.42 0.40)
  8371.    5308.968
  8372.   C-Kermit>(/ * 2)
  8373.    2654.4840
  8374.   C-Kermit>
  8375.     2. The bitwise operators coerce their operands to integer by
  8376.        truncation.
  8377.  
  8378.    [ [505]Top ] [ [506]Contents ] [ [507]C-Kermit Home ] [ [508]Kermit
  8379.    Home ]
  8380.      _________________________________________________________________
  8381.  
  8382.   9.5. Variables
  8383.  
  8384.    As noted elsewhere in this discussion, all backslash items (variables
  8385.    such as \%a, macro parameters such as \%1, array elements such as
  8386.    \&a[\%i], built-in variables such as \v(ndate), built-in functions
  8387.    such as \fjoin(), macro names enclosed in \m(), \s(), or \:(), etc)
  8388.    are evaluated at "top level" before the S-Expression is sent to the
  8389.    S-Expression reader. To use a backslash variable as the target of an
  8390.    assignment (e.g. by SETQ, LET, ++, or --), you must double the
  8391.    backslash, e.g. (setq \\%r 1234). This is discussed at greater length
  8392.    in the next section.
  8393.  
  8394.    Thus S-Expression reader generally deals only with macro names (not
  8395.    backslash items) as variables. It is important to understand how the
  8396.    reader handles macro names. There are fundamentally two kinds of
  8397.    S-Expressions: those that contain a single element, such as:
  8398.  
  8399.   (foo)
  8400.  
  8401.    and those that contain more than one element:
  8402.  
  8403.   (foo a b c)
  8404.  
  8405.    If an S-Expression contains only one element, and it is the name of a
  8406.    macro, the macro's definition is examined. If the definition is a
  8407.    number (integer or floating-point, positive or negative), then this
  8408.    becomes the value of the expression. If the definition starts with '
  8409.    (apostrophe), then the quoted word or string is the value of the
  8410.    expression (explained in [509]Section 9.8). Otherwise, the macro is
  8411.    assumed to be composed of Kermit commands (possibly including
  8412.    S-Expressions), which are executed. If the macro has a RETURN value,
  8413.    or it executes an S-Expression as its last command, the result becomes
  8414.    the value of the S-Expression; otherwise the result is empty.
  8415.  
  8416.    For S-Expressions that contain more than one element, and the first
  8417.    element is the name of a macro, then this macro is executed with the
  8418.    arguments that are given, after the arguments are evaluated by the
  8419.    S-Expression reader. Likewise, If the first element is a built-in
  8420.    operator, then it is applied to the operands after they are evaluated.
  8421.    In both cases, each operand is fed to the S-Expression reader
  8422.    recursively for evaluation. If an operand is a number or a quoted
  8423.    string, it is used as-is. But if it's a macro name, this degenerates
  8424.    into the first case, and the previous paragraph applies.
  8425.  
  8426.    Examples:
  8427.  
  8428.   define foo 123
  8429.   (foo)                                Result: 123
  8430.   define foo 'abc
  8431.   (foo)                                Result: abc
  8432.   define foo '(one two three)
  8433.   (foo)                                Result: one two three
  8434.   define foo return \frandom(1000)
  8435.   (foo)                                Result: 713 (or other number)
  8436.   define foo (+ a b)
  8437.   (foo)                                Result: The sum of a and b
  8438.  
  8439.    A more difficult example:
  8440.  
  8441.   define foo abc
  8442.   (foo)                                Result: ???
  8443.  
  8444.    The result in the last example depends on the definition of abc:
  8445.  
  8446.      * If it has no definition, an error occurs; otherwise:
  8447.      * If the definition is an S-Expression, the result is the
  8448.        S-Expression's value; otherwise:
  8449.      * If the definition consists of Kermit commands, they are executed.
  8450.        But in this case "(foo)" produces the empty result, because it
  8451.        doesn't RETURN anything.
  8452.  
  8453.    The use of macros as S-Expression operators is described in
  8454.    [510]Section 9.8.
  8455.  
  8456.    [ [511]Top ] [ [512]Contents ] [ [513]C-Kermit Home ] [ [514]Kermit
  8457.    Home ]
  8458.      _________________________________________________________________
  8459.  
  8460.   9.6. Assignments and Scope
  8461.  
  8462.    The assignment operators SETQ and LET apply to global and local
  8463.    variables, respectively. SETQ and LET are standard Lisp operators
  8464.    adapted to Kermit scoping rules. When the operands are numeric or
  8465.    arithmetic, SETQ is equivalent to Kermit's EVALUATE command:
  8466.  
  8467.   (setq a (+ 1 2))
  8468.   evaluate a 1 + 2
  8469.  
  8470.    When the operand is a string, SETQ is equivalent to DEFINE:
  8471.  
  8472.   (setq a '(this is a string))
  8473.   define a this is a string
  8474.  
  8475.    In the first case, both statements create a macro named "a" with a
  8476.    value of 3. But in neither case is the macro "a" necessarily global.
  8477.    If either of these commands executes in an environment (i.e. macro
  8478.    invocation level) where a "local a" command has been given, the "a"
  8479.    macro is global to that environment, but is not visible outside it.
  8480.  
  8481.    LET is equivalent to the Kermit LOCAL command, followed by the
  8482.    corresponding EVALUATE:
  8483.  
  8484.   (let a (+ 1 2))
  8485.  
  8486.    is equivalent to:
  8487.  
  8488.   local a
  8489.   evaluate a 1 + 2
  8490.  
  8491.    Again, "local" in this context applies to the Kermit macro invocation
  8492.    stack, not to the S-Expression nesting level. To illustrate, recall
  8493.    our "newarea" macro:
  8494.  
  8495. def newarea {
  8496.     (let a \%1 b \%2 c \%3)
  8497.     (let s (/ (+ a b c) 2.0))
  8498.     (sqrt (* s (- s a) (- s b) (- s c)))
  8499. }
  8500.  
  8501.    Because SETQ and LET expressions return a value, they can be placed
  8502.    within a larger S-Expression. In this case we can replace the first
  8503.    reference to the "s" variable by its defining expression:
  8504.  
  8505. def newarea {
  8506.     (let a \%1 b \%2 c \%3)
  8507.     (sqrt (* (let s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
  8508. }
  8509.  
  8510.    This would not work if LET were local to the S-Expression, but it
  8511.    works nicely in the context of Kermit macros. The previous definition
  8512.    is equivalent to:
  8513.  
  8514. def newarea {
  8515.     local a b c s
  8516.     (setq a \%1 b \%2 c \%3)
  8517.     (sqrt (* (setq s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
  8518. }
  8519.  
  8520.    In both cases, the variables a, b, c, and s are local to the "newarea"
  8521.    macro, and global within it.
  8522.  
  8523.    Multiple assignments can be handled in several ways. Here is the
  8524.    obvious way to initialize a series of variables to the same value:
  8525.  
  8526.   (setq a 0)
  8527.   (setq b 0)
  8528.   (setq c 0)
  8529.   (setq s 0)
  8530.  
  8531.    Here is a more compact and efficient way of doing the same thing:
  8532.  
  8533.   (setq a 0 b 0 c 0 s 0)
  8534.  
  8535.    However, in case the value was more complex, it's better to put only
  8536.    one copy of it in the S-Expression; in this case we rely on the fact
  8537.    that SETQ returns the value of its last assignment:
  8538.  
  8539.   (setq a (setq b (setq c (setq s (* x (^ y 2))))))
  8540.  
  8541.    Similarly, to set a series of variables to x, x+1, x+2, ...
  8542.  
  8543.   (setq c (+ (setq b (+ (setq a (+ (setq s x) 1)) 1)) 1))
  8544.  
  8545.    In the last example, you can see why "last" does not always correspond
  8546.    to "rightmost" (the leftmost variable "c" is assigned last).
  8547.  
  8548.    If you are working with backslash variables like \%a or array elements
  8549.    like \&a[1], remember two rules:
  8550.     1. Don't put spaces inside array brackets.
  8551.     2. You must double the backslash when using SETQ, LET, ++, or -- to
  8552.        assign a value to a backslash variable.
  8553.  
  8554.    Examples of assigning to a backslash variable:
  8555.  
  8556.   (setq x 1)
  8557.   (setq \\%a 0)
  8558.   (setq \\&a[x+1] 1)
  8559.   (++ \\%x)
  8560.   (-- \\&a[x+2])
  8561.  
  8562.    Examples of referring to a backslash variable's value:
  8563.  
  8564.   (setq a (+ \%a 1))
  8565.   (setq b (+ \%a \&a[1]))
  8566.   (++ a \%x)
  8567.   (-- b \&a[1])
  8568.  
  8569.    The special notation is required because all backslashed items (\%x
  8570.    variables, array elements, built-in \v(xxx) variables, and \fxxx()
  8571.    function invocations) are evaluated in a single pass BEFORE the
  8572.    S-Expression is executed; any other approach would result in
  8573.    unacceptable performance. So, for example, in:
  8574.  
  8575.   declare \&a[] = 1 2 3
  8576.   define \%x 4
  8577.   define \%y 0
  8578.   (setq \\%y (+ \%x \&a[1]))
  8579.  
  8580.    the S-Expression becomes:
  8581.  
  8582.   (setq \%y (+ 4 1))
  8583.  
  8584.    before it is sent to the S-Expression evaluator. If the backslash had
  8585.    not been doubled on the assignment target, the result would have been:
  8586.  
  8587.   (setq 0 (+ 4 1))
  8588.  
  8589.    which is illegal because you can't assign a value to a number.
  8590.    Conversely, if backslashes were doubled on right-hand-side values:
  8591.  
  8592.   (setq \\%y (+ \\%x \\&a[1])
  8593.  
  8594.    this too, would give an error (not numeric - "\%x").
  8595.  
  8596.    If you omit the double backslash in the assignment target, the result
  8597.    depends on whether the variable already has a value:
  8598.  
  8599.   (setq \%a (* 3 3))
  8600.  
  8601.    If \%a has a non-numeric single-word value, then this becomes the name
  8602.    of the variable that is assigned by SETQ. To illustrate:
  8603.  
  8604.   define \%a foo
  8605.   echo \%a
  8606.   foo
  8607.   (setq \%a (* 3 3))
  8608.   echo \%a
  8609.   foo
  8610.   show macro foo
  8611.   foo = 9
  8612.  
  8613.    If \%a has no value, a numeric value, or a multiword value, an
  8614.    "invalid assignment" error occurs.
  8615.  
  8616.    [ [515]Top ] [ [516]Contents ] [ [517]C-Kermit Home ] [ [518]Kermit
  8617.    Home ]
  8618.      _________________________________________________________________
  8619.  
  8620.   9.7. Conditional Expressions
  8621.  
  8622.    The IF operator provides a compact form of decision-making within
  8623.    S-Expressions. An IF expression can stand wherever a number might
  8624.    stand, as long is it returns a number. Here's a quick way to obtain
  8625.    the average value of all the elements in an array that contains only
  8626.    numbers:
  8627.  
  8628.   (/ (+ \fjoin(&a)) (float \fdim(&a)))
  8629.  
  8630.    This results in a "Divide by zero" error if the array is empty. If you
  8631.    want to define the average value of an empty array to be 0 instead of
  8632.    getting an error, you can use IF to check the array size:
  8633.  
  8634.   (if \fdim(&a) (/ (+ \fjoin(&a)) (float \fdim(&a))) 0)
  8635.  
  8636.    or equivalently:
  8637.  
  8638.   (if (not \fdim(&a)) 0 (/ (+ \fjoin(&a)) (float \fdim(&a))))
  8639.  
  8640.    Of course, IF can fit anywhere else into an S-Expression:
  8641.  
  8642.   (setq a (+ b (if (< c 0) 0 c)))
  8643.  
  8644.    and the IF expression can be as complex as you like:
  8645.  
  8646.   (setq a (+ b (if (and (or (> x 0) (> y 0)) (< c 0) (> d 1) (!= e 0)) 1 0)))
  8647.  
  8648.    and the "then" and "else" parts can contain multiple S-Expressions
  8649.    enclosed within (EVAL ...):
  8650.  
  8651.   (if x (eval (...) (...) (...)) (eval (...) (...) (...)))
  8652.  
  8653.    AND and OR operators are guaranteed to "short circuit". If any operand
  8654.    of AND is false, none of the subsequent operands is evaluated;
  8655.    likewise, if an OR operand is true, no further operands are evaluated.
  8656.  
  8657.    Bear in mind that the S-Expression IF is not the same as Kermit IF;
  8658.    the condition is only allowed to be an S-Expression or a variable or
  8659.    number, not the whole list of possibilities you see when you type "if
  8660.    ?" at the C-Kermit> prompt. But keep reading...
  8661.  
  8662.    [ [519]Top ] [ [520]Contents ] [ [521]C-Kermit Home ] [ [522]Kermit
  8663.    Home ]
  8664.      _________________________________________________________________
  8665.  
  8666.   9.8. Extensibility
  8667.  
  8668.    To extend the capabilities of S-Expressions, you can use Kermit macro
  8669.    names as operators, with the following limitations:
  8670.  
  8671.      * The macro must not have the same name as a built-in operator.
  8672.      * You must use the full macro name, not an abbreviation.
  8673.  
  8674.    And with the following enhancement:
  8675.  
  8676.      * If the last statement executed by the macro is an S-Expression,
  8677.        its value is returned automatically. In other words:
  8678.  
  8679.   define bump (++ \%1)
  8680.  
  8681.    is equivalent to:
  8682.  
  8683.   define bump return \fsexpression(++ \%1)
  8684.  
  8685.    Here's an example in which we define a FIBONACCI operator that returns
  8686.    the nth element, n >= 0, of the Fibonacci series, 0 1 1 2 3 5 8 13 21
  8687.    34 55, . . ., in which the first element is 0, the second is 1, and
  8688.    each subsequent element is the sum of the two before it. This series
  8689.    was devised by Leonardo Pisano, Filius Bonacci (Fibonacci for short)
  8690.    in 1202 to describe how fast rabbits can breed, and also forms the
  8691.    basis for the Golden Mean, the branching behavior of plants, the
  8692.    spiral of a nautilus shell, etc. (Thanks to [523]Dat Thuc Nguyen for
  8693.    December 2003 corrections to this section!)
  8694.  
  8695.    We can write a FIBONACCI function as a macro easily with
  8696.    S-Expressions:
  8697.  
  8698.   define FIBONACCI {
  8699.     (if (== \%1 0) 0
  8700.         (if (== \%1 1) 1 (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1)))))
  8701.   }
  8702.  
  8703.    You can read this as:
  8704.  
  8705.      If the argument (\%1) is 0, return a result of 0; if it is 1,
  8706.      return 1; otherwise:
  8707.      return the sum of fibonacci(argument - 2) and fibonacci(argument -
  8708.      1)
  8709.  
  8710.    Note that a RETURN statement is not needed, since S-Expressions
  8711.    automatically set the return value of their containing macros.
  8712.  
  8713.    For comparison, here's how it would be coded without S-Expressions:
  8714.  
  8715.   define FIBONACCI {
  8716.       if == \%1 0 {
  8717.           return 0
  8718.       } else if == \%1 1 {
  8719.           return 1
  8720.       } else {
  8721.           return \feval(\fexec(fibonacci \feval(\%1-2)) -
  8722.                + \fexec(fibonacci \feval(\%1-1)))
  8723.       }
  8724.   }
  8725.  
  8726.    Now we can use the FIBONACCI function (whichever way you write it)
  8727.    just as if it were a built-in operator:
  8728.  
  8729.   (fibonacci 6)
  8730.  
  8731.    Or:
  8732.  
  8733.   (setq a 10)
  8734.   (fibonacci a)
  8735.  
  8736.    Within S-Expressions only (not outside them), S-Expressions themselves
  8737.    can be used as macro arguments:
  8738.  
  8739.   (setq a 2 b 4)
  8740.   (setq x (fibonacci (* a b )))
  8741.  
  8742.    The value of the S-Expression (in this case "8"), and not the
  8743.    S-Expression itself, is sent to the macro.
  8744.  
  8745.    Your macro is responsible for argument validation and error handling.
  8746.    A robust Fibonacci macro would be more like this:
  8747.  
  8748.   define FIBONACCI {
  8749.       if < \v(argc) 2 end 1 ?\%0: Missing argument
  8750.       if > \v(argc) 2 end 1 ?\%0: Too many arguments
  8751.       if not integer \%1 end 1 ?\%0: Integers only
  8752.       if < \%1 1 end 1 ?\%0: Argument out of range
  8753.       (if (== \%1 0) 0
  8754.          (if (== \%1 1) 1 (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1)))))
  8755.   }
  8756.  
  8757.    Recall that "END nonzero-number [ message ]" causes a macro invocation
  8758.    to fail. When the macro is the operator in an S-Expression, this makes
  8759.    the S-Expression fail too. Also note that our Fibonacci macro is just
  8760.    an illustration, not a practical example. Since it is recursive (calls
  8761.    itself), it won't work for large arguments because the call stack can
  8762.    exceed available memory. See [524]Section 9.9.2 for a practical
  8763.    alternative.
  8764.  
  8765.    Kermit macros, when used as S-Expression operators, can do anything at
  8766.    all except initiate file transfers: they can print messages on the
  8767.    screen, read and write files, interact with the user, and so on. For
  8768.    example, here's a macro ASKME that asks you to enter a number, makes
  8769.    sure that you did, and then returns its value for use in the
  8770.    S-Expression:
  8771.  
  8772.   define ASKME {
  8773.       local \%n
  8774.       while true {
  8775.           ask \%n { Number: }
  8776.           if not def \%n continue
  8777.           if not numeric \%n {
  8778.               echo Not numeric - "\%n"
  8779.               continue
  8780.           }
  8781.           break
  8782.       }
  8783.       return \%n
  8784.   }
  8785.   (setq a (* 2 (askme))) ; Get number from user, double it, assign result to a.
  8786.  
  8787.    Here's a macro you can use to validate that a number is in a given
  8788.    range:
  8789.  
  8790.   define inrange {
  8791.       if != \v(argc) 4 end 1 ?\%0: Wrong number of arguments
  8792.       if ( < \%1 \%2 || > \%1 \%3 ) return 0
  8793.       return 1
  8794.   }
  8795.  
  8796.    The first argument is the number to be checked, the second is the
  8797.    minimum acceptable value, the third is the maximum. You can use this
  8798.    (for example) in IF conditions:
  8799.  
  8800.   define yes echo \%1 IS OK
  8801.   define no echo \%1 IS NOT OK
  8802.  
  8803.   (setq a -1 b 999)
  8804.   (if (inrange a 0 100) (yes a) (no a))
  8805.   (if (inrange b -1000 +1000) (yes b) (no b))
  8806.  
  8807.    This is just an illustration, of course; there's already a built-in
  8808.    operator to let you do range checking without help from macros:
  8809.  
  8810.   (if (<= 0 a 100) (yes a) (no a))
  8811.   (if (<= -1000 b +1000) (yes b) (no b))
  8812.  
  8813.    To send string parameters to a macro, some kind of quoting is required
  8814.    to tell the S-Expression parser to take a given "word" literally
  8815.    rather than replacing it by its value. For this we use the Lisp QUOTE
  8816.    operator:
  8817.  
  8818.   define length return \flength(\%1)
  8819.   (length (quote abcdefghijklmnopqrstuvwxyz))
  8820.   26
  8821.  
  8822.    This causes the string "abcdefghijklmnopqrstuvwxyz" to be sent
  8823.    literally to the LENGTH macro. Kermit, like Lisp, also offers a
  8824.    shortcut for QUOTE, that lets us quote a word by prefixing it with a
  8825.    single quote (') character, also called apostophe (ASCII 39):
  8826.  
  8827.   (length 'abcdefghijklmnopqrstuvwxyz)
  8828.   26
  8829.  
  8830.    The two forms are equivalent.
  8831.  
  8832.    How the macro treats its arguments is up to the macro. In the example
  8833.    above, the argument is treated as a literal string. However, it can
  8834.    also be treated as a variable name:
  8835.  
  8836.   define string This is a string
  8837.   define length return \flength(\m(\%1))
  8838.   (length 'string)
  8839.   16
  8840.  
  8841.    Note the construct \m(\%1). This means "the value of the macro whose
  8842.    name is the value of
  8843.    \%1". The value of \%1 in this case is the word "string", and the
  8844.    value of the macro whose name is "string" is "This is a string".
  8845.  
  8846.    What if the macro takes multiple arguments, or a variable number of
  8847.    them? Here's a simple macro that prints a phrase that includes its
  8848.    arguments:
  8849.  
  8850.   define complain echo It's too \%*!
  8851.  
  8852.    (Recall that \%* means "all arguments".)
  8853.  
  8854.    It can be called in the traditional way:
  8855.  
  8856.   complain hot                       Result: "It's too hot!"
  8857.   complain cold and wet              Result: "It's too cold and wet!"
  8858.  
  8859.    Or from an S-Expression if you quote the arguments:
  8860.  
  8861.   (complain 'hot)                    Result: "It's too hot!"
  8862.   (complain 'cold 'and 'wet)         Result: "It's too cold and wet!"
  8863.  
  8864.    To group multiple words into a single argument, use parentheses:
  8865.  
  8866.   (complain (quote (cold and wet)))  Result: "It's too cold and wet!"
  8867.   (complain '(cold and wet))         Result: "It's too cold and wet!"
  8868.  
  8869.    Note the difference:
  8870.  
  8871.   (complain 'cold 'and 'wet)         Three arguments
  8872.   (complain '(cold and wet))         One argument
  8873.  
  8874.    Since the COMPLAIN macro uses \%* to refer to all its arguments, no
  8875.    matter how many, it doesn't care which form you use. But it makes a
  8876.    difference in cases where the macro refers to its arguments
  8877.    individually.
  8878.  
  8879.    To illustrate, let's consider a macro that receives the name of a
  8880.    macro and its argument list and executes it with its arguments,
  8881.    without knowing how many arguments there are. The following LOOP macro
  8882.    is used to execute the given macro with the given argument list the
  8883.    requested number of times:
  8884.  
  8885.   def loop { local i, for i 1 \%1 1 do \%2 \%3 }
  8886.  
  8887.    Within the LOOP macro, the first argument (\%1) is the loop count, \%2
  8888.    is the macro name, and \%3 is the argument list. When the LOOP macro
  8889.    is invoked traditionally like this:
  8890.  
  8891.   loop 3 complain hot
  8892.  
  8893.    it prints "It's too hot!" three times. To invoke it from an
  8894.    S-Expression, you must quote both the macro name as well as the
  8895.    argument, since in this case the macro name itself is an argument:
  8896.  
  8897.   (loop 3 'complain 'hot)
  8898.  
  8899.    Now what if you need to send different or variable numbers of
  8900.    arguments to the LOOP macro? The LOOP macro can handle it already,
  8901.    provided you group the arguments into LOOP's third argument (\%3). In
  8902.    Kermit syntax, without grouping:
  8903.  
  8904.   loop 3 complain cold and wet
  8905.  
  8906.    prints "It's too cold!" three times ("and wet" is lost); but with
  8907.    grouping (either of the following two forms):
  8908.  
  8909.   loop 3 complain {cold and wet}
  8910.   loop 3 complain "cold and wet"
  8911.  
  8912.    the LOOP macro prints "It's too cold and wet!" three times as desired.
  8913.  
  8914.    To do the same thing in an S-Expression, just use the Lisp forms of
  8915.    quoting instead of the Kermit forms; the following two are equivalent:
  8916.  
  8917.   (loop 3 'complain (quote (cold and wet)))
  8918.   (loop 3 'complain '(cold and wet))
  8919.  
  8920.    Here's a similar example in which we write a macro that shows both the
  8921.    name and the value of one or more other macros, whose names are given
  8922.    as arguments (similar to "show macro"):
  8923.  
  8924.   define display {
  8925.       local \%i
  8926.       for \%i 1 \v(argc)-1 1 {
  8927.           echo \&_[\%i] = \m(\&_[\%i])
  8928.       }
  8929.   }
  8930.  
  8931.    (Recall that \&_[] is the macro's argument vector array, equivalent to
  8932.    \%1, \%2, ...) The DISPLAY macro can be used in S-Expressions like
  8933.    this:
  8934.  
  8935.   (setq a 1 b 2 c 3)
  8936.   (display 'a 'b 'c 'd)
  8937.  
  8938.    which prints:
  8939.  
  8940.   a = 1
  8941.   b = 2
  8942.   c = 3
  8943.   d =
  8944.  
  8945.    The names must be quoted to prevent their evaluation before they are
  8946.    sent to the macro. This ability to pass variables "by name" to macros,
  8947.    rather than by value, lets you write macros that change the values of
  8948.    argument variables. For example, here's a macro that doubles the value
  8949.    of its argument variable:
  8950.  
  8951.   define double (++ \%1 \%1)
  8952.  
  8953.    which you can call like this:
  8954.  
  8955.   (setq a 12)
  8956.   (double 'a)
  8957.  
  8958.    In the macro, \%1 is replace by the variable name "a"; "(++ a a)" adds
  8959.    "a" to itself, and sets the value of "a" to the result.
  8960.  
  8961.    There are no built-in operators other than QUOTE, ', and STRING for
  8962.    handling strings in S-Expressions, but using just these, plus macros
  8963.    that use Kermit's regular string-handling features, you can easily
  8964.    extend S-Expressions to do string manipulation:
  8965.  
  8966.   define len return \flen(\%1)               Returns length of argument string
  8967.   define cap return \fupper(\%1)             Uppercase argument string
  8968.   define rev return \freverse(\%1)           Reverses argument string
  8969.   define sub return \fsubstr(\%1,\%2,\%3)    Returns substring of arg string
  8970.  
  8971.   (len '(this is a string))                  Result: 16
  8972.   (rev '(this is a string))                  Result: gnirts a si siht
  8973.   (rev (cap '(this is a string)))            Result: GNIRTS A SI SIHT
  8974.   (sub (rev (cap '(this is a string))) 5 9)  Result: TS A SI S
  8975.  
  8976.    You can assign a string to a macro name as follows:
  8977.  
  8978.   (setq foo '(this is a string))
  8979.   (setq foo (quote (this is a string)))
  8980.  
  8981.    The two are exactly equivalent. In both cases, the macro "foo" has the
  8982.    value:
  8983.  
  8984.   '(this is a string)
  8985.  
  8986.    so when it is retrieved it can be identified as a string rather than a
  8987.    number or commands to be executed. Thus:
  8988.  
  8989.   (setq foo (quote (this is a string)))
  8990.   show macro foo
  8991.   foo = '(this is a string)
  8992.   (foo)
  8993.   this is a string
  8994.  
  8995.    Note the different results for "show macro foo" and "(foo)". The
  8996.    former shows the internal definition; the latter evaluates the
  8997.    variable, which removes the quoting. And perhaps more important, note
  8998.    that if the apostrophe and surrounding parentheses were not stored as
  8999.    part of the definition, (foo) would try to execute "this is a string"
  9000.    as a command.
  9001.  
  9002.    Given the assignment above, the following work as expected:
  9003.  
  9004.   (len foo)                                  Result: 16
  9005.   (rev foo)                                  Result: gnirts a si siht
  9006.   (rev (cap foo))                            Result: GNIRTS A SI SIHT
  9007.   (sub (rev (cap foo)) 5 8)                  Result: TS A SI S
  9008.  
  9009.    Note that, unlike built-in S-Expression operators that return numbers
  9010.    or truth values, these operators return strings. If you want to assign
  9011.    their return values to other variables, you can do so:
  9012.  
  9013.   (setq bar (rev (cap foo)))                 Result: GNIRTS A SI SIHT
  9014.  
  9015.    But now the S-Expression processor doesn't know the value of "bar" is
  9016.    supposed to be a string, rather than a macro to execute. For this you
  9017.    need one final special operator, STRING. The STRING operator takes an
  9018.    S-Expression as an operand, evaluates it, and then returns its value
  9019.    enclosed in '(), so you can use the value as a string is subsequent
  9020.    S-Expressions. Use STRING for referencing macros that return strings:
  9021.  
  9022.   (setq bar (string (rev (cap foo))))        Result: '(GNIRTS A SI SIHT)
  9023.  
  9024.    STRING is like QUOTE, except that it evaluates its operand before
  9025.    applying the quoting, rather than taking the operand literally.
  9026.  
  9027.    To reference backslash variables or functions that return string
  9028.    values, you must use the regular quoting mechanisms:
  9029.  
  9030.   (setq time '(\v(time)))
  9031.   (setq date '(\v(date)))
  9032.   assign \%r this is a string
  9033.   (setq s1 '(\%r))
  9034.  
  9035.    That's because backslash items are evaluated BEFORE the S-Expression
  9036.    parser ever sees them, and the values of \v(time) and so on are not
  9037.    valid S-Expressions, so STRING won't like them.
  9038.  
  9039.    Finally a brief word on the touchy topic of quoting. Suppose you want
  9040.    to include (say) literal parentheses in a string that will later be
  9041.    processed by the S-Expression reader (or \fsplit() or \fword()).
  9042.    Normally, you can't do this because parentheses are meaningful in
  9043.    these contexts. To defeat the normal parsing rules, you can quote the
  9044.    parentheses with backslash. However, due to the many levels of string
  9045.    processing involved, a surprisingly large amount of backslashes might
  9046.    be required, for example:
  9047.  
  9048.   (setq s '(a b (c d) \\\\\\\\\\\\\\\\(e f (g h) x\\\\\\\\\\\\\\\\) j k))
  9049.  
  9050.    This is nearly impossible to explain(*). Instead, just remember two
  9051.    points:
  9052.  
  9053.      * In situations like this, it's better to use DEFINE to create the
  9054.        string, rather than SETQ. The example above requires only double
  9055.        backslashes when DEFINE is used:
  9056.   define s '(a b (c d) \\(e f (g h) x\\) j k)
  9057.      * The level of quoting depends on how many levels of evaluation the
  9058.        string must pass through, which is not always obvious. However,
  9059.        the number of backslashes required in any given situation is
  9060.        always a power of 2. So if 1 doesn't work, try 2; if 2 doesn't
  9061.        work, try 4; if 4 doesn't work, try 8, 16, 32, and so on.
  9062.  
  9063.    Considerations like this apply in any scripting language (shell, Tcl,
  9064.    Perl, Python, etc). The situation is known as "Quoting Hell".
  9065.  
  9066.    (*) If you really want an explanation, here it is:
  9067.  
  9068.      * Every SEXP has its backslash items evaluated in a single pass at
  9069.        top level before being passed to the SEXP reader, so \%1,
  9070.        \v(ftime), etc, can be evaluated up front, freeing the SEXP reader
  9071.        of having to know about such things, which in turn makes it much
  9072.        more efficient. Therefore one level of quoting is lost right away,
  9073.        and therefore you must double each backslash that is to be used as
  9074.        a quote.
  9075.      * When the SEXP reader sees '\', it treats it as a quote; discards
  9076.        it and keeps the next character. Thus '\\' becomes '\'. This would
  9077.        be the end of it, except that:
  9078.      * The SEXP reader must call itself recursively on its operands, so
  9079.        we must double any quotes in the operands: 2^2 = 4.
  9080.      * If the result is to be passed as an argument to a macro, the
  9081.        backslashes must again be doubled, because the macro processor
  9082.        evaluates the arguments before sending them to the macro: 2^3 = 8.
  9083.      * If the macro itself is to see the quotes, rather than just the
  9084.        result of the quoting, the quotes must be doubled again: 2^4 = 16.
  9085.  
  9086.    Moral: To create string constants in which grouping characters must be
  9087.    quoted, use DEFINE rather than SETQ.
  9088.  
  9089.    [ [525]Top ] [ [526]Contents ] [ [527]C-Kermit Home ] [ [528]Kermit
  9090.    Home ]
  9091.      _________________________________________________________________
  9092.  
  9093.   9.9. Examples
  9094.  
  9095.     9.9.1. Statistics
  9096.  
  9097.    The following program computes statistics -- means, maxima, mimima,
  9098.    variance, standard deviation, and correlation -- from data stored in
  9099.    parallel arrays, \&x[] and \&y[], which can contain any mixture of
  9100.    integer and floating-point numbers: positive, negative, or zero. Array
  9101.    setup and validation are not shown. Except for the traditional FOR
  9102.    loop and printing the results at the end, the entire computation is
  9103.    done with S-Expressions:
  9104.  
  9105. ; Initialize sums, maxima, minima, and number of elements
  9106.  
  9107.   (setq xsum 0 ysum 0 xsum2 0 ysum2 0 xysum 0)
  9108.   (setq xmin (setq xmax \&x[1]) ymin (setq ymax \&y[1]))
  9109.   (setq n \fdim(&x))
  9110.  
  9111. ; Loop through elements and accumulate sums, maxima, and minima
  9112.  
  9113.   for i 1 n 1 {
  9114.       (setq x \&x[i] y \&y[i])                    ; Notational convenience
  9115.       (setq xmax (max xmax x) ymax (max ymax y))  ; X and Y maxima
  9116.       (setq xmin (min xmin x) ymin (min ymin y))  ; X and Y minima
  9117.       (++ xsum x ysum y)                          ; X and Y sums
  9118.       (++ xsum2 (^ x 2) ysum2 (^ y 2))            ; Sum of X and Y squares
  9119.       (++ xysum (* x y))                          ; Sum of XY products
  9120.   }
  9121.  
  9122. ; Calculate results
  9123.  
  9124.   (setq xmean (/ xsum n) ymean (/ ysum n))        ; Mean X and Y
  9125.   (setq xss (- xsum2 (/ (^ xsum 2) n)))           ; Intermediate values
  9126.   (setq yss (- ysum2 (/ (^ ysum 2) n)))
  9127.   (setq xyss (- xysum (/ (* xsum ysum) n)))
  9128.   (setq xvar (/ xss n) yvar (/ yss n))            ; X and Y variance
  9129.   (setq sdx (sqrt xvar) sdy (sqrt yvar))          ; Std deviation in X and Y
  9130.   (setq tmp (* xss yss))
  9131.   (setq cc (if tmp (/ xyss (sqrt tmp)) 1.0))      ; Correlation coefficient
  9132.   show macro xmean ymean xvar yvar sdx sdy cc     ; Print the results
  9133.  
  9134.    The final "if tmp" check accounts for the possibility that both arrays
  9135.    contain all 0's. Results can also be printed with "echo CC = \m(cc)",
  9136.    or any other desired way. Interestingly, if we had not needed the sum
  9137.    of the squares and products, we could have obtained the sums, maxima,
  9138.    and minima of the X's and Y's without a loop like this:
  9139.  
  9140.   (setq xsum (+ \fjoin(&x)) ysum (+ \fjoin(&y)))
  9141.   (setq xmax (max \fjoin(&x)) ymax (max \fjoin(&y)))
  9142.   (setq xmin (min \fjoin(&x)) ymin (min \fjoin(&y)))
  9143.  
  9144.    Any Kermit function that returns numbers or lists of numbers can be
  9145.    included in an S-Expression as an operand.
  9146.      _________________________________________________________________
  9147.  
  9148.     9.9.2. Practical Fibonacci Series
  9149.  
  9150.    The recursive Fibonacci example given previously is simple and
  9151.    elegant, but not very useful since it causes memory occupation to grow
  9152.    each time it calls itself, until eventually both physical memory and
  9153.    disk swap space are filled and the program crashes. Even for small
  9154.    arguments, like 17, execution time can be prohibitive:
  9155.  
  9156.   (setq t1 \v(ftime))
  9157.   (setq result (fibonacci 17))
  9158.   (setq t2 (- \v(ftime) t1))
  9159.   echo FIBONACCI(17) = \m(result): TIME = \ffpround(t2,3)
  9160.  
  9161.    prints (on a certain rather slow computer):
  9162.  
  9163.   FIBONACCI(17) = 1597: TIME = 5.861
  9164.  
  9165.    Any recursive function can be recoded iteratively. The result is not
  9166.    as pretty, but execution is far less expensive:
  9167.  
  9168.     define FIBITER {
  9169.         (if (== \%3 0) (\%2) (fibiter (+ \%1 \%2) \%1 (- \%3 1)))
  9170.     }
  9171.     define FIBONACCI {
  9172.         (fibiter 1 0 \%1)
  9173.     }
  9174.  
  9175.    Here's the result on the same computer for the same argument of 17:
  9176.  
  9177.   FIBONACCI(17) = 1597: TIME = 0.015
  9178.  
  9179.    (47 times faster.) Execution time increases proportionally to the size
  9180.    of the argument in the iterative case, whereas in the recursive case
  9181.    it goes up geometrically, quickly reaching infinity.
  9182.  
  9183.    [ [529]Top ] [ [530]Contents ] [ [531]C-Kermit Home ] [ [532]Kermit
  9184.    Home ]
  9185.      _________________________________________________________________
  9186.  
  9187.   9.10. Differences from Algebraic Notation
  9188.  
  9189.    In C-Kermit:
  9190.  
  9191.      * Algebraic notation uses infix operators and normal rules of
  9192.        operator precedence, with parentheses used to force exceptions to
  9193.        the rules; many operations can be included in an expression.
  9194.        S-Expressions use prefix operators with no intrinsic precedence;
  9195.        each operation is enclosed in parentheses, and the arrangement of
  9196.        parentheses determines precedence.
  9197.      * Algebraic infix operators require two operands; S-Expression
  9198.        prefix operators can accept a variable number of operands.
  9199.      * You can use algebraic notation anywhere that C-Kermit accepts a
  9200.        number, e.g. "echo \&a[((1+1)*2-1]", but you can use S-Expressions
  9201.        only as top-level commands. You can, however, use either algebraic
  9202.        or S-Expressions anywhere at all by enclosing them in \fevaluate()
  9203.        or \fsexpression(), respectively.
  9204.      * You can use any mixture of integer and floating-point numbers in
  9205.        S-Expressions, but only integers are permitted in algebraic
  9206.        expressions. Outside of S-Expressions, floating point arithmetic
  9207.        is supported only by \ffp...() function calls.
  9208.      * Operators and operands in S-Expressions must be separated by
  9209.        spaces, e.g. "(+ a b)". Spaces are not required in algebraic
  9210.        expressions: "((a+b)*c)".
  9211.      * When assigning values to backslash variables (such as \%x or
  9212.        \&a[2]) using SETQ or LET, you must double the backslash.
  9213.  
  9214.    [ [533]Top ] [ [534]Contents ] [ [535]C-Kermit Home ] [ [536]Kermit
  9215.    Home ]
  9216.      _________________________________________________________________
  9217.  
  9218.   9.11. Differences from Lisp
  9219.  
  9220.      * Kermit has a lot of built-in operators not found in Lisp: ++, ^,
  9221.        etc.
  9222.      * Most dialects of real Lisp do not allow S-Expressions that don't
  9223.        start with an operator, for example:
  9224.   (a)
  9225.        This expression can cause an error in Lisp (even if "a" has a
  9226.        value), but is acceptable in Kermit, where it returns the value of
  9227.        the variable "a". Similarly, (1) returns the value "1".
  9228.      * In real Lisp, EVAL requires exactly one operand. In Kermit, it can
  9229.        have 0, 1, 2, or more operands. It returns the value of the last
  9230.        operand evaluated.
  9231.      * Real Lisp SETQ and LET usually require an even number of operands.
  9232.        Kermit allows an odd number, in which case the last (or only)
  9233.        variable is undefined (i.e. deleted, destroyed).
  9234.      * Kermit does not support ratios such as "7/8". Some Lisp dialects
  9235.        accept ratios as numbers, and generate ratios when told to divide
  9236.        two integers whose quotient is not a whole number; e.g. in Common
  9237.        Lisp:
  9238.   [13] USER(37): (/ (+ 1 2 3 4) 3)
  9239.   10/3
  9240.   [13] USER(38):
  9241.      * The result of (/ 10 3) is 3.333.... Some Lisp dialects truncate
  9242.        the result to 3 since both operands are integers, some don't; some
  9243.        give the result as a ratio. C-Kermit always gives a floating point
  9244.        result when there is a fractional part. If you want an integer
  9245.        result, you can use TRUNCATE, FLOOR, or CEILING, e.g. (truncate (/
  9246.        10 3)).
  9247.      * There is currently no "bignum" support. Large numbers can be used
  9248.        and large results generated, but (as noted in [537]Section 9.2)
  9249.        they are accurate only to the precision of the underlying machine.
  9250.        \v(math_precision) gives the machine precision as a number of
  9251.        decimal digits, e.g. 16.
  9252.      * Scientific notation for floating-point numbers is not supported.
  9253.        If the magnitude of a number is greater than the precision of the
  9254.        underlying hardware, the less-significant digits are shown but
  9255.        their values are meaningless. If it the number is too small to be
  9256.        represented internally, it is shown as "0.0".
  9257.      * Many Lisp features are omitted: List processing (CAR, CDR, etc),
  9258.        DEFUN, Lisp-specific control structures, and so on.
  9259.  
  9260.    [ [538]Top ] [ [539]Contents ] [ [540]C-Kermit Home ] [ [541]Kermit
  9261.    Home ]
  9262.   __________________________________________________________________________
  9263.  
  9264. 10. FILE TRANSFER
  9265.  
  9266.    New commands and switches:
  9267.  
  9268.    SET TRANSFER REPORT { OFF, ON }
  9269.           Enables or disables the (new) one-line message printed by
  9270.           Kermit after a remote-mode file transfer to indicate the source
  9271.           and destination file, complete with path, to let you know where
  9272.           the file went.
  9273.  
  9274.    SEND /TYPE:{TEXT,BINARY}
  9275.           Sends only files of the given type (see [542]Section 4).
  9276.  
  9277.    SEND /NOFOLLOWLINKS:
  9278.           (UNIX only) Skip over symbolic links rather than following them
  9279.           (default). This applies to wildcard and/or recursive SENDs; if
  9280.           a single filename is given, and it happens to be a symbolic
  9281.           link, the file it points to is sent.
  9282.  
  9283.    SEND /FOLLOWLINKS:
  9284.           (UNIX only) Follow (resolve) symbolic links. Watch out for
  9285.           circular links, endless loops, etc.
  9286.  
  9287.    SET SEND I-PACKETS { OFF, ON }
  9288.           When sending commands to a Kermit server, this tells whether
  9289.           command packets should be preceded by an I (information)
  9290.           packet, which is used to synchronize parameters prior to
  9291.           executing the command. Normally ON. The only reason to set this
  9292.           OFF is for communicating with buggy Kermit servers that
  9293.           misbehave when an I packet is sent to them. There is also a SET
  9294.           RECEIVE I-PACKETS command, but presently it has no effect.
  9295.  
  9296.    SET TRANSFER MESSAGE [ text ]
  9297.           Sets an initial message to be shown in the Last Message field
  9298.           of the fullscreen file-transfer display.
  9299.  
  9300.    SET TRANSFER TRANSLATION { ON, OFF }
  9301.           Inhibits or re-enables text-file transfer character-set
  9302.           translation globally.
  9303.  
  9304.    { SEND, MSEND, GET, RECEIVE } /TRANSPARENT
  9305.           Inhibits character-set translation for this transfer only.
  9306.  
  9307.    { GET, RECEIVE } /PIPES:{ON,OFF}
  9308.           Overrides global TRANSFER PIPES setting for this transfer only;
  9309.           ON allows incoming files with names like "!tar xf -" to be
  9310.           opened as pipelines rather than regular files.
  9311.  
  9312.    The following new "hot keys" are available when Kermit's file-transfer
  9313.    display is visible:
  9314.  
  9315.      D: Turn on debugging, open "debug.log" if not already open.
  9316.      d: Turn off debugging but leave log open (if it was open).
  9317.      T: Turn on debug-log timestamps.
  9318.      t: Turn off debug-log timestamps.
  9319.  
  9320.    Other improvements:
  9321.      * SET FILE DOWNLOAD-DIRECTORY now works for external protocols (e.g.
  9322.        sz/rz) too.
  9323.      * Improved automatic per-file text/binary switching, described in
  9324.        [543]Section 4.
  9325.      * When sending a file group (e.g. "send *.*"), failure to open a
  9326.        file is no longer fatal; now C-Kermit simply goes ahead to the
  9327.        next file.
  9328.      * Transaction log entries are now made for external protocols too.
  9329.  
  9330.    [ [544]Top ] [ [545]Contents ] [ [546]C-Kermit Home ] [ [547]Kermit
  9331.    Home ]
  9332.   __________________________________________________________________________
  9333.  
  9334. 11. MODEMS AND DIALING
  9335.  
  9336.    In C-Kermit 8.0, the default modem type for dialing has changed from
  9337.    NONE (= DIRECT, meaning no modem) to GENERIC. This change should have
  9338.    no impact on direct connections. For dialing, it means that, unless
  9339.    you SET MODEM TYPE to a specific type, such as USROBOTICS or CONEXANT,
  9340.    Kermit assumes:
  9341.  
  9342.     1. The modem uses the Hayes AT command set.
  9343.     2. The modem supports error correction, data compression, and
  9344.        hardware flow control and is already configured to use them.
  9345.  
  9346.    In fact, Kermit assumes the modem is completely configured, and
  9347.    therefore does not send it an initialization string or any
  9348.    configuration commands. Instead, it sends only the simplest and most
  9349.    portable commands:
  9350.  
  9351.      ATQ0V1          Give dial result codes.
  9352.      ATDTnumber      Dial the number.
  9353.  
  9354.    (or ATD or ATDP, as appropriate).
  9355.  
  9356.    The new defaults work for direct connections and for most modern
  9357.    modems on most platforms, and they work much faster than
  9358.    "full-treatment" dialing. If the new defaults don't work for you, or
  9359.    if you need to perform explicit modem configuations or interactions,
  9360.    then set a specific modem type and use the SET MODEM and SET DIAL
  9361.    commands as documented in Using C-Kermit.
  9362.  
  9363.      WARNING: Don't use the generic modem on hosts that do not support
  9364.      RTS/CTS flow control. If Xon/Xoff is in use on the serial port,
  9365.      you'll need to select a particular modem type so Kermit knows what
  9366.      command to give it to enable Xon/Xoff flow control between itself
  9367.      and your serial port.
  9368.  
  9369.    The following new modem types were added in C-Kermit 8.0:
  9370.  
  9371.      lucent:          Lucent Venus chipset
  9372.      pctel:           PCTel V.90 chipset
  9373.      conexant:        Conexant (ex-Rockwell) modem family
  9374.      zoom-v32bis:     New name for "Zoom"
  9375.      zoom-v34         Zoom V.34
  9376.      zoom-v90         Zoom V.90 56K
  9377.      zoom-v92:        Zoom V.92 with V.44 data compression
  9378.      zoltrix-v34:     New name for "zoltrix"
  9379.      zoltrix-hsp-v90: Synonym for PCTel
  9380.      zoltrix-hcf-v90: Synonym for ITU-T-V250
  9381.      smartlink-v90:   Synonym for usrobotics (same chipset)
  9382.      acer-v90:        Synonym for Rockwell-v90
  9383.  
  9384.    New DIAL-related variables:
  9385.  
  9386.      \v(dm_hf):  Dial modifier: Wait for Hook-Flash.
  9387.      \v(dm_wb):  Dial modifier: Wait for Bong.
  9388.  
  9389.    Finally, if dialing fails, Kermit now prints a context-sensitive hint
  9390.    suggesting possible reasons and remedies.
  9391.  
  9392.    Added in C-Kermit 8.0.201:   Rudimentary support for Caller ID, for
  9393.    use with the ANSWER command. If the modem reports Caller ID
  9394.    information, Kermit stores it in variables that you can access after
  9395.    the call is answered:
  9396.  
  9397.   \v(callid_date)   The date of the call
  9398.   \v(callid_time)   The time of the call
  9399.   \v(callid_name)   The name of the caller
  9400.   \v(callid_nmbr)   The telephone number of the caller
  9401.   \v(callid_mesg)   A message
  9402.  
  9403.    The format of these items depends on the originating and answering
  9404.    phone companies and the modems and their configuration.
  9405.  
  9406.    Not very many modems support Caller ID, and those that do (a) tend to
  9407.    have it disabled by default, and (b) use different commands to enable
  9408.    it. A quick survey shows of some current models shows:
  9409.  
  9410.    - USR V.90:      No
  9411.    - ITU-T V.250:   No
  9412.    - Lucent Venus:  No
  9413.    - Diamond Supra: #CID=1
  9414.    - Rockwell 56K:  #CID=1
  9415.    - PCTEL:         #CID=1
  9416.    - Zoltrix:       +VCID=1
  9417.    - Conexant:      +VCID=1
  9418.  
  9419.    To use Kermit's Caller ID feature, you have to set the modem to wait
  9420.    for at least two rings before answering, and you have to give the
  9421.    command to enable Caller ID; for example (after choosing a modem with
  9422.    SET MODEM TYPE):
  9423.  
  9424.   set modem command autoanswer on ATS0=2#CID=1\{13}
  9425.   set modem command autoanswer on ATS0=2+VCID=1\{13}
  9426.  
  9427.    These commands can be undone with:
  9428.  
  9429.   set modem command autoanswer on ATS0=1#CID=0\{13}
  9430.   set modem command autoanswer on ATS0=1+VCID=0\{13}
  9431.  
  9432.    Kermit presently has no built-in knowledge of the Caller ID
  9433.    capabilities or commands of the modems in its database.
  9434.  
  9435.    Since the variables can be accessed only after the call is answered,
  9436.    the only way to refuse a call is to answer it, inspect the variables,
  9437.    and then hang it up if desired.
  9438.  
  9439.    [ [548]Top ] [ [549]Contents ] [ [550]C-Kermit Home ] [ [551]Kermit
  9440.    Home ]
  9441.   __________________________________________________________________________
  9442.  
  9443. 12. TERMINAL CONNECTION
  9444.  
  9445.    Now that 7-bit connections are no longer the norm, the default
  9446.    terminal bytesize (also called "data size" or "word size") in C-Kermit
  9447.    8.0 is 8 bits, rather than 7 bits as it was in C-Kermit 7.0 and
  9448.    earlier:
  9449.  
  9450.    SET ESCAPE character
  9451.           This command, which specifies your CONNECT-mode escape
  9452.           character, allows you to specify any ASCII control character in
  9453.           a variety of formats. C-Kermit 8.0.201 now also lets you
  9454.           specify any 8-bit value, 128-255, as the escape character. In
  9455.           the SET ESCAPE command, you can type the 8-bit character
  9456.           literally or you can enter its numeric code. Here are examples
  9457.           that you can enter from a terminal or console that uses the ISO
  9458.           Latin-1 character set:
  9459.  
  9460.   C-Kermit> set escape ├
  9461.   C-Kermit> set escape 195
  9462.   C-Kermit> show escape
  9463.    Escape character: Code 195 (├): enabled
  9464.   C-Kermit>
  9465.  
  9466.           Both of these commands set the escape character value to 195
  9467.           (decimal), which happens to be uppercase letter A with Tilde in
  9468.           Latin-1. SHOW ESCAPE and SHOW TERMINAL show the value, as does
  9469.           the CONNECT message.
  9470.  
  9471.    SET TERMINAL AUTODOWNLOAD ERROR { STOP, CONTINUE }
  9472.           When Kermit has a terminal connection to another computer, and
  9473.           a file transfer is initiated automatically because a Kermit
  9474.           packet was received in CONNECT mode (i.e. in the terminal
  9475.           screen), this command tells what Kermit should do if the
  9476.           transfer fails. The default is to STOP, which leaves Kermit in
  9477.           command mode with its file-transfer display showing, so you can
  9478.           see that the transfer failed and why. If you SET TERMINAL
  9479.           AUTODOWNLOAD ERROR CONTINUE, this causes Kermit to return
  9480.           automatically to its terminal screen (i.e. resume its CONNECT
  9481.           session) as if the transfer had succeeded; this can be
  9482.           desirable if the entire session is under control of a
  9483.           host-based script.
  9484.  
  9485.    SET TERMINAL BYTESIZE { 7, 8 }
  9486.           The byte size to use during CONNECT and INPUT command
  9487.           execution, which can be more restrictive than the bytesize
  9488.           implied by the current PARITY setting, but not less
  9489.           restrictive. In C-Kermit 7.0 and earlier, the terminal bytesize
  9490.           was 7 by default to protect against the likelihood that parity
  9491.           was in use on the connection without the user's knowledge. When
  9492.           the terminal bytesize is 8 (as it is in C-Kermit 8.0 and
  9493.           later), the user will see garbage in this (increasingly
  9494.           unlikely) situation. Note that 8 data bits are required for
  9495.           most character sets other than ASCII: Latin-1, UTF-8, and so
  9496.           on.
  9497.  
  9498.    A new command has been added to produce timestamped session logs:
  9499.  
  9500.    SET TERMINAL SESSION-LOG TIMESTAMPED-TEXT
  9501.           Records the terminal session in text mode (like SET TERMINAL
  9502.           SESSION-LOG TEXT) but adds a timestamp at the beginning of each
  9503.           line. The timestamp format is hh:mm:ss.nnn, and indicates the
  9504.           time at which the first character of the line appeared.
  9505.  
  9506.    In most UNIX versions (those built with the select()-capable CONNECT
  9507.    module -- pretty much all the ones that have or could have TELNET
  9508.    included), an idle timeout feature has been added:
  9509.  
  9510.    SET TERMINAL IDLE-TIMEOUT number
  9511.           If the number is not 0, then Kermit is to take an action when
  9512.           the given amount of time passes with no activity during CONNECT
  9513.           mode. If the number is positive it is the maximum number of
  9514.           idle seconds; if number is negative it represents milliseconds
  9515.           (thousandths of seconds). If 0 is given as the number, there
  9516.           are no idle timeouts. Synonym: SET TERMINAL IDLE-LIMIT.
  9517.  
  9518.    SET TERMINAL IDLE-ACTION { RETURN, HANGUP, EXIT, OUTPUT [ string ] }
  9519.           The action to be taken upon an idle timeout in CONNECT mode.
  9520.           RETURN to the prompt, HANGUP the connection, EXIT from Kermit,
  9521.           or OUTPUT the given string (if no string is given, a NUL (ASCII
  9522.           0) character is sent).
  9523.  
  9524.    SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }
  9525.           Actions that can be selected on Telnet connections only, that
  9526.           might be useful if idle limits are enforced by the Telnet
  9527.           server or in the TCP/IP protocol: TELNET-NOP sends a "NO
  9528.           Operation" (do-nothing) command, which causes no response from
  9529.           the server; TELNET-AYT sends an "Are You There" message to the
  9530.           server, which should make the server send back a message.
  9531.           Neither of these actions interferes with your remote session.
  9532.  
  9533.    SET TERMINAL IDLE-ACTION is useful for connections to hosts or
  9534.    services that automatically log you out after a certain amount of idle
  9535.    time, e.g.:
  9536.  
  9537.   set term idle-timeout 300
  9538.   set term idle-action output \32
  9539.  
  9540.    sends a space (as if you had pressed the space bar) every 300 seconds
  9541.    (five minutes) while there is no activity (32 is the ASCII code for
  9542.    space).
  9543.  
  9544.    When C-Kermit returns from CONNECT to command mode, the reason for the
  9545.    transition is given in a new variable, \v(cx_status):
  9546.  
  9547.       0  No CONNECT command given yet.
  9548.       1  User escaped back manually.
  9549.       2  A trigger string was encountered.
  9550.       3  IKSD entered server mode.
  9551.       4  Application Program Command received from host.
  9552.       5  Idle timeout.
  9553.       6  Telnet protocol error.
  9554.       7  Keystroke macro.
  9555.       8  Time limit exceeded.
  9556.     100  Internal error.
  9557.     101  Carrier required by not detected.
  9558.     102  I/O error on connection.
  9559.     103  Disconnected by host.
  9560.     104  Disconnected by user.
  9561.     105  Session limit exceeded.
  9562.     106  Rejected due to Telnet policy.
  9563.     107  Received kill signal.
  9564.  
  9565.    Values 100 and above indicate there is no connection.
  9566.  
  9567.    [ [552]Top ] [ [553]Contents ] [ [554]C-Kermit Home ] [ [555]Kermit
  9568.    Home ]
  9569.   __________________________________________________________________________
  9570.  
  9571. 13. CHARACTER SETS
  9572.  
  9573.    See the section on [556]file scanning above, and the section on
  9574.    character-set conversion in [557]FTP. Also:
  9575.  
  9576.      * True support for CP1252 (rather than treating it as Latin-1).
  9577.      * Proper handling of C1 values when converting ISO 8-bit text to
  9578.        UTF-8.
  9579.      * TYPE /CHARACTER-SET: /TRANSLATE-TO: allows specific translations.
  9580.      * The TRANSLATE command now works on multiple files.
  9581.      * K_CHARSET environment variable to set the file character-set.
  9582.      * SET TRANSFER TRANSLATION OFF.
  9583.      * FTP client character-set translation ([558]Section 3.7).
  9584.  
  9585.    [ [559]Top ] [ [560]Contents ] [ [561]C-Kermit Home ] [ [562]Kermit
  9586.    Home ]
  9587.   __________________________________________________________________________
  9588.  
  9589. 14. DIALOUT FROM TELNET TERMINAL SERVERS
  9590.  
  9591.    For years, C-Kermit has supported dialing out from Telnet modem
  9592.    servers (also called reverse terminal servers or access servers), but
  9593.    until now there was no way for Kermit to control the communication
  9594.    parameters (speed, parity, etc) on the serial port of the terminal
  9595.    server; it had to use whatever was there.
  9596.  
  9597.    But now, if you make a connection to a server that supports the Telnet
  9598.    Com Port Control Option, [563]RFC 2217, you have the same degree of
  9599.    control as you would have over a serial port on the computer where
  9600.    Kermit is running: SET SPEED, SET FLOW, SET PARITY, SET STOP-BITS,
  9601.    SHOW COMM, WAIT, SET CARRIER-WATCH, the modem-signal variables,
  9602.    sending Break, and so on, apply to the connection between the terminal
  9603.    server and the modem.
  9604.  
  9605.    For example, using a Cisco Access Server 2509, where specifying a TCP
  9606.    port in the 6000's selects a serial port that can be used for dialing
  9607.    out:
  9608.  
  9609.   set host xxx 6001      ; xxx is the IP hostname or address of the server
  9610.   (log in if necessary)  ; With a script or by hand
  9611.   set modem type usr     ; Tell Kermit what kind of modem it has
  9612.   set speed 57600        ; This affects the server's port
  9613.   set flow rts/cts       ; Ditto
  9614.   dial 7654321
  9615.  
  9616.    The modem server might or might not require a login sequence. It might
  9617.    also allow for automatic authentication, e.g. via Kerberos tickets.
  9618.    NOTE: If the modem server requires a login sequence, then REDIAL might
  9619.    not work as expected.
  9620.  
  9621.    When you have a Telnet Com Port connection, your SET SPEED and SET
  9622.    FLOW options change automatically to reflect the capabilities of the
  9623.    server, rather than those of your local computer.
  9624.  
  9625.    See the configuration manual for your server for additional
  9626.    information. For example, how to set up the server to drop the Telnet
  9627.    connection automatically when the telephone call is hung up (e.g.
  9628.    "autohangup" on Cisco models).
  9629.  
  9630.    For a Linux-based Telnet Com-Port server, click the Srdird link:
  9631.  
  9632.    [ [564]Top ] [ [565]Contents ] [ [566]Sredird ] [ [567]C-Kermit Home ]
  9633.    [ [568]Kermit Home ]
  9634.   __________________________________________________________________________
  9635.  
  9636. 15. COPING WITH BROKEN KERMIT PARTNERS
  9637.  
  9638.    There are lots of faulty Kermit protocol implementations out there,
  9639.    found mainly in 3rd-party products ranging from communications
  9640.    software packages to file-transfer functions imbedded within devices.
  9641.    This topic is covered [569]HERE for C-Kermit 7.0, but C-Kermit 8.0
  9642.    adds some additional tricks.
  9643.  
  9644.    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
  9645.           Allows control of the Kermit's Record-Format attribute. Set
  9646.           this to OFF in case incoming file are refused due to unknown or
  9647.           invalid record formats if you want to accept the file anyway.
  9648.  
  9649.    SET SEND I-PACKETS { ON, OFF }
  9650.           A Kermit server is supposed to accept I-packets; this is how
  9651.           the client lets the server know its capabilities and
  9652.           preferences before sending a command. Apparently there is at
  9653.           least one Kermit server implementation that does not accept
  9654.           I-packets, and does not properly respond with an Error packet
  9655.           if it gets one. To get around such situations in C-Kermit 8.0,
  9656.           you can use SET SEND I-PACKETS OFF to inhibit the sending of I
  9657.           packets. In this case, the client must be able to adjust to the
  9658.           server's configuration, rather than the other way around as we
  9659.           are used to.
  9660.  
  9661.    SET PROTOCOL KERMIT {} {} {}
  9662.           C-Kermit 6.0 and later automatically send "autoupload" and
  9663.           "autodownload" commands when in local mode and you give a file
  9664.           transfer command. For example, if you tell kermit to "send
  9665.           oofa.txt", Kermit sends "kermit -r" and a carriage return, in
  9666.           case you had forgotten to start Kermit on the far end and told
  9667.           it to receive a file. If a Kermit program had already been
  9668.           started on the far end, it should harmlessly absorb this
  9669.           string. However, some Kermit programs violate the Kermit
  9670.           protocol definition and treat such strings as Kermit packets
  9671.           even though they are not. In such cases, give this command to
  9672.           set the Kermit protocol autoupload and download strings to
  9673.           nothing, which tells Kermit not to send them. (This is not a
  9674.           new feature, but it was not previously included in the "Coping"
  9675.           section of the documentation.)
  9676.  
  9677.    [ [570]Top ] [ [571]Contents ] [ [572]C-Kermit Home ] [ [573]Kermit
  9678.    Home ]
  9679.   __________________________________________________________________________
  9680.  
  9681. 16. NEW COMMAND-LINE OPTIONS
  9682.  
  9683.    kermit -h Now prints a complete listing of its command-line options,
  9684.    rather than an abbreviated list squeezed into a 24x80 space.
  9685.  
  9686.    -dd              Debug, like -d but adds timestamps
  9687.    --version  Shows C-Kermit version number.
  9688.    --noperms  Equivalent to SET ATTRIBUTE PROTECTION OFF.
  9689.  
  9690.    Kermit now accepts a selection of URLs (Universal Resource Locators)
  9691.    as its first command-line argument. These are:
  9692.  
  9693.    telnet:hostname
  9694.           Makes a Telnet connection to the given host (IP hostname or
  9695.           address).
  9696.  
  9697.    ftp://[user[:password]@]hostname[/path...]
  9698.           Makes an FTP connection to the given host (IP hostname or
  9699.           address). If a username is given, Kermit tries to log you in;
  9700.           if a password is given, it is used; if not, you are prompted
  9701.           for one. If no username is given, an anonymous login is
  9702.           performed. If a pathname is included, Kermit tries to GET the
  9703.           given file. See [574]Section 3.1.3 for details.
  9704.  
  9705.    ftps://[user[:password]@]hostname[/path...]
  9706.           Makes a secure FTP connection over SSL.
  9707.  
  9708.    telnets://[user[:password]@]hostname
  9709.           Makes a secure Telnet connection over SSL.
  9710.  
  9711.    kermit://[user[:password]@]hostname[/path...]
  9712.           Makes a connection to an [575]Internet Kermit Server.
  9713.  
  9714.    http://[user[:password]@]hostname[/path...]
  9715.           Makes a connection to Web server.
  9716.  
  9717.    https://[user[:password]@]hostname[/path...]
  9718.           Makes a connection to secure Web server.
  9719.  
  9720.    [ [576]Top ] [ [577]Contents ] [ [578]C-Kermit Home ] [ [579]Kermit
  9721.    Home ]
  9722.   __________________________________________________________________________
  9723.  
  9724. 17. LOGS
  9725.  
  9726.    In C-Kermit 8.0, we make an effort to keep passwords out of the debug
  9727.    log. This can never be 100% effective, but it's better than before,
  9728.    when there were no precautions at all. Whenever Kermit knows it's
  9729.    prompting for, parsing, or transmitting a password, it temporarily
  9730.    turns off logging and then turns it back on afterwards. This keeps the
  9731.    debug log password-free in most common cases, but there can be no
  9732.    guarantees.
  9733.  
  9734.    As noted elsewhere, the new "-dd" command-line option selects a
  9735.    timestamped debug log (equivalent to "set debug timestamps on", "log
  9736.    debug debug.log").
  9737.  
  9738.    C-Kermit 8.0 also supports a new timestamped session log via "set
  9739.    session-log timestamped-text", "log session".
  9740.  
  9741.    There have been requests for other kinds of logs, for example a
  9742.    command log. These might be added at some point. One person wanted to
  9743.    be able to log commands with timestamps, but only commands issued at
  9744.    the prompt, not commands from files or macros, and also wanted a
  9745.    header line at the beginning showing the date, user, and host. This
  9746.    can be done as follows:
  9747.  
  9748.   .filename := \v(home)commands.log  ; (for example)
  9749.   fopen /write \%c \m(filename)
  9750.   if success {
  9751.       fwrite /line \%c \v(date): User=\v(user) Host=\v(host)
  9752.       fclose \%c
  9753.       set debug timestamps on
  9754.       log debug {| grep "CMD(P)" >> \m(filename)} append
  9755.   }
  9756.  
  9757.    [ [580]Top ] [ [581]Contents ] [ [582]C-Kermit Home ] [ [583]Kermit
  9758.    Home ]
  9759.      _________________________________________________________________
  9760.  
  9761.    C-Kermit 8.0 Update Notes / [584]The Kermit Project / Columbia
  9762.    University / 15 Dec 2003
  9763.  
  9764. References
  9765.  
  9766.    1. http://www.columbia.edu/kermit/ckermit80.html#contents
  9767.    2. http://www.columbia.edu/kermit/ckermit.html
  9768.    3. http://www.columbia.edu/kermit/index.html
  9769.    4. http://www.columbia.edu/kermit/ckermit80.html
  9770.    5. mailto:kermit-support@columbia.edu
  9771.    6. http://www.columbia.edu/kermit/
  9772.    7. http://www.kermit-project.org/
  9773.    8. http://www.columbia.nyc.ny.us/kermit/
  9774.    9. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
  9775.   10. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
  9776.   11. http://www.columbia.edu/kermit/ckermit80.html#xv
  9777.   12. http://www.columbia.edu/kermit/ck60manual.html
  9778.   13. http://www.columbia.edu/kermit/ckermi70.html
  9779.   14. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt
  9780.   15. http://www.columbia.edu/kermit/ckututor.html
  9781.   16. ftp://kermit.columbia.edu/kermit/f/ckuker.nr
  9782.   17. http://www.columbia.edu/kermit/security.htm
  9783.   18. http://www.columbia.edu/kermit/telnet.htm
  9784.   19. http://www.columbia.edu/kermit/ftpscripts.html
  9785.   20. http://www.columbia.edu/kermit/ckcbwr.html
  9786.   21. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
  9787.   22. http://www.columbia.edu/kermit/ckubwr.html
  9788.   23. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  9789.   24. http://www.columbia.edu/kermit/ckvbwr.html
  9790.   25. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
  9791.   26. http://www.columbia.edu/kermit/ckuins.html
  9792.   27. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
  9793.   28. http://www.columbia.edu/kermit/ckvins.html
  9794.   29. ftp://kermit.columbia.edu/kermit/f/ckvins.txt
  9795.   30. http://www.columbia.edu/kermit/ckccfg.html
  9796.   31. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  9797.   32. http://www.columbia.edu/kermit/ckcplm.html
  9798.   33. ftp://kermit.columbia.edu/kermit/f/ckcplm.txt
  9799.   34. http://www.columbia.edu/kermit/iksd.html
  9800.   35. http://www.columbia.edu/kermit/skermit.html
  9801.   36. http://www.columbia.edu/kermit/ckermit80.html#top
  9802.   37. http://www.columbia.edu/kermit/ckermit.html
  9803.   38. http://www.columbia.edu/kermit/index.html
  9804.   39. http://www.columbia.edu/kermit/ckermit80.html#x0
  9805.   40. http://www.columbia.edu/kermit/ckermit80.html#x1
  9806.   41. http://www.columbia.edu/kermit/ckermit80.html#x2
  9807.   42. http://www.columbia.edu/kermit/ckermit80.html#x2.1
  9808.   43. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  9809.   44. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
  9810.   45. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
  9811.   46. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
  9812.   47. http://www.columbia.edu/kermit/ckermit80.html#x2.2.4
  9813.   48. http://www.columbia.edu/kermit/ckermit80.html#x2.2.5
  9814.   49. http://www.columbia.edu/kermit/ckermit80.html#x2.2.6
  9815.   50. http://www.columbia.edu/kermit/ckermit80.html#x3
  9816.   51. http://www.columbia.edu/kermit/ckermit80.html#x3.1
  9817.   52. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
  9818.   53. http://www.columbia.edu/kermit/ckermit80.html#x3.1.2
  9819.   54. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9820.   55. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  9821.   56. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9822.   57. http://www.columbia.edu/kermit/ckermit80.html#x3.3
  9823.   58. http://www.columbia.edu/kermit/ckermit80.html#x3.4
  9824.   59. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  9825.   60. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
  9826.   61. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  9827.   62. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
  9828.   63. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9829.   64. http://www.columbia.edu/kermit/ckermit80.html#x3.6.1
  9830.   65. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  9831.   66. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
  9832.   67. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9833.   68. http://www.columbia.edu/kermit/ckermit80.html#x3.7.1
  9834.   69. http://www.columbia.edu/kermit/ckermit80.html#x3.7.2
  9835.   70. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9836.   71. http://www.columbia.edu/kermit/ckermit80.html#x3.9
  9837.   72. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  9838.   73. http://www.columbia.edu/kermit/ckermit80.html#x3.10.1
  9839.   74. http://www.columbia.edu/kermit/ckermit80.html#x3.10.2
  9840.   75. http://www.columbia.edu/kermit/ckermit80.html#x3.10.3
  9841.   76. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9842.   77. http://www.columbia.edu/kermit/ckermit80.html#x4
  9843.   78. http://www.columbia.edu/kermit/ckermit80.html#x5
  9844.   79. http://www.columbia.edu/kermit/ckermit80.html#x6
  9845.   80. http://www.columbia.edu/kermit/ckermit80.html#x6.1
  9846.   81. http://www.columbia.edu/kermit/ckermit80.html#x6.2
  9847.   82. http://www.columbia.edu/kermit/ckermit80.html#x6.3
  9848.   83. http://www.columbia.edu/kermit/ckermit80.html#x6.4
  9849.   84. http://www.columbia.edu/kermit/ckermit80.html#x6.5
  9850.   85. http://www.columbia.edu/kermit/ckermit80.html#x6.6
  9851.   86. http://www.columbia.edu/kermit/ckermit80.html#x7
  9852.   87. http://www.columbia.edu/kermit/ckermit80.html#x8
  9853.   88. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  9854.   89. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  9855.   90. http://www.columbia.edu/kermit/ckermit80.html#x8.3
  9856.   91. http://www.columbia.edu/kermit/ckermit80.html#x8.4
  9857.   92. http://www.columbia.edu/kermit/ckermit80.html#x8.5
  9858.   93. http://www.columbia.edu/kermit/ckermit80.html#x8.6
  9859.   94. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  9860.   95. http://www.columbia.edu/kermit/ckermit80.html#x8.8
  9861.   96. http://www.columbia.edu/kermit/ckermit80.html#x8.9
  9862.   97. http://www.columbia.edu/kermit/ckermit80.html#x8.10
  9863.   98. http://www.columbia.edu/kermit/ckermit80.html#x8.11
  9864.   99. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  9865.  100. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  9866.  101. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  9867.  102. http://www.columbia.edu/kermit/ckermit80.html#x9
  9868.  103. http://www.columbia.edu/kermit/ckermit80.html#x9.1
  9869.  104. http://www.columbia.edu/kermit/ckermit80.html#x9.2
  9870.  105. http://www.columbia.edu/kermit/ckermit80.html#x9.3
  9871.  106. http://www.columbia.edu/kermit/ckermit80.html#x9.4
  9872.  107. http://www.columbia.edu/kermit/ckermit80.html#x9.5
  9873.  108. http://www.columbia.edu/kermit/ckermit80.html#x9.6
  9874.  109. http://www.columbia.edu/kermit/ckermit80.html#x9.7
  9875.  110. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9876.  111. http://www.columbia.edu/kermit/ckermit80.html#x9.9
  9877.  112. http://www.columbia.edu/kermit/ckermit80.html#x9.10
  9878.  113. http://www.columbia.edu/kermit/ckermit80.html#x9.11
  9879.  114. http://www.columbia.edu/kermit/ckermit80.html#x10
  9880.  115. http://www.columbia.edu/kermit/ckermit80.html#x11
  9881.  116. http://www.columbia.edu/kermit/ckermit80.html#x12
  9882.  117. http://www.columbia.edu/kermit/ckermit80.html#x13
  9883.  118. http://www.columbia.edu/kermit/ckermit80.html#x14
  9884.  119. http://www.columbia.edu/kermit/ckermit80.html#x15
  9885.  120. http://www.columbia.edu/kermit/ckermit80.html#x16
  9886.  121. http://www.columbia.edu/kermit/ckermit80.html#x17
  9887.  122. http://www.columbia.edu/kermit/ckermit80.html#top
  9888.  123. http://www.columbia.edu/kermit/ckermit.html
  9889.  124. http://www.columbia.edu/kermit/index.html
  9890.  125. http://www.columbia.edu/kermit/ckuins.html#x5
  9891.  126. http://www.columbia.edu/kermit/ckuins.html
  9892.  127. http://www.columbia.edu/kermit/ckermit80.html#x5
  9893.  128. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  9894.  129. http://www.columbia.edu/kermit/ckermit80.html#contents
  9895.  130. http://www.columbia.edu/kermit/ckermit80.html#x15
  9896.  131. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9897.  132. http://www.columbia.edu/kermit/ckermit80.html#ftpdates
  9898.  133. http://www.columbia.edu/kermit/ckermit80.html#ftpcheck
  9899.  134. http://www.columbia.edu/kermit/ckermit80.html#ftpnamelist
  9900.  135. http://www.columbia.edu/kermit/ckermit80.html#srvrename
  9901.  136. http://www.columbia.edu/kermit/ckermit80.html#ftpvdir
  9902.  137. http://www.columbia.edu/kermit/ckermit80.html#setftptype
  9903.  138. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9904.  139. http://www.columbia.edu/kermit/ckermit80.html#x15
  9905.  140. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  9906.  141. http://www.columbia.edu/kermit/ckermit80.html#x2.1
  9907.  142. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  9908.  143. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  9909.  144. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  9910.  145. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  9911.  146. http://www.columbia.edu/kermit/ckututor.html
  9912.  147. http://www.columbia.edu/kermit/ckuins.html
  9913.  148. http://www.columbia.edu/kermit/skermit.html
  9914.  149. http://www.columbia.edu/kermit/ckermit80.html#setlocus
  9915.  150. http://www.columbia.edu/kermit/ckermit80.html#lcommands
  9916.  151. http://www.columbia.edu/kermit/ckermit80.html#ftpuser
  9917.  152. http://www.columbia.edu/kermit/ckermit80.html#showvar
  9918.  153. http://www.columbia.edu/kermit/ckermit80.html#callerid
  9919.  154. http://www.columbia.edu/kermit/ckermit80.html#x6.6
  9920.  155. http://www.columbia.edu/kermit/ckermit80.html#x0
  9921.  156. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9922.  157. http://www.columbia.edu/kermit/ckermit80.html#top
  9923.  158. http://www.columbia.edu/kermit/ckermit80.html#contents
  9924.  159. http://www.columbia.edu/kermit/ckermit.html
  9925.  160. http://www.columbia.edu/kermit/index.html
  9926.  161. http://www.columbia.edu/kermit/ckermit80.html#x0
  9927.  162. http://www.columbia.edu/kermit/ckermit80.html#top
  9928.  163. http://www.columbia.edu/kermit/ckermit80.html#contents
  9929.  164. http://www.columbia.edu/kermit/ckermit.html
  9930.  165. http://www.columbia.edu/kermit/index.html
  9931.  166. http://www.columbia.edu/kermit/k95.html
  9932.  167. http://www.columbia.edu/kermit/sshclient.html
  9933.  168. http://www.columbia.edu/kermit/skermit.html
  9934.  169. http://www.columbia.edu/kermit/skermit.html
  9935.  170. http://www.columbia.edu/kermit/sshclien.htm
  9936.  171. http://www.columbia.edu/kermit/ckermit80.html#x3
  9937.  172. ftp://ftp.isi.edu/in-notes/rfc1738.txt
  9938.  173. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
  9939.  174. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
  9940.  175. ftp://ftp.isi.edu/in-notes/rfc2396.txt
  9941.  176. ftp://ftp.isi.edu/in-notes/rfc2616.txt
  9942.  177. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
  9943.  178. ftp://ftp.isi.edu/in-notes/rfc2616.txt
  9944.  179. http://www.columbia.edu/kermit/ckermit80.html#x8.13.7
  9945.  180. http://www.columbia.edu/kermit/security.htm#x5.4
  9946.  181. http://www.columbia.edu/kermit/security.htm#x15
  9947.  182. http://www.columbia.edu/kermit/security.htm#x6.2
  9948.  183. http://www.columbia.edu/kermit/security.html
  9949.  184. http://www.columbia.edu/kermit/ckermit80.html#x16
  9950.  185. http://www.columbia.edu/kermit/ckermit80.html#top
  9951.  186. http://www.columbia.edu/kermit/ckermit80.html#contents
  9952.  187. http://www.columbia.edu/kermit/ckermit.html
  9953.  188. http://www.columbia.edu/kermit/index.html
  9954.  189. http://www.columbia.edu/kermit/ckermit80.html#x3.1
  9955.  190. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9956.  191. http://www.columbia.edu/kermit/ckermit80.html#x3.3
  9957.  192. http://www.columbia.edu/kermit/ckermit80.html#x3.4
  9958.  193. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  9959.  194. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9960.  195. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9961.  196. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9962.  197. http://www.columbia.edu/kermit/ckermit80.html#x3.9
  9963.  198. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  9964.  199. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9965.  200. http://www.columbia.edu/kermit/security.htm
  9966.  201. http://www.columbia.edu/kermit/security.htm#servers
  9967.  202. http://www.columbia.edu/kermit/ckcsets.html
  9968.  203. http://www.columbia.edu/kermit/unicode.html
  9969.  204. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
  9970.  205. http://www.columbia.edu/kermit/case10.html
  9971.  206. http://www.columbia.edu/kermit/ckermit80.html#x4
  9972.  207. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9973.  208. http://www.columbia.edu/kermit/ftpscripts.html
  9974.  209. http://www.columbia.edu/kermit/ckermit80.html#top
  9975.  210. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9976.  211. http://www.columbia.edu/kermit/ftpclient.html
  9977.  212. http://www.columbia.edu/kermit/ftpscripts.html
  9978.  213. http://www.columbia.edu/kermit/ckermit.html
  9979.  214. http://www.columbia.edu/kermit/index.html
  9980.  215. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
  9981.  216. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9982.  217. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  9983.  218. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9984.  219. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9985.  220. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9986.  221. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  9987.  222. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9988.  223. http://www.columbia.edu/kermit/ftpscripts.html
  9989.  224. http://www.columbia.edu/kermit/ckb2.htm
  9990.  225. http://www.columbia.edu/kermit/ckermit80.html#ftpautolog
  9991.  226. http://www.columbia.edu/kermit/ckermit80.html#ftpuser
  9992.  227. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9993.  228. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9994.  229. http://www.columbia.edu/kermit/ckermit80.html#top
  9995.  230. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9996.  231. http://www.columbia.edu/kermit/ckermit.html
  9997.  232. http://www.columbia.edu/kermit/index.html
  9998.  233. http://www.columbia.edu/kermit/ibm_ie.html
  9999.  234. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  10000.  235. http://www.columbia.edu/kermit/ckermit80.html#top
  10001.  236. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10002.  237. http://www.columbia.edu/kermit/ckermit.html
  10003.  238. http://www.columbia.edu/kermit/index.html
  10004.  239. http://www.columbia.edu/kermit/ck60manual.html
  10005.  240. http://www.columbia.edu/kermit/ckermit70.html#x4.17
  10006.  241. http://www.columbia.edu/kermit/ckermit70.html
  10007.  242. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  10008.  243. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  10009.  244. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  10010.  245. http://www.columbia.edu/kermit/security.html
  10011.  246. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10012.  247. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10013.  248. http://www.columbia.edu/kermit/ckermit80.html#x8.13.4
  10014.  249. http://www.columbia.edu/kermit/ckermit80.html#permswitch
  10015.  250. http://www.columbia.edu/kermit/ckermit80.html#ftpchmod
  10016.  251. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  10017.  252. http://www.columbia.edu/kermit/ckermit80.html#x4
  10018.  253. http://www.columbia.edu/kermit/ckermit80.html#top
  10019.  254. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10020.  255. http://www.columbia.edu/kermit/ckermit.html
  10021.  256. http://www.columbia.edu/kermit/index.html
  10022.  257. http://www.columbia.edu/kermit/ckermit80.html#x7
  10023.  258. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  10024.  259. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  10025.  260. http://www.columbia.edu/kermit/ckb2.htm
  10026.  261. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  10027.  262. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  10028.  263. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  10029.  264. http://www.columbia.edu/kermit/ckermit80.html#setftptype
  10030.  265. http://www.columbia.edu/kermit/ckermit80.html#top
  10031.  266. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10032.  267. http://www.columbia.edu/kermit/ckermit.html
  10033.  268. http://www.columbia.edu/kermit/index.html
  10034.  269. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  10035.  270. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
  10036.  271. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  10037.  272. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  10038.  273. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  10039.  274. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  10040.  275. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  10041.  276. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
  10042.  277. http://www.columbia.edu/kermit/ckermi70.htm
  10043.  278. http://www.columbia.edu/kermit/ckermit80.html#x4
  10044.  279. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10045.  280. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  10046.  281. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10047.  282. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  10048.  283. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  10049.  284. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  10050.  285. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  10051.  286. http://www.columbia.edu/kermit/ckermit80.html#ftpperms
  10052.  287. http://www.columbia.edu/kermit/ckermit80.html#ftpunique
  10053.  288. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  10054.  289. http://www.columbia.edu/kermit/ckermit80.html#note_utc
  10055.  290. http://www.columbia.edu/kermit/ckermit80.html#note_date
  10056.  291. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  10057.  292. http://www.boulder.nist.gov/timefreq/faq/faq.htm#10:
  10058.  293. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10059.  294. http://www.columbia.edu/kermit/ckermit80.html#top
  10060.  295. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10061.  296. http://www.columbia.edu/kermit/ckermit.html
  10062.  297. http://www.columbia.edu/kermit/index.html
  10063.  298. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  10064.  299. http://www.columbia.edu/kermit/ckermi70.htm#x4.3
  10065.  300. http://www.columbia.edu/kermit/ckermit70.html
  10066.  301. http://www.columbia.edu/kermit/ckermit80.html#x5
  10067.  302. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
  10068.  303. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  10069.  304. http://www.columbia.edu/kermit/ckermi70.htm#x4.1
  10070.  305. http://www.columbia.edu/kermit/ckermi70.htm#x4.2.2
  10071.  306. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
  10072.  307. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  10073.  308. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  10074.  309. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  10075.  310. http://www.columbia.edu/kermit/ckermit80.html#srvrename
  10076.  311. http://www.columbia.edu/kermit/ckermi70.htm#x4.1
  10077.  312. http://www.columbia.edu/kermit/ckermi70.htm
  10078.  313. http://www.columbia.edu/kermit/ckb2.htm
  10079.  314. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  10080.  315. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
  10081.  316. http://www.proftpd.net/
  10082.  317. http://www.columbia.edu/kermit/ckermit80.html#top
  10083.  318. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10084.  319. http://www.columbia.edu/kermit/ckermit.html
  10085.  320. http://www.columbia.edu/kermit/index.html
  10086.  321. http://www.columbia.edu/kermit/ckb2.htm
  10087.  322. http://www.columbia.edu/kermit/ckcsets.html
  10088.  323. http://www.columbia.edu/kermit/unicode.html
  10089.  324. http://www.columbia.edu/kermit/ckcsets.html
  10090.  325. http://www.columbia.edu/kermit/ckcsets.html
  10091.  326. http://www.columbia.edu/kermit/ckermit80.html#x4
  10092.  327. http://www.columbia.edu/kermit/utf8.html
  10093.  328. http://www.columbia.edu/kermit/ckcsets.html
  10094.  329. http://www.columbia.edu/kermit/ckermit80.html#x4
  10095.  330. ftp://ftp.isi.edu/in-notes/rfc2640.txt
  10096.  331. http://www.columbia.edu/kermit/ckermit80.html#top
  10097.  332. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10098.  333. http://www.columbia.edu/kermit/ckermit.html
  10099.  334. http://www.columbia.edu/kermit/index.html
  10100.  335. http://www.columbia.edu/kermit/ckermit80.html#top
  10101.  336. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10102.  337. http://www.columbia.edu/kermit/ckermit.html
  10103.  338. http://www.columbia.edu/kermit/index.html
  10104.  339. http://www.columbia.edu/kermit/ckermit80.html#top
  10105.  340. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10106.  341. http://www.columbia.edu/kermit/ckermit.html
  10107.  342. http://www.columbia.edu/kermit/index.html
  10108.  343. http://www.columbia.edu/kermit/ftpscripts.html
  10109.  344. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10110.  345. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10111.  346. ftp://ftp.isi.edu/in-notes/rfc959.txt
  10112.  347. http://www.columbia.edu/kermit/ckscripts.html
  10113.  348. http://www.columbia.edu/kermit/ckermit80.html#top
  10114.  349. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10115.  350. http://www.columbia.edu/kermit/ftpscript.html
  10116.  351. http://www.columbia.edu/kermit/ckermit.html
  10117.  352. http://www.columbia.edu/kermit/index.html
  10118.  353. http://www.columbia.edu/kermit/ckermit80.html#x3.11.1
  10119.  354. http://www.columbia.edu/kermit/ckermit80.html#x3.11.2
  10120.  355. http://www.columbia.edu/kermit/ckermit80.html#x3.11.3
  10121.  356. http://www.columbia.edu/kermit/ckermit80.html#x3.11.4
  10122.  357. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5
  10123.  358. http://www.columbia.edu/kermit/ckermit.html
  10124.  359. http://www.columbia.edu/kermit/k95.html
  10125.  360. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5
  10126.  361. ftp://ftp.isi.edu/in-notes/rfc959.txt
  10127.  362. ftp://ftp.isi.edu/in-notes/rfc2389.txt
  10128.  363. http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16.txt
  10129.  364. http://www.columbia.edu/kermit/ftpclient.html
  10130.  365. http://www.columbia.edu/kermit/ckermit80.html#top
  10131.  366. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10132.  367. http://www.columbia.edu/kermit/ckermit.html
  10133.  368. http://www.columbia.edu/kermit/index.html
  10134.  369. http://www.columbia.edu/kermit/ckermit80.html#x3
  10135.  370. http://www.columbia.edu/kermit/ckermit80.html#ucs2
  10136.  371. http://www.columbia.edu/kermit/ckermit80.html#top
  10137.  372. http://www.columbia.edu/kermit/ckermit80.html#contents
  10138.  373. http://www.columbia.edu/kermit/ckermit.html
  10139.  374. http://www.columbia.edu/kermit/index.html
  10140.  375. http://www.columbia.edu/kermit/ckermit80.html#top
  10141.  376. http://www.columbia.edu/kermit/ckermit80.html#contents
  10142.  377. http://www.columbia.edu/kermit/ckermit.html
  10143.  378. http://www.columbia.edu/kermit/index.html
  10144.  379. http://www.columbia.edu/kermit/ckb2.htm
  10145.  380. http://www.columbia.edu/kermit/ckermit80.html#top
  10146.  381. http://www.columbia.edu/kermit/ckermit80.html#contents
  10147.  382. http://www.columbia.edu/kermit/ckermit.html
  10148.  383. http://www.columbia.edu/kermit/index.html
  10149.  384. http://www.columbia.edu/kermit/ckermit80.html#x4
  10150.  385. http://www.columbia.edu/kermit/ckermit80.html#x4
  10151.  386. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  10152.  387. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  10153.  388. http://www.columbia.edu/kermit/ckermit80.html#x12
  10154.  389. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  10155.  390. http://www.columbia.edu/kermit/ckermit80.html#top
  10156.  391. http://www.columbia.edu/kermit/ckermit80.html#contents
  10157.  392. http://www.columbia.edu/kermit/ckermit.html
  10158.  393. http://www.columbia.edu/kermit/index.html
  10159.  394. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  10160.  395. http://www.columbia.edu/kermit/ckermit80.html#top
  10161.  396. http://www.columbia.edu/kermit/ckermit80.html#contents
  10162.  397. http://www.columbia.edu/kermit/ckermit.html
  10163.  398. http://www.columbia.edu/kermit/index.html
  10164.  399. http://www.columbia.edu/kermit/ckermit80.html#x9
  10165.  400. http://www.columbia.edu/kermit/ckermit80.html#top
  10166.  401. http://www.columbia.edu/kermit/ckermit80.html#contents
  10167.  402. http://www.columbia.edu/kermit/ckermit.html
  10168.  403. http://www.columbia.edu/kermit/index.html
  10169.  404. http://www.columbia.edu/kermit/ckermit80.html#x8.6
  10170.  405. http://www.columbia.edu/kermit/ckermit80.html#top
  10171.  406. http://www.columbia.edu/kermit/ckermit80.html#contents
  10172.  407. http://www.columbia.edu/kermit/ckermit.html
  10173.  408. http://www.columbia.edu/kermit/index.html
  10174.  409. http://www.columbia.edu/kermit/ckermit80.html#top
  10175.  410. http://www.columbia.edu/kermit/ckermit80.html#contents
  10176.  411. http://www.columbia.edu/kermit/ckermit.html
  10177.  412. http://www.columbia.edu/kermit/index.html
  10178.  413. http://www.columbia.edu/kermit/ckermit80.html#top
  10179.  414. http://www.columbia.edu/kermit/ckermit80.html#contents
  10180.  415. http://www.columbia.edu/kermit/ckermit.html
  10181.  416. http://www.columbia.edu/kermit/index.html
  10182.  417. http://www.columbia.edu/kermit/ckermit80.html#fjoin
  10183.  418. http://www.columbia.edu/kermit/ckermit80.html#fsplit
  10184.  419. http://www.columbia.edu/kermit/ckermit80.html#x8.10
  10185.  420. http://www.columbia.edu/kermit/ckermit80.html#top
  10186.  421. http://www.columbia.edu/kermit/ckermit80.html#contents
  10187.  422. http://www.columbia.edu/kermit/ckermit.html
  10188.  423. http://www.columbia.edu/kermit/index.html
  10189.  424. http://www.columbia.edu/kermit/ckermit80.html#x9
  10190.  425. http://www.columbia.edu/kermit/ckermit80.html#x9
  10191.  426. http://www.columbia.edu/kermit/ckermit80.html#x9
  10192.  427. http://www.columbia.edu/kermit/ckermit80.html#x3
  10193.  428. http://www.columbia.edu/kermit/ckermit80.html#x3
  10194.  429. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10195.  430. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10196.  431. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  10197.  432. http://www.columbia.edu/kermit/ckermit80.html#x3
  10198.  433. http://www.columbia.edu/kermit/ckermit80.html#x3
  10199.  434. http://www.columbia.edu/kermit/ckermit80.html#x3
  10200.  435. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10201.  436. http://www.columbia.edu/kermit/ckermit80.html#x3
  10202.  437. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  10203.  438. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  10204.  439. http://www.columbia.edu/kermit/ckermit80.html#x9
  10205.  440. http://www.columbia.edu/kermit/ckermit80.html#x8.10
  10206.  441. http://www.columbia.edu/kermit/ckermit80.html#x8.7.4
  10207.  442. http://www.columbia.edu/kermit/ckermit80.html#top
  10208.  443. http://www.columbia.edu/kermit/ckermit80.html#contents
  10209.  444. http://www.columbia.edu/kermit/ckermit.html
  10210.  445. http://www.columbia.edu/kermit/index.html
  10211.  446. http://www.columbia.edu/kermit/ckermit80.html#top
  10212.  447. http://www.columbia.edu/kermit/ckermit80.html#contents
  10213.  448. http://www.columbia.edu/kermit/ckermit.html
  10214.  449. http://www.columbia.edu/kermit/index.html
  10215.  450. http://www.columbia.edu/kermit/ckermit80.html#top
  10216.  451. http://www.columbia.edu/kermit/ckermit80.html#contents
  10217.  452. http://www.columbia.edu/kermit/ckermit.html
  10218.  453. http://www.columbia.edu/kermit/index.html
  10219.  454. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  10220.  455. http://www.columbia.edu/kermit/ckermit80.html#top
  10221.  456. http://www.columbia.edu/kermit/ckermit80.html#contents
  10222.  457. http://www.columbia.edu/kermit/ckermit.html
  10223.  458. http://www.columbia.edu/kermit/index.html
  10224.  459. http://www.columbia.edu/kermit/ckermit80.html#scriptedit
  10225.  460. http://www.columbia.edu/kermit/ckermit80.html#top
  10226.  461. http://www.columbia.edu/kermit/ckermit80.html#contents
  10227.  462. http://www.columbia.edu/kermit/ckermit.html
  10228.  463. http://www.columbia.edu/kermit/index.html
  10229.  464. http://www.columbia.edu/kermit/ckermit80.html#top
  10230.  465. http://www.columbia.edu/kermit/ckermit80.html#contents
  10231.  466. http://www.columbia.edu/kermit/ckermit.html
  10232.  467. http://www.columbia.edu/kermit/index.html
  10233.  468. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10234.  469. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10235.  470. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10236.  471. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10237.  472. http://www.columbia.edu/kermit/ckermit80.html#top
  10238.  473. http://www.columbia.edu/kermit/ckermit80.html#contents
  10239.  474. http://www.columbia.edu/kermit/ckermit.html
  10240.  475. http://www.columbia.edu/kermit/index.html
  10241.  476. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  10242.  477. http://www.columbia.edu/kermit/ckermit80.html#top
  10243.  478. http://www.columbia.edu/kermit/ckermit80.html#contents
  10244.  479. http://www.columbia.edu/kermit/ckermit.html
  10245.  480. http://www.columbia.edu/kermit/index.html
  10246.  481. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  10247.  482. http://www.columbia.edu/kermit/ckermit80.html#top
  10248.  483. http://www.columbia.edu/kermit/ckermit80.html#contents
  10249.  484. http://www.columbia.edu/kermit/ckermit.html
  10250.  485. http://www.columbia.edu/kermit/index.html
  10251.  486. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10252.  487. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10253.  488. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  10254.  489. http://www.columbia.edu/kermit/ckermit80.html#top
  10255.  490. http://www.columbia.edu/kermit/ckermit80.html#contents
  10256.  491. http://www.columbia.edu/kermit/ckermit.html
  10257.  492. http://www.columbia.edu/kermit/index.html
  10258.  493. http://www.columbia.edu/kermit/ckermit80.html#top
  10259.  494. http://www.columbia.edu/kermit/ckermit80.html#contents
  10260.  495. http://www.columbia.edu/kermit/ckermit.html
  10261.  496. http://www.columbia.edu/kermit/index.html
  10262.  497. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10263.  498. http://www.columbia.edu/kermit/ckermit80.html#top
  10264.  499. http://www.columbia.edu/kermit/ckermit80.html#contents
  10265.  500. http://www.columbia.edu/kermit/ckermit.html
  10266.  501. http://www.columbia.edu/kermit/index.html
  10267.  502. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10268.  503. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10269.  504. http://www.columbia.edu/kermit/ckermit80.html#x9.6
  10270.  505. http://www.columbia.edu/kermit/ckermit80.html#top
  10271.  506. http://www.columbia.edu/kermit/ckermit80.html#contents
  10272.  507. http://www.columbia.edu/kermit/ckermit.html
  10273.  508. http://www.columbia.edu/kermit/index.html
  10274.  509. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10275.  510. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10276.  511. http://www.columbia.edu/kermit/ckermit80.html#top
  10277.  512. http://www.columbia.edu/kermit/ckermit80.html#contents
  10278.  513. http://www.columbia.edu/kermit/ckermit.html
  10279.  514. http://www.columbia.edu/kermit/index.html
  10280.  515. http://www.columbia.edu/kermit/ckermit80.html#top
  10281.  516. http://www.columbia.edu/kermit/ckermit80.html#contents
  10282.  517. http://www.columbia.edu/kermit/ckermit.html
  10283.  518. http://www.columbia.edu/kermit/index.html
  10284.  519. http://www.columbia.edu/kermit/ckermit80.html#top
  10285.  520. http://www.columbia.edu/kermit/ckermit80.html#contents
  10286.  521. http://www.columbia.edu/kermit/ckermit.html
  10287.  522. http://www.columbia.edu/kermit/index.html
  10288.  523. mailto:thucdat@hotmail.com
  10289.  524. http://www.columbia.edu/kermit/ckermit80.html#x9.9.2
  10290.  525. http://www.columbia.edu/kermit/ckermit80.html#top
  10291.  526. http://www.columbia.edu/kermit/ckermit80.html#contents
  10292.  527. http://www.columbia.edu/kermit/ckermit.html
  10293.  528. http://www.columbia.edu/kermit/index.html
  10294.  529. http://www.columbia.edu/kermit/ckermit80.html#top
  10295.  530. http://www.columbia.edu/kermit/ckermit80.html#contents
  10296.  531. http://www.columbia.edu/kermit/ckermit.html
  10297.  532. http://www.columbia.edu/kermit/index.html
  10298.  533. http://www.columbia.edu/kermit/ckermit80.html#top
  10299.  534. http://www.columbia.edu/kermit/ckermit80.html#contents
  10300.  535. http://www.columbia.edu/kermit/ckermit.html
  10301.  536. http://www.columbia.edu/kermit/index.html
  10302.  537. http://www.columbia.edu/kermit/ckermit80.html#x9.2
  10303.  538. http://www.columbia.edu/kermit/ckermit80.html#top
  10304.  539. http://www.columbia.edu/kermit/ckermit80.html#contents
  10305.  540. http://www.columbia.edu/kermit/ckermit.html
  10306.  541. http://www.columbia.edu/kermit/index.html
  10307.  542. http://www.columbia.edu/kermit/ckermit80.html#x4
  10308.  543. http://www.columbia.edu/kermit/ckermit80.html#x4
  10309.  544. http://www.columbia.edu/kermit/ckermit80.html#top
  10310.  545. http://www.columbia.edu/kermit/ckermit80.html#contents
  10311.  546. http://www.columbia.edu/kermit/ckermit.html
  10312.  547. http://www.columbia.edu/kermit/index.html
  10313.  548. http://www.columbia.edu/kermit/ckermit80.html#top
  10314.  549. http://www.columbia.edu/kermit/ckermit80.html#contents
  10315.  550. http://www.columbia.edu/kermit/ckermit.html
  10316.  551. http://www.columbia.edu/kermit/index.html
  10317.  552. http://www.columbia.edu/kermit/ckermit80.html#top
  10318.  553. http://www.columbia.edu/kermit/ckermit80.html#contents
  10319.  554. http://www.columbia.edu/kermit/ckermit.html
  10320.  555. http://www.columbia.edu/kermit/index.html
  10321.  556. http://www.columbia.edu/kermit/ckermit80.html#x4
  10322.  557. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10323.  558. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10324.  559. http://www.columbia.edu/kermit/ckermit80.html#top
  10325.  560. http://www.columbia.edu/kermit/ckermit80.html#contents
  10326.  561. http://www.columbia.edu/kermit/ckermit.html
  10327.  562. http://www.columbia.edu/kermit/index.html
  10328.  563. ftp://ftp.isi.edu/in-notes/rfc2217.txt
  10329.  564. http://www.columbia.edu/kermit/ckermit80.html#top
  10330.  565. http://www.columbia.edu/kermit/ckermit80.html#contents
  10331.  566. ftp://kermit.columbia.edu/kermit/sredird/
  10332.  567. http://www.columbia.edu/kermit/ckermit.html
  10333.  568. http://www.columbia.edu/kermit/index.html
  10334.  569. http://www.columbia.edu/kermit/ckermi70.htm#x4.22
  10335.  570. http://www.columbia.edu/kermit/ckermit80.html#top
  10336.  571. http://www.columbia.edu/kermit/ckermit80.html#contents
  10337.  572. http://www.columbia.edu/kermit/ckermit.html
  10338.  573. http://www.columbia.edu/kermit/index.html
  10339.  574. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  10340.  575. http://www.columbia.edu/kermit/cuiksd.html
  10341.  576. http://www.columbia.edu/kermit/ckermit80.html#top
  10342.  577. http://www.columbia.edu/kermit/ckermit80.html#contents
  10343.  578. http://www.columbia.edu/kermit/ckermit.html
  10344.  579. http://www.columbia.edu/kermit/index.html
  10345.  580. http://www.columbia.edu/kermit/ckermit80.html#top
  10346.  581. http://www.columbia.edu/kermit/ckermit80.html#contents
  10347.  582. http://www.columbia.edu/kermit/ckermit.html
  10348.  583. http://www.columbia.edu/kermit/index.html
  10349.  584. http://www.columbia.edu/kermit/index.html
  10350.