home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / cku208.zip / ckermit80.txt < prev    next >
Text File  |  2003-03-30  |  482KB  |  10,280 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.209
  11.    Date of C-Kermit release: 17 March 2003
  12.    This file last updated: Sun Mar 23 19:28:09 2003
  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.  
  18.   [4]http://www.columbia.edu/kermit/ckermit80.html
  19.      * If you are reading the HTML version of this file with a GUI Web
  20.        browser, the features added since C-Kermit 8.0.201 are shown in
  21.        red if your browser and monitor permit. Features that were new to
  22.        versions 8.0.200 and 201 are in black.
  23.        
  24. Authors: Frank da Cruz and Christine M. Gianone
  25. Address: The Kermit Project
  26.          Columbia University
  27.          612 West 115th Street
  28.          New York NY 10025-7799
  29.          USA
  30. Fax:     +1 (212) 662-6442
  31. E-Mail:  [5]kermit-support@columbia.edu
  32. Web:     [6]http://www.columbia.edu/kermit/
  33. Or:      [7]http://www.kermit-project.org/
  34. Or:      [8]http://www.columbia.nyc.ny.us/kermit/
  35.      _________________________________________________________________
  36.    
  37.   NOTICES
  38.   
  39.    This document:
  40.           Copyright ⌐ 1997, 2002, Frank da Cruz and Christine M. Gianone.
  41.           All rights reserved.
  42.           
  43.    Kermit 95:
  44.           Copyright ⌐ 1995, 2002, Trustees of Columbia University in the
  45.           City of New York. All rights reserved.
  46.           
  47.    C-Kermit:
  48.           Copyright ⌐ 1985, 2002,
  49.           Trustees of Columbia University in the City of New York. All
  50.           rights reserved. See the C-Kermit [9]COPYING.TXT file or the
  51.           copyright text in the [10]ckcmai.c module for disclaimer and
  52.           permissions.
  53.           
  54.    When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or
  55.           SSL/TLS protocol are included:
  56.           Portions Copyright ⌐ 1990, Massachusetts Institute of
  57.           Technology.
  58.           Portions Copyright ⌐ 1991, 1993 Regents of the University of
  59.           California.
  60.           Portions Copyright ⌐ 1991, 1992, 1993, 1994, 1995 by AT&T.
  61.           Portions Copyright ⌐ 1997, Stanford University.
  62.           Portions Copyright ⌐ 1995-1997, Eric Young
  63.           <eay@cryptosoft.com>.
  64.           
  65.    For the full text of the third-party copyright notices, see
  66.    [11]Appendix V.
  67.      _________________________________________________________________
  68.    
  69.   WHAT IS IN THIS FILE
  70.   
  71.    This file lists changes made to C-Kermit since version 7.0 was
  72.    released in January 2000. Use this file as a supplement to:
  73.    
  74.      * The second edition of [12]Using C-Kermit; and:
  75.      * The [13]C-Kermit 7.0 Update Notes. Also available in plain-text
  76.        form as [14]ckermit70.txt.
  77.        
  78.    until the third edition of Using C-Kermit is published. We apologize
  79.    for the scattered documentation and will consolidate it when we are
  80.    able.
  81.      _________________________________________________________________
  82.    
  83.    ADDITIONAL FILES Several other files accompany this new Kermit
  84.    release:
  85.    
  86.    [15]ckututor.html
  87.           C-Kermit Tutorial (for Unix). Also distributed in Nroff form as
  88.           [16]ckuker.nr, the Unix C-Kermit manual page.
  89.           
  90.    [17]security.htm
  91.           Discussion of Kermit's new authentication and encryption
  92.           features, updated for C-Kermit 8.0.
  93.           
  94.    [18]telnet.htm
  95.           Detailed documentation of Kermit's Telnet client, updated for
  96.           C-Kermit 8.0.
  97.           
  98.    [19]ftpscripts.html
  99.           Tutorial: Writing FTP automation scripts
  100.           
  101.    [20]ckcbwr.html
  102.           Platform-independent C-Kermit hints and tips. Also distributed
  103.           in plain text form as [21]ckcbwr.txt
  104.           
  105.    [22]ckubwr.html
  106.           Unix-specific C-Kermit hints and tips. Also distributed in
  107.           plain text form as [23]ckubwr.txt.
  108.           
  109.    [24]ckvbwr.html
  110.           VMS-specific C-Kermit hints and tips. Also distributed in plain
  111.           text form as [25]ckvbwr.txt.
  112.           
  113.    [26]ckuins.html
  114.           Unix C-Kermit installation instructions. Also distributed in
  115.           plain text form as [27]ckuins.txt.
  116.           
  117.    [28]ckvins.html
  118.           VMS C-Kermit installation instructions. Also distributed in
  119.           plain text form as [29]ckvins.txt.
  120.           
  121.    [30]ckccfg.html
  122.           Compile-time configuration options. Also distributed in plain
  123.           text form as [31]ckccfg.txt.
  124.           
  125.    [32]ckcplm.html
  126.           C-Kermit Program Logic Manual. Also distributed in plain text
  127.           form as [33]ckcplm.txt.
  128.           
  129.    [34]iksd.html
  130.           Internet Kermit Service Aministrators Guide for Unix.
  131.           
  132.    [35]skermit.html
  133.           C-Kermit as an SSH Subsystem (SFTP server replacement).
  134.           
  135.    [ [36]Top ] [ [37]C-Kermit ] [ [38]Kermit Home ]
  136.   __________________________________________________________________________
  137.  
  138. CONTENTS
  139.  
  140.      [39]0. WHAT'S NEW
  141.      [40]1. FIXES SINCE VERSION 7.0.196
  142.      [41]2. SSH AND HTTP 
  143.          [42]2.1. SSH Connections
  144.          [43]2.2. HTTP Connections
  145.             [44]2.2.1. HTTP Command Switches
  146.             [45]2.2.2. HTTP Action Commands
  147.             [46]2.2.3. HTTP Headers
  148.             [47]2.2.4. Secure HTTP Connections
  149.             [48]2.2.5. HTTP Variables
  150.             [49]2.2.6. The HTTP Command-Line Personality
  151.      [50]3. THE BUILT-IN FTP CLIENT
  152.          [51]3.1. Making and Managing FTP Connections
  153.             [52]3.1.1. Kermit Command-Line Options for FTP
  154.             [53]3.1.2. The FTP Command-Line Personality
  155.             [54]3.1.3. The FTP URL Interpreter
  156.             [55]3.1.4. Interactive FTP Session Establishment
  157.          [56]3.2. Making Secure FTP Connections
  158.          [57]3.3. Setting FTP Preferences
  159.          [58]3.4. Managing Directories and Files
  160.          [59]3.5. Uploading Files With FTP
  161.             [60]3.5.1. FTP PUT Switches
  162.             [61]3.5.2. Update Mode
  163.             [62]3.5.3. Recovery
  164.          [63]3.6. Downloading Files With FTP
  165.             [64]3.6.1. FTP GET Switches
  166.             [65]3.6.2. Filename Collisions
  167.             [66]3.6.3. Recovery
  168.          [67]3.7. Translating Character Sets
  169.             [68]3.7.1. Character Sets and Uploading
  170.             [69]3.7.2. Character Sets and Downloading
  171.          [70]3.8. FTP Command Shortcuts
  172.          [71]3.9. Dual Sessions
  173.          [72]3.10. Automating FTP Sessions
  174.             [73]3.10.1. FTP-Specific Variables and Functions
  175.             [74]3.10.2. Examples
  176.          [75]3.11. Advanced FTP Protocol Features  [76]4. FILE SCANNING
  177.     [77]5. FILE AND DIRECTORY NAMES CONTAINING SPACES
  178.     [78]6. OTHER COMMAND PARSING IMPROVEMENTS
  179.          [79]6.1. Grouping Macro Arguments
  180.          [80]6.2. Directory and File Name Completion
  181.          [81]6.3. Passing Arguments to Command Files
  182.          [82]6.4. More-Prompting
  183.          [83]6.5. Commas in Macro Definitions
  184.          [84]6.6. Arrow Keys
  185.     [85]7. NEW COMMANDS AND SWITCHES
  186.     [86]8. SCRIPTING IMPROVEMENTS
  187.          [87]8.1. Performance and Debugging
  188.          [88]8.2. Using Macros as Numeric Variables
  189.          [89]8.3. New IF Conditions
  190.          [90]8.4. The ON_UNKNOWN_COMMAND Macro
  191.          [91]8.5. The SHOW MACRO Command
  192.          [92]8.6. Arrays
  193.          [93]8.7. New or Improved Built-in Variables and Functions
  194.          [94]8.8. The RETURN and END Commands
  195.          [95]8.9. UNDEFINing Groups of Variables
  196.          [96]8.10. The MINPUT Command
  197.          [97]8.11. Learned Scripts
  198.          [98]8.12. Pattern Matching
  199.          [99]8.13. Dates and Times
  200.          [100]8.14. Trapping Keyboard Interruption
  201.     [101]9. S-EXPRESSIONS
  202.          [102]9.1. What is an S-Expression?
  203.          [103]9.2. Integer and Floating-Point-Arithmetic
  204.          [104]9.3. How to Use S-Expressions
  205.          [105]9.4. Summary of Built-in Constants and Operators
  206.          [106]9.5. Variables
  207.          [107]9.6. Assignments and Scope
  208.          [108]9.7. Conditional Expressions
  209.          [109]9.8. Extensibility
  210.          [110]9.9. Examples
  211.          [111]9.10. Differences from Algebraic Notation
  212.          [112]9.11.Differences from Lisp
  213.     [113]10. FILE TRANSFER
  214.     [114]11. MODEMS AND DIALING
  215.     [115]12. TERMINAL CONNECTION
  216.     [116]13. CHARACTER SETS
  217.     [117]14. DIALOUT FROM TELNET TERMINAL SERVERS
  218.     [118]15. COPING WITH BROKEN KERMIT PARTNERS
  219.     [119]16. NEW COMMAND-LINE OPTIONS
  220.     [120]17. LOGS
  221.    
  222.    [ [121]Top ] [ [122]C-Kermit ] [ [123]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 [124]Section 5 of the Unix C-Kermit
  232.           [125]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 [126]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 [127]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 [128]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 [129]FTP, TELNET, and IKSD URLs as its
  296.             first command-line argument.
  297.           + Character-set translation added to the FTP client for
  298.             [130]filenames. 
  299.           Optional [131]setting of date of incoming files by FTP [M]GET
  300.             from the server date.
  301.           + [132]FTP CHECK filename added to let FTP client check the
  302.             existence of a file on the server.
  303.           + [133]FTP GET /NAMELIST:filename added to get list of server
  304.             filenames into a local file.
  305.           + [134]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 [135]VDIRECTORY added for getting verbose directory
  312.             listings from TOPS-20.
  313.           + [136]FTP TYPE TENEX added for transferring 8-bit binary files
  314.             with PDP-10s.
  315.           + Added [137]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.           + [138]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 [139]\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.           + [140]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.           + [141]HTTP 1.1 connections and scripting
  430.           + [142]ON_CTRLC macro for trapping Ctrl-C in scripts
  431.           + [143]Date-time parsing improvements, timezones, comparison,
  432.             arithmetic
  433.           + [144]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.           + [145]New Unix man page
  444.           + [146]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 [147]SSH v2 Subsystem.
  537.           + [148]SET LOCUS command.
  538.           + [149]L-versions of CD, DIR, DELETE, MKDIR, etc, to force
  539.             local execution.
  540.           + [150]USER and ACCOUNT added as synonyms for FTP USER and FTP
  541.             ACCOUNT.
  542.           + [151]SHOW VARIABLES now accepts a list of variables.
  543.           + Rudimentary support for [152]Caller ID when receiving phone
  544.             calls.
  545.           + Up/Down [153]Arrow-key navigation of command history buffer.
  546.           + [154]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 [155]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.    [ [156]Top ] [ [157]Contents ] [ [158]C-Kermit ] [ [159]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 [160]previous section.
  864.    
  865.    [ [161]Top ] [ [162]Contents ] [ [163]C-Kermit ] [ [164]Kermit Home ]
  866.   __________________________________________________________________________
  867.  
  868. 2. SSH AND HTTP
  869.  
  870.   2.1. SSH Connections
  871.   
  872.      This section does not apply to [165]Kermit 95 2.0, which has its
  873.      own built-in SSH client, which is documented [166]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; [167]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.           
  989.    -oForwardAgent no
  990.           
  991.    -oForwardX11 no
  992.           
  993.    -oFallbackToRsh no
  994.           These ensure that a secure connection is used and that the
  995.           connection used for file transfer is not also used for
  996.           forwarding other things that might be specified in the
  997.           ssh_config file.
  998.           
  999.    -oProtocol 2
  1000.           (i.e. SSH v2) Ensures that the negotiated protocol supports
  1001.           subsystems.
  1002.           
  1003.    Once you have an SSH connection to a Kermit server, it's just like any
  1004.    other connection to a Kermit server (and very similar to a connection
  1005.    to an FTP server). You give the client file transfer and management
  1006.    commands for the server, and the server executes them. Of course you
  1007.    can also give the client any other commands you wish.
  1008.    
  1009.    [ [168]SSH Kermit Server Subsystem ] [ [169]Kermit 95 Built-in SSH
  1010.    Client ]
  1011.      _________________________________________________________________
  1012.    
  1013.   2.2. HTTP Connections
  1014.   
  1015.    Hypertext Transfer Protocol, or HTTP, is the application protocol of
  1016.    the World Wide Web (WWW), used between Web browsers (clients) and Web
  1017.    servers. It allows a client to get files from websites, upload files
  1018.    to websites, delete files from websites, get information about website
  1019.    directories and files, and interact with server-side CGI scripts.
  1020.    C-Kermit includes an HTTP client capable of both clear-text and secure
  1021.    HTTP connections, that can do all these tasks and can be automated
  1022.    through the Kermit scripting language.
  1023.    
  1024.    Although C-Kermit 7.0 could make HTTP connections to Web servers, it
  1025.    could do so only when no other connection was open, and the procedure
  1026.    was somewhat awkward. C-Kermit 8.0 improves matters by:
  1027.    
  1028.      * Allowing an HTTP connection to be open at the same time as a
  1029.        regular SET LINE or SET HOST connection, and also at the same time
  1030.        as an FTP connection ([170]Section 3);
  1031.      * Upgrading the HTTP protocol level from 1.0 to 1.1, thus allowing
  1032.        for persistent connections, in which a series of commands can be
  1033.        sent on the same connection, rather than only one as in HTTP 1.0
  1034.        (and C-Kermit 7.0);
  1035.      * Providing for "one-shot" URL-driven HTTP operations such as GET or
  1036.        PUT.
  1037.      * Providing a distinct HTTP command-line personality.
  1038.        
  1039.    Persistent HTTP connections are managed with the following commands:
  1040.    
  1041.    HTTP [ switches ] OPEN [ security-options ] host-or-url [ port ] 
  1042.           Opens a persistent connection to the specified host (IP host
  1043.           name or address) on the specified port. If any switches
  1044.           (options, listed in the next section) are included, their
  1045.           values are saved and used for all subsequent HTTP action
  1046.           commands on the same connection. If no port is specified, HTTP
  1047.           (80) is used. A Uniform Resource Locator (URL, [171]RFC 1738)
  1048.           can be given instead of a hostname (or address) and port (but
  1049.           the URL can not include a directory/file path). The security
  1050.           options are explained [172]below. The HTTP OPEN command
  1051.           replaces the C-Kermit 7.0 SET HOST hostname HTTP command, which
  1052.           no longer works with HTTP GET and related commands.
  1053.           
  1054.    HTTP CLOSE
  1055.           Closes any open HTTP connection and clears any saved switch
  1056.           values.
  1057.           
  1058.    A URL starts with a protocol name, which must be http or https in this
  1059.    case; optionally includes a username and password; and must contain a
  1060.    host name or address:
  1061.    
  1062.   protocol://[user[.password]]@host[:port][URI]
  1063.  
  1064.    HTTP is Hypertext Transfer Protocol. HTTPS is the secure (SSL/TLS)
  1065.    version of HTTP. The TCP service port is derived from the protocol
  1066.    prefix (so normally the ":port" field is omitted). Thus the URL
  1067.    protocol name specifies a default TCP service port and the URL user
  1068.    and password fields can take the place of the /USER and /PASSWORD
  1069.    switches ([173]Section 2.2.1). The optional URI is a "compact string
  1070.    of characters for identifying an abstract or physical resource"
  1071.    ([174]RFC 2396), such as a file. It must begin with a slash (/); if
  1072.    the URI is omitted, "/" is supplied. Examples:
  1073.    
  1074.    http open http://www.columbia.edu/
  1075.           Equivalent to http open www.columbia.edu or http open
  1076.           www.columbia.edu http.
  1077.           
  1078.    http open https://olga.secret@www1.xyzcorp.com/
  1079.           Equivalent to http /user:olga /pass:secret open
  1080.           www1.xyzcorp.com https.
  1081.           
  1082.    Persistence is accomplished unilaterally by C-Kermit 8.0. An HTTP 1.0
  1083.    server closes the connection after each action. Although HTTP 1.1
  1084.    allows multiple actions on the same connection, an HTTP 1.1 server
  1085.    tends to close the connection if it is idle for more than a few
  1086.    seconds, to defend itself against denial-of-service attacks. But when
  1087.    you use Kermit's HTTP OPEN command to create a connection, Kermit
  1088.    reopens it automatically (if necessary) for each HTTP action until you
  1089.    close it with HTTP CLOSE, regardless of the server's HTTP protocol
  1090.    version, or how many times it closes the connection.
  1091.    
  1092.    Firewalls can be negotiated through proxies with the following
  1093.    commands:
  1094.    
  1095.    SET TCP HTTP-PROXY [ host[:port] ]
  1096.           If a host (by hostname or IP address) is specified, Kermit uses
  1097.           it as a proxy server when attempting outgoing TCP connections
  1098.           -- not only HTTP connections, but all TCP/IP connections,
  1099.           Telnet and FTP included. This allows Kermit to adapt to the
  1100.           HTTP firewall penetration method (as opposed to other methods
  1101.           such as SOCKS4). If no hostname or ip-address is specified, any
  1102.           previously specified Proxy server is removed. If no port number
  1103.           is specified, the "http" service is used. This command must be
  1104.           given before the HTTP OPEN command if a proxy is to be used or
  1105.           canceled.
  1106.           
  1107.    HTTP [ switches ] CONNECT host[:port]
  1108.           Instructs the HTTP server to act as a proxy, establishing a
  1109.           connection to the specified host (IP hostname or address) on
  1110.           the given port (80 = HTTP by default) and to redirect all data
  1111.           transmitted between Kermit and itself to the given host for the
  1112.           life of the connection. This command is to be used only for
  1113.           debugging HTTP proxy connections. If a proxy connection is
  1114.           required, instruct Kermit to use the proxy with the SET TCP
  1115.           HTTP-PROXY command.
  1116.           
  1117.     2.2.1. HTTP Command Switches
  1118.     
  1119.    HTTP switches, like all other switches, are optional. When HTTP
  1120.    switches are included with the HTTP OPEN command, they apply
  1121.    automatically to this and all subsequent HTTP actions (GET, PUT, ...)
  1122.    on the same connection until an HTTP CLOSE command is given. So if you
  1123.    include switches (or the equivalent URL fields, such as user and
  1124.    password) in the HTTP OPEN command, you can omit them from subsequent
  1125.    commands on the same connection. If the connection has closed since
  1126.    your last command, it is automatically reopened with the same options.
  1127.    
  1128.    If you include switches with an HTTP action command (such as GET or
  1129.    PUT), they apply only to that command.
  1130.    
  1131.    /USER:name
  1132.           To be used in case a page requires a username for access. The
  1133.           username is sent with page requests. If it is given with the
  1134.           OPEN command it is saved until needed. If a username is
  1135.           included in a URL, it overrides the username given in the
  1136.           switch. CAUTION: Username and password (and all other
  1137.           information, including credit card numbers and other material
  1138.           that you might prefer to protect from public view) are sent
  1139.           across the network in clear text on regular HTTP connections,
  1140.           but authentication is performed securely on HTTPS connections.
  1141.           
  1142.    /PASSWORD:text
  1143.           To be used in case a web page requires a password for access.
  1144.           The password is sent with page requests. If it is given with
  1145.           the OPEN command it is saved until needed. If a password is
  1146.           given in a URL, it overrides the one given here. CAUTION: (same
  1147.           as for /USER:).
  1148.           
  1149.    /AGENT:user-agent
  1150.           Identifies the client to the server. Overrides the default
  1151.           agent string, which is "C-Kermit" (for C-Kermit) or "Kermit-95"
  1152.           (for Kermit 95).
  1153.           
  1154.    /ARRAY:array-designator
  1155.           Tells Kermit to store the response headers in the given array,
  1156.           one line per element. The array need not be declared in
  1157.           advance. Example: /array:&a.
  1158.           
  1159.    /TOSCREEN
  1160.           Tells Kermit to display any response text on the screen. It
  1161.           applies independently of the output file specification; thus it
  1162.           is possible to have the server response go to the screen, a
  1163.           file, both, or neither.
  1164.           
  1165.    /HEADER:header-item(s)
  1166.           Used for specifying any optional headers to be sent with HTTP
  1167.           requests.
  1168.           
  1169.   /HEADER:tag:value
  1170.  
  1171.           To send more than one header, use braces for grouping:
  1172.           
  1173.   /HEADER:{{tag:value}{tag:value}...}
  1174.  
  1175.           For a list of valid tags and value formats see [175]RFC 2616,
  1176.           "Hypertext Transfer Protocol -- HTTP/1.1". A maximum of eight
  1177.           headers may be specified.
  1178.           
  1179.     2.2.2. HTTP Action Commands
  1180.     
  1181.    HTTP actions can occur within a persistent connection, or they can be
  1182.    self-contained ("connectionless"). A persistent HTTP connection begins
  1183.    with an HTTP OPEN command, followed by zero or more HTTP action
  1184.    commands, and is terminated with an HTTP CLOSE command:
  1185.    
  1186.   http open www.columbia.edu
  1187.   if failure stop 1 HTTP OPEN failed: \v(http_message)
  1188.   http get kermit/index.html
  1189.   if failure stop 1 HTTP GET failed: \v(http_message)
  1190.   (more actions possible here...)
  1191.   http close
  1192.  
  1193.    A self-contained HTTP action occurs when a URL is given instead of a
  1194.    remote file name to an HTTP action command. In this case, Kermit makes
  1195.    the HTTP connection, takes the action, and then closes the connection.
  1196.    If an HTTP connection was already open, it is closed silently and
  1197.    automatically.
  1198.    
  1199.   http get http://www.columbia.edu/kermit/index.html
  1200.  
  1201.    Kermit's HTTP action commands are as follows. Switches may be included
  1202.    with any of these to override switch (or default) values given in the
  1203.    HTTP OPEN command.
  1204.    
  1205.    HTTP [ switches ] GET remote-filename [ local-filename ]
  1206.           Retrieves the named file from the server specified in the most
  1207.           recent HTTP OPEN command for which a corresponding HTTP CLOSE
  1208.           command has not been given. The filename may not include
  1209.           wildcards (HTTP protocol does not support them). If no HTTP
  1210.           OPEN command is in effect, this form of the HTTP GET command
  1211.           fails. The default local filename is the same as the remote
  1212.           name, but with any pathname stripped. For example, the command
  1213.           http get kermit/index.html stores the file in the current local
  1214.           directory as index.html. If the /HEADERS: switch is included,
  1215.           information about the file is also stored in the specified
  1216.           array (explained in [176]Section 2.2.3). All files are
  1217.           transferred in binary mode. HTTP does not provide for
  1218.           record-format or character-set conversion.
  1219.           
  1220.    HTTP [ switches ] GET url [ local-filename ]
  1221.           When HTTP GET is given a URL rather than a filename, Kermit
  1222.           opens a connection to the designated server (closing any
  1223.           previously open HTTP connection), gets the file, and then
  1224.           closes the connection. If the URL does not include a filename,
  1225.           index.html is supplied. This is the self-contained one-step
  1226.           "connectionless" method for getting a file from a Web server.
  1227.           The data is not interpreted; HTTP GET is like "lynx -source"
  1228.           rather than "lynx -dump".
  1229.           
  1230.    In the remaining HTTP action commands, the distinction between a
  1231.    remote filename and a URL are the same as in the HTTP GET command.
  1232.    
  1233.    HTTP [ switches ] HEAD remote-filename-or-url [ local-filename ]
  1234.           Like GET except without actually getting the file; instead it
  1235.           retrieves only the headers. If the /ARRAY: or /TOSCREEN switch
  1236.           is included, there is no default local output filename but you
  1237.           can still specify one. If neither of these switches is
  1238.           included, the default local filename is the same as the remote
  1239.           filename, but with any path stripped and with ".head" appended.
  1240.           The HEAD command can be used in a script with the /ARRAY:
  1241.           switch to retrieve information about the requested resource to
  1242.           determine whether the resource should actually be retrieved
  1243.           with a subsequent GET request.
  1244.           
  1245.    HTTP [ switches ] INDEX remote-directory-or-url [ local-filename ]
  1246.           Asks the server to send a listing of the files in the given
  1247.           server directory. This command is not supported by most Web
  1248.           servers. Even when it is supported, there is no standard format
  1249.           for the listing.
  1250.           
  1251.    HTTP [ switches ] POST [ /MIME-TYPE:type ] source-file
  1252.           remote-path-or-url [ result-file ]
  1253.           Sends data to a process running on the remote host; the result
  1254.           is usually an HTML file but could be anything. The data to be
  1255.           posted must be read from a local file (the source-file). If a
  1256.           result file is specified, Kermit stores the server's response
  1257.           in it.
  1258.           
  1259.    HTTP [ switches ] PUT [ MIME-TYPE:type ] local-file [
  1260.           remote-file-or-url [ result-file ] ]
  1261.           Uploads a local file to the server. Only the name of a single
  1262.           file can be given; wildcards (and group transfers) are not
  1263.           supported by HTTP protocol. If no remote filename is given, the
  1264.           file is sent with the same name as the local file, but with any
  1265.           pathname stripped.
  1266.           
  1267.    HTTP [ switches ] DELETE remote-file-or-url [ local-result-file ]
  1268.           Asks the server to delete the specified single file. If a
  1269.           result file is specified, it will contain any response data
  1270.           returned by the server.
  1271.           
  1272.    Note the limitations of HTTP protocol compared to (say) FTP or Kermit.
  1273.    There is no command for changing directories, no standard way to get
  1274.    file or directory lists, no way to transfer file groups by using
  1275.    wildcard notation, etc, and therefore no good way to (say) fetch all
  1276.    pages, descend through subdirectories, perform automatic updates, etc.
  1277.    There is no assurrance a connection will stay open and, as noted,
  1278.    there is no provision for data conversion between unlike platforms.
  1279.    The data's MIME headers can be used for postprocessing.
  1280.    
  1281.     2.2.3. HTTP Headers
  1282.     
  1283.    Each HTTP request and response contains a set of name/value pairs
  1284.    called headers. HTTP headers are specified in [177]RFC 2616. For
  1285.    example, an HTTP GET request for /index.html on www.columbia.edu
  1286.    contains the following headers:
  1287.    
  1288.   GET /index.html HTTP/1.1
  1289.   Host: www.columbia.edu:80
  1290.   User-agent: C-Kermit 8.0
  1291.   Authorization: Basic base64-encoded-username-password
  1292.  
  1293.    These might be followed by any others specified with a /HEADERS:
  1294.    switch:
  1295.    
  1296.   Accept: image/gif, image/x-xbitmap, image/jpeg, *.*
  1297.   Accept-Encoding: gzip
  1298.   Accept-Language: en
  1299.   Accept-Charset: iso-8859-1,utf-8
  1300.   Cookie: cookie-data
  1301.  
  1302.    The server sends back a short report about the file prior to sending
  1303.    the file contents. Example:
  1304.    
  1305.   HTTP/1.1 200 OK
  1306.   Date: Fri, 24 Aug 2001 21:09:39 GMT
  1307.   Server: Apache/1.3.4 (Unix)
  1308.   Last-Modified: Mon, 06 Aug 2001 21:16:13 GMT
  1309.   ETag: "1fa137-10d7-3b6f091d"
  1310.   Accept-Ranges: bytes
  1311.   Content-Length: 4311
  1312.   Content-Type: text/html
  1313.  
  1314.    If you want to have this information available to a Kermit script you
  1315.    can use the /ARRAY switch to have Kermit put it in array, one line per
  1316.    array element. Example:
  1317.    
  1318.   set exit warning off
  1319.   http open www.columbia.edu
  1320.   if fail exit 1 Can't reach server
  1321.   http /array:&a get /index.html
  1322.   if fail exit 1 Can't get file
  1323.   echo Header lines: \fdim(&a)
  1324.   for \%i 1 \fdim(&a) 1 {
  1325.       echo \%i. \&a[\%i]
  1326.   }
  1327.  
  1328.    Note that the "Date:" item is the current date and time; the
  1329.    "Last-Modifed:" item is the file's modification date and time. An
  1330.    example showing how to use this information is presented in
  1331.    [178]Section 8.13.7.
  1332.    
  1333.     2.2.4. Secure HTTP Connections
  1334.     
  1335.    SSL/TLS (Secure Sockets Layer / Transport Layer Security) is the
  1336.    protocol used to secure HTTP, SMTP, and other Internet applications.
  1337.    See the [179]C-Kermit Reference Section 5.4 for an introduction to
  1338.    SSL/TLS. To make a secure HTTP connection, you need:
  1339.    
  1340.     1. A secure client (a version of C-Kermit or Kermit 95 with SSL/TLS
  1341.        security built in). Type "check ssl" at the Kermit prompt to make
  1342.        sure you have it.
  1343.     2. A secure server to connect to.
  1344.     3. The CA Root Certificate used to authenticate the server to the
  1345.        client. (see [180]Section 15 of the security reference for an
  1346.        introduction to certificates).
  1347.        
  1348.    And you must make a connection to the secure HTTP port: service name
  1349.    HTTPS, port number 443 (as opposed to service HTTP, port 80). You can
  1350.    also make secure connections to other ports by including the /TLS or
  1351.    /SSL switch with the HTTP OPEN command, if the host supports SSL/TLS
  1352.    on the given port:
  1353.    
  1354.    The quality of the SSL/TLS connection depends on the cipher suite.
  1355.    There are several possibilities:
  1356.    
  1357.    Anonymous cipher suite:
  1358.           If an anonymous cipher suite is negotiated, the connection is
  1359.           encrypted but there is no authentication. This connection is
  1360.           subject to a Man-In-The-Middle (MITM) attack.
  1361.           
  1362.    X.509 certificate on the server:
  1363.           When you connect to certain secure servers, an X.509
  1364.           certificate is returned. This certificate is issued to a
  1365.           special hostname, something like www1.xyzcorp.com or
  1366.           wwws.xyzcorp.com (rather than the normal www.xyzcorp.com). It
  1367.           is signed by the host's Certificate Authority (CA). If the host
  1368.           certificate is configured on the client, it can be used to
  1369.           verify the certificate received from the server. If the
  1370.           certificate it verified as authentic, a check is made to ensure
  1371.           it has not expired and it was issued to the host you were
  1372.           attempting to connect to. If you had asked to connect to (say)
  1373.           www.xyzcorp.com but were given a certificate for
  1374.           www1.xyzcorp.com, you would be prompted for permission to
  1375.           continue.
  1376.           
  1377.           If the verification succeeded, the connection would be
  1378.           encrypted with one-way (server-to-client) authentication. This
  1379.           connection is not subject to a MITM attack.
  1380.           
  1381.           If a username and password are transmitted over this
  1382.           connection, they are not subject to interception. However, the
  1383.           standard risks associated with passing the password to the host
  1384.           for verification apply; for example, if the host has been
  1385.           compromised, the password will be compromised.
  1386.           
  1387.    X.509 client certificate:
  1388.           If a connection has been established with an X.509 server
  1389.           certificate, the server can ask the client to send a
  1390.           certificate of its own. This certificate must be verified
  1391.           against a CA Root certificate. The certificate itself (or
  1392.           subject info from the certificate) is used to determine the
  1393.           authorization for the client, and if successful, the username
  1394.           and password need not be sent to the server.
  1395.           
  1396.    Kerberos 5:
  1397.           Instead of using X.509 certifcates, Kerberos 5 can be used to
  1398.           perform the authentication and key exchange. In this situation,
  1399.           there is mutual authentication between the client and server.
  1400.           The Kerberos 5 principal is used by the server to look up the
  1401.           appropriate authorization data. There is no need to send
  1402.           username and password.
  1403.           
  1404.    An HTTP connection is made with the HTTP OPEN command:
  1405.    
  1406.    HTTP [ switches ] OPEN [ { /SSL, /TLS } ] host [ port ] 
  1407.           If /SSL or /TLS switches are included (these are synonyms), or
  1408.           if the service is HTTPS or the port is 443, a secure connection
  1409.           is attempted using the current authentication settings; see
  1410.           HELP SET AUTHENTICATION for details ([181]Section 6.2 of the
  1411.           security reference). If the no /SSL or /TLS switch is included
  1412.           but the port is 443 or the service is HTTPS, a secure
  1413.           connection is attempted. If an /SSL or /TLS switch is included
  1414.           but a port is not specified, an SSL/TLS connection is attempted
  1415.           on the default port (80).
  1416.           
  1417.    Certificates are covered in the separate [182]Kermit Security
  1418.    Reference for C-Kermit 8.0. You should let Kermit know to verify
  1419.    certificates with the SET AUTHENTICATION TLS command. For example:
  1420.    
  1421.    SET AUTHENTICATION TLS CRL-DIR directory
  1422.           Specifies a directory that contains certificate revocation
  1423.           files where each file is named by the hash of the certificate
  1424.           that has been revoked.
  1425.           
  1426.    SET AUTHENTICATION TLS CRL-FILE filename
  1427.           Specifies a file that contains a list of certificate
  1428.           revocations.
  1429.           
  1430.    SET AUTHENTICATION TLS VERIFY-DIR directory
  1431.           Specifies a directory that contains root CA certificate files
  1432.           used to verify the certificate chains presented by the peer.
  1433.           Each file is named by a hash of the certificate.
  1434.           
  1435.    SET AUTHENTICATION TLS VERIFY-FILE filename
  1436.           Specifies a file that contains root CA certificates to be used
  1437.           for verifying certificate chains.
  1438.           
  1439.    SET AUTHENTICATION TLS VERIFY OFF
  1440.           Tells Kermit not to require a certificate and accept any
  1441.           certificate that is presented regardless of whether it is
  1442.           valid.
  1443.           
  1444.    There are many other options; see the security document for details.
  1445.    
  1446.    Now suppose you need need to fetch the file denoted by the following
  1447.    URL:
  1448.    
  1449.   https://myuserid:mypassword@wwws.xyzcorp.com/clients/info/secret.html
  1450.  
  1451.    Once you have set up the handling of certificates as desired, you can
  1452.    use the following Kermit commands:
  1453.    
  1454.   http /user:myuserid /password:mypassword open www1.xyzcorp.com https
  1455.   if success {
  1456.       http get /clients/info/secret.html
  1457.       http close
  1458.   }
  1459.  
  1460.    As another example, let's say that you have a web form you need to
  1461.    populate with three fields: red,white and blue.
  1462.    
  1463.   <FORM ACTION="http://www.xyzcorp.com/cgi-bin/form.cgi" METHOD="POST">
  1464.   <INPUT NAME="Red">
  1465.   <INPUT NAME="White">
  1466.   <INPUT NAME="Blue">
  1467.   </FORM>
  1468.  
  1469.    You can handle this with the HTTP POST command. The data to be posted
  1470.    is stored in the local file data.txt.
  1471.    
  1472.   Red=seven stripes&White=six stripes&Blue=fifty stars
  1473.  
  1474.    and the response from the server will be stored into response.txt.
  1475.    
  1476.   http open www.xyzcorp.com http
  1477.   if success {
  1478.     http /array:c post data.txt /cgi-bin/form.cgi response.txt
  1479.     http close
  1480.   }
  1481.  
  1482.    In this scenario, the Common Gateway Interface (CGI) sends a response
  1483.    whether it succeeds or fails in a script-dependent manner. The script
  1484.    can either report success and enclose the response data; or it might
  1485.    send a 302 Found error which indicates that the "Location:" header
  1486.    should be used to determine the URL at which the data can be found.
  1487.    
  1488.     2.2.5. HTTP Variables
  1489.     
  1490.    \v(http_code)
  1491.           The HTTP protocol code number of the most recent server reply,
  1492.           e.g. 404 for "not found".
  1493.           
  1494.    \v(http_connected)
  1495.           1 when an HTTP connection is open, 0 when there is no HTTP
  1496.           connection.
  1497.           
  1498.    \v(http_host)
  1499.           If an HTTP connection is open, the hostname:port, e.g.
  1500.           www.columbia.edu:80; otherwise, empty.
  1501.           
  1502.    \v(http_message)
  1503.           Server error message, if any, from most recent HTTP command.
  1504.           
  1505.    \v(http_security)
  1506.           A list of the security parameters and values for the current
  1507.           connection, if any. Empty if the connection is not to a secure
  1508.           server, or there is no connection.
  1509.           
  1510.    To display all the HTTP variables at once, type SHOW VAR HTTP:
  1511.    
  1512.   C-Kermit> http open www.columbia.edu
  1513.   C-Kermit> http get lkjlkjlkjlkj 
  1514.   C-Kermit> sho var http
  1515.    \v(http_code) = 404
  1516.    \v(http_connected) = 1
  1517.    \v(http_host) = www.columbia.edu:80
  1518.    \v(http_message) = Not Found
  1519.    \v(http_security) = NULL
  1520.   C-Kermit>
  1521.  
  1522.     2.2.6. The HTTP Command-Line Personality
  1523.     
  1524.    If you invoke C-Kermit with the name "http" or "https", you can use a
  1525.    special set of HTTP-specific command-line options. You can do this by
  1526.    creating a symbolic linke "http" or "https" to the C-Kermit 8.0
  1527.    executable, or by having a separate copy of it called "http" or
  1528.    "https". Here's the usage message ("http -h"):
  1529.    
  1530.   Usage: ./http host [ options... ]
  1531.    -h             This message.
  1532.    -d             Debug to debug.log.
  1533.    -S             Stay (issue command prompt when done).
  1534.    -Y             Do not execute Kermit initialization file.
  1535.    -q             Quiet (suppress most messages).
  1536.    -u name        Username.
  1537.    -P password    Password.
  1538.    -g pathname    Get remote pathname.
  1539.    -p pathname    Put remote pathname.
  1540.    -H pathname    Head remote pathname.
  1541.    -l pathname    Local path for -g, -p, and -H.
  1542.    -z opt[=value] Security options...
  1543.       cert=file   Client certificate file
  1544.       certsok     Accept all certificates
  1545.       key=file    Client private key file
  1546.       secure      Use SSL
  1547.       verify=n    0 = none, 1 = peer , 2 = certificate required
  1548.  
  1549.    The "host" argument is the name of a Web host, e.g. www.columbia.edu.
  1550.    The action options are -p, -g, and -H. If you give an action option,
  1551.    Kermit does the action and then exits. If you give a host without an
  1552.    action option, Kermit makes an HTTP connection to the host and then
  1553.    gives you the C-Kermit prompt. Here's a simple example that fetches a
  1554.    publicly readable Web page:
  1555.    
  1556.   http www.columbia.edu -g kermit/index.html
  1557.  
  1558.    If you need to access a website for which a username and password are
  1559.    required, you can supply them on the command line with -u and -P. If
  1560.    you include a username but omit the password, Kermit prompts you for
  1561.    it:
  1562.    
  1563.   http www.columbia.edu -u olga -p kermit/index.html -l index.html
  1564.   Password:
  1565.  
  1566.    Note that when PUT'ing files to websites, you have to supply both the
  1567.    -p (remote pathname) and -l (local path) options.
  1568.    
  1569.    If your version of Kermit is built with SSL/TLS security, you can also
  1570.    use the -z option to make secure HTTP (https) connections.
  1571.    
  1572.    Finally, as noted in [183]Section 16, you can also give a URL instead
  1573.    of a host name and options.
  1574.    
  1575.    [ [184]Top ] [ [185]Contents ] [ [186]C-Kermit Home ] [ [187]Kermit
  1576.    Home ]
  1577.   __________________________________________________________________________
  1578.  
  1579. 3. THE BUILT-IN FTP CLIENT
  1580.  
  1581.      3.1.  [188]Making and Managing FTP Connections
  1582.      3.2.  [189]Making Secure FTP Connections
  1583.      3.3.  [190]Setting FTP Preferences
  1584.      3.4.  [191]Managing Directories and Files
  1585.      3.5.  [192]Uploading Files With FTP
  1586.      3.6.  [193]Downloading Files With FTP
  1587.      3.7.  [194]Translating Character Sets
  1588.      3.8.  [195]FTP Command Shortcuts
  1589.      3.9.  [196]Dual Sessions
  1590.      3.10. [197]Automating FTP Sessions
  1591.      3.11. [198]Advanced FTP Protocol Features
  1592.      
  1593.    Earlier versions of C-Kermit and K95 included an FTP command, but it
  1594.    simply invoked an external FTP client. Now, by popular demand, Kermit
  1595.    includes its own built-in FTP client that offers the following
  1596.    advantages over traditional FTP clients (and its previous interface to
  1597.    them):
  1598.    
  1599.      * Any of Kermit's built-in [199]security methods can be used to
  1600.        establish and conduct secure FTP sessions with [200]FTP servers
  1601.        that support these methods. (Security modules can be subject to
  1602.        export restrictions.)
  1603.      * Kermit's FTP client uses "passive mode" by default to avoid
  1604.        blockage by firewalls and network address translators. Of course
  1605.        active mode can be chosen too when needed.
  1606.      * [201]Character sets can be translated as part of the transfer
  1607.        process even when the FTP server does not support character-set
  1608.        translation, including to/from the new Internet standard
  1609.        international character set, [202]Unicode UTF-8. This includes
  1610.        both the file's name and (for text files only) its contents.
  1611.      * All of C-Kermit's [203]file-selection mechanisms are available:
  1612.        size, date, name patterns and lists, exception lists, etc.
  1613.      * [204]Atomic file movement capabilities are provided (delete, move,
  1614.        or rename files automatically after successful transfer).
  1615.      * The correct file type, "ascii" (i.e. text) or binary, is chosen
  1616.        automatically for each file (explained in [205]Section 4), and any
  1617.        mixture of text and binary files can be sent in a single
  1618.        operation, even across platforms.
  1619.      * Update mode ("don't bother transferring files that didn't change
  1620.        since last time") and recovery (resumption of an interrupted
  1621.        transfer from the point of failure) are available in both
  1622.        directions.
  1623.      * When uploading files from UNIX to UNIX, the file's permissions can
  1624.        be preserved if desired.
  1625.      * Recursive directory-tree PUTs are supported between any two
  1626.        platforms that have tree-structured file systems. Recursive GETs
  1627.        are supported between like platforms if the server cooperates and
  1628.        between like or unlike platforms if the server supports MLSD
  1629.        ([206]Section 3.11).
  1630.      * When receiving files, all of Kermit's file collision actions are
  1631.        available: backup, update, refuse, rename, etc.
  1632.      * Multi-file transfers can be interrupted on a per-file basis,
  1633.        automatically skipping to the next file.
  1634.      * FTP sessions are [207]fully scriptable.
  1635.      * An entire FTP session (connect, login, CD, upload or download,
  1636.        logout) can be specified on the command line without using a
  1637.        script.
  1638.      * All of Kermit's logging options and formats are available to keep
  1639.        an accurate and complete record of each connection and file
  1640.        transfer, and to aid in troubleshooting.
  1641.      * All of Kermit's file-transfer display options are available
  1642.        (fullscreen, brief, CRT, serial, none).
  1643.        
  1644.    And best of all:
  1645.      * Kermit doesn't give you those annoying per-file prompts every time
  1646.        you start a multi-file transfer without remembering to give a
  1647.        "prompt" command first :-).
  1648.        
  1649.    [ [208]Top ] [ [209]FTP Top ] [ [210]FTP Client Overview ] [ [211]FTP
  1650.    Script Tutorial ] [ [212]C-Kermit Home ] [ [213]Kermit Home ]
  1651.      _________________________________________________________________
  1652.    
  1653.   3.1. Making and Managing FTP Connections
  1654.   
  1655.    Each copy of Kermit can have one FTP connection open at a time. FTP
  1656.    connections are independent of regular terminal connections; a
  1657.    terminal connection (serial or network via SET LINE, DIAL, SET HOST,
  1658.    TELNET, etc) may be, but need not be, open at the same time as an FTP
  1659.    connection, and terminal connections can also be closed, and new
  1660.    connections opened, without interfering with the FTP connection (and
  1661.    vice versa). Thus, for example, Kermit can have an FTP connection and
  1662.    a TELNET connection open to the same host simultaneously, using the
  1663.    TELNET connection (e.g.) to send mail or take other desired actions as
  1664.    various FTP actions complete. Of course, each copy of Kermit can do
  1665.    only one thing at a time, so it can't (for example) transfer a file
  1666.    with FTP and another file with Kermit protocol simultaneously.
  1667.    
  1668.    A Kermit FTP session can be established by [214]command-line options,
  1669.    by [215]URL, or by [216]interactive commands.
  1670.    
  1671.     3.1.1. Kermit Command-Line Options for FTP
  1672.     
  1673.    The new command-line option '-9' (sorry, we're out of letters) can be
  1674.    used when starting C-Kermit, telling it to make an FTP connection:
  1675.    
  1676.   kermit -9 hostname
  1677.  
  1678.    or if a non-default FTP port is needed:
  1679.    
  1680.   kermit -9 hostname:port
  1681.  
  1682.    You can also specify the username on the command line with the -M ("My
  1683.    User ID") option that was already there for other connection types:
  1684.    
  1685.   kermit -9 hostname -M olga
  1686.  
  1687.    If you specify the username on the command line, Kermit uses it when
  1688.    making the connection and does not prompt you for it (but it does
  1689.    prompt you for the password if one is required).
  1690.    
  1691.    Once the connection is made, you get the regular Kermit prompt, and
  1692.    can give interactive commands such as the ones described below. When
  1693.    you give a BYE command, Kermit closes the session and exits, just as a
  1694.    regular FTP client would do. If you don't want Kermit to exit when you
  1695.    give a BYE command, include the -S ("Stay") option on the command
  1696.    line.
  1697.    
  1698.    Other Kermit command-line options that are not specific to non-FTP
  1699.    connections should affect the FTP session in the expected ways; for
  1700.    example, -i and -T force binary and text mode transfers, respectively.
  1701.    
  1702.    File transfers can not be initiated on the "kermit -9" command line;
  1703.    for that you need to use Kermit's FTP personality (next section) or
  1704.    you can use URLs ([217]Section 3.1.3).
  1705.      _________________________________________________________________
  1706.    
  1707.     3.1.2. The FTP Command-Line Personality
  1708.     
  1709.    If you want to replace your regular FTP client with C-Kermit, you can
  1710.    make a link called "ftp" to the C-Kermit binary (or you can store a
  1711.    copy of the C-Kermit binary under the name "ftp"). When C-Kermit is
  1712.    invoked with a program name of "ftp" (or "FTP", case doesn't matter),
  1713.    it assumes the command-line personality of the regular FTP client:
  1714.    
  1715.   ftp [ options ] hostname [ port ]
  1716.  
  1717.    In this case the options are like those of a regular FTP client:
  1718.    
  1719.   -d  Debug: enables debug messages and creates a debug.log file.
  1720.   -n  No autologin: Kermit should not send your user ID automatically.
  1721.   -t  Packet trace: accepted but is treated the same as -d.
  1722.   -v  Verbose: accepted but ignored (operation is verbose by default).
  1723.   -i  Not interactive: accepted but ignored.
  1724.  
  1725.    and the hostname can also be a URL (explained in [218]Section 3.1.3).
  1726.    To specify a non-default TCP port for the FTP server, include the port
  1727.    number or name after the hostname.
  1728.    
  1729.    There are also some bonus options that allow you to execute an entire
  1730.    FTP session from the shell command line, as long as you don't include
  1731.    the -n option. These are not available with regular FTP clients, and
  1732.    at least one of these options (-g) conflicts with UNIX ftp (where -g
  1733.    means "no globbing", which does not apply to Kermit), and some of them
  1734.    (like the options above) also conflict with regular Kermit
  1735.    command-line options:
  1736.    
  1737.   -m mode      = "passive" (default) or "active"
  1738.   -Y            Don't execute the Kermit initialization file [1]
  1739.   -q            Quiet, suppresses all but error messages [1]
  1740.   -S            Stay, don't exit automatically [1]
  1741.   -A            Autologin anonymously [2]
  1742.   -u name       Username for autologin [2] (synonym: -M [1])
  1743.   -P password   Password for autologin (see cautions below) [2]
  1744.   -D directory  cd after autologin [2]
  1745.   -b            Binary mode [2]
  1746.   -a            Text ("ascii") mode [2] (synonym: -T [1])
  1747.   -R            Recursive (works with -p) [4]
  1748.   -p files      Files to put (upload) after autologin [2] (synonym: -s [1])
  1749.   -g files      Files to get (download) after autologin [3]
  1750.  
  1751.    [1] Same as Kermit, not available in regular FTP clients.
  1752.    [2] Conflicts with Kermit, not available in regular FTP clients.
  1753.    [3] Same as Kermit, conflicts with regular FTP clients.
  1754.    [4] Conflicts with Kermit, available in some FTP clients.
  1755.    
  1756.    Fancier options such as restart, character-set translation, filename
  1757.    collision selection, automatic move/rename/delete, etc, are not
  1758.    available from the command line; for these you can use the commands
  1759.    described in the following sections. The -R option might also work
  1760.    with -g (GET) but that depends on the server.
  1761.    
  1762.    The following security options are also available, explained in
  1763.    [219]Section 3.2:
  1764.    
  1765.   -k realm      Kerberos 4 realm [4]
  1766.   -f            Kerberos 5 credentials forwarding [4]
  1767.   -x            autoencryption mode [4]
  1768.   -c cipher     SRP cipher type [4]
  1769.   -H hash       SRP encryption hash [4]
  1770.   -z option     Security options [4]
  1771.  
  1772.    If you include -A or specify a name of "anonymous" or "ftp", you are
  1773.    logged in anonymously and, in the absence of -P, Kermit automatically
  1774.    supplies a password of "user@host", where "user" is your local user
  1775.    ID, and "host" is the hostname of the computer where Kermit is
  1776.    running. If you do not include -p or -g, Kermit enters command mode so
  1777.    you can type commands or execute them from a script.
  1778.    
  1779.    If you include -p or -g, Kermit attempts to transfer the specified
  1780.    files and then exits automatically at the end of the transfer unless
  1781.    you also included -S (Stay). It uses the "brief" file transfer display
  1782.    (one line per file) unless you include the -q option to suppress it.
  1783.    
  1784.    When uploading files with -p, Kermit switches automatically between
  1785.    text and binary mode for each file.
  1786.    
  1787.    When downloading, you can either specify a particular mode (text or
  1788.    binary) to be used for all the files, or you can let Kermit select the
  1789.    type for each file automatically, based on its name (see [220]Sections
  1790.    3.5 and [221]3.6 for greater detail). In UNIX be sure to quote any
  1791.    wildcard characters to prevent the shell from expanding them, as shown
  1792.    in the examples just below. Filename collisions are handled according
  1793.    Kermit's FILE COLLISION setting (if specified in your Kermit
  1794.    customization file; otherwise the default, which is BACKUP).
  1795.    
  1796.    It should go without saying that the -P option should be used with
  1797.    caution. In addition to the well-known risks of transmitting plaintext
  1798.    passwords over the Internet, in this case the password also echos to
  1799.    the screen if you type it, and can be seen in ps and w listings that
  1800.    show the user's currently active command and command-line arguments.
  1801.    Thus command-line FTP sessions are most appropriate for secure or
  1802.    anonymous connections (those that do not require passwords).
  1803.    
  1804.    Here's an example in which you download the latest C-Kermit "tarball"
  1805.    from the Columbia University FTP archive:
  1806.    
  1807.   ftp -A kermit.columbia.edu -bg kermit/archives/ckermit.tar.gz
  1808.  
  1809.    This assumes that "ftp" is a symbolic link to C-Kermit. It logs you in
  1810.    anonymously and gets the ckermit.tar.gz file in binary mode from the
  1811.    kermit/archives directory.
  1812.    
  1813.    Here's a slightly more ambitious example that illustrates CD'ing to
  1814.    the desired server directory to get a group of files in text mode (in
  1815.    this case the C-Kermit source files):
  1816.    
  1817.   ftp -A kermit.columbia.edu -D kermit/f -ag "ck[cuw]*.[cwh]" makefile
  1818.  
  1819.    In this case we CD to the kermit/f directory so we don't have to
  1820.    include it in each file specification, and we quote the ck[cuw]*.[cwh]
  1821.    specification so the shell doesn't expand it, since we have to pass it
  1822.    as-is to the server. Note also that the quotes don't go around the
  1823.    entire file list; only around each file specification that needs to be
  1824.    quoted.
  1825.    
  1826.    Here's one more example, that uploads a debug log file in binary mode
  1827.    to the Kermit incoming directory (as we might ask you to do when
  1828.    following up on a problem report):
  1829.    
  1830.   ftp -A kermit.columbia.edu -D kermit/incoming -bp debug.log
  1831.  
  1832.    In this case the -D option is required to tell the server where to put
  1833.    the incoming file.
  1834.    
  1835.    Unless the -Y option is included, your Kermit initialization file
  1836.    (.mykermrc in UNIX, K95.INI in Windows) is executed before the command
  1837.    line options, so you can set any FTP-related preferences there, as
  1838.    described in the subsequent sections.
  1839.      _________________________________________________________________
  1840.    
  1841.     3.1.3. The FTP URL Interpreter
  1842.     
  1843.    If Kermit is invoked with either its regular personality (as "kermit")
  1844.           or its FTP personality (as "ftp"), you can also give a URL
  1845.           (Universal Resource Locator) instead of a hostname and options,
  1846.           with or without a username and password:
  1847.           ftp ftp://user:password@host/path
  1848.           ftp ftp://user@host/path
  1849.           ftp ftp://@host/path   (or ftp://:@host/path)
  1850.           ftp ftp://host/path
  1851.           kermit ftp://host/path
  1852.           
  1853.    If the FTP personality is used, the service must be "ftp". In all
  1854.    cases, a hostname or address must be included. If a user is included
  1855.    but no password, you are prompted for the password. If a path
  1856.    (filename) is included:
  1857.      * If "@" is included without a user, Kermit prompts for the username
  1858.        and password.
  1859.      * If no user and no "@" are included, "anonymous" is used.
  1860.      * GET is assumed.
  1861.        
  1862.    If no path (and no action options) are included, an interactive FTP
  1863.           session is started, as in this example:
  1864.           ftp ftp://kermit.columbia.edu
  1865.           
  1866.    If a path is included, but a username is not included, "anonymous" is
  1867.    used and an appropriate user@host password is supplied automatically.
  1868.    If authentication is successful, Kermit attempts to GET the file
  1869.    indicated by the path or, if the path is the name of a directory, it
  1870.    asks the server for a directory listing. In both cases, Kermit
  1871.    disconnects from the server and exits after the operation is complete
  1872.    (unless you have included the -S option on the command line).
  1873.    
  1874.    Here's an example that gets a listing of the Kermit directory at the
  1875.           Kermit ftp site:
  1876.           ftp ftp://kermit.columbia.edu/kermit/
  1877.           
  1878.    This example gets the top-level READ.ME file from the same directory:
  1879.           ftp ftp://kermit.columbia.edu/kermit/READ.ME
  1880.           
  1881.    Here's the same example, but requesting a text-mode transfer:
  1882.           ftp -T ftp://kermit.columbia.edu/kermit/READ.ME
  1883.           This illustrates that you can mix command-line options and URLs
  1884.           if you desire.
  1885.           
  1886.    Here's an example that logs in as a (fictitious) real user to get a
  1887.           file:
  1888.           ftp ftp://olga@ftp.xyzcorp.com/resume.txt
  1889.           The password is not included, so Kermit prompts for it.
  1890.           
  1891.    This scheme allows Kermit to be used as the FTP helper of other
  1892.    applications, such as Web browsers, with all its advantages over other
  1893.    FTP clients (especially the ones that are built in to most Web
  1894.    browsers), e.g. that it can be given wildcards, and it can pick text
  1895.    and binary mode automatically for each file.
  1896.    
  1897.    HINT: suppose somebody sends you an FTP URL in email, or you see it in
  1898.    some text. If your terminal screen supports copy/paste, copy the url,
  1899.    and then at the shell prompt type "kermit", a space, and then paste
  1900.    the URL, e.g.:
  1901.    
  1902.   $ kermit ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty1.1.27-O
  1903.  
  1904.    "$ is the shell prompt; the part you type is underlined, the rest is
  1905.    pasted in. Kermit does the rest.
  1906.      _________________________________________________________________
  1907.    
  1908.     3.1.4. Interactive FTP Session Establishment
  1909.     
  1910.    As you read this and the following sections, bear in mind that any
  1911.    command that can be given at the prompt can also be used in a script
  1912.    program. Kermit's script programming language is the same as its
  1913.    interactive command language. [222]CLICK HERE if you would like to
  1914.    learn a bit more about script writing.
  1915.    
  1916.    An FTP session is established with the FTP OPEN command:
  1917.    
  1918.    FTP [ OPEN ] [ { /SSL, /TLS } ] hostname [ switches ] [ port ]
  1919.           Opens an FTP connection to the given host on the given port
  1920.           and, if FTP AUTOLOGIN is ON, also logs you in to the server,
  1921.           prompting for username and password if necessary. If no port is
  1922.           specified, the regular FTP protocol port (21) is used. The OPEN
  1923.           keyword is optional (unless the hostname conflicts with one of
  1924.           the FTP command keywords, which you can list by typing "ftp
  1925.           ?").
  1926.           
  1927.    The hostname can be an IP host name, numeric IP address, or if you
  1928.    have a network directory active (SET NETWORK DIRECTORY; see Chapter 6
  1929.    of [223]Using C-Kermit), an entry name in the directory. In the latter
  1930.    case, if the given hostname matches exactly one entry, the associated
  1931.    name or address is used; if it matches more than one, Kermit cycles
  1932.    through them until one is found that can be opened; if it matches
  1933.    none, then the hostname is used as-is. If a directory is active but
  1934.    you want to bypass directory lookup, include an "=" sign at the
  1935.    beginning of the hostname, and/or use a numeric IP address.
  1936.    
  1937.    When an FTP connection is opened, the default file-transfer mode is
  1938.    set to binary if the client and server platforms are alike (e.g. both
  1939.    of them are some kind of UNIX), and to text ("ascii") if they are not
  1940.    alike. This has no particular effect for uploading since Kermit
  1941.    automatically switches between text and binary mode for each file, but
  1942.    might be important for downloading. The connection is also set to
  1943.    Stream mode and File structure. Record- or page-oriented file
  1944.    transfers are not supported by C-Kermit's FTP client.
  1945.    
  1946.    The optional FTP OPEN switches are:
  1947.    
  1948.    /ANONYMOUS
  1949.           Logs you in anonymously, automatically supplying username
  1950.           "anonymous" and user@host as the password, based on your local
  1951.           user and host names.
  1952.           
  1953.    /NOLOGIN
  1954.           
  1955.           Overrides SET FTP AUTOLOGIN ON for this connection only.
  1956.           
  1957.    /USER:name
  1958.           Uses the given username to log you in, thus avoiding the Name:
  1959.           prompt.
  1960.           Overrides SET FTP AUTOLOGIN OFF for this connection only.
  1961.           
  1962.    /PASSWORD:text
  1963.           Uses the given text as your password, thus avoiding the
  1964.           Password: prompt. This switch is not recommended for use in
  1965.           script files, which would be a security risk.
  1966.           
  1967.    /ACCOUNT:text
  1968.           Uses the given text as your account (or secondary password,
  1969.           depending on the requirements of the server; most servers do
  1970.           not require or accept an account name). If an account is not
  1971.           supplied, you are not prompted for one.
  1972.           
  1973.    /PASSIVE
  1974.           Opens the connection in passive mode. Passive mode is the
  1975.           default in Kermit's FTP client, unlike in most others, since it
  1976.           works better through firewalls. The /PASSIVE and /ACTIVE
  1977.           switches apply only to the connection that is being opened, and
  1978.           do not affect the global FTP PASSIVE-MODE setting.
  1979.           
  1980.    /ACTIVE
  1981.           Opens the connection in active mode. Use this switch if the
  1982.           server does not support passive mode, or use the command SET
  1983.           FTP PASSIVE-MODE OFF.
  1984.           
  1985.    /NOINIT
  1986.           Added in C-Kermit 8.0.201.   Tells C-Kermit not to send REST,
  1987.           STRU, FEAT, and MODE commands to the server when the connection
  1988.           is opened, since these have been reported to cause confusion in
  1989.           certain servers.
  1990.           
  1991.    When a username or password is missing, a prompt is issued at the
  1992.    controlling terminal and you must type the response; the response can
  1993.    not be scripted. Use the switches to avoid prompts, or one of the
  1994.    secure authentication methods described in the next section, or see
  1995.    [224]SET FTP AUTOLOGIN and the [225]FTP USER and similar commands
  1996.    described later in this section.
  1997.    
  1998.    Examples:
  1999.    
  2000.   ftp open kermit.columbia.edu /anonymous  ; Open and log in anonymously
  2001.   ftp kermit.columbia.edu /anonymous       ; The OPEN keyword can be omitted
  2002.   ftp xyzcorp.com                          ; Open and maybe prompt for username
  2003.   ftp xyzcorp.com /user:olga               ; Open and log in as olga
  2004.   ftp testing.abccorp.com 449              ; Specify a special TCP port number
  2005.   ftp testing.abccorp.com /user:olaf /password:secret 449
  2006.  
  2007.    The FTP OPEN command succeeds if a connection was opened to the server
  2008.    (even if the given username and password were not valid) and fails
  2009.    otherwise (see [226]Section 3.8 for details).
  2010.    
  2011.    When your FTP session is complete, you can terminate it as follows:
  2012.    
  2013.    FTP BYE
  2014.           Closes the FTP connection if one was open. The FTP prefix can
  2015.           be omitted if no other connection is open at the same time (see
  2016.           [227]Section 3.8 for details). If a connection log is active,
  2017.           an FTP record is written to it. If Kermit was started with the
  2018.           -9 command-line option or with its FTP command-line
  2019.           personality, and the -S (Stay) option was not given, AND there
  2020.           is no other active connection, the FTP BYE command also exits,
  2021.           just as it does on a regular FTP client. Synonyms: FTP CLOSE,
  2022.           FTP QUIT (but if the FTP prefix is omitted from QUIT, this
  2023.           becomes the regular Kermit QUIT command, which is equivalent to
  2024.           EXIT; i.e. it closes the connection and exits from Kermit).
  2025.           
  2026.    The following commands can be used to achieve greater control over the
  2027.    connection and login process:
  2028.    
  2029.    SET FTP ANONYMOUS-PASSWORD text
  2030.           Allows you to choose the password text to be sent automatically
  2031.           by Kermit when you open an FTP connection with the /ANONYMOUS
  2032.           switch.
  2033.           
  2034.    SET FTP AUTOLOGIN { ON, OFF }
  2035.           If you give this command prior to opening an FTP connection, it
  2036.           controls whether Kermit tries to log you in automatically as
  2037.           part of the connection process. Normally ON, which means the
  2038.           username and password are sent automatically (and prompted for
  2039.           if they are not yet known). When OFF, FTP OPEN connects to the
  2040.           server without logging in. OFF is equivalent to the -n
  2041.           command-line option when using Kermit's FTP command-line
  2042.           personality.
  2043.           
  2044.    FTP USER name [ password [ account ] ]
  2045.           Used to log in to an FTP server to which a connection has been
  2046.           made without autologin, or when autologin failed. If the
  2047.           password is furnished on the command line, it is used;
  2048.           otherwise you are prompted for a password. An account may also
  2049.           be furnished if required by the server; it is not required by
  2050.           Kermit and is not prompted for if omitted. Synonyms: USER, FTP
  2051.           LOGIN.
  2052.           
  2053.    FTP ACCOUNT text
  2054.           Sends an account name to a server that supports accounts. If
  2055.           the server does not support accounts, an error response occurs.
  2056.           If the server does support accounts, the account is accepted if
  2057.           it is valid and rejected if it is not. The account might be
  2058.           used for charging purposes or it might be a secondary password,
  2059.           or it might be used for any other purpose, such as an access
  2060.           password for a particular disk. Servers that support accounts
  2061.           might or might not allow or require the account to be sent
  2062.           prior to login; usually it is sent after login, if at all.
  2063.           Synonym: ACCOUNT.
  2064.           
  2065.    Example:
  2066.    
  2067. set ftp autologin off                  ; One thing at a time please
  2068. ftp xyzcorp.com                        ; Try to make the connection
  2069. if fail exit 1 FTP connection failed   ; Check that it was made
  2070. ftp user olga secret                   ; Now log in to the server
  2071. if fail exit 1 FTP login failed        ; Check that it worked
  2072. ftp account 103896854                  ; Login OK - send account
  2073. if fail echo WARNING - FTP ACCT failed ; Warn if problem
  2074. ...                                    ; (have session here)
  2075. bye                                    ; Log out and disconnect
  2076.  
  2077.    The following commands are used to control or get information about
  2078.    the FTP connection. Any particular FTP server does not necessarily
  2079.    support all of them.
  2080.    
  2081.    FTP RESET
  2082.           Terminates a user session but leaves the connection open,
  2083.           allowing a new login via FTP USER.
  2084.           
  2085.    FTP IDLE [ number ]
  2086.           Most FTP servers automatically log you out and and disconnect
  2087.           your session if there has been no activity for a certain amount
  2088.           of time. Use this command to ask the server to set its idle
  2089.           limit to the given number of seconds. Omit the number to ask
  2090.           the server to inform you of its current idle limit.
  2091.           
  2092.    FTP STATUS [ filename ]
  2093.           Asks the FTP server to send information about the current
  2094.           session. The result is a free-format report that might include
  2095.           server identification, username and login time, FTP protocol
  2096.           settings, and file-transfer statistics. If a filename is given,
  2097.           the server is supposed to send detailed information about the
  2098.           file.
  2099.           
  2100.    FTP SYSTEM
  2101.           Asks the FTP server to identify its operating system (Listed in
  2102.           Internet Assigned Numbers, Operating System Names). Examples:
  2103.           UNIX, VMS, VM/CMS, WINDOWS-NT. Unfortunately many variations
  2104.           are allowed (e.g. LINUX-2.0, LINUX-2.2, FREEBSD, ULTRIX, etc,
  2105.           instead of UNIX; WINDOWS-NT-3, WINDOWS-NT-3.5, WINDOWS-NT-3.51,
  2106.           WINDOWS-NT-4, etc). The report might also include other
  2107.           information like "Type L8", "Type I", or "Type A", indicating
  2108.           the file-transfer mode.
  2109.           
  2110.    FTP HELP [ keyword [ keyword [ ... ] ]
  2111.           Asks the server to list the commands it supports. The response
  2112.           is usually cryptic, listing FTP command mnemonics, not the
  2113.           commands used by the client (since the server has no way of
  2114.           knowing anything about the client's user interface). For
  2115.           example, the PUT command is STOR in FTP protocol. If a keyword
  2116.           is given, which should be an FTP protocol command,
  2117.           slightly-more- detailed help is given about the corresponding
  2118.           command (if the FTP server supports this feature). Examples:
  2119.           "ftp help", "ftp help stor".
  2120.           
  2121.    FTP SITE text
  2122.           (Advanced) Sends an FTP SITE (site-specific) command. Usually
  2123.           this means that the FTP server is asked to run an external
  2124.           command with the given arguments. You might be able to find out
  2125.           what SITE commands are available by sending "ftp help site" to
  2126.           the server, but in general the availability of and response to
  2127.           SITE commands is (not surprisingly) site specific.
  2128.           
  2129.    FTP QUOTE text
  2130.           (Advanced) Sends an FTP command in FTP protocol format. Use
  2131.           this command to send commands to the server that the FTP client
  2132.           might not know about.
  2133.           
  2134.    SHOW FTP
  2135.           Lists client (Kermit) FTP settings and information. Also SHOW
  2136.           CONNECTION, SHOW COMMUNICATIONS.
  2137.           
  2138.    HELP FTP [ keyword ]
  2139.           Asks Kermit to list and describe its built-in FTP commands.
  2140.           
  2141.    HELP SET FTP [ keyword ]
  2142.           Asks Kermit to list and describe its built-in SET FTP commands.
  2143.           
  2144.    [ [228]Top ] [ [229]FTP Top ] [ [230]C-Kermit Home ] [ [231]Kermit
  2145.    Home ]
  2146.      _________________________________________________________________
  2147.    
  2148.   3.2. Making Secure FTP Connections
  2149.   
  2150.    Also see: [232]Accessing IBM Information Exchange with Kermit.
  2151.    
  2152.    In the previous section, you can see several examples of traditional
  2153.    insecure authentication: username and password sent across the network
  2154.    in clear text. Of course this is bad practice on at least two counts:
  2155.    (1) storing passwords in files (such as script files) gives access to
  2156.    the target systems to anybody who can obtain read access to your
  2157.    scripts; and (2) sending this information over the network leaves it
  2158.    open to interception by network sniffers or compromised hosts.
  2159.    
  2160.    Because of the increasing need for security on the Internet, FTP
  2161.    servers are beginning to appear that offer secure forms of
  2162.    authentication, in which no information is sent over the network that
  2163.    would allow anyone who intercepts it to usurp your identity and gain
  2164.    your access rights.
  2165.    
  2166.    Kermit provides an equivalent form of FTP security for each type of
  2167.    IETF standard security implemented in Telnet. These include
  2168.    GSSAPI-KERBEROS5, KERBEROS4, Secure Remote Password (SRP), and
  2169.    Transport Layer Security (SSL and TLS). It does not presently include
  2170.    SSL tunneling nor any form of SSH v1 or v2. When Kermit is built with
  2171.    the necessary libraries, secure FTP connections are attempted by
  2172.    default, in which all connections are authenticated and the command
  2173.    and data channels are private.
  2174.    
  2175.    The use of authentication and encryption for FTP connections can be
  2176.    adjusted with the commands listed below, which are available only if
  2177.    your version of Kermit was built with the corresponding security
  2178.    options and libraries:
  2179.    
  2180.    SET FTP AUTHTYPE { AUTOMATIC, GSSAPI-KRB5, KERBEROS4, SRP, SSL, TLS }
  2181.           Specifies an ordered list of authentication methods to be
  2182.           attempted when AUTOAUTHENTICATION is ON. The default list is:
  2183.           GSSAPI-KRB5, SRP, KERBEROS_V4, TLS, SSL. If none of the
  2184.           selected methods are supported by the server, an insecure login
  2185.           is used as a fallback. Note, by the way, that SSL or TLS can be
  2186.           used to secure an anonymous connection.
  2187.           
  2188.    SET FTP AUTOAUTHENTICATION { ON, OFF }
  2189.           Tells whether authentication should be negotiated by the FTP
  2190.           OPEN command. Default is ON. Use SET FTP AUTOAUTHENTICATION OFF
  2191.           to force a clear-text, unencrypted connection to FTP servers
  2192.           (such as the one at the Kermit FTP site) that normally would
  2193.           try to negotiate secure authentication and encryption.
  2194.           
  2195.    SET FTP AUTOENCRYPTION { ON, OFF }
  2196.           Tells whether encryption (privacy) should be negotiated by the
  2197.           FTP OPEN command, which can happen only if secure
  2198.           authentication is also negotiated. Default is ON.
  2199.           
  2200.    SET FTP AUTOLOGIN { ON, OFF }
  2201.           Tells Kermit whether to try logging in automatically when you
  2202.           make an FTP connection, as opposed to letting you do it "by
  2203.           hand" with the FTP USER command.
  2204.           
  2205.    SET FTP COMMAND-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE
  2206.           }
  2207.           Determines the level of protection applied to the command
  2208.           channel:
  2209.           
  2210.   CLEAR         Data is sent in plaintext and not protected against tampering.
  2211.   CONFIDENTIAL  Data is encrypted but not protected against tampering.
  2212.   PRIVATE       Data is encrypted and is protected against tampering.
  2213.   SAFE          Data is sent in plaintext but protected against tampering.
  2214.  
  2215.           The default is PRIVATE.
  2216.           
  2217.    SET FTP CREDENTIAL-FORWARDING { ON, OFF }
  2218.           Tells whether end-user credentials are to be forwarded to the
  2219.           server if supported by the authentication method (GSSAPI-KRB5
  2220.           only). This is often required to allow access to distributed
  2221.           file systems (e.g. AFS.)
  2222.           
  2223.    SET FTP DATA-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE }
  2224.           Tells what level of protection is applied to subsequent data
  2225.           channels. The meanings of the protection-level keywords are the
  2226.           same as for SET FTP COMMAND-PROTECTION-LEVEL. The default is
  2227.           PRIVATE.
  2228.           
  2229.    SET FTP SRP CIPHER name
  2230.           Specifies the cipher to be used for encryption when SRP
  2231.           authentication is in use. The list of possible choices is
  2232.           computed based on the capabilities of the local SRP library and
  2233.           includes NONE plus zero or more of the following:
  2234.           
  2235.   BLOWFISH_ECB        CAST5_ECB          DES_ECB          DES3_ECB
  2236.   BLOWFISH_CBC        CAST5_CBC          DES_CBC          DES3_CBC
  2237.   BLOWFISH_CFB64      CAST5_CFB64        DES_CFB64        DES3_CFB64
  2238.   BLOWFISH_OFB64      CAST5_OFB64        DES_OFB64        DES3_OFB64
  2239.  
  2240.           The default is DES3_ECB.
  2241.           
  2242.    SET FTP SRP HASH name
  2243.           Specifies the hash to be used for data protection when SRP
  2244.           authentication is in use. The choices are MD5 and SHA. The
  2245.           default is SHA.
  2246.           
  2247.    Command-line options:
  2248.    
  2249.    -k name
  2250.           Specifies the realm to be used with Kerberos 4 authentication
  2251.           (= SET AUTH K4 REALM name).
  2252.           
  2253.    -f
  2254.           Enables forwarding of Kerberos 5 credentials to the host when
  2255.           using GSSAPI authentication (= SET AUTH K5 FORWARDABLE ON).
  2256.           
  2257.    -x
  2258.           Enables autoencryption (= SET FTP AUTOENCRYPTION ON).
  2259.           
  2260.    -c cipher
  2261.           Specifies the kind of cipher to be used for encryption with SRP
  2262.           authentication. Equivalent to SET FTP SRP CIPHER, with the same
  2263.           choices. If this option is not given, CAST5_CBC is used.
  2264.           
  2265.    -H hash
  2266.           Specifies the hash to be used for encryption with SRP
  2267.           authentication. Equivalent to SET FTP SRP HASH, with the same
  2268.           choices. If this option is not given, SHA is used.
  2269.           
  2270.    -z debug
  2271.           Turns on SSL/TLS debugging.
  2272.           
  2273.    -z secure
  2274.           Requires secure connection.
  2275.           
  2276.    -z certsok
  2277.           Says to accept all certificates without checking validity.
  2278.           
  2279.    -z verify=n
  2280.           Sets certificate verification mode to the given number, n:
  2281.             0 = no verification
  2282.             1 = verify certificate if presented
  2283.             2 = require verification of certificate
  2284.           
  2285.    -z cert=filename
  2286.           Specifies a file containing a client certificate to be
  2287.           presented to the FTP server.
  2288.           
  2289.    -z key=filename
  2290.           Specifies a file containing a private key matching the client
  2291.           certificate.
  2292.           
  2293.    -z !krb4
  2294.           (nokrb4) Disables the use of Kerberos 4.
  2295.           
  2296.    -z !gss
  2297.           
  2298.    -z nogss
  2299.           Disables the use of GSSAPI - Kerberos 5.
  2300.           
  2301.    -z !srp
  2302.           
  2303.    -z nosrp
  2304.           Disables use of SRP.
  2305.           
  2306.    -z !ssl
  2307.           
  2308.    -z nossl
  2309.           Disables the use of SSL.
  2310.           
  2311.    -z !tls
  2312.           
  2313.    -z notls
  2314.           Disables the use of TLS.
  2315.           
  2316.    Caution: If your FTP connection is secured via AUTH TLS, it is not
  2317.    possible to interrupt a file transfer. This is a limitation of all
  2318.    known FTP servers that support AUTH TLS.
  2319.    
  2320.    [ [233]Top ] [ [234]FTP Top ] [ [235]C-Kermit Home ] [ [236]Kermit
  2321.    Home ]
  2322.      _________________________________________________________________
  2323.    
  2324.    3.3. Setting FTP Preferences FTP preferences can be set globally and
  2325.    persistently with the commands in the following sections; many of
  2326.    these can also be overridden on a per-command basis with switches that
  2327.    have the same name.
  2328.    
  2329.     3.3.1. Logs, Messages, and Other Feedback
  2330.     
  2331.    You can control the amount of feedback received from your FTP session
  2332.    with the commands in this section. First, you can create a log of your
  2333.    FTP transfers with the following commands:
  2334.    
  2335.    SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF }
  2336.           Selects the log format. VERBOSE is the default, and is
  2337.           described in [237]the manual. FTP chooses a WU-FTPD format, the
  2338.           same as is used by the popular FTP server. BRIEF creates
  2339.           per-file records in comma-separated-list format. For greater
  2340.           detail, see [238]Section 4.17 of the [239]C-Kermit 7.0 Update
  2341.           Notes.
  2342.           
  2343.    LOG TRANSACTIONS filename
  2344.           Records FTP (or Kermit, or any other protocol) uploads and
  2345.           downloads in the given file using the format selected by the
  2346.           most recent SET TRANSACTION-LOG command, if any, or else the
  2347.           default format.
  2348.           
  2349.    FTP screen messages and displays are controlled by the following
  2350.    commands:
  2351.    
  2352.    SET TRANSFER DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
  2353.           FTP transfers use Kermit's normal file-transfer display styles.
  2354.           Use this command to choose the desired format; the default on
  2355.           most platforms is FULLSCREEN. The display is automatically
  2356.           disabled if Kermit is running in the background or in batch.
  2357.           BRIEF is always used for command-line initiated transfers
  2358.           (unless suppressed by -q). While a file-transfer is in
  2359.           progress, you can interrupt it in the normal Kermit way by
  2360.           typing one of the following keys or key combinations:
  2361.             X - Cancel current file but go on to the next one (if any).
  2362.             Z - Cancel the entire transfer.   Ctrl-L or Ctrl-W - Refresh
  2363.           the file-transfer display (if any).
  2364.           
  2365.    SET FTP DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
  2366.           Like SET TRANSFER DISPLAY, but applies only to FTP connections,
  2367.           and does not affect Kermit- or other protocol file transfers.
  2368.           
  2369.    SET QUIET { ON, OFF }
  2370.           This command applies to Kermit in general, not just FTP. OFF by
  2371.           default; when ON, it surpresses most messages from most
  2372.           commands as well as the file-transfer display.
  2373.           
  2374.    SET FTP PROGRESS-MESSAGES { ON, OFF }
  2375.           Tells whether Kermit should print locally-generated feedback
  2376.           messages for each non-file-transfer command. ON by default.
  2377.           
  2378.    SET FTP VERBOSE-MODE { ON, OFF }
  2379.           Tells whether to display all responses from the FTP server. OFF
  2380.           by default. This shows all responses to all commands, except
  2381.           when the file-transfer display is active, and unless you have
  2382.           SET QUIET ON. When OFF, responses are shown only for commands
  2383.           such as FTP PWD whose purpose is to display a response.
  2384.           
  2385.    SET FTP DEBUG { ON, OFF }
  2386.           Tells whether local client debugging information should be
  2387.           displayed. OFF by default. When ON, the commands that are sent
  2388.           to the server are shown, as well as its responses (even if
  2389.           VERBOSE-MODE is OFF), plus additional informational messages
  2390.           are printed regarding the progress of secure operations. Also,
  2391.           the temporary file created by the [240]MGET command is not
  2392.           deleted so you can see what's in it.
  2393.           
  2394.    Set all of these to OFF when silent running is desired.
  2395.    
  2396.     3.3.2. Operational Preferences
  2397.     
  2398.    FTP DISABLE new-protocol-feature-name
  2399.           
  2400.    FTP ENABLE new-protocol-feature-name
  2401.           Explained in [241]Section 3.11.
  2402.           
  2403.    SET FTP AUTOLOGIN { ON, OFF }
  2404.           If you give this command prior to opening an FTP connection, it
  2405.           controls whether Kermit tries to log you in automatically as
  2406.           part of the connection process. Normally ON, which means the
  2407.           username and password are sent automatically (and prompted for
  2408.           if they are not yet known). When OFF, FTP OPEN connects to the
  2409.           server without logging in. OFF is equivalent to the -n
  2410.           command-line option when using Kermit's FTP command-line
  2411.           personality. See [242]Section 3.1.4 for usage.
  2412.           
  2413.    SET FTP PASSIVE-MODE { ON, OFF }
  2414.           ON by default, to avoid random TCP port assignment for data
  2415.           connections, which can prevent FTP protocol from working
  2416.           through firewalls and network address translators (for more on
  2417.           these topics, see the [243]Kermit security reference. Set to
  2418.           OFF in case the FTP server does not support passive mode, or in
  2419.           case the client has problems with it (it has been observed, for
  2420.           example, that when using passive mode, the SCO XENIX 2.3.4
  2421.           TCP/IP stack hangs in the connect() call forever). Synonyms:
  2422.           PASSIVE [ ON ], PASSIVE OFF, PASV [ ON ], PASV OFF.
  2423.           
  2424.    SET FTP SEND-PORT-COMMANDS { ON, OFF }
  2425.           This command determines whether the FTP client sends a new PORT
  2426.           command to the server when accepting incoming data connections
  2427.           (as when not using passive mode.) When PASSIVE-MODE is OFF and
  2428.           SET SEND-PORT is OFF, the port that was originally specified is
  2429.           reused. This is the default behavior for normal FTP clients but
  2430.           it is not compatible with many firewalls.
  2431.           
  2432.    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
  2433.           Whether to translate character sets when transferring files
  2434.           with FTP (explained in [244]Section 3.7). OFF by default.
  2435.           
  2436.    SET FTP SERVER-CHARACTER-SET name
  2437.           Tells Kermit the character set used by the FTP server, UTF-8 by
  2438.           default ([245]Section 3.7).
  2439.           
  2440.    SET FTP SERVER-TIME-OFFSET delta-time
  2441.           Tells Kermit to apply the given [246]delta time to file
  2442.           timestamps provided by the server for its files; for use when
  2443.           (for example) the server does not have its timezone set
  2444.           correctly.
  2445.           
  2446.    SET FTP ERROR-ACTION { PROCEED, QUIT }
  2447.           When transferring a group of files with FTP, and an error
  2448.           occurs with one of the files, Kermit normally goes on the next
  2449.           file. Use SET FTP ERROR-ACTION to QUIT to make Kermit stop the
  2450.           transfer immediately and fail if an error occurs with any
  2451.           single file in the group. Example: you have given Kermit a list
  2452.           of files to send, and one of the files can not be found, or
  2453.           read permission is denied. Note that cancelling a file by
  2454.           typing 'X' during transfer is not considered an error (if you
  2455.           want to cancel the entire transfer, type 'Z' or Ctrl-C).
  2456.           
  2457.    SET FTP PERMISSIONS { AUTO, ON, OFF }
  2458.           When uploading files with PUT or MPUT, this tells whether
  2459.           Kermit should send each file's permissions. The default is OFF,
  2460.           which means not to send permissions, in which case the uploaded
  2461.           file's permissions are set by the FTP server according to its
  2462.           own criteria. ON means to send them, AUTO means to send them
  2463.           only if the client (Kermit) and server are on like platforms
  2464.           (e.g. both UNIX). This command has no effect when downloading,
  2465.           since the FTP protocol does not include a way for the server to
  2466.           inform the client of a file's permissions. Also see [247]FTP
  2467.           PUT /PERMISSIONS. Note that setting permissions after uploading
  2468.           is likely to work (correctly or at all) only when the client
  2469.           and server platforms are alike (e.g. both of them are some form
  2470.           of UNIX). Also note that Windows files don't have permissions.
  2471.           Also see [248]FTP CHMOD.
  2472.           
  2473.    SET FTP DATES { ON, OFF }
  2474.           When downloading files with GET or MGET, this tells whether
  2475.           Kermit should try to set the received file's date from the
  2476.           server's date. FTP DATES is ON by default. Note, however, that
  2477.           FTP protocol does not allow date preservation when uploading.
  2478.           So at best, SET FTP DATES ON can work only when downloading,
  2479.           and then only when the server agrees to furnish file dates.
  2480.           
  2481.    SET FTP FILENAMES { AUTO, CONVERTED, LITERAL }
  2482.           When uploading (sending) files, this tells whether to convert
  2483.           outbound filenames to "common form". This means allowing only
  2484.           one period in a name, uppercasing any lowercase letters,
  2485.           replacing spaces by underscores, etc. AUTOMATIC is the default,
  2486.           meaning LITERAL when client and server are the same type of
  2487.           system (e.g. UNIX) and CONVERTED otherwise. Special case: if
  2488.           the setting is AUTOMATIC and the client is not UNIX and the
  2489.           server identifies itself as UNIX, Kermit uses a less-strict
  2490.           form of conversion, in which lowercase letters are not
  2491.           uppercased and the filename can contain any number of periods,
  2492.           but spaces are still converted to underscore. When receiving,
  2493.           conversion generally means to change all-uppercase names to
  2494.           lowercase and spaces to underscore.
  2495.           
  2496.    SET FTP UNIQUE-SERVER-NAMES { ON, OFF }
  2497.           Applies only to uploads. Tells the server to create new, unique
  2498.           names for incoming files that have the same names as existing
  2499.           files. OFF by default, in which case the server overwrites
  2500.           existing files with new files of the same name. When ON, the
  2501.           server uses its own built-in method for creating new names for
  2502.           incoming files; for example, appending a period (.) and a
  2503.           number to the name. CAUTION: Use this option only if you do not
  2504.           need to refer to the file after it is uploaded, since FTP
  2505.           protocol provides no mechanism for the client to find out what
  2506.           name was assigned by the server.
  2507.           
  2508.    SET FTP COLLISION { ... }
  2509.           When downloading, what to do if an incoming file has the same
  2510.           name as an existing file. Options are the same as for SET FILE
  2511.           COLLISION. If this command is not given, Kermit's regular FILE
  2512.           COLLISION setting is used. If this command is given, it
  2513.           overrides the FILE COLLISION setting for FTP transfers only.
  2514.           See [249]Section 3.6.2 for details.
  2515.           
  2516.    SET FTP TYPE { TEXT, BINARY, TENEX }
  2517.           Changes the default transfer mode. When sending (uploading)
  2518.           files, this command has no effect unless you disable automatic
  2519.           text/binary mode switching ([250]Section 4) with SET FILE SCAN
  2520.           OFF or SET TRANSFER MODE MANUAL. When receiving (downloading)
  2521.           files, this command establishes the transfer mode to be used
  2522.           when a filename does not match any of Kermit's text or binary
  2523.           filename patterns, unless you use SET FTP
  2524.           GET-FILETYPE-SWITCHING or SET TRANSFER MODE MANUAL to disable
  2525.           automatic switching, in which case, this command establishes
  2526.           the transfer mode for all downloaded files. In all cases,
  2527.           however, the FTP TYPE can be overridden in any GET or PUT
  2528.           command by including a /TEXT (/ASCII), /BINARY, or /TENEX
  2529.           switch. The FTP TYPE is independent of the Kermit FILE TYPE
  2530.           setting. TENEX is used for sending 8-bit binary files to 36-bit
  2531.           platforms such as TOPS-10, TOPS-20, and TENEX, and getting them
  2532.           back again. Synonym: ASCII = TEXT. Note: there is also an FTP
  2533.           TYPE command, which does what SET FTP TYPE does but also sends
  2534.           a TYPE command to the server immediately if the given type is
  2535.           different from the current one.
  2536.           
  2537.    If you want want specific FTP preference settings to be in effect for
  2538.    all your Kermit FTP sessions, put the desired SET FTP commands in your
  2539.    Kermit customization file (~/.mykermrc in UNIX, K95CUSTOM.INI in
  2540.    Windows).
  2541.    
  2542.    [ [251]Top ] [ [252]FTP Top ] [ [253]C-Kermit Home ] [ [254]Kermit
  2543.    Home ]
  2544.      _________________________________________________________________
  2545.    
  2546.   3.4. Managing Directories and Files
  2547.   
  2548.    In Kermit, commands for directory and file management can refer to:
  2549.    
  2550.      * The local computer
  2551.      * A remote computer when you have a connection to a Kermit server or
  2552.        IKSD.
  2553.      * A remote computer when you have a connection to an FTP server.
  2554.        
  2555.    (There can also be an HTTP connection, but the commands in this
  2556.    section don't apply to HTTP connections.)
  2557.    
  2558.    Thus in general, each such command comes in three forms:
  2559.    
  2560.     1. With no prefix in C-Kermit 8.0.200, it refers to the local
  2561.        computer (CD, DIR, etc). In C-Kermit 8.0.201 and later, however,
  2562.        the "locus" switches to automatically to the remote FTP server
  2563.        when you make an FTP connection (see the SET LOCUS description
  2564.        [255]Section 7); thus C-Kermit 8.0.201 acts almost exactly like a
  2565.        regular FTP client when it has an FTP connection, yet still acts
  2566.        like itself on other kinds of connections.
  2567.     2. With the REMOTE prefix, it is for a Kermit server (REMOTE CD,
  2568.        REMOTE DIR).
  2569.     3. With the FTP prefix, it's for an FTP server (FTP CD, FTP DIR).
  2570.     4. Also see [256]Section 3.8, which explains "R-commands" and
  2571.        "L-commands".
  2572.        
  2573.    Kermit's FTP file and directory management commands are as follows.
  2574.    When an R-command is included in the Synonyms list, be sure to read
  2575.    [257]Section 3.8 about rules for use of R-commands.
  2576.    
  2577.    FTP CD [ directory ]
  2578.           Tells the FTP server to change its default (working) directory
  2579.           to the one given, which usually must be expressed in the syntax
  2580.           of the server platform (UNIX, VMS, etc). If the directory is
  2581.           not specified, the result depends on the FTP server -- it might
  2582.           complain that the command is illegal, or it might change to
  2583.           your original login directory. Synonyms: FTP CWD (Change
  2584.           Wording Directory); RCD.
  2585.           
  2586.    FTP CDUP
  2587.           Tells the FTP server to change its default (working) directory
  2588.           to the parent directory of its current one (equivalent to
  2589.           "cd .." in UNIX, or "cd [-]" in VMS). Synonyms: RCDUP, FTP UP.
  2590.           
  2591.    FTP PWD
  2592.           Asks the FTP server to report ("print") its current working
  2593.           directory. Synonym: RPWD.
  2594.           
  2595.    FTP MKDIR directory
  2596.           Asks the FTP server to create the directory whose name is
  2597.           given. In general, the name must be in the syntax of the
  2598.           server's file system, and it must be either absolute (a full
  2599.           pathname) or relative to the server's current (working)
  2600.           directory. This command fails if the directory can't be created
  2601.           for any reason, including that it exists already. Synonym:
  2602.           RMKDIR.
  2603.           
  2604.    FTP RMDIR directory
  2605.           Asks the FTP server to remove the directory whose name is
  2606.           given. The rules are the same as for MKDIR, plus in most cases,
  2607.           the server will not remove any directory unless it is empty.
  2608.           Synonym: RRMDIR.
  2609.           
  2610.    FTP DIRECTORY [ filespec ] [ redirectors ]
  2611.           Tells the FTP server to send a directory listing of the
  2612.           specified files. If no filespec is given, the server lists all
  2613.           files in its current working directory. The results are in
  2614.           whatever format the server chooses to send them. You can use
  2615.           UNIX-like redirectors to send the listing to a file or a
  2616.           pipeline, exactly as with the regular Kermit client/server
  2617.           REMOTE DIRECTORY command ([258]Using C-Kermit, Chapter 11).
  2618.           Synonym: RDIRECTORY. Examples:
  2619.           
  2620.     ftp dir                           ; Show listing of all files on screen
  2621.     ftp dir *.txt                     ; List *.txt files on screen
  2622.     ftp dir *.txt > somefile          ; Put listing in somefile
  2623.     ftp dir *.txt >> somefile         ; Append listing to somefile
  2624.     ftp dir *.txt | sort > somefile   ; Put sorted listing in somefile
  2625.     ftp dir | more                    ; Runs list through "more"
  2626.     ftp dir | sort | more             ; Runs list through "sort" and "more"
  2627.  
  2628.    FTP VDIRECTORY [ filespec ] [ redirectors ]
  2629.           "Verbose" directory. This is an alternative FTP DIRECTORY
  2630.           command primarily for use with DECSYSTEM-20 (TOPS-20) FTP
  2631.           servers, which send only filenames when given a DIRECTORY
  2632.           command; the VDIRECTORY command makes them also send file
  2633.           sizes, dates, and attributes.
  2634.           
  2635.    FTP CHECK filespec
  2636.           Asks the FTP server whether the given file exists or, if the
  2637.           filespec contains wildcards, if any files match, and this
  2638.           command succeeds or fails accordingly.
  2639.           
  2640.    FTP MODTIME filename
  2641.           Asks the FTP server, via the not-yet-standard FTP MDTM command,
  2642.           to send the modification date and time of the given file. The
  2643.           response should be a numeric string in the format:
  2644.           yyyymmddhhmmssxxxxx... where yyyy is the year, mm is the month,
  2645.           dd is the day, hh is the hour (0-23), mm is the minute, ss is
  2646.           the second, and xxx... is the optional fraction of the second
  2647.           (0 or more digits). The date and time is expressed in UTC (GMT,
  2648.           Zulu, Zero-Meridian). The result is available programmatically
  2649.           in the [259]\v(ftp_message) variable, and is understandable by
  2650.           Kermit's date-time switches and functions. For example, suppose
  2651.           we want to upload all local files that are newer than a
  2652.           particular file on the server:
  2653.           
  2654.   C-Kermit> ftp modtime signpost
  2655.   C-Kermit> echo \v(ftp_message)
  2656.   20010807113542.014
  2657.   C-Kermit> ftp mput /after:\v(ftp_message)GMT *
  2658.  
  2659.           Note that we must append "GMT" to the date-time string to let
  2660.           the /AFTER switch know the time is GMT rather than local.
  2661.           
  2662.    FTP SIZE filename
  2663.           Asks the FTP server to send the size (in bytes) of the given
  2664.           file. The result might vary depending on whether the current
  2665.           FTP TYPE is binary or text ("ascii"). For a reliable byte
  2666.           count, do FTP TYPE BINARY first. The result is available
  2667.           programmatically in the [260]\v(ftp_message) variable.
  2668.           
  2669.    FTP CHMOD permissions filename
  2670.           Tells the FTP server to set the permissions (protection) of the
  2671.           given file to the ones given. The permissions and filename must
  2672.           be given in whatever syntax is required by the server. Example
  2673.           (for a UNIX-based FTP server):
  2674.           
  2675.   ftp chmod 664 oofa.txt
  2676.  
  2677.           Not all servers support this command. For non-UNIX-based
  2678.           servers, you might need to use FTP QUOTE or FTP SITE and the
  2679.           appropriate platform-specific FTP server command.
  2680.           
  2681.    FTP UMASK [ number ]
  2682.           This command is probably specific to UNIX-based servers; it
  2683.           sets the UNIX "umask", which is the default permissions mask
  2684.           for new (in this case, incoming) files. Crudely put, the UNIX
  2685.           umask is an octal representation of a binary number in in which
  2686.           a 1 bit stands for a permission bit that must be 0, and a 0 bit
  2687.           stands for a permission bit that can be 0 or 1 depending on
  2688.           other factors, such as the permissions of the parent directory.
  2689.           Example: "umask 007" requires that new files are created
  2690.           without read/write/execute world permission. If the number is
  2691.           not specified, the server's current umask is reported.
  2692.           
  2693.    FTP RENAME filename newname
  2694.           Asks the FTP server to rename the file whose name is "filename"
  2695.           to "newname". Works only for one file; can not be used with
  2696.           wildcards. The server's interpretation of "newname" can vary
  2697.           (in some cases it must be a filename, in others perhaps it can
  2698.           also be a directory name, in which case if the filename denote
  2699.           a regular file, the file might be moved to the given
  2700.           directory). Some servers might allow files to be renamed
  2701.           ("moved") between physical disks or partitions, others might
  2702.           not. Synonym: RRENAME.
  2703.           
  2704.    FTP DELETE [ switches ] filespec [ filespec [ ... ] ]
  2705.           Tells the FTP server to delete the file or files listed. Each
  2706.           file specification may, but need not, contain wildcard
  2707.           characters to match multiple files. File specifications and
  2708.           wildcard syntax must be those of the server. Any file
  2709.           specifications that contain spaces must be enclosed in braces
  2710.           or doublequotes. FTP DELETE switches are:
  2711.           
  2712.  /ERROR-ACTION:  /FILENAMES:     /NOBACKUPFILES  /QUIET
  2713.  /EXCEPT:        /LARGER-THAN:   /NODOTFILES     /NOPAGE
  2714.  /PAGE           /RECURSIVE      /SMALLER-THAN:
  2715.  
  2716.           When used with FTP DELETE, the /RECURSIVE switch deletes files
  2717.           but not directories, and furthermore depends on the server
  2718.           providing recursive file lists, which is not the normal
  2719.           behavior. For further details, see the decriptions of these
  2720.           switches in [261]Section 3.6. Synonyms: FTP MDELETE (Kermit
  2721.           makes no distinction between DELETE and MDELETE); RDELETE.
  2722.           
  2723.    FTP TYPE { TEXT, BINARY, TENEX }
  2724.           Tells the FTP server to change its file-transfer type to the
  2725.           one given, immediately. See [262]SET FTP TYPE for details.
  2726.           
  2727.    [ [263]Top ] [ [264]FTP Top ] [ [265]C-Kermit Home ] [ [266]Kermit
  2728.    Home ]
  2729.      _________________________________________________________________
  2730.    
  2731.   3.5. Uploading Files With FTP
  2732.   
  2733.    Uploading means sending files from the client (Kermit) to the FTP
  2734.    server. The basic command for uploading files with FTP is PUT:
  2735.    
  2736.    FTP PUT [ switches ] [ filespec [ as-name ] ]
  2737.           Uploads (sends) the file or files that match the file
  2738.           specification, which may include wildcards, to the server. If
  2739.           no filespec is given, the names of files to send are taken from
  2740.           the /LISTFILE: file, if any, otherwise from the SEND-LIST, if
  2741.           any. Unless you go out of your way to prevent it, Kermit
  2742.           determines the transfer mode (text or binary) for each file
  2743.           automatically, and switches automatically on a per-file basis.
  2744.           If an as-name is given, the file is sent under that name
  2745.           instead of its own (if an as-name is given with a wildcard
  2746.           filespec, the result is a bit more complicated, and is
  2747.           explained later in this section).
  2748.           
  2749.    Unlike normal FTP clients, Kermit does not prompt you by default (or
  2750.    at all) for each file; it just sends them, just as it does with Kermit
  2751.    protocol. The filespec can be a literal filename or a Kermit pattern,
  2752.    described in:
  2753.    
  2754.   [267]http://www.columbia.edu/kermit/ckermit70.html#x4.9
  2755.  
  2756.    Kermit patterns are equivalent to C-Shell patterns and provide a fair
  2757.    amount of flexibility in selecting which files to send, which is
  2758.    augmented by the file-selection switches presented in [268]Section
  2759.    3.5.1.
  2760.    
  2761.    FTP MPUT [ switches ] filespec [ filespec [ ... ] ]
  2762.           FTP MPUT is just like FTP PUT except it allows you to give more
  2763.           than one file specification, and it does not allow an as-name
  2764.           in the file list. However, as-names can be given to either PUT
  2765.           or MPUT with the /AS-NAME: switch.
  2766.           
  2767.    If a PUT or MPUT command results in one file being uploaded, it
  2768.    succeeds if the file is uploaded completely and fails otherwise. If
  2769.    more than one file is selected for upload, success or failure depends
  2770.    on the [269]FTP ERROR-ACTION setting; if it is PROCEED (the default
  2771.    setting), then the [M]PUT command succeeds if at least one of the
  2772.    files was completely uploaded, and fails otherwise, If FTP
  2773.    ERROR-ACTION is QUIT, the [M]PUT command succeeds if all selected
  2774.    files were uploaded successfully, and fails if any file failed.
  2775.    
  2776.    FTP uploads may be interrupted just like Kermit uploads. While the
  2777.    transfer is in progress, type:
  2778.    
  2779.   X to interrupt the current file and go on to the next file.
  2780.   Z to cancel the current file and all remaining files.
  2781.   ^C (Control-C): Like Z, but might act more quickly.
  2782.  
  2783.    MPUT may be used as in regular FTP clients, but it is not required to
  2784.    send multiple files; in Kermit it is required only if you want to give
  2785.    multiple file specifications. Examples:
  2786.    
  2787.   ftp put oofa.txt               ; Send a single file oofa.txt
  2788.   ftp put oofa.txt budget.txt    ; Send single file oofa.txt as budget.txt
  2789.   ftp put *.txt                  ; Send all *.txt files
  2790.   ftp mput *.txt                 ; Send all *.txt files (same as "put *.txt")
  2791.   ftp mput *.txt foo.bar         ; Send all *.txt files plus foo.bar
  2792.  
  2793.    The distinction between PUT and MPUT is important only when more than
  2794.    one filespec is given, just like the distinction between Kermit SEND
  2795.    and MSEND:
  2796.    
  2797.   ftp put oofa.txt budget.txt    ; Send oofa.txt AS budget.txt
  2798.   ftp mput oofa.txt budget.txt   ; Send oofa.txt AND budget.txt
  2799.  
  2800.    If the source file specification includes any path segments, for
  2801.    example:
  2802.    
  2803.   put /tmp/oofa.txt
  2804.   put subdir/another/andanother/oofa.txt
  2805.  
  2806.    the path portion is stripped from the filename that is sent to the
  2807.    server. However, if an as-name contains a path, it is retained.
  2808.    Examples:
  2809.    
  2810.   ftp put /usr/doc/oofa.txt      ; Send as "oofa.txt".
  2811.   ftp put oofa.txt /tmp/oofa.txt ; Send as "/tmp/oofa.txt"
  2812.  
  2813.    The latter example sends the file oofa.txt from your current local
  2814.    directory to the server's /tmp directory. This works only if the
  2815.    server uses the same directory notation that you used in the as-name
  2816.    AND the given directory already exists on the server AND if you have
  2817.    write access to it.
  2818.    
  2819.    Use caution when uploading from a case-sensitive file system, such as
  2820.    UNIX, to a file system that is not case sensitive, such as Windows or
  2821.    VMS. If you have two files in UNIX, AA and aa and upload both of them,
  2822.    the second one will overwrite the first. The only way around this
  2823.    provided by FTP protocol is its "unique server names" feature (SET FTP
  2824.    UNIQUE-SERVER-NAMES or the /UNIQUE switch described below).
  2825.      _________________________________________________________________
  2826.    
  2827.     3.5.1. FTP PUT Switches
  2828.     
  2829.    FTP PUT and MPUT are similar in format and behavior to the regular
  2830.    Kermit SEND and MSEND commands, and they allow most of the same
  2831.    optional switches:
  2832.    
  2833. C-Kermit>ftp put ? Filename, or switch, one of the following:
  2834.  /after:                 /larger-than:           /rename-to:
  2835.  /array:                 /listfile:              /server-character-set:
  2836.  /as-name:               /local-character-set:   /server-rename-to:
  2837.  /before:                /move-to:               /simulate
  2838.  /binary                 /nobackupfiles          /smaller-than:
  2839.  /command                /nodotfiles             /tenex
  2840.  /delete                 /nofollowlinks          /text
  2841.  /dotfiles               /not-after:             /transparent
  2842.  /error-action:          /not-before:            /type:
  2843.  /except:                /permissions:           /update
  2844.  /filenames:             /quiet                  /unique-server-names
  2845.  /filter:                /recover
  2846.  /followlinks            /recursive
  2847.  
  2848.    Since most of these switches are common to Kermit's SEND and MSEND
  2849.    commands, they described only briefly here. For greater detail see:
  2850.    
  2851.      [270]http://www.columbia.edu/kermit/ckermit70.html#x1.5 (explanation
  2852.    of switches)
  2853.      [271]http://www.columbia.edu/kermit/ckermit70.html#x4.7
  2854.    (file-transfer switches)
  2855.    
  2856.    First the file-selection switches:
  2857.    
  2858.    /AFTER:date-time
  2859.           
  2860.    /BEFORE:date-time
  2861.           
  2862.    /NOT-AFTER:date-time
  2863.           
  2864.    /NOT-BEFORE:date-time
  2865.           Only send those files modified on or after or before the given
  2866.           date and time. These switches can be combined to select files
  2867.           modified between two date/times. Various date-time formats are
  2868.           accepted; if the date-time contains spaces, it must be enclosed
  2869.           in braces or doublequotes. See
  2870.           [272]http://www.columbia.edu/kermit/ckermit70.html#x1.6 and
  2871.           [273]Section 8.13 of this document for details about date-time
  2872.           formats. Examples:
  2873.           
  2874.   ftp put /after:{1 jan 2000 0:00:00} *
  2875.   ftp put /after:-5days *
  2876.  
  2877.    /LARGER-THAN:number
  2878.           
  2879.    /SMALLER-THAN:number
  2880.           Only send files larger (smaller) than the given number of bytes
  2881.           (octets). These switches can be combined to select files in a
  2882.           certain size range.
  2883.           
  2884.    /TYPE:{TEXT,BINARY}
  2885.           Only send files that are the given type, which is determined
  2886.           for each file just before sending it by file scanning. BINARY
  2887.           includes TENEX; if you have included a /TENEX switch, or
  2888.           previously given a [SET] FTP TYPE TENEX command, binary files
  2889.           are sent in TENEX, rather than BINARY mode.
  2890.           
  2891.    /[NO]DOTFILES
  2892.           [Don't] include files whose names begin with dot (.). By
  2893.           default, such files are not included unless your filespec
  2894.           explicitly mentions them.
  2895.           
  2896.    /NOBACKUPFILES
  2897.           Don't include files whose names end with .~nnn~, where nnn is a
  2898.           number, e.g. oofa.txt.~27~. These are backup files created by
  2899.           Kermit, EMACS, and other applications. By default, backup files
  2900.           are included.
  2901.           
  2902.    /NOFOLLOWLINKS
  2903.           (UNIX only) Skip over symbolic links rather than following them
  2904.           (default). This applies to wildcard and/or recursive [M]PUTs;
  2905.           if a single filename is given, and it happens to be a symbolic
  2906.           link, the file it points to is sent.
  2907.           
  2908.    /FOLLOWLINKS
  2909.           (UNIX only) Always follow (resolve) symbolic links, even in
  2910.           wildcard or recursive [M]PUTs. Use with caution. Watch out for
  2911.           circular links, endless loops, etc.
  2912.           
  2913.    /EXCEPT:pattern
  2914.           Exception list -- don't send files whose names match the given
  2915.           pattern. See [274]Section 1.5.4 of the [275]C-Kermit 7.0 Update
  2916.           Notes for details. If you want to exclude a directory from a
  2917.           recursive [M]PUT, use /EXCEPT:{dirname/*}.
  2918.           
  2919.    /RECURSIVE
  2920.           Sends the desired files from the current (or given) directory,
  2921.           plus all directories beneath it, including empty directories,
  2922.           replicating the directory structure on the server. No special
  2923.           capabilities are required in the server, but of course your
  2924.           login ID on the server must have the appropriate access and
  2925.           permission to create directories. Recursive PUTs work not only
  2926.           between like platforms (e.g. UNIX to UNIX) but also between
  2927.           unlike ones (e.g. UNIX to VMS or Windows), in which case
  2928.           text-file format differences are handled by Kermit's automatic
  2929.           text/binary mode switching ([276]Section 4) and character-set
  2930.           translation ([277]Section 3.7). Synonym: /SUBDIRECTORIES.
  2931.           
  2932.    /UPDATE
  2933.           Send only files that have changed since last time ([278]Section
  2934.           3.5.2).
  2935.           
  2936.    /ARRAY:arrayname
  2937.           The "file" to be sent is an array, or a segment of one, rather
  2938.           than a real file. In this case the other selection switches
  2939.           don't apply. The array contents are sent in text mode, and each
  2940.           array element is treated as a line. Example:
  2941.           
  2942.  
  2943.   ftp put /as-name:array.txt /array:&a
  2944.  
  2945.    (or, to send a segment of the array, /array:&a[100:199]). If you don't
  2946.           include an /AS-NAME, a name of "_array_x_" is used (where x is
  2947.           the array letter). If you include this switch, most other
  2948.           switches are meaningless and ignored.
  2949.           
  2950.    /COMMAND
  2951.           The "file" to be sent is the standard output of a command,
  2952.           rather than a real file. It is sent in text or binary mode
  2953.           according to the prevailing FTP TYPE, which can be overridden
  2954.           with a /TEXT or /BINARY switch. Example: Example:
  2955.           
  2956.  
  2957.   ftp put /command /as-name:{userlist} {finger | sort -r}
  2958.  
  2959.    /LISTFILE:filename
  2960.           Tells Kermit to obtain the list of files to be sent from the
  2961.           file whose name is given. This file must contain one file
  2962.           specification (which may be wild) per line. If the list
  2963.           includes files from different directories, such as a recursive
  2964.           listing of a directory tree, the paths are recreated on the
  2965.           server (if possible) if you include the /RECURSIVE switch;
  2966.           otherwise all the files are sent to the current directory on
  2967.           the server.
  2968.           
  2969.    Now the other switches:
  2970.    
  2971.    /AS-NAME:text
  2972.           If a single file is being sent, send it with the given text as
  2973.           its name. If multiple files are being sent, the text must be a
  2974.           template that includes variables such as \v(filename),
  2975.           \v(filenumber), \v(ntime), to allow dynamic creation of each
  2976.           name. The same applies to the as-name field of the FTP PUT
  2977.           command. If this switch is not included (and an as-name is not
  2978.           included as the second filename to PUT), each file is sent with
  2979.           its own name.
  2980.           
  2981.    /BINARY
  2982.           
  2983.    /TEXT
  2984.           
  2985.    /TENEX
  2986.           Forces this upload to take place in the given mode, regardless
  2987.           of the current FTP TYPE setting, and without automatic
  2988.           text/binary switching. /ASCII is a synonym for /TEXT.
  2989.           
  2990.    /FILTER:command
  2991.           Specifies that the file(s) is/are to be passed through the
  2992.           given command or pipeline on their way to the server. Example:
  2993.           
  2994.   ftp put /binary /filter:{gzip -c \v(filename)} /as-name:\v(filename).gz *
  2995.  
  2996.    /TRANSPARENT
  2997.           
  2998.    /LOCAL-CHARACTER-SET:name
  2999.           
  3000.    /SERVER-CHARACTER-SET:name
  3001.           Character-set translation for text files, explained in
  3002.           [279]Section 3.7.
  3003.           
  3004.    /ERROR-ACTION:{PROCEED,QUIT}
  3005.           Overrides the prevailing [280]FTP ERROR-ACTION for the duration
  3006.           of this PUT or MPUT command only.
  3007.           
  3008.    /RECOVER
  3009.           Resume an interrupted transfer where from the point of
  3010.           interruption (explained in [281]Section 3.5.2). Synonym:
  3011.           /RESTART.
  3012.           
  3013.    /DELETE
  3014.           Tells Kermit to delete each source file immediately after, and
  3015.           only if, it has been uploaded completely and successfully.
  3016.           This, in effect, moves the file from the client to the server.
  3017.           
  3018.    /MOVE-TO:directory
  3019.           Tells Kermit to move each source file to the named local
  3020.           directory after, and only if, it has been uploaded completely
  3021.           and successfully.
  3022.           
  3023.    /RENAME-TO:template
  3024.           Tells Kermit to rename each (local) source file according to
  3025.           the given template after, and only if, it has been uploaded
  3026.           completely and successfully. The template works as in /AS-NAME.
  3027.           
  3028.    /SERVER-RENAME-TO:template
  3029.           Tells Kermit to ask the server to rename each file according to
  3030.           the given template as soon as, and only if, it has been
  3031.           received completely and successfully. The template works as in
  3032.           /AS-NAME. Requires write and rename access on the server, so
  3033.           doesn't usually work with (e.g.) anonymous uploads to public
  3034.           incoming areas where the permissions don't allow renaming.
  3035.           Examples:
  3036.           
  3037.         ftp mput /server-rename:\v(filename).ok *
  3038.                 Appends ".ok" to each filename on the server when it's
  3039.                 finished uploading.
  3040.                 
  3041.         ftp mput /as-name:\v(filename).tmp /server-rename:\v(filename) *
  3042.                 This is the reverse of the previous example; it uses a
  3043.                 temporary name while uploading is in progress and reverts
  3044.                 the file to its real name when uploading is complete.
  3045.                 
  3046.         ftp mput /as-name:\v(filename)
  3047.                 /server-rename:../final/\v(filename) *
  3048.                 Moves the file from the working directory to a final
  3049.                 directory when the upload is complete, but in this case
  3050.                 you have to know the pathname syntax of the server. If
  3051.                 the rename fails, the [M]PUT command fails according to
  3052.                 the [282]FTP ERROR-ACTION selection.
  3053.                 
  3054.    /FILENAMES:{AUTOMATIC,CONVERTED,LITERAL}
  3055.           Overrides the [283]FTP FILENAMES setting for this upload only.
  3056.           
  3057.    /PERMISSIONS:{ON,OFF}
  3058.           Overrides the [284]FTP PERMISSIONS setting for this upload
  3059.           only.
  3060.           
  3061.    /UNIQUE
  3062.           Tells Kermit to tell the server to give [285]unique names to
  3063.           incoming files that would otherwise overwrite existing files
  3064.           that have the same name. This switch conflicts with /UPDATE,
  3065.           /RECOVER, /PERMISSIONS, and /SERVER-RENAME since the client has
  3066.           no way of knowing the name assigned by the server.
  3067.           
  3068.    /QUIET
  3069.           Don't display file-transfer progress or statistics.
  3070.           
  3071.    /SIMULATE
  3072.           Shows which files would be sent without actually sending them.
  3073.           Useful (for example) with /UPDATE (next section). The results
  3074.           are shown in the file-transfer display (if it is not disabled)
  3075.           and in the transaction log (if one is active). Hint: use SET
  3076.           TRANSFER DISPLAY BRIEF.
  3077.      _________________________________________________________________
  3078.    
  3079.     3.5.2. Update Mode
  3080.     
  3081.    When you include the /UPDATE switch, this means to skip sending any
  3082.    file that already exists on the server if the local file's
  3083.    modification date/time is not later than that of the corresponding
  3084.    file on the server. Here is a typical application for update mode:
  3085.    Suppose that on Computer A, you maintain a large set of files (say, a
  3086.    collection of Web pages and graphics images, or the source files for a
  3087.    software application), and you need to keep a parallel copy on another
  3088.    Computer, B. Of course you could upload the entire collection every
  3089.    day:
  3090.    
  3091.   cd source-directory
  3092.   ftp computerb.xyzcorp.com
  3093.   ( authentication details... )
  3094.   ftp cd target-directory
  3095.   ftp put [ switches ] *
  3096.  
  3097.    But if the total size is large or the network slow, this would be
  3098.    unnecessarily time-consuming. Worse, if other users or sites had to
  3099.    update whenever new files appeared in B's directory, this would cause
  3100.    them unnecessary work. By including the /UPDATE switch:
  3101.    
  3102.   ftp put /update [ other-switches ] *
  3103.  
  3104.    only those files that changed since last time are uploaded. Here's how
  3105.    it works. For each local file that is selected for uploading:
  3106.    
  3107.      * The remote filename is determined in the normal way, according to
  3108.        the [286]FTP FILENAMES setting, /FILENAMES switch, or the as-name,
  3109.        if any.
  3110.      * Kermit sends an MDTM (modification time) command for the
  3111.        corresponding remote filename to the server.
  3112.      * If the server does not understand the MDTM command, the file is
  3113.        sent.
  3114.      * If the server can't find a file with the given name, the file is
  3115.        sent.
  3116.      * If the local file's modification time is later than that of the
  3117.        remote file, the file is sent.
  3118.      * Otherwise -- the remote file exists but its modification time is
  3119.        equal to or earlier than that of the local file -- the file is
  3120.        skipped.
  3121.        
  3122.    All time comparisons take place in Coordinated Universal Time
  3123.    (UTC)([287]1), also known as GMT or Zulu time: Timezone 0; standard
  3124.    time, without daylight savings.
  3125.    
  3126.      WARNING: Some FTP servers, such as Novell NWFTPD.NLM, ignore or
  3127.      misimplement the FTP specification and send local time rather than
  3128.      UTC.
  3129.      
  3130.    Update mode is useful only when always used in the same direction.
  3131.    When you upload (PUT) a file with FTP, the destination file receives
  3132.    the current timestamp on the server's computer, not the original
  3133.    file's timestamp ([288]2). If you try to FTP PUT /UPDATE the same file
  3134.    again, it will be skipped (as expected) since the remote copy is
  3135.    newer. However, if you try to FTP GET /UPDATE the same file
  3136.    ([289]Section 3.6), it will be transferred for the same reason.
  3137.    
  3138.    To check the availability of PUT /UPDATE on a particular connection,
  3139.    issue an FTP MODTIME command for a file that is known to exist on the
  3140.    server. If it succeeds, PUT /UPDATE should work and in that case, you
  3141.    can run a procedure like the one above every day: the first time, it
  3142.    sends all the files; after that, it sends only the ones that changed.
  3143.    If a transaction log is active, a notation is included for any files
  3144.    that are skipped.
  3145.    
  3146.    Notes:
  3147.     1. Why is Coordinated Universal Time abbreviated UTC? From the
  3148.        [290]National Institute of Standards and Technology FAQ: "In 1970
  3149.        the Coordinated Universal Time system was devised by an
  3150.        international advisory group of technical experts within the
  3151.        International Telecommunication Union (ITU). The ITU felt it was
  3152.        best to designate a single abbreviation for use in all languages
  3153.        in order to minimize confusion. Since unanimous agreement could
  3154.        not be achieved on using either the English word order, CUT, or
  3155.        the French word order, TUC, the acronym UTC was chosen as a
  3156.        compromise."
  3157.     2. The Kermit FTP client is unusual in that, when downloading only,
  3158.        it can set the received file's date from the file's date on the
  3159.        server, but this should not affect the update feature. When
  3160.        uploading to an FTP server, however, there is no mechanism for the
  3161.        client to set the date of the uploaded file on the server.
  3162.      _________________________________________________________________
  3163.    
  3164.     3.5.3 Recovery
  3165.     
  3166.    Suppose that while you are uploading a large file over a slow
  3167.    connection, the connection is lost before the entire file is
  3168.    transferred. With most FTP clients, you would have to start over, thus
  3169.    resending the portion of the file that was sent already, and that is
  3170.    already on the server. But Kermit's /RECOVER switch (Synonym:
  3171.    /RESTART) lets you continue an interrupted transfer from the point of
  3172.    failure, thus transferring only the part that wasn't sent already. The
  3173.    prerequisites for recovery are:
  3174.    
  3175.      * The transfer must be in BINARY mode, or else the client and server
  3176.        must reside on like systems (e.g. both on some form of UNIX).
  3177.      * The FTP server must support the SIZE command.
  3178.        
  3179.    Here's how it works. When you include the /RECOVER switch:
  3180.    
  3181.      * Kermit checks for conflicting switches, such as /UPDATE and
  3182.        /UNIQUE; if /RECOVER is given with these switches an error occurs.
  3183.        If /RECOVER is given in other circumstances where it could serve
  3184.        no useful purpose (e.g. with arrays, pipes, or filters), it is
  3185.        ignored.
  3186.        
  3187.    If the switch is accepted, then for each selected file:
  3188.    
  3189.      * If it is not binary (determined by scanning) and the client and
  3190.        server are not on like platforms, recovery is canceled (the entire
  3191.        file is sent). Otherwise:
  3192.      * A SIZE command is sent for the file (using its remote name). If
  3193.        the reply indicates the file was not found, or the SIZE command
  3194.        was not understood, or any other kind of error, recovery is
  3195.        canceled. Otherwise:
  3196.      * A MDTM (modification time) command is sent for the file. If a
  3197.        valid reply is received, and the modification time of the local
  3198.        file is later than that of the remote file, recovery is canceled.
  3199.        Otherwise:
  3200.      * If the sizes of the two files are identical, the file is not sent.
  3201.        Otherwise:
  3202.      * Kermit seeks to the recovery spot in the local file, tells the
  3203.        server to APPEND the data which is about to arrive to the remote
  3204.        file, and then sends the data starting at the recovery point.
  3205.        
  3206.    To safeguard file integrity, recovery is not attempted unless all the
  3207.    preconditions are met. For the widest possible usefulness, APPEND is
  3208.    used rather than RESTART. For stream transfers (the only kind that
  3209.    Kermit supports) the results are the same.
  3210.    
  3211.    By design, the /RECOVER switch can be included with any FTP PUT or
  3212.    MPUT command, even if it specifies a group of files. This allows you
  3213.    to resume an interrupted batch transfer from where it left off. The
  3214.    files that were already completely sent are skipped, the file that was
  3215.    interrupted is recovered, and the remaining files are uploaded.
  3216.    
  3217.    By the way, it doesn't matter how the original partial file was
  3218.    uploaded -- FTP, Kermit, Zmodem, etc: as long as the preconditions are
  3219.    met, it can be recovered with FTP PUT /RECOVER, or for that matter
  3220.    also using Kermit protocol and SEND /RECOVER.
  3221.    
  3222.    A word of caution, however, when the original upload was in text mode
  3223.    with character-set translation ([291]Section 3.7):
  3224.    
  3225.      * If the original upload involved a translation from one single-byte
  3226.        character set to another (e.g. Code Page 850 to Latin-1), recovery
  3227.        is safe if you specify the same translations for the recovery. If
  3228.        you don't, the resulting file will contain a mixture of character
  3229.        sets.
  3230.      * If the original upload involved a translation that changed the
  3231.        size of the file (e.g. from an alphabetic Code Page or Latin
  3232.        Alphabet to Unicode, or vice versa), recovery is NOT safe, even if
  3233.        you specify the same translations.
  3234.        
  3235.    Kermit has no way of knowing anything about the previous upload. As a
  3236.    safeguard, an error occurs if you include /RECOVER and also specify a
  3237.    character-set of UCS2 or UTF8, since recovery can't possibly work in
  3238.    that situation. Otherwise, it's up to you to avoid unsafe recovery
  3239.    operations.
  3240.    
  3241.    [ [292]Top ] [ [293]FTP Top ] [ [294]C-Kermit Home ] [ [295]Kermit
  3242.    Home ]
  3243.      _________________________________________________________________
  3244.    
  3245.   3.6. Downloading Files With FTP
  3246.   
  3247.    Although uploading files with Kermit's FTP client is just as easy and
  3248.    flexible as sending files with Kermit protocol, the same is not always
  3249.    true for downloading because FTP servers lack some of the capabilities
  3250.    of a Kermit server:
  3251.    
  3252.      * If you want to get more than one file, you have to use MGET, not
  3253.        GET, since the underlying FTP protocol is different in the two
  3254.        cases. Kermit can't "autodetect" which one you mean, as it can
  3255.        with PUT and MPUT, since it can't be expected to know the wildcard
  3256.        syntax of the remote platform and/or FTP server (the same is true
  3257.        for all other FTP clients). To complicate matters, FTP protocol
  3258.        now includes two underlying mechanisms (NLST and MLSD) for
  3259.        accomplishing MGET operations and, as explained in [296]Section
  3260.        3.11, the two behave differently.
  3261.      * Automatic text-binary mode switching is not done by the server. It
  3262.        can be done by the client (Kermit), but in this case it is not
  3263.        based on a file scan (since there is no way for Kermit prescan a
  3264.        server file), but rather on the filename, using C-Kermit 7.0
  3265.        [297]filename patterns.
  3266.      * Some options that are available with FTP PUT can not be used with
  3267.        FTP [M]GET or don't work the same way:
  3268.          /PERMISSIONS (FTP protocol has no mechanism for this).
  3269.          /[NOT-]BEFORE, /[NOT-]AFTER (because of the timezone problem).
  3270.          /RECOVER works only in binary mode.   /RECURSIVE has limited
  3271.        utility.
  3272.        
  3273.    The commands for downloading are:
  3274.    
  3275.    SET FILE DOWNLOAD-DIRECTORY [ directory ]
  3276.           As with Kermit transfers, this command, if given, tells
  3277.           C-Kermit where to store incoming files in the absence of a
  3278.           specific as-name. If not given, incoming files are stored as
  3279.           indicated by the as-name, if any, otherwise in the current
  3280.           directory, just as with Kermit transfers. The more verbose
  3281.           transfer display formats give the full pathname of each
  3282.           received file, and, in case you have trouble finding a
  3283.           downloaded file afterwards, its full path is also listed in the
  3284.           transaction log (if you kept one), and you can also ask Kermit
  3285.           where it went with the [298]WHERE command.
  3286.           
  3287.    SET FTP GET-FILETYPE-SWITCHING { ON, OFF }
  3288.           ON by default, causing Kermit to switch automatically into text
  3289.           or binary mode for each file based on whether its name matches
  3290.           a text pattern or binary pattern. Set this OFF, or use a /TEXT,
  3291.           /BINARY, or /TENEX switch to defeat this feature. Use SHOW
  3292.           PATTERNS to see the current pattern list.
  3293.           
  3294.    [ FTP ] GET [ switches ] filename [ as-name ]
  3295.           Asks the server to send the given file, and if it comes, stores
  3296.           it locally under the given as-name, if any, otherwise under its
  3297.           original name (modified according to the selected filename
  3298.           conversion option), in your download directory, if you have
  3299.           specified one, otherwise in the directory indicated in the
  3300.           as-name, if any, otherwise in your current directory. If you
  3301.           accidentally use a wildcard in the filename ("get *.txt") the
  3302.           server will reply with a message like "File not found" (unless
  3303.           there is a file whose name actually is "*.txt"). If FTP
  3304.           GET-FILETYPE-SWITCHING is ON, and in the absence of any GET
  3305.           switches to override it, the file is transferred in binary mode
  3306.           if it matches any of Kermit's binary name patterns, and in text
  3307.           mode if it matches any of Kermit's text name patterns, and in
  3308.           the prevailing FTP TYPE if it matches none of these patterns.
  3309.           
  3310.    [ FTP ] MGET [ switches ] filespec [ filespec [ filespec [ ... ] ] ]
  3311.           Like GET, but for multiple files. One or more file
  3312.           specifications can be given, and any or all (or none) of them
  3313.           can contain wildcards or can be directory names. The file list
  3314.           may not include an as-name, but you can still give one with the
  3315.           /AS-NAME: switch.
  3316.           
  3317.    In both the FTP GET and MGET commands, any filenames that contain
  3318.    spaces must be enclosed in braces or doublequotes (see [299]Section 5
  3319.    for details).
  3320.    
  3321.    FTP downloads may be interrupted just like Kermit transfers. While the
  3322.    transfer is in progress, type:
  3323.    
  3324.      * X to interrupt the current file and go on to the next file.
  3325.      * Z (or Control-C) to cancel the current file and all remaining
  3326.        files.
  3327.        
  3328.    Before proceeding, a brief word about temporary files. In FTP
  3329.    protocol, the MGET command works by requesting a file list from the
  3330.    server, and then (internally) issuing a GET command (FTP RETR protocol
  3331.    directive) for each file. The file list returned by the server can be
  3332.    any size at all, so in case it is huge, we don't store it in memory;
  3333.    instead we put it in a temporary file. For troubleshooting purposes,
  3334.    you should be aware of two points:
  3335.    
  3336.     1. The location of the temporary file is chosen according the TMP or
  3337.        TEMP environment variables. If neither of these variables is
  3338.        defined, you might need to define it. In case there is not enough
  3339.        space on the indicated disk or partition for the server's file
  3340.        list, you might need to either clean up the temporary area, or
  3341.        redefine the environment variable to indicate a different area
  3342.        that has sufficient space.
  3343.     2. If you want to look at the list yourself, use SET FTP DEBUG ON.
  3344.        This tells Kermit to (a) give you the full pathname of the
  3345.        temporary file at the end of each MGET command, and (b) not to
  3346.        delete it, as it normally does.
  3347.      _________________________________________________________________
  3348.    
  3349.     3.6.1. FTP GET Switches
  3350.     
  3351.    The following switches are available with FTP GET and MGET:
  3352.    
  3353.    /TEXT
  3354.           Specifies a text-mode transfer. Overrides the global FTP TYPE
  3355.           setting and filename pattern-matching for the duration of the
  3356.           current command only, All files are downloaded in text mode.
  3357.           Synonym: /ASCII.
  3358.           
  3359.    /BINARY
  3360.           Specifies a binary-mode transfer. Overrides the global FTP TYPE
  3361.           setting and filename pattern-matching for the duration of the
  3362.           current command only. All files are downloaded in binary mode.
  3363.           
  3364.    /TENEX
  3365.           Like /BINARY but specifies a special binary transfer mode to be
  3366.           used when getting 8-bit binary files from a 36-bit platform
  3367.           such as TOPS-10, TOPS-20, or TENEX. All files are downloaded in
  3368.           the special binary mode.
  3369.           
  3370.    /RECOVER
  3371.           This instructs Kermit to try to recover an incomplete download
  3372.           from the point of failure. Works only in binary mode, and only
  3373.           if the server supports the (not-yet-standard) FTP "REST"
  3374.           directive. See [300]Section 3.6.3 for details. Synonym:
  3375.           /RESTART.
  3376.           
  3377.    /FILENAMES:{CONVERTED,LITERAL}
  3378.           Overrides the [301]FTP FILENAMES (filename conversion) setting
  3379.           for this download only, forcing incoming filenames to be either
  3380.           converted or taken literally.
  3381.           
  3382.    /AS-NAME:text
  3383.           For GET, this is equivalent to giving an as-name after the
  3384.           filename. For MGET, this is the only way to specify alternative
  3385.           names for the incoming files. With MGET, the /AS-NAME text
  3386.           should (must) contain a Kermit variable, usually \v(filename)
  3387.           or \v(filenumber). Example:
  3388.           
  3389.   mget /text /as-name:\v(filename).new *.c
  3390.  
  3391.           This gets all ".c" files and stores them with "
  3392.           
  3393.           .new" appended to their names. See the [302]C-Kermit 7.0 Update
  3394.           Notes for details.
  3395.           
  3396.    /COMMAND
  3397.           This specifies that the incoming file is to be written to the
  3398.           standard input of a command, rather than to a file. The command
  3399.           name is the as-name from the GET command or the /AS-NAME
  3400.           argument. If you need to refer to the incoming file's name in
  3401.           the command, use \v(filename). See the description of the
  3402.           regular Kermit [303]GET /COMMAND command for details and
  3403.           examples.
  3404.           
  3405.    /QUIET
  3406.           Transfers the files quietly; don't put up a file-transfer
  3407.           display.
  3408.           
  3409.    /ERROR-ACTION:{QUIT,PROCEED}
  3410.           This switch affects only MGET. If an error occurs with a
  3411.           particular file, this tells whether to go on to the next file
  3412.           (PROCEED) or to stop right away and fail (QUIT). The default is
  3413.           PROCEED.
  3414.           
  3415.    The file selection switches are:
  3416.    
  3417.    /EXCEPT:{pattern} or /EXCEPT:{{pattern}{pattern}{...}}
  3418.           Exception list for MGET; skip downloading any file whose name
  3419.           matches any of the given patterns (when using the second
  3420.           format, up to 64 patterns may be specified). [304]CLICK HERE
  3421.           for syntax details.
  3422.           
  3423.    /SMALLER-THAN:number
  3424.           Download only files whose size is smaller than the given number
  3425.           of bytes (octets). Requires that the FTP server support the
  3426.           SIZE or MLSD directive.
  3427.           
  3428.    /LARGER-THAN:number
  3429.           Download only files whose size is greater than the given number
  3430.           of bytes. Requires that the FTP server support the SIZE or MLSD
  3431.           directive.
  3432.           
  3433.    /NOBACKUPFILES
  3434.           During MGET, don't download any files whose names end with
  3435.           backup suffixes (.~n~ where n is a number).
  3436.           
  3437.    /NODOTFILES
  3438.           During MGET, don't download any files whose names begin with
  3439.           period (.). Equivalent to /EXCEPT:{.*}.
  3440.           
  3441.    /LISTFILE:local-filename
  3442.           The given file contains a list of files to GET, one per line.
  3443.           Filenames in the listfile can contain wildcard characters in
  3444.           the syntax of the server. There is no limit on the number of
  3445.           lines in the listfile.
  3446.           
  3447.    /NAMELIST:local-filename
  3448.           If this switch is given, then instead of actually retrieving
  3449.           the selected files, the GET command retrieves a list of the
  3450.           names of the files that would be retrieved, and places it in
  3451.           the specifed file. The resulting file is an ordinary text file,
  3452.           with one filename per line, suitable for reading by a person,
  3453.           or processing by a computer program, including Kermit itself
  3454.           (FOPEN / FREAD / FWRITE / FCLOSE), and as /FILELIST: file. If
  3455.           the filename is omitted or given as "-" (dash, hyphen), the
  3456.           list goes to the screen. NOTE: if you want a copy of the
  3457.           complete list sent by the server, use SET FTP DEBUG ON, perform
  3458.           an MGET, and the temporary file containing the list will be
  3459.           kept rather than deleted (and Kermit tells you its name).
  3460.           
  3461.    /UPDATE, /COLLISION:keyword
  3462.           Explained in [305]Section 3.6.2.
  3463.           
  3464.    /RECURSIVE
  3465.           This means to try to download an entire directory tree, rather
  3466.           than just files from a particular directory. In fact, FTP
  3467.           protocol does not provide a method to request a recursive
  3468.           download (unless the server supports MLSD; see [306]Section
  3469.           3.11), so this works only if the FTP server does it anyway,
  3470.           without being asked, as some do. In this case, Kermit detects
  3471.           that names in the returned file list contain directory
  3472.           separators, and therefore attempts to create the needed
  3473.           directories as the files arrive. But this can work only if the
  3474.           server is on the same kind of platform as the client, so the
  3475.           pathname syntax can be recognized, and also because the server
  3476.           does not switch between text and binary mode, which would be
  3477.           vital for cross-platform transfers. Use with caution. Synonym:
  3478.           /SUBDIRECTORIES.
  3479.           
  3480.           Even when the server does not provide recursive file lists,
  3481.           [M]GET /RECURSIVE forces Kermit to replicate any directory
  3482.           structure implied or expressed by the server's file list. For
  3483.           example:
  3484.           
  3485.   get somepath/somefile
  3486.  
  3487.           Gets the file named somefile from the server's somepath
  3488.           directory and puts it Kermit's current (or download) directory,
  3489.           whereas:
  3490.           
  3491.   get /recursive somepath/somefile
  3492.  
  3493.           creates the path locally and then puts the file in it.
  3494.           Similarly for MGET:
  3495.           
  3496.   mget */data/*
  3497.  
  3498.           downloads all the files in all the data subdirectories of all
  3499.           the subdirectories of the server's current directory and stores
  3500.           them locally in Kermit's current (or download) directory,
  3501.           whereas:
  3502.           
  3503.   mget /recursive */data/*
  3504.  
  3505.           re-creates the server's directory structure locally.
  3506.           
  3507.    The FTP protocol does not include explicit mechanisms for recursion,
  3508.    so Kermit builds upon what is available. Although an Internet draft
  3509.    describes a mechanism ("MLSD") that would allow protocol-driven
  3510.    recursion, similar to Kermit's File Attribute packets (circa 1984), it
  3511.    has not yet attained RFC or standard status, and servers are not yet
  3512.    widely available that offer this feature. In the meantime, the
  3513.    effectiveness of MGET /RECURSIVE depends on the FTP server
  3514.    implementation. If the server returns a recursive list in response to
  3515.    the standard NLST command (whose behavior is ill-defined), Kermit's
  3516.    FTP MGET /RECURSIVE command uses it to re-create the remote directory
  3517.    tree locally. If the server supports MLSD, C-Kermit 8.0.206 and Kermit
  3518.    95 2.1 and later are able to sense it automatically and use it, as
  3519.    described below in [307]Section 3.11.
  3520.    
  3521.    The /BEFORE:, /AFTER:, /NOT-BEFORE:, and /NOT-AFTER: switches are not
  3522.    available for downloading because of the confusion with timezones.
  3523.    Would the given times be in the local timezone, the server's timezone,
  3524.    or GMT? The FTP server's directory listings show its own local times
  3525.    but since we don't know what timezone the server is in, there's no way
  3526.    to reconcile our local times with the server's. Similarly,
  3527.    /PERMISSIONS can't be preserved in downloads because FTP protocol
  3528.    provides no means of querying the server for a file's permission.
  3529.    
  3530.    Source-file disposition switches:
  3531.    
  3532.    /DELETE
  3533.           Each file that is downloaded successfully is to be deleted from
  3534.           the server. Requires the appropriate file access rights on the
  3535.           server.
  3536.           
  3537.    /SERVER-RENAME-TO:template
  3538.           Asks the server to rename each (remote) source file immediately
  3539.           after, and only if, it is sent correctly. See [308]PUT
  3540.           /SERVER-RENAME-TO: for details.
  3541.           
  3542.    Destination-file disposition switches:
  3543.    
  3544.    /TO-SCREEN
  3545.           Displays the incoming file on the screen rather than storing it
  3546.           on disk. If this switch is given, the /RENAME-TO and /MOVE-TO
  3547.           switches are ignored, the file-transfer display is suppressed,
  3548.           and the given file(s) is/are shown on the screen. Can be used
  3549.           with /FILTER, e.g.
  3550.           
  3551.   get /text /to-screen /filter:more oofa.txt
  3552.  
  3553.           In fact, you should always use /TO-SCREEN with /FILTER or
  3554.           /COMMAND when the command would result in displaying the
  3555.           incoming file on the screen; otherwise C-Kermit would have no
  3556.           way of knowing to suppress its file transfer display (since it
  3557.           can't be expected to know what the command or filter does).
  3558.           
  3559.    /RENAME-TO:template
  3560.           Each file that is downloaded is to be renamed as indicated if
  3561.           and only if it was received completely and without error. The
  3562.           template can be literal text or can contain variables that are
  3563.           evaluated for each file. For MGET, the text must contain
  3564.           variables; for GET it can be a literal string. The \v(filename)
  3565.           variable contains the name of the current file, so:
  3566.           
  3567.   ftp mget /rename-to:\v(filename).ok *
  3568.  
  3569.           causes each file that is successfully downloaded to have ".ok"
  3570.           appended to its name. For details see [309]Section 4.1 of the
  3571.           [310]C-Kermit 7.0 Update Notes.
  3572.           
  3573.    /MOVE-TO:text
  3574.           Just like /RENAME-TO:, except the text denotes the name of a
  3575.           directory to which successfully downloaded files are to be
  3576.           moved. If the directory does not exist, it is created.
  3577.           
  3578.    The file transfer display does not show the /MOVE-TO or /RENAME-TO
  3579.    value, since the incoming file has not yet been moved or renamed.
  3580.      _________________________________________________________________
  3581.    
  3582.     3.6.2. Filename Collisions
  3583.     
  3584.    What should happen if an incoming file has the same name as an
  3585.    existing file in the same directory? By default, Kermit's FILE
  3586.    COLLISION setting applies: BACKUP, RENAME, UPDATE, DISCARD, etc, as
  3587.    described in [311]Using C-Kermit. Kermit's default FILE COLLISION
  3588.    setting is BACKUP (rename the existing file and store the incoming
  3589.    file under its own name) and therefore this is also the default FTP
  3590.    collision action.
  3591.    
  3592.    The name under which an incoming file is to be stored is determined as
  3593.    follows:
  3594.    
  3595.      * If an as-name was given, the as-name is used. Otherwise:
  3596.      * If the client and server platforms are alike or [312]FTP FILENAMES
  3597.        is set to LITERAL (or the /FILENAMES:LITERAL switch was given for
  3598.        this download), the incoming filename is used literally.
  3599.        Otherwise:
  3600.      * The incoming filename is converted to a form that is friendly to
  3601.        the local platform. For UNIX, for example, incoming filenames that
  3602.        are all uppercase (as they might be from, say, VMS or an IBM
  3603.        mainframe) are converted to lowercase.
  3604.        
  3605.    If the resulting name coincides with the name of a local file that
  3606.    already exists, we have a filename collision. Collisions are handled
  3607.    according to the currently selected collision action:
  3608.    
  3609.    SET FTP COLLISION { BACKUP, RENAME, UPDATE, DISCARD, APPEND, OVERWRITE
  3610.           }
  3611.           This establishes a filename collision for FTP, separate from
  3612.           the Kermit one. The initial FTP collision setting is inherited
  3613.           from Kermit's FILE COLLISION setting when the first FTP command
  3614.           is given, but subsequent changes to Kermit's FILE COLLISION
  3615.           setting do not affect the FTP COLLISION setting. SHOW FTP tells
  3616.           the current FTP COLLISION setting.
  3617.           
  3618.    FTP GET /COLLISION:{BACKUP,RENAME,UPDATE,DISCARD,APPEND,OVERWRITE}
  3619.           Overrides the current FTP COLLISION action for this download
  3620.           only.
  3621.           
  3622.    FTP GET /UPDATE
  3623.           This is equivalent to GET /COLLISION:UPDATE, and is included
  3624.           for symmetry with PUT /UPDATE
  3625.           
  3626.    FTP GET /UPDATE and /COLLISION:UPDATE mean to download only those
  3627.    files whose modification dates on the server are later than those on
  3628.    the client. Date-time comparisons are done in Coordinated Universal
  3629.    Time (UTC, GMT, ZULU). The command:
  3630.    
  3631.      FTP MGET /COLLISION:APPEND /AS-NAME:newfilename *.*
  3632.      
  3633.    Downloads all matching remote files into a single local file (in
  3634.    whatever order the server sends them).
  3635.      _________________________________________________________________
  3636.    
  3637.     3.6.3. Recovery
  3638.     
  3639.    Recovery is available for downloads too, but there are some
  3640.    differences from the uploading case described in [313]Section 3.5.3:
  3641.    
  3642.      * The transfer must be in BINARY mode. It can not be in text mode,
  3643.        even if the FTP server is on the same kind of platform as Kermit,
  3644.        and even if there is no character-set translation. The original
  3645.        download must also have been in binary mode.
  3646.      * The FTP server must support the REST ("restart") directive.
  3647.        Unfortunately, this is not a standard command; at this writing, it
  3648.        is described only in an Internet Draft, not an RFC or Internet
  3649.        Standard, but nevertheless it is found in several popular FTP
  3650.        servers, such as [314]ProFTPD.
  3651.        
  3652.    Here's how download recovery works:
  3653.    
  3654.      * Kermit checks for conflicting switches, such as /UPDATE, /COMMAND,
  3655.        or /FILTER. If /RECOVER is given with these switches an error
  3656.        occurs.
  3657.      * The prevailing transfer mode (SET FTP TYPE) must be BINARY. If it
  3658.        is not, the /BINARY switch must have been included with the FTP
  3659.        [M]GET command.
  3660.        
  3661.    If the /RECOVER switch is accepted, then for each selected file:
  3662.    
  3663.      * A SIZE command is sent for the file (using its remote name). If
  3664.        the reply indicates the file was not found, or the SIZE command
  3665.        was not understood, or any other kind of error, recovery is
  3666.        canceled (i.e. the entire file is downloaded).
  3667.      * If the sizes of the two files are identical, the file is not sent.
  3668.        Otherwise:
  3669.      * Kermit sends the REST directive to the server, indicating the size
  3670.        of the local file. If the server responds affirmatively, Kermit
  3671.        opens the local file in append mode and appends the incoming data
  3672.        to it. Otherwise, recovery is canceled and the entire file is
  3673.        downloaded.
  3674.        
  3675.    The /RECOVER switch can be included with any FTP GET or MGET command,
  3676.    even if it specifies a group of files. This lets you resume an
  3677.    interrupted batch transfer from where it left off. The files that were
  3678.    already completely sent are skipped, the file that was interrupted is
  3679.    recovered, and the remaining files are uploaded. BUT... unlike with
  3680.    uploading, where this can be done with any mixture of text and binary
  3681.    files, when downloading, it can only be done if all the files are
  3682.    binary.
  3683.    
  3684.    It doesn't matter how the original partial file was downloaded -- FTP,
  3685.    Kermit, HTTP, Zmodem, etc: as long as the preconditions are met, it
  3686.    can be recovered with FTP [M]GET /RECOVER, or for that matter also
  3687.    with GET /RECOVER (using Kermit protocol).
  3688.    
  3689.    [ [315]Top ] [ [316]FTP Top ] [ [317]C-Kermit Home ] [ [318]Kermit
  3690.    Home ]
  3691.      _________________________________________________________________
  3692.    
  3693.   3.7. Translating Character Sets
  3694.   
  3695.    A possibly unique feature of Kermit's FTP client is its ability to
  3696.    convert character sets when transferring files in text mode,
  3697.    independent of the capabilites of the FTP server, as well as to
  3698.    translate the character sets of filenames regardless of transfer mode.
  3699.    For compatibility with existing FTP clients, and because there is a
  3700.    certain performance penalty, Kermit won't do this unless you ask for
  3701.    it. If you enable this feature, you need to inform Kermit of the
  3702.    character set (to be) used on the server and in some cases (explained
  3703.    below) also the local file character set. This discussion assumes you
  3704.    know a bit about character sets (as you must if you have to use them);
  3705.    see Chapter 16 of [319]Using C-Kermit for a detailed treatment. The
  3706.    Kermit commands for FTP character-set conversion are:
  3707.    
  3708.    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
  3709.           Whether to translate character sets when transferring text
  3710.           files with FTP. OFF by default. Set this to ON to enable
  3711.           character-set translation for subsequent FTP uploads and
  3712.           downloads.
  3713.           
  3714.    SET FTP SERVER-CHARACTER-SET [320]name
  3715.           Text character set (to be) used by the server. Most FTP servers
  3716.           are ignorant of character sets, so all translations are done
  3717.           unilaterally by Kermit's FTP client. This means that when
  3718.           downloading files, you must know in advance the character-set
  3719.           used in the files you are downloading (and in their names).
  3720.           When uploading, you must specify the character-set to which
  3721.           local filenames and text-file contents are to be translated for
  3722.           transmission to the server. If you SET FTP
  3723.           CHARACTER-SET-TRANSLATION ON but do not specify an FTP
  3724.           SERVER-CHARACTER-SET, [321]UTF8 is used, since this is the new
  3725.           Internet standard international character set; it is upwards
  3726.           compatible with ASCII and it encompasses most written languages
  3727.           and therefore does not favor any particular group of people, as
  3728.           any other default would do. If you SET FTP SERVER-CHARACTER-SET
  3729.           to something (anything) when FTP CHARACTER-SET TRANSLATION is
  3730.           OFF, this also sets the latter ON.
  3731.           
  3732.    SET FILE CHARACTER-SET [322]name
  3733.           This is the regular Kermit (non-FTP-specific) command for
  3734.           identifying the character set (to be) used in local text files
  3735.           and filenames.
  3736.           
  3737.    TO REITERATE: If you SET FTP CHARACTER-SET TRANSLATION ON but do not
  3738.    specify an FTP SERVER-CHARACTER-SET, outbound text files are converted
  3739.    to UTF-8 and inbound text files are assumed to be UTF-8. If this is
  3740.    not appropriate, be sure to also specify the desired FTP
  3741.    SERVER-CHARACTER-SET.
  3742.    
  3743.    You can use "special" (non-ASCII) characters in filenames in all the
  3744.    client / server file management commands (FTP MKDIR, RMDIR, DIRECTORY,
  3745.    VDIRECTORY, DELETE, etc), and also in file-transfer commands. When
  3746.    giving commands such as FTP DIR (RDIR) and FTP PWD (RPWD), the reply
  3747.    is translated too, so you can read it. In this example, the client and
  3748.    server use entirely different codes to represent the special
  3749.    characters of German:
  3750.    
  3751.   C-Kermit> ftp xyzcorp.de /anonymous
  3752.   C-Kermit> set ftp server-character-set latin1
  3753.   C-Kermit> set file character-set german
  3754.   C-Kermit> rcd StΣdte
  3755.   C-Kermit> rpwd
  3756.   "/pub/ftp/StΣdte is current directory"
  3757.   C-Kermit> rdir
  3758.   -rw-rw----  1 olaf     54018 Jan  6 17:58 Adenbⁿttel.txt
  3759.   -rw-rw----  1 ursula     373 Jan  5 15:19 A▀lar.txt
  3760.   -rw-rw----  1 gisbert    482 Jan  5 15:20 Blowatz.txt
  3761.   -rw-rw----  1 gudrun     124 Jan  5 15:19 B÷blingen.txt
  3762.   -rw-rw----  1 olga     14348 Jan  7 14:23 K÷ln.txt
  3763.  
  3764.    When the client and server file systems use different character sets,
  3765.    you should take care to use only those characters that the two sets
  3766.    share in common when creating filenames or text-file contents. For
  3767.    example, PC code pages contain a lot line- and box-drawing characters,
  3768.    and sometimes "smart quotes", etc, that are not found in ISO standard
  3769.    8-bit character sets. You should be especially careful to avoid using
  3770.    such characters in filenames.
  3771.    
  3772.    [ [323]C-Kermit Character Sets ]
  3773.      _________________________________________________________________
  3774.    
  3775.     3.7.1. Character Sets and Uploading
  3776.     
  3777.    Kermit's PUT and MPUT commands include full file-scanning
  3778.    capabilities, as described in [324]Section 4. Thus if FTP
  3779.    CHARACTER-SET-TRANSLATION is ON and your character-set associations
  3780.    are set up appropriately, Kermit automatically switches on a per-file
  3781.    basis between text and binary mode, and for each text file between
  3782.    your chosen 7-bit text character set (e.g. ASCII or ISO 646 German),
  3783.    8-bit text (e.g. Latin-1 or Japanese EUC), UCS-2, and UTF-8, and
  3784.    converts each of these automatically to the server character-set, and
  3785.    furthermore automatically differentiates between the Little and Big
  3786.    Endian forms of UCS-2, always sending in Big Endian form.
  3787.    
  3788.      WARNING: It is not advisable to use UCS-2 (or any Unicode
  3789.      transformation other than UTF-8) "on the wire", i.e. as a server
  3790.      character set. Most FTP servers are not able to cope with it, since
  3791.      it contains lots of 0 (NUL) characters. If you do use it, Kermit
  3792.      does not translate filenames to or from UCS-2, for reasons well
  3793.      known to C programmers (for example, UNIX APIs assume filename
  3794.      strings are NUL-terminated). [325]UTF-8 is the preferred (and
  3795.      standard) Unicode format for the Internet.
  3796.      
  3797.    FTP character-set translations differ from the regular Kermit ones by
  3798.    not restricting translations to a file-character-set /
  3799.    transfer-character-set pair. You can have Kermit's FTP client
  3800.    translate between any pair of character sets it knows about. You can
  3801.    see the list of supported character sets by typing either of the
  3802.    following:
  3803.    
  3804.   set ftp server-character-set ?
  3805.   set file character-set ?
  3806.  
  3807.    A typical list looks like this ([326]CLICK HERE for an explanation of
  3808.    the names):
  3809.    
  3810.   C-Kermit>set file char ? One of the following:
  3811.    ascii            cp869-greek       hebrew-7         mazovia-pc
  3812.    british          cyrillic-iso      hebrew-iso       next-multinational
  3813.    bulgaria-pc      danish            hp-roman8        norwegian
  3814.    canadian-french  dec-kanji         hungarian        portuguese
  3815.    cp1250           dec-multinational iso2022jp-kanji  shift-jis-kanji
  3816.    cp1251-cyrillic  dg-international  italian          short-koi
  3817.    cp1252           dutch             jis7-kanji       spanish
  3818.    cp437            elot927-greek     koi8             swedish
  3819.    cp850            elot928-greek     koi8r            swiss
  3820.    cp852            euc-jp            koi8u            ucs2
  3821.    cp855-cyrillic   finnish           latin1-iso       utf8
  3822.    cp858            french            latin2-iso
  3823.    cp862-hebrew     german            latin9-iso
  3824.    cp866-cyrillic   greek-iso         macintosh-latin
  3825.   C-Kermit>
  3826.  
  3827.    Thus you can translate not only between private sets (like PC code
  3828.    pages) and standard ones (like Latin-1) as in Kermit protocol, but
  3829.    also between any given pair of private sets (e.g. CP852 and Mazovia).
  3830.    All conversions go through Unicode as the intermediate character set,
  3831.    resulting in a minimum of character loss, since Unicode is a superset
  3832.    of all other character sets known to Kermit.
  3833.    
  3834.    In addition to the SET commands listed above, the FTP PUT and MPUT
  3835.    commands include switches that apply only to the current command:
  3836.    
  3837.    /LOCAL-CHARACTER-SET:name
  3838.           
  3839.    /SERVER-CHARACTER-SET:name
  3840.           Use these switches to force a particular translation. These
  3841.           switches override the global FTP CHARACTER-SET-TRANSLATION and
  3842.           SERVER-CHARACTER-SET settings and also character-set
  3843.           differentiation by file scanning for the duration of the PUT or
  3844.           MPUT command. The file scan is still performed, however, to
  3845.           determine whether the file is text or binary; thus these
  3846.           switches do not affect binary files unless you also include the
  3847.           /TEXT switch to force all files to be treated as text.
  3848.           
  3849.    In other words, if you include one or both of these switches with a
  3850.    PUT or MPUT command, they are used. Similarly, the /TRANSPARENT switch
  3851.    disables character-set translation for the PUT or MPUT command despite
  3852.    the prevailing FTP CHARACTER-SET-TRANSLATION and SERVER-CHARACTER-SET
  3853.    settings.
  3854.    
  3855.    When uploading, the FILE CHARACTER-SET setting is ignored unless you
  3856.    have forced Kermit not to [327]scan local files by including a /TEXT
  3857.    or /BINARY switch with your [M]PUT command, or by disabling automatic
  3858.    text/binary switching in some other way.
  3859.    
  3860.    Examples:
  3861.    
  3862.     1. Suppose you have a CP852 (East European) text file that you want
  3863.        to upload and store in ISO Latin Alphabet 2 encoding:
  3864.  
  3865.   ftp put /local-char:cp852 /server-char:latin2 magyar.txt
  3866.     2. Suppose you always want your text files converted to Latin-2 when
  3867.        uploading with FTP. Then put:
  3868.  
  3869.   set ftp server-character-set latin2
  3870.        in your Kermit customization file, and then you can omit the
  3871.        /SERVER-CHARACTER-SET: switch from your FTP PUT commands:
  3872.  
  3873.   ftp put /local-char:cp852 magyar.txt
  3874.     3. Now suppose that all the text files on your PC are written in
  3875.        Hungarian, but they have a variety of encodings, and you don't
  3876.        want to have to include the /LOCAL-CHARACTER-SET: switch on every
  3877.        FTP PUT command, or (more to the point) you want to be able to
  3878.        send a mixture of these files all at once. Put these commands in
  3879.        your Kermit customization file:
  3880.  
  3881.   set ftp server-character-set latin2            ; ISO 8859-2
  3882.   set file default 7-bit-character-set hungarian ; ISO 646 Hungarian
  3883.   set file default 8-bit-character-set cp852     ; PC East European Code Page
  3884.        and now PUT and MPUT will automatically detect and switch among
  3885.        ISO 646 Hungarian, Code Page 852, UTF-8, and UCS-2 encodings,
  3886.        translating each one to Latin-2 for uploading:
  3887.  
  3888.   ftp put *.txt
  3889.  
  3890.    And since binary files are also detected automatically, the latter can
  3891.    be simplified to:
  3892.    
  3893.   ftp put *
  3894.  
  3895.    even when "*" matches a diverse collection of binary and text files,
  3896.    because translations are skipped automatically for binary files.
  3897.      _________________________________________________________________
  3898.    
  3899.     3.7.2. Character Sets and Downloading
  3900.     
  3901.    The commands and switches are the same as for uploading, but automatic
  3902.    character-set switching works differently, since Kermit can't scan the
  3903.    server files in advance. Instead, the transfer mode (text or binary)
  3904.    is based on the filenames; each name is compared with Kermit's list of
  3905.    text name patterns and binary name patterns. If the name matches a
  3906.    binary pattern (for example, if the filename is oofa.tar.gz and one of
  3907.    the filename patterns is "*.gz"), the file is downloaded in binary
  3908.    mode; otherwise if it matches a text pattern (e.g. oofa.txt matches
  3909.    "*.txt"), it is transferred in text ("ascii") mode. Otherwise, it is
  3910.    transferred in the prevailing FTP TYPE.
  3911.    
  3912.    In C-Kermit 8.0, the pattern lists used with FTP GET are not the same
  3913.    lists used with Kermit transfers, and can not be viewed with SHOW
  3914.    PATTERNS, nor adjusted with ADD and REMOVE TEXT-PATTERNS and
  3915.    BINARY-PATTERNS, or SET FILE TEXT-PATTERNS and BINARY-PATTERNS.
  3916.    Configuration of the FTP patterns list will be added in a future
  3917.    release.
  3918.    
  3919.    Examples:
  3920.    
  3921.    get /server-char:latin1 /local-char:cp850 Grⁿ▀e.txt
  3922.           In this command, the filename contains special characters,
  3923.           which you enter using whatever character set your local
  3924.           computer uses, in this case PC Code Page 850 (cp850). The
  3925.           command tells Kermit (in case it didn't know already from its
  3926.           FILE CHARACTER-SET setting) that the local character set is
  3927.           cp850 and the server's character-set is ISO 8859-1 Latin
  3928.           Alphabet 1 (latin1). Kermit translates the filename from cp850
  3929.           to latin1 and sends the latin1 name to the server. Since it's a
  3930.           text file (matches "*.txt"), its contents are translated to
  3931.           cp850 on arrival, and it is saved with a cp850 name.
  3932.           
  3933.    mget /text /server:latin1 /local:utf8 *.txt
  3934.           This command:
  3935.           
  3936.           + Tells C-Kermit that the server's files are encoded in ISO
  3937.             8859-1 Latin Alphabet 1.
  3938.           + Tells C-Kermit to translate the incoming files into Unicode
  3939.             UTF-8 for storage.
  3940.           + Asks the server to send all ".txt" files in text mode.
  3941.             
  3942.    mget /server:latin1 /local:utf8 *
  3943.           Tells Kermit to get all files from the server's directory,
  3944.           switching between text and binary mode based on the filename.
  3945.           The names of all the files are translated (to UTF-8 in this
  3946.           case), but contents are translated (also to UTF-8) only for
  3947.           text files.
  3948.           
  3949.    Note that any pair of 8-bit character sets is likely to have some
  3950.    incompatibilities. Any characters in the source file that do not have
  3951.    equivalents in the destination file's character set are converted to
  3952.    question marks. This applies to both filenames and to text file
  3953.    contents.
  3954.    
  3955.    Also note that the server's ability to accept special characters in
  3956.    filenames depends on the particular server. For example:
  3957.    
  3958.   get Grⁿ▀e.txt
  3959.  
  3960.    works with WU-FTPD, but:
  3961.    
  3962.   mget Grⁿ▀*.txt
  3963.  
  3964.    does not.
  3965.      _________________________________________________________________
  3966.    
  3967.     3.7.3. RFC2640
  3968.     
  3969.    [328]RFC2640, July 1999, specifies a method by which the FTP client
  3970.    and server can negotiate the use of UTF8. However, RFC2640-capable
  3971.    servers are rare to nonexistent at this writing, and in any case you
  3972.    don't need them to be able to transfer text in UTF8. C-Kermit lets you
  3973.    upload and download text files in any character set it knows about,
  3974.    converting to or from any other character set it knows about, without
  3975.    the knowledge, permission, or cooperation of the server, and
  3976.    regardless of its capabilities.
  3977.    
  3978.    [ [329]Top ] [ [330]FTP Top ] [ [331]C-Kermit Home ] [ [332]Kermit
  3979.    Home ]
  3980.      _________________________________________________________________
  3981.    
  3982.   3.8. FTP Command Shortcuts
  3983.   
  3984.    C-Kermit's FTP client coexists with other C-Kermit functions by
  3985.    requiring the "ftp" prefix for each FTP-related command: FTP OPEN, FTP
  3986.    GET, FTP BYE, and so on. For interactive use, however, this can be
  3987.    rather awkward and sometimes surprising, for example when a GET
  3988.    command starts a Kermit GET rather than an FTP GET. In fact, many
  3989.    Kermit commands might just as easily apply to an FTP connection: GET,
  3990.    PUT (SEND), BYE, and CLOSE. The following command lets you choose how
  3991.    these commands are interpreted:
  3992.    
  3993.    SET GET-PUT-REMOTE { AUTO, KERMIT, FTP }
  3994.           Controls the orientation of GET, PUT, REMOTE and other
  3995.           file-transfer and client/server commands that might apply to
  3996.           either Kermit or FTP. The default setting is AUTO, meaning that
  3997.           these commands apply to FTP if an FTP connection is open, and
  3998.           to Kermit otherwise. KERMIT means they always apply to Kermit,
  3999.           FTP means they always apply to FTP.
  4000.           
  4001.    Here is a complete list of affected commands:
  4002.    
  4003.  Kermit Command               FTP Equivalent
  4004.   (none)                       FTP [ OPEN ]
  4005.   LOGIN                        FTP USER
  4006.   LOGOUT                       FTP RESET
  4007.   BYE                          FTP BYE
  4008.   FINISH                       FTP BYE
  4009.   CLOSE                        FTP BYE
  4010.   HANGUP                       FTP BYE
  4011.   BINARY                       FTP TYPE BINARY
  4012.   TEXT (or ASCII)              FTP TYPE ASCII
  4013.   SEND (or PUT)                FTP PUT
  4014.   MSEND (or MPUT)              FTP MPUT
  4015.   RESEND                       FTP PUT /RECOVER
  4016.   CSEND                        FTP PUT /COMMAND
  4017.   GET                          FTP GET
  4018.   MGET                         FTP MGET
  4019.   REGET                        FTP GET /RECOVER
  4020.   REMOTE HELP      (RHELP)     FTP HELP
  4021.   REMOTE CD        (RCD)       FTP CD (CWD)
  4022.   REMOTE PWD       (RPWD)      FTP PWD
  4023.   REMOTE DIRECTORY (RDIR)      FTP DIRECTORY
  4024.   REMOTE DELETE    (RDEL)      FTP DELETE
  4025.   REMOTE MKDIR     (RMKDIR)    FTP MKDIR
  4026.   REMOTE RMDIR     (RRMDIR)    FTP RMDIR
  4027.   REMOTE RENAME    (RRENAME)   FTP RENAME
  4028.   REMOTE TYPE      (RTYPE)     FTP TYPE
  4029.   REMOTE EXIT      (REXIT)     FTP BYE
  4030.  
  4031.    The commands in the right-hand column always access FTP. The commands
  4032.    in the left column can access either Kermit protocol or FTP:
  4033.    
  4034.      * When GET-PUT-REMOTE is set to KERMIT, or to AUTO when there is no
  4035.        FTP connection, the commands in the left-hand column access Kermit
  4036.        protocol, and those right-hand column are required for FTP.
  4037.      * When GET-PUT-REMOTE is set to FTP, or to AUTO when there is an
  4038.        active FTP connection, the commands in the left-hand column access
  4039.        the FTP connection and can not be used to access Kermit protocol.
  4040.        In this case, if you want to be able to use both Kermit protocol
  4041.        and the FTP connection, you must SET GET-PUT-REMOTE KERMIT, and
  4042.        then use the FTP commands in the right-hand column to access the
  4043.        FTP connection.
  4044.        
  4045.    Note that file-management commands such as DIRECTORY, DELETE, CD, PWD,
  4046.    MKDIR, RMDIR, HELP, RENAME, COPY, TYPE, and so on, always apply
  4047.    locally, no matter what kind of connection you have. This is the
  4048.    opposite of most FTP clients, where these commands are intended for
  4049.    the server, and require an "L" prefix for local execution (e.g. "dir"
  4050.    gets a directory listing from the server, "ldir" gets a local
  4051.    directory listing). To illustrate with the CD command and a typical
  4052.    UNIX FTP client:
  4053.    
  4054.  Client   Server      Change Local Directory     Change Remote Directory
  4055.   FTP      FTP         lcd                        cd (cwd)
  4056.   Kermit   Kermit      cd                         rcd, remote cd
  4057.   Kermit   FTP         cd                         ftp cd, rcd, remote cd
  4058.  
  4059.    Also note that not all REMOTE commands are useful with FTP, since FTP
  4060.    servers do not offer the corresponding functions. These include:
  4061.    
  4062.      * REMOTE ASSIGN  - FTP servers don't have variables
  4063.      * REMOTE COPY    - FTP servers don't copy files
  4064.      * REMOTE HOST    - FTP servers don't execute host (shell) commands
  4065.      * REMOTE KERMIT  - FTP servers don't execute Kermit commands
  4066.      * REMOTE PRINT   - FTP servers don't print files
  4067.      * REMOTE QUERY   - FTP servers don't have variables
  4068.      * REMOTE SET     - FTP servers don't have Kermit settings
  4069.      * REMOTE WHO     - FTP servers don't send user lists
  4070.        
  4071.    Finally note that command shortcuts do not apply to the HELP command.
  4072.    For help about an FTP command, use (for example) "help ftp delete",
  4073.    not "help delete" or "help rdelete".
  4074.    
  4075.    [ [333]Top ] [ [334]FTP Top ] [ [335]C-Kermit Home ] [ [336]Kermit
  4076.    Home ]
  4077.      _________________________________________________________________
  4078.    
  4079.   3.9. Dual Sessions
  4080.   
  4081.    You can have an FTP session open at the same time as a regular Kermit
  4082.    SET LINE or SET HOST (terminal) session. In this case, the default SET
  4083.    GET-PUT-REMOTE AUTO setting should ensure that all "two-faced"
  4084.    commands like GET, PUT, REMOTE, HANGUP, BYE, etc, apply to the Kermit
  4085.    session, and all commands for the FTP session must include the FTP
  4086.    prefix. To be absolutely certain, you can use SET GET-PUT-REMOTE
  4087.    KERMIT.
  4088.    
  4089.   ftp foo.bar.baz.com
  4090.   if fail ...
  4091.   (log in)
  4092.   set host foo.bar.baz.com
  4093.   if fail ...
  4094.   (log in)
  4095.  
  4096.    Now you have both an FTP and Telnet connection to the same host (of
  4097.    course they could also be to different hosts, and you could also have
  4098.    a direct or dialed serial connection instead of a Telnet connection).
  4099.    Now assuming you have a Kermit server on the far end of the Kermit
  4100.    connection:
  4101.    
  4102.   rcd incoming      ; Changes Kermit server's directory (= REMOTE CD)
  4103.   ftp cd incoming   ; Changes FTP server's directory
  4104.   put oofa.txt      ; Sends a file on the Kermit connection
  4105.   ftp put oofa.txt  ; Sends a file on the FTP connection
  4106.   bye               ; Shuts down the Kermit connection
  4107.   ftp bye           ; Shuts down the FTP connection
  4108.  
  4109.    Note that PUT and SEND are synonyms for both FTP and Kermit
  4110.    connections.
  4111.    
  4112.    You can also establish dual sessions on the Kermit command line:
  4113.    
  4114.   kermit -j host1 -9 host2
  4115.  
  4116.    This makes a Telnet connection to host1 and an FTP connection to
  4117.    host2.
  4118.    
  4119.    [ [337]Top ] [ [338]FTP Top ] [ [339]C-Kermit Home ] [ [340]Kermit
  4120.    Home ]
  4121.      _________________________________________________________________
  4122.    
  4123.   3.10. Automating FTP Sessions
  4124.   
  4125.    Most of Kermit's scripting features can be used to make and control
  4126.    FTP sessions: FOR and WHILE loops, IF-ELSE and SWITCH constructions,
  4127.    variables, arrays, built-in functions, and all the rest. You can't use
  4128.    INPUT, MINPUT, OUTPUT, CLEAR, or SCRIPT on an FTP session, but these
  4129.    are not needed since the FTP protocol is well defined.
  4130.    
  4131.    [341]CLICK HERE for an FTP scripting tutorial.
  4132.    
  4133.     3.10.1. FTP-Specific Variables and Functions
  4134.     
  4135.    The following variable tells whether an FTP connection is open:
  4136.    
  4137.    \v(ftp_connected)
  4138.           1 if there is an active FTP connection, 0 if there isn't.
  4139.           
  4140.    The FTP OPEN command sets:
  4141.    
  4142.    \v(ftp_host)
  4143.           The host to which the most recent FTP connection was made.
  4144.           
  4145.    \v(ftp_security)
  4146.           The security method negotiated for the current FTP session. The
  4147.           value is "NULL" when no security is used. See [342]3.2. Making
  4148.           Secure FTP Connections.
  4149.           
  4150.    \v(ftp_server)
  4151.           The OS type (UNIX, VMS, etc) of the FTP server host.
  4152.           
  4153.    The FTP USER command (or FTP OPEN /USER:, or FTP with automatic login)
  4154.    sets:
  4155.    
  4156.    \v(ftp_loggedin)
  4157.           1 if you are logged in to an FTP server, 0 if you are not.
  4158.           
  4159.    The current COMMAND-PROTECTION-LEVEL and DATA-PROTECTION-LEVEL values
  4160.    are reflected in:
  4161.    
  4162.    \v(ftp_cpl)
  4163.           
  4164.    \v(ftp_dpl)
  4165.           The values are "clear", "confidential", "safe" or "private".
  4166.           See [343]3.2. Making Secure FTP Connections.
  4167.           
  4168.    The FTP GET-PUT-REMOTE setting is reflected in:
  4169.    
  4170.    \v(ftp_getputremote)
  4171.           The values are "auto", "ftp", or "kermit".
  4172.           
  4173.    Every FTP command sets the \v(success) variable, as well as the
  4174.    following two FTP-specific variables:
  4175.    
  4176.    \v(ftp_code)
  4177.           The standardized numeric FTP protocol code from the server's
  4178.           response to the last client command, a 3-digit decimal number
  4179.           defined in [344]RFC959. Briefly:
  4180.           
  4181.           1xx = Positive Preliminary Reply
  4182.           2xx = Positive Completion Reply
  4183.           3xx = Positive Intermediate Reply
  4184.           4xx = Transient Negative Completion Reply
  4185.           5xx = Permanent Negative Completion Reply
  4186.           
  4187.    \v(ftp_message)
  4188.           The text message, if any, from the server's response to the
  4189.           last client command. If the most recent response had multiple
  4190.           lines, this variable has only the final line. These messages
  4191.           are not standardized and vary in format and content from server
  4192.           to server. Synonym: \v(ftp_msg).
  4193.           
  4194.    FTP file transfers set the regular Kermit transfer status variables:
  4195.    
  4196.   \v(cps)         Characters per second of most recent transfer.
  4197.   \v(filespec)    File specification used in most recent transfer.
  4198.   \v(fsize)       Size of file most recently transferred.
  4199.   \v(tfsize)      Total size of file group most recently transferred.
  4200.   \v(xferstatus)  Status of most recent transfer (0 = success, 1 = failure).
  4201.   \v(tftime)      Elapsed time of most recent transfer, in seconds.
  4202.  
  4203.    During an FTP transfer, the per-file variables are:
  4204.    
  4205.   \v(filename)    Name of current file.
  4206.   \v(filenumber)  Ordinal file number in group (1, 2, 3, ...)
  4207.      _________________________________________________________________
  4208.    
  4209.     3.10.2. Examples
  4210.     
  4211.    Let's begin with a simple example showing how to log in, send some
  4212.    files, and log out:
  4213.    
  4214.   define error if fail { ftp bye, stop 1 Error: \%1 }
  4215.   set transact brief
  4216.   log t
  4217.   ftp ftp.xyzcorp.com /anonymous
  4218.   if fail stop 1 Connection failed
  4219.   if not \v(ftp_loggedin) stop 1 Login failed
  4220.   ftp cd incoming
  4221.   error {ftp cd}
  4222.   cd upload
  4223.   error {local cd}
  4224.   ftp put /delete *
  4225.   error {put}
  4226.   ftp bye
  4227.  
  4228.    First we define an error handling macro to be used after the
  4229.    connection is made. Then we set up a brief-format transaction log to
  4230.    keep a record of our file transfers. Then we make a connection to the
  4231.    host and log in anonymously. The "if fail" command checks whether the
  4232.    connection was made. The "if not" command checks whether login was
  4233.    successful. Obviously the script should not continue unless both tests
  4234.    succeed.
  4235.    
  4236.    Next we change to the server's 'incoming' directory and to our own
  4237.    'upload' directory, and send all the files that are in it (they can be
  4238.    any mixture of text and binary files), deleting each source file
  4239.    automatically after it is successfully uploaded. Each of these
  4240.    operations is checked with the ERROR macro, which prevents the script
  4241.    from continuing past a failure.
  4242.    
  4243.    Finally we close the FTP session with the "bye" command.
  4244.    
  4245.    Just like any other Kermit script, this one can be used in many ways:
  4246.    
  4247.      * It can be stored in a file, and Kermit can be told to TAKE the
  4248.        file.
  4249.      * In UNIX, it can be a "[345]kerbang" script and therefore run
  4250.        directly from the shell prompt or as a cron job.
  4251.        
  4252.    We could have used command shortcuts like "rcd", "put", and "bye", but
  4253.    since they can be ambiguous under certain circumstances, it is better
  4254.    to avoid them in scripts; they are intended mainly for convenience
  4255.    during interactive use. However, if you wish to use the shortcuts in a
  4256.    script, you can do it this way (error handling omitted for brevity):
  4257.    
  4258.   local \%t                       ; Declare a local temporary veriable
  4259.   assign \%t \v(ftp_getputremote) ; Save current FTP GET-PUT-REMOTE setting
  4260.   set ftp get-put-remote ftp      ; Choose FTP orientation
  4261.   ftp xyzcorp.com /anonymous      ; Open an FTP connection
  4262.   get oofa.txt                    ; GET a file
  4263.   put foo.bar                     ; PUT a file
  4264.   rdel yesterday.log              ; Delete a file on the server
  4265.   bye                             ; Log out and disconnect from server.
  4266.   set ftp get-put-remote \%t      ; Restore previous GET-PUT-REMOTE setting
  4267.  
  4268.    Of course, FTP scripts can also be written as macros. This lets you
  4269.    pass parameters such as hostnames, usernames, and filenames to them:
  4270.    
  4271.   define doftpget {
  4272.       if < \v(argc) 4 end 1 Usage: \%0 host user remotefile [ localfile ]
  4273.       ftp \%1 /user:\%2
  4274.       if fail end 1 FTP OPEN \%1 failed
  4275.       if not \v(ftp_loggedin) end 1 FTP LOGIN failed
  4276.       ftp get {\%3} {\%4}
  4277.       if fail end 1 FTP GET \%3 failed
  4278.       ftp bye
  4279.   }
  4280.  
  4281.    Add this definition to your Kermit customization file, and it will
  4282.    always be available when you start Kermit. This macro lets you
  4283.    download a file with FTP by giving a single command, e.g.:
  4284.    
  4285.   doftpget xyzcorp.com anonymous oofa.txt
  4286.  
  4287.    [346]CLICK HERE to visit the Kermit FTP script-writing tutorial.
  4288.    
  4289.    [ [347]Top ] [ [348]FTP Top ] [ [349]C-Kermit Home ] [ [350]Kermit
  4290.    Home ]
  4291.      _________________________________________________________________
  4292.    
  4293.   3.11. Advanced FTP Protocol Features
  4294.   
  4295.    The remainder of the FTP documention (through the end of Section 3) is
  4296.    new to C-Kermit 8.0.206, but we leave it in black to prevent
  4297.    headaches. Except for titles.
  4298.      * [351]TERMINOLOGY
  4299.      * [352]FEATURE NEGOTIATION
  4300.      * [353]USING MGET: NLST VERSUS MLSD
  4301.      * [354]EXAMPLES
  4302.      * [355]REFERENCES
  4303.        
  4304.    The new releases of [356]C-Kermit (8.0.206) and [357]Kermit 95 (2.1)
  4305.    support new FTP protocol features from RFC 2389 as well as most of
  4306.    what's in the Elz and Hethmon Extensions to FTP Internet Draft (see
  4307.    [358]References). Some of these features, such as SIZE (request a
  4308.    file's size), MDTM (request file's modification time), and REST
  4309.    (restart interrupted transfer) have been widely implemented in FTP
  4310.    clients and servers for years (as well as in the initial release of
  4311.    the Kermit FTP clients). Others such as FEAT and MLSD are rarely seen
  4312.    and are new to the upcoming Kermit releases. TVFS (Trivial Virtual
  4313.    File Store) is supported implicitly, and the UTF-8 character-set is
  4314.    already fully supported at the protocol and data-interchange level.
  4315.    
  4316.    For Kermit users, the main benefit of the new FTP protocol extensions
  4317.    is the ability to do recursive downloads. But the extensions also
  4318.    introduce complications and tradeoffs that you should be aware of. Of
  4319.    course Kermit tries to "do the right thing" automatically in every
  4320.    case for backwards compatibility. But (as noted later) some cases are
  4321.    inherently ambiguous and/or can result in nasty surprises, and for
  4322.    those situations new commands and switches are available to give you
  4323.    precise control over Kermit's behavior, in case the defaults don't
  4324.    produce the desired results.
  4325.      _________________________________________________________________
  4326.    
  4327.    3.11.1. Terminology Command-line FTP clients such as Kermit (as well
  4328.    as the traditional FTP programs found on Unix, VMS, ..., even Windows)
  4329.    have commands like PUT, MPUT, GET, MGET, and BYE, which they convert
  4330.    into zero or more FTP protocol commands, such as NLST, RETR, QUIT. For
  4331.    clarity, we'll use "command" to refer to commands given by the user to
  4332.    the FTP client, and "directive" for FTP protocol commands sent by the
  4333.    FTP client to the FTP server.
  4334.      _________________________________________________________________
  4335.    
  4336.    3.11.2. Feature Negotiation New FTP protocol features are negotiated
  4337.    by the client sending a FEAT directive and the server responding with
  4338.    a list of (new) features it supports, or else with an error indication
  4339.    if it does not support the FEAT directive at all, in which case the
  4340.    client has to guess which new features it supports (Kermit guesses
  4341.    that it supports SIZE and MDTM but not MLST). Note that the MLST
  4342.    feature includes MLSD, which is not listed separately as a feature.
  4343.    
  4344.    Guessing is nice when it works, but sometimes it doesn't, and some FTP
  4345.    servers become confused when you send them a directive they don't
  4346.    understand, or they do something you didn't want, sometimes to the
  4347.    point of closing the connection. For this reason, Kermit lets you
  4348.    override default or negotiated features with the following new
  4349.    commands:
  4350.    
  4351.    FTP { ENABLE, DISABLE } FEAT
  4352.           Enables or disables the automatic sending of a FEAT directive
  4353.           upon connection to an FTP server. Note that
  4354.           FTP [ OPEN ] /NOINIT   also inhibits sending the FEAT directive
  4355.           (and several others) for the connection being OPEN'd, but
  4356.           without necessarily disabling FEAT for subsequent connections
  4357.           in the same Kermit instance. FEAT is ENABLED by default, in
  4358.           which case many FTP servers are likely to reply:
  4359.           
  4360. 500 'FEAT': command not understood
  4361.  
  4362.           which is normally harmless (but you never know). (In C-Kermit
  4363.           8.0.208, this error message is suppressed unless you SET FTP
  4364.           DEBUG ON.)
  4365.           
  4366.    FTP ENABLE { MDTM, MLST, SIZE }
  4367.           Enables the given directive for implicit use by the FTP GET and
  4368.           MGET commands in case it has been disabled or erroneously
  4369.           omitted by the server in its FEAT response. Note: MLSD can be
  4370.           used in the FTP ENABLE and DISABLE commands as a synonym for
  4371.           MLST. YOU MUST GIVE THIS COMMAND AFTER MAKING THE FTP
  4372.           CONNECTION.
  4373.           
  4374.    FTP DISABLE { MDTM, MLST, SIZE }
  4375.           Disables implicit use of the given directive by GET or MGET in
  4376.           case it causes problems; for example, because it makes
  4377.           multifile downloads take too long or the server announces it
  4378.           erroneously or misimplements it. Use DISABLE FEAT before making
  4379.           a connection to prevent Kermit from sending the FEAT directive
  4380.           as part of its initial sequence. Note that disabling FEAT,
  4381.           SIZE, or MDTM does not prevent you from executing explicit FTP
  4382.           FEATURES, FTP SIZE, or FTP MODTIME commands. Also note that
  4383.           disabling SIZE prevents PUT /RESTART (recovery of interrupted
  4384.           uploads) from working. YOU MUST GIVE THIS COMMAND AFTER MAKING
  4385.           THE FTP CONNECTION.
  4386.           
  4387.    To enable or disable more than one feature, use multiple FTP ENABLE or
  4388.    FTP DISABLE commands. The SHOW FTP command shows which features are
  4389.    currently enabled and disabled.
  4390.    
  4391.    FTP FEATURES
  4392.           This command sends a FEAT directive to the server. In case you
  4393.           have been disabling and enabling different features, this
  4394.           resynchronizes Kermit's feature list with the server's. If the
  4395.           server does not support the FEAT directive, Kermit's feature
  4396.           list is not changed.
  4397.           
  4398.    FTP OPTIONS directive
  4399.           Informational only: the server tells what options, if any, it
  4400.           supports for the given directive, e.g. MLST. Fails if the
  4401.           server does not support the OPTS directive or if the directive
  4402.           for which options are requested is not valid. The directive is
  4403.           case-insensitive.
  4404.           
  4405.    FTP SIZE filename
  4406.           Sends a SIZE directive to the server for the given file. The
  4407.           filename must not contain wildcards. The server responds with
  4408.           an error if the file can't be found, is not accessible, or the
  4409.           SIZE directive is not supported, otherwise with the length of
  4410.           the file in bytes, which Kermit displays and also makes
  4411.           available to you in its \v(ftp_message) variable. If the
  4412.           directive is successful, Kermit (re-)enables it for internal
  4413.           use by the GET and MGET directives on this connection.
  4414.           
  4415.    FTP MODTIME filename
  4416.           Works just like the SIZE directive except it sends an MDTM
  4417.           directive. Upon success, the server sends modification
  4418.           date-time string, which Kermit interprets for you and also
  4419.           makes available in its \v(ftp_message) variable.
  4420.           
  4421.    Whenever a SIZE or MDTM directive is sent implicitly and rejected by
  4422.    the server because it is unknown, Kermit automatically disables it.
  4423.      _________________________________________________________________
  4424.    
  4425.    3.11.3. Using MGET: NLST versus MLSD When you give an MGET command to
  4426.    an FTP client, it sends a request to the FTP server for a list of
  4427.    files, and then upon successful receipt of the list, goes through it
  4428.    and issues a RETR (retrieve) directive for each file on the list (or
  4429.    possibly only for selected files).
  4430.    
  4431.    With the new FTP protocol extensions, now there are two ways to get
  4432.    the list of files: the NLST directive, which has been part of FTP
  4433.    protocol since the beginning, and the new MLSD directive, which is new
  4434.    and not yet widely implemented. When NLST is used and you give a
  4435.    command like "mget *.txt", the FTP client sends:
  4436.    
  4437. NLST *.txt
  4438.  
  4439.    and the server sends back a list of the files whose names match, e.g.
  4440.    
  4441. foo.txt
  4442. bar.txt
  4443. baz.txt
  4444.  
  4445.    Then when downloading each file, the client sends SIZE (if it wants
  4446.    have a percent-done display) and MDTM (if it wants to set the
  4447.    downloaded file's timestamp to match that of the original), as well as
  4448.    RETR (to retrieve the file).
  4449.    
  4450.    But when MLSD is used, the client is not supposed to send the filename
  4451.    or wildcard to the server; instead it sends an MLSD directive with no
  4452.    argument (or the name of a directory), and the server sends back a
  4453.    list of all the files in the current or given directory; then the
  4454.    client goes through the list and checks each file to see if it matches
  4455.    the given pattern, the rationale being that the user knows only the
  4456.    local conventions for wildcards and not necessarily the server's
  4457.    conventions. So with NLST the server interprets wildcards; with MLSD
  4458.    the client does.
  4459.    
  4460.      The interpretation of NLST wildcards by the server is not
  4461.      necessarily required or even envisioned by the FTP protocol
  4462.      definition (RFC 959), but in practice most clients and servers work
  4463.      this way. 
  4464.      
  4465.    The principal advantage of MLSD is that instead of sending back a
  4466.    simple list of filenames, it sends back a kind of database in which
  4467.    each entry contains a filename together with information about the
  4468.    file: type, size, timestamp, and so on; for example:
  4469.    
  4470. size=0;type=dir;perm=el;modify=20020409191530; bin
  4471. size=3919312;type=file;perm=r;modify=20000310140400; bar.txt
  4472. size=6686176;type=file;perm=r;modify=20001215181000; baz.txt
  4473. size=3820092;type=file;perm=r;modify=20000310140300; foo.txt
  4474. size=27439;type=file;perm=r;modify=20020923151312; foo.zip
  4475. (etc etc...)
  4476.  
  4477.    (If the format of the file list were the only difference between NLST
  4478.    and MLSD, the discussion would be finished: it would always be better
  4479.    to use MLSD when available, and the MGET user interface would need no
  4480.    changes. But there's a lot more to MLSD than the file-list format;
  4481.    read on…)
  4482.    
  4483.    The client learns whether the server supports MLSD in FEAT exchange.
  4484.    But the fact that the server supports MLSD doesn't mean the client
  4485.    should always use it. It is better to use MLSD:
  4486.    
  4487.      * On connections where the server imposes a time penalty for every
  4488.        command, e.g. the Red Hat Rawhide server. With MLSD, the client
  4489.        needs to send only one command (RETR) per file, whereas NLST
  4490.        requires three (SIZE, RETR, and MDTM). Suppose there is a
  4491.        30-second delay for each command and 1000 files are to be fetched;
  4492.        in that case, MLSD saves 60,000 seconds = 1000 minutes = 16 hours
  4493.        and 40 minutes.
  4494.      * For recursive downloads since there is no dependable way to
  4495.        download directory trees with NLST.
  4496.        
  4497.    But it is better to use NLST:
  4498.    
  4499.      * If you want only a couple short files out of a large directory. In
  4500.        this case, NLST is the better choice since the server sends a list
  4501.        of only the files you want, not a list of (say) a million files,
  4502.        which can make a big difference on slow connections. For example,
  4503.        suppose your wildcard matches three files of 1K each, but the
  4504.        million-file listing is 80MB long, and your connection is through
  4505.        a modem. The overhead of using MLSD is practically infinite.
  4506.      * If the server supports wildcarding features not known to the
  4507.        client, but that can be used to achieve desirable effects
  4508.        otherwise unobtainable, such as "[dir...]*.txt" in VMS or AOS/VS
  4509.        "except" clauses.
  4510.      * If you have been given a wildcard string by an FTP site
  4511.        administrator for fetching a specific group of files out of a
  4512.        larger directory, e.g. "mget ck[cuw]*.[cwh] makefile", that is
  4513.        expected to work with any client (an FTP site administrator can't
  4514.        be expected to know the wildcard syntax of every FTP client).
  4515.        
  4516.    But when using MLSD there are complications:
  4517.    
  4518.      * MLSD wants either a blank argument (meaning the current directory)
  4519.        or else the name of a specific directory. The client must not send
  4520.        it a wildcard or a filename.
  4521.      * But if the user's command is "mget xxx", how does the client know
  4522.        whether to send "xxx" in the MLSD directive? It might be the name
  4523.        of a directory on on the server, in which case it should be sent,
  4524.        or it might be the name of a file on the server (or a wildcard),
  4525.        in which case it must not be sent. Since the client knows its own
  4526.        wildcard syntax, then in most cases it would be right to send
  4527.        "MLSD" with no argument if xxx is wild, and to send "MLSD xxx" if
  4528.        it is not.
  4529.      * But suppose the server's file system allows filename characters
  4530.        that correspond with the client's wildcard syntax? For example:
  4531.        "[abc]" could be either a valid VMS directory name or a wildcard
  4532.        pattern used by the FTP client. What should the client do with
  4533.        "mget [abc]"? In this case there must be a way for the user to
  4534.        force sending the MGET argument as the MLSD argument.
  4535.      * If "xxx" is a regular file in the server's current directory,
  4536.        "mget xxx" works with NLST but not with MLSD.
  4537.        
  4538.    To further complicate matters, NLST can (in theory) work just like
  4539.    MLSD: if sent with a blank argument or a directory name, it is
  4540.    supposed to return a complete list of files in the current or given
  4541.    directory, which the client can match locally against some pattern. It
  4542.    is not known if any FTP server or client does this but nevertheless,
  4543.    it should be possible since this behavior can be inferred from RFC
  4544.    959.
  4545.    
  4546.    In view of these considerations, and given the need to preserve the
  4547.    traditional FTP client command structure and behavior so the software
  4548.    will be usable by most people:
  4549.    
  4550.     1. The MGET command should produce the expected result in the common
  4551.        cases, regardless of whether NLST or MLSD is used underneath.
  4552.     2. For anomalous cases, the user needs a way to control whether the
  4553.        MGET argument is sent to the server or kept for local use.
  4554.     3. At the same time, the user might need a way to send a directory
  4555.        name to the server, independent of any wildcard pattern.
  4556.     4. The user needs a way to force NLST or MLSD for a given MGET
  4557.        command.
  4558.        
  4559.    By default, Kermit's MGET command uses MLSD if MLST is reported by the
  4560.    server in its FEAT list. When MLSD is used, the filespec is sent to
  4561.    the server if it is not wild (according to Kermit's own definition of
  4562.    "wild" since it can't possibly know the server's definition). If the
  4563.    filespec is wild it is held for local use to select files from the
  4564.    list returned by the server. If MLST is not reported by the server or
  4565.    is disabled, Kermit sends the MGET filespec with the NLST directive.
  4566.    
  4567.    The default behavior can be overridden globally with FTP DISABLE MLST,
  4568.    which forces Kermit to use NLST to get file lists. And then for
  4569.    situations in which MLSD is enabled, the following MGET switches can
  4570.    be used to override the defaults for a specific MGET operation:
  4571.    
  4572.    /NLST
  4573.           Forces the client to send NLST. Example:
  4574.           
  4575. mget /nlst foo.*
  4576.  
  4577.    /MLSD
  4578.           Forces the client to send MLSD (even if MLST is disabled).
  4579.           Example:
  4580.           
  4581. mget /mlsd foo.*
  4582.  
  4583.    /MATCH:pattern
  4584.           When this switch is given, it forces the client to hold the
  4585.           pattern for local use against the returned file list. If a
  4586.           remote filespec is also given (e.g. the "blah" in "mget
  4587.           /match:*.txt blah"), then it is sent as the NLST or MLSD
  4588.           argument, presumably to specify the directory whose files are
  4589.           to be listed. When the /MATCH switch is not given, the MGET
  4590.           filespec is sent to the server if the directive is NLST or if
  4591.           the filespec is not wild. Examples:
  4592.           
  4593.   Command:                   With NLST:     With MLSD:
  4594.     mget                      NLST           MLSD
  4595.     mget *.txt                NLST *.txt     MLSD
  4596.     mget foo                  NLST foo       MLSD foo
  4597.     mget /match:*.txt         NLST           MLSD
  4598.     mget /match:*.txt foo     NLST foo       MLSD foo
  4599.  
  4600.    In other words, the pattern is always intepreted locally unless MGET
  4601.    uses NLST and no /MATCH switch was given.
  4602.      _________________________________________________________________
  4603.    
  4604.    3.11.4. Examples
  4605.    
  4606.   3.11.4.1. Downloading a Single File
  4607.   
  4608.    There are no choices here, just use the FTP GET command. Kermit always
  4609.    sends the RETR directive, and possibly SIZE and/or MDTM. The small
  4610.    advantage of using MLST in this case is outweighed by the risk and
  4611.    effort of coding a special case.
  4612.    
  4613.   3.11.4.2. Downloading a Group of Files from a Single Directory
  4614.   
  4615.    This case presents tradeoffs, especially on slow connections:
  4616.    
  4617.      * For downloading all or most of the files in a directory, MLSD is
  4618.        better because it eliminates the need to send SIZE and MDTM for
  4619.        each file. No special actions are required in this case; Kermit
  4620.        uses MLSD automatically if the server supports it (unless you have
  4621.        disabled it).
  4622.      * For a small number of files from a large directory, NLST is better
  4623.        because it bypasses downloading of a potentially huge file list
  4624.        prior to the files themselves. If you have a connection to a
  4625.        server that supports MLSD, use the /NLST switch to force NLST:
  4626.        
  4627. mget /nlst t[1234].h
  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
  4698.      current and downloads each file. The list includes names only, so
  4699.      Kermit also must send SIZE and MDTM directives if size and
  4700.      timestamp information is required (this is always true of NLST).
  4701.      Sending NLST without an argument is allowed by the RFC959 NLST
  4702.      definition and by the Kermit FTP client, but might not work with
  4703.      other clients, and also might not work with every server.
  4704.      mget /nlst foo NLST foo If "foo" is a directory, this gets a list
  4705.      of all the files from the server's "foo" directory and downloads
  4706.      each file; otherwise this downloads the file named "foo" (if any)
  4707.      from the server's current directory.
  4708.      mget /nlst *.txt NLST *.txt Gets a list of the files in the
  4709.      server's current directory whose names match the pattern *.txt, and
  4710.      then downloads each file from the list. Because we are using NLST,
  4711.      we send the filespec (*.txt) to the server and the server
  4712.      interprets any wildcards.
  4713.      mget /nlst foo/*.txt NLST foo/*.txt  Gets a list of the files in
  4714.      the server's "foo" directory whose names match the pattern *.txt,
  4715.      and then downloads each file from the list (server interprets
  4716.      wildcards).
  4717.      mget /nlst /match:*.txt NLST Gets a list of all the files in the
  4718.      server's current directory and then downloads each one whose name
  4719.      matches the pattern *.txt (client interprets wildcards).
  4720.      mget /nlst /match:*.txt foo  NLST foo Gets a list of all the files
  4721.      in the server's "foo" directory and then downloads each one whose
  4722.      name matches the pattern *.txt (client interprets wildcards).
  4723.      mget /mlsd MLSD Gets a list of all the files from the server's
  4724.      current directory and then downloads each one. The list might
  4725.      include size and timestamp information, in which case Kermit does
  4726.      not need to send SIZE and MDTM directives for each file (this is
  4727.      always true of MLSD).
  4728.      mget /mlsd foo MLSD foo Gets a list of all the files from the
  4729.      server's "foo" directory (where the string "foo" does not contain
  4730.      wildcards) and then downloads each one. If "foo" is a regular file
  4731.      and not a directory, this command is supposed to fail, but some
  4732.      servers have been observed that send the file.
  4733.      mget /mlsd *.txt MLSD Gets a list of all the files from the
  4734.      server's current directory and then downloads only the ones whose
  4735.      names match the pattern "*.txt". Because we are using MLSD and the
  4736.      MGET filespec is wild, we do not send the filespec to the server,
  4737.      but treat it as though it had been given in a /MATCH: switch and
  4738.      use it locally to match the names in the list.
  4739.      mget /mlsd foo/*.txt MLSD This one won't work because MLSD requires
  4740.      that the notions of server directory and filename-matching pattern
  4741.      be separated. However, the client, which can't be expected to know
  4742.      the server's file-system syntax, winds up sending a request that
  4743.      the server will (or should) reject.
  4744.      mget /mlsd /match:*.txt MLSD Gets a list of all the files from the
  4745.      server's current directory and then downloads only the ones whose
  4746.      names match the pattern "*.txt" (client interprets wildcards).
  4747.      mget /mlsd /match:*.txt foo MLSD foo If "foo" is a directory on the
  4748.      server, this gets a list of all the files from the server's "foo"
  4749.      directory and then downloads only the ones whose names match the
  4750.      pattern "*.txt" (client interprets wildcards). This leaves the
  4751.      server CD'd to the "foo" directory; there's no way the client can
  4752.      restore the server's original directory because MLSD doesn't give
  4753.      that information, and since the client can not be expected to know
  4754.      the server's file-system syntax, it would not be safe to guess. If
  4755.      "foo" is a regular file, MLSD fails.
  4756.      mget /mlsd foo bar MLSD This one is problematic. You're supposed to
  4757.      be able to give MGET a list a filespecs; in this case we name two
  4758.      directories. The client must change the server's directory to "foo"
  4759.      to get the list of files, and then the files themselves. But then
  4760.      it has no way to return to the server's previous directory in order
  4761.      to do the same for "bar", as explained in the previous example.
  4762.      mget /mlsd /match:* [abc] MLSD [abc] Including a /MATCH: switch
  4763.      forces [abc] to be sent to the server even though the client would
  4764.      normally think it was a wildcard and hold it for local
  4765.      interpretation. In this example, [abc] might be a VMS directory
  4766.      name.
  4767.      mget /mlsd /match:* t*.h MLSD t*.h Contrary to the MLSD
  4768.      specification, some MLSD-capable FTP servers do interpret
  4769.      wildcards. This form of the MGET command can be used to force a
  4770.      wildcard to be sent to the server for interpretation.
  4771.      
  4772.    When MLSD is used implicitly (that is, without an /MLSD switch given
  4773.    to force the use of MLSD) and an MGET command such as "mget foo/*.txt"
  4774.    fails, Kermit automatically falls back to NLST and tries again.
  4775.      _________________________________________________________________
  4776.    
  4777.    3.11.5. References
  4778.    
  4779.     1. Postel, J., and J. Reynolds, File Transfer Protocol (FTP), RFC
  4780.        959, October 1985: [359]ftp://ftp.isi.edu/in-notes/rfc959.txt.
  4781.     2. Hethmon, P, and R. Elz, Feature negotiation mechanism for the File
  4782.        Transfer Protocol, RFC 2389, August 1998:
  4783.        [360]ftp://ftp.isi.edu/in-notes/rfc2389.txt.
  4784.     3. Elz, R, and P. Hethmon, Extensions to FTP, Internet Draft
  4785.        draft-ietf-ftpext-mlst-16.txt, September 2002:
  4786.        [361]http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16
  4787.        .txt.
  4788.     4. [362]The Kermit FTP Client (overview).
  4789.        
  4790.    [ [363]Top ] [ [364]FTP Top ] [ [365]C-Kermit Home ] [ [366]Kermit
  4791.    Home ]
  4792.   __________________________________________________________________________
  4793.  
  4794. 4. FILE SCANNING
  4795.  
  4796.    A new feature called file scanning is used in various contexts to
  4797.    determine if a file is text or binary, and if it is text, what kind of
  4798.    text. The overhead of file scanning is surprisingly tolerable, usually
  4799.    about a quarter second per file. File scanning is now used instead of
  4800.    filename patterns unless you SET FILE SCAN OFF, which restores the
  4801.    previous behavior.
  4802.    
  4803.    The primary benefit of file scanning is in file transfer. For all
  4804.    practical purposes, now you can stop worrying about whether a file
  4805.    should be sent in binary or text mode, or about sending mixtures of
  4806.    text and binary files in a single operation, or configuring and
  4807.    fine-tuning your lists of binary-file and text-file name patterns: now
  4808.    it all just works.
  4809.    
  4810.    File scanning is done by the file sender, which determines the type of
  4811.    each file before it sends it and informs the receiver (Kermit or FTP
  4812.    server) of the type. File scanning is NOT done by the receiver,
  4813.    because it is the sender's responsibility to determine each file's
  4814.    type, send the file in the right mode, and inform the receiver of the
  4815.    mode. If both transfer partners are capable of this (or any other)
  4816.    form of automatic text/binary mode switching, then files can be sent
  4817.    in both directions with no worries about corruption due to
  4818.    inappropriate transfer mode. (As noted in [367]Section 3, FTP servers
  4819.    don't do this, so this discussion does not apply when using Kermit to
  4820.    download from an FTP server.)
  4821.    
  4822.    The rest of this section is mainly for the curious. If you don't read
  4823.    it and simply accept all defaults, every file you send should go in
  4824.    the appropriate mode automatically. As always, however, for
  4825.    character-set translation to work for 7- and 8-bit character-set
  4826.    files, the appropriate SET FILE CHARACTER-SET command(s) must have
  4827.    been executed to identify their encoding (Kermit's default file
  4828.    character-set is neutral ASCII except on platforms like HP-UX or
  4829.    DG/UX, where the default file character-set is known). And of course,
  4830.    receiving is another matter -- obviously the other Kermit must also
  4831.    send each file in the appropriate mode.
  4832.    
  4833.    Scanning is more reliable than filename patterns simply because
  4834.    filenames are not reliable indicators of the file's contents. Classic
  4835.    examples include ".doc" files, which are binary if Microsoft Word
  4836.    documents but text on most other platforms, and ".com" files, which
  4837.    are binary on DOS and Windows but text on VMS. Anyway, nobody knows
  4838.    the naming conventions (if any) of all the applications (and persons!)
  4839.    on your computer. Scanning, on the other hand, determines each file's
  4840.    type by inspecting its contents rather than just looking at its name.
  4841.    
  4842.    Also, file patterns -- even when they work as intended -- categorize
  4843.    each file only as text or binary, whereas file scanning can make finer
  4844.    distinctions:
  4845.    
  4846.    BINARY
  4847.           Binary data, not to be converted in any way. Examples include
  4848.           binary machine code (executable programs), graphics images
  4849.           (GIF, JPG, etc), compressed files (Z, GZ, etc), archives and
  4850.           packages (ZIP, TAR, RPM, etc), object files and libraries (OBJ,
  4851.           DLL, etc).
  4852.           
  4853.    7-BIT TEXT
  4854.           Text encoded in a 7-bit character set such as ASCII or one of
  4855.           the ISO 646 national versions. Kermit has no way to tell which
  4856.           character is used, only that it's 7-bit text. Typical examples
  4857.           include program source code, README files, Perl or Kermit
  4858.           scripts, plain-text email, HTML, TeX, and various textual
  4859.           encodings of binary files: Hex, Base64, etc. When sending such
  4860.           files, the FILE DEFAULT 7BIT-CHARACTER-SET is used as the file
  4861.           character-set, and then the appropriate transfer character set
  4862.           is chosen from the associations list (ASSOCIATE, SHOW
  4863.           ASSOCIATIONS).
  4864.           
  4865.    8-BIT TEXT
  4866.           Text encoded in an 8-bit character set such as Latin-1,
  4867.           Latin-2, Latin/Hebrew, Latin/Cyrillic, KOI8, HP-Roman8, JIS X
  4868.           0208, Code Page 437, or Code Page 1252. Again, Kermit has no
  4869.           way of knowing which particular set is in use, only that it's
  4870.           8-bit text. When sending such files, the FILE DEFAULT
  4871.           8BIT-CHARACTER-SET is used as the file character-set, and then
  4872.           the appropriate transfer character set is chosen from the
  4873.           associations list.
  4874.           
  4875.    UCS2 TEXT
  4876.           Unicode in its basic form, 16 bits (2 octets) per character.
  4877.           When sending such files, UCS2 is the file character-set and the
  4878.           byte order is identified automatically; the appropriate
  4879.           transfer character set is chosen from the associations list.
  4880.           Normally this would be UTF8. UTF-16 is not supported yet;
  4881.           Kermit's Unicode translations are restricted to Plane 0, the
  4882.           Base Multilingual Plane (BMP).
  4883.           
  4884.    UTF8 TEXT
  4885.           Unicode in its 8-bit transformation format. When sending such
  4886.           files, UTF8 is the file character-set; the appropriate transfer
  4887.           character set is chosen from the associations list, normally
  4888.           UCS2 or UTF8.
  4889.           
  4890.    File scanning is available in UNIX C-Kermit, in K-95, and to a limited
  4891.    extent, in VMS C-Kermit (full scanning is problematic in VMS because
  4892.    even plain-text files might contain binary record-format information).
  4893.    The relevant commands are:
  4894.    
  4895.    SET TRANSFER MODE { AUTOMATIC, MANUAL }
  4896.           Tells whether the file-transfer mode (text or binary) should be
  4897.           set by automatic or "manual" means. AUTOMATIC is the default,
  4898.           which allows any of the automatic methods that are enabled to
  4899.           do their jobs: FILE SCAN, FILE PATTERNS, peer recognition, etc.
  4900.           MANUAL lets you control the transfer mode with the SET FILE
  4901.           TYPE commands. As always, /TEXT and /BINARY switches on your
  4902.           file-transfer commands override all other methods; if you give
  4903.           one of these switches, scanning is not done. SHOW TRANSFER
  4904.           displays the current TRANSFER MODE setting.
  4905.           
  4906.    SET FILE SCAN { ON [ number ], OFF }
  4907.           Turns this feature on and off. It's ON by default. When OFF,
  4908.           the previous rules apply (SET FILE PATTERNS, etc). When ON is
  4909.           given, you can also specify a number of bytes to be scanned.
  4910.           The default is 49152 (= 48K). If a negative number is given,
  4911.           the entire file is scanned, no matter how big, for maximum
  4912.           certainty (for example, a PostScript file that appears to be
  4913.           plain text might include an embedded graphic past the normal
  4914.           scanning limit). SHOW FILE displays the current FILE SCAN
  4915.           setting.
  4916.           
  4917.    SET FILE DEFAULT 7BIT-CHARACTER-SET name
  4918.           Tells the 7-bit character-set to use if scanning identifies a
  4919.           7-bit text file, e.g. GERMAN. SHOW FILE displays the current
  4920.           SET FILE DEFAULT settings. So does SHOW CHARACTER-SETS.
  4921.           
  4922.    SET FILE DEFAULT 8BIT-CHARACTER-SET name
  4923.           Tells the 8-bit character-set to use if scanning identifies an
  4924.           8-bit text file, e.g. LATIN1. SHOW FILE and SHOW CHARACTER-SET
  4925.           display this.
  4926.           
  4927.    ASSOCIATE FILE-CHARACTER-SET fcs tcs
  4928.           When sending files and a file character-set (fcs) is identified
  4929.           by scanning, this tells C-Kermit which transfer character-set
  4930.           (tcs) to translate it to. It also allows C-Kermit to set the
  4931.           appropriate transfer character-set automatically whenever you
  4932.           give a SET FILE CHARACTER-SET command.
  4933.           
  4934.    ASSOCIATE TRANSFER-CHARACTER-SET tcs fcs
  4935.           When receivinging files and a file arrives whose transfer
  4936.           character-set (tcs) is announced by the sender, this command
  4937.           tells C-Kermit which file character-set (fcs) to translate it
  4938.           to. It also allows C-Kermit to set the appropriate file
  4939.           character-set whenever you give a SET TRANSFER CHARACTER-SET
  4940.           command.
  4941.           
  4942.    SET FILE CHARACTER-SET name
  4943.           When given for a 7-bit set, also sets FILE DEFAULT
  4944.           7BIT-CHARACTER-SET to the same set. When given for an 8-bit
  4945.           set, also sets FILE DEFAULT 8BIT-CHARACTER-SET to the same set.
  4946.           If an ASSOCIATE FILE-CHARACTER-SET command has been given for
  4947.           this set, also sets the corresponding transfer character-set.
  4948.           
  4949.    DIRECTORY /XFERMODE [ filespec ]
  4950.           Performs a file scan of the given files, listing the result for
  4951.           each file. If FILE SCAN is OFF but PATTERNS are ON, the result
  4952.           shown according to the current FILE TEXT-PATTERNS and
  4953.           BINARY-PATTERNS, and are restricted to (B) and (T). When FILE
  4954.           SCAN is ON, the results are:
  4955.           
  4956.   (B)          Binary
  4957.   (T)(7BIT)    Text: 7-bit
  4958.   (T)(8BIT)    Text: 8-bit
  4959.   (T)(UTF8)    Text: Unicode UTF8
  4960.   (T)(UCS2BE)  Text: Unicode UCS2 Big Endian
  4961.   (T)(UCS2LE)  Text: Unicode UCS2 Little Endian
  4962.  
  4963.           So you can use DIR /XFER to get a preview of how each file in a
  4964.           selected group will be transferred. Everything to the right of
  4965.           the (B) or (T) is new. If FILE SCAN is OFF, you only get the
  4966.           (B) or (T) as before.
  4967.           
  4968.           Note: Big and Little Endian refer to the ordering of bytes
  4969.           within a computer word. Big Endian architecture is standard and
  4970.           is used on most non-PC computers. Little Endian architecture is
  4971.           used on PCs.
  4972.           
  4973.    To illustrate file-transfer with scanning, suppose you have a
  4974.    directory containing a mixture of text and binary files, and each text
  4975.    file can be 7-bit German ISO 646, 8-bit Latin-1, or Unicode in any of
  4976.    the following forms: UCS2 Little Endian, UCS2 Big Endian, or UTF8
  4977.    ([368]UTF-16 is not supported yet). Assuming all the built-in defaults
  4978.    are in effect, the following three commands do the job:
  4979.    
  4980.   set file char german   ; This sets the default for 7-bit text files
  4981.   set file char latin1   ; This sets the default for 8-bit text files
  4982.   send *
  4983.  
  4984.    Each file is sent in the appropriate mode (text or binary), with text
  4985.    files converted to the appropriate transfer character-set and labeled
  4986.    so the receiver can convert them according to its own local
  4987.    conventions.
  4988.    
  4989.    By the way, what if you want to inhibit character-set translation but
  4990.    still allow automatic text/binary mode switching? Previously, you
  4991.    could simply SET TRANSFER CHARACTER-SET TRANSPARENT. But now with file
  4992.    scanning, the file and transfer character-sets are set automatically
  4993.    per file. A new command was added for this purpose:
  4994.    
  4995.    SET TRANSFER TRANSLATION { ON, OFF }
  4996.           Enables and disables file-transfer character-set translation.
  4997.           It is enabled by default.
  4998.           
  4999.    When TRANSFER TRANSLATION is OFF but FILE SCAN is ON, files are still
  5000.    scanned to see if they are text or binary, but no character-set
  5001.    translation is done when they text: only the normal record-format
  5002.    conversion.
  5003.    
  5004.    Like all SET commands, SET TRANSFER TRANSLATION is global and
  5005.    persistent. You can also force a particular file-transfer command
  5006.    (SEND, MSEND, GET, RECEIVE, TRANSMIT, etc) to not translate without
  5007.    affecting the global translation settings by including the new
  5008.    /TRANSPARENT switch, e.g.
  5009.    
  5010.   send /transparent oofa.txt
  5011.  
  5012.    As of C-Kermit 8.0.206, SET TRANSFER CHARACTER-SET TRANSPARENT implies
  5013.    SET TRANSFER TRANSLATION OFF.
  5014.    
  5015.    File scanning is also used in the TYPE command. The source file type
  5016.    and character set are determined as above, and then the file is
  5017.    automatically converted to your display character-set, line by line.
  5018.    In Kermit 95, the display character-set is Unicode, perhaps converted
  5019.    to your current console code page; in other versions of C-Kermit, it
  5020.    is your current file character-set. Thus if you have the following set
  5021.    appriately:
  5022.    
  5023.   SET FILE CHARACTER-SET (necessary in Unix but not K95)
  5024.   SET FILE DEFAULT 7BIT CHARACTER-SET
  5025.   SET FILE DEFAULT 8BIT CHARACTER-SET
  5026.  
  5027.    then you should be able to TYPE any text file and see something
  5028.    reasonable. For example, in Unix, if your DEFAULT 7BIT-CHARACTER-SET
  5029.    is ITALIAN and your DEFAULT 8BIT-CHARACTER-SET is LATIN1, and your
  5030.    FILE CHARACTER-SET is LATIN1, you can TYPE an Italian ISO 646 file, a
  5031.    Latin-1 file, or any kind of Unicode file, and have it translated
  5032.    automatically to Latin-1 for your display.
  5033.    
  5034.    In the GUI version of Kermit 95, you can see mixtures of many
  5035.    different scripts if the file is UTF8 or UCS2: Roman, Cyrillic,
  5036.    Hebrew, Greek, Armenian, Georgian, etc, all on the same screen at
  5037.    once.
  5038.    
  5039.    File scanning also adds a new criterion for file selection, i.e. to
  5040.    select only text (or binary) files. Several commands now include a new
  5041.    switch, /TYPE:{BINARY,TEXT,ALL}. BINARY means select only binary
  5042.    regular files (not directories). TEXT means select only text files.
  5043.    ALL means don't scan; select all files. Examples:
  5044.    
  5045.    SEND /TYPE:BINARY *.*
  5046.           Sends only binary files, skipping over text files.
  5047.           
  5048.    NOTE: File scanning is NOT done when using external protocols (because
  5049.    the external protocol programs, such as sz, are processing each file,
  5050.    not Kermit).
  5051.    
  5052.    DIRECTORY /TYPE:TEXT
  5053.           Lists only text files but not binary files.
  5054.           
  5055.    DELETE /TYPE:BINARY foo.*
  5056.           Deletes all foo.* files that are regular binary files but does
  5057.           not delete any text files.
  5058.           
  5059.    CHMOD /TYPE:BINARY 775 *
  5060.           (UNIX) Changes the permissions of all binary files to 775.
  5061.           
  5062.    When FILE SCAN is OFF and FILE PATTERNS are ON, behavior is as before
  5063.    with PATTERNS ON, but with some improvements:
  5064.    
  5065.      * Pathnames are now stripped prior to pattern matching.
  5066.      * Backup suffixes (like .~3~) are stripped prior to pattern
  5067.        matching.
  5068.        
  5069.    [ [369]Top ] [ [370]Contents ] [ [371]C-Kermit Home ] [ [372]Kermit
  5070.    Home ]
  5071.   __________________________________________________________________________
  5072.  
  5073. 5. FILE AND DIRECTORY NAMES CONTAINING SPACES
  5074.  
  5075.    Prior to the introduction of the graphical user interface (GUI), it
  5076.    was inconceivable that file or directory names could contain spaces,
  5077.    because space is a field delimiter in all command languages. GUIs,
  5078.    however, use dialog boxes for filenames, so there is never any
  5079.    question of distinguishing a filename from adjacent fields -- because
  5080.    there are no adjacent fields -- and therefore it has become quite
  5081.    common on computers that have GUIs to have file and directory names
  5082.    composed of multiple words. Of course this poses problems for command
  5083.    shells and other text-oriented programs.
  5084.    
  5085.    Most command shells address these problems by allowing such names to
  5086.    be enclosed in doublequotes, e.g.:
  5087.    
  5088.   cd "c:\Program Files"
  5089.  
  5090.    C-Kermit previously used braces for this:
  5091.    
  5092.   cd {c:\Program Files}
  5093.  
  5094.    which was not what most people expected. And even when braces were
  5095.    used, Kermit had difficulties with completion, file menus, and so
  5096.    forth, within braced fields.
  5097.    
  5098.    C-Kermit 8.0 allows either doublequotes or braces to be used for
  5099.    grouping:
  5100.    
  5101.   send "this file"
  5102.   send {this file}
  5103.   rename "this file" "that file"
  5104.   rename {this file} "that file"
  5105.   rename "this file" {that file}
  5106.   cd {Program Files}
  5107.   cd "Program Files"
  5108.  
  5109.    Note that the doublequotes or brackets must enclose the whole file or
  5110.    directory specification:
  5111.    
  5112.   "c:\My Directory"
  5113.  
  5114.    not:
  5115.    
  5116.   c:\"My Directory"
  5117.  
  5118.    In C-Kermit 8.0, you can also use completion on these filenames, in
  5119.    which case Kermit supplies the quotes (or braces) automatically.
  5120.    Example (in which the current directory contains only one file whose
  5121.    name starts with "th" and its full name is "this file" (without the
  5122.    quotes, but with the space)):
  5123.    
  5124.   cat th<Tab>
  5125.  
  5126.    Kermit repaints the filename field like this:
  5127.    
  5128.   cat "this file"
  5129.  
  5130.    That is, it backspaces over the original "th" and then writes the
  5131.    filename in doublequotes.
  5132.    
  5133.    If completion is only partial, Kermit still supplies the quotes, but
  5134.    in this case also beeps. To continue the filename, you must first
  5135.    backspace over the closing quote. The closing quote is supplied in
  5136.    this case to make sure that you can see the spaces, especially if they
  5137.    are trailing. For example, if the current directory contains two files
  5138.    whose names start with "th", and their fill names are "this file" and
  5139.    "this other file":
  5140.    
  5141.   cat th<Tab>
  5142.  
  5143.    Kermit prints:
  5144.    
  5145.   cat "this "<Beep>
  5146.  
  5147.    If it didn't print the closing quote, you would probably wonder why it
  5148.    was beeping.
  5149.    
  5150.    Also, if you begin a filename field with a doublequote or opening
  5151.    brace, now you can use completion or get ?-help; this was never
  5152.    possible before.
  5153.    
  5154.  C-Kermit>type "thi? Input file specification, one of the following:
  5155.    this file        this other file
  5156.  C-Kermit>type "thi_
  5157.  
  5158.    [ [373]Top ] [ [374]Contents ] [ [375]C-Kermit Home ] [ [376]Kermit
  5159.    Home ]
  5160.   __________________________________________________________________________
  5161.  
  5162. 6. OTHER COMMAND PARSING IMPROVEMENTS
  5163.  
  5164.   6.1. Grouping Macro Arguments
  5165.   
  5166.    Doublequotes now can be used in macro invocations to group arguments
  5167.    containing spaces, where previously only braces could be used:
  5168.    
  5169.   define xx show args
  5170.   xx one "this is two" three
  5171.  
  5172.    Result:
  5173.    
  5174.   Macro arguments at level 0 (\v(argc) = 4):
  5175.    \%0 = xx
  5176.    \%1 = one
  5177.    \%2 = this is two
  5178.    \%3 = three
  5179.  
  5180.    Also, you can now quote braces and quotes in macro args (this didn't
  5181.    work before). Examples:
  5182.    
  5183.   xx "{"  ; The argument is a single left brace
  5184.   xx {"}  ; The argument is a doublequote character
  5185.  
  5186.    In case this new behavior interferes with your scripts, you can
  5187.    restore the previous behavior with:
  5188.    
  5189.   SET COMMAND DOUBLEQUOTING OFF
  5190.  
  5191.   6.2. Directory and File Name Completion
  5192.   
  5193.    C-Kermit 8.0 also includes better completion for directory names, e.g.
  5194.    in the CD command. If the name typed so far uniquely matches a
  5195.    directory name, it is completed (as before), but now if the directory
  5196.    contains any subdirectories, completion is partial (allowing you to
  5197.    supply additional path segments without backspacing); otherwise it is
  5198.    complete.
  5199.    
  5200.    Completion has also been improved for file and directory names that
  5201.    contain not only spaces (as described above) but also "metacharacters"
  5202.    such as asterisk (*) and tilde (~): now the field is repainted if
  5203.    necessary. For example, if the current directory contains only one
  5204.    file whose name contains "blah", then in:
  5205.    
  5206.   type *blah<Tab>
  5207.  
  5208.    "*blah" is replaced by the filename. In earlier releases, the part
  5209.    typed so far was left on the command line (and in the history buffer),
  5210.    so even when the original command worked, the recalled version would
  5211.    not. Similarly for ~ (the nearly-universal Unix notation for
  5212.    username):
  5213.    
  5214.   type ~olga/x<Tab>
  5215.  
  5216.    is repainted as (e.g.):
  5217.    
  5218.   type /users/home/olga/x(Beep)
  5219.  
  5220.    Speaking of command history, the new SHOW HISTORY command shows your
  5221.    command history and recall buffer. SAVE COMMAND HISTORY saves it into
  5222.    a file of your choice.
  5223.    
  5224.   6.3. Passing Arguments to Command Files
  5225.   
  5226.    The method for passing arguments to command files has been improved.
  5227.    Prior to C-Kermit 7.0 there was no provision for doing this. In
  5228.    C-Kermit 7.0, the TAKE command was changed to allow arguments to be
  5229.    given after the filename:
  5230.    
  5231.   take commandfile arg1 arg2 ...
  5232.  
  5233.    This was accomplished by replacing the current \%1, \%2, etc, with the
  5234.    given arguments, since a new set of macro argument variables is
  5235.    created only when a macro is executed, not a command file. It is much
  5236.    more intuitive, however, if arguments to command files worked like
  5237.    those to macros: the command file sees the arguments as its own \%1,
  5238.    \%2, etc, but the caller's variables are not disturbed. C-Kermit 8.0
  5239.    accomplishes this by automatically creating an intermediate temporary
  5240.    macro to start the command file (if any arguments were given), thus
  5241.    creating a new level of arguments as expected.
  5242.    
  5243.   6.4. More-Prompting
  5244.   
  5245.    The familiar --more?-- prompt that appears at the end of each
  5246.    screenful of command-response output now accepts a new answer: G (Go)
  5247.    meaning "show all the rest without pausing and asking me any more
  5248.    questions". P (Proceed) is a synonym for G.
  5249.    
  5250.   6.5. Commas in Macro Definitions
  5251.   
  5252.    As noted in the [377]C-Kermit manual, comma is used to separate
  5253.    commands in a macro definition. Even when the macro is defined on
  5254.    multiple lines using curly-brace block-structure notation without
  5255.    commas, the definition is still stored internally as a comma-separated
  5256.    list of commands. Therefore special tricks are needed to include a
  5257.    comma in a command. The classic example is:
  5258.    
  5259.   define foo {
  5260.       (some command)
  5261.       if fail echo Sorry, blah failed...
  5262.   }
  5263.  
  5264.    This would result in Kermit trying to execute a "blah" command. This
  5265.    could always be handled by enclosing the text in braces:
  5266.    
  5267.   define foo {
  5268.       (some command)
  5269.       if fail echo {Sorry, blah failed...}
  5270.   }
  5271.  
  5272.    but doublequotes (more intuitive) should have worked too. Now they do:
  5273.    
  5274.   define foo {
  5275.       (some command)
  5276.       if fail echo "Sorry, blah failed..."
  5277.   }
  5278.  
  5279.   6.6. Arrow Keys
  5280.   
  5281.    As of version 8.0.201, C-Kermit on most platforms lets you access the
  5282.    command history buffer with arrow keys, just as you always could with
  5283.    control characters. The restrictions are:
  5284.    
  5285.     1. Only Up and Down arrow keys are accepted.
  5286.     2. Only 7-bit ANSI arrow-key sequences are understood (ESC followed
  5287.        by [ or uppercase letter O, followed by uppercase letter A or (up)
  5288.        B (down).
  5289.        
  5290.    This change was made to facilitate command recall in Linux-based PDAs
  5291.    that don't have a Control key, or at least not one that's easily (or
  5292.    always) accessible, such as the Sharp Zaurus SL5500.
  5293.    
  5294.    [ [378]Top ] [ [379]Contents ] [ [380]C-Kermit Home ] [ [381]Kermit
  5295.    Home ]
  5296.   __________________________________________________________________________
  5297.  
  5298. 7. NEW COMMANDS AND SWITCHES
  5299.  
  5300.    See [382]Section 4 for more about file scanning and the /TYPE: switch.
  5301.    
  5302.    ASK[Q] [ /TIMEOUT:number /QUIET ] variable [ prompt ]
  5303.           The new optional /TIMEOUT: switch for ASK and ASKQ causes the
  5304.           command to time out and and fail if no response is given within
  5305.           the specified number of seconds, 1 or greater (0 or less means
  5306.           no timeout, wait forever). This works just like SET ASK-TIMER,
  5307.           except its effect is local to the ASK command with which it is
  5308.           given and it does not disturb the global ask timer setting. The
  5309.           new /QUIET switch tells Kermit not to print an error message if
  5310.           the ASK or ASKQ command times out waiting for a response.
  5311.           
  5312.    CAT filename
  5313.           Equivalent to TYPE /NOPAGE.
  5314.           
  5315.    CDUP
  5316.           Changes Kermit's local working directory to the parent of the
  5317.           current one. Equivalent to "cd .." in UNIX or Windows, "cd [-]"
  5318.           in VMS, "cd ^" in AOS/VS, etc; in other words, it's a
  5319.           platform-independent way of moving one level up in a directory
  5320.           tree.
  5321.           
  5322.    CHMOD [ switches ] permission files
  5323.           UNIX only. Sets file permissions for one or more files or
  5324.           directories. The permission must be given as an octal number,
  5325.           e.g. 664, 755. Switches: /DIRECTORIES, /FILES, /NOLIST, /PAGE,
  5326.           /DOTFILES, /LIST, /NOPAGE, /RECURSIVE, /TYPE:{TEXT,BINARY,ALL},
  5327.           /SIMULATE. The /TYPE: switch allows selection of only text or
  5328.           binary files. For example, if you have a mixture of source
  5329.           files and executables, you can use "chmod /files /type:text
  5330.           664" to give owner/group read/write and world read permission
  5331.           to the text files, and "chmod /files /type:binary 775" to give
  5332.           the same plus execute permission to the executables. Use
  5333.           /SIMULATE to see which files would be affected, without
  5334.           actually changing their permissions.
  5335.           
  5336.    CLEAR KEYBOARD-BUFFER
  5337.           Flushes any as-yet unread characters from the keyboard input
  5338.           buffer. Useful for flushing typeahead in scripts.
  5339.           
  5340.    CONTINUE
  5341.           When given at an interactive command prompt that was reached by
  5342.           issuing a PROMPT command (described in this section) from a
  5343.           script, this command returns to the script, continuing its
  5344.           execution at the command after the PROMPT command. In this
  5345.           context, CONTINUE is simply a more-intuitive synonym for END.
  5346.           
  5347.    COPY, RENAME, and TRANSLATE
  5348.           These commands now work on file groups if the target filename
  5349.           is a directory, e.g. "copy oofa.* ..", "rename * ~olga/tmp/"
  5350.           
  5351.    COPY /APPEND source destination
  5352.           The source file specification can now include wildcards, in
  5353.           which case all of the source files that match will go into the
  5354.           destination file in alphabetical order by name.
  5355.           
  5356.    DELETE /ASK
  5357.           Asks permission to delete each file before deleting it. In
  5358.           C-Kermit 7.0, the answers were "yes" (or "ok") and "no".
  5359.           C-Kermit 8.0 adds "go" (meaning, delete all the rest without
  5360.           asking) and "quit" (cancel the DELETE command and return to the
  5361.           prompt).
  5362.           
  5363.    DELETE /DIRECTORIES
  5364.           Deletes not only files but also directories.
  5365.           
  5366.    DELETE /RECURSIVE
  5367.           Deletes all files that match the given file specification in
  5368.           the current (or given) directory and all directories beneath
  5369.           it.
  5370.           
  5371.    DELETE /SUMMARY
  5372.           Prints only the number of files deleted and total size freed,
  5373.           without listing each file.
  5374.           
  5375.    DELETE /TREE
  5376.           Shorthand for DELETE /RECURSIVE /DIRECTORIES /DOTFILES/.
  5377.           Equivalent to Windows DELTREE or Unix "rm -Rf". If no file
  5378.           specification is given, the contents of the current directory,
  5379.           plus all of its subdirectories and their contents, are deleted.
  5380.           
  5381.    DELETE /TYPE:BINARY
  5382.           Delete only regular binary files (requires FILE SCAN ON).
  5383.           
  5384.    DELETE /TYPE:TEXT
  5385.           Delete only regular text files (requires FILE SCAN ON).
  5386.           
  5387.    DIRECTORY [ switches ] [ filespec [ filespec [ filespec ... ] ] ]
  5388.           The DIRECTORY command now accepts more than one file
  5389.           specification; e.g. "directory moon.txt sun.doc stars.*".
  5390.           
  5391.    DIRECTORY /NORECURSIVE xxx
  5392.           If xxx is a directory name, forces listing of the directory
  5393.           itself rather than its contents.
  5394.           
  5395.    DIRECTORY /FOLLOWLINKS xxx
  5396.           (UNIX only) Tells the DIRECTORY command to follow symbolic
  5397.           links. This not the default because it can cause endless loops.
  5398.           
  5399.    DIRECTORY /NOFOLLOWLINKS xxx
  5400.           (UNIX only) Tells the DIRECTORY command not to follow symbolic
  5401.           links, but rather, merely to list them. This is the default.
  5402.           
  5403.    DIRECTORY /OUTPUT:filename
  5404.           Sends the results of the DIRECTORY command to the given file.
  5405.           
  5406.    DIRECTORY /SUMMARY
  5407.           Prints only the number of directories and files and the total
  5408.           size, without listing each file.
  5409.           
  5410.    DIRECTORY /TYPE:{TEXT,BINARY}
  5411.           Shows only files of the selected type, based on file scan.
  5412.           
  5413.    DIRECTORY /XFERMODE
  5414.           Now shows results of file scan (see [383]Section 4).
  5415.           
  5416.    GREP [ switches ] pattern files
  5417.           Similar to Unix grep command: displays file lines that match
  5418.           the given [384]pattern. Switches:
  5419.           
  5420.         /COUNT[:variable]
  5421.                 Don't show the matching lines, just tell how many lines
  5422.                 match. If a variable name is specified, the count is
  5423.                 stored in the given variable.
  5424.                 
  5425.         /DOTFILES
  5426.                 Include files whose names begin with dot.
  5427.                 
  5428.         /LINENUMBERS
  5429.                 Show line numbers of matching lines.
  5430.                 
  5431.         /NAMEONLY
  5432.                 only list the names of files that contain matching lines,
  5433.                 but not the lines themselves.
  5434.                 
  5435.         /NOBACKUP
  5436.                 Skip backup files.
  5437.                 
  5438.         /NOCASE
  5439.                 Ignore alphabetic case while pattern matching.
  5440.                 
  5441.         /NODOTFILES
  5442.                 skip files whose names start with dot (period).
  5443.                 
  5444.         /NOLIST
  5445.                 Suppress output but set SUCCESS or FAILURE according to
  5446.                 search result.
  5447.                 
  5448.         /NOMATCH
  5449.                 Look for lines that do not match the pattern.
  5450.                 
  5451.         /NOPAGE
  5452.                 Don't pause between screens of output.
  5453.                 
  5454.         /OUTPUT:filename
  5455.                 Write results into the given file.
  5456.                 
  5457.         /PAGE
  5458.                 Pause between screens of output.
  5459.                 
  5460.         /RECURSIVE
  5461.                 Search files in subdirectories too.
  5462.                 
  5463.         /TYPE:{TEXT,BINARY}
  5464.                 Search only files of the specified type.
  5465.                 
  5466.           Synonyms: FIND, SEARCH.
  5467.           
  5468.    GETOK /TIMEOUT:n /QUIET
  5469.           The new /QUIET switch instructs GETOK, when given a timeout,
  5470.           not to print an error message if it times out.
  5471.           
  5472.    HEAD [ switches ] filename
  5473.           Equivalent to TYPE /HEAD [ other-switches ] filename.
  5474.           
  5475.    HELP DATE
  5476.           Explains date-time formats, including timezone notation and
  5477.           delta times.
  5478.           
  5479.    HELP FIREWALLS
  5480.           Explains the firewall negotiation capabilities of your version
  5481.           of Kermit.
  5482.           
  5483.    KCD [ symbolic-directory-name ]
  5484.           Changes Kermit's working directory to the named symbolic
  5485.           directory, such as such as exedir, inidir, startup, download,
  5486.           or and home. Type "kcd ?" for a list of symbolic directory
  5487.           names known to your copy of Kermit, or give the new ORIENTATION
  5488.           command for a more detailed explanation. If you give a KCD
  5489.           command without a directory name, Kermit returns to its "home"
  5490.           directory, which is determined in some way that depends on the
  5491.           underlying operating system, but which you can redefine with
  5492.           the (new) SET CD HOME command. Your home directory is shown by
  5493.           SHOW CD and it's also the value of the \v(home) variable.
  5494.           
  5495.    LICENSE
  5496.           Displays the C-Kermit license.
  5497.           
  5498.    L-commands
  5499.           When Kermit has a connection to a Kermit or FTP server, file
  5500.           managment commands such as CD, DIRECTORY, and DELETE might be
  5501.           intended for the local computer or the remote server. C-Kermit
  5502.           8.0.200 and earlier always executes these commands on the local
  5503.           computer. If you want them executed by the remote server, you
  5504.           have to prefix them with REMOTE (e.g. REMOTE CD) or use special
  5505.           R-command aliases (e.g. RCD = REMOTE CD, RDIR = REMOTE DIR,
  5506.           etc). But this feels unnatural to FTP users, who expect
  5507.           unprefixed file management commands to be executed by the
  5508.           remote server, rather than locally. C-Kermit 8.0.201 adds
  5509.           automatic locus switching to present an FTP-like interface for
  5510.           FTP connections and the normal Kermit interface for Kermit
  5511.           connections, and a SET LOCUS command (described below) to
  5512.           control whether or how this is done. For when LOCUS is REMOTE,
  5513.           a new set of commands was added for local management: LCD
  5514.           (Local CD), LDIR (Local DIR), etc. These are described below
  5515.           under SET LOCUS.
  5516.           
  5517.    MORE filename
  5518.           Equivalent to TYPE /PAGE.
  5519.           
  5520.    ORIENTATION
  5521.           Displays symbolic directory names and the corresponding
  5522.           variable names and values. The symbolic names, such as exedir,
  5523.           inidir, startup, download, and home, can be used as arguments
  5524.           to the new KCD command.
  5525.           
  5526.    PROMPT [ text ]
  5527.           For use in a macro or command file: enters interactive command
  5528.           mode within the current context ([385]Section 8.1). If the
  5529.           optional text is included, the prompt is set to it. The text
  5530.           can include variables, functions, etc, as in the SET PROMPT
  5531.           command. They are evaluated each time the prompt is printed.
  5532.           Unlike the SET PROMPT command, the text argument applies only
  5533.           to the current command level. Thus you can have different
  5534.           prompts at different levels.
  5535.           
  5536.    REMOTE SET MATCH { DOTIFILE, FIFO } { ON, OFF }
  5537.           Allows the client to tell the server whether wildcards sent to
  5538.           the server should match dot files (files whose names begin with
  5539.           period) or FIFOs (named pipes). See SET MATCH.
  5540.           
  5541.    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
  5542.           Allows control of the Kermit's Record-Format attribute. Set
  5543.           this to OFF in case incoming file are refused due to unknown or
  5544.           invalid record formats if you want to accept the file anyway
  5545.           (and, perhaps, postprocess it to fix its record format).
  5546.           
  5547.    SET CD HOME [ directory ]
  5548.           Specifies the target directory for the CD and KCD commands,
  5549.           when they are given without an argument, and also sets the
  5550.           value of the \v(home) variable.
  5551.           
  5552.    SET EXIT HANGUP { OFF, ON }
  5553.           Normally ON, meaning that when Kermit exits, it also explicitly
  5554.           hangs up the current SET LINE / SET PORT serial port according
  5555.           to the current SET MODEM TYPE and SET MODEM HANGUP METHOD, and
  5556.           closes the port device if it was opened by Kermit in the first
  5557.           place (as opposed to inherited). SET EXIT HANGUP OFF tells
  5558.           Kermit not to do this. This can't prevent the operating system
  5559.           from closing the device when Kermit exits (and it's a "last
  5560.           close") but if the port or modem have been conditioned to
  5561.           somehow ignore the close and keep the connection open, at least
  5562.           Kermit itself won't do anything explicit to hang it up or close
  5563.           it.
  5564.           
  5565.    SET FILE EOF { CTRL-Z, LENGTH }
  5566.           Specifies the end-of-file detection method to be used by
  5567.           C-Kermit when sending and receiving text files, and in the TYPE
  5568.           and similar text-file oriented commands. The normal and default
  5569.           method is LENGTH. You can specify CTRL-Z when handling CP/M or
  5570.           MS-DOS format text files, in which a Ctrl-Z (ASCII 26)
  5571.           character within the file marks the end of the file.
  5572.           
  5573.    SET FILE LISTSIZE number
  5574.           Allocates space for the given number of filenames to be filled
  5575.           in by the wildcard expander. The current number is shown by
  5576.           SHOW FILE. If you give a command that includes a filename
  5577.           containing a wildcard (such as "*") that matches more files
  5578.           that Kermit's list has room for, you can adjust the list size
  5579.           with this command.
  5580.           
  5581.    SET FILE STRINGSPACE number
  5582.           Allocates space for the given amount of filename strings for
  5583.           use by the wildcard expander. The current number is shown by
  5584.           SHOW FILE. The number is the total number of bytes of all the
  5585.           file specifications that match the given wildcard.
  5586.           
  5587.      If you need to process a bigger list of files than your computer
  5588.      has memory for, you might be able use an external file list. The
  5589.      Kermit SEND and the FTP PUT and GET commands accept a /LISTFILE:
  5590.      switch, which gives the name of a file that contains the list of
  5591.      files to be transferred. Example for UNIX:
  5592.      
  5593.   !find . -print | grep / > /tmp/names
  5594.   ftp put /update /recursive /listfile:/tmp/names
  5595.  
  5596.    SET LOCUS { AUTO, LOCAL, REMOTE }
  5597.           Added in C-Kermit 8.0.201.   Sets the locus for unprefixed file
  5598.           management commands such as CD, DIRECTORY, MKDIR, etc. When
  5599.           LOCUS is LOCAL these commands act locally and a REMOTE (or R)
  5600.           prefix (e.g. REMOTE CD, RCD, RDIR) is required to send file
  5601.           management commands to a remote server. When LOCUS is REMOTE,
  5602.           an L prefix is required to issue local file management commands
  5603.           (e.g. LCD, LDIR). The word LOCAL can't be used as a prefix
  5604.           since it is already used for declaring local variables. LOCUS
  5605.           applies to all types of connections, and thus is orthogonal to
  5606.           SET GET-PUT-REMOTE, which selects between Kermit and FTP for
  5607.           remote file-transfer and management commands. The default LOCUS
  5608.           is AUTO, which means we switch to REMOTE whenever an FTP
  5609.           connection is made, and to LOCAL whenever a non-FTP connection
  5610.           is made, and switch back accordingly whenever a connnection is
  5611.           closed. So by default, Kermit behaves in its traditional manner
  5612.           unless you make an FTP connection, in which case it acts like a
  5613.           regular FTP client (but better :-)   LOCUS applies to the
  5614.           following commands:
  5615.           
  5616.   Unprefixed    Remote       Local        Description        
  5617.    CD (CWD)      RCD          LCD          Change (Working) Directory
  5618.    CDUP          RCDUP        LCDUP        CD Up
  5619.    PWD           RPWD         LPWD         Print Working Directory
  5620.    DIRECTORY     RDIR         LDIR         Request a directory listinga
  5621.    DELETE        RDEL         LDEL         Delete (a) file(s)
  5622.    RENEME        RREN         LREN         Rename a file
  5623.    MKDIR         RMKDIR       LMKDIR       Create a directory
  5624.    RMDIR         RRMDIR       LRMDIR       Remove a directory
  5625.  
  5626.    SET MATCH { DOTIFILE, FIFO } { ON, OFF }
  5627.           Whether C-Kermit filename patterns (wildcards) should match
  5628.           filenames that start with dot (period), or (Unix only) FIFOs
  5629.           (named pipes). The defaults are to skip dotfiles in Unix but
  5630.           match them elsewhere, and to skip FIFOs. Applies to both
  5631.           interactive use and to server mode, when the server receives
  5632.           wildcards, e.g. in a GET command. Also see REMOTE SET MATCH.
  5633.           
  5634.    SET OPTIONS DIRECTORY /DOTFILES
  5635.           Now works for server listings too (UNIX only). Give this
  5636.           command prior to having Kermit enter server mode, and then it
  5637.           will show files whose names begin with dot (period) when sent a
  5638.           REMOTE DIRECTORY command.
  5639.           
  5640.    SET QUIET ON
  5641.           (as well as the -q command-line option) Now applies also to:
  5642.           
  5643.           + SET HOST connection progress messages.
  5644.           + "Press the X or E key to cancel" file-transfer message.
  5645.           + REMOTE CD response.
  5646.           + REMOTE LOGIN response.
  5647.             
  5648.    SET RECEIVE PERMISSIONS { ON, OFF }
  5649.           Tells C-Kermit whether to set the permissions of incoming files
  5650.           (received with Kermit protocol) from the permissions supplied
  5651.           in the file's Attribute packet (if any). Normally ON. Also see
  5652.           SET SEND PERMISSIONS.
  5653.           
  5654.    SET ROOT directory
  5655.           Like UNIX chroot, without requiring privilege. Sets the root
  5656.           for file access, does not allow reference to or creation of
  5657.           files outside the root, and can't be undone.
  5658.           
  5659.    SET SEND PERMISSIONS { ON, OFF }
  5660.           Tells C-Kermit whether to include file permissions in the
  5661.           attributes it includes with each file when sending with Kermit
  5662.           protocol. Also see SET RECEIVE PERMISSIONS.
  5663.           
  5664.    SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER:name /PASSWORD:text
  5665.           These commands now allow specification of username and
  5666.           password.
  5667.           
  5668.    SET TERMINAL . . .
  5669.           (See [386]Section 12.)
  5670.           
  5671.    SET TRANSFER MESSAGE [ text ]
  5672.           Sets an initial text message to be displayed in the
  5673.           file-transfer display. The transfer message is automatically
  5674.           deleted once used, so must be set each time a message a
  5675.           desired. Any variables in the message are evaluated at the time
  5676.           the SET command is given. If the optional text is omitted, any
  5677.           transfer message that is currently set is removed. Synonym: SET
  5678.           XFER MSG. SHOW TRANSFER displays it if it has been set but not
  5679.           yet used.
  5680.           
  5681.    SHOW COMMUNICATIONS
  5682.           In C-Kermit 8.0, SHOW COMMUNICATIONS, when given in remote mode
  5683.           (i.e. before any connection has been established), tells the
  5684.           typical dialout device name for the particular platform on
  5685.           which it's running (e.g. TXA0: for VMS, or /dev/cua0p0 for
  5686.           HP-UX). On Unix platforms, it also tells the name of the
  5687.           lockfile directory. This way, you have an idea of what the SET
  5688.           LINE device name should look like, and if the SET LINE command
  5689.           fails, you know the name of the directory or device that is
  5690.           protected against you.
  5691.           
  5692.    SHOW VARIABLES [ name [ name [ ... ] ] ]
  5693.           In C-Kermit 8.0.201 you can request values of a list of
  5694.           built-in (\v(xxx)) variables. Each name is a pattern, as
  5695.           before, but now it a free pattern rather than an anchored one
  5696.           (explained in [387]Section 8.12) so now "show var date time"
  5697.           shows the values of all variables whose names include the
  5698.           strings "date" or "time".
  5699.           
  5700.    TAIL [ switches ] filename
  5701.           Equivalent to TYPE /TAIL [ other-switches ] filename.
  5702.           
  5703.    TRANSMIT /NOECHO [ other switches ] filename
  5704.           The /NOECHO switch is equivalent to giving the command SET
  5705.           TRANSMIT ECHO OFF prior to the TRANSMIT command, except the
  5706.           switch affects only the command with which it was given and
  5707.           does not affect the prevailing global setting.
  5708.           
  5709.    TRANSMIT /NOWAIT [ other switches ] filename
  5710.           The /NOWAIT switch is equivalent to giving the command SET
  5711.           TRANSMIT PROMPT 0 prior to the TRANSMIT command, except the
  5712.           switch affects only the command with which it was given and
  5713.           does not affect the prevailing global setting.
  5714.           
  5715.    TRANSMIT /NOWAIT /NOECHO /BINARY [ other switches ] filename
  5716.           When the TRANSMIT command is given with the /NOWAIT, /NOECHO,
  5717.           and /BINARY switches, this activates a special "blast the whole
  5718.           file out the communications connection all at once" mode that
  5719.           Kermit didn't have prior to version 8.0. There has been
  5720.           increasing demand for this type of transmission with the advent
  5721.           of devices that expect image (e.g. .JPG) or sound (e.g. .MP3)
  5722.           files as raw input. The obvious question is: how does the
  5723.           receiving device know when it has the whole file? This depends
  5724.           on the device, of course; usually after a certain amount of
  5725.           time elapses with nothing arriving, or else when Kermit hangs
  5726.           up or closes the connection.
  5727.           
  5728.    TYPE /CHARACTER-SET:name
  5729.           Allows you to specify the character set in which the file to be
  5730.           typed is encoded.
  5731.           
  5732.    TYPE /NUMBER
  5733.           Adds line numbers.
  5734.           
  5735.    TYPE /OUTPUT:filename
  5736.           Sends the results of the TYPE command to the given file.
  5737.           
  5738.    TYPE /TRANSLATE-TO:name
  5739.           Used in conjunction with TYPE /CHARACTER-SET:xxx; allows you to
  5740.           specify the character set in which the file is to be displayed.
  5741.           
  5742.    TYPE /TRANSPARENT
  5743.           Used to disable character-set translation in the TYPE command,
  5744.           which otherwise can take place automatically based on file
  5745.           scanning, even when /CHARACTER-SET and /TRANSLATE-TO switches
  5746.           are not given.
  5747.           
  5748.    VOID text
  5749.           Parses the text, evaluating any backslash items in it (such as
  5750.           function calls) but doesn't do anything further, except
  5751.           possibly printing error messages. Useful for invoking functions
  5752.           that have side effects without using or printing their direct
  5753.           results, e.g. "void \fsplit(\%a,&a)".
  5754.           
  5755.   Symbolic Links in UNIX
  5756.   
  5757.    The UNIX versions of C-Kermit have had /FOLLOWLINKS and /NOFOLLOWLINKS
  5758.    switches added to several commands to control the treatment of
  5759.    symbolic links. Different commands deal differently with symbolic
  5760.    links:
  5761.    
  5762.    Kermit SEND, FTP MPUT
  5763.           /NOFOLLOWLINKS is the default, which means symbolic links are
  5764.           skipped entirely. The alternative, /FOLLOWLINKS, should be used
  5765.           with caution, since an innocent link might point to a whole
  5766.           file system, or it might cause a loop. There is no way in
  5767.           Kermit or FTP protocol to send the link itself. We either skip
  5768.           them or follow them; we can't duplicate them.
  5769.           
  5770.    DIRECTORY
  5771.           /NOFOLLOWLINKS is the default, which means the DIRECTORY
  5772.           command lists symbolic links in a way that shows they are
  5773.           links, but it does not follow them. The alternative,
  5774.           /FOLLOWLINKS, follows links and gives information about the
  5775.           linked-to directories and files.
  5776.           
  5777.    DELETE, RMDIR
  5778.           The DELETE command does not have link-specific switches. DELETE
  5779.           never follows links. If you tell Kermit to delete a symbolic
  5780.           link, it deletes the link itself, not the linked-to file. Ditto
  5781.           for RMDIR.
  5782.           
  5783.    COPY
  5784.           The COPY command behaves just like the UNIX cp command; it
  5785.           always follows links.
  5786.           
  5787.    RENAME
  5788.           The RENAME command behaves just like the UNIX mv command; it
  5789.           operates on links directly rather than following.
  5790.           
  5791.    [ [388]Top ] [ [389]Contents ] [ [390]C-Kermit Home ] [ [391]Kermit
  5792.    Home ]
  5793.   __________________________________________________________________________
  5794.  
  5795. 8. OTHER SCRIPTING IMPROVEMENTS
  5796.  
  5797.   8.1. Performance and Debugging
  5798.   
  5799.    A command cache for frequently used commands plus some related
  5800.    optimizations increases the speed of compute-bound scripts by anywhere
  5801.    from 50% to 1000%.
  5802.    
  5803.    The new PROMPT command can be used to set breakpoints for debugging
  5804.    scripts. If executed in a command file or macro, it gives you an
  5805.    interactive command prompt in the current context of the script, with
  5806.    all its variables, arguments, command stack, etc, available for
  5807.    examination or change, and the ability to resume the script at any
  5808.    point (END resumes it, Ctrl-C or STOP cancels it and returns to top
  5809.    level).
  5810.    
  5811.    The new Ctrl-C trapping feature ([392]Section 8.14) lets you intercept
  5812.    interruption of scripts. This can be used in combination with the
  5813.    PROMPT command to debug scripts. Example:
  5814.    
  5815. define ON_CTRLC {
  5816.     echo INTERRUPTED BY CTRL-C...
  5817.     echo The command stack has not yet been rolled back:
  5818.     show stack
  5819.     echo Type Ctrl-C again or use the END command to return to top level.
  5820.     prompt Debug>
  5821. }
  5822.  
  5823.    Adding this ON_CTRL definition to your script lets you interrupt it at
  5824.    any point and get prompt that is issued at the current command level,
  5825.    so you can query local variables, etc.
  5826.    
  5827.    [ [393]Top ] [ [394]Contents ] [ [395]C-Kermit Home ] [ [396]Kermit
  5828.    Home ]
  5829.      _________________________________________________________________
  5830.    
  5831.   8.2. Using Macros as Numeric Variables
  5832.   
  5833.    A macro is a way to assign a value to a name, and then use the name to
  5834.    refer to the value. Macros are used in two ways in Kermit: as
  5835.    "subroutines" or functions composed of Kermit commands, which are
  5836.    executed, or as variables to hold arbitrary values -- text, numbers,
  5837.    filenames, etc.
  5838.    
  5839.    When a macro is to be executed, its name is given as if it were a
  5840.    C-Kermit command, optionally preceded by the word "do". When a macro
  5841.    is used as a variable, it must be "escaped" with \m(xxx) (or
  5842.    equivalent function, e.g. \s(xxx), \:(xxx), \fdefinition(xxx)), where
  5843.    xxx is the macro name, for example:
  5844.    
  5845.   define filename /usr/olga/oofa.txt
  5846.   send \m(filename)
  5847.  
  5848.    Of course variables can also hold numbers:
  5849.    
  5850.   define size 17
  5851.   declare \&a[\m(size)]
  5852.   ...
  5853.   define index 3
  5854.   if ( == \m(index) 3 ) echo The third value is: \&a[\m(index)]
  5855.   evaluate index (\m(index) * 4)
  5856.   if ( > \m(index) \m(size) ) echo Out of range!
  5857.  
  5858.    But these are contexts in which only numbers are valid. C-Kermit 8.0
  5859.    has been changed to treat non-escaped non-numeric items in strictly
  5860.    numeric contexts as macro names. So it is now possible (but not
  5861.    required) to omit the \m(...) notation and just use the macro name in
  5862.    these contexts:
  5863.    
  5864.   define size 17
  5865.   declare \&a[size]
  5866.   ...
  5867.   define index 3
  5868.   if ( == index 3 ) echo The third value is: \&a[index]
  5869.   evaluate index (index * 4)
  5870.   if ( > index size ) echo Out of range!
  5871.  
  5872.    This is especially nice for loops that deal with arrays. Here, for
  5873.    example, is a loop that reverses the order of the elements in an
  5874.    array. Whereas formerly it was necessary to write:
  5875.    
  5876.   .\%n ::= \fdim(&a)
  5877.   for \%i 1 \%n/2 1 {
  5878.       .tmp := \&a[\%n-\%i+1]
  5879.       .\&a[\%n-\%i+1] := \&a[\%i]
  5880.       .\&a[\%i] := \m(tmp)
  5881.   }
  5882.  
  5883.    Recoding this to use macro names "i" and "n" instead of the backslash
  5884.    variables \%i and \%n, we have:
  5885.    
  5886.   .n ::= \fdim(&a)
  5887.   for i 1 n/2 1 {
  5888.       .tmp := \&a[n-i+1]
  5889.       .\&a[n-i+1] := \&a[i]
  5890.       .\&a[i] := \m(tmp)
  5891.   }
  5892.  
  5893.    which reduces the backslash count to less than half. The final
  5894.    statement in the loop could be written ".\&a[i] ::= tmp" if the array
  5895.    contained only numbers (since ::= indicates arithmetic expression
  5896.    evaluation).
  5897.    
  5898.    Also, now you can use floating-point numbers in integer contexts (such
  5899.    as array subscripts), in which case they are truncated to an integer
  5900.    value (i.e. the fractional part is discarded).
  5901.    
  5902.    Examples of numeric contexts include:
  5903.    
  5904.      * Array subscripts.
  5905.      * Any numeric function argument.
  5906.      * Right-hand side of ::= assignments.
  5907.      * EVALUATE command or \fevaluate() function expression.
  5908.      * The INCREMENT or DECREMENT by-value.
  5909.      * IF =, >, <, !=, >=, and <= comparands.
  5910.      * The IF number construct.
  5911.      * FOR-loop variables.
  5912.      * STOP, END, and EXIT status codes.
  5913.      * The INPUT timeout value.
  5914.      * PAUSE, WAIT, SLEEP, MSLEEP intervals.
  5915.      * The SHIFT argument.
  5916.      * Numeric switch arguments, e.g. TYPE /WIDTH:number, SEND
  5917.        /LARGER:number.
  5918.      * SCREEN MOVE-TO row and column number.
  5919.      * Various SET DIAL parameters (timeout, retry limit, etc).
  5920.      * Various SET SEND or RECEIVE parameters (packet length, window
  5921.        size, etc).
  5922.      * Various other SET parameters.
  5923.        
  5924.    and:
  5925.    
  5926.      * S-Expressions (explained in [397]Section 9).
  5927.        
  5928.    Macro names used in numeric contexts must not include mathematical
  5929.    operators. Although it is legal to create a macro called "foo+bar", in
  5930.    a numeric context this would be taken as the sum of the values of
  5931.    "foo" and "bar". Any such conflict can be avoided, of course, by
  5932.    enclosing the macro name in \m(...).
  5933.    
  5934.    [ [398]Top ] [ [399]Contents ] [ [400]C-Kermit Home ] [ [401]Kermit
  5935.    Home ]
  5936.      _________________________________________________________________
  5937.    
  5938.   8.3. New IF Conditions
  5939.   
  5940.    Several new IF conditions are available:
  5941.    
  5942.    IF DECLARED arrayname
  5943.           Explained in [402]Section 8.6.
  5944.           
  5945.    IF KBHIT
  5946.           Allows a script to test whether a key was pressed without
  5947.           actually trying to read it.
  5948.           
  5949.    IF KERBANG (Unix only)
  5950.           True if Kermit was started from a Kerbang script. This is
  5951.           useful for knowing how to interpret the \&@[] and \&_[]
  5952.           argument vector arrays, and under what conditions to exit.
  5953.           
  5954.    IF INTEGER n
  5955.           This is just a synonym for IF NUMERIC, which is true if n
  5956.           contains only digits (or, if n is a variable, its value
  5957.           contains only digits).
  5958.           
  5959.    By contrast, IF FLOAT n succeeds if n is a floating-point number OR an
  5960.    integer (or a variable with floating-point or integer value).
  5961.    Therefore, IF FLOAT should be used whenever any kind of number is
  5962.    acceptable, whereas IF INTEGER (or IF NUMERIC) when only an integer
  5963.    can be used.
  5964.    
  5965.    [ [403]Top ] [ [404]Contents ] [ [405]C-Kermit Home ] [ [406]Kermit
  5966.    Home ]
  5967.      _________________________________________________________________
  5968.    
  5969.   8.4. The ON_UNKNOWN_COMMAND Macro
  5970.   
  5971.    The new ON_UNKNOWN_COMMAND macro, if defined, is executed whenever you
  5972.    give a command that is not known to C-Kermit; any operands are passed
  5973.    as arguments. Here are some sample definitions:
  5974.    
  5975.   DEF ON_UNKNOWN_COMMAND telnet \%1 ; Treat unknown commands as hostnames
  5976.   DEF ON_UNKNOWN_COMMAND dial \%1   ; Treat unknown commands phone numbers
  5977.   DEF ON_UNKNOWN_COMMAND take \%1   ; Treat unknown commands as filenames
  5978.   DEF ON_UNKNOWN_COMMAND !\%*       ; Treat unknown commands as shell commands
  5979.  
  5980.    [ [407]Top ] [ [408]Contents ] [ [409]C-Kermit Home ] [ [410]Kermit
  5981.    Home ]
  5982.      _________________________________________________________________
  5983.    
  5984.   8.5. The SHOW MACRO Command
  5985.   
  5986.    The SHOW MACRO command has been changed to accept more than one macro
  5987.    name:
  5988.    
  5989.   (setq a 1 b 2 c 3)
  5990.   show mac a b c
  5991.   a = 1
  5992.   b = 2
  5993.   c = 3
  5994.  
  5995.    An exact match is required for each name (except that case doesn't
  5996.    matter). If you include wildcard characters, however, a pattern match
  5997.    is performed:
  5998.    
  5999.   show mac [a-c]*x
  6000.  
  6001.    shows all macros whose names start with a, b, or c, and end with x.
  6002.    
  6003.    [ [411]Top ] [ [412]Contents ] [ [413]C-Kermit Home ] [ [414]Kermit
  6004.    Home ]
  6005.      _________________________________________________________________
  6006.    
  6007.   8.6. Arrays
  6008.   
  6009.    A clarification regarding references to array names (as opposed to
  6010.    array elements): You can use array-name "abbreviations" like &a only
  6011.    in contexts that expect array names, like ARRAY commands or array-name
  6012.    function arguments such as the second argument of \fsplit(). In a
  6013.    LOCAL statement, however, you have to write \&a[], since "local &a"
  6014.    might refer to a macro named "&a".
  6015.    
  6016.    In function arguments, however, you MUST use the abbreviated form:
  6017.    \fsplit(\%a,&a) or \fsplit(\%a,&a[]). If you include the backslash (as
  6018.    in "\fsplit(\%a,\&a[])") a parse error occurs.
  6019.    
  6020.    Here are the new array-related commands:
  6021.    
  6022.    IF DECLARED arrayname
  6023.           Allows a script to test whether an array has been declared. The
  6024.           arrayname can be a non-array backslash variable such as \%1 or
  6025.           \m(name), in which case it is evaluated first, and the result
  6026.           is treated as the array name. Otherwise, arrayname is treated
  6027.           as in the ARRAY commands: it can be a, &a, &a[], \&a, \&a[],
  6028.           \&a[3], \&a[3:9], etc, with the appropriate results in each
  6029.           case. Synonym: IF DCL.
  6030.           
  6031.    UNDECLARE arrayname
  6032.           UNDECLARE is a new top-level command to undeclare an array.
  6033.           Previously this could only be done with "declare \&a[0]" (i.e.
  6034.           re-declare the array with a dimension of 0).
  6035.           
  6036.    ARRAY LINK linkname arrayname
  6037.           Creates a symbolic link from the array named by linkname (which
  6038.           must be the name of an array that is not yet declared in the
  6039.           current context) to the array named by arrayname (which must
  6040.           the name of a currently declared array that is not itself a
  6041.           link, or a variable containing the name of such an array). The
  6042.           two names indicate the same array: if you change an array
  6043.           element, the change is reflected in the link too, and vice
  6044.           versa. If you undeclare the link, the real array is unaffected.
  6045.           If you undeclare the real array, all links to it disappear. If
  6046.           you resize an array (directly or through a link), all links to
  6047.           it are updated automatically.
  6048.           
  6049.    Array links let you pass array names as arguments to macros. For
  6050.    example, suppose you had a program that needed to uppercase all the
  6051.    elements of different arrays at different times. You could write a
  6052.    macro to do this, with the array name as an argument. But without
  6053.    array links, there would be no way to refer to the argument array
  6054.    within the macro. Array links make it easy:
  6055.    
  6056.   define arrayupper {
  6057.       local \&e[] \%i
  6058.       array link \&e[] \%1
  6059.       for i 1 \fdim(&e) 1 { .\&e[i] := \fupper(\&e[i]) }
  6060.   }
  6061.   declare \&a[] = these are some words
  6062.   arrayupper &a
  6063.   show array &a
  6064.  
  6065.    The macro declares the array link LOCAL, which means it doesn't
  6066.    conflict with any array of the same name that might exist outside the
  6067.    macro, and that the link is destroyed automatically when the macro
  6068.    exits. This works, by the way, even if the link name and the macro
  6069.    argument name are the same, as long as the link is declared LOCAL.
  6070.    
  6071.    As noted, you can't make a link to a nonexistent array. So when
  6072.    writing a macro whose job is to create an array whose name is passed
  6073.    as an argument, you must declare the array first (the size doesn't
  6074.    matter as long as it's greater than 0). Example:
  6075.    
  6076.   define tryme {                ; Demonstration macro
  6077.       local \&e[]               ; We only need this inside the macro
  6078.       array link \&e[] \%1      ; Make local link
  6079.       shift                     ; Shift argument list
  6080.       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
  6081.   }
  6082.   declare \&a[1]                ; Declare target array in advance
  6083.   tryme &a here are some words  ; Invoke the macro with array name and words
  6084.   show array a                  ; See the results
  6085.  
  6086.    One final improvement allows the macro itself to declare the array
  6087.    (this was not possible in earlier Kermit releases): if the array name
  6088.    in the DECLARE command is a variable (and not an array name), or
  6089.    includes variables, the resulting value is used as the array name. So:
  6090.    
  6091.   define tryme {                ; Demonstration macro
  6092.       declare \%1[1]            ; Preliminary declaration for target array
  6093.       local \&e[]               ; We only need this inside the macro
  6094.       array link \&e[] \%1      ; Make local link
  6095.       shift                     ; Shift argument list
  6096.       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
  6097.   }
  6098.   tryme &a here are some words  ; Invoke the macro with array name and words
  6099.   show array a                  ; See the results
  6100.  
  6101.    The SHOW ARRAY command now indicates whether an array name is a link.
  6102.    
  6103.    Also see the descriptions of [415]\fjoin() and [416]\fsplit(), plus
  6104.    [417]Section 8.10 on the MINPUT command, which shows how an entire
  6105.    array (or segment of it) can be used as the MINPUT target list.
  6106.    
  6107.    [ [418]Top ] [ [419]Contents ] [ [420]C-Kermit Home ] [ [421]Kermit
  6108.    Home ]
  6109.      _________________________________________________________________
  6110.    
  6111.   8.7. New or Improved Built-in Variables and Functions
  6112.   
  6113.    The following new built-in variables are available:
  6114.    
  6115.   \v(buildid)       A date string like "20000808" indicating when C-Kermit was
  6116. built.
  6117.   \v(ftime)         Current time, secs since midnight, including fraction of se
  6118. cond.
  6119.   \v(iprompt)       The current SET PROMPT value
  6120.   \v(sexp)          The most recent S-Expression (see [422]Section 9)
  6121.   \v(sdepth)        The current S-Expression invocation depth ([423]Section 9)
  6122.   \v(svalue)        The value of the most recent S-Expression ([424]Section 9)
  6123.  
  6124.   \v(ftp_code)      Most recent FTP response code ([425]Section 3)
  6125.   \v(ftp_connected) FTP connection status ([426]Section 3)
  6126.   \v(ftp_cpl)       FTP Command Protection Level ([427]Section 3.2)
  6127.   \v(ftp_dpl)       FTP Data Protection Level ([428]Section 3.2)
  6128.   \v(ftp_getputremote) The current SET GET-PUT-REMOTE setting ([429]Section 3.8
  6129. )
  6130.   \v(ftp_host)      Name or IP address of FTP server ([430]Section 3)
  6131.   \v(ftp_loggedin)  FTP login status ([431]Section 3)
  6132.   \v(ftp_message)   Most recent FTP response message ([432]Section 3)
  6133.   \v(ftp_security)  FTP Security method ([433]Section 3.2)
  6134.   \v(ftp_server)    OS type of FTP server ([434]Section 3)
  6135.  
  6136.   \v(http_code)       Most recent HTTP response code
  6137.   \v(http_connected)  HTTP connection status
  6138.   \v(http_host)       Name or IP address of HTTP server
  6139.   \v(http_message)    Most recent HTTP response message
  6140.   \v(http_security)   TLS cipher used to secure the HTTP session
  6141.  
  6142.   \v(hour)            Hour of the day, 0 to 23.
  6143.   \v(timestamp)       Equivalent to "\v(ndate) \v(time)".
  6144.  
  6145.   \v(log_debug)       Current debug log file, if any.
  6146.   \v(log_packet)      Current packet log file, if any.
  6147.   \v(log_session)     Current session log file, if any.
  6148.   \v(log_transaction) Current transaction log file, if any.
  6149.   \v(log_connection)  Current connection log file, if any.
  6150.  
  6151.    The following new or improved built-in functions are available:
  6152.    
  6153.   \fcmdstack()            Allows programmatic access to the command stack.
  6154.   \fcvtdate()             [435]Section 8.13, format options added
  6155.   \fdelta2secs()          [436]Section 8.13
  6156.   \fdostounixpath(s1)     Converts a DOS filename to Unix format.
  6157.   \fsplit()               Now allows grouping/nesting in source string.
  6158.   \fword()                Allows the same grouping and nesting.
  6159.   \fjoin(&a,s1,n1,n2)     Copies an array into a single string.
  6160.   \fsubstitute(s1,s2,s3)  Substitutes characters within a string.
  6161.   \freplace()             Has new 4th "occurrence" argument.
  6162.   \fsexpression()         Evaluates an S-Expression (explained in [437]Section
  6163. 9).
  6164.   \ftrim(), \fltrim()     Now trim CR and LF by default, as well as SP and Tab.
  6165.   \funixtodospath(s1)     Converts a Unix filename to DOS format.
  6166.   \fkeywordval(s1,c1)     Assigns values to keywords (macros) (explained below)
  6167. .
  6168.  
  6169.    Most functions that have "2" in their names to stand for the word "2"
  6170.    can now also be written with "to", e.g. "\fdelta2secs(),"
  6171.    \fdeltatosecs()."
  6172.    
  6173.   8.7.1. The \fkeywordval() Function
  6174.   
  6175.    \fkeywordval(s1,c1) is new. Given a string s1 of the form
  6176.    "name=value", it creates a macro with the given name and assigns it
  6177.    the given value. If no value appears after the equal sign, any
  6178.    existing macro of the given name is undefined. Blanks are
  6179.    automatically trimmed from around the name and value. The optional c1
  6180.    parameter is the assignment operator character, equal sign (=) by
  6181.    default. This function is handy for processing keyword parameters or
  6182.    any other form of parameter-value pair. Suppose, for example, you want
  6183.    to write a macro that accepts keyword parameters rather than
  6184.    positional ones:
  6185.    
  6186.   define MYDIAL {
  6187.       local \%i modem hangup method device speed number
  6188.       def number 5551234          ; Assign default parameter values
  6189.       def speed 57600
  6190.       def modem usrobotics
  6191.       def hangup rs232
  6192.       def method tone
  6193.       def country 1
  6194.       for \%i 1 \v(argc)-1 1 {    ; Parse any keyword parameters...
  6195.           if not \fkeywordval(\&_[\%i]) end 1 Bad parameter: "\&_[\%i]"
  6196.       }
  6197.       set dial country \m(country)
  6198.       set modem type \m(modem)
  6199.       set modem hang \m(hangup)
  6200.       set dial method \m(tone)
  6201.       set line \m(device)
  6202.       if fail stop 1
  6203.       set speed \m(speed)
  6204.       if fail stop 1
  6205.       show comm
  6206.       set dial display on
  6207.       dial \m(number)
  6208.       if success connect
  6209.   }
  6210.  
  6211.    In this example, all the defaults are set up inside the macro, and
  6212.    therefore it can be invoked with no parameters at all. But if you want
  6213.    to have the macro dial a different number, you can supply it as
  6214.    follows:
  6215.    
  6216.   mydial number=7654321
  6217.  
  6218.    You can supply any number of keyword parameters, and you can give them
  6219.    in any order:
  6220.    
  6221.   mydial number=7654321 hangup=modem speed=115200
  6222.  
  6223.   8.7.2. The \fsplit(), \fjoin(), and \fword() Functions
  6224.   
  6225.    \fjoin(&a,s1,n1,n2) is also new; it creates a string from an array (or
  6226.    a piece of one). &a is the name of the array (a range specifier can be
  6227.    included); s1 is a character or string to separate each element in the
  6228.    result string (can be omitted, in which case the elements are not
  6229.    separated at all), and n1 is a grouping mask, explained below. If s1
  6230.    is empty or not specified, the array elements are separated with
  6231.    spaces. If you want the elements concatenated with no separator,
  6232.    include a nonzero n2 argument. Given the array:
  6233.    
  6234.   declare \&a[] = 0 1 2 3 4 5 6 7 8 9
  6235.  
  6236.    you can get effects like this:
  6237.    
  6238.   \fjoin(&a)      0 1 2 3 4 5 6 7 8 9
  6239.   \fjoin(&a,:)    0:1:2:3:4:5:6:7:8:9
  6240.   \fjoin(&a,{,})  0,1,2,3,4,5,6,7,8,9
  6241.   \fjoin(&a,...)  0...1...2...3...4...5...6...7...8...9
  6242.   \fjoin(&a,,,1)  0123456789
  6243.  
  6244.    \fsplit(), \fword(), \fstripb(), and \fjoin() accept a "grouping mask"
  6245.    argument, n1, which is a number from 0 to 63, in which:
  6246.    
  6247.    1 = "" doublequotes
  6248.    2 = {} braces
  6249.    4 = '' singlequotes
  6250.    8 = () parentheses
  6251.   16 = [] square brackets
  6252.   32 = <> angle brackets
  6253.  
  6254.    These can be OR'd (added) together to make any number 0-63 (-1 is
  6255.    treated the same as 63, 0 means no grouping). If a bit is on, the
  6256.    corresponding kind of grouping is selected. (If more than 1 bit is set
  6257.    for \fjoin(), only the lowest-order one is used.)
  6258.    
  6259.    If you include the same character in the grouping mask and the include
  6260.    list, the grouping mask takes precedence. Example:
  6261.    
  6262.   def \%a  a "b c d" e
  6263.   \fsplit(\%a,&a[],,,-1)  = 3  <-- doublequote used for grouping
  6264.   \fsplit(\%a,&a[],,",-1) = 3  <-- doublequote still used for grouping
  6265.  
  6266.    Nesting of matched left and right grouping characters (parentheses,
  6267.    braces, and brackets, but not quotes) is recognized. Example:
  6268.    
  6269.   def \%a a (b c <d e [f g {h i} j k] l m> n o) p
  6270.   \fsplit(\%a,&a,,,0)  = 16 (no grouping)
  6271.   \fsplit(\%a,&a,,,2)  = 15 (braces only)
  6272.   \fsplit(\%a,&a,,,16) = 11 (square brackets only)
  6273.   \fsplit(\%a,&a,,,32) =  7 (angle brackets only)
  6274.   \fsplit(\%a,&a,,,63) =  3 (all)
  6275.   \fsplit(\%a,&a,,,-1) =  3 (all)
  6276.  
  6277.    \fsplit() and \fjoin() are "reciprocal" functions. You can split a
  6278.    string up into an array and join it back into a new string that is
  6279.    equivalent, as long as \fsplit() and \fjoin() are given equivalent
  6280.    grouping masks, except that the type of braces might change. Example:
  6281.    
  6282.   def \%a a {b c [d e] f g} "h i" j <k l> m
  6283.   echo STRING=[\%a]
  6284.   echo WORDS=\fsplit(\%a,&a,,,-1)
  6285.   show array a
  6286.   asg \%b \fjoin(&a,{ },2)
  6287.   echo JOIN  =[\%b]
  6288.   echo WORDS=\fsplit(\%b,&b,,,-1)
  6289.   show array b
  6290.  
  6291.    The arrays a and b are identical. The strings a and b are as follows:
  6292.    
  6293.   \%a: a {b c [d e] f g} "h i" j <k l> m
  6294.   \%b: a {b c [d e] f g} {h i} j {k l} m
  6295.  
  6296.    It is possible to quote separator grouping characters with backslash
  6297.    to override their grouping function. And of course to include
  6298.    backslash itself in the string, it must be quoted too. Furthermore,
  6299.    each backslash must be doubled, so the command parser will still pass
  6300.    one backslash to \fsplit() for each two that it sees. Here are some
  6301.    examples using \fsplit() with a grouping mask of 8 (treat parentheses
  6302.    as grouping characters).
  6303.    
  6304.   String                  Result
  6305.     a b c d e f             6
  6306.     a b\\ c d e f           5
  6307.     a b (c d e) f           4
  6308.     a b \\(c d e\\) f       6
  6309.     a b \\\\(c d e\\\\) f   7
  6310.  
  6311.    \fsplit() has also been changed to create its array (if one is given)
  6312.    each time it is called, so now it can be conveniently called in a loop
  6313.    without having to redeclare the array each time.
  6314.    
  6315.    Incidentally... Sometimes you might want to invoke \fsplit() in a
  6316.    situation where you don't care about its return value, e.g. when you
  6317.    just want to fill the array. Now you can "call" \fsplit() or any other
  6318.    function with the new [438]VOID command:
  6319.    
  6320.   void \fsplit(\%a,&a)
  6321.  
  6322.    \fsplit() and \fjoin() also accept a new, optional 6th argument, an
  6323.    options flag, a number that can specify a number of options. So far
  6324.    there is just one option, whose value is 1:
  6325.    
  6326.    separator-flag
  6327.           Normally separators are collapsed. So, for example,
  6328.           
  6329.   \fword(Three        little          words,2)
  6330.  
  6331.           returns "little" (the second word). Space is a separator, but
  6332.           there are multiple spaces between each word. If the value 1 is
  6333.           included in the option flag, however, each separator counts. If
  6334.           two separators are adjacent, an empty word is produced between
  6335.           them. This is useful for parsing (e.g.) comma-separated lists
  6336.           exported from databases or spreadsheets.
  6337.           
  6338.   8.7.3. The \fcmdstack() Function
  6339.   
  6340.    The new \fcmdstack() function gives access to the command stack:
  6341.    
  6342.    \fcmdstack(n1,n2)
  6343.           Arguments: n1 is the command stack level. If omitted, the
  6344.           current level, \v(cmdlevel), is used. n2 is a function code
  6345.           specifying the desired type of information:
  6346.           
  6347.  
  6348.   0 (default) = name of object at level n1.
  6349.   1 (nonzero) = object type (0 = prompt; 1 = command file; 2 = macro).
  6350.  
  6351.    The default for n2 is 0.
  6352.           
  6353.    The name associated with prompt is "(prompt)". Here's a loop that can
  6354.    be included in a macro or command file to show the stack (similar to
  6355.    what the SHOW STACK command does):
  6356.    
  6357.   for \%i \v(cmdlevel) 0 -1 {
  6358.       echo \%i. [\fcmdstack(\%i,1)] \fcmdstack(\%i,0)
  6359.   }
  6360.  
  6361.    In this connection, note that \v(cmdfile) always indicates the most
  6362.    recently invoked active command file (if any), even if that file is
  6363.    executing a macro. Similarly, \v(macro) indicates the most recently
  6364.    invoked macro (if any), even if the current command source is not a
  6365.    macro. The name of the "caller" of the currently executing object
  6366.    (command file or macro) is:
  6367.    
  6368.   \fcmdstack(\v(cmdlevel)-1)
  6369.  
  6370.    and its type is:
  6371.    
  6372.   \fcmdstack(\v(cmdlevel)-1,1)
  6373.  
  6374.    To find the name of the macro that invoked the currently executing
  6375.    object, even if one or more intermediate command files (or prompting
  6376.    levels) are involved, use a loop like this:
  6377.    
  6378.   for \%i \v(cmdlevel)-1 0 -1 {
  6379.       if = \fcmdstack(\%i,1) 2 echo CALLER = \fcmdstack(\%i,0)
  6380.   }
  6381.  
  6382.    Of course if you make a macro to do this, the macro must account for
  6383.    its own additional level:
  6384.    
  6385.   define CALLER {
  6386.       for \%i \v(cmdlevel)-2 0 -1 {
  6387.           if = \fcmdstack(\%i,1) 2 return \fcmdstack(\%i,0)
  6388.       }
  6389.       return "(none)"
  6390.   }
  6391.  
  6392.    The built-in variable \v(cmdsource) gives the current command source
  6393.    as a word ("prompt", "file", or "macro").
  6394.    
  6395.   8.7.4. The VOID Command
  6396.   
  6397.    VOID is like ECHO in that all functions and variables in its argument
  6398.    text are evaluated. but it doesn't print anything (except possibly an
  6399.    error message if a function was invocation contained or resulted in
  6400.    any errors). VOID sets FAILURE if it encounters any errors, SUCCESS
  6401.    otherwise.
  6402.    
  6403.    [ [439]Top ] [ [440]Contents ] [ [441]C-Kermit Home ] [ [442]Kermit
  6404.    Home ]
  6405.      _________________________________________________________________
  6406.    
  6407.   8.8. The RETURN and END Commands
  6408.   
  6409.    The execution of a macro is terminated in any of the following ways:
  6410.    
  6411.      * With an END [ number [ message ] ] command. If a number is given,
  6412.        the macro succeeds if the number is 0, and fails if it is not
  6413.        zero; if a number is not given, the macro succeeds.
  6414.      * With a STOP command, which works just like END except it peels
  6415.        back the command stack all the way to top level.
  6416.      * With a RETURN [ text ] command, in which case the macro always
  6417.        succeeds.
  6418.      * By running out of commands to execute, in which case the macro
  6419.        succeeds or fails according the most recently executed command
  6420.        that sets success or failure.
  6421.        
  6422.    The same considerations apply to command files invoked by the TAKE
  6423.    command.
  6424.    
  6425.    If a macro does not execute any commands that set success or failure,
  6426.    then invoking the macro does not change the current SUCCESS/FAILURE
  6427.    status. It follows, then, that the mere invocation of a macro does not
  6428.    change the SUCCESS/FAILURE status either. This makes it possible to
  6429.    write macros to react to the status of other commands (or macros), for
  6430.    example:
  6431.    
  6432.   define CHKLINE {
  6433.       if success end 0
  6434.       stop 1 SET LINE failed - please try another device.
  6435.   }
  6436.   set modem type usrobotics
  6437.   set line /dev/cua0
  6438.   chkline
  6439.   set speed 57600
  6440.   dial 7654321
  6441.  
  6442.    By the way, none of this is news. But it was not explicitly documented
  6443.    before, and C-Kermit 7.0 and earlier did not always handle the RETURN
  6444.    statement as it should have.
  6445.    
  6446.    [ [443]Top ] [ [444]Contents ] [ [445]C-Kermit Home ] [ [446]Kermit
  6447.    Home ]
  6448.      _________________________________________________________________
  6449.    
  6450.   8.9. UNDEFINing Groups of Variables
  6451.   
  6452.    The UNDEFINE command, which previously accepted one variable name, now
  6453.    accepts a list of them, and also accepts wildcard notation to allow
  6454.    deletion of variables that match a given pattern.
  6455.    
  6456.    UNDEFINE [ switches ] name [ name [ name [ ... ] ] ]
  6457.           Undefines the variables whose names are given. Up to 64 names
  6458.           may be given in one UNDEFINE command.
  6459.           
  6460.    If you omit the switches and include only one name, the UNDEFINE
  6461.    command works as before.
  6462.    
  6463.    Switches include:
  6464.    
  6465.    /MATCHING
  6466.           Specifies that the names given are to treated as patterns
  6467.           rather than literal variable names. Note: pattern matching
  6468.           can't be used with array references; use the ARRAY command to
  6469.           manipulate arrays and subarrays.
  6470.           
  6471.    /LIST
  6472.           List the name of each variable to be undefined, and whether it
  6473.           was undefined successfully ("ok" or "error"), plus a summary
  6474.           count at the end.
  6475.           
  6476.    /SIMULATE
  6477.           List the names of the variables that would be deleted without
  6478.           actually deleting them. Implies /LIST.
  6479.           
  6480.    The UNDEFINE command fails if there were any errors and succeeds
  6481.    otherwise.
  6482.    
  6483.    The new _UNDEFINE command is like UNDEFINE, except the names are
  6484.    assumed to be variable names themselves, which contain the names (or
  6485.    parts of them) of the variables to be undefined. For example, if you
  6486.    have the following definitions:
  6487.    
  6488.   define \%a foo
  6489.   define foo This is some text
  6490.  
  6491.    then:
  6492.    
  6493.   undef \%a
  6494.  
  6495.    undefines the variable \%a, but:
  6496.    
  6497.   _undef \%a
  6498.  
  6499.    undefines the macro foo.
  6500.    
  6501.    Normal Kermit patterns are used for matching; metacharacters include
  6502.    asterisk, question mark, braces, and square brackets. Thus, when using
  6503.    the /MATCHING switch, if the names of the macros you want to undefine
  6504.    contain any of these characters, you must quote them with backslash to
  6505.    force them to be taken literally. Also note that \%* is not the name
  6506.    of a variable; it is a special notation used within a macro for "all
  6507.    my arguments". The command "undef /match \%*" deletes all \%x
  6508.    variables, where x is 0..9 and a..z. Use "undef /match \%[0-9]" to
  6509.    delete macro argument variables or "undef /match \%[i-n]" to delete a
  6510.    range of \%x variables.
  6511.    
  6512.    [ [447]Top ] [ [448]Contents ] [ [449]C-Kermit Home ] [ [450]Kermit
  6513.    Home ]
  6514.      _________________________________________________________________
  6515.    
  6516.   8.10. The MINPUT Command
  6517.   
  6518.    The MINPUT command can be used to search the incoming data stream for
  6519.    several targets simultaneously. For example:
  6520.    
  6521.   MINPUT 8 one two three
  6522.  
  6523.    waits up to 8 seconds for one of the words "one", "two", or "three" to
  6524.    arrive. Words can be grouped to indicate targets that contain spaces:
  6525.    
  6526.   MINPUT 8 nineteeen twenty "twenty one"
  6527.  
  6528.    And of course you can also use variables in place of (or as part of)
  6529.    the target names:
  6530.    
  6531.   MINPUT 8 \%a \&x[3] \m(foo)
  6532.  
  6533.    Until now you had to know the number of targets in advance when
  6534.    writing the MINPUT statement. Each of the examples above has exactly
  6535.    three targets.
  6536.    
  6537.    But suppose your script needs to look for a variable number of
  6538.    targets. For this you can use arrays and \fjoin(), described in
  6539.    [451]Section 8.7. Any number of \fjoin() invocations can be included
  6540.    in the MINPUT target list, and each one is expanded into the
  6541.    appropriate number of separate targets each time the MINPUT command is
  6542.    executed. Example:
  6543.    
  6544.   declare \&a[10] = one two three
  6545.   minput 10 foo \fjoin(&a) bar
  6546.  
  6547.    This declares an array of ten elements, and assigns values to the
  6548.    first three of them. The MINPUT command looks for these three (as well
  6549.    as the words "foo" and "bar"). Later, if you assign additional
  6550.    elements to the array, the same MINPUT command also looks for the new
  6551.    elements.
  6552.    
  6553.    If an array element contains spaces, each word becomes a separate
  6554.    target. To create one target per array element, use \fjoin()'s
  6555.    grouping feature:
  6556.    
  6557.   dcl \&a[] = {aaa bbb} {ccc ddd} {xxx yyy zzz}
  6558.  
  6559.   minput 10 \fjoin(&a)     <-- 7 targets
  6560.   minput 10 \fjoin(&a,,2)  <-- 3 targets
  6561.  
  6562.    [ [452]Top ] [ [453]Contents ] [ [454]C-Kermit Home ] [ [455]Kermit
  6563.    Home ]
  6564.      _________________________________________________________________
  6565.    
  6566.   8.11. Learned Scripts
  6567.   
  6568.    C-Kermit now includes a simple script recorder that monitors your
  6569.    commands, plus your actions during CONNECT mode, and automatically
  6570.    generates a script program that mimics what it observed. You should
  6571.    think of this feature as a script-writing ASSISTANT since, as you will
  6572.    see [456]later in this section, the result generally needs some
  6573.    editing to make it both secure and flexible. The script recorder is
  6574.    controlled by the new LEARN command:
  6575.    
  6576.    LEARN [ /ON /OFF /CLOSE ] [ filename ]
  6577.           If you give a filename, the file is opened for subsequent
  6578.           recording. The /ON switch enables recording to the current file
  6579.           (if any); /OFF disables recording. /CLOSE closes the current
  6580.           script recording file (if any). If you give a filename without
  6581.           any switches, /ON is assumed.
  6582.           
  6583.    The /OFF and /ON switches let you turn recording off and on during a
  6584.    session without closing the file.
  6585.    
  6586.    When recording:
  6587.    
  6588.      * All commands that you type (or recall) at the prompt are recorded
  6589.        in the file except:
  6590.           + LEARN commands are not recorded.
  6591.           + The CONNECT command is not recorded.
  6592.           + The TELNET command is converted to SET HOST /NETWORK:TCP.
  6593.      * Commands obtained from macros or command files are not recorded.
  6594.      * During CONNECT:
  6595.           + Every line you type is converted to an OUTPUT command.
  6596.           + The last prompt before any line you type becomes an INPUT
  6597.             command.
  6598.           + Timeouts are calculated automatically for each INPUT command.
  6599.           + A PAUSE command is inserted before each OUTPUT command just
  6600.             to be safe.
  6601.        
  6602.    Thus the script recorder is inherently line-oriented. It can't be used
  6603.    to script character-oriented interactions like typing Space to a
  6604.    "More?" prompt or editing a text file with VI or EMACS.
  6605.    
  6606.    But it has advantages too; for example it takes control characters
  6607.    into account that might not be visible to you otherwise, and it
  6608.    automatically converts control characters in both the input and output
  6609.    streams to the appropriate notation. It can tell, for example that the
  6610.    "$ " prompt on the left margin in UNIX is really {\{13}\{10}$ },
  6611.    whereas in VMS it might be {\{13}\{10}\{13}$ }. These sequences are
  6612.    detected and recorded automatically.
  6613.    
  6614.    A learned script should execute correctly when you give a TAKE command
  6615.    for it. However, it is usually appropriate to edit the script a bit.
  6616.    The most important change would be to remove any passwords from it.
  6617.    For example, if the script contains:
  6618.    
  6619.   INPUT 9 {\{13}\{10}Password: }
  6620.   IF FAIL STOP 1 INPUT timeout
  6621.   PAUSE 1
  6622.   OUTPUT bigsecret\{13}
  6623.  
  6624.    you should replace this by something like:
  6625.    
  6626.   INPUT 9 {\{13}\{10}Password: }
  6627.   IF FAIL STOP 1 INPUT timeout
  6628.   ASKQ pswd Please type your password:
  6629.   PAUSE 1
  6630.   OUTPUT \m(pswd)\{13}
  6631.  
  6632.    The LEARN command can't do this for you since it knows nothing about
  6633.    "content"; it only knows about lines and can't be expected to parse or
  6634.    understand them -- after all, the Password prompt might be in some
  6635.    other language. So remember: if you use to LEARN command to record a
  6636.    login script, be sure edit the resulting file to remove any passwords.
  6637.    Also be sure to delete any backup copies your editor or OS might have
  6638.    made of the file.
  6639.    
  6640.    Other manual adjustments might also be appropriate:
  6641.    
  6642.      * If the target of an INPUT command can vary, you can replace the
  6643.        INPUT command with MINPUT and the appropriate target list, and/or
  6644.        the target with a \fpattern(). For example, suppose you are
  6645.        dialing a number that can be answered by any one of 100 terminal
  6646.        servers, whose prompts are ts-00>, ts-01>, ts-02>, ... ts-99>. The
  6647.        script records a particular one of these, but you want it to work
  6648.        for all of them, so change (e.g.):
  6649.  
  6650.   INPUT 10 ts-23>  ; or whatever
  6651.        to:
  6652.  
  6653.   INPUT 10 \fpattern(ts-[0-9][0-9]>)
  6654.      * The INPUT timeout values are conservative, but they are based only
  6655.        on a single observation; you might need to tune them.
  6656.      * The PAUSE commands might not be necessary, or the PAUSE interval
  6657.        might need adjustment.
  6658.      * In case you made typographical errors during recording, they are
  6659.        incorporated in your script; you can edit them out if you want to.
  6660.        
  6661.    Here is a sample script generated by Kermit ("learn vms.ksc") in which
  6662.    a Telnet connection is made to a VMS computer, the user logs in,
  6663.    starts Kermit on VMS, sends it a file, and then logs out:
  6664.    
  6665.   ; Scriptfile: vms.ksc
  6666.   ; Directory:  /usr/olga
  6667.   ; Recorded:   20001124 15:21:23
  6668.  
  6669.   SET HOST /NETWORK:TCP vms.xyzcorp.com
  6670.   IF FAIL STOP 1 Connection failed
  6671.  
  6672.   INPUT 7 {\{13}\{10}\{13}Username: }
  6673.   IF FAIL STOP 1 INPUT timeout
  6674.   PAUSE 1
  6675.   OUTPUT olga\{13}
  6676.   INPUT 3 {\{13}\{10}\{13}Password: }
  6677.   IF FAIL STOP 1 INPUT timeout
  6678.   PAUSE 1
  6679.   OUTPUT secret\{13}
  6680.   INPUT 18 {\{13}\{10}\{13}$ }
  6681.   IF FAIL STOP 1 INPUT timeout
  6682.   PAUSE 1
  6683.   OUTPUT set default [.incoming]\{13}
  6684.   INPUT 12 {\{13}\{10}\{13}$ }
  6685.   IF FAIL STOP 1 INPUT timeout
  6686.   PAUSE 1
  6687.   OUTPUT kermit\{13}
  6688.   INPUT 15 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
  6689.   IF FAIL STOP 1 INPUT timeout
  6690.   PAUSE 1
  6691.   OUTPUT receive\{13}
  6692.   send myfile.txt
  6693.  
  6694.   INPUT 18 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
  6695.   IF FAIL STOP 1 INPUT timeout
  6696.   PAUSE 1
  6697.   OUTPUT exit\{13}
  6698.   INPUT 6 {\{13}\{10}\{13}$ }
  6699.   IF FAIL STOP 1 INPUT timeout
  6700.   PAUSE 1
  6701.   OUTPUT logout\{13}
  6702.   close
  6703.   exit
  6704.  
  6705.    The commands generated by Kermit during CONNECT (INPUT, IF FAIL,
  6706.    PAUSE, and OUTPUT) have uppercase keywords; the commands typed by the
  6707.    user are in whatever form the user typed them (in this case,
  6708.    lowercase).
  6709.    
  6710.    [ [457]Top ] [ [458]Contents ] [ [459]C-Kermit Home ] [ [460]Kermit
  6711.    Home ]
  6712.      _________________________________________________________________
  6713.    
  6714.   8.12. Pattern Matching
  6715.   
  6716.    A pattern is a character string that is used to match other strings.
  6717.    Patterns can contain metacharacters that represent special actions
  6718.    like "match any single character", "match zero or more characters",
  6719.    "match any single character from a list", and so on. The best known
  6720.    application of patterns is in file specifications that contain
  6721.    wildcards, as in "send *.txt", meaning "send all files whose names end
  6722.    with .txt".
  6723.    
  6724.    Patterns are also used in increasingly many other ways, to the extent
  6725.    it is useful to point out certain important distinctions in the ways
  6726.    in which they are used:
  6727.    
  6728.    Anchored Patterns
  6729.           If an anchored pattern does not begin with "*", it must match
  6730.           the beginning of the string, and if it does not end with "*",
  6731.           it must match the end of the string. For example, the anchored
  6732.           pattern "abc" matches only the string "abc", not "abcde" or
  6733.           "xyzabc" or "abcabc". The anchored pattern "abc*" matches any
  6734.           string that starts with "abc"; the anchored pattern "*abc"
  6735.           matches any string that ends with "abc"; the anchored pattern
  6736.           "*abc*" matches any string that contains "abc" (including any
  6737.           that start and/or end with it).
  6738.           
  6739.    Floating Patterns
  6740.           A floating pattern matches any string that contains a substring
  6741.           that matches the pattern. In other words, a floating pattern
  6742.           has an implied "*" at the beginning and end. You can anchor a
  6743.           floating pattern to the beginning by starting it with "^", and
  6744.           you can anchor it to the end by ending it with "$" (see
  6745.           examples below).
  6746.           
  6747.    Wildcards
  6748.           A wildcard is an anchored pattern that has the additional
  6749.           property that "*" does not match directory separators.
  6750.           
  6751.    This terminology lets us describe Kermit's commands with a bit more
  6752.    precision. When a pattern is used for matching filenames, it is a
  6753.    wildcard, except in the TEXT-PATTERNS and BINARY-PATTERNS lists and
  6754.    /EXCEPT: clauses, in which case directory separators are not
  6755.    significant (for example, a BINARY-PATTERN of "*.exe" matches any file
  6756.    whose name ends in .exe, no matter how deeply it might be buried in
  6757.    subdirectories). When Kermit parses a file specification directly,
  6758.    however, it uses the strict wildcard definition. For example, "send
  6759.    a*b" sends all files whose names start with "a" and end with "b" in
  6760.    the current directory, and not any files whose names end with "b" that
  6761.    happen to be in subdirectories whose names start with "a". And as
  6762.    noted, wildcards are anchored, so "delete foo" deletes the file named
  6763.    "foo", and not all files whose names happen to contain "foo".
  6764.    
  6765.    Most other patterns are anchored. For example:
  6766.    
  6767.   if match abc bc ...
  6768.  
  6769.    does not succeed (and you would be surprised if it did!). In fact, the
  6770.    only floating patterns are the ones used by commands or functions that
  6771.    search for patterns in files, arrays, or strings. These include:
  6772.    
  6773.      * The GREP and TYPE /MATCH commands.
  6774.      * The \fsearch(), \frsearch(), and \farraylook() functions.
  6775.        
  6776.    Thus these are the only contexts in which explicit anchors ("^" and
  6777.    "$") may be used:
  6778.    
  6779.    grep abc *.txt
  6780.           Prints all lines containing "abc" in all files whose names end
  6781.           with ".txt".
  6782.           
  6783.    grep ^abc *.txt
  6784.           Prints all lines that start with "abc" in all ".txt" files.
  6785.           
  6786.    grep abc$ *.txt
  6787.           Prints all lines that end with "abc" in all ".txt" files.
  6788.           
  6789.    grep ^a*z$ *.txt
  6790.           Prints all lines that start with "a" and end with "z" in all
  6791.           ".txt" files.
  6792.           
  6793.    Similarly for TYPE /PAGE, /fsearch(), /frsearch(), and \farraylook().
  6794.    
  6795.    Here is a brief summary of anchored and floating pattern equivalences:
  6796.    
  6797.   Anchored   Floating
  6798.     abc       ^abc$
  6799.     *abc      abc$
  6800.     abc*      ^abc
  6801.     *abc*     abc
  6802.  
  6803.    [ [461]Top ] [ [462]Contents ] [ [463]C-Kermit Home ] [ [464]Kermit
  6804.    Home ]
  6805.      _________________________________________________________________
  6806.    
  6807.   8.13. Dates and Times
  6808.   
  6809.    C-Kermit's comprehension of date-time formats is considerably expanded
  6810.    in version 8.0. Any command that reads dates, including the DATE
  6811.    command itself, or any switch, such as the /BEFORE: and /AFTER:
  6812.    switches, or any function such as \fcvtdate(), now can understand
  6813.    dates and times expressed in any ISO 8601 format, in Unix "asctime"
  6814.    format, in FTP MDTM format, and in practically any format used in RFC
  6815.    822 or RFC 2822 electronic mail, with or without timezones, and in a
  6816.    great many other formats as well. HELP DATE briefly summarizes the
  6817.    acceptable date-time formats.
  6818.    
  6819.    Furthermore, C-Kermit 8.0 includes a new and easy-to-use form of
  6820.    date-time arithmetic, in which any date or time can be combined with a
  6821.    "delta time", to add or subtract the desired time interval (years,
  6822.    months, weeks, days, hours, minutes, seconds) to/from the given date.
  6823.    And new functions are available to compare dates and to compute their
  6824.    differences.
  6825.    
  6826.    As you can imagine, all this requires quite a bit of "syntax". The
  6827.    basic format is:
  6828.    
  6829.   [ date ] [ time ] [ delta ]
  6830.  
  6831.    Each field is optional, but in most cases (depending on the context)
  6832.    there must be at least one field. If a date is given, it must come
  6833.    first. If no date is given, the current date is assumed. If no time is
  6834.    given, an appropriate time is supplied depending on whether a date was
  6835.    supplied. If no delta is given, no arithmetic is done. If a delta is
  6836.    given without a date or time, the current date and time are used as
  6837.    the base.
  6838.    
  6839.    Date-time-delta fields are likely to contain spaces (although they
  6840.    need not; space-free forms are always available). Therefore, in most
  6841.    contexts -- and notably as switch arguments -- date-time information
  6842.    must be enclosed in braces or doublequotes, for example:
  6843.    
  6844.   send /after:"8-Aug-2001 12:00 UTC" *.txt
  6845.  
  6846.    Kermit's standard internal format for dates and times is:
  6847.    
  6848.   yyyymmdd hh:mm:ss
  6849.  
  6850.    for example:
  6851.    
  6852.   20010208 10:28:01
  6853.  
  6854.    Date-times can always be given in this format. yyyy is the 4-digit
  6855.    year, mm is the two-digit month (1-12; supply leading zero for
  6856.    Jan-Sep), dd is the 2-digit day (leading zero for 1-9), hh is the hour
  6857.    (0-23), mm the minute (0-59), ss the second (0-59), each with leading
  6858.    zero if less than the field width. The date and time can be separated
  6859.    by a space, an underscore, a colon, or the letter T. The time is in
  6860.    24-hour format. Thus the various quantites are at the following fixed
  6861.    positions:
  6862.    
  6863. Position  Contents                    
  6864.    1-4    Year   (4 digits, 0000-9999)
  6865.    5-6    Month  (2 digits, 1-12)
  6866.    7-8    Day    (2 digits, 1-31)
  6867.    9      Date-Time Separator (space, :, _, or the letter T)
  6868.   10-11   Hour   (2 digits, 0-23)
  6869.   12      Hour-Minute Separator (colon)
  6870.   13-14   Minute (2 digits, 0-59)
  6871.   15      Minute-Second Separator (colon)
  6872.   16-17   Second (2 digits, 0-59)
  6873.  
  6874.    Example:
  6875.    
  6876.   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
  6877.  
  6878.    This is the format produced by the DATE command and by any function
  6879.    that returns a date-time. It is suitable for lexical comparison and
  6880.    sorting, and for use as a date-time in any Kermit command. When this
  6881.    format is given as input to a command or function, various date-time
  6882.    separators (as noted) are accepted:
  6883.    
  6884.   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
  6885.   20010208_10:28:35  2 February 2001, 10:28:35 AM
  6886.   18580101:12:00:00  1 January 1858, noon
  6887.   20110208T00:00:00  2 February 2011, midnight
  6888.  
  6889.    Certain other special date-time formats that are encountered on
  6890.    computer networks are recognized:
  6891.    
  6892.    Asctime Format
  6893.           
  6894.    This is a fixed format used by Unix, named after Unix's asctime()
  6895.           ("ASCII time") function. It is always exactly 24 characters
  6896.           long. Example: Fri Aug 10 16:38:01 2001
  6897.           
  6898.    Asctime with Timezone
  6899.           
  6900.    This is like Asctime format, but includes a 3-character timezone
  6901.           between the time and year. It is exactly 28 characters long.
  6902.           Example: Fri Aug 10 16:38:01 GMT 2001
  6903.           
  6904.    E-Mail Format
  6905.           E-mail date-time formats are defined in [465]RFC 2822 with a
  6906.           fair amount of flexibility and options. The following examples
  6907.           are typical of e-mails and HTTP (web-page) headers:
  6908.           
  6909.  
  6910.   Sat, 14 Jul 2001 11:49:29                (No timezone)
  6911.   Fri, 24 Mar 2000 14:19:59 EST            (Symbolic timezone)
  6912.   Tue, 26 Jun 2001 10:19:45 -0400 (EDT)    (GMT Offset + comment)
  6913.  
  6914.    FTP MDTM Format
  6915.           
  6916.    This is the date-time format supplied by FTP servers that support the
  6917.           (not yet standard but widely used nevertheless) MDTM command,
  6918.           by which the FTP client asks for a file's modification time:
  6919.           
  6920.   yyyymmddhhmmss[.ffff]
  6921.  
  6922.           where yyyy is the 4-digit year, mm is the 2-digit month, and so
  6923.           on, exactly 14 digits long. An optional fractional part
  6924.           (fraction of second) may also be included, separated by a
  6925.           decimal point (period). Kermit rounds to the nearest second.
  6926.           Example:
  6927.           
  6928.   20020208102835.515                       (8 February 2002 10:28:36 AM)
  6929.  
  6930.     8.13.1. The Date
  6931.     
  6932.    The date, if given, must precede the time and/or delta, and can be in
  6933.    many, many formats. For starters, you can use several symbolic date
  6934.    names in place of actual dates:
  6935.    
  6936.    NOW
  6937.           This is replaced by the current date and time. The time can not
  6938.           be overriden (if you want to supply a specific time, use TODAY
  6939.           rather than NOW).
  6940.           
  6941.    TODAY
  6942.           This is replaced by the current date and a default time of
  6943.           00:00:00 is supplied, but can be overridden by a specific time;
  6944.           for example, if today is 8 February 2002, then "TODAY" is
  6945.           "20020802 00:00:00" but "TODAY 10:28" is "20020802 10:28:00".
  6946.           
  6947.    TOMORROW
  6948.           Like TODAY, but one day later (if today is 8 February 2002,
  6949.           then "TOMORROW" is "20020803 00:00:00" but "TOMORROW 16:30" is
  6950.           "20020803 16:30:00").
  6951.           
  6952.    YESTERDAY
  6953.           Like TODAY, but one day earlier.
  6954.           
  6955.    MONDAY, TUESDAY, WEDNESDAY, ..., SUNDAY
  6956.           The date on the given day of the week, today or later. A
  6957.           default time of 00:00:00 is supplied but can be overridden.
  6958.           Example: "SATURDAY 12:00" means next Saturday (or today, if
  6959.           today is Saturday) at noon.
  6960.           
  6961.    You can give an explicit date in almost any conceivable format, but
  6962.    there are some rules:
  6963.    
  6964.      * If a date is given, it must have three fields: day, month, and
  6965.        year; the order can vary (except that the month can not be last).
  6966.      * If names are used for days, months, etc, they must be English.
  6967.      * The year must lie between 0000 and 9999, inclusive.
  6968.      * All calendar calculations use Gregorian dating, so calculated
  6969.        dates for years prior to 1582 (or later, depending on the country)
  6970.        will not agree with historical dates. Other forms of dating (e.g.
  6971.        Hebrew, Chinese) are not supported.
  6972.        
  6973.    Various date-field separators are accepted: hyphen, slash, space,
  6974.    underscore, period. The same field separator (if any) must be used in
  6975.    both places; for example 18-Sep-2001 but not 18-Sep/2001. Months can
  6976.    be numeric (1-12) or English names or abbreviations. Month name
  6977.    abbreviations are normally three letters, e.g. Apr, May, Jun, Jul.
  6978.    Capitalization doesn't matter.
  6979.    
  6980.    Here are a few examples:
  6981.    
  6982.   18 Sep 2001                              (English month, abbreviated)
  6983.   18 September 2001                        (English month, spelled out)
  6984.   2001 Sept 18                             (Year, month, day)
  6985.   18-Sep-2001                              (With hyphens)
  6986.   18/09/2001                               (All numeric with slashes)
  6987.   18.09.2001                               (Ditto, with periods)
  6988.   18_09_2001                               (Ditto, with underscores)
  6989.   09/18/2001                               (See below)
  6990.   2001/09/18                               (See below)
  6991.   September 18, 2001                       (Correspondence style)
  6992.   Sep-18-2001                              (Month-day-year)
  6993.   20010918                                 (Numeric, no separators)
  6994.  
  6995.    You can also include the day of the week with a specific date, in
  6996.    which case it is accepted (if it is a valid day name), but not
  6997.    verified to agree with the given date:
  6998.    
  6999.   Tue, 18 Sep 2001                         (Abbreviated, with comma)
  7000.   Tue,18 Sep 2001                          (Comma but no space)
  7001.   Tue 18 Sep 2001                          (Abbreviated, no comma)
  7002.   Tuesday 18 Sep 2001                      (Spelled out)
  7003.   Tuesday, 18 Sep 2001                     (etc)
  7004.   Friday, 18 Sep 2001                      (Accepted even if not Friday)
  7005.  
  7006.    In all-numeric dates with the year last, such as 18/09/2001, Kermit
  7007.    identifies the year because it's 4 digits, then decides which of the
  7008.    other two numbers is the month or day based on its value. If both are
  7009.    12 or less and are unequal, the date is ambiguous and is rejected. In
  7010.    all-numeric dates with the year first, the second field is always the
  7011.    month and the third is the day. The month never comes last. A date
  7012.    with no separators is accepted only if it is all numeric and has
  7013.    exactly eight digits, and is assumed to be in yyyymmdd format.
  7014.    
  7015.   20010918                                 (18-Sep-2001 00:00:00)
  7016.  
  7017.    or 14 digits (as in FTP MDTM format):
  7018.    
  7019.   20010918123456                           (18-Sep-2001 12:34:56)
  7020.  
  7021.    You can always avoid ambiguity by putting the year first, or by using
  7022.    an English, rather than numeric, month. A date such as 09/08/2001
  7023.    would be ambiguous but 2001/09/08 is not, nor is 09-Aug-2001.
  7024.    
  7025.    Until the late 1990s, it was common to encounter 2-digit years, and
  7026.    these are found to this day in old e-mails and other documents. Kermit
  7027.    accepts these dates if they have English months, and interprets them
  7028.    according to the windowing rules of [466]RFC 2822: "If a two digit
  7029.    year is encountered whose value is between 00 and 49, the year is
  7030.    interpreted by adding 2000, ending up with a value between 2000 and
  7031.    2049. If a two digit year is encountered with a value between 50 and
  7032.    99, or any three digit year is encountered, the year is interpreted by
  7033.    adding 1900."
  7034.    
  7035.    If you need to specify a year prior to 1000, use leading zeros to
  7036.    ensure it is not misinterpreted as a "non-Y2K-compliant" modern year:
  7037.    
  7038.   7-Oct-77                                 (19771007 00:00:00)
  7039.   7-Oct-0077                               (00771007 00:00:00)
  7040.  
  7041.     8.13.2. The Time
  7042.     
  7043.    The basic time format is hh:mm:dd; that is hours, minutes, seconds,
  7044.    separated by colons, perhaps with an optional fractional second
  7045.    separated by a decimal point (period). The hours are in 24-hour
  7046.    format; 12 is noon, 13 is 1pm, and so on. Fields omitted from the
  7047.    right default to zero. Fields can be omitted from the left or middle
  7048.    by including the field's terminating colon. Examples:
  7049.    
  7050.   11:59:59                                 (11:59:59 AM)
  7051.   11:59                                    (11:59:00 AM)
  7052.   11                                       (11:00:00 AM)
  7053.   11:59:59.33                              (11:59:59 AM)
  7054.   11:59:59.66                              (Noon)
  7055.   03:21:00                                 (3:21:00 AM)
  7056.   3:21:00                                  (3:21:00 AM)
  7057.   15:21:00                                 (3:21:00 PM)
  7058.   :21:00                                   (00:21:00 AM)
  7059.   ::01                                     (00:00:01 AM)
  7060.   11::59                                   (11:00:59 AM)
  7061.  
  7062.    Leading zeros can be omitted, but it is customary and more readable to
  7063.    keep them in the minute and second fields:
  7064.    
  7065.   03:02:01                                 (03:02:01 AM)
  7066.   3:02:01                                  (03:02:01 AM)
  7067.   3:2:1                                    (03:02:01 AM)
  7068.  
  7069.    AM/PM notation is accepted if you wish to use it:
  7070.    
  7071.   11:59:59                                 (11:59:59 AM)
  7072.   11:59:59AM                               (11:59:59 AM)
  7073.   11:59:59A.M.                             (11:59:59 AM)
  7074.   11:59:59am                               (11:59:59 AM)
  7075.   11:59:59a.m.                             (11:59:59 AM)
  7076.   11:59:59PM                               (11:59:59 PM = 23:59:59)
  7077.   11:59:59P.M.                             (11:59:59 PM = 23:59:59)
  7078.   11:59:59pm                               (11:59:59 PM = 23:59:59)
  7079.   11:59:59p.m.                             (11:59:59 PM = 23:59:59)
  7080.  
  7081.    You can omit the colons if you wish, in which case Kermit uses the
  7082.    following rules to interpret the time:
  7083.    
  7084.     1. 6 digits is hh:mm:ss, e.g. 123456 is 12:34:56.
  7085.     2. 5 digits is h:mm:ss, e.g. 12345 is 1:23:45.
  7086.     3. 4 digits is hh:mm, e.g. 1234 is 12:34.
  7087.     4. 3 digits is h:mm, e.g. 123 is 1:23.
  7088.     5. 2 digits is hh, e.g. 12 is 12:00.
  7089.     6. 1 digit is h (the hour), e.g. 1 is 1:00.
  7090.        
  7091.    Examples:
  7092.    
  7093.   1                                        (01:00:00 AM)
  7094.   10                                       (10:00:00 AM)
  7095.   230                                      (02:30:00 AM)
  7096.   230pm                                    (02:30:00 PM = 14:30:00)
  7097.   1115                                     (11:15:00 AM)
  7098.   2315                                     (11:15:00 PM = 23:15:00 PM)
  7099.   23150                                    (02:31:50 AM)
  7100.   231500                                   (23:15:00 PM)
  7101.  
  7102.     8.13.3. Time Zones
  7103.     
  7104.    If a time is given, it can (but need not) be followed by a time zone
  7105.    designator. If no time zone is included, the time is treated as local
  7106.    time and no timezone conversions are performed.
  7107.    
  7108.    The preferred time zone designator is the UTC Offset, as specified in
  7109.    [467]RFC 2822: a plus sign or minus sign immediately followed by
  7110.    exactly four decimal digits, signifying the difference in hh (hours)
  7111.    and mm (minutes) from Universal Coordinated Time (UTC, also known as
  7112.    Greenwich Mean Time, or GMT), with negative numbers to the West and
  7113.    positive numbers to the East. For example:
  7114.    
  7115.   Fri, 13 Jul 2001 12:54:29 -0700
  7116.  
  7117.    indicates a local time of 12:54:29 that is 07 hours and 00 minutes
  7118.    behind (less than, East of) Universal Time. The space is optional, so
  7119.    the example could also be written as:
  7120.    
  7121.   Fri, 13 Jul 2001 12:54:29-0700
  7122.  
  7123.    The following symbolic time zones are also accepted, as specified by
  7124.    [468]RFC 2822 and/or in ISO 8601:
  7125.    
  7126.   GMT  =  +0000       Greenwich Mean Time
  7127.   Z    =  +0000       Zulu (Zero Meridian) Time
  7128.   UTC  =  +0000       Universal Coordinated Time
  7129.   UT   =  +0000       Universal Time
  7130.   EDT  =  -0400       Eastern (USA) Daylight Time
  7131.   EST  =  -0500       Eastern (USA) Standard Time
  7132.   CDT  =  -0500       Central (USA) Daylight Time
  7133.   CST  =  -0600       Central (USA) Standard Time
  7134.   MDT  =  -0600       Mountain (USA) Daylight Time
  7135.   MST  =  -0700       Mountain (USA) Standard Time
  7136.   PDT  =  -0700       Pacific (USA) Daylight Time
  7137.   PST  =  -0800       Pacific (USA) Standard Time
  7138.  
  7139.    Note that GMT, Z, UTC, and UT all express the same concept: standard
  7140.    (not daylight) time at the Zero Meridian. UTC, by the way, is an
  7141.    international standard symbol and does not correspond to the order of
  7142.    the English words, Universal Coordinated Time, but it happens to have
  7143.    the same initial letters as these words. Of course hundreds of other
  7144.    symbolic timezones and variations exist, but they are not
  7145.    standardized, and are therefore not supported by Kermit.
  7146.    
  7147.    When a time zone is included with a time, the time is converted to
  7148.    local time. In case the conversion crosses a midnight boundary, the
  7149.    date is adjusted accordingly. Examples converting to EST (Eastern USA
  7150.    Standard Time = -0500):
  7151.    
  7152.  11:30:00      =  11:30:00
  7153.  11:30:00 EST  =  11:30:00
  7154.  11:30:00 GMT  =  06:30:00
  7155.  11:30:00 PST  =  14:30:00
  7156.  11:30:00Z     =  06:30:00
  7157.  11:30PM GMT   =  18:30:00
  7158.  11:30 -0500   =  11:30:00
  7159.  11:30 -0800   =  08:30:00
  7160.  11:30 +0200   =  04:30:00
  7161.  
  7162.    Unlike most of Kermit's other date-time conversions, timezone
  7163.    knowledge (specifically, the offset of local time from UTC) is
  7164.    embodied in the underlying operating system, not in Kermit itself, and
  7165.    any conversion errors in this department are the fault of the OS. For
  7166.    example, most UNIX platforms do not perform conversions for years
  7167.    prior to 1970.
  7168.    
  7169.     8.13.4. Delta Time
  7170.     
  7171.    Date/time expressions can be composed of a date and/or time and a
  7172.    delta time, or a delta time by itself. When a delta time is given by
  7173.    itself, it is relative to the current local date and time. Delta times
  7174.    have the following general format:
  7175.    
  7176.   {+,-}[number units][hh[:mm[:ss]]]
  7177.  
  7178.    In other words, a delta time always starts with a plus or minus sign,
  7179.    which is followed by a "part1", a "part2", or both. The "part1", if
  7180.    given, specifies a number of days, weeks, months, or years; "part2"
  7181.    specifies a time in hh:mm:ss notation. In arithmetic terms, these
  7182.    represents some number of days or other big time units, and then a
  7183.    fraction of a day expressed as hours, minutes, and seconds; these are
  7184.    to be added to or subtracted from the given (or implied) date and
  7185.    time. The syntax is somewhat flexible, as shown by the following
  7186.    examples:
  7187.    
  7188.   +1 day                (Plus one day)
  7189.   +1day                 (Ditto)
  7190.   +1d                   (Ditto)
  7191.   + 1 day               (Ditto)
  7192.   + 1 day 3:00          (Plus one day and 3 hours)
  7193.   +1d3:00               (Ditto)
  7194.   +1d3                  (Ditto)
  7195.   +3:00:00              (Plus 3 hours)
  7196.   +3:00                 (Ditto)
  7197.   +3                    (Ditto)
  7198.   +2 days               (Plus 2 days)
  7199.   -12 days 7:14:22      (Minus 12 days, 7 hours, 14 minutes, and 22 seconds)
  7200.  
  7201.    The words "week", "month", and "year" can be used like "day" in the
  7202.    examples above. A week is exactly equivalent to 7 days. When months
  7203.    are specified, the numeric month number of the date is incremented or
  7204.    decremented by the given number, and the year and day adjusted
  7205.    accordingly if necessary (for example, 31-Jan-2001 +1month =
  7206.    03-Mar-2001 because February does not have 31 days). When years are
  7207.    specified, they are added or subtracted to the base year. Examples
  7208.    (assuming the current date is 10-Aug-2001 and the current time is
  7209.    19:21:11):
  7210.    
  7211.   18-Sep-2001 +1day              (20010918 00:00:00)
  7212.   today +1day                    (20010811 00:00:00)
  7213.   now+1d                         (20010811 19:21:11)
  7214.   + 1 day                        (20010811 19:21:11)
  7215.   + 1 day 3:14:42                (20010811 22:35:54)
  7216.   + 7 weeks                      (20010928 19:21:11)
  7217.   +1d3:14:42                     (20010811 22:35:54)
  7218.   +1w3:14:42                     (20010817 22:35:54)
  7219.   +1m3:14:42                     (20010910 22:35:54)
  7220.   +1y3:14:42                     (20020810 22:35:54)
  7221.   2 feb 2001 + 10 years          (20110208 00:00:00)
  7222.   2001-02-08 +10y12              (20110208 12:00:00)
  7223.   31-dec-1999 23:59:59+00:00:01  (20000101 00:00:00)
  7224.   28-feb-1996 +1day              (19960229 00:00:00) (leap year)
  7225.   28-feb-1997 +1day              (19970301 00:00:00) (nonleap year)
  7226.   28-feb-1997 +1month            (19970328 00:00:00)
  7227.   28-feb-1997 +1month 11:59:59   (19970328 11:59:59)
  7228.   28-feb-1997 +20years           (20170228 00:00:00)
  7229.   28-feb-1997 +8000years         (99970228 00:00:00)
  7230.  
  7231.    For compatibility with VMS, the following special delta-time format is
  7232.    also accepted:
  7233.    
  7234.   +number-hh:mm:ss
  7235.   -number-hh:mm:ss
  7236.  
  7237.    (no spaces). The hyphen after the number indicates days. It
  7238.    corresponds exactly to the Kermit notation:
  7239.    
  7240.   +numberdhh:mm:ss
  7241.   -numberdhh:mm:ss
  7242.  
  7243.    The following forms all indicate exactly the same date and time:
  7244.    
  7245.   18-Sep-2001 12:34:56 +1-3:23:01
  7246.   18-Sep-2001 12:34:56 +1d3:23:01
  7247.   18-Sep-2001 12:34:56 +1 day 3:23:01
  7248.  
  7249.    and mean "add a day plus 3 hours, 23 minutes, and 1 second" to the
  7250.    given date.
  7251.    
  7252.    Note that delta times are not at all the same as UTC offsets; the
  7253.    former specifies an adjustment to the given date/time and the latter
  7254.    specifies that the local time is a particular distance from Universal
  7255.    Time, for example:
  7256.    
  7257.   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
  7258.   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
  7259.  
  7260.    If you give a time followed by a modifer that starts with a + or -
  7261.    sign, how does Kermit know whether it's a UTC offset or a delta time?
  7262.    It is treated as a UTC offset if the sign is followed by exactly four
  7263.    decimal digits; otherwise it is a delta time. Examples (for USA
  7264.    Eastern Daylight Time):
  7265.    
  7266.   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
  7267.   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
  7268.   11-Aug-2001 12:34:56 -800           (20010811 04:34:56 -- Delta time)
  7269.   11-Aug-2001 12:34:56 -8             (20010811 04:34:56 -- Delta time)
  7270.  
  7271.    The first example says that at some unknown place which is 8 hours
  7272.    ahead of Universal Time, the time is 12:34:56, and this corresponds to
  7273.    16:34:56 in Eastern Daylight time. The second example says to subtract
  7274.    8 hours from the local time. The third and fourth are delta times
  7275.    because, even though a colon is not included, the time does not
  7276.    consist of exactly 4 digits.
  7277.    
  7278.    When a delta time is written after a timezone, however, there is no
  7279.    ambiguity and no syntax distinction is required:
  7280.    
  7281.   11-Aug-2001 12:34:56 -0800 -0800    (20010811 08:34:56)
  7282.   11-Aug-2001 12:34:56 -0800 -08:00   (Ditto)
  7283.   11-Aug-2001 12:34:56 -08:00 -08:00  (Illegal)
  7284.  
  7285.     8.13.5. The DATE Command
  7286.     
  7287.    Obviously a great many combinations of date, time, time zone, and
  7288.    delta time are possible, as well as many formatting options. The
  7289.    purpose of all this flexibility is to comply with as many standards as
  7290.    possible -- Internet RFCs, ISO standards, and proven corporate
  7291.    standards -- as well as with notations commonly used by real people,
  7292.    in order that dates and times from the widest variety of sources can
  7293.    be assigned to a variable and used in any date-time field in any
  7294.    Kermit command.
  7295.    
  7296.    You can test any date-and/or-time format with the DATE command, which
  7297.    converts it to standard yyyymmdd hh:mm:ss format if it is understood,
  7298.    or else gives an explicit error message (rather than just "BAD DATE"
  7299.    as in previous C-Kermit releases) to indicate what is wrong with it.
  7300.    Examples (on Tuesday, 31 July 2001 in New York City, Eastern Daylight
  7301.    Time, UTC -0400):
  7302.    
  7303.   DATE command argument                   Result           
  7304.   12:30                                   20010731 12:30:00
  7305.   12:30:01                                20010731 12:30:01
  7306.   12:30:01.5                              20010731 12:30:02
  7307.   1230                                    20010731 12:30:00
  7308.   230                                     20010731 02:30:00
  7309.   230+1d                                  20010801 02:30:00
  7310.   230+1d3:00                              20010801 05:30:00
  7311.   20010718 19:21:15                       20010718 19:21:15
  7312.   20010718_192115                         20010718 19:21:15
  7313.   20010718T192115                         20010718 19:21:15
  7314.   18 Jul 2001 +0400                       20010717 23:59:59
  7315.   18 Jul 2001 192115                      20010718 19:21:15
  7316.   18 Jul 2001 192115.8                    20010718 19:21:16
  7317.   18-Jul-2001T1921                        20010718 19:21:00
  7318.   18-Jul-2001 1921Z                       20010718 15:21:00
  7319.   18-Jul-2001 1921 GMT                    20010718 15:21:00
  7320.   18-Jul-2001 1921 UTC                    20010718 15:21:00
  7321.   18-Jul-2001 1921 Z                      20010718 15:21:00
  7322.   18-Jul-2001 1921Z                       20010718 15:21:00
  7323.   18-Jul-2001 1921 -04:00:00              20010718 19:21:00
  7324.   21-Jul-2001_08:20:00am                  20010721 08:20:00
  7325.   21-Jul-2001_8:20:00P.M.                 20010721 20:20:00
  7326.   Fri Jul 20 11:26:25 2001                20010720 11:26:25
  7327.   Fri Jul 20 11:26:25 GMT 2001            20010720 07:26:25
  7328.   Sun, 9 Apr 2000 06:46:46 +0100          20000409 01:46:46
  7329.   Sunday, 9 Apr 2000 06:46:46 +0100       20000409 01:46:46
  7330.   now                                     20010731 19:41:12
  7331.   today                                   20010731 00:00:00
  7332.   today 09:00                             20010731 09:00:00
  7333.   tomorrow                                20010801 00:00:00
  7334.   tomorrow 09:00                          20010801 09:00:00
  7335.   tomorrow 09:00 GMT                      20010801 05:00:00
  7336.   yesterday                               20010730 00:00:00
  7337.   yesterday 09:00                         20010730 09:00:00
  7338.   + 3 days                                20010803 00:00:00
  7339.   +3 days                                 20010803 00:00:00
  7340.   +3days                                  20010803 00:00:00
  7341.   + 3days                                 20010803 00:00:00
  7342.   + 3 days 09:00                          20010803 09:00:00
  7343.   + 2 weeks                               20010814 00:00:00
  7344.   + 1 month                               20010831 00:00:00
  7345.   - 7 months                              20001231 00:00:00
  7346.   + 10 years                              20110731 00:00:00
  7347.   friday                                  20010803 00:00:00
  7348.   saturday                                20010804 00:00:00
  7349.   sunday                                  20010805 00:00:00
  7350.   monday                                  20010806 00:00:00
  7351.   tuesday                                 20010731 00:00:00
  7352.   wednesday                               20010801 00:00:00
  7353.   thursday                                20010802 00:00:00
  7354.   friday 07:00                            20010803 07:00:00
  7355.   thursday 1:00pm                         20010802 13:00:00
  7356.   thursday 1:00pm GMT                     20010802 09:00:00
  7357.   Thu, 10 Nov 94 10:50:47 EST             19941110 10:50:47
  7358.   Fri, 20 Oct 1995 18:35:15 -0400 (EDT)   19951020 18:35:15
  7359.   31/12/2001                              20011231 00:00:00
  7360.   12/31/2001                              20011231 00:00:00
  7361.   2001-July-20                            20010720 00:00:00
  7362.   2001-September-30                       20010930 00:00:00
  7363.   30-September-2001                       20010930 00:00:00
  7364.   Sep 30, 2001 12:34:56                   20010930 12:34:56
  7365.   September 30, 2001                      20010930 00:00:00
  7366.   September 30, 2001 630                  20010930 06:30:00
  7367.   September 30 2001 630                   20010930 06:30:00
  7368.   Sep-30-2001 12:34:59                    20010930 12:34:59
  7369.   20010807113542.014                      20010807 11:35.42
  7370.   20010807113542.014Z                     20010807 07:35:42
  7371.  
  7372.     8.13.6. New Date-Time Functions
  7373.     
  7374.    In the following descriptions, date-time function arguments are the
  7375.    same free-format date-time strings discussed above, with the same
  7376.    defaults for missing fields. They are automatically converted to
  7377.    standard format internally prior to processing.
  7378.    
  7379.    \fcvtdate(d1)
  7380.           Converts the date-time d1 to standard format and local time.
  7381.           This function is not new, but now it accepts a wider range of
  7382.           argument formats that can include timezones and/or delta times.
  7383.           If the first argument is omitted, the current date and time are
  7384.           assumed. The optional second argument is a format code for the
  7385.           result:
  7386.           
  7387.      n1 = 1: yyyy-mmm-dd hh:mm:ss (mmm = English 3-letter month
  7388.      abbreviation)
  7389.      n1 = 2: dd-mmm-yyyy hh:mm:ss (ditto)
  7390.      n1 = 3: yyyymmddhhmmss (all numeric)
  7391.      
  7392.    \futcdate(d1)
  7393.           Converts the date-time d1 to Universal Coordinated Time (UTC),
  7394.           also known as GMT or Zulu or Zero-Meridian time. The default d1
  7395.           is NOW. If d1 is a valid date-time, the UTC result is returned
  7396.           in standard format, yyyymmdd hh:ss:mm.
  7397.           
  7398.    \fcmpdates(d1,d2)
  7399.           Compares two free-format date-times, d1 and d2, and, if both
  7400.           arguments are valid, returns a number: -1 if d1 is earlier than
  7401.           (before) d2; 0 if d1 is the same as d2; 1 if d1 is later than
  7402.           (after) d2.
  7403.           
  7404.    \fdiffdates(d1,d2)
  7405.           Computes the difference between two free-format date-times, d1
  7406.           and d2. If both arguments are valid, returns a delta time which
  7407.           is negative if d1 is earlier than (before) d2 and positive
  7408.           otherwise. If d1 and d2 are equal, the result is "+0:00".
  7409.           Otherwise, the result consists of the number of days, hours,
  7410.           minutes, and seconds that separate the two date-times. If the
  7411.           number of days is zero, it is omitted. If the number of days is
  7412.           nonzero but the hours, minutes, and seconds are all zero, the
  7413.           time is omitted. if the seconds are zero, they are omitted.
  7414.           
  7415.    \fdelta2secs(dt)
  7416.           Converts a delta time to seconds. For example, "+1d00:00:01" to
  7417.           86401. Valid delta times must start with a + or - sign. Days
  7418.           are accepted as time units, but not years, months, or weeks. If
  7419.           the result would overflow a computer long word (as would happen
  7420.           with 32-bit long words when the number of days is greater than
  7421.           24854), the function fails.
  7422.           
  7423.    HINT: Although Kermit has a number of built-in date and time
  7424.    variables, it doesn't have a single one suitable for writing a
  7425.    timestamp. For this you would normally use something like "\v(ndate)
  7426.    \v(time)". But \fcvtdate() (with no arguments) is equivalent: it
  7427.    returns the current date and time in yyyymmdd hh:mm:ss format,
  7428.    suitable for time stamping.
  7429.    
  7430.     8.13.7. Date-Time Programming Examples
  7431.     
  7432.    Here's a macro that converts any date-time to UTC, which you might use
  7433.    if C-Kermit didn't already have a \futcdate() function:
  7434.    
  7435.   define utcdate {
  7436.       .local := \fcvtdate(\%*)                 ; 1.
  7437.       .tmp := \fcvtdate(\m(local)UTC)          ; 2.
  7438.       .offset := \fdiffdate(\m(local),\m(tmp)) ; 3.
  7439.       .utc := \fcvtdate(\m(local)\m(offset))   ; 4.
  7440.       sho mac utc                              ; 5.
  7441.   }
  7442.  
  7443.    Brief explanation: Line 1 converts the macro argument, a free-format
  7444.    date-time, to standard-format local time. Line 2 appends the "UTC"
  7445.    timezone to the local time and converts the result to local time. In
  7446.    other words, we take the same time as the local time, but pretend it's
  7447.    UTC time, and convert it to local time. For example, if New York time
  7448.    is 4 hours ahead of UTC, then 6:00pm New York time is 2:00pm UTC. Line
  7449.    3 gets the difference of the two results (e.g. "+04:00"). Line 4
  7450.    appends the difference (delta time) to the local time, and converts it
  7451.    again, which adds (or subtracts) the UTC offset to the given time.
  7452.    Line 5 displays the result.
  7453.    
  7454.    Here's a script that opens a web page, gets its headers into an array,
  7455.    scans the array for the "Last-Modified:" header, and inteprets it:
  7456.  
  7457.   http open www.columbia.edu
  7458.   if fail stop 1 HTTP OPEN failed
  7459.   http /array:a head index.html /dev/null
  7460.   if fail stop 1 HTTP GET failed
  7461.   show array a
  7462.   for \%i 1 \fdim(&a) 1 {
  7463.       .\%x := \findex(:,\&a[\%i])
  7464.       if not \%x continue
  7465.       .tag := \fleft(\&a[\%i],\%x-1)
  7466.       .val := \fltrim(\fsubstr(\&a[\%i],\%x+1))
  7467.       if ( eq "\m(tag)" "Last-Modified" ) {
  7468.           echo HTTP Date: \m(val)
  7469.           .rdate := \fcvtdate(\m(val))
  7470.           echo {Standard Date (local): \m(rdate)}
  7471.           echo {Standard Date (UTC):   \futcdate(\m(rdate))}
  7472.           break
  7473.       }
  7474.   }
  7475.   http close
  7476.  
  7477.    The result:
  7478.    
  7479.   HTTP Date: Mon, 13 Aug 2001 20:05:42 GMT
  7480.   Standard Date (local): 20010813 16:05:42
  7481.   Standard Date (UTC):   20010813 20:05:42
  7482.  
  7483.    As you can see, Kermit had no trouble decoding the date-time-string
  7484.    from the website, converting to local time, and converting back to UTC
  7485.    with no conflicts or loss of information. If it had been in any other
  7486.    known format, the result would have been the same.
  7487.    
  7488.    Now suppose we want to download the web page only if it is newer than
  7489.    our local copy. The \fdate(filename) function (which returns the
  7490.    modification date-time of the given file) and the new \fcmpdates()
  7491.    function make it easy. Insert the following just before the BREAK
  7492.    statement:
  7493.    
  7494.   if ( < 0 \fcmpdates(\m(rdate),\fdate(index.html)) ) {
  7495.      echo GETTING index.html...
  7496.      http get index.html index.html
  7497.      if success echo HTTP GET OK
  7498.   } else {
  7499.      echo index.html: no update needed
  7500.   }
  7501.   http close
  7502.   exit
  7503.  
  7504.    This says, "if 0 is less than the comparison of the remote file date
  7505.    and the local file date, get the remote file, otherwise skip it." And
  7506.    it automatically reconciles the time-zone difference (if any).
  7507.    
  7508.    It would be nice to be able to extend this script into a
  7509.    general-purpose website updater, but unfortunately HTTP protocol
  7510.    doesn't provide any mechanism for the client to ask the server for a
  7511.    list of files, recursive or otherwise.
  7512.    
  7513.    [ [469]Top ] [ [470]Contents ] [ [471]C-Kermit Home ] [ [472]Kermit
  7514.    Home ]
  7515.      _________________________________________________________________
  7516.    
  7517.   8.14. Trapping Keyboard Interruption
  7518.   
  7519.    Normally when you type Ctrl-C and Kermit is in command mode (as
  7520.    opposed to CONNECT mode) with COMMAND INTERRUPTION ON (as it is unless
  7521.    you have set it OFF), Kermit interrupts any command that is currently
  7522.    in progress, and if a command file or macro is executing, rolls the
  7523.    command stack back to top level, closing all open command files,
  7524.    deactivating all macros, deallocating all local variables and arrays,
  7525.    and leaving you at the command prompt.
  7526.    
  7527.    Suppose, however, you want certain actions to occur when a script is
  7528.    interrupted; for example, closing open files, writing log entries, or
  7529.    displaying summary results. You can do this by defining a macro named
  7530.    ON_CTRLC. When Ctrl-C is detected, and a macro with this name is
  7531.    defined, Kermit executes it from the current command level, thus
  7532.    giving it full access to the environment in which the interruption
  7533.    occurred, including local variables and open files. Only when the
  7534.    ON_CTRLC macro completes execution is the command stack rolled back to
  7535.    top level.
  7536.    
  7537.    Once the ON_CTRLC macro is defined, it can be executed only once. This
  7538.    is to prevent recursion if the user types Ctrl-C while the ON_CTRLC
  7539.    macro is executing. If you type Ctrl-C while the Ctrl-C macro is
  7540.    active, this does not start a new copy of ON_CTRLC; rather, it returns
  7541.    to the top-level command prompt. After the ON_CTRLC macro returns, it
  7542.    has been removed from the macro table so if you want to use it again
  7543.    or install a different Ctrl-C trap, you must execute a new DEFINE
  7544.    ON_CTRLC command. In any case, as always when you interrupt a script
  7545.    with Ctrl-C, its completion status is FAILURE.
  7546.    
  7547.    Normally the ON_CTRLC macro would be defined in the command file or
  7548.    macro to which it applies, and should be declared LOCAL. This way, if
  7549.    the command file or macro completes successfully without being
  7550.    interrupted, the ON_CTRLC definition disappears automatically.
  7551.    Otherwise the definition would still be valid and the macro would be
  7552.    executed, probably out of context, the next time you typed Ctrl-C.
  7553.    
  7554.    Here's a simple example of a command file that sets a Ctrl-C trap for
  7555.    itself:
  7556.    
  7557.   local on_ctrlc              ; Make Ctrl-C trap local to this command file.
  7558.   define on_ctrlc {           ; Define the ON_CTRLC macro.
  7559.       echo Interrupted at \v(time).
  7560.       echo Iterations: \%n
  7561.   }
  7562.   xecho Type Ctrl-C to quit
  7563.   for \%n 1 999 1 {           ; Prints a dot every second until interrupted.
  7564.       sleep 1
  7565.       xecho .
  7566.   }
  7567.   echo Finished normally at \v(time) ; Get here only if not interrupted.
  7568.   decrement \%n
  7569.   echo Iterations: \%n
  7570.  
  7571.    This prints a summary no matter whether it completes normally or is
  7572.    interrupted from the keyboard. In both cases the trap is automatically
  7573.    removed afterwards.
  7574.    
  7575.    For an example of how to use ON_CTRLC to debug scripts, see
  7576.    [473]Section 8.1.
  7577.    
  7578.    [ [474]Top ] [ [475]Contents ] [ [476]C-Kermit Home ] [ [477]Kermit
  7579.    Home ]
  7580.   __________________________________________________________________________
  7581.  
  7582. 9. S-EXPRESSIONS
  7583.  
  7584.    This section is primarily for those who want to write
  7585.    calculation-intensive scripts, especially if they require
  7586.    floating-point arithmetic, and/or for those who are familiar with the
  7587.    LISP programming language.
  7588.    
  7589.    Ever since C-Kermit version 5 was released in 1988, scripting has been
  7590.    one of its major attractions, and arithmetic is a key part of it.
  7591.    Versions 5 and 6 included integer arithmetic only, using traditional
  7592.    algebraic notation, e.g.:
  7593.    
  7594.   echo \fevaluate(3*(2+7)/2)
  7595.   13
  7596.  
  7597.    C-Kermit 7.0 added support for floating-point arithmetic, but only
  7598.    through function calls:
  7599.    
  7600.   echo \ffpdivide(\ffpmultiply(3.0,\ffpadd(2.0,7.0)),2.0)
  7601.   13.5
  7602.  
  7603.    C-Kermit 8.0 introduces a third form of arithmetic that treats
  7604.    integers and floating-point numbers uniformly, is easier to read and
  7605.    write, and executes very quickly:
  7606.    
  7607.   (/ (* 3 (+ 2 7)) 2)
  7608.   13.5
  7609.  
  7610.    But first some background.
  7611.    
  7612.    The Kermit command and scripting language differs from true
  7613.    programming languages (such as C or Fortran) in many ways; one of the
  7614.    most prominent differences is the way in which variables are
  7615.    distinguished from constants. In a command language, words are taken
  7616.    literally; for example, the Unix shell:
  7617.    
  7618.   cat foo.bar
  7619.  
  7620.    displays the file named foo.bar. Whereas in a programming language
  7621.    like C, words are assumed to be variables:
  7622.    
  7623.   s = foo.bar;    /* Assigns the value of foo.bar to the variable s */
  7624.  
  7625.    To make a programming language take words literally, you have to quote
  7626.    or "escape" them:
  7627.    
  7628.   s = "foo.bar";  /* Assigns a pointer to the string "foo.bar" to the variable
  7629. s */
  7630.  
  7631.    The opposite holds for command languages: to get them to treat a word
  7632.    as a variable rather than a constant, you have to escape them. For
  7633.    example, in the Unix shell:
  7634.    
  7635.   foo=123         ; Assign value 123 to variable foo.
  7636.   echo foo        ; Prints "foo"
  7637.   echo $foo       ; Prints "123"
  7638.  
  7639.    And in Kermit:
  7640.    
  7641.   define foo 123  ; Assign value 123 to variable foo.
  7642.   echo 123        ; This prints "123".
  7643.   echo foo        ; This prints "foo".
  7644.   echo \m(foo)    ; This prints "123".
  7645.  
  7646.    In other words, character strings (such as "foo" above) are
  7647.    interpreted as literal strings, rather than variable names, except in
  7648.    special commands like DEFINE that deal specifically with variable
  7649.    names (or in numeric contexts as explained in [478]Section 8.2). The
  7650.    special "escape" character (dollar sign ($) for the shell, backslash
  7651.    (\) for Kermit) indicates that a variable is to be replaced by its
  7652.    value.
  7653.    
  7654.    The requirement to escape variable names in command languages normally
  7655.    does not impose any special hardship, but can add a considerable
  7656.    notational burden to arithmetic expressions, which are typically full
  7657.    of variables. Especially in Kermit when floating point numbers are
  7658.    involved, where you must use special \ffpxxx() functions, e.g.
  7659.    "\ffpadd(\m(a),\m(b))" rather than the simple "+" operator to add two
  7660.    floating-point numbers together, because the original arithmetic
  7661.    handler doesn't support floating point (this might change in the
  7662.    future). To illustrate, the general formula for the area of a triangle
  7663.    is:
  7664.    
  7665.   sqrt(s * (s - a) * (s - b) * (s - c))
  7666.  
  7667.    where a, b, and c are the lengths of the triangle's three sides and:
  7668.    
  7669.   s = (a + b + c) / 2
  7670.  
  7671.    Except in special cases (e.g. a = 3, b = 4, c = 5), the result has a
  7672.    fractional part so the computation must be done using floating-point
  7673.    arithmetic. We can create a Kermit 7.0 function for this as follows:
  7674.    
  7675.   def area {
  7676.       local s t1 t2 t3
  7677.       assign s \ffpdiv(\ffpadd(\ffpadd(\%1,\%2),\%3),2.0)
  7678.       assign t1 \ffpsub(\m(s),\%1)
  7679.       assign t2 \ffpsub(\m(s),\%2)
  7680.       assign t3 \ffpsub(\m(s),\%3)
  7681.       return \ffpsqrt(\ffpmul(\m(s),\ffpmul(\m(t1),\ffpmul(\m(t2),\m(t3)))))
  7682.   }
  7683.  
  7684.    But as you can see, this is rather cumbersome. Note, in particular,
  7685.    that arithmetic functions like \ffpadd(), \ffpmul(), etc, take exactly
  7686.    two operands (like their symbolic counterparts + and *), so obtaining
  7687.    the product of three or more numbers (as we do in this case) is
  7688.    awkward.
  7689.    
  7690.    Using the alternative S-Expression notation, we can reduce this to a
  7691.    form that is both easier to read and executes faster (the details are
  7692.    explained later):
  7693.    
  7694.   def newarea {
  7695.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  7696.       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  7697.   }
  7698.  
  7699.    In both examples, the \%1..3 variables are the normal Kermit macro
  7700.    arguments, referenced by the normal escaping mechanism. For increased
  7701.    readability, we can also assign the macro arguments \%1, \%2, and \%3
  7702.    to the letters a, b, and c corresponding to our formula:
  7703.    
  7704. def newarea {
  7705.     (let a \%1 b \%2 c \%3)
  7706.     (let s (/ (+ a b c) 2.0))
  7707.     (sqrt (* s (- s a) (- s b) (- s c)))
  7708. }
  7709.  
  7710.    And now the Kermit function reads almost like the original formula.
  7711.    Here Kermit behaves more like a regular programming language. In an
  7712.    S-Expression, macro names need not be escaped when they are used as
  7713.    the names of numeric variables.
  7714.    
  7715.    [ [479]Top ] [ [480]Contents ] [ [481]C-Kermit Home ] [ [482]Kermit
  7716.    Home ]
  7717.      _________________________________________________________________
  7718.    
  7719.   9.1. What is an S-Expression?
  7720.   
  7721.    The S-Expression concept is borrowed from the Lisp programming
  7722.    language. "S-Expression" is short for Symbolic Expression (itself
  7723.    sometimes shortened to SEXP). S-Expressions provide a kind of
  7724.    Alternative Mini-Universe within the Kermit command language when the
  7725.    regular rules don't apply, a universe enclosed in parentheses.
  7726.    
  7727.    C-Kermit does not pretend to be a full Lisp interpreter; only the
  7728.    arithmetic parts of Lisp have been incorporated: S-Expressions that
  7729.    operate on numbers and return numeric values (plus extensibility
  7730.    features described in [483]Section 9.8, which allow some degree of
  7731.    string processing).
  7732.    
  7733.    An S-Expression is a list of zero or more items, separated by spaces,
  7734.    within parentheses. Examples:
  7735.    
  7736.   ()
  7737.   (1)
  7738.   (a)
  7739.   (+ a 1)
  7740.   (* 2 a b)
  7741.  
  7742.    If the S-Expression is empty, it has the NIL (empty) value. If it is
  7743.    not empty and the first item is an operator (such as + or *), there
  7744.    can be zero or more subsequent items, called the operands:
  7745.    
  7746.   (+ 1 2)
  7747.  
  7748.    Here the operator is "+" and the operands are "1" and "2", and the
  7749.    value of the S-Expression is the value of the operation (in this case
  7750.    3). The operator always comes first, which is different from the
  7751.    familiar algebraic notation; this because S-Expression operators can
  7752.    have different numbers of operands:
  7753.    
  7754.   (+ 1)
  7755.   (+ 1 2)
  7756.   (+ 1 2 3 4 5 6 7 8 9)
  7757.  
  7758.    If the first item in the S-Expression is not an operator, then it must
  7759.    be a variable or a number (or a macro; see [484]Section 9.8), and the
  7760.    S-Expression can only contain one item; in this case, the
  7761.    S-Expression's value is the value of the variable or number:
  7762.    
  7763.   (a)
  7764.   (3)
  7765.  
  7766.    Operands can be numbers, variables that have numeric values, functions
  7767.    that return numbers, or other S-Expressions. To illustrate an
  7768.    S-Expression within an S-Expression, observe that:
  7769.    
  7770.   (+ 1 2)
  7771.  
  7772.    is equivalent to any of the following (plus an infinite number of
  7773.    others):
  7774.    
  7775.   (+ 1 (+ 1 1))
  7776.   (+ (- 3 2) (/ 14 (+ 3 4)))
  7777.  
  7778.    S-Expressions can be nested to any reasonable level; for example, the
  7779.    value of the following S-Expression is 64:
  7780.    
  7781.   (- (* (+ 2 (* 3 4)) (- 9 (* 2 2))) 6)
  7782.  
  7783.    Operators have no precedence, implied or otherwise, since they can't
  7784.    be mixed. The only exceptions are unary + and -, which simply indicate
  7785.    the sign of a number:
  7786.    
  7787.   (* 3 -1)
  7788.  
  7789.    Order of evaluation is specified entirely by parentheses, which are
  7790.    required around each operator and its operands: (+ a (* b c)) instead
  7791.    of (a + b * c).
  7792.    
  7793.    S-Expressions provide a simple and isolated environment in which
  7794.    Kermit's macro names can be used without the \m(...) escaping that is
  7795.    normally required. Given:
  7796.    
  7797.   define a 1
  7798.   define b 2
  7799.   define c 3
  7800.  
  7801.    Then:
  7802.    
  7803.   (+ \m(a) \m(b) \m(c))
  7804.  
  7805.    is equivalent to:
  7806.    
  7807.   (+ a b c)
  7808.  
  7809.    Within an S-Expression, as in other strictly numeric contexts
  7810.    ([485]Section 8.2), any operand that starts with a letter is treated
  7811.    as a Kermit macro name. In this context, abbreviations are not
  7812.    accepted; variable names must be spelled out in full. Alphabetic case
  7813.    is not significant; "a" and "A" are the same variable, but both are
  7814.    different from "area".
  7815.    
  7816.    Of course, regular Kermit variables and functions can be used in
  7817.    S-Expressions in the normal ways:
  7818.    
  7819.   (* \v(math_pi) (^ \%r 2))             ; Area of a circle with radius \%r
  7820.   (+ \fjoin(&a))                        ; Sum of all elements of array \&a[]
  7821.  
  7822.    [ [486]Top ] [ [487]Contents ] [ [488]C-Kermit Home ] [ [489]Kermit
  7823.    Home ]
  7824.      _________________________________________________________________
  7825.    
  7826.   9.2. Integer and Floating-Point-Arithmetic
  7827.   
  7828.    Normally, if all numbers in an S-Expression are integers, the result
  7829.    is an integer:
  7830.    
  7831.   (+ 1 1)                               ; Result is 2
  7832.   (/ 9 3)                               ; Result is 3
  7833.  
  7834.    If any of the operands is floating point, however, the result is also
  7835.    floating point:
  7836.    
  7837.   (+ 1 1.0)                             ; Result is 2.0
  7838.   (/ 9.0 3)                             ; Result is 3.0
  7839.  
  7840.    If all the operands are integers but the result has a fractional part,
  7841.    the result is floating point:
  7842.    
  7843.   (/ 10 3)                              ; Result is 3.333333333333333
  7844.  
  7845.    To force an integer result in such cases, use the TRUNCATE operator:
  7846.    
  7847.   (truncate (/ 10 3))                   ; Result is 3
  7848.  
  7849.    Similarly, to force a computation to occur in floating point, you can
  7850.    coerce one of its operands to FLOAT:
  7851.    
  7852.   (+ 1 (float 1))                       ; Result is 2.0
  7853.  
  7854.    The result is also floating point if the magnitude of any integer
  7855.    operand, intermediate result, or the result itself, is larger than the
  7856.    maximum for the underlying machine architecture:
  7857.    
  7858.   (^ 100 100)
  7859.  
  7860.    If the result is too large even for floating-point representation,
  7861.    "Infinity" is printed; if it is too small to be distinguished from 0,
  7862.    0.0 is returned.
  7863.    
  7864.    Large numbers can be used and large results generated, but they are
  7865.    accurate only to the precision of the underlying machine. For example,
  7866.    the result of:
  7867.    
  7868.  (+ 111111111111111111111 222222222222222222222)
  7869.  
  7870.    should be 333333333333333333333, but 333333333333333300000.0 is
  7871.    produced instead if the machine is accurate to only about 16 decimal
  7872.    digits, even with coercion to floating-point. The order of magnitude
  7873.    is correct but the least significant digits are wrong. The imprecise
  7874.    nature of the result is indicated by the ".0" at the end. Contrast
  7875.    with:
  7876.    
  7877.  (+ 111111111 222222222)
  7878.  
  7879.    which produces an exact integer result.
  7880.    
  7881.    [ [490]Top ] [ [491]Contents ] [ [492]C-Kermit Home ] [ [493]Kermit
  7882.    Home ]
  7883.      _________________________________________________________________
  7884.    
  7885.   9.3. How to Use S-Expressions
  7886.   
  7887.    S-Expressions may be given as commands to C-Kermit. Any command whose
  7888.    first character is "(" (left parenthesis) is interpreted as an
  7889.    S-Expression.
  7890.    
  7891.    If you enter an S-Expression at the C-Kermit> prompt, its result is
  7892.    printed:
  7893.    
  7894.   C-Kermit>(/ 10.0 3)
  7895.    3.333333333333333
  7896.   C-Kermit>
  7897.  
  7898.    If an S-Expression is executed within a macro or command file, its
  7899.    value is not printed. However, you can control the printing action
  7900.    with:
  7901.    
  7902.    SET SEXPRESSION ECHO { AUTO, ON, OFF }
  7903.           AUTO is the default, meaning print the value at top level only;
  7904.           ON means always print the value; OFF means never print it.
  7905.           
  7906.    In any case, the value of the most recent S-Expression (and the
  7907.    S-Expression itself) may be accessed programmatically through the
  7908.    following variables:
  7909.    
  7910.    \v(sexpression)
  7911.           The S-Expression most recently executed.
  7912.           
  7913.    \v(svalue)
  7914.           The value of the S-Expression most recently executed.
  7915.           
  7916.    Besides issuing S-Expressions as commands in themselves, you can also
  7917.    execute them anywhere within a Kermit command, but in this case they
  7918.    must be enclosed in a function call (otherwise they are taken
  7919.    literally):
  7920.    
  7921.    \fsexpression(s)
  7922.           The argument "s" is an S-Expression; the outer parentheses may
  7923.           be omitted. The value of the S-Expression is returned. Note
  7924.           that since S-Expressions usually contain spaces, some form of
  7925.           grouping or quoting might be needed in some contexts:
  7926.           
  7927.   echo \fsexpression((+ 1 1))            ; Outer parentheses may be included
  7928.   echo \fsexpr(+ 1 1)                    ; Outer parentheses may be omitted
  7929.   echo Value = "\fsexp(+ 1 a)"           ; Can be embedded in strings
  7930.   echo Value = \&a[\fsexp(/ b 2)]        ; Can be used in array subscripts
  7931.   if = {\fsexp(+ 1 1)} 2 {               ; Braces needed here for grouping
  7932.       echo One plus one still equals two
  7933.   }
  7934.  
  7935.    The IF statement illustrates how to use S-Expressions as (or in) IF or
  7936.    WHILE conditions:
  7937.    
  7938.      * Although S-Expressions and IF conditions are similar in
  7939.        appearance, they are not interchangeable. Therefore you must use
  7940.        \fsexpr() to let Kermit know it's an S-Expression rather than a
  7941.        regular IF condition, or a boolean or algebraic expression within
  7942.        an IF condition.
  7943.      * In contexts where a single "word" is expected, you must enclose
  7944.        the \fsexp() invocation in braces if the S-Expression contains
  7945.        spaces (and most of them do).
  7946.        
  7947.    If an S-Expression is the last command executed in a macro, its value
  7948.    becomes the return value of the macro; no RETURN command is needed.
  7949.    Example:
  7950.    
  7951.   def newarea {
  7952.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  7953.       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  7954.   }
  7955.  
  7956.    This is equivalent to (but more efficient than):
  7957.    
  7958.   def newarea {
  7959.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  7960.       return \fsexp(sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  7961.   }
  7962.  
  7963.    When an S-Expression is entered as a command -- that is, the first
  7964.    nonblank character of the command is a left parenthesis -- then it is
  7965.    allowed to span multiple lines, as many as you like, until the first
  7966.    left parenthesis is matched:
  7967.    
  7968.   (let s (/
  7969.           (+
  7970.            \%1
  7971.            \%2
  7972.            \%3
  7973.            )
  7974.           2.0
  7975.           )
  7976.        )
  7977.   (sqrt (*
  7978.          s
  7979.          (- s \%1)
  7980.          (- s \%2)
  7981.          (- s \%3)
  7982.          )
  7983.         )
  7984.  
  7985.    The S-Expression concept lends itself easily to embedding and
  7986.    recursion, but the depth to which recursion can occur is limited by
  7987.    the resources of the computer (memory size, address space, swap space
  7988.    on disk) and other factors. There is no way that C-Kermit can know
  7989.    what this limit is, since it varies not only from computer to
  7990.    computer, but also from moment to moment. If resources are exhausted
  7991.    by recursion, C-Kermit simply crashes; there's no way to trap this
  7992.    error. However, you can set a depth limit on S-Expressions:
  7993.    
  7994.    SET SEXPRESSION DEPTH-LIMIT number
  7995.           Limits the number of times the S-Expression reader can invoke
  7996.           itself without returning to the given number. The default limit
  7997.           is 1000. This limit applies to S-Expressions embedded within
  7998.           other S-Expressions as well as to S-Expressions that invoke
  7999.           recursive macros. If the limit is exceeded, Kermit prints
  8000.           "?S-Expression depth limit exceeded" and returns to its prompt.
  8001.           More about recursion in [494]Section 9.8.
  8002.           
  8003.    You can also test the depth programmatically:
  8004.    
  8005.    \v(sdepth)
  8006.           The current S-Expression invocation depth. The depth includes
  8007.           both nesting level and recursion. For example, in:
  8008.           (foo (foo (foo (foo (foo))))), the innermost (foo) is at depth
  8009.           5.
  8010.           
  8011.    Help, completion, and syntax checking are not available within an
  8012.    S-Expression. If you type ? within an S-Expression, it says:
  8013.    
  8014.   C-Kermit>(? S-Expression ("help sexp" for details)
  8015.  
  8016.    As it says, typing "help sexp" will display a brief help text.
  8017.    
  8018.    The SHOW SEXPRESSION command displays current SET SEXPRESSION settings
  8019.    and related information.
  8020.    
  8021.    [ [495]Top ] [ [496]Contents ] [ [497]C-Kermit Home ] [ [498]Kermit
  8022.    Home ]
  8023.      _________________________________________________________________
  8024.    
  8025.   9.4. Summary of Built-in Constants and Operators
  8026.   
  8027.    Three constants are built in:
  8028.    
  8029.      * PI, whose value is the value of pi (the quotient of circumference
  8030.        of any circle and its diameter, 3.141592653...) to the underlying
  8031.        machine's precision;
  8032.      * T, which always has the value 1, which signifies truth in Kermit
  8033.        logical expressions or S-Expressions;
  8034.      * NIL, which always has the empty value, and can serve as a False
  8035.        truth value.
  8036.        
  8037.    These constants are specific to S-Expressions and are not visible
  8038.    outside them. They may not be used as the target of an assignment. So,
  8039.    for example:
  8040.    
  8041.   (setq t 0)   Fails
  8042.   assign t 0   Succeeds but this is not the same T!
  8043.  
  8044.    E (the base of natural logarithms, 2.7182818184...) is not built in
  8045.    since it is not intrinsic in most Lisp dialects. If you want E to be
  8046.    the base of natural logarithms you can:
  8047.    
  8048.   (setq e (exp 1))
  8049.  
  8050.    Operators are either symbols (such as "+") or words. Words must be
  8051.    spelled out in full, not abbreviated. Differences of alphabetic case
  8052.    are ignored.
  8053.    
  8054.    The most basic operation in S-Expressions is evaluation:
  8055.    
  8056.    EVAL [ s-expression or variable or number [ another [ another ... ] ]
  8057.           ]
  8058.           Evaluates its operands and returns the value of the last one
  8059.           evaluated. Examples:
  8060.           
  8061.   (eval)                                0
  8062.   (eval 1)                              1
  8063.   (eval a)                              value of a
  8064.   (eval (+ 1 a))                        value of a+1
  8065.   (eval (setq a 1) (setq b (+ a 0.5)))  value of b (= a+0.5)
  8066.  
  8067.           You can use "." as a shorthand for EVAL:
  8068.           
  8069.   (.)
  8070.   (. 1)
  8071.   (. a)
  8072.   (. (+ 1 a))
  8073.   (. (setq a 1) (setq b (+ a 0.5)))
  8074.  
  8075.    Opposite of EVAL is the operator that suppresses evaluation of its
  8076.    operand:
  8077.    
  8078.    QUOTE item
  8079.           The value (quote item) is "item". If the item is itself an
  8080.           S-Expression, the result is the S-Expression with the outer
  8081.           parentheses stripped. Examples:
  8082.           
  8083.   (quote)                               (illegal)
  8084.   (quote a)                             a
  8085.   (quote hello)                         hello
  8086.   (quote (this is a string))            this is a string
  8087.   (quote this is a string)              (illegal)
  8088.  
  8089.           A shorthand notation is also accepted for quoting:
  8090.           'a is equivalent to (quote a). And therefore:
  8091.           '(a b c) is equivalent to (quote (a b c)).
  8092.           More about quoting in [499]Section 9.8.
  8093.           
  8094.    STRING item
  8095.           Is a combination of EVAL and QUOTE. It evaluates the item as an
  8096.           S-Expression, and then puts quotes around the result (more
  8097.           about this in [500]Section 9.8).
  8098.           
  8099.    The following operators assign values to variables:
  8100.    
  8101.    SETQ [ variable [ value [ variable [ value [ ... ] ] ] ] ]
  8102.           Applies to global variables. For each variable given: if a
  8103.           value is not given, the variable is undefined. If a value is
  8104.           given, assigns the value to the variable. The value may be a
  8105.           number, a variable, or anything that resolves to a number
  8106.           including an S-Expression. Returns the value of the last
  8107.           assignment. Examples:
  8108.           
  8109.   (setq)             Does nothing, returns NIL.
  8110.   (setq a)           Undefines a, returns NIL.
  8111.   (setq a 1)         Assigns 1 to a, returns 1.
  8112.   (setq a 1 b 2)     Assigns 1 to a, 2 to b, returns 2.
  8113.   (setq a 1 b 2 c)   Assigns 1 to a, 2 to b, undefines c, returns NIL.
  8114.  
  8115.    To undefine a variable that is not the final one in the list, give it
  8116.    a value of "()" or NIL:
  8117.    
  8118.   (setq a () b 2)    Undefines a, assigns 2 to b, returns 2.
  8119.   (setq a nil b 2)   Ditto.
  8120.  
  8121.    Note that a variable can be used right away once it has a value:
  8122.    
  8123.   (setq a 1 b a)     Assigns 1 to a, the value of a (1) to b, returns 1.
  8124.  
  8125.    The results of SETQ (when used with macro names) can be checked
  8126.    conveniently with SHOW MACRO, e.g:
  8127.    
  8128.   show mac a b c
  8129.  
  8130.    LET [ variable [ value [ variable [ value [ ... ] ] ] ] ]
  8131.           Like SETQ, but applies to local variables. Note that "local" is
  8132.           used in the Kermit sense, not the Lisp sense; it applies to the
  8133.           current Kermit command level, not to the current S-Expression.
  8134.           
  8135.    If you want to use SETQ or LET to assign a value to a backslash
  8136.    variable such as \%a or \&a[2], you must double the backslash:
  8137.    
  8138.   (setq \\%a 3)
  8139.   (setq \\%b (+ \%a 1))
  8140.   (setq \\&a[2] (setq (\\%c (+ \%a \%b))))
  8141.  
  8142.    In other words:
  8143.    
  8144.      * Double the backslash when you want to indicate the variable's
  8145.        NAME;
  8146.      * Don't double the backslash when you want its VALUE.
  8147.        
  8148.    See [501]Section 9.6 for a fuller explanation of variable syntax and
  8149.    scope.
  8150.    
  8151.    Here's a summary table of arithmetic operators; in the examples, a is
  8152.    2 and b is -1.3:
  8153.    
  8154.   Operator  Description                            Example           Result
  8155.   +         Adds all operands (0 or more)          (+ a b)           0.7
  8156.   -         Subtracts all operands (0 or more)     (- 9 5 2 1)       1
  8157.   *         Multiplies all operands (0 or more)    (* a (+ b 1) 3)  -1.80
  8158.   /         Divides all operands (2 or more)       (/ b a 2)        -0.325
  8159.   ^         Raise given number to given power      (^ 3 2)           9
  8160.   ++        Increments variables                   (++ a 1.2)        3.2
  8161.   --        Decrements variables                   (-- a)            1
  8162.   ABS       Absolute value of 1 operand            (abs (* a b 3))   7.8
  8163.   MAX       Maximum of all operands (1 or more)    (max 1 2 3 4)     4
  8164.   MIN       Minimum of all operands (1 or more)    (min 1 2 3 4)     1
  8165.   MOD (%)   Modulus of all operands (1 or more)    (mod 7 4 2)       1
  8166.   FLOAT     Convert an integer to floating-point   (float 1)         1.0
  8167.   TRUNCATE  Integer part of floating-point operand (truncate 3.333)  3
  8168.   CEILING   Ceiling of floating-point operand      (ceiling 1.25)    2
  8169.   FLOOR     Floor of floating-point operand        (floor 1.25)      1
  8170.   ROUND     Operand rounded to nearest integer     (round 1.75)      2
  8171.   SQRT      Square root of 1 operand               (sqrt 2)          1.414..
  8172.   EXP       e (2.71828..) to the given power       (exp -1)          0.367..
  8173.   SIN       Sine of angle-in-radians               (sin (/ pi 2))    1.0
  8174.   COS       Cosine of angle-in-radians             (cos pi)         -1.0
  8175.   TAN       Tangent of angle-in-radians            (tan pi)          0.0
  8176.   LOG       Natural log (base e) of given number   (log 2.7183)      1.000..
  8177.   LOG10     Log base 10 of given number            (log10 1000)      3.0
  8178.  
  8179.    The ++ and -- operators are also assignment operators and work just
  8180.    like SETQ and LET in their interpretations of operators and operands,
  8181.    but:
  8182.    
  8183.      * Each target variable must already be defined and have a numeric
  8184.        value;
  8185.      * The assignment value is the amount by which to increment or
  8186.        decrement the variable.
  8187.      * If an assignment value is not given, 1 is used.
  8188.        
  8189.    If you include more than one variable-value pair in a ++ or --
  8190.    expression, every variable (except, optionally, the last) must be
  8191.    followed by a value. Examples:
  8192.    
  8193.   (++ a)                Equivalent to (setq a (+ a 1)) and to (++ a 1)
  8194.   (++ a 2)              Equivalent to (setq a (+ a 2))
  8195.   (-- a (* 2 pi))       Equivalent to (setq a (- a (* 2 pi)))
  8196.   (++ a 1 b 1 c 1 d)    Equivalent to four SETQs incrementing a,b,c,d by 1.
  8197.  
  8198.    Another group of operators forms the predicates. These return a "truth
  8199.    value", in which 0 (or NIL) is false, and 1 or any other nonzero
  8200.    number is true.
  8201.    
  8202.   Operator  Description                            Example           Result
  8203.   = (or ==) Operands are equal                     (= 1 1.0)         1
  8204.   !=        Operands are not equal                 (!= 1 1.0)        0
  8205.   <         Operands in strictly ascending order   (< 1 2 3)         1
  8206.   <=        Operands in ascending order            ( 3 2 1)         1
  8207.   >=        Operands in descending order           (
  8208.  
  8209. The Exclusive OR of two values is true if one value is true and the other
  8210. value is false.
  8211.  
  8212. And another group operates on bits within an integer word:
  8213.  
  8214.   Operator  Description                            Example           Result
  8215.   &         Bitwise AND                            (& 7 2)           2
  8216.   |         Bitwise OR                             (| 1 2 3 4)       7
  8217.   #         Bitwise Exclusive OR                   (# 3 1)           2
  8218.   ~         Reverses all bits                      (~ 3)            -4
  8219.  
  8220.    These operators coerce their operands to integer by truncation if
  8221.    necessary. The result of bit reversal is hardware dependent.
  8222.    
  8223.    The final category of operator works on truth values:
  8224.    
  8225.   Operator  Description                            Example           Result
  8226.   IF        Conditional evaluation                 (if (1) 2 3)      2
  8227.  
  8228.    IF (predicate) (s1) [ (s2) ]
  8229.           The IF operator is similar to Kermit's IF command. If the
  8230.           predicate is true (i.e. evaluates to a nonzero number), the
  8231.           first S-Expression (s1) is evaluated and its value is returned.
  8232.           Otherwise, if (s2) is given, it is evaluated and its value
  8233.           returned; if (s2) is not given, nothing happens and the NIL
  8234.           (empty) value is returned.
  8235.           
  8236.    You can group multiple expressions in the s1 and s2 expressions using
  8237.    EVAL (or "."):
  8238.    
  8239.   (if (< a 0) (eval (setq x 0) (setq y 0)) (eval (setq x a) (setq y b)))
  8240.  
  8241.    or equivalently:
  8242.    
  8243.   (if (< a 0) (. (setq x 0) (setq y 0)) (. (setq x a) (setq y b)))
  8244.  
  8245.    Each operator has its own requirement as to number and type of
  8246.    operands. In the following table, "number" means any kind of number --
  8247.    integer or floating-point -- or a variable, function, macro, or
  8248.    S-Expression that returns a number; "vname" means variable name,
  8249.    "fpnumber" means a floating-point number (or anything that resolves to
  8250.    one), and "integer" means integer (or anything that resolves to one).
  8251.    "truthvalue" means anything that resolves to a value of zero or an
  8252.    empty value (which indicates false) or a nonzero value (which
  8253.    indicates true). "any" means any kind of value, including none at all.
  8254.    
  8255.   Operator  Number of operands   Type of operands    Returns
  8256.   EVAL  (.) 0 or more            S-Expression        Last value (default NIL)
  8257.   STRING    1                    S-Expression        string
  8258.   QUOTE (') 1                    word                string
  8259.   SETQ      0 or more            vname value pairs   Last value (default NIL)
  8260.   LET       0 or more            vname value pairs   Last value (default NIL)
  8261.   +         0 or more            number              number     (default 0)
  8262.   -         0 or more            number              number     (default 0)
  8263.   *         0 or more            number              number     (see note (1))
  8264.   /         2 or more            number              number
  8265.   ^         2 or more            number              number
  8266.   ++        1 or more            vname value pairs   Result of last increment
  8267.   --        1 or more            vname value pairs   Result of last decrement
  8268.   ABS       1                    number              number
  8269.   MAX       1 or more            number              number
  8270.   MIN       1 or more            number              number
  8271.   MOD (%)   2                    number              number
  8272.   FLOAT     1                    number              fpnumber
  8273.   TRUNCATE  1                    number              integer
  8274.   CEILING   1                    number              integer
  8275.   FLOOR     1                    number              integer
  8276.   ROUND     1                    number              integer
  8277.   SQRT      1                    number              fpnumber
  8278.   EXP       1                    number              fpnumber
  8279.   SIN       1                    number              fpnumber
  8280.   COS       1                    number              fpnumber
  8281.   TAN       1                    number              fpnumber
  8282.   LOG       1                    number              fpnumber
  8283.   LOG10     1                    number              fpnumber
  8284.   = (==)    1 or more            number              truthvalue
  8285.   !=        1 or more            number              truthvalue
  8286.   <         1 or more            number              truthvalue
  8287.   <=        1 or more            number              truthvalue
  8288.   >         1 or more            number              truthvalue
  8289.   >=        1 or more            number              truthvalue
  8290.   AND (&&)  1 or more            truthvalue          truthvalue
  8291.   OR  (||)  1 or more            truthvalue          truthvalue
  8292.   XOR       2                    truthvalue          truthvalue
  8293.   NOT (!)   1                    truthvalue          truthvalue
  8294.   &         1 or more            number (see note 2) integer
  8295.   |         1 or more            number (see note 2) integer
  8296.   #         2                    number (see note 2) integer
  8297.   ~         1                    number (see note 2) integer
  8298.   IF        2 or 3               truthvalue,any,any  any
  8299.  
  8300.    Operators that don't require any arguments return the default values
  8301.    shown.
  8302.    
  8303.     1. The value of "*", when used as an operator, is initially "1" and
  8304.        the value of the most recent S-Expression thereafter, as in Franz
  8305.        Lisp. This is handy when doing a series of calculations by hand:
  8306.  
  8307.   C-Kermit>(* 13272.42 0.40)
  8308.    5308.968
  8309.   C-Kermit>(/ * 2)
  8310.    2654.4840
  8311.   C-Kermit>
  8312.     2. The bitwise operators coerce their operands to integer by
  8313.        truncation.
  8314.        
  8315.    [ [502]Top ] [ [503]Contents ] [ [504]C-Kermit Home ] [ [505]Kermit
  8316.    Home ]
  8317.      _________________________________________________________________
  8318.    
  8319.   9.5. Variables
  8320.   
  8321.    As noted elsewhere in this discussion, all backslash items (variables
  8322.    such as \%a, macro parameters such as \%1, array elements such as
  8323.    \&a[\%i], built-in variables such as \v(ndate), built-in functions
  8324.    such as \fjoin(), macro names enclosed in \m(), \s(), or \:(), etc)
  8325.    are evaluated at "top level" before the S-Expression is sent to the
  8326.    S-Expression reader. To use a backslash variable as the target of an
  8327.    assignment (e.g. by SETQ, LET, ++, or --), you must double the
  8328.    backslash, e.g. (setq \\%r 1234). This is discussed at greater length
  8329.    in the next section.
  8330.    
  8331.    Thus S-Expression reader generally deals only with macro names (not
  8332.    backslash items) as variables. It is important to understand how the
  8333.    reader handles macro names. There are fundamentally two kinds of
  8334.    S-Expressions: those that contain a single element, such as:
  8335.    
  8336.   (foo)
  8337.  
  8338.    and those that contain more than one element:
  8339.    
  8340.   (foo a b c)
  8341.  
  8342.    If an S-Expression contains only one element, and it is the name of a
  8343.    macro, the macro's definition is examined. If the definition is a
  8344.    number (integer or floating-point, positive or negative), then this
  8345.    becomes the value of the expression. If the definition starts with '
  8346.    (apostrophe), then the quoted word or string is the value of the
  8347.    expression (explained in [506]Section 9.8). Otherwise, the macro is
  8348.    assumed to be composed of Kermit commands (possibly including
  8349.    S-Expressions), which are executed. If the macro has a RETURN value,
  8350.    or it executes an S-Expression as its last command, the result becomes
  8351.    the value of the S-Expression; otherwise the result is empty.
  8352.    
  8353.    For S-Expressions that contain more than one element, and the first
  8354.    element is the name of a macro, then this macro is executed with the
  8355.    arguments that are given, after the arguments are evaluated by the
  8356.    S-Expression reader. Likewise, If the first element is a built-in
  8357.    operator, then it is applied to the operands after they are evaluated.
  8358.    In both cases, each operand is fed to the S-Expression reader
  8359.    recursively for evaluation. If an operand is a number or a quoted
  8360.    string, it is used as-is. But if it's a macro name, this degenerates
  8361.    into the first case, and the previous paragraph applies.
  8362.    
  8363.    Examples:
  8364.    
  8365.   define foo 123
  8366.   (foo)                                Result: 123
  8367.   define foo 'abc
  8368.   (foo)                                Result: abc
  8369.   define foo '(one two three)
  8370.   (foo)                                Result: one two three
  8371.   define foo return \frandom(1000)
  8372.   (foo)                                Result: 713 (or other number)
  8373.   define foo (+ a b)
  8374.   (foo)                                Result: The sum of a and b
  8375.  
  8376.    A more difficult example:
  8377.    
  8378.   define foo abc
  8379.   (foo)                                Result: ???
  8380.  
  8381.    The result in the last example depends on the definition of abc:
  8382.    
  8383.      * If it has no definition, an error occurs; otherwise:
  8384.      * If the definition is an S-Expression, the result is the
  8385.        S-Expression's value; otherwise:
  8386.      * If the definition consists of Kermit commands, they are executed.
  8387.        But in this case "(foo)" produces the empty result, because it
  8388.        doesn't RETURN anything.
  8389.        
  8390.    The use of macros as S-Expression operators is described in
  8391.    [507]Section 9.8.
  8392.    
  8393.    [ [508]Top ] [ [509]Contents ] [ [510]C-Kermit Home ] [ [511]Kermit
  8394.    Home ]
  8395.      _________________________________________________________________
  8396.    
  8397.   9.6. Assignments and Scope
  8398.   
  8399.    The assignment operators SETQ and LET apply to global and local
  8400.    variables, respectively. SETQ and LET are standard Lisp operators
  8401.    adapted to Kermit scoping rules. When the operands are numeric or
  8402.    arithmetic, SETQ is equivalent to Kermit's EVALUATE command:
  8403.    
  8404.   (setq a (+ 1 2))
  8405.   evaluate a 1 + 2
  8406.  
  8407.    When the operand is a string, SETQ is equivalent to DEFINE:
  8408.    
  8409.   (setq a '(this is a string))
  8410.   define a this is a string
  8411.  
  8412.    In the first case, both statements create a macro named "a" with a
  8413.    value of 3. But in neither case is the macro "a" necessarily global.
  8414.    If either of these commands executes in an environment (i.e. macro
  8415.    invocation level) where a "local a" command has been given, the "a"
  8416.    macro is global to that environment, but is not visible outside it.
  8417.    
  8418.    LET is equivalent to the Kermit LOCAL command, followed by the
  8419.    corresponding EVALUATE:
  8420.    
  8421.   (let a (+ 1 2))
  8422.  
  8423.    is equivalent to:
  8424.    
  8425.   local a
  8426.   evaluate a 1 + 2
  8427.  
  8428.    Again, "local" in this context applies to the Kermit macro invocation
  8429.    stack, not to the S-Expression nesting level. To illustrate, recall
  8430.    our "newarea" macro:
  8431.    
  8432. def newarea {
  8433.     (let a \%1 b \%2 c \%3)
  8434.     (let s (/ (+ a b c) 2.0))
  8435.     (sqrt (* s (- s a) (- s b) (- s c)))
  8436. }
  8437.  
  8438.    Because SETQ and LET expressions return a value, they can be placed
  8439.    within a larger S-Expression. In this case we can replace the first
  8440.    reference to the "s" variable by its defining expression:
  8441.    
  8442. def newarea {
  8443.     (let a \%1 b \%2 c \%3)
  8444.     (sqrt (* (let s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
  8445. }
  8446.  
  8447.    This would not work if LET were local to the S-Expression, but it
  8448.    works nicely in the context of Kermit macros. The previous definition
  8449.    is equivalent to:
  8450.    
  8451. def newarea {
  8452.     local a b c s
  8453.     (setq a \%1 b \%2 c \%3)
  8454.     (sqrt (* (setq s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
  8455. }
  8456.  
  8457.    In both cases, the variables a, b, c, and s are local to the "newarea"
  8458.    macro, and global within it.
  8459.    
  8460.    Multiple assignments can be handled in several ways. Here is the
  8461.    obvious way to initialize a series of variables to the same value:
  8462.    
  8463.   (setq a 0)
  8464.   (setq b 0)
  8465.   (setq c 0)
  8466.   (setq s 0)
  8467.  
  8468.    Here is a more compact and efficient way of doing the same thing:
  8469.    
  8470.   (setq a 0 b 0 c 0 s 0)
  8471.  
  8472.    However, in case the value was more complex, it's better to put only
  8473.    one copy of it in the S-Expression; in this case we rely on the fact
  8474.    that SETQ returns the value of its last assignment:
  8475.    
  8476.   (setq a (setq b (setq c (setq s (* x (^ y 2))))))
  8477.  
  8478.    Similarly, to set a series of variables to x, x+1, x+2, ...
  8479.    
  8480.   (setq c (+ (setq b (+ (setq a (+ (setq s x) 1)) 1)) 1))
  8481.  
  8482.    In the last example, you can see why "last" does not always correspond
  8483.    to "rightmost" (the leftmost variable "c" is assigned last).
  8484.    
  8485.    If you are working with backslash variables like \%a or array elements
  8486.    like \&a[1], remember two rules:
  8487.     1. Don't put spaces inside array brackets.
  8488.     2. You must double the backslash when using SETQ, LET, ++, or -- to
  8489.        assign a value to a backslash variable.
  8490.        
  8491.    Examples of assigning to a backslash variable:
  8492.    
  8493.   (setq x 1)
  8494.   (setq \\%a 0)
  8495.   (setq \\&a[x+1] 1)
  8496.   (++ \\%x)
  8497.   (-- \\&a[x+2])
  8498.  
  8499.    Examples of referring to a backslash variable's value:
  8500.    
  8501.   (setq a (+ \%a 1))
  8502.   (setq b (+ \%a \&a[1]))
  8503.   (++ a \%x)
  8504.   (-- b \&a[1])
  8505.  
  8506.    The special notation is required because all backslashed items (\%x
  8507.    variables, array elements, built-in \v(xxx) variables, and \fxxx()
  8508.    function invocations) are evaluated in a single pass BEFORE the
  8509.    S-Expression is executed; any other approach would result in
  8510.    unacceptable performance. So, for example, in:
  8511.    
  8512.   declare \&a[] = 1 2 3
  8513.   define \%x 4
  8514.   define \%y 0
  8515.   (setq \\%y (+ \%x \&a[1]))
  8516.  
  8517.    the S-Expression becomes:
  8518.    
  8519.   (setq \%y (+ 4 1))
  8520.  
  8521.    before it is sent to the S-Expression evaluator. If the backslash had
  8522.    not been doubled on the assignment target, the result would have been:
  8523.    
  8524.   (setq 0 (+ 4 1))
  8525.  
  8526.    which is illegal because you can't assign a value to a number.
  8527.    Conversely, if backslashes were doubled on right-hand-side values:
  8528.    
  8529.   (setq \\%y (+ \\%x \\&a[1])
  8530.  
  8531.    this too, would give an error (not numeric - "\%x").
  8532.    
  8533.    If you omit the double backslash in the assignment target, the result
  8534.    depends on whether the variable already has a value:
  8535.    
  8536.   (setq \%a (* 3 3))
  8537.  
  8538.    If \%a has a non-numeric single-word value, then this becomes the name
  8539.    of the variable that is assigned by SETQ. To illustrate:
  8540.    
  8541.   define \%a foo
  8542.   echo \%a
  8543.   foo
  8544.   (setq \%a (* 3 3))
  8545.   echo \%a
  8546.   foo
  8547.   show macro foo
  8548.   foo = 9
  8549.  
  8550.    If \%a has no value, a numeric value, or a multiword value, an
  8551.    "invalid assignment" error occurs.
  8552.    
  8553.    [ [512]Top ] [ [513]Contents ] [ [514]C-Kermit Home ] [ [515]Kermit
  8554.    Home ]
  8555.      _________________________________________________________________
  8556.    
  8557.   9.7. Conditional Expressions
  8558.   
  8559.    The IF operator provides a compact form of decision-making within
  8560.    S-Expressions. An IF expression can stand wherever a number might
  8561.    stand, as long is it returns a number. Here's a quick way to obtain
  8562.    the average value of all the elements in an array that contains only
  8563.    numbers:
  8564.    
  8565.   (/ (+ \fjoin(&a)) (float \fdim(&a)))
  8566.  
  8567.    This results in a "Divide by zero" error if the array is empty. If you
  8568.    want to define the average value of an empty array to be 0 instead of
  8569.    getting an error, you can use IF to check the array size:
  8570.    
  8571.   (if \fdim(&a) (/ (+ \fjoin(&a)) (float \fdim(&a))) 0)
  8572.  
  8573.    or equivalently:
  8574.    
  8575.   (if (not \fdim(&a)) 0 (/ (+ \fjoin(&a)) (float \fdim(&a))))
  8576.  
  8577.    Of course, IF can fit anywhere else into an S-Expression:
  8578.    
  8579.   (setq a (+ b (if (< c 0) 0 c)))
  8580.  
  8581.    and the IF expression can be as complex as you like:
  8582.    
  8583.   (setq a (+ b (if (and (or (> x 0) (> y 0)) (< c 0) (> d 1) (!= e 0)) 1 0)))
  8584.  
  8585.    and the "then" and "else" parts can contain multiple S-Expressions
  8586.    enclosed within (EVAL ...):
  8587.    
  8588.   (if x (eval (...) (...) (...)) (eval (...) (...) (...)))
  8589.  
  8590.    AND and OR operators are guaranteed to "short circuit". If any operand
  8591.    of AND is false, none of the subsequent operands is evaluated;
  8592.    likewise, if an OR operand is true, no further operands are evaluated.
  8593.    
  8594.    Bear in mind that the S-Expression IF is not the same as Kermit IF;
  8595.    the condition is only allowed to be an S-Expression or a variable or
  8596.    number, not the whole list of possibilities you see when you type "if
  8597.    ?" at the C-Kermit> prompt. But keep reading...
  8598.    
  8599.    [ [516]Top ] [ [517]Contents ] [ [518]C-Kermit Home ] [ [519]Kermit
  8600.    Home ]
  8601.      _________________________________________________________________
  8602.    
  8603.   9.8. Extensibility
  8604.   
  8605.    To extend the capabilities of S-Expressions, you can use Kermit macro
  8606.    names as operators, with the following limitations:
  8607.    
  8608.      * The macro must not have the same name as a built-in operator.
  8609.      * You must use the full macro name, not an abbreviation.
  8610.        
  8611.    And with the following enhancement:
  8612.    
  8613.      * If the last statement executed by the macro is an S-Expression,
  8614.        its value is returned automatically. In other words:
  8615.        
  8616.   define bump (++ \%1)
  8617.  
  8618.    is equivalent to:
  8619.    
  8620.   define bump return \fsexpression(++ \%1)
  8621.  
  8622.    Here's an example in which we define a FIBONACCI operator that returns
  8623.    the nth element, n > 0, of the Fibonacci series, 0 1 1 2 3 5 8 13 21
  8624.    34 55, . . ., in which the first element is 0, the second is 1, and
  8625.    each subsequent element is the sum of the two before it. This series
  8626.    was devised by Leonardo Pisano, Filius Bonacci (Fibonacci for short)
  8627.    in 1202 to describe how fast rabbits can breed, and also forms the
  8628.    basis for the Golden Mean, the branching behavior of plants, the
  8629.    spiral of a nautilus shell, etc.
  8630.    
  8631.    We can write a FIBONACCI function as a macro easily with
  8632.    S-Expressions:
  8633.    
  8634.   define FIBONACCI {
  8635.       (if (< \%1 3) (- \%1 1) (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1))))
  8636.   }
  8637.  
  8638.    You can read this as:
  8639.    
  8640.      If the argument (\%1) is less than 3, return the argument minus 1;
  8641.      otherwise:
  8642.      return the sum of fibonacci(argument - 2) and fibonacci(argument -
  8643.      1)
  8644.      
  8645.    Note that a RETURN statement is not needed, since S-Expressions
  8646.    automatically set the return value of their containing macros.
  8647.    
  8648.    For comparison, here's how it would be coded without S-Expressions:
  8649.    
  8650.   define FIBONACCI {
  8651.       if < \%1 3 return \feval(\%1-1)
  8652.       return \feval(\fexec(fibonacci \feval(\%1-2)) -
  8653.            + \fexec(fibonacci \feval(\%1-1)))
  8654.   }
  8655.  
  8656.    Now we can use the FIBONACCI function (whichever way you write it)
  8657.    just as if it were a built-in operator:
  8658.    
  8659.   (fibonacci 6)
  8660.  
  8661.    Or:
  8662.    
  8663.   (setq a 10)
  8664.   (fibonacci a)
  8665.  
  8666.    Within S-Expressions only (not outside them), S-Expressions themselves
  8667.    can be used as macro arguments:
  8668.    
  8669.   (setq a 2 b 4)
  8670.   (setq x (fibonacci (* a b )))
  8671.  
  8672.    The value of the S-Expression (in this case "8"), and not the
  8673.    S-Expression itself, is sent to the macro.
  8674.    
  8675.    Your macro is responsible for argument validation and error handling.
  8676.    A robust Fibonacci macro would be more like this:
  8677.    
  8678.   define FIBONACCI {
  8679.       if < \v(argc) 2 end 1 ?\%0: Missing argument
  8680.       if > \v(argc) 2 end 1 ?\%0: Too many arguments
  8681.       if not integer \%1 end 1 ?\%0: Integers only
  8682.       if < \%1 1 end 1 ?\%0: Argument out of range
  8683.       (if (< \%1 2) (\%1) (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1))))
  8684.   }
  8685.  
  8686.    Recall that "END nonzero-number [ message ]" causes a macro invocation
  8687.    to fail. When the macro is the operator in an S-Expression, this makes
  8688.    the S-Expression fail too. Also note that our Fibonacci macro is just
  8689.    an illustration, not a practical example. Since it is recursive (calls
  8690.    itself), it won't work for large arguments because the call stack can
  8691.    exceed available memory. See [520]Section 9.9.2 for a practical
  8692.    alternative.
  8693.    
  8694.    Kermit macros, when used as S-Expression operators, can do anything at
  8695.    all except initiate file transfers: they can print messages on the
  8696.    screen, read and write files, interact with the user, and so on. For
  8697.    example, here's a macro ASKME that asks you to enter a number, makes
  8698.    sure that you did, and then returns its value for use in the
  8699.    S-Expression:
  8700.    
  8701.   define ASKME {
  8702.       local \%n
  8703.       while true {
  8704.           ask \%n { Number: }
  8705.           if not def \%n continue
  8706.           if not numeric \%n {
  8707.               echo Not numeric - "\%n"
  8708.               continue
  8709.           }
  8710.           break
  8711.       }
  8712.       return \%n
  8713.   }
  8714.   (setq a (* 2 (askme))) ; Get number from user, double it, assign result to a.
  8715.  
  8716.    Here's a macro you can use to validate that a number is in a given
  8717.    range:
  8718.    
  8719.   define inrange {
  8720.       if != \v(argc) 4 end 1 ?\%0: Wrong number of arguments
  8721.       if ( < \%1 \%2 || > \%1 \%3 ) return 0
  8722.       return 1
  8723.   }
  8724.  
  8725.    The first argument is the number to be checked, the second is the
  8726.    minimum acceptable value, the third is the maximum. You can use this
  8727.    (for example) in IF conditions:
  8728.    
  8729.   define yes echo \%1 IS OK
  8730.   define no echo \%1 IS NOT OK
  8731.  
  8732.   (setq a -1 b 999)
  8733.   (if (inrange a 0 100) (yes a) (no a))
  8734.   (if (inrange b -1000 +1000) (yes b) (no b))
  8735.  
  8736.    This is just an illustration, of course; there's already a built-in
  8737.    operator to let you do range checking without help from macros:
  8738.    
  8739.   (if (<= 0 a 100) (yes a) (no a))
  8740.   (if (<= -1000 b +1000) (yes b) (no b))
  8741.  
  8742.    To send string parameters to a macro, some kind of quoting is required
  8743.    to tell the S-Expression parser to take a given "word" literally
  8744.    rather than replacing it by its value. For this we use the Lisp QUOTE
  8745.    operator:
  8746.    
  8747.   define length return \flength(\%1)
  8748.   (length (quote abcdefghijklmnopqrstuvwxyz))
  8749.   26
  8750.  
  8751.    This causes the string "abcdefghijklmnopqrstuvwxyz" to be sent
  8752.    literally to the LENGTH macro. Kermit, like Lisp, also offers a
  8753.    shortcut for QUOTE, that lets us quote a word by prefixing it with a
  8754.    single quote (') character, also called apostophe (ASCII 39):
  8755.    
  8756.   (length 'abcdefghijklmnopqrstuvwxyz)
  8757.   26
  8758.  
  8759.    The two forms are equivalent.
  8760.    
  8761.    How the macro treats its arguments is up to the macro. In the example
  8762.    above, the argument is treated as a literal string. However, it can
  8763.    also be treated as a variable name:
  8764.    
  8765.   define string This is a string
  8766.   define length return \flength(\m(\%1))
  8767.   (length 'string)
  8768.   16
  8769.  
  8770.    Note the construct \m(\%1). This means "the value of the macro whose
  8771.    name is the value of
  8772.    \%1". The value of \%1 in this case is the word "string", and the
  8773.    value of the macro whose name is "string" is "This is a string".
  8774.    
  8775.    What if the macro takes multiple arguments, or a variable number of
  8776.    them? Here's a simple macro that prints a phrase that includes its
  8777.    arguments:
  8778.    
  8779.   define complain echo It's too \%*!
  8780.  
  8781.    (Recall that \%* means "all arguments".)
  8782.    
  8783.    It can be called in the traditional way:
  8784.    
  8785.   complain hot                       Result: "It's too hot!"
  8786.   complain cold and wet              Result: "It's too cold and wet!"
  8787.  
  8788.    Or from an S-Expression if you quote the arguments:
  8789.    
  8790.   (complain 'hot)                    Result: "It's too hot!"
  8791.   (complain 'cold 'and 'wet)         Result: "It's too cold and wet!"
  8792.  
  8793.    To group multiple words into a single argument, use parentheses:
  8794.    
  8795.   (complain (quote (cold and wet)))  Result: "It's too cold and wet!"
  8796.   (complain '(cold and wet))         Result: "It's too cold and wet!"
  8797.  
  8798.    Note the difference:
  8799.    
  8800.   (complain 'cold 'and 'wet)         Three arguments
  8801.   (complain '(cold and wet))         One argument
  8802.  
  8803.    Since the COMPLAIN macro uses \%* to refer to all its arguments, no
  8804.    matter how many, it doesn't care which form you use. But it makes a
  8805.    difference in cases where the macro refers to its arguments
  8806.    individually.
  8807.    
  8808.    To illustrate, let's consider a macro that receives the name of a
  8809.    macro and its argument list and executes it with its arguments,
  8810.    without knowing how many arguments there are. The following LOOP macro
  8811.    is used to execute the given macro with the given argument list the
  8812.    requested number of times:
  8813.    
  8814.   def loop { local i, for i 1 \%1 1 do \%2 \%3 }
  8815.  
  8816.    Within the LOOP macro, the first argument (\%1) is the loop count, \%2
  8817.    is the macro name, and \%3 is the argument list. When the LOOP macro
  8818.    is invoked traditionally like this:
  8819.    
  8820.   loop 3 complain hot
  8821.  
  8822.    it prints "It's too hot!" three times. To invoke it from an
  8823.    S-Expression, you must quote both the macro name as well as the
  8824.    argument, since in this case the macro name itself is an argument:
  8825.    
  8826.   (loop 3 'complain 'hot)
  8827.  
  8828.    Now what if you need to send different or variable numbers of
  8829.    arguments to the LOOP macro? The LOOP macro can handle it already,
  8830.    provided you group the arguments into LOOP's third argument (\%3). In
  8831.    Kermit syntax, without grouping:
  8832.    
  8833.   loop 3 complain cold and wet
  8834.  
  8835.    prints "It's too cold!" three times ("and wet" is lost); but with
  8836.    grouping (either of the following two forms):
  8837.    
  8838.   loop 3 complain {cold and wet}
  8839.   loop 3 complain "cold and wet"
  8840.  
  8841.    the LOOP macro prints "It's too cold and wet!" three times as desired.
  8842.    
  8843.    To do the same thing in an S-Expression, just use the Lisp forms of
  8844.    quoting instead of the Kermit forms; the following two are equivalent:
  8845.    
  8846.   (loop 3 'complain (quote (cold and wet)))
  8847.   (loop 3 'complain '(cold and wet))
  8848.  
  8849.    Here's a similar example in which we write a macro that shows both the
  8850.    name and the value of one or more other macros, whose names are given
  8851.    as arguments (similar to "show macro"):
  8852.    
  8853.   define display {
  8854.       local \%i
  8855.       for \%i 1 \v(argc)-1 1 {
  8856.           echo \&_[\%i] = \m(\&_[\%i])
  8857.       }
  8858.   }
  8859.  
  8860.    (Recall that \&_[] is the macro's argument vector array, equivalent to
  8861.    \%1, \%2, ...) The DISPLAY macro can be used in S-Expressions like
  8862.    this:
  8863.    
  8864.   (setq a 1 b 2 c 3)
  8865.   (display 'a 'b 'c 'd)
  8866.  
  8867.    which prints:
  8868.    
  8869.   a = 1
  8870.   b = 2
  8871.   c = 3
  8872.   d =
  8873.  
  8874.    The names must be quoted to prevent their evaluation before they are
  8875.    sent to the macro. This ability to pass variables "by name" to macros,
  8876.    rather than by value, lets you write macros that change the values of
  8877.    argument variables. For example, here's a macro that doubles the value
  8878.    of its argument variable:
  8879.    
  8880.   define double (++ \%1 \%1)
  8881.  
  8882.    which you can call like this:
  8883.    
  8884.   (setq a 12)
  8885.   (double 'a)
  8886.  
  8887.    In the macro, \%1 is replace by the variable name "a"; "(++ a a)" adds
  8888.    "a" to itself, and sets the value of "a" to the result.
  8889.    
  8890.    There are no built-in operators other than QUOTE, ', and STRING for
  8891.    handling strings in S-Expressions, but using just these, plus macros
  8892.    that use Kermit's regular string-handling features, you can easily
  8893.    extend S-Expressions to do string manipulation:
  8894.    
  8895.   define len return \flen(\%1)               Returns length of argument string
  8896.   define cap return \fupper(\%1)             Uppercase argument string
  8897.   define rev return \freverse(\%1)           Reverses argument string
  8898.   define sub return \fsubstr(\%1,\%2,\%3)    Returns substring of arg string
  8899.  
  8900.   (len '(this is a string))                  Result: 16
  8901.   (rev '(this is a string))                  Result: gnirts a si siht
  8902.   (rev (cap '(this is a string)))            Result: GNIRTS A SI SIHT
  8903.   (sub (rev (cap '(this is a string))) 5 9)  Result: TS A SI S
  8904.  
  8905.    You can assign a string to a macro name as follows:
  8906.    
  8907.   (setq foo '(this is a string))
  8908.   (setq foo (quote (this is a string)))
  8909.  
  8910.    The two are exactly equivalent. In both cases, the macro "foo" has the
  8911.    value:
  8912.    
  8913.   '(this is a string)
  8914.  
  8915.    so when it is retrieved it can be identified as a string rather than a
  8916.    number or commands to be executed. Thus:
  8917.    
  8918.   (setq foo (quote (this is a string)))
  8919.   show macro foo
  8920.   foo = '(this is a string)
  8921.   (foo)
  8922.   this is a string
  8923.  
  8924.    Note the different results for "show macro foo" and "(foo)". The
  8925.    former shows the internal definition; the latter evaluates the
  8926.    variable, which removes the quoting. And perhaps more important, note
  8927.    that if the apostrophe and surrounding parentheses were not stored as
  8928.    part of the definition, (foo) would try to execute "this is a string"
  8929.    as a command.
  8930.    
  8931.    Given the assignment above, the following work as expected:
  8932.    
  8933.   (len foo)                                  Result: 16
  8934.   (rev foo)                                  Result: gnirts a si siht
  8935.   (rev (cap foo))                            Result: GNIRTS A SI SIHT
  8936.   (sub (rev (cap foo)) 5 8)                  Result: TS A SI S
  8937.  
  8938.    Note that, unlike built-in S-Expression operators that return numbers
  8939.    or truth values, these operators return strings. If you want to assign
  8940.    their return values to other variables, you can do so:
  8941.    
  8942.   (setq bar (rev (cap foo)))                 Result: GNIRTS A SI SIHT
  8943.  
  8944.    But now the S-Expression processor doesn't know the value of "bar" is
  8945.    supposed to be a string, rather than a macro to execute. For this you
  8946.    need one final special operator, STRING. The STRING operator takes an
  8947.    S-Expression as an operand, evaluates it, and then returns its value
  8948.    enclosed in '(), so you can use the value as a string is subsequent
  8949.    S-Expressions. Use STRING for referencing macros that return strings:
  8950.    
  8951.   (setq bar (string (rev (cap foo))))        Result: '(GNIRTS A SI SIHT)
  8952.  
  8953.    STRING is like QUOTE, except that it evaluates its operand before
  8954.    applying the quoting, rather than taking the operand literally.
  8955.    
  8956.    To reference backslash variables or functions that return string
  8957.    values, you must use the regular quoting mechanisms:
  8958.    
  8959.   (setq time '(\v(time)))
  8960.   (setq date '(\v(date)))
  8961.   assign \%r this is a string
  8962.   (setq s1 '(\%r))
  8963.  
  8964.    That's because backslash items are evaluated BEFORE the S-Expression
  8965.    parser ever sees them, and the values of \v(time) and so on are not
  8966.    valid S-Expressions, so STRING won't like them.
  8967.    
  8968.    Finally a brief word on the touchy topic of quoting. Suppose you want
  8969.    to include (say) literal parentheses in a string that will later be
  8970.    processed by the S-Expression reader (or \fsplit() or \fword()).
  8971.    Normally, you can't do this because parentheses are meaningful in
  8972.    these contexts. To defeat the normal parsing rules, you can quote the
  8973.    parentheses with backslash. However, due to the many levels of string
  8974.    processing involved, a surprisingly large amount of backslashes might
  8975.    be required, for example:
  8976.    
  8977.   (setq s '(a b (c d) \\\\\\\\\\\\\\\\(e f (g h) x\\\\\\\\\\\\\\\\) j k))
  8978.  
  8979.    This is nearly impossible to explain(*). Instead, just remember two
  8980.    points:
  8981.    
  8982.      * In situations like this, it's better to use DEFINE to create the
  8983.        string, rather than SETQ. The example above requires only double
  8984.        backslashes when DEFINE is used:
  8985.  
  8986.   define s '(a b (c d) \\(e f (g h) x\\) j k)
  8987.      * The level of quoting depends on how many levels of evaluation the
  8988.        string must pass through, which is not always obvious. However,
  8989.        the number of backslashes required in any given situation is
  8990.        always a power of 2. So if 1 doesn't work, try 2; if 2 doesn't
  8991.        work, try 4; if 4 doesn't work, try 8, 16, 32, and so on.
  8992.        
  8993.    Considerations like this apply in any scripting language (shell, Tcl,
  8994.    Perl, Python, etc). The situation is known as "Quoting Hell".
  8995.    
  8996.    (*) If you really want an explanation, here it is:
  8997.    
  8998.      * Every SEXP has its backslash items evaluated in a single pass at
  8999.        top level before being passed to the SEXP reader, so \%1,
  9000.        \v(ftime), etc, can be evaluated up front, freeing the SEXP reader
  9001.        of having to know about such things, which in turn makes it much
  9002.        more efficient. Therefore one level of quoting is lost right away,
  9003.        and therefore you must double each backslash that is to be used as
  9004.        a quote.
  9005.      * When the SEXP reader sees '\', it treats it as a quote; discards
  9006.        it and keeps the next character. Thus '\\' becomes '\'. This would
  9007.        be the end of it, except that:
  9008.      * The SEXP reader must call itself recursively on its operands, so
  9009.        we must double any quotes in the operands: 2^2 = 4.
  9010.      * If the result is to be passed as an argument to a macro, the
  9011.        backslashes must again be doubled, because the macro processor
  9012.        evaluates the arguments before sending them to the macro: 2^3 = 8.
  9013.      * If the macro itself is to see the quotes, rather than just the
  9014.        result of the quoting, the quotes must be doubled again: 2^4 = 16.
  9015.        
  9016.    Moral: To create string constants in which grouping characters must be
  9017.    quoted, use DEFINE rather than SETQ.
  9018.    
  9019.    [ [521]Top ] [ [522]Contents ] [ [523]C-Kermit Home ] [ [524]Kermit
  9020.    Home ]
  9021.      _________________________________________________________________
  9022.    
  9023.   9.9. Examples
  9024.   
  9025.     9.9.1. Statistics
  9026.     
  9027.    The following program computes statistics -- means, maxima, mimima,
  9028.    variance, standard deviation, and correlation -- from data stored in
  9029.    parallel arrays, \&x[] and \&y[], which can contain any mixture of
  9030.    integer and floating-point numbers: positive, negative, or zero. Array
  9031.    setup and validation are not shown. Except for the traditional FOR
  9032.    loop and printing the results at the end, the entire computation is
  9033.    done with S-Expressions:
  9034.    
  9035. ; Initialize sums, maxima, minima, and number of elements
  9036.  
  9037.   (setq xsum 0 ysum 0 xsum2 0 ysum2 0 xysum 0)
  9038.   (setq xmin (setq xmax \&x[1]) ymin (setq ymax \&y[1]))
  9039.   (setq n \fdim(&x))
  9040.  
  9041. ; Loop through elements and accumulate sums, maxima, and minima
  9042.  
  9043.   for i 1 n 1 {
  9044.       (setq x \&x[i] y \&y[i])                    ; Notational convenience
  9045.       (setq xmax (max xmax x) ymax (max ymax y))  ; X and Y maxima
  9046.       (setq xmin (min xmin x) ymin (min ymin y))  ; X and Y minima
  9047.       (++ xsum x ysum y)                          ; X and Y sums
  9048.       (++ xsum2 (^ x 2) ysum2 (^ y 2))            ; Sum of X and Y squares
  9049.       (++ xysum (* x y))                          ; Sum of XY products
  9050.   }
  9051.  
  9052. ; Calculate results
  9053.  
  9054.   (setq xmean (/ xsum n) ymean (/ ysum n))        ; Mean X and Y
  9055.   (setq xss (- xsum2 (/ (^ xsum 2) n)))           ; Intermediate values
  9056.   (setq yss (- ysum2 (/ (^ ysum 2) n)))
  9057.   (setq xyss (- xysum (/ (* xsum ysum) n)))
  9058.   (setq xvar (/ xss n) yvar (/ yss n))            ; X and Y variance
  9059.   (setq sdx (sqrt xvar) sdy (sqrt yvar))          ; Std deviation in X and Y
  9060.   (setq tmp (* xss yss))
  9061.   (setq cc (if tmp (/ xyss (sqrt tmp)) 1.0))      ; Correlation coefficient
  9062.   show macro xmean ymean xvar yvar sdx sdy cc     ; Print the results
  9063.  
  9064.    The final "if tmp" check accounts for the possibility that both arrays
  9065.    contain all 0's. Results can also be printed with "echo CC = \m(cc)",
  9066.    or any other desired way. Interestingly, if we had not needed the sum
  9067.    of the squares and products, we could have obtained the sums, maxima,
  9068.    and minima of the X's and Y's without a loop like this:
  9069.    
  9070.   (setq xsum (+ \fjoin(&x)) ysum (+ \fjoin(&y)))
  9071.   (setq xmax (max \fjoin(&x)) ymax (max \fjoin(&y)))
  9072.   (setq xmin (min \fjoin(&x)) ymin (min \fjoin(&y)))
  9073.  
  9074.    Any Kermit function that returns numbers or lists of numbers can be
  9075.    included in an S-Expression as an operand.
  9076.      _________________________________________________________________
  9077.    
  9078.     9.9.2. Practical Fibonacci Series
  9079.     
  9080.    The recursive Fibonacci example given previously is simple and
  9081.    elegent, but not very useful since it causes memory occupation to grow
  9082.    each time it calls itself, until eventually both physical memory and
  9083.    disk swap space are filled and the program crashes. Even for small
  9084.    arguments, like 17, execution time can be prohibitive:
  9085.    
  9086.   (setq t1 \v(ftime))
  9087.   (setq result (fibonacci 17))
  9088.   (setq t2 (- \v(ftime) t1))
  9089.   echo FIBONACCI(17) = \m(result): TIME = \ffpround(t2,3)
  9090.  
  9091.    prints (on a certain rather slow computer):
  9092.    
  9093.   FIBONACCI(17) = 987: TIME = 27.544
  9094.  
  9095.    Any recursive function can be recoded iteratively. The result is not
  9096.    as pretty, but execution is far less expensive:
  9097.    
  9098.   define FIBONACCI {
  9099.       local i n r s
  9100.       (setq n \%1 r 1 s 0)
  9101.       if < n 3 return \fsexp(-- n)
  9102.       for i 3 n 1 { (setq tmp r r (+ r s) s tmp) }
  9103.       (r)
  9104.   }
  9105.  
  9106.    Here's the result on the same computer for the same argument of 17:
  9107.    
  9108.   FIBONACCI(17) = 987: TIME = 0.125
  9109.  
  9110.    (220 times faster.) Execution time increases proportionally to the
  9111.    size of the argument in the iterative case, whereas in the recursive
  9112.    case it goes up geometrically, quickly reaching infinity.
  9113.    
  9114.    [ [525]Top ] [ [526]Contents ] [ [527]C-Kermit Home ] [ [528]Kermit
  9115.    Home ]
  9116.      _________________________________________________________________
  9117.    
  9118.   9.10. Differences from Algebraic Notation
  9119.   
  9120.    In C-Kermit:
  9121.    
  9122.      * Algebraic notation uses infix operators and normal rules of
  9123.        operator precedence, with parentheses used to force exceptions to
  9124.        the rules; many operations can be included in an expression.
  9125.        S-Expressions use prefix operators with no intrinsic precedence;
  9126.        each operation is enclosed in parentheses, and the arrangement of
  9127.        parentheses determines precedence.
  9128.      * Algebraic infix operators require two operands; S-Expression
  9129.        prefix operators can accept a variable number of operands.
  9130.      * You can use algebraic notation anywhere that C-Kermit accepts a
  9131.        number, e.g. "echo \&a[((1+1)*2-1]", but you can use S-Expressions
  9132.        only as top-level commands. You can, however, use either algebraic
  9133.        or S-Expressions anywhere at all by enclosing them in \fevaluate()
  9134.        or \fsexpression(), respectively.
  9135.      * You can use any mixture of integer and floating-point numbers in
  9136.        S-Expressions, but only integers are permitted in algebraic
  9137.        expressions. Outside of S-Expressions, floating point arithmetic
  9138.        is supported only by \ffp...() function calls.
  9139.      * Operators and operands in S-Expressions must be separated by
  9140.        spaces, e.g. "(+ a b)". Spaces are not required in algebraic
  9141.        expressions: "((a+b)*c)".
  9142.      * When assigning values to backslash variables (such as \%x or
  9143.        \&a[2]) using SETQ or LET, you must double the backslash.
  9144.        
  9145.    [ [529]Top ] [ [530]Contents ] [ [531]C-Kermit Home ] [ [532]Kermit
  9146.    Home ]
  9147.      _________________________________________________________________
  9148.    
  9149.   9.11. Differences from Lisp
  9150.   
  9151.      * Kermit has a lot of built-in operators not found in Lisp: ++, ^,
  9152.        etc.
  9153.      * Most dialects of real Lisp do not allow S-Expressions that don't
  9154.        start with an operator, for example:
  9155.  
  9156.   (a)
  9157.        This expression can cause an error in Lisp (even if "a" has a
  9158.        value), but is acceptable in Kermit, where it returns the value of
  9159.        the variable "a". Similarly, (1) returns the value "1".
  9160.      * In real Lisp, EVAL requires exactly one operand. In Kermit, it can
  9161.        have 0, 1, 2, or more operands. It returns the value of the last
  9162.        operand evaluated.
  9163.      * Real Lisp SETQ and LET usually require an even number of operands.
  9164.        Kermit allows an odd number, in which case the last (or only)
  9165.        variable is undefined (i.e. deleted, destroyed).
  9166.      * Kermit does not support ratios such as "7/8". Some Lisp dialects
  9167.        accept ratios as numbers, and generate ratios when told to divide
  9168.        two integers whose quotient is not a whole number; e.g. in Common
  9169.        Lisp:
  9170.  
  9171.   [13] USER(37): (/ (+ 1 2 3 4) 3)
  9172.   10/3
  9173.   [13] USER(38):
  9174.      * The result of (/ 10 3) is 3.333.... Some Lisp dialects truncate
  9175.        the result to 3 since both operands are integers, some don't; some
  9176.        give the result as a ratio. C-Kermit always gives a floating point
  9177.        result when there is a fractional part. If you want an integer
  9178.        result, you can use TRUNCATE, FLOOR, or CEILING, e.g. (truncate (/
  9179.        10 3)).
  9180.      * There is currently no "bignum" support. Large numbers can be used
  9181.        and large results generated, but (as noted in [533]Section 9.2)
  9182.        they are accurate only to the precision of the underlying machine.
  9183.        \v(math_precision) gives the machine precision as a number of
  9184.        decimal digits, e.g. 16.
  9185.      * Scientific notation for floating-point numbers is not supported.
  9186.        If the magnitude of a number is greater than the precision of the
  9187.        underlying hardware, the less-significant digits are shown but
  9188.        their values are meaningless. If it the number is too small to be
  9189.        represented internally, it is shown as "0.0".
  9190.      * Many Lisp features are omitted: List processing (CAR, CDR, etc),
  9191.        DEFUN, Lisp-specific control structures, and so on.
  9192.        
  9193.    [ [534]Top ] [ [535]Contents ] [ [536]C-Kermit Home ] [ [537]Kermit
  9194.    Home ]
  9195.   __________________________________________________________________________
  9196.  
  9197. 10. FILE TRANSFER
  9198.  
  9199.    New commands and switches:
  9200.    
  9201.    SET TRANSFER REPORT { OFF, ON }
  9202.           
  9203.    Enables or disables the (new) one-line message printed by Kermit after
  9204.           a remote-mode file transfer to indicate the source and
  9205.           destination file, complete with path, to let you know where the
  9206.           file went.
  9207.           
  9208.    SEND /TYPE:{TEXT,BINARY}
  9209.           Sends only files of the given type (see [538]Section 4).
  9210.           
  9211.    SEND /NOFOLLOWLINKS:
  9212.           (UNIX only) Skip over symbolic links rather than following them
  9213.           (default). This applies to wildcard and/or recursive SENDs; if
  9214.           a single filename is given, and it happens to be a symbolic
  9215.           link, the file it points to is sent.
  9216.           
  9217.    SEND /FOLLOWLINKS:
  9218.           (UNIX only) Follow (resolve) symbolic links. Watch out for
  9219.           circular links, endless loops, etc.
  9220.           
  9221.    SET SEND I-PACKETS { OFF, ON }
  9222.           When sending commands to a Kermit server, this tells whether
  9223.           command packets should be preceded by an I (information)
  9224.           packet, which is used to synchronize parameters prior to
  9225.           executing the command. Normally ON. The only reason to set this
  9226.           OFF is for communicating with buggy Kermit servers that
  9227.           misbehave when an I packet is sent to them. There is also a SET
  9228.           RECEIVE I-PACKETS command, but presently it has no effect.
  9229.           
  9230.    SET TRANSFER MESSAGE [ text ]
  9231.           Sets an initial message to be shown in the Last Message field
  9232.           of the fullscreen file-transfer display.
  9233.           
  9234.    SET TRANSFER TRANSLATION { ON, OFF }
  9235.           Inhibits or re-enables text-file transfer character-set
  9236.           translation globally.
  9237.           
  9238.    { SEND, MSEND, GET, RECEIVE } /TRANSPARENT
  9239.           Inhibits character-set translation for this transfer only.
  9240.           
  9241.    { GET, RECEIVE } /PIPES:{ON,OFF}
  9242.           Overrides global TRANSFER PIPES setting for this transfer only;
  9243.           ON allows incoming files with names like "!tar xf -" to be
  9244.           opened as pipelines rather than regular files.
  9245.           
  9246.    The following new "hot keys" are available when Kermit's file-transfer
  9247.    display is visible:
  9248.    
  9249.      D: Turn on debugging, open "debug.log" if not already open.
  9250.      d: Turn off debugging but leave log open (if it was open).
  9251.      T: Turn on debug-log timestamps.
  9252.      t: Turn off debug-log timestamps.
  9253.    
  9254.    Other improvements:
  9255.      * SET FILE DOWNLOAD-DIRECTORY now works for external protocols (e.g.
  9256.        sz/rz) too.
  9257.      * Improved automatic per-file text/binary switching, described in
  9258.        [539]Section 4.
  9259.      * When sending a file group (e.g. "send *.*"), failure to open a
  9260.        file is no longer fatal; now C-Kermit simply goes ahead to the
  9261.        next file.
  9262.      * Transaction log entries are now made for external protocols too.
  9263.        
  9264.    [ [540]Top ] [ [541]Contents ] [ [542]C-Kermit Home ] [ [543]Kermit
  9265.    Home ]
  9266.   __________________________________________________________________________
  9267.  
  9268. 11. MODEMS AND DIALING
  9269.  
  9270.    In C-Kermit 8.0, the default modem type for dialing has changed from
  9271.    NONE (= DIRECT, meaning no modem) to GENERIC. This change should have
  9272.    no impact on direct connections. For dialing, it means that, unless
  9273.    you SET MODEM TYPE to a specific type, such as USROBOTICS or CONEXANT,
  9274.    Kermit assumes:
  9275.    
  9276.     1. The modem uses the Hayes AT command set.
  9277.     2. The modem supports error correction, data compression, and
  9278.        hardware flow control and is already configured to use them.
  9279.        
  9280.    In fact, Kermit assumes the modem is completely configured, and
  9281.    therefore does not send it an initialization string or any
  9282.    configuration commands. Instead, it sends only the simplest and most
  9283.    portable commands:
  9284.    
  9285.      ATQ0V1          Give dial result codes.
  9286.      ATDTnumber      Dial the number.
  9287.    
  9288.    (or ATD or ATDP, as appropriate).
  9289.    
  9290.    The new defaults work for direct connections and for most modern
  9291.    modems on most platforms, and they work much faster than
  9292.    "full-treatment" dialing. If the new defaults don't work for you, or
  9293.    if you need to perform explicit modem configuations or interactions,
  9294.    then set a specific modem type and use the SET MODEM and SET DIAL
  9295.    commands as documented in Using C-Kermit.
  9296.    
  9297.      WARNING: Don't use the generic modem on hosts that do not support
  9298.      RTS/CTS flow control. If Xon/Xoff is in use on the serial port,
  9299.      you'll need to select a particular modem type so Kermit knows what
  9300.      command to give it to enable Xon/Xoff flow control between itself
  9301.      and your serial port.
  9302.      
  9303.    The following new modem types were added in C-Kermit 8.0:
  9304.    
  9305.      lucent:          Lucent Venus chipset
  9306.      pctel:           PCTel V.90 chipset
  9307.      conexant:        Conexant (ex-Rockwell) modem family
  9308.      zoom-v32bis:     New name for "Zoom"
  9309.      zoom-v34         Zoom V.34
  9310.      zoom-v90         Zoom V.90 56K
  9311.      zoom-v92:        Zoom V.92 with V.44 data compression
  9312.      zoltrix-v34:     New name for "zoltrix"
  9313.      zoltrix-hsp-v90: Synonym for PCTel
  9314.      zoltrix-hcf-v90: Synonym for ITU-T-V250
  9315.      smartlink-v90:   Synonym for usrobotics (same chipset)
  9316.      acer-v90:        Synonym for Rockwell-v90
  9317.    
  9318.    New DIAL-related variables:
  9319.    
  9320.      \v(dm_hf):  Dial modifier: Wait for Hook-Flash.
  9321.      \v(dm_wb):  Dial modifier: Wait for Bong.
  9322.    
  9323.    Finally, if dialing fails, Kermit now prints a context-sensitive hint
  9324.    suggesting possible reasons and remedies.
  9325.    
  9326.    Added in C-Kermit 8.0.201:   Rudimentary support for Caller ID, for
  9327.    use with the ANSWER command. If the modem reports Caller ID
  9328.    information, Kermit stores it in variables that you can access after
  9329.    the call is answered:
  9330.    
  9331.   \v(callid_date)   The date of the call
  9332.   \v(callid_time)   The time of the call
  9333.   \v(callid_name)   The name of the caller
  9334.   \v(callid_nmbr)   The telephone number of the caller
  9335.   \v(callid_mesg)   A message
  9336.  
  9337.    The format of these items depends on the originating and answering
  9338.    phone companies and the modems and their configuration.
  9339.    
  9340.    Not very many modems support Caller ID, and those that do (a) tend to
  9341.    have it disabled by default, and (b) use different commands to enable
  9342.    it. A quick survey shows of some current models shows:
  9343.    
  9344.    - USR V.90:      No
  9345.    - ITU-T V.250:   No
  9346.    - Lucent Venus:  No
  9347.    - Diamond Supra: #CID=1
  9348.    - Rockwell 56K:  #CID=1
  9349.    - PCTEL:         #CID=1
  9350.    - Zoltrix:       +VCID=1
  9351.    - Conexant:      +VCID=1
  9352.  
  9353.    To use Kermit's Caller ID feature, you have to set the modem to wait
  9354.    for at least two rings before answering, and you have to give the
  9355.    command to enable Caller ID; for example (after choosing a modem with
  9356.    SET MODEM TYPE):
  9357.    
  9358.   set modem command autoanswer on ATS0=2#CID=1\{13}
  9359.   set modem command autoanswer on ATS0=2+VCID=1\{13}
  9360.  
  9361.    These commands can be undone with:
  9362.    
  9363.   set modem command autoanswer on ATS0=1#CID=0\{13}
  9364.   set modem command autoanswer on ATS0=1+VCID=0\{13}
  9365.  
  9366.    Kermit presently has no built-in knowledge of the Caller ID
  9367.    capabilities or commands of the modems in its database.
  9368.    
  9369.    Since the variables can be accessed only after the call is answered,
  9370.    the only way to refuse a call is to answer it, inspect the variables,
  9371.    and then hang it up if desired.
  9372.    
  9373.    [ [544]Top ] [ [545]Contents ] [ [546]C-Kermit Home ] [ [547]Kermit
  9374.    Home ]
  9375.   __________________________________________________________________________
  9376.  
  9377. 12. TERMINAL CONNECTION
  9378.  
  9379.    Now that 7-bit connections are no longer the norm, the default
  9380.    terminal bytesize (also called "data size" or "word size") in C-Kermit
  9381.    8.0 is 8 bits, rather than 7 bits as it was in C-Kermit 7.0 and
  9382.    earlier:
  9383.    
  9384.    SET ESCAPE character
  9385.           This command, which specifies your CONNECT-mode escape
  9386.           character, allows you to specify any ASCII control character in
  9387.           a variety of formats. C-Kermit 8.0.201 now also lets you
  9388.           specify any 8-bit value, 128-255, as the escape character. In
  9389.           the SET ESCAPE command, you can type the 8-bit character
  9390.           literally or you can enter its numeric code. Here are examples
  9391.           that you can enter from a terminal or console that uses the ISO
  9392.           Latin-1 character set:
  9393.           
  9394.   C-Kermit> set escape ├
  9395.   C-Kermit> set escape 195
  9396.   C-Kermit> show escape
  9397.    Escape character: Code 195 (├): enabled
  9398.   C-Kermit>
  9399.  
  9400.           Both of these commands set the escape character value to 195
  9401.           (decimal), which happens to be uppercase letter A with Tilde in
  9402.           Latin-1. SHOW ESCAPE and SHOW TERMINAL show the value, as does
  9403.           the CONNECT message.
  9404.           
  9405.    SET TERMINAL AUTODOWNLOAD ERROR { STOP, CONTINUE }
  9406.           When Kermit has a terminal connection to another computer, and
  9407.           a file transfer is initiated automatically because a Kermit
  9408.           packet was received in CONNECT mode (i.e. in the terminal
  9409.           screen), this command tells what Kermit should do if the
  9410.           transfer fails. The default is to STOP, which leaves Kermit in
  9411.           command mode with its file-transfer display showing, so you can
  9412.           see that the transfer failed and why. If you SET TERMINAL
  9413.           AUTODOWNLOAD ERROR CONTINUE, this causes Kermit to return
  9414.           automatically to its terminal screen (i.e. resume its CONNECT
  9415.           session) as if the transfer had succeeded; this can be
  9416.           desirable if the entire session is under control of a
  9417.           host-based script.
  9418.           
  9419.    SET TERMINAL BYTESIZE { 7, 8 }
  9420.           The byte size to use during CONNECT and INPUT command
  9421.           execution, which can be more restrictive than the bytesize
  9422.           implied by the current PARITY setting, but not less
  9423.           restrictive. In C-Kermit 7.0 and earlier, the terminal bytesize
  9424.           was 7 by default to protect against the likelihood that parity
  9425.           was in use on the connection without the user's knowledge. When
  9426.           the terminal bytesize is 8 (as it is in C-Kermit 8.0 and
  9427.           later), the user will see garbage in this (increasingly
  9428.           unlikely) situation. Note that 8 data bits are required for
  9429.           most character sets other than ASCII: Latin-1, UTF-8, and so
  9430.           on.
  9431.           
  9432.    A new command has been added to produce timestamped session logs:
  9433.    
  9434.    SET TERMINAL SESSION-LOG TIMESTAMPED-TEXT
  9435.           Records the terminal session in text mode (like SET TERMINAL
  9436.           SESSION-LOG TEXT) but adds a timestamp at the beginning of each
  9437.           line. The timestamp format is hh:mm:ss.nnn, and indicates the
  9438.           time at which the first character of the line appeared.
  9439.           
  9440.    In most UNIX versions (those built with the select()-capable CONNECT
  9441.    module -- pretty much all the ones that have or could have TELNET
  9442.    included), an idle timeout feature has been added:
  9443.    
  9444.    SET TERMINAL IDLE-TIMEOUT number
  9445.           If the number is not 0, then Kermit is to take an action when
  9446.           the given amount of time passes with no activity during CONNECT
  9447.           mode. If the number is positive it is the maximum number of
  9448.           idle seconds; if number is negative it represents milliseconds
  9449.           (thousandths of seconds). If 0 is given as the number, there
  9450.           are no idle timeouts. Synonym: SET TERMINAL IDLE-LIMIT.
  9451.           
  9452.    SET TERMINAL IDLE-ACTION { RETURN, HANGUP, EXIT, OUTPUT [ string ] }
  9453.           The action to be taken upon an idle timeout in CONNECT mode.
  9454.           RETURN to the prompt, HANGUP the connection, EXIT from Kermit,
  9455.           or OUTPUT the given string (if no string is given, a NUL (ASCII
  9456.           0) character is sent).
  9457.           
  9458.    SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }
  9459.           Actions that can be selected on Telnet connections only, that
  9460.           might be useful if idle limits are enforced by the Telnet
  9461.           server or in the TCP/IP protocol: TELNET-NOP sends a "NO
  9462.           Operation" (do-nothing) command, which causes no response from
  9463.           the server; TELNET-AYT sends an "Are You There" message to the
  9464.           server, which should make the server send back a message.
  9465.           Neither of these actions interferes with your remote session.
  9466.           
  9467.    SET TERMINAL IDLE-ACTION is useful for connections to hosts or
  9468.    services that automatically log you out after a certain amount of idle
  9469.    time, e.g.:
  9470.    
  9471.   set term idle-timeout 300
  9472.   set term idle-action output \32
  9473.  
  9474.    sends a space (as if you had pressed the space bar) every 300 seconds
  9475.    (five minutes) while there is no activity (32 is the ASCII code for
  9476.    space).
  9477.    
  9478.    When C-Kermit returns from CONNECT to command mode, the reason for the
  9479.    transition is given in a new variable, \v(cx_status):
  9480.    
  9481.       0  No CONNECT command given yet.
  9482.       1  User escaped back manually.
  9483.       2  A trigger string was encountered.
  9484.       3  IKSD entered server mode.
  9485.       4  Application Program Command received from host.
  9486.       5  Idle timeout.
  9487.       6  Telnet protocol error.
  9488.       7  Keystroke macro.
  9489.       8  Time limit exceeded.
  9490.     100  Internal error.
  9491.     101  Carrier required by not detected.
  9492.     102  I/O error on connection.
  9493.     103  Disconnected by host.
  9494.     104  Disconnected by user.
  9495.     105  Session limit exceeded.
  9496.     106  Rejected due to Telnet policy.
  9497.     107  Received kill signal.
  9498.    
  9499.    Values 100 and above indicate there is no connection.
  9500.    
  9501.    [ [548]Top ] [ [549]Contents ] [ [550]C-Kermit Home ] [ [551]Kermit
  9502.    Home ]
  9503.   __________________________________________________________________________
  9504.  
  9505. 13. CHARACTER SETS
  9506.  
  9507.    See the section on [552]file scanning above, and the section on
  9508.    character-set conversion in [553]FTP. Also:
  9509.    
  9510.      * True support for CP1252 (rather than treating it as Latin-1).
  9511.      * Proper handling of C1 values when converting ISO 8-bit text to
  9512.        UTF-8.
  9513.      * TYPE /CHARACTER-SET: /TRANSLATE-TO: allows specific translations.
  9514.      * The TRANSLATE command now works on multiple files.
  9515.      * K_CHARSET environment variable to set the file character-set.
  9516.      * SET TRANSFER TRANSLATION OFF.
  9517.      * FTP client character-set translation ([554]Section 3.7).
  9518.        
  9519.    [ [555]Top ] [ [556]Contents ] [ [557]C-Kermit Home ] [ [558]Kermit
  9520.    Home ]
  9521.   __________________________________________________________________________
  9522.  
  9523. 14. DIALOUT FROM TELNET TERMINAL SERVERS
  9524.  
  9525.    For years, C-Kermit has supported dialing out from Telnet modem
  9526.    servers (also called reverse terminal servers or access servers), but
  9527.    until now there was no way for Kermit to control the communication
  9528.    parameters (speed, parity, etc) on the serial port of the terminal
  9529.    server; it had to use whatever was there.
  9530.    
  9531.    But now, if you make a connection to a server that supports the Telnet
  9532.    Com Port Control Option, [559]RFC 2217, you have the same degree of
  9533.    control as you would have over a serial port on the computer where
  9534.    Kermit is running: SET SPEED, SET FLOW, SET PARITY, SET STOP-BITS,
  9535.    SHOW COMM, WAIT, SET CARRIER-WATCH, the modem-signal variables,
  9536.    sending Break, and so on, apply to the connection between the terminal
  9537.    server and the modem.
  9538.    
  9539.    For example, using a Cisco Access Server 2509, where specifying a TCP
  9540.    port in the 6000's selects a serial port that can be used for dialing
  9541.    out:
  9542.    
  9543.   set host xxx 6001      ; xxx is the IP hostname or address of the server
  9544.   (log in if necessary)  ; With a script or by hand
  9545.   set modem type usr     ; Tell Kermit what kind of modem it has
  9546.   set speed 57600        ; This affects the server's port
  9547.   set flow rts/cts       ; Ditto
  9548.   dial 7654321
  9549.  
  9550.    The modem server might or might not require a login sequence. It might
  9551.    also allow for automatic authentication, e.g. via Kerberos tickets.
  9552.    NOTE: If the modem server requires a login sequence, then REDIAL might
  9553.    not work as expected.
  9554.    
  9555.    When you have a Telnet Com Port connection, your SET SPEED and SET
  9556.    FLOW options change automatically to reflect the capabilities of the
  9557.    server, rather than those of your local computer.
  9558.    
  9559.    See the configuration manual for your server for additional
  9560.    information. For example, how to set up the server to drop the Telnet
  9561.    connection automatically when the telephone call is hung up (e.g.
  9562.    "autohangup" on Cisco models).
  9563.    
  9564.    For a Linux-based Telnet Com-Port server, click the Srdird link:
  9565.    
  9566.    [ [560]Top ] [ [561]Contents ] [ [562]Sredird ] [ [563]C-Kermit Home ]
  9567.    [ [564]Kermit Home ]
  9568.   __________________________________________________________________________
  9569.  
  9570. 15. COPING WITH BROKEN KERMIT PARTNERS
  9571.  
  9572.    There are lots of faulty Kermit protocol implementations out there,
  9573.    found mainly in 3rd-party products ranging from communications
  9574.    software packages to file-transfer functions imbedded within devices.
  9575.    This topic is covered [565]HERE for C-Kermit 7.0, but C-Kermit 8.0
  9576.    adds some additional tricks.
  9577.    
  9578.    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
  9579.           Allows control of the Kermit's Record-Format attribute. Set
  9580.           this to OFF in case incoming file are refused due to unknown or
  9581.           invalid record formats if you want to accept the file anyway.
  9582.           
  9583.    SET SEND I-PACKETS { ON, OFF }
  9584.           A Kermit server is supposed to accept I-packets; this is how
  9585.           the client lets the server know its capabilities and
  9586.           preferences before sending a command. Apparently there is at
  9587.           least one Kermit server implementation that does not accept
  9588.           I-packets, and does not properly respond with an Error packet
  9589.           if it gets one. To get around such situations in C-Kermit 8.0,
  9590.           you can use SET SEND I-PACKETS OFF to inhibit the sending of I
  9591.           packets. In this case, the client must be able to adjust to the
  9592.           server's configuration, rather than the other way around as we
  9593.           are used to.
  9594.           
  9595.    SET PROTOCOL KERMIT {} {} {}
  9596.           C-Kermit 6.0 and later automatically send "autoupload" and
  9597.           "autodownload" commands when in local mode and you give a file
  9598.           transfer command. For example, if you tell kermit to "send
  9599.           oofa.txt", Kermit sends "kermit -r" and a carriage return, in
  9600.           case you had forgotten to start Kermit on the far end and told
  9601.           it to receive a file. If a Kermit program had already been
  9602.           started on the far end, it should harmlessly absorb this
  9603.           string. However, some Kermit programs violate the Kermit
  9604.           protocol definition and treat such strings as Kermit packets
  9605.           even though they are not. In such cases, give this command to
  9606.           set the Kermit protocol autoupload and download strings to
  9607.           nothing, which tells Kermit not to send them. (This is not a
  9608.           new feature, but it was not previously included in the "Coping"
  9609.           section of the documentation.)
  9610.           
  9611.    [ [566]Top ] [ [567]Contents ] [ [568]C-Kermit Home ] [ [569]Kermit
  9612.    Home ]
  9613.   __________________________________________________________________________
  9614.  
  9615. 16. NEW COMMAND-LINE OPTIONS
  9616.  
  9617.    kermit -h Now prints a complete listing of its command-line options,
  9618.    rather than an abbreviated list squeezed into a 24x80 space.
  9619.    
  9620.    -dd              Debug, like -d but adds timestamps
  9621.    --version  Shows C-Kermit version number.
  9622.    --noperms  Equivalent to SET ATTRIBUTE PROTECTION OFF.
  9623.    
  9624.    Kermit now accepts a selection of URLs (Universal Resource Locators)
  9625.    as its first command-line argument. These are:
  9626.    
  9627.    telnet:hostname
  9628.           Makes a Telnet connection to the given host (IP hostname or
  9629.           address).
  9630.           
  9631.    ftp://[user[:password]@]hostname[/path...]
  9632.           Makes an FTP connection to the given host (IP hostname or
  9633.           address). If a username is given, Kermit tries to log you in;
  9634.           if a password is given, it is used; if not, you are prompted
  9635.           for one. If no username is given, an anonymous login is
  9636.           performed. If a pathname is included, Kermit tries to GET the
  9637.           given file. See [570]Section 3.1.3 for details.
  9638.           
  9639.    ftps://[user[:password]@]hostname[/path...]
  9640.           Makes a secure FTP connection over SSL.
  9641.           
  9642.    telnets://[user[:password]@]hostname
  9643.           Makes a secure Telnet connection over SSL.
  9644.           
  9645.    kermit://[user[:password]@]hostname[/path...]
  9646.           Makes a connection to an [571]Internet Kermit Server.
  9647.           
  9648.    http://[user[:password]@]hostname[/path...]
  9649.           Makes a connection to Web server.
  9650.           
  9651.    https://[user[:password]@]hostname[/path...]
  9652.           Makes a connection to secure Web server.
  9653.           
  9654.    [ [572]Top ] [ [573]Contents ] [ [574]C-Kermit Home ] [ [575]Kermit
  9655.    Home ]
  9656.   __________________________________________________________________________
  9657.  
  9658. 17. LOGS
  9659.  
  9660.    In C-Kermit 8.0, we make an effort to keep passwords out of the debug
  9661.    log. This can never be 100% effective, but it's better than before,
  9662.    when there were no precautions at all. Whenever Kermit knows it's
  9663.    prompting for, parsing, or transmitting a password, it temporarily
  9664.    turns off logging and then turns it back on afterwards. This keeps the
  9665.    debug log password-free in most common cases, but there can be no
  9666.    guarantees.
  9667.    
  9668.    As noted elsewhere, the new "-dd" command-line option selects a
  9669.    timestamped debug log (equivalent to "set debug timestamps on", "log
  9670.    debug debug.log").
  9671.    
  9672.    C-Kermit 8.0 also supports a new timestamped session log via "set
  9673.    session-log timestamped-text", "log session".
  9674.    
  9675.    There have been requests for other kinds of logs, for example a
  9676.    command log. These might be added at some point. One person wanted to
  9677.    be able to log commands with timestamps, but only commands issued at
  9678.    the prompt, not commands from files or macros, and also wanted a
  9679.    header line at the beginning showing the date, user, and host. This
  9680.    can be done as follows:
  9681.    
  9682.   .filename := \v(home)commands.log  ; (for example)
  9683.   fopen /write \%c \m(filename)
  9684.   if success {
  9685.       fwrite /line \%c \v(date): User=\v(user) Host=\v(host)
  9686.       fclose \%c
  9687.       set debug timestamps on
  9688.       log debug {| grep "CMD(P)" >> \m(filename)} append
  9689.   }
  9690.  
  9691.    [ [576]Top ] [ [577]Contents ] [ [578]C-Kermit Home ] [ [579]Kermit
  9692.    Home ]
  9693.      _________________________________________________________________
  9694.    
  9695.    C-Kermit 8.0 Update Notes / [580]The Kermit Project / Columbia
  9696.    University / 17 March 2003
  9697.  
  9698. References
  9699.  
  9700.    1. http://www.columbia.edu/kermit/ckermit80.html#contents
  9701.    2. http://www.columbia.edu/kermit/ckermit.html
  9702.    3. http://www.columbia.edu/kermit/index.html
  9703.    4. http://www.columbia.edu/kermit/ckermit80.html
  9704.    5. mailto:kermit-support@columbia.edu
  9705.    6. http://www.columbia.edu/kermit/
  9706.    7. http://www.kermit-project.org/
  9707.    8. http://www.columbia.nyc.ny.us/kermit/
  9708.    9. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
  9709.   10. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
  9710.   11. http://www.columbia.edu/kermit/ckermit80.html#xv
  9711.   12. http://www.columbia.edu/kermit/ck60manual.html
  9712.   13. http://www.columbia.edu/kermit/ckermi70.html
  9713.   14. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt
  9714.   15. http://www.columbia.edu/kermit/ckututor.html
  9715.   16. ftp://kermit.columbia.edu/kermit/f/ckuker.nr
  9716.   17. http://www.columbia.edu/kermit/security.htm
  9717.   18. http://www.columbia.edu/kermit/telnet.htm
  9718.   19. http://www.columbia.edu/kermit/ftpscripts.html
  9719.   20. http://www.columbia.edu/kermit/ckcbwr.html
  9720.   21. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
  9721.   22. http://www.columbia.edu/kermit/ckubwr.html
  9722.   23. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  9723.   24. http://www.columbia.edu/kermit/ckvbwr.html
  9724.   25. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
  9725.   26. http://www.columbia.edu/kermit/ckuins.html
  9726.   27. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
  9727.   28. http://www.columbia.edu/kermit/ckvins.html
  9728.   29. ftp://kermit.columbia.edu/kermit/f/ckvins.txt
  9729.   30. http://www.columbia.edu/kermit/ckccfg.html
  9730.   31. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  9731.   32. http://www.columbia.edu/kermit/ckcplm.html
  9732.   33. ftp://kermit.columbia.edu/kermit/f/ckcplm.txt
  9733.   34. http://www.columbia.edu/kermit/iksd.html
  9734.   35. http://www.columbia.edu/kermit/skermit.html
  9735.   36. http://www.columbia.edu/kermit/ckermit80.html#top
  9736.   37. http://www.columbia.edu/kermit/ckermit.html
  9737.   38. http://www.columbia.edu/kermit/index.html
  9738.   39. http://www.columbia.edu/kermit/ckermit80.html#x0
  9739.   40. http://www.columbia.edu/kermit/ckermit80.html#x1
  9740.   41. http://www.columbia.edu/kermit/ckermit80.html#x2
  9741.   42. http://www.columbia.edu/kermit/ckermit80.html#x2.1
  9742.   43. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  9743.   44. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
  9744.   45. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
  9745.   46. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
  9746.   47. http://www.columbia.edu/kermit/ckermit80.html#x2.2.4
  9747.   48. http://www.columbia.edu/kermit/ckermit80.html#x2.2.5
  9748.   49. http://www.columbia.edu/kermit/ckermit80.html#x2.2.6
  9749.   50. http://www.columbia.edu/kermit/ckermit80.html#x3
  9750.   51. http://www.columbia.edu/kermit/ckermit80.html#x3.1
  9751.   52. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
  9752.   53. http://www.columbia.edu/kermit/ckermit80.html#x3.1.2
  9753.   54. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9754.   55. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  9755.   56. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9756.   57. http://www.columbia.edu/kermit/ckermit80.html#x3.3
  9757.   58. http://www.columbia.edu/kermit/ckermit80.html#x3.4
  9758.   59. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  9759.   60. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
  9760.   61. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  9761.   62. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
  9762.   63. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9763.   64. http://www.columbia.edu/kermit/ckermit80.html#x3.6.1
  9764.   65. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  9765.   66. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
  9766.   67. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9767.   68. http://www.columbia.edu/kermit/ckermit80.html#x3.7.1
  9768.   69. http://www.columbia.edu/kermit/ckermit80.html#x3.7.2
  9769.   70. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9770.   71. http://www.columbia.edu/kermit/ckermit80.html#x3.9
  9771.   72. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  9772.   73. http://www.columbia.edu/kermit/ckermit80.html#x3.10.1
  9773.   74. http://www.columbia.edu/kermit/ckermit80.html#x3.10.2
  9774.   75. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9775.   76. http://www.columbia.edu/kermit/ckermit80.html#x4
  9776.   77. http://www.columbia.edu/kermit/ckermit80.html#x5
  9777.   78. http://www.columbia.edu/kermit/ckermit80.html#x6
  9778.   79. http://www.columbia.edu/kermit/ckermit80.html#x6.1
  9779.   80. http://www.columbia.edu/kermit/ckermit80.html#x6.2
  9780.   81. http://www.columbia.edu/kermit/ckermit80.html#x6.3
  9781.   82. http://www.columbia.edu/kermit/ckermit80.html#x6.4
  9782.   83. http://www.columbia.edu/kermit/ckermit80.html#x6.5
  9783.   84. http://www.columbia.edu/kermit/ckermit80.html#x6.6
  9784.   85. http://www.columbia.edu/kermit/ckermit80.html#x7
  9785.   86. http://www.columbia.edu/kermit/ckermit80.html#x8
  9786.   87. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  9787.   88. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  9788.   89. http://www.columbia.edu/kermit/ckermit80.html#x8.3
  9789.   90. http://www.columbia.edu/kermit/ckermit80.html#x8.4
  9790.   91. http://www.columbia.edu/kermit/ckermit80.html#x8.5
  9791.   92. http://www.columbia.edu/kermit/ckermit80.html#x8.6
  9792.   93. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  9793.   94. http://www.columbia.edu/kermit/ckermit80.html#x8.8
  9794.   95. http://www.columbia.edu/kermit/ckermit80.html#x8.9
  9795.   96. http://www.columbia.edu/kermit/ckermit80.html#x8.10
  9796.   97. http://www.columbia.edu/kermit/ckermit80.html#x8.11
  9797.   98. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  9798.   99. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  9799.  100. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  9800.  101. http://www.columbia.edu/kermit/ckermit80.html#x9
  9801.  102. http://www.columbia.edu/kermit/ckermit80.html#x9.1
  9802.  103. http://www.columbia.edu/kermit/ckermit80.html#x9.2
  9803.  104. http://www.columbia.edu/kermit/ckermit80.html#x9.3
  9804.  105. http://www.columbia.edu/kermit/ckermit80.html#x9.4
  9805.  106. http://www.columbia.edu/kermit/ckermit80.html#x9.5
  9806.  107. http://www.columbia.edu/kermit/ckermit80.html#x9.6
  9807.  108. http://www.columbia.edu/kermit/ckermit80.html#x9.7
  9808.  109. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9809.  110. http://www.columbia.edu/kermit/ckermit80.html#x9.9
  9810.  111. http://www.columbia.edu/kermit/ckermit80.html#x9.10
  9811.  112. http://www.columbia.edu/kermit/ckermit80.html#x9.11
  9812.  113. http://www.columbia.edu/kermit/ckermit80.html#x10
  9813.  114. http://www.columbia.edu/kermit/ckermit80.html#x11
  9814.  115. http://www.columbia.edu/kermit/ckermit80.html#x12
  9815.  116. http://www.columbia.edu/kermit/ckermit80.html#x13
  9816.  117. http://www.columbia.edu/kermit/ckermit80.html#x14
  9817.  118. http://www.columbia.edu/kermit/ckermit80.html#x15
  9818.  119. http://www.columbia.edu/kermit/ckermit80.html#x16
  9819.  120. http://www.columbia.edu/kermit/ckermit80.html#x17
  9820.  121. http://www.columbia.edu/kermit/ckermit80.html#top
  9821.  122. http://www.columbia.edu/kermit/ckermit.html
  9822.  123. http://www.columbia.edu/kermit/index.html
  9823.  124. http://www.columbia.edu/kermit/ckuins.html#x5
  9824.  125. http://www.columbia.edu/kermit/ckuins.html
  9825.  126. http://www.columbia.edu/kermit/ckermit80.html#x5
  9826.  127. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  9827.  128. http://www.columbia.edu/kermit/ckermit80.html#contents
  9828.  129. http://www.columbia.edu/kermit/ckermit80.html#x15
  9829.  130. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9830.  131. http://www.columbia.edu/kermit/ckermit80.html#ftpdates
  9831.  132. http://www.columbia.edu/kermit/ckermit80.html#ftpcheck
  9832.  133. http://www.columbia.edu/kermit/ckermit80.html#ftpnamelist
  9833.  134. http://www.columbia.edu/kermit/ckermit80.html#srvrename
  9834.  135. http://www.columbia.edu/kermit/ckermit80.html#ftpvdir
  9835.  136. http://www.columbia.edu/kermit/ckermit80.html#setftptype
  9836.  137. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9837.  138. http://www.columbia.edu/kermit/ckermit80.html#x15
  9838.  139. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  9839.  140. http://www.columbia.edu/kermit/ckermit80.html#x2.1
  9840.  141. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  9841.  142. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  9842.  143. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  9843.  144. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  9844.  145. http://www.columbia.edu/kermit/ckututor.html
  9845.  146. http://www.columbia.edu/kermit/ckuins.html
  9846.  147. http://www.columbia.edu/kermit/skermit.html
  9847.  148. http://www.columbia.edu/kermit/ckermit80.html#setlocus
  9848.  149. http://www.columbia.edu/kermit/ckermit80.html#lcommands
  9849.  150. http://www.columbia.edu/kermit/ckermit80.html#ftpuser
  9850.  151. http://www.columbia.edu/kermit/ckermit80.html#showvar
  9851.  152. http://www.columbia.edu/kermit/ckermit80.html#callerid
  9852.  153. http://www.columbia.edu/kermit/ckermit80.html#x6.6
  9853.  154. http://www.columbia.edu/kermit/ckermit80.html#x0
  9854.  155. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9855.  156. http://www.columbia.edu/kermit/ckermit80.html#top
  9856.  157. http://www.columbia.edu/kermit/ckermit80.html#contents
  9857.  158. http://www.columbia.edu/kermit/ckermit.html
  9858.  159. http://www.columbia.edu/kermit/index.html
  9859.  160. http://www.columbia.edu/kermit/ckermit80.html#x0
  9860.  161. http://www.columbia.edu/kermit/ckermit80.html#top
  9861.  162. http://www.columbia.edu/kermit/ckermit80.html#contents
  9862.  163. http://www.columbia.edu/kermit/ckermit.html
  9863.  164. http://www.columbia.edu/kermit/index.html
  9864.  165. http://www.columbia.edu/kermit/k95.html
  9865.  166. http://www.columbia.edu/kermit/sshclient.html
  9866.  167. http://www.columbia.edu/kermit/skermit.html
  9867.  168. http://www.columbia.edu/kermit/skermit.html
  9868.  169. http://www.columbia.edu/kermit/sshclien.htm
  9869.  170. http://www.columbia.edu/kermit/ckermit80.html#x3
  9870.  171. ftp://ftp.isi.edu/in-notes/rfc1738.txt
  9871.  172. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
  9872.  173. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
  9873.  174. ftp://ftp.isi.edu/in-notes/rfc2396.txt
  9874.  175. ftp://ftp.isi.edu/in-notes/rfc2616.txt
  9875.  176. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
  9876.  177. ftp://ftp.isi.edu/in-notes/rfc2616.txt
  9877.  178. http://www.columbia.edu/kermit/ckermit80.html#x8.13.7
  9878.  179. http://www.columbia.edu/kermit/security.htm#x5.4
  9879.  180. http://www.columbia.edu/kermit/security.htm#x15
  9880.  181. http://www.columbia.edu/kermit/security.htm#x6.2
  9881.  182. http://www.columbia.edu/kermit/security.html
  9882.  183. http://www.columbia.edu/kermit/ckermit80.html#x16
  9883.  184. http://www.columbia.edu/kermit/ckermit80.html#top
  9884.  185. http://www.columbia.edu/kermit/ckermit80.html#contents
  9885.  186. http://www.columbia.edu/kermit/ckermit.html
  9886.  187. http://www.columbia.edu/kermit/index.html
  9887.  188. http://www.columbia.edu/kermit/ckermit80.html#x3.1
  9888.  189. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9889.  190. http://www.columbia.edu/kermit/ckermit80.html#x3.3
  9890.  191. http://www.columbia.edu/kermit/ckermit80.html#x3.4
  9891.  192. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  9892.  193. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9893.  194. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9894.  195. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9895.  196. http://www.columbia.edu/kermit/ckermit80.html#x3.9
  9896.  197. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  9897.  198. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9898.  199. http://www.columbia.edu/kermit/security.htm
  9899.  200. http://www.columbia.edu/kermit/security.htm#servers
  9900.  201. http://www.columbia.edu/kermit/ckcsets.html
  9901.  202. http://www.columbia.edu/kermit/unicode.html
  9902.  203. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
  9903.  204. http://www.columbia.edu/kermit/case10.html
  9904.  205. http://www.columbia.edu/kermit/ckermit80.html#x4
  9905.  206. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9906.  207. http://www.columbia.edu/kermit/ftpscripts.html
  9907.  208. http://www.columbia.edu/kermit/ckermit80.html#top
  9908.  209. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9909.  210. http://www.columbia.edu/kermit/ftpclient.html
  9910.  211. http://www.columbia.edu/kermit/ftpscripts.html
  9911.  212. http://www.columbia.edu/kermit/ckermit.html
  9912.  213. http://www.columbia.edu/kermit/index.html
  9913.  214. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
  9914.  215. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9915.  216. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  9916.  217. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9917.  218. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9918.  219. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9919.  220. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  9920.  221. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9921.  222. http://www.columbia.edu/kermit/ftpscripts.html
  9922.  223. http://www.columbia.edu/kermit/ckb2.htm
  9923.  224. http://www.columbia.edu/kermit/ckermit80.html#ftpautolog
  9924.  225. http://www.columbia.edu/kermit/ckermit80.html#ftpuser
  9925.  226. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9926.  227. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9927.  228. http://www.columbia.edu/kermit/ckermit80.html#top
  9928.  229. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9929.  230. http://www.columbia.edu/kermit/ckermit.html
  9930.  231. http://www.columbia.edu/kermit/index.html
  9931.  232. http://www.columbia.edu/kermit/ibm_ie.html
  9932.  233. http://www.columbia.edu/kermit/ckermit80.html#top
  9933.  234. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9934.  235. http://www.columbia.edu/kermit/ckermit.html
  9935.  236. http://www.columbia.edu/kermit/index.html
  9936.  237. http://www.columbia.edu/kermit/ck60manual.html
  9937.  238. http://www.columbia.edu/kermit/ckermit70.html#x4.17
  9938.  239. http://www.columbia.edu/kermit/ckermit70.html
  9939.  240. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9940.  241. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9941.  242. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  9942.  243. http://www.columbia.edu/kermit/security.html
  9943.  244. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9944.  245. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9945.  246. http://www.columbia.edu/kermit/ckermit80.html#x8.13.4
  9946.  247. http://www.columbia.edu/kermit/ckermit80.html#permswitch
  9947.  248. http://www.columbia.edu/kermit/ckermit80.html#ftpchmod
  9948.  249. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  9949.  250. http://www.columbia.edu/kermit/ckermit80.html#x4
  9950.  251. http://www.columbia.edu/kermit/ckermit80.html#top
  9951.  252. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9952.  253. http://www.columbia.edu/kermit/ckermit.html
  9953.  254. http://www.columbia.edu/kermit/index.html
  9954.  255. http://www.columbia.edu/kermit/ckermit80.html#x7
  9955.  256. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9956.  257. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9957.  258. http://www.columbia.edu/kermit/ckb2.htm
  9958.  259. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  9959.  260. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  9960.  261. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9961.  262. http://www.columbia.edu/kermit/ckermit80.html#setftptype
  9962.  263. http://www.columbia.edu/kermit/ckermit80.html#top
  9963.  264. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9964.  265. http://www.columbia.edu/kermit/ckermit.html
  9965.  266. http://www.columbia.edu/kermit/index.html
  9966.  267. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  9967.  268. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
  9968.  269. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  9969.  270. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  9970.  271. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  9971.  272. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  9972.  273. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  9973.  274. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
  9974.  275. http://www.columbia.edu/kermit/ckermi70.htm
  9975.  276. http://www.columbia.edu/kermit/ckermit80.html#x4
  9976.  277. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9977.  278. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  9978.  279. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9979.  280. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  9980.  281. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  9981.  282. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  9982.  283. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  9983.  284. http://www.columbia.edu/kermit/ckermit80.html#ftpperms
  9984.  285. http://www.columbia.edu/kermit/ckermit80.html#ftpunique
  9985.  286. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  9986.  287. http://www.columbia.edu/kermit/ckermit80.html#note_utc
  9987.  288. http://www.columbia.edu/kermit/ckermit80.html#note_date
  9988.  289. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  9989.  290. http://www.boulder.nist.gov/timefreq/faq/faq.htm#10:
  9990.  291. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9991.  292. http://www.columbia.edu/kermit/ckermit80.html#top
  9992.  293. http://www.columbia.edu/kermit/ckermit80.html#ftp
  9993.  294. http://www.columbia.edu/kermit/ckermit.html
  9994.  295. http://www.columbia.edu/kermit/index.html
  9995.  296. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  9996.  297. http://www.columbia.edu/kermit/ckermi70.htm#x4.3
  9997.  298. http://www.columbia.edu/kermit/ckermit70.html
  9998.  299. http://www.columbia.edu/kermit/ckermit80.html#x5
  9999.  300. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
  10000.  301. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  10001.  302. http://www.columbia.edu/kermit/ckermi70.htm#x4.1
  10002.  303. http://www.columbia.edu/kermit/ckermi70.htm#x4.2.2
  10003.  304. http://www.columbia.edu/kermit/ckermi70.htm#x1.5.4
  10004.  305. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  10005.  306. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  10006.  307. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  10007.  308. http://www.columbia.edu/kermit/ckermit80.html#srvrename
  10008.  309. http://www.columbia.edu/kermit/ckermi70.htm#x4.1
  10009.  310. http://www.columbia.edu/kermit/ckermi70.htm
  10010.  311. http://www.columbia.edu/kermit/ckb2.htm
  10011.  312. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  10012.  313. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
  10013.  314. http://www.proftpd.net/
  10014.  315. http://www.columbia.edu/kermit/ckermit80.html#top
  10015.  316. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10016.  317. http://www.columbia.edu/kermit/ckermit.html
  10017.  318. http://www.columbia.edu/kermit/index.html
  10018.  319. http://www.columbia.edu/kermit/ckb2.htm
  10019.  320. http://www.columbia.edu/kermit/ckcsets.html
  10020.  321. http://www.columbia.edu/kermit/unicode.html
  10021.  322. http://www.columbia.edu/kermit/ckcsets.html
  10022.  323. http://www.columbia.edu/kermit/ckcsets.html
  10023.  324. http://www.columbia.edu/kermit/ckermit80.html#x4
  10024.  325. http://www.columbia.edu/kermit/utf8.html
  10025.  326. http://www.columbia.edu/kermit/ckcsets.html
  10026.  327. http://www.columbia.edu/kermit/ckermit80.html#x4
  10027.  328. ftp://ftp.isi.edu/in-notes/rfc2640.txt
  10028.  329. http://www.columbia.edu/kermit/ckermit80.html#top
  10029.  330. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10030.  331. http://www.columbia.edu/kermit/ckermit.html
  10031.  332. http://www.columbia.edu/kermit/index.html
  10032.  333. http://www.columbia.edu/kermit/ckermit80.html#top
  10033.  334. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10034.  335. http://www.columbia.edu/kermit/ckermit.html
  10035.  336. http://www.columbia.edu/kermit/index.html
  10036.  337. http://www.columbia.edu/kermit/ckermit80.html#top
  10037.  338. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10038.  339. http://www.columbia.edu/kermit/ckermit.html
  10039.  340. http://www.columbia.edu/kermit/index.html
  10040.  341. http://www.columbia.edu/kermit/ftpscripts.html
  10041.  342. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10042.  343. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10043.  344. ftp://ftp.isi.edu/in-notes/rfc959.txt
  10044.  345. http://www.columbia.edu/kermit/ckscripts.html
  10045.  346. http://www.columbia.edu/kermit/ftpscript.html
  10046.  347. http://www.columbia.edu/kermit/ckermit80.html#top
  10047.  348. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10048.  349. http://www.columbia.edu/kermit/ckermit.html
  10049.  350. http://www.columbia.edu/kermit/index.html
  10050.  351. http://www.columbia.edu/kermit/ckermit80.html#x3.11.1
  10051.  352. http://www.columbia.edu/kermit/ckermit80.html#x3.11.2
  10052.  353. http://www.columbia.edu/kermit/ckermit80.html#x3.11.3
  10053.  354. http://www.columbia.edu/kermit/ckermit80.html#x3.11.4
  10054.  355. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5
  10055.  356. http://www.columbia.edu/kermit/ckermit.html
  10056.  357. http://www.columbia.edu/kermit/k95.html
  10057.  358. http://www.columbia.edu/kermit/ckermit80.html#x3.11.5
  10058.  359. ftp://ftp.isi.edu/in-notes/rfc959.txt
  10059.  360. ftp://ftp.isi.edu/in-notes/rfc2389.txt
  10060.  361. http://www.ietf.org/internet-drafts/draft-ietf-ftpext-mlst-16.txt
  10061.  362. http://www.columbia.edu/kermit/ftpclient.html
  10062.  363. http://www.columbia.edu/kermit/ckermit80.html#top
  10063.  364. http://www.columbia.edu/kermit/ckermit80.html#ftp
  10064.  365. http://www.columbia.edu/kermit/ckermit.html
  10065.  366. http://www.columbia.edu/kermit/index.html
  10066.  367. http://www.columbia.edu/kermit/ckermit80.html#x3
  10067.  368. http://www.columbia.edu/kermit/ckermit80.html#ucs2
  10068.  369. http://www.columbia.edu/kermit/ckermit80.html#top
  10069.  370. http://www.columbia.edu/kermit/ckermit80.html#contents
  10070.  371. http://www.columbia.edu/kermit/ckermit.html
  10071.  372. http://www.columbia.edu/kermit/index.html
  10072.  373. http://www.columbia.edu/kermit/ckermit80.html#top
  10073.  374. http://www.columbia.edu/kermit/ckermit80.html#contents
  10074.  375. http://www.columbia.edu/kermit/ckermit.html
  10075.  376. http://www.columbia.edu/kermit/index.html
  10076.  377. http://www.columbia.edu/kermit/ckb2.htm
  10077.  378. http://www.columbia.edu/kermit/ckermit80.html#top
  10078.  379. http://www.columbia.edu/kermit/ckermit80.html#contents
  10079.  380. http://www.columbia.edu/kermit/ckermit.html
  10080.  381. http://www.columbia.edu/kermit/index.html
  10081.  382. http://www.columbia.edu/kermit/ckermit80.html#x4
  10082.  383. http://www.columbia.edu/kermit/ckermit80.html#x4
  10083.  384. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  10084.  385. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  10085.  386. http://www.columbia.edu/kermit/ckermit80.html#x12
  10086.  387. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  10087.  388. http://www.columbia.edu/kermit/ckermit80.html#top
  10088.  389. http://www.columbia.edu/kermit/ckermit80.html#contents
  10089.  390. http://www.columbia.edu/kermit/ckermit.html
  10090.  391. http://www.columbia.edu/kermit/index.html
  10091.  392. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  10092.  393. http://www.columbia.edu/kermit/ckermit80.html#top
  10093.  394. http://www.columbia.edu/kermit/ckermit80.html#contents
  10094.  395. http://www.columbia.edu/kermit/ckermit.html
  10095.  396. http://www.columbia.edu/kermit/index.html
  10096.  397. http://www.columbia.edu/kermit/ckermit80.html#x9
  10097.  398. http://www.columbia.edu/kermit/ckermit80.html#top
  10098.  399. http://www.columbia.edu/kermit/ckermit80.html#contents
  10099.  400. http://www.columbia.edu/kermit/ckermit.html
  10100.  401. http://www.columbia.edu/kermit/index.html
  10101.  402. http://www.columbia.edu/kermit/ckermit80.html#x8.6
  10102.  403. http://www.columbia.edu/kermit/ckermit80.html#top
  10103.  404. http://www.columbia.edu/kermit/ckermit80.html#contents
  10104.  405. http://www.columbia.edu/kermit/ckermit.html
  10105.  406. http://www.columbia.edu/kermit/index.html
  10106.  407. http://www.columbia.edu/kermit/ckermit80.html#top
  10107.  408. http://www.columbia.edu/kermit/ckermit80.html#contents
  10108.  409. http://www.columbia.edu/kermit/ckermit.html
  10109.  410. http://www.columbia.edu/kermit/index.html
  10110.  411. http://www.columbia.edu/kermit/ckermit80.html#top
  10111.  412. http://www.columbia.edu/kermit/ckermit80.html#contents
  10112.  413. http://www.columbia.edu/kermit/ckermit.html
  10113.  414. http://www.columbia.edu/kermit/index.html
  10114.  415. http://www.columbia.edu/kermit/ckermit80.html#fjoin
  10115.  416. http://www.columbia.edu/kermit/ckermit80.html#fsplit
  10116.  417. http://www.columbia.edu/kermit/ckermit80.html#x8.10
  10117.  418. http://www.columbia.edu/kermit/ckermit80.html#top
  10118.  419. http://www.columbia.edu/kermit/ckermit80.html#contents
  10119.  420. http://www.columbia.edu/kermit/ckermit.html
  10120.  421. http://www.columbia.edu/kermit/index.html
  10121.  422. http://www.columbia.edu/kermit/ckermit80.html#x9
  10122.  423. http://www.columbia.edu/kermit/ckermit80.html#x9
  10123.  424. http://www.columbia.edu/kermit/ckermit80.html#x9
  10124.  425. http://www.columbia.edu/kermit/ckermit80.html#x3
  10125.  426. http://www.columbia.edu/kermit/ckermit80.html#x3
  10126.  427. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10127.  428. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10128.  429. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  10129.  430. http://www.columbia.edu/kermit/ckermit80.html#x3
  10130.  431. http://www.columbia.edu/kermit/ckermit80.html#x3
  10131.  432. http://www.columbia.edu/kermit/ckermit80.html#x3
  10132.  433. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  10133.  434. http://www.columbia.edu/kermit/ckermit80.html#x3
  10134.  435. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  10135.  436. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  10136.  437. http://www.columbia.edu/kermit/ckermit80.html#x9
  10137.  438. http://www.columbia.edu/kermit/ckermit80.html#x8.7.4
  10138.  439. http://www.columbia.edu/kermit/ckermit80.html#top
  10139.  440. http://www.columbia.edu/kermit/ckermit80.html#contents
  10140.  441. http://www.columbia.edu/kermit/ckermit.html
  10141.  442. http://www.columbia.edu/kermit/index.html
  10142.  443. http://www.columbia.edu/kermit/ckermit80.html#top
  10143.  444. http://www.columbia.edu/kermit/ckermit80.html#contents
  10144.  445. http://www.columbia.edu/kermit/ckermit.html
  10145.  446. http://www.columbia.edu/kermit/index.html
  10146.  447. http://www.columbia.edu/kermit/ckermit80.html#top
  10147.  448. http://www.columbia.edu/kermit/ckermit80.html#contents
  10148.  449. http://www.columbia.edu/kermit/ckermit.html
  10149.  450. http://www.columbia.edu/kermit/index.html
  10150.  451. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  10151.  452. http://www.columbia.edu/kermit/ckermit80.html#top
  10152.  453. http://www.columbia.edu/kermit/ckermit80.html#contents
  10153.  454. http://www.columbia.edu/kermit/ckermit.html
  10154.  455. http://www.columbia.edu/kermit/index.html
  10155.  456. http://www.columbia.edu/kermit/ckermit80.html#scriptedit
  10156.  457. http://www.columbia.edu/kermit/ckermit80.html#top
  10157.  458. http://www.columbia.edu/kermit/ckermit80.html#contents
  10158.  459. http://www.columbia.edu/kermit/ckermit.html
  10159.  460. http://www.columbia.edu/kermit/index.html
  10160.  461. http://www.columbia.edu/kermit/ckermit80.html#top
  10161.  462. http://www.columbia.edu/kermit/ckermit80.html#contents
  10162.  463. http://www.columbia.edu/kermit/ckermit.html
  10163.  464. http://www.columbia.edu/kermit/index.html
  10164.  465. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10165.  466. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10166.  467. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10167.  468. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  10168.  469. http://www.columbia.edu/kermit/ckermit80.html#top
  10169.  470. http://www.columbia.edu/kermit/ckermit80.html#contents
  10170.  471. http://www.columbia.edu/kermit/ckermit.html
  10171.  472. http://www.columbia.edu/kermit/index.html
  10172.  473. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  10173.  474. http://www.columbia.edu/kermit/ckermit80.html#top
  10174.  475. http://www.columbia.edu/kermit/ckermit80.html#contents
  10175.  476. http://www.columbia.edu/kermit/ckermit.html
  10176.  477. http://www.columbia.edu/kermit/index.html
  10177.  478. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  10178.  479. http://www.columbia.edu/kermit/ckermit80.html#top
  10179.  480. http://www.columbia.edu/kermit/ckermit80.html#contents
  10180.  481. http://www.columbia.edu/kermit/ckermit.html
  10181.  482. http://www.columbia.edu/kermit/index.html
  10182.  483. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10183.  484. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10184.  485. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  10185.  486. http://www.columbia.edu/kermit/ckermit80.html#top
  10186.  487. http://www.columbia.edu/kermit/ckermit80.html#contents
  10187.  488. http://www.columbia.edu/kermit/ckermit.html
  10188.  489. http://www.columbia.edu/kermit/index.html
  10189.  490. http://www.columbia.edu/kermit/ckermit80.html#top
  10190.  491. http://www.columbia.edu/kermit/ckermit80.html#contents
  10191.  492. http://www.columbia.edu/kermit/ckermit.html
  10192.  493. http://www.columbia.edu/kermit/index.html
  10193.  494. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10194.  495. http://www.columbia.edu/kermit/ckermit80.html#top
  10195.  496. http://www.columbia.edu/kermit/ckermit80.html#contents
  10196.  497. http://www.columbia.edu/kermit/ckermit.html
  10197.  498. http://www.columbia.edu/kermit/index.html
  10198.  499. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10199.  500. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10200.  501. http://www.columbia.edu/kermit/ckermit80.html#x9.6
  10201.  502. http://www.columbia.edu/kermit/ckermit80.html#top
  10202.  503. http://www.columbia.edu/kermit/ckermit80.html#contents
  10203.  504. http://www.columbia.edu/kermit/ckermit.html
  10204.  505. http://www.columbia.edu/kermit/index.html
  10205.  506. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10206.  507. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  10207.  508. http://www.columbia.edu/kermit/ckermit80.html#top
  10208.  509. http://www.columbia.edu/kermit/ckermit80.html#contents
  10209.  510. http://www.columbia.edu/kermit/ckermit.html
  10210.  511. http://www.columbia.edu/kermit/index.html
  10211.  512. http://www.columbia.edu/kermit/ckermit80.html#top
  10212.  513. http://www.columbia.edu/kermit/ckermit80.html#contents
  10213.  514. http://www.columbia.edu/kermit/ckermit.html
  10214.  515. http://www.columbia.edu/kermit/index.html
  10215.  516. http://www.columbia.edu/kermit/ckermit80.html#top
  10216.  517. http://www.columbia.edu/kermit/ckermit80.html#contents
  10217.  518. http://www.columbia.edu/kermit/ckermit.html
  10218.  519. http://www.columbia.edu/kermit/index.html
  10219.  520. http://www.columbia.edu/kermit/ckermit80.html#x9.9.2
  10220.  521. http://www.columbia.edu/kermit/ckermit80.html#top
  10221.  522. http://www.columbia.edu/kermit/ckermit80.html#contents
  10222.  523. http://www.columbia.edu/kermit/ckermit.html
  10223.  524. http://www.columbia.edu/kermit/index.html
  10224.  525. http://www.columbia.edu/kermit/ckermit80.html#top
  10225.  526. http://www.columbia.edu/kermit/ckermit80.html#contents
  10226.  527. http://www.columbia.edu/kermit/ckermit.html
  10227.  528. http://www.columbia.edu/kermit/index.html
  10228.  529. http://www.columbia.edu/kermit/ckermit80.html#top
  10229.  530. http://www.columbia.edu/kermit/ckermit80.html#contents
  10230.  531. http://www.columbia.edu/kermit/ckermit.html
  10231.  532. http://www.columbia.edu/kermit/index.html
  10232.  533. http://www.columbia.edu/kermit/ckermit80.html#x9.2
  10233.  534. http://www.columbia.edu/kermit/ckermit80.html#top
  10234.  535. http://www.columbia.edu/kermit/ckermit80.html#contents
  10235.  536. http://www.columbia.edu/kermit/ckermit.html
  10236.  537. http://www.columbia.edu/kermit/index.html
  10237.  538. http://www.columbia.edu/kermit/ckermit80.html#x4
  10238.  539. http://www.columbia.edu/kermit/ckermit80.html#x4
  10239.  540. http://www.columbia.edu/kermit/ckermit80.html#top
  10240.  541. http://www.columbia.edu/kermit/ckermit80.html#contents
  10241.  542. http://www.columbia.edu/kermit/ckermit.html
  10242.  543. http://www.columbia.edu/kermit/index.html
  10243.  544. http://www.columbia.edu/kermit/ckermit80.html#top
  10244.  545. http://www.columbia.edu/kermit/ckermit80.html#contents
  10245.  546. http://www.columbia.edu/kermit/ckermit.html
  10246.  547. http://www.columbia.edu/kermit/index.html
  10247.  548. http://www.columbia.edu/kermit/ckermit80.html#top
  10248.  549. http://www.columbia.edu/kermit/ckermit80.html#contents
  10249.  550. http://www.columbia.edu/kermit/ckermit.html
  10250.  551. http://www.columbia.edu/kermit/index.html
  10251.  552. http://www.columbia.edu/kermit/ckermit80.html#x4
  10252.  553. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10253.  554. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  10254.  555. http://www.columbia.edu/kermit/ckermit80.html#top
  10255.  556. http://www.columbia.edu/kermit/ckermit80.html#contents
  10256.  557. http://www.columbia.edu/kermit/ckermit.html
  10257.  558. http://www.columbia.edu/kermit/index.html
  10258.  559. ftp://ftp.isi.edu/in-notes/rfc2217.txt
  10259.  560. http://www.columbia.edu/kermit/ckermit80.html#top
  10260.  561. http://www.columbia.edu/kermit/ckermit80.html#contents
  10261.  562. ftp://kermit.columbia.edu/kermit/sredird/
  10262.  563. http://www.columbia.edu/kermit/ckermit.html
  10263.  564. http://www.columbia.edu/kermit/index.html
  10264.  565. http://www.columbia.edu/kermit/ckermi70.htm#x4.22
  10265.  566. http://www.columbia.edu/kermit/ckermit80.html#top
  10266.  567. http://www.columbia.edu/kermit/ckermit80.html#contents
  10267.  568. http://www.columbia.edu/kermit/ckermit.html
  10268.  569. http://www.columbia.edu/kermit/index.html
  10269.  570. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  10270.  571. http://www.columbia.edu/kermit/cuiksd.html
  10271.  572. http://www.columbia.edu/kermit/ckermit80.html#top
  10272.  573. http://www.columbia.edu/kermit/ckermit80.html#contents
  10273.  574. http://www.columbia.edu/kermit/ckermit.html
  10274.  575. http://www.columbia.edu/kermit/index.html
  10275.  576. http://www.columbia.edu/kermit/ckermit80.html#top
  10276.  577. http://www.columbia.edu/kermit/ckermit80.html#contents
  10277.  578. http://www.columbia.edu/kermit/ckermit.html
  10278.  579. http://www.columbia.edu/kermit/index.html
  10279.  580. http://www.columbia.edu/kermit/index.html
  10280.