home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / cku200.tar / ckermit80.txt < prev    next >
Text File  |  2001-12-17  |  412KB  |  9,187 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.200
  11.    This file last updated: 12 Dec 2001
  12.    
  13.      IF YOU ARE READING A PLAIN-TEXT version of this document, note that
  14.      this file is a plain-text dump of a Web page. You can visit the
  15.      original (and possibly more up-to-date) Web page here:
  16.      
  17.   [4]http://www.columbia.edu/kermit/ckermit80.html
  18.  
  19. Authors: Frank da Cruz and Christine M. Gianone
  20. Address: The Kermit Project
  21.          Columbia University
  22.          612 West 115th Street
  23.          New York NY 10025-7799
  24.          USA
  25. Fax:     +1 (212) 662-6442
  26. E-Mail:  [5]kermit-support@columbia.edu
  27. Web:     [6]http://www.columbia.edu/kermit/
  28. Or:      [7]http://www.kermit-project.org/
  29. Or:      [8]http://www.columbia.nyc.ny.us/kermit/
  30.      _________________________________________________________________
  31.    
  32.   NOTICES
  33.   
  34.    This document:
  35.           Copyright ⌐ 1997, 2001, Frank da Cruz and Christine M. Gianone.
  36.           All rights reserved.
  37.           
  38.    Kermit 95:
  39.           Copyright ⌐ 1995, 2001, Trustees of Columbia University in the
  40.           City of New York. All rights reserved.
  41.           
  42.    C-Kermit:
  43.           Copyright ⌐ 1985, 2001,
  44.           Trustees of Columbia University in the City of New York. All
  45.           rights reserved. See the C-Kermit [9]COPYING.TXT file or the
  46.           copyright text in the [10]ckcmai.c module for disclaimer and
  47.           permissions.
  48.           
  49.    When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or
  50.           SSL/TLS protocol are included:
  51.           Portions Copyright ⌐ 1990, Massachusetts Institute of
  52.           Technology.
  53.           Portions Copyright ⌐ 1991, 1993 Regents of the University of
  54.           California.
  55.           Portions Copyright ⌐ 1991, 1992, 1993, 1994, 1995 by AT&T.
  56.           Portions Copyright ⌐ 1997, Stanford University.
  57.           Portions Copyright ⌐ 1995-1997, Eric Young
  58.           <eay@cryptosoft.com>.
  59.           
  60.    For the full text of the third-party copyright notices, see
  61.    [11]Appendix V.
  62.      _________________________________________________________________
  63.    
  64.   WHAT IS IN THIS FILE
  65.   
  66.    This file lists changes made to C-Kermit since version 7.0 was
  67.    released in January 2000. Use this file as a supplement to:
  68.    
  69.      * The second edition of [12]Using C-Kermit; and:
  70.      * The [13]C-Kermit 7.0 Update Notes. Also available in plain-text
  71.        form as [14]ckermit70.txt. 
  72.        
  73.    until the third edition of Using C-Kermit is published. We apologize
  74.    for the scattered documentation and will consolidate it when we are
  75.    able.
  76.      _________________________________________________________________
  77.    
  78.    ADDITIONAL FILES Several other files accompany this new Kermit
  79.    release:
  80.    
  81.    [15]ckututor.html
  82.           C-Kermit Tutorial (for Unix). Also distributed in Nroff form as
  83.           [16]ckuker.nr, the Unix C-Kermit manual page.
  84.           
  85.    [17]security80.html
  86.           Discussion of Kermit's new authentication and encryption
  87.           features, updated for C-Kermit 8.0.
  88.           
  89.    [18]telnet80.html
  90.           Detailed documentation of Kermit's Telnet client, updated for
  91.           C-Kermit 8.0.
  92.           
  93.    [19]ftpscripts.html
  94.           Tutorial: Writing FTP automation scripts
  95.           
  96.    [20]ckcbwr.html
  97.           Platform-independent C-Kermit hints and tips. Also distributed
  98.           in plain text form as [21]ckcbwr.txt
  99.           
  100.    [22]ckubwr.html
  101.           Unix-specific C-Kermit hints and tips. Also distributed in
  102.           plain text form as [23]ckubwr.txt.
  103.           
  104.    [24]ckvbwr.html
  105.           VMS-specific C-Kermit hints and tips. Also distributed in plain
  106.           text form as [25]ckvbwr.txt.
  107.           
  108.    [26]ckuins.html
  109.           Unix C-Kermit installation instructions. Also distributed in
  110.           plain text form as [27]ckuins.txt.
  111.           
  112.    [28]ckvins.html
  113.           VMS C-Kermit installation instructions. Also distributed in
  114.           plain text form as [29]ckvins.txt.
  115.           
  116.    [30]ckccfg.html
  117.           Compile-time configuration options. Also distributed in plain
  118.           text form as [31]ckccfg.txt.
  119.           
  120.    [32]ckcplm.html
  121.           C-Kermit Program Logic Manual. Also distributed in plain text
  122.           form as [33]ckcplm.txt.
  123.           
  124.    [34]iksd.html
  125.           Internet Kermit Service Aministrators Guide for Unix.
  126.           
  127.    [ [35]Top ] [ [36]C-Kermit Home ] [ [37]Kermit Home ]
  128.   __________________________________________________________________________
  129.  
  130. CONTENTS
  131.  
  132.      [38]0. WHAT'S NEW
  133.      [39]1. FIXES SINCE VERSION 7.0.196
  134.      [40]2. SSH AND HTTP 
  135.          [41]2.1. SSH Connections
  136.          [42]2.2. HTTP Connections
  137.             [43]2.2.1. HTTP Command Switches
  138.             [44]2.2.2. HTTP Action Commands
  139.             [45]2.2.3. HTTP Headers
  140.             [46]2.2.4. Secure HTTP Connections
  141.             [47]2.2.5. HTTP Variables
  142.             [48]2.2.6. The HTTP Command-Line Personality
  143.      [49]3. THE BUILT-IN FTP CLIENT
  144.          [50]3.1. Making and Managing FTP Connections
  145.             [51]3.1.1. Kermit Command-Line Options for FTP
  146.             [52]3.1.2. The FTP Command-Line Personality
  147.             [53]3.1.3. The FTP URL Interpreter
  148.             [54]3.1.4. Interactive FTP Session Establishment
  149.          [55]3.2. Making Secure FTP Connections
  150.          [56]3.3. Setting FTP Preferences
  151.          [57]3.4. Managing Directories and Files
  152.          [58]3.5. Uploading Files With FTP
  153.             [59]3.5.1. FTP PUT Switches
  154.             [60]3.5.2. Update Mode
  155.             [61]3.5.3. Recovery
  156.          [62]3.6. Downloading Files With FTP
  157.             [63]3.6.1. FTP GET Switches
  158.             [64]3.6.2. Filename Collisions
  159.             [65]3.6.3. Recovery
  160.          [66]3.7. Translating Character Sets
  161.             [67]3.7.1. Character Sets and Uploading
  162.             [68]3.7.2. Character Sets and Downloading
  163.          [69]3.8. FTP Command Shortcuts
  164.          [70]3.9. Dual Sessions
  165.          [71]3.10. Automating FTP Sessions
  166.             [72]3.10.1. FTP-Specific Variables and Functions
  167.             [73]3.10.2. Examples
  168.          [74]3.11. Advanced FTP Protocol Features  [75]4. FILE SCANNING
  169.     [76]5. FILE AND DIRECTORY NAMES CONTAINING SPACES
  170.     [77]6. OTHER COMMAND PARSING IMPROVEMENTS
  171.          [78]6.1. Grouping Macro Arguments
  172.          [79]6.2. Directory and File Name Completion
  173.          [80]6.3. Passing Arguments to Command Files
  174.          [81]6.4. More-Prompting
  175.     [82]7. NEW COMMANDS AND SWITCHES
  176.     [83]8. SCRIPTING IMPROVEMENTS
  177.          [84]8.1. Performance and Debugging
  178.          [85]8.2. Using Macros as Numeric Variables
  179.          [86]8.3. New IF Conditions
  180.          [87]8.4. The ON_UNKNOWN_COMMAND Macro
  181.          [88]8.5. The SHOW MACRO Command
  182.          [89]8.6. Arrays
  183.          [90]8.7. New or Improved Built-in Variables and Functions
  184.          [91]8.8. The RETURN and END Commands
  185.          [92]8.9. UNDEFINing Groups of Variables
  186.          [93]8.10. The MINPUT Command
  187.          [94]8.11. Learned Scripts
  188.          [95]8.12. Pattern Matching
  189.          [96]8.13. Dates and Times
  190.          [97]8.14. Trapping Keyboard Interruption
  191.     [98]9. S-EXPRESSIONS
  192.          [99]9.1. What is an S-Expression?
  193.          [100]9.2. Integer and Floating-Point-Arithmetic
  194.          [101]9.3. How to Use S-Expressions
  195.          [102]9.4. Summary of Built-in Constants and Operators
  196.          [103]9.5. Variables
  197.          [104]9.6. Assignments and Scope
  198.          [105]9.7. Conditional Expressions
  199.          [106]9.8. Extensibility
  200.          [107]9.9. Examples
  201.          [108]9.10. Differences from Algebraic Notation
  202.          [109]9.11.Differences from Lisp
  203.     [110]10. FILE TRANSFER
  204.     [111]11. MODEMS AND DIALING
  205.     [112]12. TERMINAL CONNECTION
  206.     [113]13. CHARACTER SETS
  207.     [114]14. DIALOUT FROM TELNET TERMINAL SERVERS
  208.     [115]15. COPING WITH BROKEN KERMIT PARTNERS
  209.     [116]16. NEW COMMAND-LINE OPTIONS
  210.     [117]17. LOGS
  211.    
  212.    [ [118]Top ] [ [119]C-Kermit Home ] [ [120]Kermit Home ]
  213.   __________________________________________________________________________
  214.  
  215. 0. WHAT'S NEW
  216.  
  217.    The Initialization File
  218.           C-Kermit 8.0 now supports specification of the initialization
  219.           file name (path) in an environment variable, CKERMIT_INI. It
  220.           also relies far less than before on the initialization for
  221.           functioning. See [121]Section 5 of the Unix C-Kermit
  222.           [122]installation instructions for details.
  223.           
  224.    Incompatible Changes
  225.           As always, we do our best to avoid changes that break existing
  226.           scripts. However, C-Kermit 8.0 does include a rather pervasive
  227.           syntax change that might alter the behavior of scripts that
  228.           depend on the previous behavior. As described in [123]Section
  229.           5, C-Kermit now accepts doublequotes in most contexts where you
  230.           previously had to use braces to group multiple words into a
  231.           single field, or to force inclusion of leading or trailing
  232.           blanks. Most noticeably, in C-Kermit 7.0 and earlier:
  233.           
  234.   echo {this is a string}
  235.  
  236.           would print:
  237.           
  238.   this is a string
  239.  
  240.           whereas:
  241.           
  242.   echo "this is a string"
  243.  
  244.           printed:
  245.           
  246.   "this is a string"
  247.  
  248.           In C-Kermit 8.0, both print:
  249.           
  250.   this is a string
  251.  
  252.           To force the doublequotes to be treated as part of the string,
  253.           use either of the following forms:
  254.           
  255.   echo {"this is a string"}
  256.   echo ""this is a string""
  257.  
  258.           Similarly, to force braces to be treated as part of the string:
  259.           
  260.   echo "{this is a string}"
  261.   echo {{this is a string}}
  262.  
  263.           Other incompatibilities:
  264.           
  265.          1. Using the SET HOST command to make HTTP connections is no
  266.             longer supported. Instead, use the new HTTP OPEN command,
  267.             described in [124]Section 2.2.
  268.             
  269.    C-Kermit 7.1 Alpha.01 (8 December 2000)
  270.           
  271.      Its major new features are those listed in the [125]Table of
  272.           Contents: the FTP client, file scanning, command parsing and
  273.           scripting improvements, S-Expressions, and support for the
  274.           Telnet Com Port Option, plus wider availability of the
  275.           Kerberos, SSL/TLS, and SRP security options for secure Internet
  276.           connections.
  277.           
  278.    C-Kermit 7.1.199 Alpha.02 (4 January 2001)
  279.           
  280.      C-Kermit now accepts [126]FTP, TELNET, and IKSD URLs as its first
  281.           command-line argument.
  282.           
  283.      Character-set translation added to the FTP client for
  284.           [127]filenames. 
  285.           
  286.      Optional [128]setting of date of incoming files by FTP [M]GET from
  287.           the server date.
  288.           
  289.      [129]FTP CHECK filename added to let FTP client check the existence
  290.           of a file on the server.
  291.           
  292.      [130]FTP GET /NAMELIST:filename added to get list of server
  293.           filenames into a local file.
  294.           
  295.      [131]FTP [M]PUT /SERVER-RENAME:template added to make server rename
  296.           a file as indicated by the template after it has arrived
  297.           completely.
  298.           
  299.      FTP [M]GET /SERVER-RENAME:template added to make server rename a
  300.           file as indicated by the template after it has been sent
  301.           completely.
  302.           
  303.      FTP [132]VDIRECTORY added for getting verbose directory listings
  304.           from TOPS-20.
  305.           
  306.      [133]FTP TYPE TENEX added for transferring 8-bit binary files with
  307.           PDP-10s.
  308.           
  309.      Added [134]automatic text/binary mode switching for FTP [M]GET,
  310.           based on filename patterns (e.g. *.zip, *.gz, *.exe are binary;
  311.           *.txt, *.c are text).
  312.           
  313.      [135]SET SEND I-PACKETS OFF added for coping with Kermit servers
  314.           that do not support I packets.
  315.           
  316.      A new option was added to [136]\fword() and \fsplit() for parsing
  317.           comma-separated lists that might contain empty elements.
  318.           
  319.      Bug fixes including:
  320.           
  321.           + {} or "" could not be used as expected to represent the empty
  322.             string.
  323.           + ,- on a line by itself in a macro definition caused
  324.             subsequent statements to be skipped.
  325.           + FTP [M]GET didn't work right if path segments were included
  326.             in the filespec.
  327.           + FTP MGET, if interrupted, did not clear its file list.
  328.           + Various problems with FTP PUT /AS-NAME that nobody noticed.
  329.           + Some FTP messages and displays interfered with each other.
  330.           + Parsing of YESTERDAY, TODAY, and TOMORROW in date-time fields
  331.             was broken.
  332.           + Automatic old-to-new dialing directory format conversion was
  333.             broken on VMS.
  334.           + Various source-code portability problems fixed.
  335.             
  336.      Improvement of various HELP and SHOW messages.
  337.           
  338.    C-Kermit 7.1.199 Alpha.04 (1 April 2001)
  339.           
  340.      Big changes:
  341.           
  342.           + Changed default modem type from NONE to GENERIC.
  343.           + Generic dialing now sends no init string at all.
  344.           + Changed default terminal bytesize from 7 to 8.
  345.             
  346.      New features:
  347.           
  348.           + SET SESSION-LOG TIMESTAMPED-TEXT for timestamped session log.
  349.             
  350.      New modem types:
  351.           
  352.           + Conexant modem family
  353.           + Lucent VENUS chipset
  354.           + PCTel V.90 chipset
  355.           + Zoom V.90
  356.           + Zoom V.92
  357.             
  358.      FTP client:
  359.           
  360.           + FTP OPEN /PASSIVE and /ACTIVE switches added.
  361.           + Now works with servers that that don't include path in NLST
  362.             response.
  363.           + Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
  364.           + SET FTP VERBOSE-MODE default is now OFF instead of ON.
  365.             
  366.      Kermit protocol:
  367.           
  368.           + Fixed what I hope is the last "Receive window full" error.
  369.           + SET PREFIXING or SET CONTROL PREFIX now automatically sets
  370.             CLEARCHANNEL OFF.
  371.           + Fixed incorrect report of number of files transferred at end
  372.             of transfer.
  373.           + Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
  374.             
  375.      UNIX:
  376.           
  377.           + HTTP and shadow passwords enabled for SCO 5.0.6.
  378.           + Even with SET FILENAMES CONVERTED, spaces were still accepted
  379.             in incoming filenames; now they are converted to underscores.
  380.           + Added support for compile-time mktemp()/mkstemp() selection.
  381.             
  382.      VMS:
  383.           
  384.           + Session-log format for scripted sessions fixed.
  385.             
  386.      Scripting:
  387.           
  388.           + Fixed \frdir() not to follow symlinks (UNIX).
  389.           + Fixed \fday() not to dump core for dates prior to 17 Mar
  390.             1858.
  391.             
  392.      General:
  393.           
  394.           + "Closing blah..." message upon exit could not be surpressed.
  395.           + Added /PAGE and /NOPAGE to DELETE switches.
  396.           + Added GO response for DELETE /ASK (delete all the rest
  397.             without asking).
  398.           + Added GO response to "more?" prompt (for multi-page screen
  399.             output).
  400.           + Updated HELP texts.
  401.             
  402.    C-Kermit 7.1.199 Beta.01 (10 May 2001)
  403.           
  404.      FTP client verbosity adjustments.
  405.           
  406.      Bug with generic modem dialing pausing several secs fixed.
  407.           
  408.      SET HOST /USER:, SET LOGIN USERID, etc, fixed when given no user ID.
  409.           
  410.      A couple \v(dm_blah) dial modifier variables added.
  411.           
  412.      "--version" command-line switch added.
  413.           
  414.      Fixed NetBSD serial-port DTR handling.
  415.           
  416.      Lots of syntax cleanups for Flexelint and gcc -Wall.
  417.           
  418.      Fixed modem-type aliases to not take precedence over real names.
  419.           
  420.      Fixed funny treatment of doublequotes by ECHO command.
  421.           
  422.      Enabled SET SESSION-LOG for VMS and other non-UNIX platorms.
  423.           
  424.      Fixed changing direction in command history buffer.
  425.           
  426.      Fixed handling of IKSD URLs.
  427.           
  428.      Made sure DELETE prints a message if it got any errors.
  429.           
  430.    C-Kermit 8.0.200 Beta.02 (28 June 2001)
  431.           
  432.      Major version number increased from 7 to 8.
  433.           
  434.      [137]SSH command.
  435.           
  436.      More-consistent Kermit protocol defaults.
  437.           
  438.      CONNECT idle timeout and action selection.
  439.           
  440.      CONNECT status variable.
  441.           
  442.      A way to allocate more space for filename lists.
  443.           
  444.      Pseudoterminal handler fixed for late-model Linuxes.
  445.           
  446.      Command-line option -dd for timestamped debug log.
  447.           
  448.      Download directory now works for external protocols too.
  449.           
  450.      GREP /COUNT:variable.
  451.           
  452.      SET ATTRIBUTE RECORD-FORMAT { OFF, ON }.
  453.           
  454.      Bug fixes.
  455.           
  456.    C-Kermit 8.0.200 Beta.03 (9 Sep 2001)
  457.           
  458.      [138]HTTP 1.1 connections and scripting
  459.           
  460.      [139]ON_CTRLC macro for trapping Ctrl-C in scripts
  461.           
  462.      [140]Date-time parsing improvements, timezones, comparison,
  463.           arithmetic
  464.           
  465.      [141]Pattern-matching improvements
  466.           
  467.      FTP improvements
  468.           
  469.      SET EXIT HANGUP { ON, OFF }
  470.           
  471.      SET FILE EOF { CTRL-Z, LENGTH }
  472.           
  473.      ASK[Q] /TIMEOUT
  474.           
  475.      Bug fixes
  476.           
  477.      New platforms
  478.           
  479.    C-Kermit 8.0.200 Beta.04 (16 Nov 2001)
  480.           
  481.      [142]New Unix man page
  482.           
  483.      [143]New Unix installation instructions
  484.           
  485.      SET TELOPT policies are now enforced on non-Telnet ports if the
  486.           server begins Telnet negotiations.
  487.           
  488.      SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }.
  489.           
  490.      UUCP lockfile creation race condition fixed.
  491.           
  492.      Dialout, modem signals, hangup, hardware flow control, etc, tested
  493.           extensively on many platforms, numerous problems fixed.
  494.           
  495.      Improved hints when dialing fails.
  496.           
  497.      SET STOP-BITS 2 can now be given without SET FLOW HARDWARE.
  498.           
  499.      Major improvements in RFC 2217 Telnet Com-Port Control.
  500.           
  501.      Improved ability to REDIAL a modem server port.
  502.           
  503.      kermit -h now shows the command name in the usage usage string.
  504.           
  505.      kermit -h now shows ALL command-line options.
  506.           
  507.      kermit -s blah, where blah is a symlink, now works.
  508.           
  509.      --noperms command-line option = SET ATTRIBUTE PERMISSIONS OFF.
  510.           
  511.      HTTP and HTTPS URLs now supported on the command line.
  512.           
  513.      An http command-line personality is now available.
  514.           
  515.      Initialization file streamlined to load faster, anachronisms
  516.           removed.
  517.           
  518.      Updated NEWS, INTRO, HELP text, SHOW commands. In particular, see
  519.           SHOW COMM, HELP SET LINE, HELP WAIT.
  520.           
  521.      Date/time arithmetic routines converted from floating-point to
  522.           integer arithmetic (internally) for greater accuracy and
  523.           portability.
  524.           
  525.      Quoted strings containing commas no longer break macro execution.
  526.           
  527.      Dynamic Kermit file-transfer timeouts are now much more aggressive.
  528.           
  529.      New "hot keys" to turn debug.log on/off during file transfer.
  530.           
  531.      Improved hints when file transfer fails.
  532.           
  533.      FTP CD orientation messages are now printed.
  534.           
  535.      -R now accepted on the FTP command line to request Recursion.
  536.           
  537.      -m allows Active or Passive mode to be chosen on the FTP command
  538.           line.
  539.           
  540.      -dd on the FTP command line creates a timestamped debug.log.
  541.           
  542.      FTP command-line security options filled in.
  543.           
  544.      Improved automatic text/binary mode switching for MGET.
  545.           
  546.      Removed spurious error messages that sometimes occur during MGET.
  547.           
  548.      DIRECTORY, GREP, TYPE, HEAD, and TAIL now have a /OUTPUT:file
  549.           option.
  550.           
  551.      TYPE /NUMBER adds line numbers.
  552.           
  553.      CAT = TYPE /NOPAGE; MORE = TYPE /PAGE.
  554.           
  555.      GETOK ?-help fixed.
  556.           
  557.      \v(timestamp) (= "\v(ndate) \v(time)")
  558.           
  559.      \v(hour) (hour of the day, 0-23)
  560.           
  561.      \funix2dospath() converts a UNIX path (/) to a DOS one (\).
  562.           
  563.      \fdos2unixpath() converts a DOS (Windows, OS/2) path to a UNIX one.
  564.           
  565.      \fkeywordval() parses name=value pair, allows macro keyword
  566.           parameters.
  567.           
  568.      We now make every attempt to not write passwords to the debug.log.
  569.           
  570.      New Certficate Authority certificates file, includes the Kermit
  571.           Project at Columbia University so you can access our IKSD
  572.           securely.
  573.           
  574.      Secure targets improved and better documented in Unix makefile.
  575.           
  576.      All Linux (libc and glibc) builds consolidated under "make linux".
  577.           
  578.      HP-UX makefile targets now have consistent names.
  579.           
  580.      New aix50 and aix51 targets added.
  581.           
  582.    C-Kermit 8.0.200 Final (12 Dec 2001)
  583.           
  584.      Remote/local-mode confusion on some platforms introduced in Beta.04,
  585.           fixed.
  586.           
  587.      Many of the makefile targets adjusted, new ones added.
  588.           
  589.      New "make install" target should please most people.
  590.           
  591.      New command: SHOW IKSD.
  592.           
  593.      FTP over TLS.
  594.           
  595.      Last-minute touchups to text messages, HELP text, etc.
  596.           
  597.      Enable modem-signal reading for SCO OSR5 and Unixware 7.
  598.           
  599.      Special superfast TRANSMIT /BINARY /NOECHO /NOWAIT mode added.
  600.           
  601.      Fixed PBX dialing in unmarked-area-code case.
  602.           
  603.      Improved SHOW COMMUNICATIONS tells lockfile directory, typical
  604.           dialout device name.
  605.           
  606.      Some FTP OPEN command parsing problems fixed.
  607.           
  608.      Some errors in date arithmetic fixed.
  609.           
  610.      New command: SET TERMINAL AUTODOWNLOAD { ..., ERROR { STOP, CONTINUE
  611.           } }
  612.           
  613.      New command: HELP FIREWALL.
  614.           
  615.      SET MODEM HANGUP-METHOD DTR added as synomym for RS232-SIGNAL
  616.           
  617.      Support for secure URL protocols added: telnets:, ftps:, https:.
  618.           
  619.    [ [144]Top ] [ [145]Contents ] [ [146]C-Kermit Home ] [ [147]Kermit
  620.    Home ]
  621.   __________________________________________________________________________
  622.  
  623. 1. FIXES SINCE VERSION 7.0.196 First, the changes from 7.0.196 to 7.0.197...
  624. Source and makefile tweaks to get successful builds on platforms that were not
  625. available in time for the 7.0 release:
  626.  
  627.      * 4.2BSD
  628.      * 4.3BSD
  629.      * AIX 4.3
  630.      * AT&T 3B2 and 3B20
  631.      * BeOS 4.5
  632.      * CLIX
  633.      * Interactive UNIX System V/386 R3.2 V4.1.1
  634.      * OS-9/68000
  635.      * OSF/1 1.3.
  636.      * PS/2 AIX 1.2.1
  637.      * SCO OSR5.0.x
  638.      * SCO Xenix 2.3.4
  639.      * SINIX 5.41/Intel
  640.      * Stratus FTX
  641.      * Stratus VOS
  642.      * SunOS 4.1 with X.25
  643.      * Ultrix 4.2
  644.      * Unixware 2.0
  645.        
  646.    There were no functional changes from 196 to 197.
  647.    
  648.    Fixes applied after C-Kermit 7.0.197 was released:
  649.    
  650.    Source code: Big flexelint and "gcc -Wall" audit and cleanup.
  651.    
  652.    Configuration:
  653.      * Solaris RTS/CTS (hardware flow control) didn't work.
  654.      * BSDI RTS/CTS worked only in one direction.
  655.      * FreeBSD 4.0 with ncurses 5.0 broke interactive command parsing.
  656.      * QNX-32 build lacked -DBIGBUFOK so couldn't execute big macros.
  657.        
  658.    Connections:
  659.      * SET HOST /PTY didn't work on some platforms.
  660.      * Broken SET HOST /USER:xxx /PASSWORD:yyy /ACCOUNT:zzz switches
  661.        fixed.
  662.      * Transparent printing was broken in Unix.
  663.      * ANSWER 0 (wait forever) didn't work.
  664.      * Some problems in Multitech modem command strings.
  665.      * Spurious "?Sorry, can't condition console terminal" errors.
  666.      * Disabling modem command strings by setting them to nothing broke
  667.        dialing.
  668.      * SET DIAL TIMEOUT value was usually ignored.
  669.      * SET DIAL METHOD PULSE didn't work.
  670.      * Certain modem commands, if changed, not refreshed if modem type
  671.        changed.
  672.      * SET SESSION-LOG command was missing from VMS.
  673.      * VMS session log format fixed for scripts.
  674.      * HANGUP by dropping DTR didn't work in NetBSD.
  675.      * SET FLOW /AUTO versus SET FLOW confusion fixed.
  676.      * Spurious secondary Solaris lockfile removed.
  677.      * SCO OSR5 DTR On/Off hangup.
  678.      * UUCP lockfile race condition.
  679.        
  680.    Commands and scripts:
  681.      * Missing CAUTIOUS and FAST commands restored.
  682.      * Broken PTY command in late-model Linuxes fixed (API changed).
  683.      * Fixed off-by-one error in command recall when switching direction.
  684.      * Fixed recall of commands that contain '?'.
  685.      * COPY /SWAP-BYTES didn't work on some architectures.
  686.      * Various combinations of COPY switches didn't work.
  687.      * Various problems with COPY or RENAME with a directory name as
  688.        target.
  689.      * SHIFT didn't decrement \v(argc) if used within IF, ELSE, or SWITCH
  690.        block.
  691.      * SHIFT didn't affect the \%* variable.
  692.      * Divide by zero improperly handled in some \function()s.
  693.      * Problems with RETURN from right-recursive functions.
  694.      * FSEEK /LINE \%c LAST didn't work if already at end.
  695.      * Some buffer vulnerabilities and potential memory leaks were
  696.        discovered and fixed.
  697.      * \frdirectory() fixed not to follow symbolic links.
  698.      * SET EXIT WARNING OFF fixed to work when EXIT given in a script.
  699.      * Missing DELETE and MKDIR error message fixed.
  700.      * \fday() core dump for ancient dates fixed.
  701.        
  702.    File transfer:
  703.      * SEND /COMMAND was broken.
  704.      * CRECEIVE was broken (but RECEIVE /COMMAND was OK).
  705.      * Quoting wildcard chars in filenames didn't work.
  706.      * Problems canceling streaming file transfers with X or Z.
  707.      * Problems shifting between streaming and windowing file transfer.
  708.      * Non-FULL file-transfer displays erroneously said STREAMING when
  709.        not.
  710.      * An active SEND-LIST prevented GET from working.
  711.      * SET SERVER GET-PATH interpretation of relative names like "." was
  712.        wrong.
  713.      * The MAIL command was broken.
  714.      * "kermit -s *" might have skipped some files.
  715.      * Transaction log entries were not made for external protocol
  716.        transfers.
  717.      * File count report fixed to show number of files actually
  718.        transferred.
  719.      * Fixed filename conversion to convert spaces to underscores.
  720.      * Made SET PREFIXING / SET CONTROL PREFIX also adjust CLEARCHANNEL.
  721.      * More "Receive window full" errors fixed.
  722.      * Broken terminal buffering after curses display in Solaris fixed.
  723.      * SET FILE INCOMPLETE DISCARD did not work in all cases.
  724.      * Packet log changed to reformat the start-of-packet character
  725.        printably.
  726.      * Dynamic timeouts could grow ridiculously large.
  727.        
  728.    Character sets:
  729.      * Hebrew-7 translations missed the letter Tav.
  730.      * C1 area of CP1252 was ignored.
  731.      * SET TRANSFER CHARACTER-SET TRANSPARENT could give garbage
  732.        translations.
  733.      * TRANSLATE might not work on Little Endian architectures.
  734.      * Insufficient range checking in certain TRANSLATE operations.
  735.        
  736.    [ [148]Top ] [ [149]Contents ] [ [150]C-Kermit Home ] [ [151]Kermit
  737.    Home ]
  738.   __________________________________________________________________________
  739.  
  740. 2. SSH AND HTTP
  741.  
  742.   2.1. SSH Connections
  743.   
  744.    On most UNIX platforms, C-Kermit can make SSH (Secure SHell)
  745.    connection by running the external SSH command or program through its
  746.    pseudoterminal interface. The command is:
  747.    
  748.    SSH text
  749.           Tells Kermit to start the external SSH client, passing the
  750.           given text to it on the command line. Normally the text is just
  751.           the hostname, but it can be anything else that is acceptable to
  752.           the ssh client. If the command succeeds, the connection is made
  753.           and Kermit automatically enters CONNECT (terminal) mode. You
  754.           can use the SSH command to make a connection to any host that
  755.           has an SSH server.
  756.           
  757.    Kermit's SSH command gives you all the features of Kermit on an SSH
  758.    connection: command language, file transfer, character-set
  759.    translation, scripting, and all the rest. By default, C-Kermit invokes
  760.    SSH with "-e none", which disables the ssh escape character and makes
  761.    the connection transparent for purposes of file transfer. You can,
  762.    however, change the SSH invocation to whatever else you might need (an
  763.    explicit path, additional command-line arguments, etc) with:
  764.    
  765.    SET SSH COMMAND text
  766.           Specifies the system command that Kermit's SSH command should
  767.           use to invoke the external SSH client. Use this command to
  768.           supply a specific path or alternative name, or to include
  769.           different or more command-line options.
  770.           
  771.    In most cases, these connections work quite well. They can be scripted
  772.    like any other connection, and file transfer goes as fast as, or
  773.    faster than, on a regular Telnet connection. In some cases, however,
  774.    the underlying pseudoterminal driver is a limiting factor, resulting
  775.    in slow or failed file transfers. Sometimes you can work around such
  776.    problems by reducing the Kermit packet length. Note that Kermit does
  777.    not consider SSH connections to be reliable, so it does not offer to
  778.    use streaming in Kermit protocol transfers (but you can force it with
  779.    SET RELIABLE or SET STREAMING if you wish).
  780.    
  781.    The SSH command is like the TELNET command: it enters CONNECT mode
  782.    automatically when the connection is made. Therefore, to script an SSH
  783.    connection, use:
  784.    
  785.   set host /pty ssh -e none [ other-options ] host
  786.   if fail ...
  787.  
  788.    to make the connection.
  789.    
  790.    Here's a sequence that can be used to make a connection to a given
  791.    host using Telnet if the host accepts it, otherwise SSH:
  792.    
  793.   if not defined \%1 exit 1 Usage: \%0 host
  794.   set quiet on
  795.   set host \%1 23 /telnet
  796.   if fail {
  797.       set host /pty ssh -l \m(user) -e none \%1
  798.       if fail exit 1 \%1: Telnet and SSH both fail
  799.       echo SSH connection to \%1 successful
  800.   } else {
  801.       echo Telnet connection to \%1 successful
  802.   }
  803.      _________________________________________________________________
  804.    
  805.   2.2. HTTP Connections
  806.   
  807.    Hypertext Transfer Protocol, or HTTP, is the application protocol of
  808.    the World Wide Web (WWW), used between Web browsers (clients) and Web
  809.    servers. It allows a client to get files from websites, upload files
  810.    to websites, delete files from websites, get information about website
  811.    directories and files, and interact with server-side CGI scripts.
  812.    C-Kermit includes an HTTP client capable of both clear-text and secure
  813.    HTTP connections, that can do all these tasks and can be automated
  814.    through the Kermit scripting language.
  815.    
  816.    Although C-Kermit 7.0 could make HTTP connections to Web servers, it
  817.    could do so only when no other connection was open, and the procedure
  818.    was somewhat awkward. C-Kermit 8.0 improves matters by:
  819.    
  820.      * Allowing an HTTP connection to be open at the same time as a
  821.        regular SET LINE or SET HOST connection, and also at the same time
  822.        as an FTP connection ([152]Section 3);
  823.      * Upgrading the HTTP protocol level from 1.0 to 1.1, thus allowing
  824.        for persistent connections, in which a series of commands can be
  825.        sent on the same connection, rather than only one as in HTTP 1.0
  826.        (and C-Kermit 7.0);
  827.      * Providing for "one-shot" URL-driven HTTP operations such as GET or
  828.        PUT.
  829.      * Providing a distinct HTTP command-line personality.
  830.        
  831.    Persistent HTTP connections are managed with the following commands:
  832.    
  833.    HTTP [ switches ] OPEN [ security-options ] host-or-url [ port ] 
  834.           Opens a persistent connection to the specified host (IP host
  835.           name or address) on the specified port. If any switches
  836.           (options, listed in the next section) are included, their
  837.           values are saved and used for all subsequent HTTP action
  838.           commands on the same connection. If no port is specified, HTTP
  839.           (80) is used. A Uniform Resource Locator (URL, [153]RFC 1738)
  840.           can be given instead of a hostname (or address) and port (but
  841.           the URL can not include a directory/file path). The security
  842.           options are explained [154]below. The HTTP OPEN command
  843.           replaces the C-Kermit 7.0 SET HOST hostname HTTP command, which
  844.           no longer works with HTTP GET and related commands.
  845.           
  846.    HTTP CLOSE
  847.           Closes any open HTTP connection and clears any saved switch
  848.           values.
  849.           
  850.    A URL starts with a protocol name, which must be http or https in this
  851.    case; optionally includes a username and password; and must contain a
  852.    host name or address:
  853.    
  854.   protocol://[user[.password]]@host[:port][URI]
  855.  
  856.    HTTP is Hypertext Transfer Protocol. HTTPS is the secure (SSL/TLS)
  857.    version of HTTP. The TCP service port is derived from the protocol
  858.    prefix (so normally the ":port" field is omitted). Thus the URL
  859.    protocol name specifies a default TCP service port and the URL user
  860.    and password fields can take the place of the /USER and /PASSWORD
  861.    switches ([155]Section 2.2.1). The optional URI is a "compact string
  862.    of characters for identifying an abstract or physical resource"
  863.    ([156]RFC 2396), such as a file. It must begin with a slash (/); if
  864.    the URI is omitted, "/" is supplied. Examples:
  865.    
  866.    http open http://www.columbia.edu/
  867.           Equivalent to http open www.columbia.edu or http open
  868.           www.columbia.edu http.
  869.           
  870.    http open https://olga.secret@www1.xyzcorp.com/
  871.           Equivalent to http /user:olga /pass:secret open
  872.           www1.xyzcorp.com https.
  873.           
  874.    Persistence is accomplished unilaterally by C-Kermit 8.0. An HTTP 1.0
  875.    server closes the connection after each action. Although HTTP 1.1
  876.    allows multiple actions on the same connection, an HTTP 1.1 server
  877.    tends to close the connection if it is idle for more than a few
  878.    seconds, to defend itself against denial-of-service attacks. But when
  879.    you use Kermit's HTTP OPEN command to create a connection, Kermit
  880.    reopens it automatically (if necessary) for each HTTP action until you
  881.    close it with HTTP CLOSE, regardless of the server's HTTP protocol
  882.    version, or how many times it closes the connection.
  883.    
  884.    Firewalls can be negotiated through proxies with the following
  885.    commands:
  886.    
  887.    SET TCP HTTP-PROXY [ host[:port] ]
  888.           If a host (by hostname or IP address) is specified, Kermit uses
  889.           it as a proxy server when attempting outgoing TCP connections
  890.           -- not only HTTP connections, but all TCP/IP connections,
  891.           Telnet and FTP included. This allows Kermit to adapt to the
  892.           HTTP firewall penetration method (as opposed to other methods
  893.           such as SOCKS4). If no hostname or ip-address is specified, any
  894.           previously specified Proxy server is removed. If no port number
  895.           is specified, the "http" service is used. This command must be
  896.           given before the HTTP OPEN command if a proxy is to be used or
  897.           canceled.
  898.           
  899.    HTTP [ switches ] CONNECT host[:port]
  900.           Instructs the HTTP server to act as a proxy, establishing a
  901.           connection to the specified host (IP hostname or address) on
  902.           the given port (80 = HTTP by default) and to redirect all data
  903.           transmitted between Kermit and itself to the given host for the
  904.           life of the connection. This command is to be used only for
  905.           debugging HTTP proxy connections. If a proxy connection is
  906.           required, instruct Kermit to use the proxy with the SET TCP
  907.           HTTP-PROXY command.
  908.           
  909.     2.2.1. HTTP Command Switches
  910.     
  911.    HTTP switches, like all other switches, are optional. When HTTP
  912.    switches are included with the HTTP OPEN command, they apply
  913.    automatically to this and all subsequent HTTP actions (GET, PUT, ...)
  914.    on the same connection until an HTTP CLOSE command is given. So if you
  915.    include switches (or the equivalent URL fields, such as user and
  916.    password) in the HTTP OPEN command, you can omit them from subsequent
  917.    commands on the same connection. If the connection has closed since
  918.    your last command, it is automatically reopened with the same options.
  919.    
  920.    If you include switches with an HTTP action command (such as GET or
  921.    PUT), they apply only to that command.
  922.    
  923.    /USER:name
  924.           To be used in case a page requires a username for access. The
  925.           username is sent with page requests. If it is given with the
  926.           OPEN command it is saved until needed. If a username is
  927.           included in a URL, it overrides the username given in the
  928.           switch. CAUTION: Username and password (and all other
  929.           information, including credit card numbers and other material
  930.           that you might prefer to protect from public view) are sent
  931.           across the network in clear text on regular HTTP connections,
  932.           but authentication is performed securely on HTTPS connections.
  933.           
  934.    /PASSWORD:text
  935.           To be used in case a web page requires a password for access.
  936.           The password is sent with page requests. If it is given with
  937.           the OPEN command it is saved until needed. If a password is
  938.           given in a URL, it overrides the one given here. CAUTION: (same
  939.           as for /USER:).
  940.           
  941.    /AGENT:user-agent
  942.           Identifies the client to the server. Overrides the default
  943.           agent string, which is "C-Kermit" (for C-Kermit) or "Kermit-95"
  944.           (for Kermit 95).
  945.           
  946.    /ARRAY:array-designator
  947.           Tells Kermit to store the response headers in the given array,
  948.           one line per element. The array need not be declared in
  949.           advance. Example: /array:&a.
  950.           
  951.    /TOSCREEN
  952.           Tells Kermit to display any response text on the screen. It
  953.           applies independently of the output file specification; thus it
  954.           is possible to have the server response go to the screen, a
  955.           file, both, or neither.
  956.           
  957.    /HEADER:header-item(s)
  958.           Used for specifying any optional headers to be sent with HTTP
  959.           requests.
  960.           
  961.   /HEADER:tag:value
  962.  
  963.           To send more than one header, use braces for grouping:
  964.           
  965.   /HEADER:{{tag:value}{tag:value}...}
  966.  
  967.           For a list of valid tags and value formats see [157]RFC 2616,
  968.           "Hypertext Transfer Protocol -- HTTP/1.1". A maximum of eight
  969.           headers may be specified.
  970.           
  971.     2.2.2. HTTP Action Commands
  972.     
  973.    HTTP actions can occur within a persistent connection, or they can be
  974.    self-contained ("connectionless"). A persistent HTTP connection begins
  975.    with an HTTP OPEN command, followed by zero or more HTTP action
  976.    commands, and is terminated with an HTTP CLOSE command:
  977.    
  978.   http open www.columbia.edu
  979.   if failure stop 1 HTTP OPEN failed: \v(http_message)
  980.   http get kermit/index.html
  981.   if failure stop 1 HTTP GET failed: \v(http_message)
  982.   (more actions possible here...)
  983.   http close
  984.  
  985.    A self-contained HTTP action occurs when a URL is given instead of a
  986.    remote file name to an HTTP action command. In this case, Kermit makes
  987.    the HTTP connection, takes the action, and then closes the connection.
  988.    If an HTTP connection was already open, it is closed silently and
  989.    automatically.
  990.    
  991.   http get http://www.columbia.edu/kermit/index.html
  992.  
  993.    Kermit's HTTP action commands are as follows. Switches may be included
  994.    with any of these to override switch (or default) values given in the
  995.    HTTP OPEN command.
  996.    
  997.    HTTP [ switches ] GET remote-filename [ local-filename ]
  998.           Retrieves the named file from the server specified in the most
  999.           recent HTTP OPEN command for which a corresponding HTTP CLOSE
  1000.           command has not been given. The filename may not include
  1001.           wildcards (HTTP protocol does not support them). If no HTTP
  1002.           OPEN command is in effect, this form of the HTTP GET command
  1003.           fails. The default local filename is the same as the remote
  1004.           name, but with any pathname stripped. For example, the command
  1005.           http get kermit/index.html stores the file in the current local
  1006.           directory as index.html. If the /HEADERS: switch is included,
  1007.           information about the file is also stored in the specified
  1008.           array (explained in [158]Section 2.2.3). All files are
  1009.           transferred in binary mode. HTTP does not provide for
  1010.           record-format or character-set conversion.
  1011.           
  1012.    HTTP [ switches ] GET url [ local-filename ]
  1013.           When HTTP GET is given a URL rather than a filename, Kermit
  1014.           opens a connection to the designated server (closing any
  1015.           previously open HTTP connection), gets the file, and then
  1016.           closes the connection. If the URL does not include a filename,
  1017.           index.html is supplied. This is the self-contained one-step
  1018.           "connectionless" method for getting a file from a Web server.
  1019.           The data is not interpreted; HTTP GET is like "lynx -source"
  1020.           rather than "lynx -dump".
  1021.           
  1022.    In the remaining HTTP action commands, the distinction between a
  1023.    remote filename and a URL are the same as in the HTTP GET command.
  1024.    
  1025.    HTTP [ switches ] HEAD remote-filename-or-url [ local-filename ]
  1026.           Like GET except without actually getting the file; instead it
  1027.           retrieves only the headers. If the /ARRAY: or /TOSCREEN switch
  1028.           is included, there is no default local output filename but you
  1029.           can still specify one. If neither of these switches is
  1030.           included, the default local filename is the same as the remote
  1031.           filename, but with any path stripped and with ".head" appended.
  1032.           The HEAD command can be used in a script with the /ARRAY:
  1033.           switch to retrieve information about the requested resource to
  1034.           determine whether the resource should actually be retrieved
  1035.           with a subsequent GET request.
  1036.           
  1037.    HTTP [ switches ] INDEX remote-directory-or-url [ local-filename ]
  1038.           Asks the server to send a listing of the files in the given
  1039.           server directory. This command is not supported by most Web
  1040.           servers. Even when it is supported, there is no standard format
  1041.           for the listing.
  1042.           
  1043.    HTTP [ switches ] POST [ /MIME-TYPE:type ] source-file
  1044.           remote-path-or-url [ result-file ]
  1045.           Sends data to a process running on the remote host; the result
  1046.           is usually an HTML file but could be anything. The data to be
  1047.           posted must be read from a local file (the source-file). If a
  1048.           result file is specified, Kermit stores the server's response
  1049.           in it.
  1050.           
  1051.    HTTP [ switches ] PUT [ MIME-TYPE:type ] local-file [
  1052.           remote-file-or-url [ result-file ] ]
  1053.           Uploads a local file to the server. Only the name of a single
  1054.           file can be given; wildcards (and group transfers) are not
  1055.           supported by HTTP protocol. If no remote filename is given, the
  1056.           file is sent with the same name as the local file, but with any
  1057.           pathname stripped.
  1058.           
  1059.    HTTP [ switches ] DELETE remote-file-or-url [ local-result-file ]
  1060.           Asks the server to delete the specified single file. If a
  1061.           result file is specified, it will contain any response data
  1062.           returned by the server.
  1063.           
  1064.    Note the limitations of HTTP protocol compared to (say) FTP or Kermit.
  1065.    There is no command for changing directories, no standard way to get
  1066.    file or directory lists, no way to transfer file groups by using
  1067.    wildcard notation, etc, and therefore no good way to (say) fetch all
  1068.    pages, descend through subdirectories, perform automatic updates, etc.
  1069.    There is no assurrance a connection will stay open and, as noted,
  1070.    there is no provision for data conversion between unlike platforms.
  1071.    The data's MIME headers can be used for postprocessing.
  1072.    
  1073.     2.2.3. HTTP Headers
  1074.     
  1075.    Each HTTP request and response contains a set of name/value pairs
  1076.    called headers. HTTP headers are specified in [159]RFC 2616. For
  1077.    example, an HTTP GET request for /index.html on www.columbia.edu
  1078.    contains the following headers:
  1079.    
  1080.   GET /index.html HTTP/1.1
  1081.   Host: www.columbia.edu:80
  1082.   User-agent: C-Kermit 8.0
  1083.   Authorization: Basic base64-encoded-username-password
  1084.  
  1085.    These might be followed by any others specified with a /HEADERS:
  1086.    switch:
  1087.    
  1088.   Accept: image/gif, image/x-xbitmap, image/jpeg, *.*
  1089.   Accept-Encoding: gzip
  1090.   Accept-Language: en
  1091.   Accept-Charset: iso-8859-1,utf-8
  1092.   Cookie: cookie-data
  1093.  
  1094.    The server sends back a short report about the file prior to sending
  1095.    the file contents. Example:
  1096.    
  1097.   HTTP/1.1 200 OK
  1098.   Date: Fri, 24 Aug 2001 21:09:39 GMT
  1099.   Server: Apache/1.3.4 (Unix)
  1100.   Last-Modified: Mon, 06 Aug 2001 21:16:13 GMT
  1101.   ETag: "1fa137-10d7-3b6f091d"
  1102.   Accept-Ranges: bytes
  1103.   Content-Length: 4311
  1104.   Content-Type: text/html
  1105.  
  1106.    If you want to have this information available to a Kermit script you
  1107.    can use the /ARRAY switch to have Kermit put it in array, one line per
  1108.    array element. Example:
  1109.    
  1110.   set exit warning off
  1111.   http open www.columbia.edu
  1112.   if fail exit 1 Can't reach server
  1113.   http /array:&a get /index.html
  1114.   if fail exit 1 Can't get file
  1115.   echo Header lines: \fdim(&a)
  1116.   for \%i 1 \fdim(&a) 1 {
  1117.       echo \%i. \&a[\%i]
  1118.   }
  1119.  
  1120.    Note that the "Date:" item is the current date and time; the
  1121.    "Last-Modifed:" item is the file's modification date and time. An
  1122.    example showing how to use this information is presented in
  1123.    [160]Section 8.13.7.
  1124.    
  1125.     2.2.4. Secure HTTP Connections
  1126.     
  1127.    SSL/TLS (Secure Sockets Layer / Transport Layer Security) is the
  1128.    protocol used to secure HTTP, SMTP, and other Internet applications.
  1129.    See the [161]C-Kermit Reference Section 5.4 for an introduction to
  1130.    SSL/TLS. To make a secure HTTP connection, you need:
  1131.    
  1132.     1. A secure client (a version of C-Kermit or Kermit 95 with SSL/TLS
  1133.        security built in). Type "check ssl" at the Kermit prompt to make
  1134.        sure you have it.
  1135.     2. A secure server to connect to.
  1136.     3. The CA Root Certificate used to authenticate the server to the
  1137.        client. (see [162]Section 15 of the security reference for an
  1138.        introduction to certificates).
  1139.        
  1140.    And you must make a connection to the secure HTTP port: service name
  1141.    HTTPS, port number 443 (as opposed to service HTTP, port 80). You can
  1142.    also make secure connections to other ports by including the /TLS or
  1143.    /SSL switch with the HTTP OPEN command, if the host supports SSL/TLS
  1144.    on the given port:
  1145.    
  1146.    The quality of the SSL/TLS connection depends on the cipher suite.
  1147.    There are several possibilities:
  1148.    
  1149.    Anonymous cipher suite:
  1150.           If an anonymous cipher suite is negotiated, the connection is
  1151.           encrypted but there is no authentication. This connection is
  1152.           subject to a Man-In-The-Middle (MITM) attack.
  1153.           
  1154.    X.509 certificate on the server:
  1155.           When you connect to certain secure servers, an X.509
  1156.           certificate is returned. This certificate is issued to a
  1157.           special hostname, something like www1.xyzcorp.com or
  1158.           wwws.xyzcorp.com (rather than the normal www.xyzcorp.com). It
  1159.           is signed by the host's Certificate Authority (CA). If the host
  1160.           certificate is configured on the client, it can be used to
  1161.           verify the certificate received from the server. If the
  1162.           certificate it verified as authentic, a check is made to ensure
  1163.           it has not expired and it was issued to the host you were
  1164.           attempting to connect to. If you had asked to connect to (say)
  1165.           www.xyzcorp.com but were given a certificate for
  1166.           www1.xyzcorp.com, you would be prompted for permission to
  1167.           continue.
  1168.           
  1169.           If the verification succeeded, the connection would be
  1170.           encrypted with one-way (server-to-client) authentication. This
  1171.           connection is not subject to a MITM attack.
  1172.           
  1173.           If a username and password are transmitted over this
  1174.           connection, they are not subject to interception. However, the
  1175.           standard risks associated with passing the password to the host
  1176.           for verification apply; for example, if the host has been
  1177.           compromised, the password will be compromised.
  1178.           
  1179.    X.509 client certificate:
  1180.           If a connection has been established with an X.509 server
  1181.           certificate, the server can ask the client to send a
  1182.           certificate of its own. This certificate must be verified
  1183.           against a CA Root certificate. The certificate itself (or
  1184.           subject info from the certificate) is used to determine the
  1185.           authorization for the client, and if successful, the username
  1186.           and password need not be sent to the server.
  1187.           
  1188.    Kerberos 5:
  1189.           Instead of using X.509 certifcates, Kerberos 5 can be used to
  1190.           perform the authentication and key exchange. In this situation,
  1191.           there is mutual authentication between the client and server.
  1192.           The Kerberos 5 principal is used by the server to look up the
  1193.           appropriate authorization data. There is no need to send
  1194.           username and password.
  1195.           
  1196.    An HTTP connection is made with the HTTP OPEN command:
  1197.    
  1198.    HTTP [ switches ] OPEN [ { /SSL, /TLS } ] host [ port ] 
  1199.           If /SSL or /TLS switches are included (these are synonyms), or
  1200.           if the service is HTTPS or the port is 443, a secure connection
  1201.           is attempted using the current authentication settings; see
  1202.           HELP SET AUTHENTICATION for details ([163]Section 6.2 of the
  1203.           security reference). If the no /SSL or /TLS switch is included
  1204.           but the port is 443 or the service is HTTPS, a secure
  1205.           connection is attempted. If an /SSL or /TLS switch is included
  1206.           but a port is not specified, an SSL/TLS connection is attempted
  1207.           on the default port (80).
  1208.           
  1209.    Certificates are covered in the separate [164]Kermit Security
  1210.    Reference for C-Kermit 8.0. You should let Kermit know to verify
  1211.    certificates with the SET AUTHENTICATION TLS command. For example:
  1212.    
  1213.    SET AUTHENTICATION TLS CRL-DIR directory
  1214.           Specifies a directory that contains certificate revocation
  1215.           files where each file is named by the hash of the certificate
  1216.           that has been revoked.
  1217.           
  1218.    SET AUTHENTICATION TLS CRL-FILE filename
  1219.           Specifies a file that contains a list of certificate
  1220.           revocations.
  1221.           
  1222.    SET AUTHENTICATION TLS VERIFY-DIR directory
  1223.           Specifies a directory that contains root CA certificate files
  1224.           used to verify the certificate chains presented by the peer.
  1225.           Each file is named by a hash of the certificate.
  1226.           
  1227.    SET AUTHENTICATION TLS VERIFY-FILE filename
  1228.           Specifies a file that contains root CA certificates to be used
  1229.           for verifying certificate chains.
  1230.           
  1231.    SET AUTHENTICATION TLS VERIFY OFF
  1232.           Tells Kermit not to require a certificate and accept any
  1233.           certificate that is presented regardless of whether it is
  1234.           valid.
  1235.           
  1236.    There are many other options; see the security document for details.
  1237.    
  1238.    Now suppose you need need to fetch the file denoted by the following
  1239.    URL:
  1240.    
  1241.   https://myuserid:mypassword@wwws.xyzcorp.com/clients/info/secret.html
  1242.  
  1243.    Once you have set up the handling of certificates as desired, you can
  1244.    use the following Kermit commands:
  1245.    
  1246.   http /user:myuserid /password:mypassword open www1.xyzcorp.com https
  1247.   if success {
  1248.       http get /clients/info/secret.html
  1249.       http close
  1250.   }
  1251.  
  1252.    As another example, let's say that you have a web form you need to
  1253.    populate with three fields: red,white and blue.
  1254.    
  1255.   <FORM ACTION="http://www.xyzcorp.com/cgi-bin/form.cgi" METHOD="POST">
  1256.   <INPUT NAME="Red">
  1257.   <INPUT NAME="White">
  1258.   <INPUT NAME="Blue">
  1259.   </FORM>
  1260.  
  1261.    You can handle this with the HTTP POST command. The data to be posted
  1262.    is stored in the local file data.txt.
  1263.    
  1264.   Red=seven stripes&White=six stripes&Blue=fifty stars
  1265.  
  1266.    and the response from the server will be stored into response.txt.
  1267.    
  1268.   http open www.xyzcorp.com http
  1269.   if success {
  1270.     http /array:c post data.txt /cgi-bin/form.cgi response.txt
  1271.     http close
  1272.   }
  1273.  
  1274.    In this scenario, the Common Gateway Interface (CGI) sends a response
  1275.    whether it succeeds or fails in a script-dependent manner. The script
  1276.    can either report success and enclose the response data; or it might
  1277.    send a 302 Found error which indicates that the "Location:" header
  1278.    should be used to determine the URL at which the data can be found.
  1279.    
  1280.     2.2.5. HTTP Variables
  1281.     
  1282.    \v(http_code)
  1283.           The HTTP protocol code number of the most recent server reply,
  1284.           e.g. 404 for "not found".
  1285.           
  1286.    \v(http_connected)
  1287.           1 when an HTTP connection is open, 0 when there is no HTTP
  1288.           connection.
  1289.           
  1290.    \v(http_host)
  1291.           If an HTTP connection is open, the hostname:port, e.g.
  1292.           www.columbia.edu:80; otherwise, empty.
  1293.           
  1294.    \v(http_message)
  1295.           Server error message, if any, from most recent HTTP command.
  1296.           
  1297.    \v(http_security)
  1298.           A list of the security parameters and values for the current
  1299.           connection, if any. Empty if the connection is not to a secure
  1300.           server, or there is no connection.
  1301.           
  1302.    To display all the HTTP variables at once, type SHOW VAR HTTP:
  1303.    
  1304.   C-Kermit> http open www.columbia.edu
  1305.   C-Kermit> http get lkjlkjlkjlkj 
  1306.   C-Kermit> sho var http
  1307.    \v(http_code) = 404
  1308.    \v(http_connected) = 1
  1309.    \v(http_host) = www.columbia.edu:80
  1310.    \v(http_message) = Not Found
  1311.    \v(http_security) = NULL
  1312.   C-Kermit>
  1313.  
  1314.     2.2.6. The HTTP Command-Line Personality
  1315.     
  1316.    If you invoke C-Kermit with the name "http" or "https", you can use a
  1317.    special set of HTTP-specific command-line options. You can do this by
  1318.    creating a symbolic linke "http" or "https" to the C-Kermit 8.0
  1319.    executable, or by having a separate copy of it called "http" or
  1320.    "https". Here's the usage message ("http -h"):
  1321.    
  1322.   Usage: ./http host [ options... ]
  1323.    -h             This message.
  1324.    -d             Debug to debug.log.
  1325.    -S             Stay (issue command prompt when done).
  1326.    -Y             Do not execute Kermit initialization file.
  1327.    -q             Quiet (suppress most messages).
  1328.    -u name        Username.
  1329.    -P password    Password.
  1330.    -g pathname    Get remote pathname.
  1331.    -p pathname    Put remote pathname.
  1332.    -H pathname    Head remote pathname.
  1333.    -l pathname    Local path for -g, -p, and -H.
  1334.    -z opt[=value] Security options...
  1335.       cert=file   Client certificate file
  1336.       certsok     Accept all certificates
  1337.       key=file    Client private key file
  1338.       secure      Use SSL
  1339.       verify=n    0 = none, 1 = peer , 2 = certificate required
  1340.  
  1341.    The "host" argument is the name of a Web host, e.g. www.columbia.edu.
  1342.    The action options are -p, -g, and -H. If you give an action option,
  1343.    Kermit does the action and then exits. If you give a host without an
  1344.    action option, Kermit makes an HTTP connection to the host and then
  1345.    gives you the C-Kermit prompt. Here's a simple example that fetches a
  1346.    publicly readable Web page:
  1347.    
  1348.   http www.columbia.edu -g kermit/index.html
  1349.  
  1350.    If you need to access a website for which a username and password are
  1351.    required, you can supply them on the command line with -u and -P. If
  1352.    you include a username but omit the password, Kermit prompts you for
  1353.    it:
  1354.    
  1355.   http www.columbia.edu -u olga -p kermit/index.html -l index.html
  1356.   Password:
  1357.  
  1358.    Note that when PUT'ing files to websites, you have to supply both the
  1359.    -p (remote pathname) and -l (local path) options.
  1360.    
  1361.    If your version of Kermit is built with SSL/TLS security, you can also
  1362.    use the -z option to make secure HTTP (https) connections.
  1363.    
  1364.    Finally, as noted in [165]Section 16, you can also give a URL instead
  1365.    of a host name and options.
  1366.    
  1367.    [ [166]Top ] [ [167]Contents ] [ [168]C-Kermit Home ] [ [169]Kermit
  1368.    Home ]
  1369.   __________________________________________________________________________
  1370.  
  1371. 3. THE BUILT-IN FTP CLIENT
  1372.  
  1373.    Earlier versions of C-Kermit and K95 included an FTP command, but it
  1374.    simply invoked an external FTP client. Now, by popular demand, Kermit
  1375.    includes its own built-in FTP client that offers the following
  1376.    advantages over traditional FTP clients (and its previous interface to
  1377.    them):
  1378.      * Any of Kermit's built-in [170]security methods can be used to
  1379.        establish and conduct secure FTP sessions with [171]FTP servers
  1380.        that support these methods. (Security modules can be subject to
  1381.        export restrictions.)
  1382.      * Kermit's FTP client uses "passive mode" by default to avoid
  1383.        blockage by firewalls and network address translators.
  1384.      * [172]Character sets can be translated as part of the transfer
  1385.        process even when the FTP server does not support character-set
  1386.        translation, including to/from the new Internet standard
  1387.        international character set, [173]Unicode UTF-8. This includes
  1388.        both the file's name and (for text files only) its contents.
  1389.      * All of C-Kermit's [174]file-selection mechanisms are available:
  1390.        size, date, name patterns and lists, exception lists, etc.
  1391.      * [175]Atomic file movement operations are provided (delete, move,
  1392.        or rename files automatically after successful transfer).
  1393.      * The correct file type, "ascii" (i.e. text) or binary, is chosen
  1394.        automatically for each file (explained in [176]Section 4), and any
  1395.        mixture of text and binary files can be sent in a single
  1396.        operation, even across platforms.
  1397.      * Update mode ("don't bother transferring files that didn't change
  1398.        since last time") and recovery (resumption of an interrupted
  1399.        transfer from the point of failure) are available in both
  1400.        directions.
  1401.      * When uploading files from UNIX to UNIX, the file's permissions can
  1402.        be preserved if desired.
  1403.      * Recursive directory-tree PUTs are supported between any two
  1404.        platforms that have tree-structured file systems. Recursive GETs
  1405.        are supported between like platforms if the server cooperates.
  1406.      * When receiving files, all of Kermit's file collision actions are
  1407.        available: backup, update, refuse, rename, etc.
  1408.      * Multi-file transfers can be interrupted on a per-file basis,
  1409.        automatically skipping to the next file.
  1410.      * FTP sessions are [177]fully scriptable.
  1411.      * An entire FTP session (connect, login, CD, upload or download,
  1412.        logout) can be specified on the command line without using a
  1413.        script.
  1414.      * All of Kermit's logging options and formats are available to keep
  1415.        an accurate and complete record of each connection and file
  1416.        transfer, and to aid in troubleshooting.
  1417.      * All of Kermit's file-transfer display options are available
  1418.        (fullscreen, brief, CRT, serial, none).
  1419.        
  1420.    And best of all:
  1421.      * Kermit doesn't give you those annoying per-file prompts every time
  1422.        you start a multi-file transfer without remembering to give a
  1423.        "prompt" command first :-).
  1424.        
  1425.    [ [178]Top ] [ [179]Contents ] [ [180]FTP Client Overview ] [ [181]FTP
  1426.    Script Tutorial ] [ [182]C-Kermit Home ] [ [183]Kermit Home ]
  1427.      _________________________________________________________________
  1428.    
  1429.   3.1. Making and Managing FTP Connections
  1430.   
  1431.    Each copy of Kermit can have one FTP connection open at a time. FTP
  1432.    connections are independent of regular terminal connections; a
  1433.    terminal connection (serial or network via SET LINE, DIAL, SET HOST,
  1434.    TELNET, etc) may be, but need not be, open at the same time as an FTP
  1435.    connection, and terminal connections can also be closed, and new
  1436.    connections opened, without interfering with the FTP connection (and
  1437.    vice versa). Thus, for example, Kermit can have an FTP connection and
  1438.    a TELNET connection open to the same host simultaneously, using the
  1439.    TELNET connection (e.g.) to send mail or take other desired actions as
  1440.    various FTP actions complete. Of course, each copy of Kermit can do
  1441.    only one thing at a time, so it can't (for example) transfer a file
  1442.    with FTP and another file with Kermit protocol simultaneously.
  1443.    
  1444.    A Kermit FTP session can be established by [184]command-line options,
  1445.    by [185]URL, or by [186]interactive commands.
  1446.    
  1447.     3.1.1. Kermit Command-Line Options for FTP
  1448.     
  1449.    The new command-line option '-9' (sorry, we're out of letters) can be
  1450.    used when starting C-Kermit, telling it to make an FTP connection:
  1451.    
  1452.   kermit -9 hostname
  1453.  
  1454.    or if a non-default FTP port is needed:
  1455.    
  1456.   kermit -9 hostname:port
  1457.  
  1458.    You can also specify the username on the command line with the -M ("My
  1459.    User ID") option that was already there for other connection types:
  1460.    
  1461.   kermit -9 hostname -M olga
  1462.  
  1463.    If you specify the username on the command line, Kermit uses it when
  1464.    making the connection and does not prompt you for it (but it does
  1465.    prompt you for the password if one is required).
  1466.    
  1467.    Once the connection is made, you get the regular Kermit prompt, and
  1468.    can give interactive commands such as the ones described below. When
  1469.    you give a BYE command, Kermit closes the session and exits, just as a
  1470.    regular FTP client would do. If you don't want Kermit to exit when you
  1471.    give a BYE command, include the -S ("Stay") option on the command
  1472.    line.
  1473.    
  1474.    Other Kermit command-line options that are not specific to non-FTP
  1475.    connections should affect the FTP session in the expected ways; for
  1476.    example, -i and -T force binary and text mode transfers, respectively.
  1477.    
  1478.    File transfers can not be initiated on the "kermit -9" command line;
  1479.    for that you need to use Kermit's FTP personality (next section) or
  1480.    you can use URLs ([187]Section 3.1.3).
  1481.      _________________________________________________________________
  1482.    
  1483.     3.1.2. The FTP Command-Line Personality
  1484.     
  1485.    If you want to replace your regular FTP client with C-Kermit, you can
  1486.    make a link called "ftp" to the C-Kermit binary (or you can store a
  1487.    copy of the C-Kermit binary under the name "ftp"). When C-Kermit is
  1488.    invoked with a program name of "ftp" (or "FTP", case doesn't matter),
  1489.    it assumes the command-line personality of the regular FTP client:
  1490.    
  1491.   ftp [ options ] hostname [ port ]
  1492.  
  1493.    In this case the options are like those of a regular FTP client:
  1494.    
  1495.   -d  Debug: enables debug messages and creates a debug.log file.
  1496.   -n  No autologin: Kermit should not send your user ID automatically.
  1497.   -t  Packet trace: accepted but is treated the same as -d.
  1498.   -v  Verbose: accepted but ignored (operation is verbose by default).
  1499.   -i  Not interactive: accepted but ignored.
  1500.  
  1501.    and the hostname can also be a URL (explained in [188]Section 3.1.3).
  1502.    To specify a non-default TCP port for the FTP server, include the port
  1503.    number or name after the hostname.
  1504.    
  1505.    There are also some bonus options that allow you to execute an entire
  1506.    FTP session from the shell command line, as long as you don't include
  1507.    the -n option. These are not available with regular FTP clients, and
  1508.    at least one of these options (-g) conflicts with UNIX ftp (where -g
  1509.    means "no globbing", which does not apply to Kermit), and some of them
  1510.    (like the options above) also conflict with regular Kermit
  1511.    command-line options:
  1512.    
  1513.   -m mode      = "passive" (default) or "active"
  1514.   -Y            Don't execute the Kermit initialization file [1]
  1515.   -q            Quiet, suppresses all but error messages [1]
  1516.   -S            Stay, don't exit automatically [1]
  1517.   -A            Autologin anonymously [2]
  1518.   -u name       Username for autologin [2] (synonym: -M [1])
  1519.   -P password   Password for autologin (see cautions below) [2]
  1520.   -D directory  cd after autologin [2]
  1521.   -b            Binary mode [2]
  1522.   -a            Text ("ascii") mode [2] (synonym: -T [1])
  1523.   -R            Recursive (works with -p) [4]
  1524.   -p files      Files to put (upload) after autologin [2] (synonym: -s [1])
  1525.   -g files      Files to get (download) after autologin [3]
  1526.  
  1527.    [1] Same as Kermit, not available in regular FTP clients.
  1528.    [2] Conflicts with Kermit, not available in regular FTP clients.
  1529.    [3] Same as Kermit, conflicts with regular FTP clients.
  1530.    [4] Conflicts with Kermit, available in some FTP clients.
  1531.    
  1532.    Fancier options such as restart, character-set translation, filename
  1533.    collision selection, automatic move/rename/delete, etc, are not
  1534.    available from the command line; for these you can use the commands
  1535.    described in the following sections. The -R might also work with -g
  1536.    (GET) but that depends on the server.
  1537.    
  1538.    The following security options are also available, explained in
  1539.    [189]Section 3.2:
  1540.    
  1541.   -k realm      Kerberos 4 realm [4]
  1542.   -f            Kerberos 5 credentials forwarding [4]
  1543.   -x            autoencryption mode [4]
  1544.   -c cipher     SRP cipher type [4]
  1545.   -H hash       SRP encryption hash [4]
  1546.   -z option     Security options [4]
  1547.  
  1548.    If you include -A or specify a name of "anonymous" or "ftp", you are
  1549.    logged in anonymously and, in the absence of -P, Kermit automatically
  1550.    supplies a password of "user@host", where "user" is your local user
  1551.    ID, and "host" is the hostname of the computer where Kermit is
  1552.    running. If you do not include -p or -g, Kermit enters command mode so
  1553.    you can type commands or execute them from a script.
  1554.    
  1555.    If you include -p or -g, Kermit attempts to transfer the specified
  1556.    files and then exits automatically at the end of the transfer unless
  1557.    you also included -S (Stay). It uses the "brief" file transfer display
  1558.    (one line per file) unless you include the -q option to suppress it.
  1559.    
  1560.    When uploading files with -p, Kermit switches automatically between
  1561.    text and binary mode for each file.
  1562.    
  1563.    When downloading, you can either specify a particular mode (text or
  1564.    binary) to be used for all the files, or you can let Kermit select the
  1565.    type for each file automatically, based on its name (see [190]Sections
  1566.    3.5 and [191]3.6 for greater detail). In UNIX be sure to quote any
  1567.    wildcard characters to prevent the shell from expanding them, as shown
  1568.    in the examples just below. Filename collisions are handled according
  1569.    Kermit's FILE COLLISION setting (if specified in your Kermit
  1570.    customization file; otherwise the default, which is BACKUP).
  1571.    
  1572.    It should go without saying that the -P option should be used with
  1573.    caution. In addition to the well-known risks of transmitting plaintext
  1574.    passwords over the Internet, in this case the password also echos to
  1575.    the screen if you type it, and can be seen in ps and w listings that
  1576.    show the user's currently active command and command-line arguments.
  1577.    Thus command-line FTP sessions are most appropriate for secure or
  1578.    anonymous connections (those that do not require passwords).
  1579.    
  1580.    Here's an example in which you download the latest C-Kermit "tarball"
  1581.    from the Columbia University FTP archive:
  1582.    
  1583.   ftp -A kermit.columbia.edu -bg kermit/archives/ckermit.tar.gz
  1584.  
  1585.    This assumes that "ftp" is a symbolic link to C-Kermit. It logs you in
  1586.    anonymously and gets the ckermit.tar.gz file in binary mode from the
  1587.    kermit/archives directory.
  1588.    
  1589.    Here's a slightly more ambitious example that illustrates CD'ing to
  1590.    the desired server directory to get a group of files in text mode (in
  1591.    this case the C-Kermit source files):
  1592.    
  1593.   ftp -A kermit.columbia.edu -D kermit/f -ag "ck[cuw]*.[cwh]" makefile
  1594.  
  1595.    In this case we CD to the kermit/f directory so we don't have to
  1596.    include it in each file specification, and we quote the ck[cuw]*.[cwh]
  1597.    specification so the shell doesn't expand it, since we have to pass it
  1598.    as-is to the server. Note also that the quotes don't go around the
  1599.    entire file list; only around each file specification that needs to be
  1600.    quoted.
  1601.    
  1602.    Here's one more example, that uploads a debug log file in binary mode
  1603.    to the Kermit incoming directory (as we might ask you to do when
  1604.    following up on a problem report):
  1605.    
  1606.   ftp -A kermit.columbia.edu -D kermit/incoming -bp debug.log
  1607.  
  1608.    In this case the -D option is required to tell the server where to put
  1609.    the incoming file.
  1610.    
  1611.    Unless the -Y option is included, your Kermit initialization file
  1612.    (.kermrc in UNIX, K95.INI in Windows) is executed before the command
  1613.    line options, so you can set any FTP-related preferences there, as
  1614.    described in the subsequent sections.
  1615.      _________________________________________________________________
  1616.    
  1617.     3.1.3. The FTP URL Interpreter
  1618.     
  1619.    If Kermit is invoked with either its regular personality (as "kermit")
  1620.           or its FTP personality (as "ftp"), you can also give a URL
  1621.           (Universal Resource Locator) instead of a hostname and options,
  1622.           with or without a username and password:
  1623.           ftp ftp://user:password@host/path
  1624.           ftp ftp://user@host/path
  1625.           ftp ftp://host/path
  1626.           kermit ftp://host/path
  1627.           
  1628.    If the FTP personality is used, the service must be "ftp". In all
  1629.    cases, a hostname or address must be included. If a user is included
  1630.    but no password, you are prompted for the password. If a path
  1631.    (filename) is included:
  1632.      * If no user is included, "anonymous" is used.
  1633.      * GET is assumed.
  1634.        
  1635.    If no path (and no action options) are included, an interactive FTP
  1636.           session is started, as in this example:
  1637.           ftp ftp://kermit.columbia.edu
  1638.           
  1639.    If a path is included, but a username is not included, "anonymous" is
  1640.    used and an appropriate user@host password is supplied automatically.
  1641.    If authentication is successful, Kermit attempts to GET the file
  1642.    indicated by the path or, if the path is the name of a directory, it
  1643.    asks the server for a directory listing. In both cases, Kermit
  1644.    disconnects from the server and exits after the operation is complete
  1645.    (unless you have included the -S option on the command line).
  1646.    
  1647.    Here's an example that gets a listing of the Kermit directory at the
  1648.           Kermit ftp site:
  1649.           ftp ftp://kermit.columbia.edu/kermit/
  1650.           
  1651.    This example gets the top-level READ.ME file from the same directory:
  1652.           ftp ftp://kermit.columbia.edu/kermit/READ.ME
  1653.           
  1654.    Here's the same example, but requesting a text-mode transfer:
  1655.           ftp -T ftp://kermit.columbia.edu/kermit/READ.ME
  1656.           This illustrates that you can mix command-line options and URLs
  1657.           if you desire.
  1658.           
  1659.    Here's an example that logs in as a (fictitious) real user to get a
  1660.           file:
  1661.           ftp ftp://olga@ftp.xyzcorp.com/resume.txt
  1662.           The password is not included, so Kermit prompts for it.
  1663.           
  1664.    This scheme allows Kermit to be used as the FTP helper of other
  1665.    applications, such as Web browsers, with all its advantages over other
  1666.    FTP clients (especially the ones that are built in to most Web
  1667.    browsers), e.g. that it can be given wildcards, and it can pick text
  1668.    and binary mode automatically for each file.
  1669.    
  1670.    HINT: suppose somebody sends you an FTP URL in email, or you see it in
  1671.    some text. If your terminal screen supports copy/paste, copy the url,
  1672.    and then at the shell prompt type "kermit", a space, and then paste
  1673.    the URL, e.g.:
  1674.    
  1675.   $ kermit ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty1.1.27-O
  1676.  
  1677.    "$ is the shell prompt; the part you type is underlined, the rest is
  1678.    pasted in. Kermit does the rest.
  1679.      _________________________________________________________________
  1680.    
  1681.     3.1.4. Interactive FTP Session Establishment
  1682.     
  1683.    As you read this and the following sections, bear in mind that any
  1684.    command that can be given at the prompt can also be used in a script
  1685.    program. Kermit's script programming language is the same as its
  1686.    interactive command language. [192]CLICK HERE if you would like to
  1687.    learn a bit more about script writing.
  1688.    
  1689.    An FTP session is established with the FTP OPEN command:
  1690.    
  1691.    FTP [ OPEN ] [ { /SSL, /TLS } ] hostname [ switches ] [ port ]
  1692.           Opens an FTP connection to the given host on the given port
  1693.           and, if FTP AUTOLOGIN is ON, also logs you in to the server,
  1694.           prompting for username and password if necessary. If no port is
  1695.           specified, the regular FTP protocol port (21) is used. The OPEN
  1696.           keyword is optional (unless the hostname conflicts with one of
  1697.           the FTP command keywords, which you can list by typing "ftp
  1698.           ?").
  1699.           
  1700.    The hostname can be an IP host name, numeric IP address, or if you
  1701.    have a network directory active (SET NETWORK DIRECTORY; see Chapter 6
  1702.    of [193]Using C-Kermit), an entry name in the directory. In the latter
  1703.    case, if the given hostname matches exactly one entry, the associated
  1704.    name or address is used; if it matches more than one, Kermit cycles
  1705.    through them until one is found that can be opened; if it matches
  1706.    none, then the hostname is used as-is. If a directory is active but
  1707.    you want to bypass directory lookup, include an "=" sign at the
  1708.    beginning of the hostname, and/or use a numeric IP address.
  1709.    
  1710.    When an FTP connection is opened, the default file-transfer mode is
  1711.    set to binary if the client and server platforms are alike (e.g. both
  1712.    of them are some kind of UNIX), and to text ("ascii") if they are not
  1713.    alike. This has no particular effect for uploading since Kermit
  1714.    automatically switches between text and binary mode for each file, but
  1715.    might be important for downloading. The connection is also set to
  1716.    Stream mode and File structure. Record- or page-oriented file
  1717.    transfers are not supported by C-Kermit's FTP client.
  1718.    
  1719.    The optional FTP OPEN switches are:
  1720.    
  1721.    /ANONYMOUS
  1722.           Logs you in anonymously, automatically supplying username
  1723.           "anonymous" and user@host as the password, based on your local
  1724.           user and host names.
  1725.           
  1726.    /USER:name
  1727.           Uses the given username to log you in, thus avoiding the Name:
  1728.           prompt.
  1729.           
  1730.    /PASSWORD:text
  1731.           Uses the given text as your password, thus avoiding the
  1732.           Password: prompt. This switch is not recommended for use in
  1733.           script files, which would be a security risk.
  1734.           
  1735.    /ACCOUNT:text
  1736.           Uses the given text as your account (or secondary password,
  1737.           depending on the requirements of the server; most servers do
  1738.           not require or accept an account name). If an account is not
  1739.           supplied, you are not prompted for one.
  1740.           
  1741.    /PASSIVE
  1742.           Opens the connection in passive mode. Passive mode is the
  1743.           default in Kermit's FTP client, unlike in most others, since it
  1744.           works better through firewalls. The /PASSIVE and /ACTIVE
  1745.           switches apply only to the connection that is being opened, and
  1746.           do not affect the global FTP PASSIVE-MODE setting.
  1747.           
  1748.    /ACTIVE
  1749.           Opens the connection in active mode. Use this switch if the
  1750.           server does not support passive mode, or use the command SET
  1751.           FTP PASSIVE-MODE OFF.
  1752.           
  1753.    When a username or password is missing, a prompt is issued at the
  1754.    controlling terminal and you must type the response; the response can
  1755.    not be scripted. Use the switches to avoid prompts, or one of the
  1756.    secure authentication methods described in the next section, or see
  1757.    [194]SET FTP AUTOLOGIN and the [195]FTP USER and similar commands
  1758.    described later in this section.
  1759.    
  1760.    Examples:
  1761.    
  1762.   ftp open kermit.columbia.edu /anonymous  ; Open and log in anonymously
  1763.   ftp kermit.columbia.edu /anonymous       ; The OPEN keyword can be omitted
  1764.   ftp xyzcorp.com                          ; Open and maybe prompt for username
  1765.   ftp xyzcorp.com /user:olga               ; Open and log in as olga
  1766.   ftp testing.abccorp.com 449              ; Specify a special TCP port number
  1767.   ftp testing.abccorp.com /user:olaf /password:secret 449
  1768.  
  1769.    The FTP OPEN command succeeds if a connection was opened to the server
  1770.    (even if the given username and password were not valid) and fails
  1771.    otherwise (see [196]Section 3.8 for details).
  1772.    
  1773.    When your FTP session is complete, you can terminate it as follows:
  1774.    
  1775.    FTP BYE
  1776.           Closes the FTP connection if one was open. The FTP prefix can
  1777.           be omitted if no other connection is open at the same time (see
  1778.           [197]Section 3.8 for details). If a connection log is active,
  1779.           an FTP record is written to it. If Kermit was started with the
  1780.           -9 command-line option or with its FTP command-line
  1781.           personality, and the -S (Stay) option was not given, AND there
  1782.           is no other active connection, the FTP BYE command also exits,
  1783.           just as it does on a regular FTP client. Synonyms: FTP CLOSE,
  1784.           FTP QUIT (but if the FTP prefix is omitted from QUIT, this
  1785.           becomes the regular Kermit QUIT command, which is equivalent to
  1786.           EXIT; i.e. it closes the connection and exits from Kermit).
  1787.           
  1788.    The following commands can be used to achieve greater control over the
  1789.    connection and login process:
  1790.    
  1791.    SET FTP AUTOLOGIN { ON, OFF }
  1792.           If you give this command prior to opening an FTP connection, it
  1793.           controls whether Kermit tries to log you in automatically as
  1794.           part of the connection process. Normally ON, which means the
  1795.           username and password are sent automatically (and prompted for
  1796.           if they are not yet known). When OFF, FTP OPEN connects to the
  1797.           server without logging in. OFF is equivalent to the -n
  1798.           command-line option when using Kermit's FTP command-line
  1799.           personality.
  1800.           
  1801.    FTP USER name [ password [ account ] ]
  1802.           Used to log in to an FTP server to which a connection has been
  1803.           made without autologin, or when autologin failed. If the
  1804.           password is furnished on the command line, it is used;
  1805.           otherwise you are prompted for a password. An account may also
  1806.           be furnished if required by the server; it is not required by
  1807.           Kermit and is not prompted for if omitted. Synonym: FTP LOGIN.
  1808.           
  1809.    FTP ACCOUNT text
  1810.           Sends an account name to a server that supports accounts. If
  1811.           the server does not support accounts, an error response occurs.
  1812.           If the server does support accounts, the account is accepted if
  1813.           it is valid and rejected if it is not. The account might be
  1814.           used for charging purposes or it might be a secondary password,
  1815.           or it might be used for any other purpose, such as an access
  1816.           password for a particular disk. Servers that support accounts
  1817.           might or might not allow or require the account to be sent
  1818.           prior to login; usually it is sent after login, if at all.
  1819.           
  1820.    Example:
  1821.    
  1822.   set ftp autologin off                  ; One thing at a time please
  1823.   ftp xyzcorp.com                        ; Try to make the connection
  1824.   if fail exit 1 FTP connection failed   ; Check that it was made
  1825.   ftp user olga secret                   ; Now log in to the server
  1826.   if fail exit 1 FTP login failed        ; Check that it worked
  1827.   ftp account 103896854                  ; Login OK - send account
  1828.   if fail echo WARNING - FTP ACCT failed ; Warn if problem
  1829.   ...                                    ; (have session here)
  1830.   bye                                    ; Log out and disconnect
  1831.  
  1832.    The following commands are used to control or get information about
  1833.    the FTP connection. Any particular FTP server does not necessarily
  1834.    support all of them.
  1835.    
  1836.    FTP RESET
  1837.           Terminates a user session but leaves the connection open,
  1838.           allowing a new login via FTP USER.
  1839.           
  1840.    FTP IDLE [ number ]
  1841.           Most FTP servers automatically log you out and and disconnect
  1842.           your session if there has been no activity for a certain amount
  1843.           of time. Use this command to ask the server to set its idle
  1844.           limit to the given number of seconds. Omit the number to ask
  1845.           the server to inform you of its current idle limit.
  1846.           
  1847.    FTP STATUS [ filename ]
  1848.           Asks the FTP server to send information about the current
  1849.           session. The result is a free-format report that might include
  1850.           server identification, username and login time, FTP protocol
  1851.           settings, and file-transfer statistics. If a filename is given,
  1852.           the server is supposed to send detailed information about the
  1853.           file.
  1854.           
  1855.    FTP SYSTEM
  1856.           Asks the FTP server to identify its operating system (Listed in
  1857.           Internet Assigned Numbers, Operating System Names). Examples:
  1858.           UNIX, VMS, VM/CMS, WINDOWS-NT. Unfortunately many variations
  1859.           are allowed (e.g. LINUX-2.0, LINUX-2.2, FREEBSD, ULTRIX, etc,
  1860.           instead of UNIX; WINDOWS-NT-3, WINDOWS-NT-3.5, WINDOWS-NT-3.51,
  1861.           WINDOWS-NT-4, etc). The report might also include other
  1862.           information like "Type L8", "Type I", or "Type A", indicating
  1863.           the file-transfer mode.
  1864.           
  1865.    FTP HELP [ keyword [ keyword [ ... ] ]
  1866.           Asks the server to list the commands it supports. The response
  1867.           is usually cryptic, listing FTP command mnemonics, not the
  1868.           commands used by the client (since the server has no way of
  1869.           knowing anything about the client's user interface). For
  1870.           example, the PUT command is STOR in FTP protocol. If a keyword
  1871.           is given, which should be an FTP protocol command,
  1872.           slightly-more- detailed help is given about the corresponding
  1873.           command (if the FTP server supports this feature). Examples:
  1874.           "ftp help", "ftp help stor".
  1875.           
  1876.    FTP SITE text
  1877.           (Advanced) Sends an FTP SITE (site-specific) command. Usually
  1878.           this means that the FTP server is asked to run an external
  1879.           command with the given arguments. You might be able to find out
  1880.           what SITE commands are available by sending "ftp help site" to
  1881.           the server, but in general the availability of and response to
  1882.           SITE commands is (not surprisingly) site specific.
  1883.           
  1884.    FTP QUOTE text
  1885.           (Advanced) Sends an FTP command in FTP protocol format. Use
  1886.           this command to send commands to the server that the FTP client
  1887.           might not know about.
  1888.           
  1889.    SHOW FTP
  1890.           Lists client (Kermit) FTP settings and information. Also SHOW
  1891.           CONNECTION, SHOW COMMUNICATIONS.
  1892.           
  1893.    HELP FTP [ keyword ]
  1894.           Asks Kermit to list and describe its built-in FTP commands.
  1895.           
  1896.    HELP SET FTP [ keyword ]
  1897.           Asks Kermit to list and describe its built-in SET FTP commands.
  1898.           
  1899.    [ [198]Top ] [ [199]Contents ] [ [200]C-Kermit Home ] [ [201]Kermit
  1900.    Home ]
  1901.      _________________________________________________________________
  1902.    
  1903.   3.2. Making Secure FTP Connections
  1904.   
  1905.    In the previous section, you can see several examples of traditional
  1906.    insecure authentication: username and password sent across the network
  1907.    in clear text. Of course this is bad practice on at least two counts:
  1908.    (1) storing passwords in files (such as script files) gives access to
  1909.    the target systems to anybody who can obtain read access to your
  1910.    scripts; and (2) sending this information over the network leaves it
  1911.    open to interception by network sniffers or compromised hosts.
  1912.    
  1913.    Because of the increasing need for security on the Internet, FTP
  1914.    servers are beginning to appear that offer secure forms of
  1915.    authentication, in which no information is sent over the network that
  1916.    would allow anyone who intercepts it to usurp your identity and gain
  1917.    your access rights.
  1918.    
  1919.    Kermit provides an equivalent form of FTP security for each type of
  1920.    IETF standard security implemented in Telnet. These include
  1921.    GSSAPI-KERBEROS5, KERBEROS4, Secure Remote Password (SRP), and
  1922.    Transport Layer Security (SSL and TLS). It does not presently include
  1923.    SSL tunneling nor any form of SSH v1 or v2. When Kermit is built with
  1924.    the necessary libraries, secure FTP connections are attempted by
  1925.    default, in which all connections are authenticated and the command
  1926.    and data channels are private.
  1927.    
  1928.    The use of authentication and encryption for FTP connections can be
  1929.    adjusted with the commands listed below, which are available only if
  1930.    your version of Kermit was built with the corresponding security
  1931.    options and libraries:
  1932.    
  1933.    SET FTP AUTHTYPE { AUTOMATIC, GSSAPI-KRB5, KERBEROS4, SRP, SSL, TLS }
  1934.           Specifies an ordered list of authentication methods to be
  1935.           attempted when AUTOAUTHENTICATION is ON. The default list is:
  1936.           GSSAPI-KRB5, SRP, KERBEROS_V4, TLS, SSL. If none of the
  1937.           selected methods are supported by the server, an insecure login
  1938.           is used as a fallback. Note, by the way, that SSL or TLS can be
  1939.           used to secure an anonymous connection.
  1940.           
  1941.    SET FTP AUTOAUTHENTICATION { ON, OFF }
  1942.           Tells whether authentication should be negotiated by the FTP
  1943.           OPEN command. Default is ON.
  1944.           
  1945.    SET FTP AUTOENCRYPTION { ON, OFF }
  1946.           Tells whether encryption (privacy) should be negotiated by the
  1947.           FTP OPEN command. Default is ON.
  1948.           
  1949.    SET FTP AUTOLOGIN { ON, OFF }
  1950.           Tells Kermit whether to try logging in automatically when you
  1951.           make an FTP connection, as opposed to letting you do it "by
  1952.           hand" with the FTP USER command.
  1953.           
  1954.    SET FTP COMMAND-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE
  1955.           }
  1956.           Determines the level of protection applied to the command
  1957.           channel:
  1958.           
  1959.   CLEAR         Data is sent in plaintext and not protected against tampering.
  1960.   CONFIDENTIAL  Data is encrypted but not protected against tampering.
  1961.   PRIVATE       Data is encrypted and is protected against tampering.
  1962.   SAFE          Data is sent in plaintext but protected against tampering.
  1963.  
  1964.           The default is PRIVATE.
  1965.           
  1966.    SET FTP CREDENTIAL-FORWARDING { ON, OFF }
  1967.           Tells whether end-user credentials are to be forwarded to the
  1968.           server if supported by the authentication method (GSSAPI-KRB5
  1969.           only). This is often required to allow access to distributed
  1970.           file systems (e.g. AFS.)
  1971.           
  1972.    SET FTP DATA-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE }
  1973.           Tells what level of protection is applied to subsequent data
  1974.           channels. The meanings of the protection-level keywords are the
  1975.           same as for SET FTP COMMAND-PROTECTION-LEVEL. The default is
  1976.           PRIVATE.
  1977.           
  1978.    SET FTP SRP CIPHER name
  1979.           Specifies the cipher to be used for encryption when SRP
  1980.           authentication is in use. The list of possible choices is
  1981.           computed based on the capabilities of the local SRP library and
  1982.           includes NONE plus zero or more of the following:
  1983.           
  1984.   BLOWFISH_ECB        CAST5_ECB          DES_ECB          DES3_ECB
  1985.   BLOWFISH_CBC        CAST5_CBC          DES_CBC          DES3_CBC
  1986.   BLOWFISH_CFB64      CAST5_CFB64        DES_CFB64        DES3_CFB64
  1987.   BLOWFISH_OFB64      CAST5_OFB64        DES_OFB64        DES3_OFB64
  1988.  
  1989.           The default is DES3_ECB.
  1990.           
  1991.    SET FTP SRP HASH name
  1992.           Specifies the hash to be used for data protection when SRP
  1993.           authentication is in use. The choices are MD5 and SHA. The
  1994.           default is SHA.
  1995.           
  1996.    Command-line options:
  1997.    
  1998.    -k name
  1999.           Specifies the realm to be used with Kerberos 4 authentication
  2000.           (= SET AUTH K4 REALM name).
  2001.           
  2002.    -f
  2003.           Enables forwarding of Kerberos 5 credentials to the host when
  2004.           using GSSAPI authentication (= SET AUTH K5 FORWARDABLE ON).
  2005.           
  2006.    -x
  2007.           Enables autoencryption (= SET FTP AUTOENCRYPTION ON).
  2008.           
  2009.    -c cipher
  2010.           Specifies the kind of cipher to be used for encryption with SRP
  2011.           authentication. Equivalent to SET FTP SRP CIPHER, with the same
  2012.           choices. If this option is not given, CAST5_CBC is used.
  2013.           
  2014.    -H hash
  2015.           Specifies the hash to be used for encryption with SRP
  2016.           authentication. Equivalent to SET FTP SRP HASH, with the same
  2017.           choices. If this option is not given, SHA is used.
  2018.           
  2019.    -z debug
  2020.           Turns on SSL/TLS debugging.
  2021.           
  2022.    -z secure
  2023.           Requires secure connection.
  2024.           
  2025.    -z certsok
  2026.           Says to accept all certificates without checking validity.
  2027.           
  2028.    -z verify=n
  2029.           Sets certificate verification mode to the given number, n:
  2030.             0 = no verification
  2031.             1 = verify certificate if presented
  2032.             2 = require verification of certificate
  2033.           
  2034.    -z cert=filename
  2035.           Specifies a file containing a client certificate to be
  2036.           presented to the FTP server.
  2037.           
  2038.    -z key=filename
  2039.           Specifies a file containing a private key matching the client
  2040.           certificate.
  2041.           
  2042.    -z !krb4
  2043.           nokrb4 Disables the use of Kerberos 4.
  2044.           
  2045.    -z !gss
  2046.           
  2047.    -z nogss
  2048.           Disables the use of GSSAPI - Kerberos 5.
  2049.           
  2050.    -z !srp
  2051.           
  2052.    -z nosrp
  2053.           Disables use of SRP.
  2054.           
  2055.    -z !ssl
  2056.           
  2057.    -z nossl
  2058.           Disables the use of SSL.
  2059.           
  2060.    -z !tls
  2061.           
  2062.    -z notls
  2063.           Disables the use of TLS.
  2064.           
  2065.    Caution: If your FTP connection is secured via AUTH TLS, it is not
  2066.    possible to interrupt a file transfer. This is a limitation of all
  2067.    known FTP servers that support AUTH TLS.
  2068.    
  2069.    [ [202]Top ] [ [203]Contents ] [ [204]C-Kermit Home ] [ [205]Kermit
  2070.    Home ]
  2071.      _________________________________________________________________
  2072.    
  2073.   3.3. Setting FTP Preferences
  2074.   
  2075.    FTP preferences can be set globally and persistently with the commands
  2076.    in the following sections; many of these can also be overridden on a
  2077.    per-command basis with switches that have the same name.
  2078.    
  2079.     3.3.1. Logs, Messages, and Other Feedback
  2080.     
  2081.    You can control the amount of feedback received from your FTP session
  2082.    with the commands in this section. First, you can create a log of your
  2083.    FTP transfers with the following commands:
  2084.    
  2085.    SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF }
  2086.           Selects the log format. VERBOSE is the default, and is
  2087.           described in [206]the manual. FTP chooses a WU-FTPD format, the
  2088.           same as is used by the popular FTP server. BRIEF creates
  2089.           per-file records in comma-separated-list format. For greater
  2090.           detail, see [207]Section 4.17 of the [208]C-Kermit 7.0 Update
  2091.           Notes.
  2092.           
  2093.    LOG TRANSACTIONS filename
  2094.           Records FTP (or Kermit, or any other protocol) uploads and
  2095.           downloads in the given file using the format selected by the
  2096.           most recent SET TRANSACTION-LOG command, if any, or else the
  2097.           default format.
  2098.           
  2099.    FTP screen messages and displays are controlled by the following
  2100.    commands:
  2101.    
  2102.    SET TRANSFER DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
  2103.           FTP transfers use Kermit's normal file-transfer display styles.
  2104.           Use this command to choose the desired format; the default on
  2105.           most platforms is FULLSCREEN. The display is automatically
  2106.           disabled if Kermit is running in the background or in batch.
  2107.           BRIEF is always used for command-line initiated transfers
  2108.           (unless suppressed by -q). While a file-transfer is in
  2109.           progress, you can interrupt it in the normal Kermit way by
  2110.           typing one of the following keys or key combinations:
  2111.             X - Cancel current file but go on to the next one (if any).
  2112.             Z - Cancel the entire transfer.   Ctrl-L or Ctrl-W - Refresh
  2113.           the file-transfer display (if any).
  2114.           
  2115.    SET QUIET { ON, OFF }
  2116.           This command applies to Kermit in general, not just FTP. OFF by
  2117.           default; when ON, it surpresses most messages from most
  2118.           commands as well as the file-transfer display.
  2119.           
  2120.    SET FTP PROGRESS-MESSAGES { ON, OFF }
  2121.           Tells whether Kermit should print locally-generated feedback
  2122.           messages for each non-file-transfer command. ON by default.
  2123.           
  2124.    SET FTP VERBOSE-MODE { ON, OFF }
  2125.           Tells whether to display all responses from the FTP server. OFF
  2126.           by default. This shows all responses to all commands, except
  2127.           when the file-transfer display is active, and unless you have
  2128.           SET QUIET ON. When OFF, responses are shown only for commands
  2129.           such as FTP PWD whose purpose is to display a response.
  2130.           
  2131.    SET FTP DEBUG { ON, OFF }
  2132.           Tells whether local client debugging information should be
  2133.           displayed. OFF by default. When ON, the commands that are sent
  2134.           to the server are shown, as well as its responses (even if
  2135.           VERBOSE-MODE is OFF), plus additional informational messages
  2136.           are printed regarding the progress of secure operations. Also,
  2137.           the temporary file created by the [209]MGET command is not
  2138.           deleted so you can see what's in it.
  2139.           
  2140.    Set all of these to OFF when silent running is desired.
  2141.    
  2142.     3.3.2. Operational Preferences
  2143.     
  2144.    SET FTP AUTOLOGIN { ON, OFF }
  2145.           If you give this command prior to opening an FTP connection, it
  2146.           controls whether Kermit tries to log you in automatically as
  2147.           part of the connection process. Normally ON, which means the
  2148.           username and password are sent automatically (and prompted for
  2149.           if they are not yet known). When OFF, FTP OPEN connects to the
  2150.           server without logging in. OFF is equivalent to the -n
  2151.           command-line option when using Kermit's FTP command-line
  2152.           personality. See [210]Section 3.1.4 for usage.
  2153.           
  2154.    SET FTP PASSIVE-MODE { ON, OFF }
  2155.           ON by default, to avoid random TCP port assignment for data
  2156.           connections, which can prevent FTP protocol from working
  2157.           through firewalls and network address translators (for more on
  2158.           these topics, see the [211]Kermit security reference. Set to
  2159.           OFF in case the FTP server does not support passive mode, or in
  2160.           case the client has problems with it (it has been observed, for
  2161.           example, that when using passive mode, the SCO XENIX 2.3.4
  2162.           TCP/IP stack hangs in the connect() call forever).
  2163.           
  2164.    SET FTP SEND-PORT-COMMANDS { ON, OFF }
  2165.           This command determines whether the FTP client sends a new PORT
  2166.           command to the server when accepting incoming data connections
  2167.           (as when not using passive mode.) When PASSIVE-MODE is OFF and
  2168.           SET SEND-PORT is OFF, the port that was originally specified is
  2169.           reused. This is the default behavior for normal FTP clients but
  2170.           it is not compatible with many firewalls.
  2171.           
  2172.    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
  2173.           Whether to translate character sets when transferring files
  2174.           with FTP (explained in [212]Section 3.7). OFF by default.
  2175.           
  2176.    SET FTP SERVER-CHARACTER-SET name
  2177.           Tells Kermit the character set used by the FTP server, UTF-8 by
  2178.           default ([213]Section 3.7).
  2179.           
  2180.    SET FTP ERROR-ACTION { PROCEED, QUIT }
  2181.           When transferring a group of files with FTP, and an error
  2182.           occurs with one of the files, Kermit normally goes on the next
  2183.           file. Use SET FTP ERROR-ACTION to QUIT to make Kermit stop the
  2184.           transfer immediately and fail if an error occurs with any
  2185.           single file in the group. Example: you have given Kermit a list
  2186.           of files to send, and one of the files can not be found, or
  2187.           read permission is denied. Note that cancelling a file by
  2188.           typing 'X' during transfer is not considered an error (if you
  2189.           want to cancel the entire transfer, type 'Z' or Ctrl-C).
  2190.           
  2191.    SET FTP PERMISSIONS { AUTO, ON, OFF }
  2192.           When uploading files with PUT or MPUT, this tells whether
  2193.           Kermit should send each file's permissions. The default is OFF,
  2194.           which means not to send permissions, in which case the uploaded
  2195.           file's permissions are set by the FTP server according to its
  2196.           own criteria. ON means to send them, AUTO means to send them
  2197.           only if the client (Kermit) and server are on like platforms
  2198.           (e.g. both UNIX). This command has no effect when downloading,
  2199.           since the FTP protocol does not include a way for the server to
  2200.           inform the client of a file's permissions. Also see [214]FTP
  2201.           PUT /PERMISSIONS. Note that setting permissions after uploading
  2202.           is likely to work (correctly or at all) only when the client
  2203.           and server platforms are alike (e.g. both of them are some form
  2204.           of UNIX). Also note that Windows files don't have permissions.
  2205.           Also see [215]FTP CHMOD.
  2206.           
  2207.    SET FTP DATES { ON, OFF }
  2208.           When downloading files with GET or MGET, this tells whether
  2209.           Kermit should try to set the received file's date from the
  2210.           server's date. FTP DATES is OFF by default, for compatibility
  2211.           with other FTP clients, and also because (a) the FTP server
  2212.           might not support file-date inquiries, and (b) FTP protocol
  2213.           does not allow date preservation when uploading. So at best,
  2214.           SET FTP DATES ON can work only when downloading.
  2215.           
  2216.    SET FTP FILENAMES { AUTO, CONVERTED, LITERAL }
  2217.           When uploading (sending) files, this tells whether to convert
  2218.           outbound filenames to "common form". This means allowing only
  2219.           one period in a name, uppercasing any lowercase letters,
  2220.           replacing spaces by underscores, etc. AUTOMATIC is the default,
  2221.           meaning LITERAL when client and server are the same type of
  2222.           system (e.g. UNIX) and CONVERTED otherwise. Special case: if
  2223.           the setting is AUTOMATIC and the client is not UNIX and the
  2224.           server identifies itself as UNIX, Kermit uses a less-strict
  2225.           form of conversion, in which lowercase letters are not
  2226.           uppercased and the filename can contain any number of periods,
  2227.           but spaces are still converted to underscore. When receiving,
  2228.           conversion generally means to change all-uppercase names to
  2229.           lowercase and spaces to underscore.
  2230.           
  2231.    SET FTP UNIQUE-SERVER-NAMES { ON, OFF }
  2232.           Applies only to uploads. Tells the server to create new, unique
  2233.           names for incoming files that have the same names as existing
  2234.           files. OFF by default, in which case the server overwrites
  2235.           existing files with new files of the same name. When ON, the
  2236.           server uses its own built-in method for creating new names for
  2237.           incoming files; for example, appending a period (.) and a
  2238.           number to the name. CAUTION: Use this option only if you do not
  2239.           need to refer to the file after it is uploaded, since FTP
  2240.           protocol provides no mechanism for the client to find out what
  2241.           name was assigned by the server.
  2242.           
  2243.    SET FTP COLLISION { ... }
  2244.           When downloading, what to do if an incoming file has the same
  2245.           name as an existing file. Options are the same as for SET FILE
  2246.           COLLISION. If this command is not given, Kermit's regular FILE
  2247.           COLLISION setting is used. If this command is given, it
  2248.           overrides the FILE COLLISION setting for FTP transfers only.
  2249.           See [216]Section 3.6.2 for details.
  2250.           
  2251.    SET FTP TYPE { TEXT, BINARY, TENEX }
  2252.           Changes the default transfer mode. When sending (uploading)
  2253.           files, this command has no effect unless you disable automatic
  2254.           text/binary mode switching ([217]Section 4) with SET FILE SCAN
  2255.           OFF or SET TRANSFER MODE MANUAL. When receiving (downloading)
  2256.           files, this command establishes the transfer mode to be used
  2257.           when a filename does not match any of Kermit's text or binary
  2258.           filename patterns, unless you use SET FTP
  2259.           GET-FILETYPE-SWITCHING or SET TRANSFER MODE MANUAL to disable
  2260.           automatic switching, in which case, this command establishes
  2261.           the transfer mode for all downloaded files. In all cases,
  2262.           however, the FTP TYPE can be overridden in any GET or PUT
  2263.           command by including a /TEXT (/ASCII), /BINARY, or /TENEX
  2264.           switch. The FTP TYPE is independent of the Kermit FILE TYPE
  2265.           setting. TENEX is used for sending 8-bit binary files to 36-bit
  2266.           platforms such as TOPS-10, TOPS-20, and TENEX, and getting them
  2267.           back again. Synonym: ASCII = TEXT. Note: there is also an FTP
  2268.           TYPE command, which does what SET FTP TYPE does but also sends
  2269.           a TYPE command to the server immediately if the given type is
  2270.           different from the current one.
  2271.           
  2272.    If you want want specific FTP preference settings to be in effect for
  2273.    all your Kermit FTP sessions, put the desired SET FTP commands in your
  2274.    Kermit customization file (~/.mykermrc in UNIX, K95CUSTOM.INI in
  2275.    Windows.
  2276.    
  2277.    [ [218]Top ] [ [219]Contents ] [ [220]C-Kermit Home ] [ [221]Kermit
  2278.    Home ]
  2279.      _________________________________________________________________
  2280.    
  2281.   3.4. Managing Directories and Files
  2282.   
  2283.    In Kermit, commands for directory and file management can refer to:
  2284.    
  2285.      * The local computer
  2286.      * A remote computer when you have a connection to a Kermit server or
  2287.        IKSD.
  2288.      * A remote computer when you have a connection to an FTP server.
  2289.        
  2290.    (There can also be an HTTP connection, but the commands in this
  2291.    section don't apply to HTTP connections.)
  2292.    
  2293.    Thus in general, each such command comes in three forms:
  2294.    
  2295.     1. With no prefix, it refers to the local computer (CD, DIR, etc).
  2296.     2. With the REMOTE prefix, it is for a Kermit server (REMOTE CD,
  2297.        REMOTE DIR).
  2298.     3. With the FTP prefix, it's for an FTP server (FTP CD, FTP DIR).
  2299.        
  2300.    Note the difference in command format between the Kermit FTP client
  2301.    and most other FTP clients: in Kermit, unprefixed file management
  2302.    commands apply locally; the FTP prefix is required to send them to the
  2303.    server (but see [222]Section 3.8, which explains how "R-commands" can
  2304.    be used when the only connection is an FTP connection, or when you
  2305.    explicitly tell Kermit to "switch focus" to the FTP connection). In
  2306.    most FTP clients, on the other hand, unprefixed commands are for the
  2307.    server, and local commands require a prefix.
  2308.    
  2309.    Kermit's FTP file and directory management commands are as follows.
  2310.    When an R-command is included in the Synonyms list, be sure to read
  2311.    [223]Section 3.8 about rules for use of R-commands.
  2312.    
  2313.    FTP CD [ directory ]
  2314.           Tells the FTP server to change its default (working) directory
  2315.           to the one given, which usually must be expressed in the syntax
  2316.           of the server platform (UNIX, VMS, etc). If the directory is
  2317.           not specified, the result depends on the FTP server -- it might
  2318.           complain that the command is illegal, or it might change to
  2319.           your original login directory. Synonyms: FTP CWD (Change
  2320.           Wording Directory); RCD.
  2321.           
  2322.    FTP CDUP
  2323.           Tells the FTP server to change its default (working) directory
  2324.           to the parent directory of its current one (equivalent to
  2325.           "cd .." in UNIX, or "cd [-]" in VMS). Synonyms: RCDUP, FTP UP.
  2326.           
  2327.    FTP PWD
  2328.           Asks the FTP server to report ("print") its current working
  2329.           directory. Synonym: RPWD.
  2330.           
  2331.    FTP MKDIR directory
  2332.           Asks the FTP server to create the directory whose name is
  2333.           given. In general, the name must be in the syntax of the
  2334.           server's file system, and it must be either absolute (a full
  2335.           pathname) or relative to the server's current (working)
  2336.           directory. This command fails if the directory can't be created
  2337.           for any reason, including that it exists already. Synonym:
  2338.           RMKDIR.
  2339.           
  2340.    FTP RMDIR directory
  2341.           Asks the FTP server to remove the directory whose name is
  2342.           given. The rules are the same as for MKDIR, plus in most cases,
  2343.           the server will not remove any directory unless it is empty.
  2344.           Synonym: RRMDIR.
  2345.           
  2346.    FTP DIRECTORY [ filespec ] [ redirectors ]
  2347.           Tells the FTP server to send a directory listing of the
  2348.           specified files. If no filespec is given, the server lists all
  2349.           files in its current working directory. The results are in
  2350.           whatever format the server chooses to send them. You can use
  2351.           UNIX-line redirectors to send the listing to a file or a
  2352.           pipeline, exactly as with the regular Kermit client/server
  2353.           REMOTE DIRECTORY command ([224]Using C-Kermit, Chapter 11).
  2354.           Synonym: RDIRECTORY. Examples:
  2355.           
  2356.     ftp dir                           ; Show listing of all files on screen
  2357.     ftp dir *.txt                     ; List *.txt files on screen
  2358.     ftp dir *.txt > somefile          ; Put listing in somefile
  2359.     ftp dir *.txt >> somefile         ; Append listing to somefile
  2360.     ftp dir *.txt | sort > somefile   ; Put sorted listing in somefile
  2361.     ftp dir | more                    ; Runs list through "more"
  2362.     ftp dir | sort | more             ; Runs list through "sort" and "more"
  2363.  
  2364.    FTP VDIRECTORY [ filespec ] [ redirectors ]
  2365.           "Verbose" directory. This is an alternative FTP DIRECTORY
  2366.           command primarily for use with DECSYSTEM-20 (TOPS-20) FTP
  2367.           servers, which send only filenames when given a DIRECTORY
  2368.           command; the VDIRECTORY command makes them also send file
  2369.           sizes, dates, and attributes.
  2370.           
  2371.    FTP CHECK filespec
  2372.           Asks the FTP server whether the given file exists or, if the
  2373.           filespec contains wildcards, if any files match, and this
  2374.           command succeeds or fails accordingly.
  2375.           
  2376.    FTP MODTIME filename
  2377.           Asks the FTP server, via the not-yet-standard FTP MDTM command,
  2378.           to send the modification date and time of the given file. The
  2379.           response should be a numeric string in the format:
  2380.           yyyymmddhhmmssxxxxx... where yyyy is the year, mm is the month,
  2381.           dd is the day, hh is the hour (0-23), mm is the minute, ss is
  2382.           the second, and xxx... is the optional fraction of the second
  2383.           (0 or more digits). The date and time is expressed in UTC (GMT,
  2384.           Zulu, Zero-Meridian). The result is available programmatically
  2385.           in the [225]\v(ftp_message) variable, and is understandable by
  2386.           Kermit's date-time switches and functions. For example, suppose
  2387.           we want to upload all local files that are newer than a
  2388.           particular file on the server:
  2389.           
  2390.   C-Kermit> ftp modtime signpost
  2391.   C-Kermit> echo \v(ftp_message)
  2392.   20010807113542.014
  2393.   C-Kermit> ftp mput /after:\v(ftp_message)GMT *
  2394.  
  2395.           Note that we must append "GMT" to the date-time string to let
  2396.           the /AFTER switch know the time is GMT rather than local.
  2397.           
  2398.    FTP SIZE filename
  2399.           Asks the FTP server to send the size (in bytes) of the given
  2400.           file. The result might vary depending on whether the current
  2401.           FTP TYPE is binary or text ("ascii"). For a reliable byte
  2402.           count, do FTP TYPE BINARY first. The result is available
  2403.           programmatically in the [226]\v(ftp_message) variable.
  2404.           
  2405.    FTP CHMOD permissions filename
  2406.           Tells the FTP server to set the permissions (protection) of the
  2407.           given file to the ones given. The permissions and filename must
  2408.           be given in whatever syntax is required by the server. Example
  2409.           (for a UNIX-based FTP server):
  2410.           
  2411.   ftp chmod 664 oofa.txt
  2412.  
  2413.           Not all servers support this command. For non-UNIX-based
  2414.           servers, you might need to use FTP QUOTE or FTP SITE and the
  2415.           appropriate platform-specific FTP server command.
  2416.           
  2417.    FTP UMASK [ number ]
  2418.           This command is probably specific to UNIX-based servers; it
  2419.           sets the UNIX "umask", which is the default permissions mask
  2420.           for new (in this case, incoming) files. Crudely put, the UNIX
  2421.           umask is an octal representation of a binary number in in which
  2422.           a 1 bit stands for a permission bit that must be 0, and a 0 bit
  2423.           stands for a permission bit that can be 0 or 1 depending on
  2424.           other factors, such as the permissions of the parent directory.
  2425.           Example: "umask 007" requires that new files are created
  2426.           without read/write/execute world permission. If the number is
  2427.           not specified, the server's current umask is reported.
  2428.           
  2429.    FTP RENAME filename newname
  2430.           Asks the FTP server to rename the file whose name is "filename"
  2431.           to "newname". Works only for one file; can not be used with
  2432.           wildcards. The server's interpretation of "newname" can vary
  2433.           (in some cases it must be a filename, in others perhaps it can
  2434.           also be a directory name, in which case if the filename denote
  2435.           a regular file, the file might be moved to the given
  2436.           directory). Some servers might allow files to be renamed
  2437.           ("moved") between physical disks or partitions, others might
  2438.           not. Synonym: RRENAME.
  2439.           
  2440.    FTP DELETE [ switches ] filespec [ filespec [ ... ] ]
  2441.           Tells the FTP server to delete the file or files listed. Each
  2442.           file specification may, but need not, contain wildcard
  2443.           characters to match multiple files. File specifications and
  2444.           wildcard syntax must be those of the server. Any file
  2445.           specifications that contain spaces must be enclosed in braces
  2446.           or doublequotes. FTP DELETE switches are:
  2447.           
  2448.  /ERROR-ACTION:  /FILENAMES:     /NOBACKUPFILES  /QUIET
  2449.  /EXCEPT:        /LARGER-THAN:   /NODOTFILES     /NOPAGE
  2450.  /PAGE           /RECURSIVE      /SMALLER-THAN:
  2451.  
  2452.           When used with FTP DELETE, the /RECURSIVE switch deletes files
  2453.           but not directories, and furthermore depends on the server
  2454.           providing recursive file lists, which is not the normal
  2455.           behavior. For further details, see the decriptions of these
  2456.           switches in [227]Section 3.6. Synonyms: FTP MDELETE (Kermit
  2457.           makes no distinction between DELETE and MDELETE); RDELETE.
  2458.           
  2459.    FTP TYPE { TEXT, BINARY, TENEX }
  2460.           Tells the FTP server to change its file-transfer type to the
  2461.           one given, immediately. See [228]SET FTP TYPE for details.
  2462.           
  2463.    [ [229]Top ] [ [230]Contents ] [ [231]C-Kermit Home ] [ [232]Kermit
  2464.    Home ]
  2465.      _________________________________________________________________
  2466.    
  2467.   3.5. Uploading Files With FTP
  2468.   
  2469.    Uploading means sending files from the client (Kermit) to the FTP
  2470.    server. The basic command for uploading files with FTP is PUT:
  2471.    
  2472.    FTP PUT [ switches ] [ filespec [ as-name ] ]
  2473.           Uploads (sends) the file or files that match the file
  2474.           specification, which may include wildcards, to the server. If
  2475.           no filespec is given, the names of files to send are taken from
  2476.           the /LISTFILE: file, if any, otherwise from the SEND-LIST, if
  2477.           any. Unless you go out of your way to prevent it, Kermit
  2478.           determines the transfer mode (text or binary) for each file
  2479.           automatically, and switches automatically on a per-file basis.
  2480.           If an as-name is given, the file is sent under that name
  2481.           instead of its own (if an as-name is given with a wildcard
  2482.           filespec, the result is a bit more complicated, and is
  2483.           explained later in this section).
  2484.           
  2485.    Unlike normal FTP clients, Kermit does not prompt you by default (or
  2486.    at all) for each file; it just sends them, just as it does with Kermit
  2487.    protocol. The filespec can be a literal filename or a Kermit pattern,
  2488.    described in:
  2489.    
  2490.   [233]http://www.columbia.edu/kermit/ckermit70.html#x4.9
  2491.  
  2492.    Kermit patterns are equivalent to C-Shell patterns and provide a fair
  2493.    amount of flexibility in selecting which files to send, which is
  2494.    augmented by the file-selection switches presented in [234]Section
  2495.    3.5.1.
  2496.    
  2497.    FTP MPUT [ switches ] filespec [ filespec [ ... ] ]
  2498.           FTP MPUT is just like FTP PUT except it allows you to give more
  2499.           than one file specification, and it does not allow an as-name
  2500.           in the file list. However, as-names can be given to either PUT
  2501.           or MPUT with the /AS-NAME: switch.
  2502.           
  2503.    If a PUT or MPUT command results in one file being uploaded, it
  2504.    succeeds if the file is uploaded completely and fails otherwise. If
  2505.    more than one file is selected for upload, success or failure depends
  2506.    on the [235]FTP ERROR-ACTION setting; if it is PROCEED (the default
  2507.    setting), then the [M]PUT command succeeds if at least one of the
  2508.    files was completely uploaded, and fails otherwise, If FTP
  2509.    ERROR-ACTION is QUIT, the [M]PUT command succeeds if all selected
  2510.    files were uploaded successfully, and fails if any file failed.
  2511.    
  2512.    FTP uploads may be interrupted just like Kermit uploads. While the
  2513.    transfer is in progress, type:
  2514.    
  2515.   X to interrupt the current file and go on to the next file.
  2516.   Z to cancel the current file and all remaining files.
  2517.   ^C (Control-C): Like Z, but might act more quickly.
  2518.  
  2519.    MPUT may be used as in regular FTP clients, but it is not required to
  2520.    send multiple files; in Kermit it is required only if you want to give
  2521.    multiple file specifications. Examples:
  2522.    
  2523.   ftp put oofa.txt               ; Send a single file oofa.txt
  2524.   ftp put oofa.txt budget.txt    ; Send single file oofa.txt as budget.txt
  2525.   ftp put *.txt                  ; Send all *.txt files
  2526.   ftp mput *.txt                 ; Send all *.txt files (same as "put *.txt")
  2527.   ftp mput *.txt foo.bar         ; Send all *.txt files plus foo.bar
  2528.  
  2529.    The distinction between PUT and MPUT is important only when more than
  2530.    one filespec is given, just like the distinction between Kermit SEND
  2531.    and MSEND:
  2532.    
  2533.   ftp put oofa.txt budget.txt    ; Send oofa.txt AS budget.txt
  2534.   ftp mput oofa.txt budget.txt   ; Send oofa.txt AND budget.txt
  2535.  
  2536.    If the source file specification includes any path segments, for
  2537.    example:
  2538.    
  2539.   put /tmp/oofa.txt
  2540.   put subdir/another/andanother/oofa.txt
  2541.  
  2542.    the path portion is stripped from the filename that is sent to the
  2543.    server. However, if an as-name contains a path, it is retained.
  2544.    Examples:
  2545.    
  2546.   ftp put /usr/doc/oofa.txt      ; Send as "oofa.txt".
  2547.   ftp put oofa.txt /tmp/oofa.txt ; Send as "/tmp/oofa.txt"
  2548.  
  2549.    The latter example sends the file oofa.txt from your current local
  2550.    directory to the server's /tmp directory. This works only if the
  2551.    server uses the same directory notation that you used in the as-name
  2552.    AND the given directory already exists on the server AND if you have
  2553.    write access to it.
  2554.    
  2555.    Use caution when uploading from a case-sensitive file system, such as
  2556.    UNIX, to a file system that is not case sensitive, such as Windows or
  2557.    VMS. If you have two files in UNIX, AA and aa and upload both of them,
  2558.    the second one will overwrite the first. The only way around this
  2559.    provided by FTP protocol is its "unique server names" feature (SET FTP
  2560.    UNIQUE-SERVER-NAMES or the /UNIQUE switch described below).
  2561.      _________________________________________________________________
  2562.    
  2563.     3.5.1. FTP PUT Switches
  2564.     
  2565.    FTP PUT and MPUT are similar in format and behavior to the regular
  2566.    Kermit SEND and MSEND commands, and they allow most of the same
  2567.    optional switches:
  2568.    
  2569. C-Kermit>ftp put ? Filename, or switch, one of the following:
  2570.  /after:                 /larger-than:           /rename-to:
  2571.  /array:                 /listfile:              /server-character-set:
  2572.  /as-name:               /local-character-set:   /server-rename-to:
  2573.  /before:                /move-to:               /simulate
  2574.  /binary                 /nobackupfiles          /smaller-than:
  2575.  /command                /nodotfiles             /tenex
  2576.  /delete                 /nofollowlinks          /text
  2577.  /dotfiles               /not-after:             /transparent
  2578.  /error-action:          /not-before:            /type:
  2579.  /except:                /permissions:           /update
  2580.  /filenames:             /quiet                  /unique-server-names
  2581.  /filter:                /recover
  2582.  /followlinks            /recursive
  2583.  
  2584.    Most of these switches are common to Kermit's SEND and MSEND commands,
  2585.    so are described only briefly here. For greater detail see:
  2586.    
  2587.      [236]http://www.columbia.edu/kermit/ckermit70.html#x1.5 (explanation
  2588.    of switches)
  2589.      [237]http://www.columbia.edu/kermit/ckermit70.html#x4.7
  2590.    (file-transfer switches)
  2591.    
  2592.    First the file-selection switches:
  2593.    
  2594.    /AFTER:date-time
  2595.           
  2596.    /BEFORE:date-time
  2597.           
  2598.    /NOT-AFTER:date-time
  2599.           
  2600.    /NOT-BEFORE:date-time
  2601.           Only send those files modified on or after or before the given
  2602.           date and time. These switches can be combined to select files
  2603.           modified between two date/times. Various date-time formats are
  2604.           accepted; if the date-time contains spaces, it must be enclosed
  2605.           in braces or doublequotes. See
  2606.           [238]http://www.columbia.edu/kermit/ckermit70.html#x1.6 for
  2607.           details about date-time formats. Examples:
  2608.           
  2609.   ftp put /after:{1 jan 2000 0:00:00} *
  2610.   ftp put /after:-5days *
  2611.  
  2612.    /LARGER-THAN:number
  2613.           
  2614.    /SMALLER-THAN:number
  2615.           Only send files larger (smaller) than the given number of bytes
  2616.           (octets). These switches can be combined to select files in a
  2617.           certain size range.
  2618.           
  2619.    /TYPE:{TEXT,BINARY}
  2620.           Only send files that are the given type, which is determined
  2621.           for each file just before sending it by file scanning. BINARY
  2622.           includes TENEX; if you have included a /TENEX switch, or
  2623.           previously given a [SET] FTP TYPE TENEX command, binary files
  2624.           are sent in TENEX, rather than BINARY mode.
  2625.           
  2626.    /[NO]DOTFILES
  2627.           [Don't] include files whose names begin with dot (.). By
  2628.           default, such files are not included unless your filespec
  2629.           explicitly mentions them.
  2630.           
  2631.    /NOBACKUPFILES
  2632.           Don't include files whose names end with .~nnn~, where nnn is a
  2633.           number, e.g. oofa.txt.~27~. These are backup files created by
  2634.           Kermit, EMACS, and other applications. By default, backup files
  2635.           are included.
  2636.           
  2637.    /NOFOLLOWLINKS
  2638.           (UNIX only) Skip over symbolic links rather than following them
  2639.           (default). This applies to wildcard and/or recursive [M]PUTs;
  2640.           if a single filename is given, and it happens to be a symbolic
  2641.           link, the file it points to is sent.
  2642.           
  2643.    /FOLLOWLINKS
  2644.           (UNIX only) Always follow (resolve) symbolic links, even in
  2645.           wildcard or recursive [M]PUTs. Use with caution. Watch out for
  2646.           circular links, endless loops, etc.
  2647.           
  2648.    /EXCEPT:pattern
  2649.           Exception list -- don't send files whose names match the given
  2650.           pattern. See [239]Section 1.5.4 of the [240]C-Kermit 7.0 Update
  2651.           Notes for details. If you want to exclude a directory from a
  2652.           recursive [M]PUT, use /EXCEPT:{dirname/*}.
  2653.           
  2654.    /RECURSIVE
  2655.           Sends the desired files from the current (or given) directory,
  2656.           plus all directories beneath it, including empty directories,
  2657.           replicating the directory structure on the server. No special
  2658.           capabilities are required in the server, but of course your
  2659.           login ID on the server must have the appropriate access and
  2660.           permission to create directories. Recursive PUTs work not only
  2661.           between like platforms (e.g. UNIX to UNIX) but also between
  2662.           unlike ones (e.g. UNIX to VMS or Windows), in which case
  2663.           text-file format differences are handled by Kermit's automatic
  2664.           text/binary mode switching ([241]Section 4) and character-set
  2665.           translation ([242]Section 3.7). Synonym: /SUBDIRECTORIES.
  2666.           
  2667.    /UPDATE
  2668.           Send only files that have changed since last time ([243]Section
  2669.           3.5.2).
  2670.           
  2671.    /ARRAY:arrayname
  2672.           The "file" to be sent is an array, or a segment of one, rather
  2673.           than a real file. In this case the other selection switches
  2674.           don't apply. The array contents are sent in text mode, and each
  2675.           array element is treated as a line. Example:
  2676.           
  2677.  
  2678.   ftp put /as-name:array.txt /array:&a
  2679.  
  2680.    (or, to send a segment of the array, /array:&a[100:199]). If you don't
  2681.           include an /AS-NAME, a name of "_array_x_" is used (where x is
  2682.           the array letter). If you include this switch, most other
  2683.           switches are meaningless and ignored.
  2684.           
  2685.    /COMMAND
  2686.           The "file" to be sent is the standard output of a command,
  2687.           rather than a real file. It is sent in text or binary mode
  2688.           according to the prevailing FTP TYPE, which can be overridden
  2689.           with a /TEXT or /BINARY switch. Example: Example:
  2690.           
  2691.  
  2692.   ftp put /command /as-name:{userlist} {finger | sort -r}
  2693.  
  2694.    /LISTFILE:filename
  2695.           Tells Kermit to obtain the list of files to be sent from the
  2696.           file whose name is given. This file must contain one file
  2697.           specification (which may be wild) per line. If the list
  2698.           includes files from different directories, such as a recursive
  2699.           listing of a directory tree, the paths are recreated on the
  2700.           server (if possible) if you include the /RECURSIVE switch;
  2701.           otherwise all the files are sent to the current directory on
  2702.           the server.
  2703.           
  2704.    Now the other switches:
  2705.    
  2706.    /AS-NAME:text
  2707.           If a single file is being sent, send it with the given text as
  2708.           its name. If multiple files are being sent, the text must be a
  2709.           template that includes variables such as \v(filename),
  2710.           \v(filenumber), \v(ntime), to allow dynamic creation of each
  2711.           name. The same applies to the as-name field of the FTP PUT
  2712.           command. If this switch is not included (and an as-name is not
  2713.           included as the second filename to PUT), each file is sent with
  2714.           its own name.
  2715.           
  2716.    /BINARY
  2717.           
  2718.    /TEXT
  2719.           
  2720.    /TENEX
  2721.           Forces this upload to take place in the given mode, regardless
  2722.           of the current FTP TYPE setting, and without automatic
  2723.           text/binary switching. /ASCII is a synonym for /TEXT.
  2724.           
  2725.    /FILTER:command
  2726.           Specifies that the file(s) is/are to be passed through the
  2727.           given command or pipeline on their way to the server. Example:
  2728.           
  2729.   ftp put /binary /filter:{gzip -c \v(filename)} /as-name:\v(filename).gz *
  2730.  
  2731.    /TRANSPARENT
  2732.           
  2733.    /LOCAL-CHARACTER-SET:name
  2734.           
  2735.    /SERVER-CHARACTER-SET:name
  2736.           Character-set translation for text files, explained in
  2737.           [244]Section 3.7.
  2738.           
  2739.    /ERROR-ACTION:{PROCEED,QUIT}
  2740.           Overrides the prevailing [245]FTP ERROR-ACTION for the duration
  2741.           of this PUT or MPUT command only.
  2742.           
  2743.    /RECOVER
  2744.           Resume an interrupted transfer where from the point of
  2745.           interruption (explained in [246]Section 3.5.2). Synonym:
  2746.           /RESTART.
  2747.           
  2748.    /DELETE
  2749.           Tells Kermit to delete each source file immediately after, and
  2750.           only if, it has been uploaded completely and successfully.
  2751.           This, in effect, moves the file from the client to the server.
  2752.           
  2753.    /MOVE-TO:directory
  2754.           Tells Kermit to move each source file to the named local
  2755.           directory after, and only if, it has been uploaded completely
  2756.           and successfully.
  2757.           
  2758.    /RENAME-TO:template
  2759.           Tells Kermit to rename each (local) source file according to
  2760.           the given template after, and only if, it has been uploaded
  2761.           completely and successfully. The template works as in /AS-NAME.
  2762.           
  2763.    /SERVER-RENAME-TO:template
  2764.           Tells Kermit to ask the server to rename each file according to
  2765.           the given template as soon as, and only if, it has been
  2766.           received completely and successfully. The template works as in
  2767.           /AS-NAME. Requires write and rename access on the server, so
  2768.           doesn't usually work with (e.g.) anonymous uploads to public
  2769.           incoming areas where the permissions don't allow renaming.
  2770.           Examples:
  2771.           
  2772.         ftp mput /server-rename:\v(filename).ok *
  2773.                 Appends ".ok" to each filename on the server when it's
  2774.                 finished uploading.
  2775.                 
  2776.         ftp mput /as-name:\v(filename).tmp /server-rename:\v(filename) *
  2777.                 This is the reverse of the previous example; it uses a
  2778.                 temporary name while uploading is in progress and reverts
  2779.                 the file to its real name when uploading is complete.
  2780.                 
  2781.         ftp mput /as-name:\v(filename)
  2782.                 /server-rename:../final/\v(filename) *
  2783.                 Moves the file from the working directory to a final
  2784.                 directory when the upload is complete, but in this case
  2785.                 you have to know the pathname syntax of the server. If
  2786.                 the rename fails, the [M]PUT command fails according to
  2787.                 the [247]FTP ERROR-ACTION selection.
  2788.                 
  2789.    /FILENAMES:{AUTOMATIC,CONVERTED,LITERAL}
  2790.           Overrides the [248]FTP FILENAMES setting for this upload only.
  2791.           
  2792.    /PERMISSIONS:{ON,OFF}
  2793.           Overrides the [249]FTP PERMISSIONS setting for this upload
  2794.           only.
  2795.           
  2796.    /UNIQUE
  2797.           Tells Kermit to tell the server to give [250]unique names to
  2798.           incoming files that would otherwise overwrite existing files
  2799.           that have the same name. This switch conflicts with /UPDATE,
  2800.           /RECOVER, /PERMISSIONS, and /SERVER-RENAME since the client has
  2801.           no way of knowing the name assigned by the server.
  2802.           
  2803.    /QUIET
  2804.           Don't display file-transfer progress or statistics.
  2805.           
  2806.    /SIMULATE
  2807.           Shows which files would be sent without actually sending them.
  2808.           Useful (for example) with /UPDATE (next section). The results
  2809.           are shown in the file-transfer display (if it is not disabled)
  2810.           and in the transaction log (if one is active). Hint: use SET
  2811.           TRANSFER DISPLAY BRIEF.
  2812.      _________________________________________________________________
  2813.    
  2814.     3.5.2. Update Mode
  2815.     
  2816.    When you include the /UPDATE switch, this means to skip sending any
  2817.    file that already exists on the server if the local file's
  2818.    modification date/time is not later than that of the corresponding
  2819.    file on the server. Here is a typical application for update mode:
  2820.    Suppose that on Computer A, you maintain a large set of files (say, a
  2821.    collection of Web pages and graphics images, or the source files for a
  2822.    software application), and you need to keep a parallel copy on another
  2823.    Computer, B. Of course you could upload the entire collection every
  2824.    day:
  2825.    
  2826.   cd source-directory
  2827.   ftp computerb.xyzcorp.com
  2828.   ( authentication details... )
  2829.   ftp cd target-directory
  2830.   ftp put [ switches ] *
  2831.  
  2832.    But if the total size is large or the network slow, this would be
  2833.    unnecessarily time-consuming. Worse, if other users or sites had to
  2834.    update whenever new files appeared in B's directory, this would cause
  2835.    them unnecessary work. By including the /UPDATE switch:
  2836.    
  2837.   ftp put /update [ other-switches ] *
  2838.  
  2839.    only those files that changed since last time are uploaded. Here's how
  2840.    it works. For each local file that is selected for uploading:
  2841.    
  2842.      * The remote filename is determined in the normal way, according to
  2843.        the [251]FTP FILENAMES setting, /FILENAMES switch, or the as-name,
  2844.        if any.
  2845.      * Kermit sends an MDTM (modification time) command for the
  2846.        corresponding remote filename to the server.
  2847.      * If the server does not understand the MDTM command, the file is
  2848.        sent.
  2849.      * If the server can't find a file with the given name, the file is
  2850.        sent.
  2851.      * If the local file's modification time is later than that of the
  2852.        remote file, the file is sent.
  2853.      * Otherwise -- the remote file exists but its modification time is
  2854.        equal to or earlier than that of the local file -- the file is
  2855.        skipped.
  2856.        
  2857.    All time comparisons take place in Coordinated Universal Time
  2858.    (UTC)([252]1), also known as GMT or Zulu time: Timezone 0; standard
  2859.    time, without daylight savings.
  2860.    
  2861.      WARNING: Some FTP servers, such as Novell NWFTPD.NLM, ignore or
  2862.      misimplement the FTP specification and send local time rather than
  2863.      UTC.
  2864.      
  2865.    Update mode is useful only when always used in the same direction.
  2866.    When you transfer a file with FTP, the destination file receives the
  2867.    current timestamp on the receiving computer, not the original file's
  2868.    timestamp ([253]2). If you try to FTP PUT /UPDATE the same file again,
  2869.    it will be skipped (as expected) since the remote copy is newer.
  2870.    However, if you try to FTP GET /UPDATE the same file ([254]Section
  2871.    3.6), it will be transferred for the same reason.
  2872.    
  2873.    To check the availability of PUT /UPDATE on a particular connection,
  2874.    issue an FTP MODTIME command for a file that is known to exist on the
  2875.    server. If it succeeds, PUT /UPDATE should work and in that case, you
  2876.    can run a procedure like the one above every day: the first time, it
  2877.    sends all the files; after that, it sends only the ones that changed.
  2878.    If a transaction log is active, a notation is included for any files
  2879.    that are skipped.
  2880.    
  2881.    Notes:
  2882.     1. Why is Coordinated Universal Time abbreviated UTC? From the
  2883.        [255]National Institute of Standards and Technology FAQ: "In 1970
  2884.        the Coordinated Universal Time system was devised by an
  2885.        international advisory group of technical experts within the
  2886.        International Telecommunication Union (ITU). The ITU felt it was
  2887.        best to designate a single abbreviation for use in all languages
  2888.        in order to minimize confusion. Since unanimous agreement could
  2889.        not be achieved on using either the English word order, CUT, or
  2890.        the French word order, TUC, the acronym UTC was chosen as a
  2891.        compromise."
  2892.     2. The Kermit FTP client is unusual in that, when downloading only,
  2893.        it can set the received file's date from the file's date on the
  2894.        server, but this should not affect the update feature.
  2895.      _________________________________________________________________
  2896.    
  2897.     3.5.3 Recovery
  2898.     
  2899.    Suppose that while you are uploading a large file over a slow
  2900.    connection, the connection is lost before the entire file is
  2901.    transferred. With most FTP clients, you would have to start over, thus
  2902.    resending the portion of the file that was sent already, and that is
  2903.    already on the server. But Kermit's /RECOVER switch (Synonym:
  2904.    /RESTART) lets you continue an interrupted transfer from the point of
  2905.    failure, thus transferring only the part that wasn't sent already. The
  2906.    prerequisites for recovery are:
  2907.    
  2908.      * The transfer must be in BINARY mode, or else the client and server
  2909.        must reside on like systems (e.g. both on some form of UNIX).
  2910.      * The FTP server must support the SIZE command.
  2911.        
  2912.    Here's how it works. When you include the /RECOVER switch:
  2913.    
  2914.      * Kermit checks for conflicting switches, such as /UPDATE and
  2915.        /UNIQUE; if /RECOVER is given with these switches an error occurs.
  2916.        If /RECOVER is given in other circumstances where it could serve
  2917.        no useful purpose (e.g. with arrays, pipes, or filters), it is
  2918.        ignored.
  2919.        
  2920.    If the switch is accepted, then for each selected file:
  2921.    
  2922.      * If it is not binary (determined by scanning) and the client and
  2923.        server are not on like platforms, recovery is canceled (the entire
  2924.        file is sent). Otherwise:
  2925.      * A SIZE command is sent for the file (using its remote name). If
  2926.        the reply indicates the file was not found, or the SIZE command
  2927.        was not understood, or any other kind of error, recovery is
  2928.        canceled. Otherwise:
  2929.      * A MDTM (modification time) command is sent for the file. If a
  2930.        valid reply is received, and the modification time of the local
  2931.        file is later than that of the remote file, recovery is canceled.
  2932.        Otherwise:
  2933.      * If the sizes of the two files are identical, the file is not sent.
  2934.        Otherwise:
  2935.      * Kermit seeks to the recovery spot in the local file, tells the
  2936.        server to APPEND the data which is about to arrive to the remote
  2937.        file, and then sends the data starting at the recovery point.
  2938.        
  2939.    To safeguard file integrity, recovery is not attempted unless all the
  2940.    preconditions are met. For the widest possible usefulness, APPEND is
  2941.    used rather than RESTART. For stream transfers (the only kind that
  2942.    Kermit supports) the results are the same.
  2943.    
  2944.    By design, the /RECOVER switch can be included with any FTP PUT or
  2945.    MPUT command, even if it specifies a group of files. This allows you
  2946.    to resume an interrupted batch transfer from where it left off. The
  2947.    files that were already completely sent are skipped, the file that was
  2948.    interrupted is recovered, and the remaining files are uploaded.
  2949.    
  2950.    By the way, it doesn't matter how the original partial file was
  2951.    uploaded -- FTP, Kermit, Zmodem, etc: as long as the preconditions are
  2952.    met, it can be recovered with FTP PUT /RECOVER, or for that matter
  2953.    also using Kermit protocol and SEND /RECOVER.
  2954.    
  2955.    A word of caution, however, when the original upload was in text mode
  2956.    with character-set translation ([256]Section 3.7):
  2957.    
  2958.      * If the original upload involved a translation from one single-byte
  2959.        character set to another (e.g. Code Page 850 to Latin-1), recovery
  2960.        is safe if you specify the same translations for the recovery. If
  2961.        you don't, the resulting file will contain a mixture of character
  2962.        sets.
  2963.      * If the original upload involved a translation that changed the
  2964.        size of the file (e.g. from an alphabetic Code Page or Latin
  2965.        Alphabet to Unicode, or vice versa), recovery is NOT safe, even if
  2966.        you specify the same translations.
  2967.        
  2968.    Kermit has no way of knowing anything about the previous upload. As a
  2969.    safeguard, an error occurs if you include /RECOVER and also specify a
  2970.    character-set of UCS2 or UTF8, since recovery can't possibly work in
  2971.    that situation. Otherwise, it's up to you to avoid unsafe recovery
  2972.    operations.
  2973.    
  2974.    [ [257]Top ] [ [258]Contents ] [ [259]C-Kermit Home ] [ [260]Kermit
  2975.    Home ]
  2976.      _________________________________________________________________
  2977.    
  2978.   3.6. Downloading Files With FTP
  2979.   
  2980.    Although uploading files with Kermit's FTP client is just as easy and
  2981.    flexible as sending files with Kermit protocol, the same is not always
  2982.    true for downloading because FTP servers lack some of the capabilities
  2983.    of a Kermit server:
  2984.    
  2985.      * If you want to get more than one file, you have to use MGET, not
  2986.        GET, since the underlying FTP protocol is different in the two
  2987.        cases. Kermit can't "autodetect" which one you mean, as it can
  2988.        with PUT and MPUT, since it can't be expected to know the wildcard
  2989.        syntax of the remote platform and/or FTP server (the same is true
  2990.        for all other FTP clients).
  2991.      * Automatic text-binary mode switching is not done by the server. It
  2992.        can be done by the client (Kermit), but in this case it is not
  2993.        based on a file scan (since there is no way for Kermit prescan a
  2994.        server file), but rather on the filename, using C-Kermit 7.0
  2995.        [261]filename patterns.
  2996.      * Some options that are available with FTP PUT can not be used with
  2997.        FTP [M]GET or don't work the same way:
  2998.          /PERMISSIONS (FTP protocol has no mechanism for this).
  2999.          /[NOT-]BEFORE, /[NOT-]AFTER (because of the timezone problem).
  3000.          /RECOVER works only in binary mode.   /RECURSIVE has limited
  3001.        utility.
  3002.        
  3003.    The commands for downloading are:
  3004.    
  3005.    SET FILE DOWNLOAD-DIRECTORY [ directory ]
  3006.           As with Kermit transfers, this command, if given, tells
  3007.           C-Kermit where to store incoming files in the absence of a
  3008.           specific as-name. If not given, incoming files are stored as
  3009.           indicated by the as-name, if any, otherwise in the current
  3010.           directory, just as with Kermit transfers. The more verbose
  3011.           transfer display formats give the full pathname of each
  3012.           received file, and, in case you have trouble finding a
  3013.           downloaded file afterwards, its full path is also listed in the
  3014.           transaction log (if you kept one), and you can also ask Kermit
  3015.           where it went with the [262]WHERE command.
  3016.           
  3017.    SET FTP GET-FILETYPE-SWITCHING { ON, OFF }
  3018.           ON by default, causing Kermit to switch automatically into text
  3019.           or binary mode for each file based on whether its name matches
  3020.           a text pattern or binary pattern. Set this OFF, or use a /TEXT,
  3021.           /BINARY, or /TENEX switch to defeat this feature. Use SHOW
  3022.           PATTERNS to see the current pattern list.
  3023.           
  3024.    [ FTP ] GET [ switches ] filename [ as-name ]
  3025.           Asks the server to send the given file, and if it comes, stores
  3026.           it locally under the given as-name, if any, otherwise under its
  3027.           original name (modified according to the selected filename
  3028.           conversion option), in your download directory, if you have
  3029.           specified one, otherwise in the directory indicated in the
  3030.           as-name, if any, otherwise in your current directory. If you
  3031.           accidentally use a wildcard in the filename ("get *.txt") the
  3032.           server will reply with a message like "File not found" (unless
  3033.           there is a file whose name actually is "*.txt"). If FTP
  3034.           GET-FILETYPE-SWITCHING is ON, and in the absence of any GET
  3035.           switches to override it, the file is transferred in binary mode
  3036.           if it matches any of Kermit's binary name patterns, and in text
  3037.           mode if it matches any of Kermit's text name patterns, and in
  3038.           the prevailing FTP TYPE if it matches none of these patterns.
  3039.           
  3040.    [ FTP ] MGET [ switches ] filespec [ filespec [ filespec [ ... ] ] ]
  3041.           Like GET, but for multiple files. One or more file
  3042.           specifications can be given, and any or all (or none) of them
  3043.           can contain wildcards. The file list may not include an
  3044.           as-name, but you can still give one with /AS-NAME:.
  3045.           
  3046.    In both the FTP GET and MGET commands, any filenames that contain
  3047.    spaces must be enclosed in braces or doublequotes (see [263]Section 5
  3048.    for details).
  3049.    
  3050.    FTP downloads may be interrupted just like Kermit transfers. While the
  3051.    transfer is in progress, type:
  3052.    
  3053.      * X to interrupt the current file and go on to the next file.
  3054.      * Z (or Control-C) to cancel the current file and all remaining
  3055.        files.
  3056.        
  3057.    Before proceeding, a brief word about temporary files. In FTP
  3058.    protocol, the MGET command works by requesting a file list from the
  3059.    server, and then (internally) issuing a GET command for each file. The
  3060.    file list returned by the server can be any size at all, so in case it
  3061.    is huge, we don't store it in memory; instead we put it in a temporary
  3062.    file. For troubleshooting purposes, you should be aware of two points:
  3063.    
  3064.     1. The location of the temporary file is chosen according the TMP or
  3065.        TEMP environment variables. If neither of these variables is
  3066.        defined, you might need to define it. In case there is not enough
  3067.        space on the indicated disk or partition for the server's file
  3068.        list, you might need to either clean up the temporary area, or
  3069.        redefine the environment variable to indicate a different area
  3070.        that has sufficient space.
  3071.     2. If you want to look at the list yourself, use SET FTP DEBUG ON.
  3072.        This tells Kermit to (a) give you the full pathname of the
  3073.        temporary file at the end of each MGET command, and (b) not to
  3074.        delete it, as it normally does.
  3075.      _________________________________________________________________
  3076.    
  3077.     3.6.1. FTP GET Switches
  3078.     
  3079.    The following switches are available with FTP GET and MGET:
  3080.    
  3081.    /TEXT
  3082.           Specifies a text-mode transfer. Overrides the global FTP TYPE
  3083.           setting for the duration of the current command only. All files
  3084.           are downloaded in text mode. Synonym: /ASCII.
  3085.           
  3086.    /BINARY
  3087.           Specifies a binary-mode transfer. Overrides the global FTP TYPE
  3088.           setting for the duration of the current command only. All files
  3089.           are downloaded in binary mode.
  3090.           
  3091.    /TENEX
  3092.           Specifies a special binary transfer mode to be used when
  3093.           getting 8-bit binary files from a 36-bit platform such as
  3094.           TOPS-10, TOPS-20, or TENEX. Overrides the global FTP TYPE
  3095.           setting for the duration of the current command only. All files
  3096.           are downloaded in the special binary mode.
  3097.           
  3098.    /RECOVER
  3099.           This instructs Kermit to try to recover an incomplete download
  3100.           from the point of failure. Works only in binary mode, and only
  3101.           if the server supports the (not-yet-standard) FTP "REST"
  3102.           command. See [264]Section 3.6.3 for details. Synonym: /RESTART.
  3103.           
  3104.    /FILENAMES:{CONVERTED,LITERAL}
  3105.           Overrides the [265]FTP FILENAMES (filename conversion) setting
  3106.           for this download only.
  3107.           
  3108.    /AS-NAME:text
  3109.           For GET, this is equivalent to giving an as-name after the
  3110.           filename. For MGET, this is the only way to specify alternative
  3111.           names for the incoming files. With MGET, the /AS-NAME text
  3112.           should (must) contain a Kermit variable, usually \v(filename)
  3113.           or \v(filenumber). Example:
  3114.           
  3115.   mget /text /as-name:\v(filename).new *.c
  3116.  
  3117.           This gets all ".c" files and stores them with "
  3118.           
  3119.           .new" appended to their names. See the [266]C-Kermit 7.0 Update
  3120.           Notes for details.
  3121.           
  3122.    /COMMAND
  3123.           This specifies that the incoming file is to be written to the
  3124.           standard input of a command, rather than to a file. The command
  3125.           name is the as-name from the GET command or the /AS-NAME
  3126.           argument. If you need to refer to the incoming file's name in
  3127.           the command, use \v(filename). See the description of the
  3128.           regular Kermit [267]GET /COMMAND command for details and
  3129.           examples.
  3130.           
  3131.    /QUIET
  3132.           Transfer the files quietly; don't put up a file-transfer
  3133.           display.
  3134.           
  3135.    /ERROR-ACTION:{QUIT,PROCEED}
  3136.           This switch affects only MGET. If an error occurs with a
  3137.           particular file, this tells whether to go on to the next file
  3138.           (PROCEED) or to stop right away and fail (QUIT). The default is
  3139.           PROCEED.
  3140.           
  3141.    The file selection switches are:
  3142.    
  3143.    /EXCEPT:{pattern} or /EXCEPT:{{pattern}{pattern}{...}}
  3144.           Exception list for MGET; skip downloading any file whose name
  3145.           matches any of the given patterns (when using the second
  3146.           format, up to 8 patterns may be specified). [268]CLICK HERE for
  3147.           syntax details.
  3148.           
  3149.    /SMALLER-THAN:number
  3150.           Download only files whose size is smaller than the given number
  3151.           of bytes (octets). Requires that the FTP server support the
  3152.           SIZE command.
  3153.           
  3154.    /LARGER-THAN:number
  3155.           Download only files whose size is greater than the given number
  3156.           of bytes. Requires that the FTP server support the SIZE
  3157.           command.
  3158.           
  3159.    /NOBACKUPFILES
  3160.           During MGET, don't download any files whose names end with
  3161.           backup suffixes (.~n~ where n is a number).
  3162.           
  3163.    /NODOTFILES
  3164.           During MGET, don't download any files whose names begin with
  3165.           period (.). Equivalent to /EXCEPT:{.*}.
  3166.           
  3167.    /LISTFILE:local-filename
  3168.           The given file contains a list of files to GET, one per line.
  3169.           Filenames in the listfile can contain wildcard characters in
  3170.           the syntax of the server. There is no limit on the number of
  3171.           lines in the listfile.
  3172.           
  3173.    /NAMELIST:local-filename
  3174.           If this switch is given, then instead of actually retrieving
  3175.           the selected files, the GET command retrieves a list of the
  3176.           names of the files that would be retrieved, and places it in
  3177.           the specifed file. The resulting file is an ordinary text file,
  3178.           with one filename per line, suitable for reading by a person,
  3179.           or processing by a computer program, including Kermit itself
  3180.           (FOPEN / FREAD / FWRITE / FCLOSE), and as /FILELIST: file. If
  3181.           the filename is omitted or given as "-" (dash, hyphen), the
  3182.           list goes to the screen. NOTE: if you want a copy of the
  3183.           complete list sent by the server, use SET FTP DEBUG ON, perform
  3184.           an MGET, and the temporary file containing the list will be
  3185.           kept rather than deleted (and Kermit tells you its name).
  3186.           
  3187.    /UPDATE, /COLLISION:keyword
  3188.           Explained in [269]Section 3.6.2.
  3189.           
  3190.    /RECURSIVE
  3191.           This means to try to download an entire directory tree, rather
  3192.           than just files from a particular directory. In fact, FTP
  3193.           protocol does not provide a method to request a recursive
  3194.           download, so this works only if the FTP server does it anyway,
  3195.           without being asked. In this case, Kermit detects that names in
  3196.           the returned file list contain directory separators, and
  3197.           therefore attempts to create the needed directories as the
  3198.           files arrive. But this can work only if the server is on the
  3199.           same kind of platform as the client, so the pathname syntax can
  3200.           be recognized, and also because the server does not switch
  3201.           between text and binary mode, which would be vital for
  3202.           cross-platform transfers. Use with caution. Synonym:
  3203.           /SUBDIRECTORIES.
  3204.           
  3205.    The FTP protocol does not include explicit mechanisms for recursion,
  3206.    so Kermit builds upon what is available. Although an Internet draft
  3207.    describes a mechanism ("MLST") that would allow protocol-driven
  3208.    recursion, similar to Kermit's File Attribute packets (circa 1984), it
  3209.    has not yet attained RFC or standard status, and servers are not yet
  3210.    widely available that offer this feature. In the meantime, the
  3211.    effectiveness of MGET /RECURSIVE depends on the FTP server
  3212.    implementation. If the server returns a recursive list in response to
  3213.    the standard NLST command (whose behavior is ill-defined), Kermit's
  3214.    FTP GET /RECURSIVE command uses it to re-create the remote directory
  3215.    tree locally. When MLST becomes standardized, the Kermit FTP client
  3216.    will be updated to use it.
  3217.    
  3218.    The /BEFORE:, /AFTER:, /NOT-BEFORE:, and /NOT-AFTER: switches are not
  3219.    available for downloading because of the confusion with timezones.
  3220.    Would the given times be in the local timezone, the server's timezone,
  3221.    or GMT? The FTP server's directory listings show its own local times
  3222.    but since we don't know what timezone the server is in, there's no way
  3223.    to reconcile our local times with the server's. Similarly,
  3224.    /PERMISSIONS can't be preserved in downloads because FTP protocol
  3225.    provides no means of querying the server for a file's permission.
  3226.    
  3227.    Source-file disposition switches:
  3228.    
  3229.    /DELETE
  3230.           Each file that is downloaded successfully is to be deleted from
  3231.           the server. Requires the appropriate file access rights on the
  3232.           server.
  3233.           
  3234.    /SERVER-RENAME-TO:template
  3235.           Asks the server to rename each (remote) source file immediately
  3236.           after, and only if, it is sent correctly. See [270]PUT
  3237.           /SERVER-RENAME-TO: for details.
  3238.           
  3239.    Destination-file disposition switches:
  3240.    
  3241.    /TO-SCREEN
  3242.           Displays the incoming file on the screen rather than storing it
  3243.           on disk. If this switch is given, the /RENAME-TO and /MOVE-TO
  3244.           switches are ignored, the file-transfer display is suppressed,
  3245.           and the given file(s) is/are shown on the screen. Can be used
  3246.           with /FILTER, e.g.
  3247.           
  3248.   get /text /to-screen /filter:more oofa.txt
  3249.  
  3250.           In fact, you should always use /TO-SCREEN with /FILTER or
  3251.           /COMMAND when the command would result in displaying the
  3252.           incoming file on the screen; otherwise C-Kermit would have no
  3253.           way of knowing to suppress its file transfer display (since it
  3254.           can't be expected to know what the command or filter does).
  3255.           
  3256.    /RENAME-TO:template
  3257.           Each file that is downloaded is to be renamed as indicated if
  3258.           and only if it was received completely and without error. The
  3259.           template can be literal text or can contain variables that are
  3260.           evaluated for each file. For MGET, the text must contain
  3261.           variables; for GET it can be a literal string. The \v(filename)
  3262.           variable contains the name of the current file, so:
  3263.           
  3264.   ftp mget /rename-to:\v(filename).ok *
  3265.  
  3266.           causes each file that is successfully downloaded to have ".ok"
  3267.           appended to its name. For details see [271]Section 4.1 of the
  3268.           [272]C-Kermit 7.0 Update Notes.
  3269.           
  3270.    /MOVE-TO:text
  3271.           Just like /RENAME-TO:, except the text denotes the name of a
  3272.           directory to which successfully downloaded files are to be
  3273.           moved. If the directory does not exist, it is created.
  3274.           
  3275.    The file transfer display does not show the /MOVE-TO or /RENAME-TO
  3276.    value, since the incoming file has not yet been moved or renamed.
  3277.      _________________________________________________________________
  3278.    
  3279.     3.6.2. Filename Collisions
  3280.     
  3281.    What should happen if an incoming file has the same name as an
  3282.    existing file in the same directory? By default, Kermit's FILE
  3283.    COLLISION setting applies: BACKUP, RENAME, UPDATE, DISCARD, etc, as
  3284.    described in [273]Using C-Kermit. Kermit's default FILE COLLISION
  3285.    setting is BACKUP (rename the existing file and store the incoming
  3286.    file under its own name) and therefore this is also the default FTP
  3287.    collision action.
  3288.    
  3289.    The name under which an incoming file is to be stored is determined as
  3290.    follows:
  3291.    
  3292.      * If an as-name was given, the as-name is used. Otherwise:
  3293.      * If the client and server platforms are alike or [274]FTP FILENAMES
  3294.        is set to LITERAL (or the /FILENAMES:LITERAL switch was given for
  3295.        this download), the incoming filename is used literally.
  3296.        Otherwise:
  3297.      * The incoming filename is converted to a form that is friendly to
  3298.        the local platform. For UNIX, for example, incoming filenames that
  3299.        are all uppercase (as they might be from, say, VMS or an IBM
  3300.        mainframe) are converted to lowercase.
  3301.        
  3302.    If the resulting name coincides with the name of a local file that
  3303.    already exists, we have a filename collision. Collisions are handled
  3304.    according to the currently selected collision action:
  3305.    
  3306.    SET FTP COLLISION { BACKUP, RENAME, UPDATE, DISCARD, APPEND, OVERWRITE
  3307.           }
  3308.           This establishes a filename collision for FTP, separate from
  3309.           the Kermit one. The initial FTP collision setting is inherited
  3310.           from Kermit's FILE COLLISION setting when the first FTP command
  3311.           is given, but subsequent changes to Kermit's FILE COLLISION
  3312.           setting do not affect the FTP COLLISION setting. SHOW FTP tells
  3313.           the current FTP COLLISION setting.
  3314.           
  3315.    FTP GET /COLLISION:{BACKUP,RENAME,UPDATE,DISCARD,APPEND,OVERWRITE}
  3316.           Overrides the current FTP COLLISION action for this download
  3317.           only.
  3318.           
  3319.    FTP GET /UPDATE
  3320.           This is equivalent to GET /COLLISION:UPDATE, and is included
  3321.           for symmetry with PUT /UPDATE
  3322.           
  3323.    FTP GET /UPDATE and /COLLISION:UPDATE mean to download only those
  3324.    files whose modification dates on the server are later than those on
  3325.    the client. Date-time comparisons are done in Coordinated Universal
  3326.    Time (UTC, GMT, ZULU).
  3327.    
  3328.    As when uploading, update mode is effective only when used
  3329.    consistently in one direction. When you download a file with FTP, the
  3330.    local file receives the current timestamp, not the original file's
  3331.    timestamp. If you try to FTP GET /UPDATE the same file again, it is
  3332.    skipped (as expected) since the local copy is newer. However, if you
  3333.    try to FTP PUT /UPDATE the same file, it is sent for the same reason.
  3334.    
  3335.    (It might be possible to set the downloaded file's date from the
  3336.    server file's date but (a) UNIX does not offer the necessary time
  3337.    conversion APIs, and (b) FTP protocol offers no mechanism for doing
  3338.    the same thing in the opposite direction.)
  3339.      _________________________________________________________________
  3340.    
  3341.     3.6.3. Recovery
  3342.     
  3343.    Recovery is available for downloads too, but there are some
  3344.    differences from the uploading case described in [275]Section 3.5.3:
  3345.    
  3346.      * The transfer must be in BINARY mode. It can not be in text mode,
  3347.        even if the FTP server is on the same kind of platform as Kermit,
  3348.        and even if there is no character-set translation. The original
  3349.        download must also have been in binary mode.
  3350.      * The FTP server must support the REST ("restart") command.
  3351.        Unfortunately, this is not a standard command; at this writing, it
  3352.        is described only in an Internet Draft, not an RFC or Internet
  3353.        Standard, but nevertheless it is found in several popular FTP
  3354.        servers, such as [276]ProFTPD.
  3355.        
  3356.    Here's how download recovery works:
  3357.    
  3358.      * Kermit checks for conflicting switches, such as /UPDATE, /COMMAND,
  3359.        or /FILTER. If /RECOVER is given with these switches an error
  3360.        occurs.
  3361.      * The prevailing transfer mode (SET FTP TYPE) must be BINARY. If it
  3362.        is not, the /BINARY switch must have been included with the FTP
  3363.        [M]GET command.
  3364.        If the /RECOVER switch is accepted, then for each selected file:
  3365.      * A SIZE command is sent for the file (using its remote name). If
  3366.        the reply indicates the file was not found, or the SIZE command
  3367.        was not understood, or any other kind of error, recovery is
  3368.        canceled (i.e. the entire file is downloaded). Otherwise:
  3369.      * A MDTM (modification time) command is sent for the file. If a
  3370.        valid reply is received, and the modification time of the remote
  3371.        file is later than that of the local file, recovery is canceled.
  3372.        Otherwise:
  3373.      * If the sizes of the two files are identical, the file is not sent.
  3374.        Otherwise:
  3375.      * Kermit sends the REST command to the server, indicating the size
  3376.        of the local file. If the server responds affirmatively, Kermit
  3377.        opens the local file in append mode and appends the incoming data
  3378.        to it. Otherwise, recovery is canceled and the entire file is
  3379.        downloaded.
  3380.        
  3381.    The /RECOVER switch can be included with any FTP GET or MGET command,
  3382.    even if it specifies a group of files. This lets you resume an
  3383.    interrupted batch transfer from where it left off. The files that were
  3384.    already completely sent are skipped, the file that was interrupted is
  3385.    recovered, and the remaining files are uploaded. BUT... unlike with
  3386.    uploading, where this can be done with any mixture of text and binary
  3387.    files, when downloading, it can only be done if all the files are
  3388.    binary.
  3389.    
  3390.    It doesn't matter how the original partial file was downloaded -- FTP,
  3391.    Kermit, Zmodem, etc: as long as the preconditions are met, it can be
  3392.    recovered with FTP [M]GET /RECOVER, or for that matter also with GET
  3393.    /RECOVER (using Kermit protocol).
  3394.    
  3395.    [ [277]Top ] [ [278]Contents ] [ [279]C-Kermit Home ] [ [280]Kermit
  3396.    Home ]
  3397.      _________________________________________________________________
  3398.    
  3399.   3.7. Translating Character Sets
  3400.   
  3401.    A possibly unique feature of Kermit's FTP client is its ability to
  3402.    convert character sets when transferring files in text mode,
  3403.    independent of the capabilites of the FTP server, as well as to
  3404.    translate the character sets of filenames regardless of transfer mode.
  3405.    For compatibility with existing FTP clients, and because there is a
  3406.    certain performance penalty, Kermit won't do this unless you ask for
  3407.    it. If you enable this feature, you need to inform Kermit of the
  3408.    character set (to be) used on the server and in some cases (explained
  3409.    below) also the local file character set. This discussion assumes you
  3410.    know a bit about character sets (as you must if you have to use them);
  3411.    see Chapter 16 of [281]Using C-Kermit for a detailed treatment. The
  3412.    Kermit commands for FTP character-set conversion are:
  3413.    
  3414.    SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
  3415.           Whether to translate character sets when transferring text
  3416.           files with FTP. OFF by default. Set this to ON to enable
  3417.           character-set translation for subsequent FTP uploads and
  3418.           downloads.
  3419.           
  3420.    SET FTP SERVER-CHARACTER-SET [282]name
  3421.           Text character set (to be) used by the server. Most FTP servers
  3422.           are ignorant of character sets, so all translations are done
  3423.           unilaterally by Kermit's FTP client. This means that when
  3424.           downloading files, you must know in advance the character-set
  3425.           used in the files you are downloading (and in their names).
  3426.           When uploading, you must specify the character-set to which
  3427.           local filenames and text-file contents are to be translated for
  3428.           transmission to the server. If you SET FTP
  3429.           CHARACTER-SET-TRANSLATION ON but do not specify an FTP
  3430.           SERVER-CHARACTER-SET, [283]UTF8 is used, since this is the new
  3431.           Internet standard international character set; it is upwards
  3432.           compatible with ASCII and it encompasses most written languages
  3433.           and therefore does not favor any particular group of people, as
  3434.           any other default would do. If you SET FTP SERVER-CHARACTER-SET
  3435.           to something (anything) when FTP CHARACTER-SET TRANSLATION is
  3436.           OFF, this also sets the latter ON.
  3437.           
  3438.    SET FILE CHARACTER-SET [284]name
  3439.           This is the regular Kermit (non-FTP-specific) command for
  3440.           identifying the character set (to be) used in local text files
  3441.           and filenames.
  3442.           
  3443.    TO REITERATE: If you SET FTP CHARACTER-SET TRANSLATION ON but do not
  3444.    specify an FTP SERVER-CHARACTER-SET, outbound text files are converted
  3445.    to UTF-8 and inbound text files are assumed to be UTF-8. If this is
  3446.    not appropriate, be sure to also specify the desired FTP
  3447.    SERVER-CHARACTER-SET.
  3448.    
  3449.    You can use "special" (non-ASCII) characters in filenames in all the
  3450.    client / server file management commands (FTP MKDIR, RMDIR, DIRECTORY,
  3451.    VDIRECTORY, DELETE, etc), and also in file-transfer commands. When
  3452.    giving commands such as FTP DIR (RDIR) and FTP PWD (RPWD), the reply
  3453.    is translated too, so you can read it. In this example, the client and
  3454.    server use entirely different codes to represent the special
  3455.    characters of German:
  3456.    
  3457.   C-Kermit> ftp xyzcorp.de /anonymous
  3458.   C-Kermit> set ftp server-character-set latin1
  3459.   C-Kermit> set file character-set german
  3460.   C-Kermit> rcd StΣdte
  3461.   C-Kermit> rpwd
  3462.   "/pub/ftp/StΣdte is current directory"
  3463.   C-Kermit> rdir
  3464.   -rw-rw----  1 olaf     54018 Jan  6 17:58 Adenbⁿttel.txt
  3465.   -rw-rw----  1 ursula     373 Jan  5 15:19 A▀lar.txt
  3466.   -rw-rw----  1 gisbert    482 Jan  5 15:20 Blowatz.txt
  3467.   -rw-rw----  1 gudrun     124 Jan  5 15:19 B÷blingen.txt
  3468.   -rw-rw----  1 olga     14348 Jan  7 14:23 K÷ln.txt
  3469.  
  3470.    When the client and server file systems use different character sets,
  3471.    you should take care to use only those characters that the two sets
  3472.    share in common when creating filenames or text-file contents. For
  3473.    example, PC code pages contain a lot line- and box-drawing characters,
  3474.    and sometimes "smart quotes", etc, that are not found in ISO standard
  3475.    8-bit character sets. You should be especially careful to avoid using
  3476.    such characters in filenames.
  3477.    
  3478.    [ [285]C-Kermit Character Sets ]
  3479.      _________________________________________________________________
  3480.    
  3481.     3.7.1. Character Sets and Uploading
  3482.     
  3483.    Kermit's PUT and MPUT commands include full file-scanning
  3484.    capabilities, as described in [286]Section 4. Thus if FTP
  3485.    CHARACTER-SET-TRANSLATION is ON and your character-set associations
  3486.    are set up appropriately, Kermit automatically switches on a per-file
  3487.    basis between text and binary mode, and for each text file between
  3488.    your chosen 7-bit text character set (e.g. ASCII or ISO 646 German),
  3489.    8-bit text (e.g. Latin-1 or Japanese EUC), UCS-2, and UTF-8, and
  3490.    converts each of these automatically to the server character-set, and
  3491.    furthermore automatically differentiates between the Little and Big
  3492.    Endian forms of UCS-2, always sending in Big Endian form.
  3493.    
  3494.      WARNING: It is not advisable to use UCS-2 (or any Unicode
  3495.      transformation other than UTF-8) "on the wire", i.e. as a server
  3496.      character set. Most FTP servers are not able to cope with it, since
  3497.      it contains lots of 0 (NUL) characters. If you do use it, Kermit
  3498.      does not translate filenames to or from UCS-2, for reasons well
  3499.      known to C programmers (for example, UNIX APIs assume filename
  3500.      strings are NUL-terminated). [287]UTF-8 is the preferred (and
  3501.      standard) Unicode format for the Internet.
  3502.      
  3503.    FTP character-set translations differ from the regular Kermit ones by
  3504.    not restricting translations to a file-character-set /
  3505.    transfer-character-set pair. You can have Kermit's FTP client
  3506.    translate between any pair of character sets it knows about. You can
  3507.    see the list of supported character sets by typing either of the
  3508.    following:
  3509.    
  3510.   set ftp server-character-set ?
  3511.   set file character-set ?
  3512.  
  3513.    A typical list looks like this ([288]CLICK HERE for an explanation of
  3514.    the names):
  3515.    
  3516.   C-Kermit>set file char ? One of the following:
  3517.    ascii            cp869-greek       hebrew-7         mazovia-pc
  3518.    british          cyrillic-iso      hebrew-iso       next-multinational
  3519.    bulgaria-pc      danish            hp-roman8        norwegian
  3520.    canadian-french  dec-kanji         hungarian        portuguese
  3521.    cp1250           dec-multinational iso2022jp-kanji  shift-jis-kanji
  3522.    cp1251-cyrillic  dg-international  italian          short-koi
  3523.    cp1252           dutch             jis7-kanji       spanish
  3524.    cp437            elot927-greek     koi8             swedish
  3525.    cp850            elot928-greek     koi8r            swiss
  3526.    cp852            euc-jp            koi8u            ucs2
  3527.    cp855-cyrillic   finnish           latin1-iso       utf8
  3528.    cp858            french            latin2-iso
  3529.    cp862-hebrew     german            latin9-iso
  3530.    cp866-cyrillic   greek-iso         macintosh-latin
  3531.   C-Kermit>
  3532.  
  3533.    Thus you can translate not only between private sets (like PC code
  3534.    pages) and standard ones (like Latin-1) as in Kermit protocol, but
  3535.    also between any given pair of private sets (e.g. CP852 and Mazovia).
  3536.    All conversions go through Unicode as the intermediate character set,
  3537.    resulting in a minimum of character loss, since Unicode is a superset
  3538.    of all other character sets known to Kermit.
  3539.    
  3540.    In addition to the SET commands listed above, the FTP PUT and MPUT
  3541.    commands include switches that apply only to the current command:
  3542.    
  3543.    /LOCAL-CHARACTER-SET:name
  3544.           
  3545.    /SERVER-CHARACTER-SET:name
  3546.           Use these switches to force a particular translation. These
  3547.           switches override the global FTP CHARACTER-SET-TRANSLATION and
  3548.           SERVER-CHARACTER-SET settings and also character-set
  3549.           differentiation by file scanning for the duration of the PUT or
  3550.           MPUT command. The file scan is still performed, however, to
  3551.           determine whether the file is text or binary; thus these
  3552.           switches do not affect binary files unless you also include the
  3553.           /TEXT switch to force all files to be treated as text.
  3554.           
  3555.    In other words, if you include one or both of these switches with a
  3556.    PUT or MPUT command, they are used. Similarly, the /TRANSPARENT switch
  3557.    disables character-set translation for the PUT or MPUT command despite
  3558.    the prevailing FTP CHARACTER-SET-TRANSLATION and SERVER-CHARACTER-SET
  3559.    settings.
  3560.    
  3561.    When uploading, the FILE CHARACTER-SET setting is ignored unless you
  3562.    have forced Kermit not to [289]scan local files by including a /TEXT
  3563.    or /BINARY switch with your [M]PUT command, or by disabling automatic
  3564.    text/binary switching in some other way.
  3565.    
  3566.    Examples:
  3567.    
  3568.     1. Suppose you have a CP852 (East European) text file that you want
  3569.        to upload and store in ISO Latin Alphabet 2 encoding:
  3570.  
  3571.   ftp put /local-char:cp852 /server-char:latin2 magyar.txt
  3572.     2. Suppose you always want your text files converted to Latin-2 when
  3573.        uploading with FTP. Then put:
  3574.  
  3575.   set ftp server-character-set latin2
  3576.        in your Kermit customization file, and then you can omit the
  3577.        /SERVER-CHARACTER-SET: switch from your FTP PUT commands:
  3578.  
  3579.   ftp put /local-char:cp852 magyar.txt
  3580.     3. Now suppose that all the text files on your PC are written in
  3581.        Hungarian, but they have a variety of encodings, and you don't
  3582.        want to have to include the /LOCAL-CHARACTER-SET: switch on every
  3583.        FTP PUT command, or (more to the point) you want to be able to
  3584.        send a mixture of these files all at once. Put these commands in
  3585.        your Kermit customization file:
  3586.  
  3587.   set ftp server-character-set latin2            ; ISO 8859-2
  3588.   set file default 7-bit-character-set hungarian ; ISO 646 Hungarian
  3589.   set file default 8-bit-character-set cp852     ; PC East European Code Page
  3590.        and now PUT and MPUT will automatically detect and switch among
  3591.        ISO 646 Hungarian, Code Page 852, UTF-8, and UCS-2 encodings,
  3592.        translating each one to Latin-2 for uploading:
  3593.  
  3594.   ftp put *.txt
  3595.  
  3596.    And since binary files are also detected automatically, the latter can
  3597.    be simplified to:
  3598.    
  3599.   ftp put *
  3600.  
  3601.    even when "*" matches a diverse collection of binary and text files,
  3602.    because translations are skipped automatically for binary files.
  3603.      _________________________________________________________________
  3604.    
  3605.     3.7.2. Character Sets and Downloading
  3606.     
  3607.    The commands and switches are the same as for uploading, but automatic
  3608.    character-set switching works differently, since Kermit can't scan the
  3609.    server files in advance. Instead, the transfer mode (text or binary)
  3610.    is based on the filenames; each name is compared with Kermit's list of
  3611.    text name patterns and binary name patterns. If the name matches a
  3612.    binary pattern (for example, if the filename is oofa.tar.gz and one of
  3613.    the filename patterns is "*.gz"), the file is downloaded in binary
  3614.    mode; otherwise if it matches a text pattern (e.g. oofa.txt matches
  3615.    "*.txt"), it is transferred in text ("ascii") mode. Otherwise, it is
  3616.    transferred in the prevailing FTP TYPE.
  3617.    
  3618.    In C-Kermit 8.0, the pattern lists used with FTP GET are not the same
  3619.    lists used with Kermit transfers, and can not be viewed with SHOW
  3620.    PATTERNS, nor adjusted with ADD and REMOVE TEXT-PATTERNS and
  3621.    BINARY-PATTERNS, or SET FILE TEXT-PATTERNS and BINARY-PATTERNS.
  3622.    Configuration of the FTP patterns list will be added in a future
  3623.    release.
  3624.    
  3625.    Examples:
  3626.    
  3627.    get /server-char:latin1 /local-char:cp850 Grⁿ▀e.txt
  3628.           In this command, the filename contains special characters,
  3629.           which you enter using whatever character set your local
  3630.           computer uses, in this case PC Code Page 850 (cp850). The
  3631.           command tells Kermit (in case it didn't know already from its
  3632.           FILE CHARACTER-SET setting) that the local character set is
  3633.           cp850 and the server's character-set is ISO 8859-1 Latin
  3634.           Alphabet 1 (latin1). Kermit translates the filename from cp850
  3635.           to latin1 and sends the latin1 name to the server. Since it's a
  3636.           text file (matches "*.txt"), its contents are translated to
  3637.           cp850 on arrival, and it is saved with a cp850 name.
  3638.           
  3639.    mget /text /server:latin1 /local:utf8 *.txt
  3640.           This command:
  3641.           
  3642.           + Tells C-Kermit that the server's files are encoded in ISO
  3643.             8859-1 Latin Alphabet 1.
  3644.           + Tells C-Kermit to translate the incoming files into Unicode
  3645.             UTF-8 for storage.
  3646.           + Asks the server to send all ".txt" files in text mode.
  3647.             
  3648.    mget /server:latin1 /local:utf8 *
  3649.           Tells Kermit to get all files from the server's directory,
  3650.           switching between text and binary mode based on the filename.
  3651.           The names of all the files are translated (to UTF-8 in this
  3652.           case), but contents are translated (also to UTF-8) only for
  3653.           text files.
  3654.           
  3655.    Note that any pair of 8-bit character sets is likely to have some
  3656.    incompatibilities. Any characters in the source file that do not have
  3657.    equivalents in the destination file's character set are converted to
  3658.    question marks. This applies to both filenames and to text file
  3659.    contents.
  3660.    
  3661.    Also note that the server's ability to accept special characters in
  3662.    filenames depends on the particular server. For example:
  3663.    
  3664.   get Grⁿ▀e.txt
  3665.  
  3666.    works with WU-FTPD, but:
  3667.    
  3668.   mget Grⁿ▀*.txt
  3669.  
  3670.    does not.
  3671.      _________________________________________________________________
  3672.    
  3673.     3.7.3. RFC2640
  3674.     
  3675.    [290]RFC2640, July 1999, specifies a method by which the FTP client
  3676.    and server can negotiate the use of UTF8. However, RFC2640-capable
  3677.    servers are rare to nonexistent at this writing, and in any case you
  3678.    don't need them to be able to transfer text in UTF8. C-Kermit lets you
  3679.    upload and download text files in any character set it knows about,
  3680.    converting to or from any other character set it knows about, without
  3681.    the knowledge, permission, or cooperation of the server, and
  3682.    regardless of its capabilities.
  3683.    
  3684.    [ [291]Top ] [ [292]Contents ] [ [293]C-Kermit Home ] [ [294]Kermit
  3685.    Home ]
  3686.      _________________________________________________________________
  3687.    
  3688.   3.8. FTP Command Shortcuts
  3689.   
  3690.    C-Kermit's FTP client coexists with other C-Kermit functions by
  3691.    requiring the "ftp" prefix for each FTP-related command: FTP OPEN, FTP
  3692.    GET, FTP BYE, and so on. For interactive use, however, this can be
  3693.    rather awkward and sometimes surprising, for example when a GET
  3694.    command starts a Kermit GET rather than an FTP GET. In fact, many
  3695.    Kermit commands might just as easily apply to an FTP connection: GET,
  3696.    PUT (SEND), BYE, and CLOSE. The following command lets you choose how
  3697.    these commands are interpreted:
  3698.    
  3699.    SET GET-PUT-REMOTE { AUTO, KERMIT, FTP }
  3700.           Controls the orientation of GET, PUT, REMOTE and other
  3701.           file-transfer and client/server commands that might apply to
  3702.           either Kermit or FTP. The default setting is AUTO, meaning that
  3703.           these commands apply to FTP if an FTP connection is open, and
  3704.           to Kermit otherwise. KERMIT means they always apply to Kermit,
  3705.           FTP means they always apply to FTP.
  3706.           
  3707.    Here is a complete list of affected commands:
  3708.    
  3709.  Kermit Command               FTP Equivalent
  3710.   (none)                       FTP [ OPEN ]
  3711.   LOGIN                        FTP USER
  3712.   LOGOUT                       FTP RESET
  3713.   BYE                          FTP BYE
  3714.   FINISH                       FTP BYE
  3715.   CLOSE                        FTP BYE
  3716.   HANGUP                       FTP BYE
  3717.   BINARY                       FTP TYPE BINARY
  3718.   TEXT (or ASCII)              FTP TYPE ASCII
  3719.   SEND (or PUT)                FTP PUT
  3720.   MSEND (or MPUT)              FTP MPUT
  3721.   RESEND                       FTP PUT /RECOVER
  3722.   CSEND                        FTP PUT /COMMAND
  3723.   GET                          FTP GET
  3724.   MGET                         FTP MGET
  3725.   REGET                        FTP GET /RECOVER
  3726.   REMOTE HELP      (RHELP)     FTP HELP
  3727.   REMOTE CD        (RCD)       FTP CD (CWD)
  3728.   REMOTE PWD       (RPWD)      FTP PWD
  3729.   REMOTE DIRECTORY (RDIR)      FTP DIRECTORY
  3730.   REMOTE DELETE    (RDEL)      FTP DELETE
  3731.   REMOTE MKDIR     (RMKDIR)    FTP MKDIR
  3732.   REMOTE RMDIR     (RRMDIR)    FTP RMDIR
  3733.   REMOTE RENAME    (RRENAME)   FTP RENAME
  3734.   REMOTE TYPE      (RTYPE)     FTP TYPE
  3735.   REMOTE EXIT      (REXIT)     FTP BYE
  3736.  
  3737.    The commands in the right-hand column always access FTP. The commands
  3738.    in the left column can access either Kermit protocol or FTP:
  3739.    
  3740.      * When GET-PUT-REMOTE is set to KERMIT, or to AUTO when there is no
  3741.        FTP connection, the commands in the left-hand column access Kermit
  3742.        protocol, and those right-hand column are required for FTP.
  3743.      * When GET-PUT-REMOTE is set to FTP, or to AUTO when there is an
  3744.        active FTP connection, the commands in the left-hand column access
  3745.        the FTP connection and can not be used to access Kermit protocol.
  3746.        In this case, if you want to be able to use both Kermit protocol
  3747.        and the FTP connection, you must SET GET-PUT-REMOTE KERMIT, and
  3748.        then use the FTP commands in the right-hand column to access the
  3749.        FTP connection.
  3750.        
  3751.    Note that file-management commands such as DIRECTORY, DELETE, CD, PWD,
  3752.    MKDIR, RMDIR, HELP, RENAME, COPY, TYPE, and so on, always apply
  3753.    locally, no matter what kind of connection you have. This is the
  3754.    opposite of most FTP clients, where these commands are intended for
  3755.    the server, and require an "L" prefix for local execution (e.g. "dir"
  3756.    gets a directory listing from the server, "ldir" gets a local
  3757.    directory listing). To illustrate with the CD command and a typical
  3758.    UNIX FTP client:
  3759.    
  3760.  Client   Server      Change Local Directory     Change Remote Directory
  3761.   FTP      FTP         lcd                        cd (cwd)
  3762.   Kermit   Kermit      cd                         rcd, remote cd
  3763.   Kermit   FTP         cd                         ftp cd, rcd, remote cd
  3764.  
  3765.    Also note that not all REMOTE commands are useful with FTP, since FTP
  3766.    servers do not offer the corresponding functions. These include:
  3767.    
  3768.      * REMOTE ASSIGN  - FTP servers don't have variables
  3769.      * REMOTE COPY    - FTP servers don't copy files
  3770.      * REMOTE HOST    - FTP servers don't execute host (shell) commands
  3771.      * REMOTE KERMIT  - FTP servers don't execute Kermit commands
  3772.      * REMOTE PRINT   - FTP servers don't print files
  3773.      * REMOTE QUERY   - FTP servers don't have variables
  3774.      * REMOTE SET     - FTP servers don't have Kermit settings
  3775.      * REMOTE WHO     - FTP servers don't send user lists
  3776.        
  3777.    Finally note that command shortcuts do not apply to the HELP command.
  3778.    For help about an FTP command, use (for example) "help ftp delete",
  3779.    not "help delete" or "help rdelete".
  3780.    
  3781.    [ [295]Top ] [ [296]Contents ] [ [297]C-Kermit Home ] [ [298]Kermit
  3782.    Home ]
  3783.      _________________________________________________________________
  3784.    
  3785.   3.9. Dual Sessions
  3786.   
  3787.    You can have an FTP session open at the same time as a regular Kermit
  3788.    SET LINE or SET HOST (terminal) session. In this case, the default SET
  3789.    GET-PUT-REMOTE AUTO setting should ensure that all "two-faced"
  3790.    commands like GET, PUT, REMOTE, HANGUP, BYE, etc, apply to the Kermit
  3791.    session, and all commands for the FTP session must include the FTP
  3792.    prefix. To be absolutely certain, you can use SET GET-PUT-REMOTE
  3793.    KERMIT.
  3794.    
  3795.   ftp foo.bar.baz.com
  3796.   if fail ...
  3797.   (log in)
  3798.   set host foo.bar.baz.com
  3799.   if fail ...
  3800.   (log in)
  3801.  
  3802.    Now you have both an FTP and Telnet connection to the same host (of
  3803.    course they could also be to different hosts, and you could also have
  3804.    a direct or dialed serial connection instead of a Telnet connection).
  3805.    Now assuming you have a Kermit server on the far end of the Kermit
  3806.    connection:
  3807.    
  3808.   rcd incoming      ; Changes Kermit server's directory (= REMOTE CD)
  3809.   ftp cd incoming   ; Changes FTP server's directory
  3810.   put oofa.txt      ; Sends a file on the Kermit connection
  3811.   ftp put oofa.txt  ; Sends a file on the FTP connection
  3812.   bye               ; Shuts down the Kermit connection
  3813.   ftp bye           ; Shuts down the FTP connection
  3814.  
  3815.    Note that PUT and SEND are synonyms for both FTP and Kermit
  3816.    connections.
  3817.    
  3818.    You can also establish dual sessions on the Kermit command line:
  3819.    
  3820.   kermit -j host1 -9 host2
  3821.  
  3822.    This makes a Telnet connection to host1 and an FTP connection to
  3823.    host2.
  3824.    
  3825.    [ [299]Top ] [ [300]Contents ] [ [301]C-Kermit Home ] [ [302]Kermit
  3826.    Home ]
  3827.      _________________________________________________________________
  3828.    
  3829.   3.10. Automating FTP Sessions
  3830.   
  3831.    Most of Kermit's scripting features can be used to make and control
  3832.    FTP sessions: FOR and WHILE loops, IF-ELSE and SWITCH constructions,
  3833.    variables, arrays, built-in functions, and all the rest. You can't use
  3834.    INPUT, MINPUT, OUTPUT, CLEAR, or SCRIPT on an FTP session, but these
  3835.    are not needed since the FTP protocol is well defined.
  3836.    
  3837.    [303]CLICK HERE for an FTP scripting tutorial.
  3838.    
  3839.     3.10.1. FTP-Specific Variables and Functions
  3840.     
  3841.    The following variable tells whether an FTP connection is open:
  3842.    
  3843.    \v(ftp_connected)
  3844.           1 if there is an active FTP connection, 0 if there isn't.
  3845.           
  3846.    The FTP OPEN command sets:
  3847.    
  3848.    \v(ftp_host)
  3849.           The host to which the most recent FTP connection was made.
  3850.           
  3851.    \v(ftp_security)
  3852.           The security method negotiated for the current FTP session. The
  3853.           value is "NULL" when no security is used. See [304]3.2. Making
  3854.           Secure FTP Connections.
  3855.           
  3856.    \v(ftp_server)
  3857.           The OS type (UNIX, VMS, etc) of the FTP server host.
  3858.           
  3859.    The FTP USER command (or FTP OPEN /USER:, or FTP with automatic login)
  3860.    sets:
  3861.    
  3862.    \v(ftp_loggedin)
  3863.           1 if you are logged in to an FTP server, 0 if you are not.
  3864.           
  3865.    The current COMMAND-PROTECTION-LEVEL and DATA-PROTECTION-LEVEL values
  3866.    are reflected in:
  3867.    
  3868.    \v(ftp_cpl)
  3869.           
  3870.    \v(ftp_dpl)
  3871.           The values are "clear", "confidential", "safe" or "private".
  3872.           See [305]3.2. Making Secure FTP Connections.
  3873.           
  3874.    The FTP GET-PUT-REMOTE setting is reflected in:
  3875.    
  3876.    \v(ftp_getputremote)
  3877.           The values are "auto", "ftp", or "kermit".
  3878.           
  3879.    Every FTP command sets the \v(success) variable, as well as the
  3880.    following two FTP-specific variables:
  3881.    
  3882.    \v(ftp_code)
  3883.           The standardized numeric FTP protocol code from the server's
  3884.           response to the last client command, a 3-digit decimal number
  3885.           defined in [306]RFC959. Briefly:
  3886.           
  3887.           1xx = Positive Preliminary Reply
  3888.           2xx = Positive Completion Reply
  3889.           3xx = Positive Intermediate Reply
  3890.           4xx = Transient Negative Completion Reply
  3891.           5xx = Permanent Negative Completion Reply
  3892.           
  3893.    \v(ftp_message)
  3894.           The text message, if any, from the server's response to the
  3895.           last client command. If the most recent response had multiple
  3896.           lines, this variable has only the final line. These messages
  3897.           are not standardized and vary in format and content from server
  3898.           to server. Synonym: \v(ftp_msg).
  3899.           
  3900.    FTP file transfers set the regular Kermit transfer status variables:
  3901.    
  3902.   \v(cps)         Characters per second of most recent transfer.
  3903.   \v(filespec)    File specification used in most recent transfer.
  3904.   \v(fsize)       Size of file most recently transferred.
  3905.   \v(tfsize)      Total size of file group most recently transferred.
  3906.   \v(xferstatus)  Status of most recent transfer (0 = success, 1 = failure).
  3907.   \v(tftime)      Elapsed time of most recent transfer, in seconds.
  3908.  
  3909.    During an FTP transfer, the per-file variables are:
  3910.    
  3911.   \v(filename)    Name of current file.
  3912.   \v(filenumber)  Ordinal file number in group (1, 2, 3, ...)
  3913.      _________________________________________________________________
  3914.    
  3915.     3.10.2. Examples
  3916.     
  3917.    Let's begin with a simple example showing how to log in, send some
  3918.    files, and log out:
  3919.    
  3920.   define error if fail { ftp bye, stop 1 Error: \%1 }
  3921.   set transact brief
  3922.   log t
  3923.   ftp ftp.xyzcorp.com /anonymous
  3924.   if fail stop 1 Connection failed
  3925.   if not \v(ftp_loggedin) stop 1 Login failed
  3926.   ftp cd incoming
  3927.   error {ftp cd}
  3928.   cd upload
  3929.   error {local cd}
  3930.   ftp put /delete *
  3931.   error {put}
  3932.   ftp bye
  3933.  
  3934.    First we define an error handling macro to be used after the
  3935.    connection is made. Then we set up a brief-format transaction log to
  3936.    keep a record of our file transfers. Then we make a connection to the
  3937.    host and log in anonymously. The "if fail" command checks whether the
  3938.    connection was made. The "if not" command checks whether login was
  3939.    successful. Obviously the script should not continue unless both tests
  3940.    succeed.
  3941.    
  3942.    Next we change to the server's 'incoming' directory and to our own
  3943.    'upload' directory, and send all the files that are in it (they can be
  3944.    any mixture of text and binary files), deleting each source file
  3945.    automatically after it is successfully uploaded. Each of these
  3946.    operations is checked with the ERROR macro, which prevents the script
  3947.    from continuing past a failure.
  3948.    
  3949.    Finally we close the FTP session with the "bye" command.
  3950.    
  3951.    Just like any other Kermit script, this one can be used in many ways:
  3952.    
  3953.      * It can be stored in a file, and Kermit can be told to TAKE the
  3954.        file.
  3955.      * In UNIX, it can be a "[307]kerbang" script and therefore run
  3956.        directly from the shell prompt or as a cron job.
  3957.        
  3958.    We could have used command shortcuts like "rcd", "put", and "bye", but
  3959.    since they can be ambiguous under certain circumstances, it is better
  3960.    to avoid them in scripts; they are intended mainly for convenience
  3961.    during interactive use. However, if you wish to use the shortcuts in a
  3962.    script, you can do it this way (error handling omitted for brevity):
  3963.    
  3964.   local \%t                       ; Declare a local temporary veriable
  3965.   assign \%t \v(ftp_getputremote) ; Save current FTP GET-PUT-REMOTE setting
  3966.   set ftp get-put-remote ftp      ; Choose FTP orientation
  3967.   ftp xyzcorp.com /anonymous      ; Open an FTP connection
  3968.   get oofa.txt                    ; GET a file
  3969.   put foo.bar                     ; PUT a file
  3970.   rdel yesterday.log              ; Delete a file on the server
  3971.   bye                             ; Log out and disconnect from server.
  3972.   set ftp get-put-remote \%t      ; Restore previous GET-PUT-REMOTE setting
  3973.  
  3974.    Of course, FTP scripts can also be written as macros. This lets you
  3975.    pass parameters such as hostnames, usernames, and filenames to them:
  3976.    
  3977.   define doftpget {
  3978.       if < \v(argc) 4 end 1 Usage: \%0 host user remotefile [ localfile ]
  3979.       ftp \%1 /user:\%2
  3980.       if fail end 1 FTP OPEN \%1 failed
  3981.       if not \v(ftp_loggedin) end 1 FTP LOGIN failed
  3982.       ftp get {\%3} {\%4}
  3983.       if fail end 1 FTP GET \%3 failed
  3984.       ftp bye
  3985.   }
  3986.  
  3987.    Add this definition to your Kermit customization file, and it will
  3988.    always be available when you start Kermit (unless you start it in a
  3989.    way that bypasses the normal initialization file). This macro lets you
  3990.    download a file with FTP by giving a single command, e.g.:
  3991.    
  3992.   doftpget xyzcorp.com anonymous oofa.txt
  3993.  
  3994.    [308]CLICK HERE to visit the Kermit FTP script-writing tutorial.
  3995.    
  3996.    [ [309]Top ] [ [310]Contents ] [ [311]C-Kermit Home ] [ [312]Kermit
  3997.    Home ]
  3998.      _________________________________________________________________
  3999.    
  4000.   3.11. Advanced FTP Protocol Features
  4001.   
  4002.    FEAT and NLST are not supported by C-Kermit since they are not yet
  4003.    standardized, nor can they be found in most FTP servers at this
  4004.    writing. Similarly for the various mail-sending options.
  4005.    
  4006.    [ [313]Top ] [ [314]Contents ] [ [315]C-Kermit Home ] [ [316]Kermit
  4007.    Home ]
  4008.   __________________________________________________________________________
  4009.  
  4010. 4. FILE SCANNING
  4011.  
  4012.    A new feature called file scanning is used in various contexts to
  4013.    determine if a file is text or binary, and if it is text, what kind of
  4014.    text. The overhead of file scanning is surprisingly tolerable, usually
  4015.    about a quarter second per file. File scanning is now used instead of
  4016.    filename patterns unless you SET FILE SCAN OFF, which restores the
  4017.    previous behavior.
  4018.    
  4019.    The primary benefit of file scanning is in file transfer. For all
  4020.    practical purposes, now you can stop worrying about whether a file
  4021.    should be sent in binary or text mode, or about sending mixtures of
  4022.    text and binary files in a single operation, or configuring and
  4023.    fine-tuning your lists of binary-file and text-file name patterns: now
  4024.    it all just works.
  4025.    
  4026.    File scanning is done by the file sender, which determines the type of
  4027.    each file before it sends it and informs the receiver (Kermit or FTP
  4028.    server) of the type. File scanning is NOT done by the receiver,
  4029.    because it is the sender's responsibility to determine each file's
  4030.    type, send the file in the right mode, and inform the receiver of the
  4031.    mode. If both transfer partners are capable of this (or any other)
  4032.    form of automatic text/binary mode switching, then files can be sent
  4033.    in both directions with no worries about corruption due to
  4034.    inappropriate transfer mode. (As noted in [317]Section 3, FTP servers
  4035.    don't do this, so this discussion does not apply when using Kermit to
  4036.    download from an FTP server.)
  4037.    
  4038.    The rest of this section is mainly for the curious. If you don't read
  4039.    it and simply accept all defaults, every file you send should go in
  4040.    the appropriate mode automatically. As always, however, for
  4041.    character-set translation to work for 7- and 8-bit character-set
  4042.    files, the appropriate SET FILE CHARACTER-SET command(s) must have
  4043.    been executed to identify their encoding (Kermit's default file
  4044.    character-set is neutral ASCII except on platforms like HP-UX or
  4045.    DG/UX, where the default file character-set is known). And of course,
  4046.    receiving is another matter -- obviously the other Kermit must also
  4047.    send each file in the appropriate mode.
  4048.    
  4049.    Scanning is more reliable than filename patterns simply because
  4050.    filenames are not reliable indicators of the file's contents. Classic
  4051.    examples include ".doc" files, which are binary if Microsoft Word
  4052.    documents but text on most other platforms, and ".com" files, which
  4053.    are binary on DOS and Windows but text on VMS. Anyway, nobody knows
  4054.    the naming conventions (if any) of all the applications (and persons!)
  4055.    on your computer. Scanning, on the other hand, determines each file's
  4056.    type by inspecting its contents rather than just looking at its name.
  4057.    
  4058.    Also, file patterns -- even when they work as intended -- categorize
  4059.    each file only as text or binary, whereas file scanning can make finer
  4060.    distinctions:
  4061.    
  4062.    BINARY
  4063.           Binary data, not to be converted in any way. Examples include
  4064.           binary machine code (executable programs), graphics images
  4065.           (GIF, JPG, etc), compressed files (Z, GZ, etc), archives and
  4066.           packages (ZIP, TAR, RPM, etc), object files and libraries (OBJ,
  4067.           DLL, etc).
  4068.           
  4069.    7-BIT TEXT
  4070.           Text encoded in a 7-bit character set such as ASCII or one of
  4071.           the ISO 646 national versions. Kermit has no way to tell which
  4072.           character is used, only that it's 7-bit text. Typical examples
  4073.           include program source code, README files, Perl or Kermit
  4074.           scripts, plain-text email, HTML, TeX, and various textual
  4075.           encodings of binary files: Hex, Base64, etc. When sending such
  4076.           files, the FILE DEFAULT 7BIT-CHARACTER-SET is used as the file
  4077.           character-set, and then the appropriate transfer character set
  4078.           is chosen from the associations list (ASSOCIATE, SHOW
  4079.           ASSOCIATIONS).
  4080.           
  4081.    8-BIT TEXT
  4082.           Text encoded in an 8-bit character set such as Latin-1,
  4083.           Latin-2, Latin/Hebrew, Latin/Cyrillic, KOI8, HP-Roman8, JIS X
  4084.           0208, Code Page 437, or Code Page 1252. Again, Kermit has no
  4085.           way of knowing which particular set is in use, only that it's
  4086.           8-bit text. When sending such files, the FILE DEFAULT
  4087.           8BIT-CHARACTER-SET is used as the file character-set, and then
  4088.           the appropriate transfer character set is chosen from the
  4089.           associations list.
  4090.           
  4091.    UCS2 TEXT
  4092.           Unicode in its basic form, 16 bits (2 octets) per character.
  4093.           When sending such files, UCS2 is the file character-set and the
  4094.           byte order is identified automatically; the appropriate
  4095.           transfer character set is chosen from the associations list.
  4096.           Normally this would be UTF8. UTF-16 is not supported yet;
  4097.           Kermit's Unicode translations are restricted to Plane 0, the
  4098.           Base Multilingual Plane (BMP).
  4099.           
  4100.    UTF8 TEXT
  4101.           Unicode in its 8-bit transformation format. When sending such
  4102.           files, UTF8 is the file character-set; the appropriate transfer
  4103.           character set is chosen from the associations list, normally
  4104.           UCS2 or UTF8.
  4105.           
  4106.    File scanning is available in UNIX C-Kermit, in K-95, and to a limited
  4107.    extent, in VMS C-Kermit (full scanning is problematic in VMS because
  4108.    even plain-text files might contain binary record-format information).
  4109.    The relevant commands are:
  4110.    
  4111.    SET TRANSFER MODE { AUTOMATIC, MANUAL }
  4112.           Tells whether the file-transfer mode (text or binary) should be
  4113.           set by automatic or "manual" means. AUTOMATIC is the default,
  4114.           which allows any of the automatic methods that are enabled to
  4115.           do their jobs: FILE SCAN, FILE PATTERNS, peer recognition, etc.
  4116.           MANUAL lets you control the transfer mode with the SET FILE
  4117.           TYPE commands. As always, /TEXT and /BINARY switches on your
  4118.           file-transfer commands override all other methods; if you give
  4119.           one of these switches, scanning is not done. SHOW TRANSFER
  4120.           displays the current TRANSFER MODE setting.
  4121.           
  4122.    SET FILE SCAN { ON [ number ], OFF }
  4123.           Turns this feature on and off. It's ON by default. When OFF,
  4124.           the previous rules apply (SET FILE PATTERNS, etc). When ON is
  4125.           given, you can also specify a number of bytes to be scanned.
  4126.           The default is 49152 (= 48K). If a negative number is given,
  4127.           the entire file is scanned, no matter how big, for maximum
  4128.           certainty (for example, a PostScript file that appears to be
  4129.           plain text might include an embedded graphic past the normal
  4130.           scanning limit). SHOW FILE displays the current FILE SCAN
  4131.           setting.
  4132.           
  4133.    SET FILE DEFAULT 7BIT-CHARACTER-SET name
  4134.           Tells the 7-bit character-set to use if scanning identifies a
  4135.           7-bit text file, e.g. GERMAN. SHOW FILE displays the current
  4136.           SET FILE DEFAULT settings. So does SHOW CHARACTER-SETS.
  4137.           
  4138.    SET FILE DEFAULT 8BIT-CHARACTER-SET name
  4139.           Tells the 8-bit character-set to use if scanning identifies an
  4140.           8-bit text file, e.g. LATIN1. SHOW FILE and SHOW CHARACTER-SET
  4141.           display this.
  4142.           
  4143.    ASSOCIATE FILE-CHARACTER-SET fcs tcs
  4144.           When sending files and a file character-set (fcs) is identified
  4145.           by scanning, this tells C-Kermit which transfer character-set
  4146.           (tcs) to translate it to. It also allows C-Kermit to set the
  4147.           appropriate transfer character-set automatically whenever you
  4148.           give a SET FILE CHARACTER-SET command.
  4149.           
  4150.    ASSOCIATE TRANSFER-CHARACTER-SET tcs fcs
  4151.           When receivinging files and a file arrives whose transfer
  4152.           character-set (tcs) is announced by the sender, this command
  4153.           tells C-Kermit which file character-set (fcs) to translate it
  4154.           to. It also allows C-Kermit to set the appropriate file
  4155.           character-set whenever you give a SET TRANSFER CHARACTER-SET
  4156.           command.
  4157.           
  4158.    SET FILE CHARACTER-SET name
  4159.           When given for a 7-bit set, also sets FILE DEFAULT
  4160.           7BIT-CHARACTER-SET to the same set. When given for an 8-bit
  4161.           set, also sets FILE DEFAULT 8BIT-CHARACTER-SET to the same set.
  4162.           If an ASSOCIATE FILE-CHARACTER-SET command has been given for
  4163.           this set, also sets the corresponding transfer character-set.
  4164.           
  4165.    DIRECTORY /XFERMODE [ filespec ]
  4166.           Performs a file scan of the given files, listing the result for
  4167.           each file. If FILE SCAN is OFF but PATTERNS are ON, the result
  4168.           shown according to the current FILE TEXT-PATTERNS and
  4169.           BINARY-PATTERNS, and are restricted to (B) and (T). When FILE
  4170.           SCAN is ON, the results are:
  4171.           
  4172.   (B)          Binary
  4173.   (T)(7BIT)    Text: 7-bit
  4174.   (T)(8BIT)    Text: 8-bit
  4175.   (T)(UTF8)    Text: Unicode UTF8
  4176.   (T)(UCS2BE)  Text: Unicode UCS2 Big Endian
  4177.   (T)(UCS2LE)  Text: Unicode UCS2 Little Endian
  4178.  
  4179.           So you can use DIR /XFER to get a preview of how each file in a
  4180.           selected group will be transferred. Everything to the right of
  4181.           the (B) or (T) is new. If FILE SCAN is OFF, you only get the
  4182.           (B) or (T) as before.
  4183.           
  4184.           Note: Big and Little Endian refer to the ordering of bytes
  4185.           within a computer word. Big Endian architecture is standard and
  4186.           is used on most non-PC computers. Little Endian architecture is
  4187.           used on PCs.
  4188.           
  4189.    To illustrate file-transfer with scanning, suppose you have a
  4190.    directory containing a mixture of text and binary files, and each text
  4191.    file can be 7-bit German ISO 646, 8-bit Latin-1, or Unicode in any of
  4192.    the following forms: UCS2 Little Endian, UCS2 Big Endian, or UTF8
  4193.    ([318]UTF-16 is not supported yet). Assuming all the built-in defaults
  4194.    are in effect, the following three commands do the job:
  4195.    
  4196.   set file char german   ; This sets the default for 7-bit text files
  4197.   set file char latin1   ; This sets the default for 8-bit text files
  4198.   send *
  4199.  
  4200.    Each file is sent in the appropriate mode (text or binary), with text
  4201.    files converted to the appropriate transfer character-set and labeled
  4202.    so the receiver can convert them according to its own local
  4203.    conventions.
  4204.    
  4205.    By the way, what if you want to inhibit character-set translation but
  4206.    still allow automatic text/binary mode switching? Previously, you
  4207.    could simply SET TRANSFER CHARACTER-SET TRANSPARENT. But now with file
  4208.    scanning, the file and transfer character-sets are set automatically
  4209.    per file. A new command was added for this purpose:
  4210.    
  4211.    SET TRANSFER TRANSLATION { ON, OFF }
  4212.           Enables and disables file-transfer character-set translation.
  4213.           It is enabled by default.
  4214.           
  4215.    When TRANSFER TRANSLATION is OFF but FILE SCAN is ON, files are still
  4216.    scanned to see if they are text or binary, but no character-set
  4217.    translation is done when they text: only the normal record-format
  4218.    conversion.
  4219.    
  4220.    Like all SET commands, SET TRANSFER TRANSLATION is global and
  4221.    persistent. You can also force a particular file-transfer command
  4222.    (SEND, MSEND, GET, RECEIVE, TRANSMIT, etc) to not translate without
  4223.    affecting the global translation settings by including the new
  4224.    /TRANSPARENT switch, e.g.
  4225.    
  4226.   send /transparent oofa.txt
  4227.  
  4228.    File scanning is also used in the TYPE command. The source file type
  4229.    and character set are determined as above, and then the file is
  4230.    automatically converted to your display character-set, line by line.
  4231.    In Kermit 95, the display character-set is Unicode, perhaps converted
  4232.    to your current console code page; in other versions of C-Kermit, it
  4233.    is your current file character-set. Thus if you have the following set
  4234.    appriately:
  4235.    
  4236.   SET FILE CHARACTER-SET (necessary in Unix but not K95)
  4237.   SET FILE DEFAULT 7BIT CHARACTER-SET
  4238.   SET FILE DEFAULT 8BIT CHARACTER-SET
  4239.  
  4240.    then you should be able to TYPE any text file and see something
  4241.    reasonable. For example, in Unix, if your DEFAULT 7BIT-CHARACTER-SET
  4242.    is ITALIAN and your DEFAULT 8BIT-CHARACTER-SET is LATIN1, and your
  4243.    FILE CHARACTER-SET is LATIN1, you can TYPE an Italian ISO 646 file, a
  4244.    Latin-1 file, or any kind of Unicode file, and have it translated
  4245.    automatically to Latin-1 for your display.
  4246.    
  4247.    In the GUI version of Kermit 95, you can see mixtures of many
  4248.    different scripts if the file is UTF8 or UCS2: Roman, Cyrillic,
  4249.    Hebrew, Greek, Armenian, Georgian, etc, all on the same screen at
  4250.    once.
  4251.    
  4252.    File scanning also adds a new criterion for file selection, i.e. to
  4253.    select only text (or binary) files. Several commands now include a new
  4254.    switch, /TYPE:{BINARY,TEXT,ALL}. BINARY means select only binary
  4255.    regular files (not directories). TEXT means select only text files.
  4256.    ALL means don't scan; select all files. Examples:
  4257.    
  4258.    SEND /TYPE:BINARY *.*
  4259.           Sends only binary files, skipping over text files.
  4260.           
  4261.    NOTE: File scanning is NOT done when using external protocols (because
  4262.    the external protocol programs, such as sz, are processing each file,
  4263.    not Kermit).
  4264.    
  4265.    DIRECTORY /TYPE:TEXT
  4266.           Lists only text files but not binary files.
  4267.           
  4268.    DELETE /TYPE:BINARY foo.*
  4269.           Deletes all foo.* files that are regular binary files but does
  4270.           not delete any text files.
  4271.           
  4272.    CHMOD /TYPE:BINARY 775 *
  4273.           (UNIX) Changes the permissions of all binary files to 775.
  4274.           
  4275.    When FILE SCAN is OFF and FILE PATTERNS are ON, behavior is as before
  4276.    with PATTERNS ON, but with some improvements:
  4277.    
  4278.      * Pathnames are now stripped prior to pattern matching.
  4279.      * Backup suffixes (like .~3~) are stripped prior to pattern
  4280.        matching.
  4281.        
  4282.    [ [319]Top ] [ [320]Contents ] [ [321]C-Kermit Home ] [ [322]Kermit
  4283.    Home ]
  4284.   __________________________________________________________________________
  4285.  
  4286. 5. FILE AND DIRECTORY NAMES CONTAINING SPACES
  4287.  
  4288.    Prior to the introduction of the graphical user interface (GUI), it
  4289.    was inconceivable that file or directory names could contain spaces,
  4290.    because space is a field delimiter in all command languages. GUIs,
  4291.    however, use dialog boxes for filenames, so there is never any
  4292.    question of distinguishing a filename from adjacent fields -- because
  4293.    there *are* no adjacent fields -- and therefore it has become quite
  4294.    common on computers that have GUIs to have file and directory names
  4295.    composed of multiple words. Of course this poses problems for command
  4296.    shells and other text-oriented programs.
  4297.    
  4298.    Most command shells address these problems by allowing such names to
  4299.    be enclosed in doublequotes, e.g.:
  4300.    
  4301.   cd "c:\Program Files"
  4302.  
  4303.    C-Kermit previously used braces for this:
  4304.    
  4305.   cd {c:\Program Files}
  4306.  
  4307.    which was not what most people expected. And even when braces were
  4308.    used, Kermit had difficulties with completion, file menus, and so
  4309.    forth, within braced fields.
  4310.    
  4311.    C-Kermit 8.0 allows either doublequotes or braces to be used for
  4312.    grouping:
  4313.    
  4314.   send "this file"
  4315.   send {this file}
  4316.   rename "this file" "that file"
  4317.   rename {this file} "that file"
  4318.   rename "this file" {that file}
  4319.   cd {Program Files}
  4320.   cd "Program Files"
  4321.  
  4322.    And now you can also use completion on these filenames, in which case
  4323.    Kermit supplies the quotes (or braces) automatically. Example (in
  4324.    which the current directory contains only one file whose name starts
  4325.    with "th" and its full name is "this file" (without the quotes)):
  4326.    
  4327.   cat th<Tab>
  4328.  
  4329.    Kermit repaints the filename field like this:
  4330.    
  4331.   cat "this file"
  4332.  
  4333.    That is, it backspaces over the original "th" and then writes the
  4334.    filename in doublequotes.
  4335.    
  4336.    If completion is only partial, Kermit still supplies the quotes, but
  4337.    in this case also beeps. To continue the filename, you must first
  4338.    backspace over the closing quote. The closing quote is supplied in
  4339.    this case to make sure that you can see the spaces, especially if they
  4340.    are trailing. For example, if the current directory contains two files
  4341.    whose names start with "th", and their fill names are "this file" and
  4342.    "this other file":
  4343.    
  4344.   cat th<Tab>
  4345.  
  4346.    Kermit prints:
  4347.    
  4348.   cat "this "<Beep>
  4349.  
  4350.    If it didn't print the closing quote, you would probably wonder why it
  4351.    was beeping.
  4352.    
  4353.    Also, if you begin a filename field with a doublequote or opening
  4354.    brace, now you can use completion or get ?-help; this was never
  4355.    possible before.
  4356.    
  4357.  C-Kermit>type "thi? Input file specification, one of the following:
  4358.    this file        this other file
  4359.  C-Kermit>type "thi_
  4360.  
  4361.    [ [323]Top ] [ [324]Contents ] [ [325]C-Kermit Home ] [ [326]Kermit
  4362.    Home ]
  4363.   __________________________________________________________________________
  4364.  
  4365. 6. OTHER COMMAND PARSING IMPROVEMENTS
  4366.  
  4367.   6.1. Grouping Macro Arguments
  4368.   
  4369.    Doublequotes now can be used in macro invocations to group arguments
  4370.    containing spaces, where previously only braces could be used:
  4371.    
  4372.   define xx show args
  4373.   xx one "this is two" three
  4374.  
  4375.    Result:
  4376.    
  4377.   Macro arguments at level 0 (\v(argc) = 4):
  4378.    \%0 = xx
  4379.    \%1 = one
  4380.    \%2 = this is two
  4381.    \%3 = three
  4382.  
  4383.    Also, you can now quote braces and quotes in macro args (this didn't
  4384.    work before). Examples:
  4385.    
  4386.   xx "{"  ; The argument is a single left brace
  4387.   xx {"}  ; The argument is a doublequote character
  4388.  
  4389.    In case this new behavior interferes with your scripts, you can
  4390.    restore the previous behavior with:
  4391.    
  4392.   SET COMMAND DOUBLEQUOTING OFF
  4393.  
  4394.   6.2. Directory and File Name Completion
  4395.   
  4396.    C-Kermit 8.0 also includes better completion for directory names, e.g.
  4397.    in the CD command. If the name typed so far uniquely matches a
  4398.    directory name, it is completed (as before), but now if the directory
  4399.    contains any subdirectories, completion is partial (allowing you to
  4400.    supply additional path segments without backspacing); otherwise it is
  4401.    complete.
  4402.    
  4403.    Completion has also been improved for file and directory names that
  4404.    contain not only spaces (as described above) but also "metacharacters"
  4405.    such as asterisk (*) and tilde (~): now the field is repainted if
  4406.    necessary. For example, if the current directory contains only one
  4407.    file whose name contains "blah", then in:
  4408.    
  4409.   type *blah<Tab>
  4410.  
  4411.    "*blah" is replaced by the filename. In earlier releases, the part
  4412.    typed so far was left on the command line (and in the history buffer),
  4413.    so even when the original command worked, the recalled version would
  4414.    not. Similarly for ~ (the nearly-universal Unix notation for
  4415.    username):
  4416.    
  4417.   type ~olga/x<Tab>
  4418.  
  4419.    is repainted as (e.g.):
  4420.    
  4421.   type /users/home/olga/x(Beep)
  4422.  
  4423.    Speaking of command history, the new SHOW HISTORY command shows your
  4424.    command history and recall buffer. SAVE COMMAND HISTORY saves it into
  4425.    a file of your choice.
  4426.    
  4427.   6.3. Passing Arguments to Command Files
  4428.   
  4429.    The method for passing arguments to command files has been improved.
  4430.    Prior to C-Kermit 7.0 there was no provision for doing this. In
  4431.    C-Kermit 7.0, the TAKE command was changed to allow arguments to be
  4432.    given after the filename:
  4433.    
  4434.   take commandfile arg1 arg2 ...
  4435.  
  4436.    This was accomplished by replacing the current \%1, \%2, etc, with the
  4437.    given arguments, since a new set of macro argument variables is
  4438.    created only when a macro is executed, not a command file. It is much
  4439.    more intuitive, however, if arguments to command files worked like
  4440.    those to macros: the command file sees the arguments as its own \%1,
  4441.    \%2, etc, but the caller's variables are not disturbed. C-Kermit 8.0
  4442.    accomplishes this by automatically creating an intermediate temporary
  4443.    macro to start the command file (if any arguments were given), thus
  4444.    creating a new level of arguments as expected.
  4445.    
  4446.   6.4. More-Prompting
  4447.   
  4448.    The familiar --more?-- prompt that appears at the end of each
  4449.    screenful of command-response output now accepts a new answer: G (Go)
  4450.    meaning "show all the rest without pausing and asking me any more
  4451.    questions". P (Proceed) is a synonym for G.
  4452.    
  4453.   6.5. Commas in Macro Definitions
  4454.   
  4455.    As noted in the [327]C-Kermit manual, comma is used to separate
  4456.    commands in a macro definition. Even when the macro is defined on
  4457.    multiple lines using curly-brace block-structure notation without
  4458.    commas, the definition is still stored internally as a comma-separated
  4459.    list of commands. Therefore special tricks are needed to include a
  4460.    comma in a command. The classic example is:
  4461.    
  4462.   define foo {
  4463.       (some command)
  4464.       if fail echo Sorry, blah failed...
  4465.   }
  4466.  
  4467.    This would result in Kermit trying to execute a "blah" command. This
  4468.    could always be handled by enclosing the text in braces:
  4469.    
  4470.   define foo {
  4471.       (some command)
  4472.       if fail echo {Sorry, blah failed...}
  4473.   }
  4474.  
  4475.    but doublequotes (more intuitive) should have worked too. Now they do:
  4476.    
  4477.   define foo {
  4478.       (some command)
  4479.       if fail echo "Sorry, blah failed..."
  4480.   }
  4481.  
  4482.    [ [328]Top ] [ [329]Contents ] [ [330]C-Kermit Home ] [ [331]Kermit
  4483.    Home ]
  4484.   __________________________________________________________________________
  4485.  
  4486. 7. NEW COMMANDS AND SWITCHES
  4487.  
  4488.    See [332]Section 4 for more about file scanning and the /TYPE: switch.
  4489.    
  4490.    ASK[Q] [ /TIMEOUT:number ] variable [ prompt ]
  4491.           The new optional /TIMEOUT: switch for ASK and ASKQ causes the
  4492.           command to time out and and fail if no response is given within
  4493.           the specified number of seconds, 1 or greater (0 or less means
  4494.           no timeout, wait forever). This works just like SET ASK-TIMER,
  4495.           except its effect is local to the ASK command with which it is
  4496.           given and it does not disturb the global ask timer setting.
  4497.           
  4498.    CAT filename
  4499.           Equivalent to TYPE /NOPAGE.
  4500.           
  4501.    CDUP
  4502.           Changes Kermit's local working directory to the parent of the
  4503.           current one. Equivalent to "cd .." in UNIX or Windows, "cd [-]"
  4504.           in VMS, "cd ^" in AOS/VS, etc; in other words, it's a
  4505.           platform-independent way of moving one level up in a directory
  4506.           tree.
  4507.           
  4508.    CHMOD [ switches ] permission files
  4509.           UNIX only. Sets file permissions for one or more files or
  4510.           directories. The permission must be given as an octal number,
  4511.           e.g. 664, 755. Switches: /DIRECTORIES, /FILES, /NOLIST, /PAGE,
  4512.           /DOTFILES, /LIST, /NOPAGE, /RECURSIVE, /TYPE:{TEXT,BINARY,ALL},
  4513.           /SIMULATE. The /TYPE: switch allows selection of only text or
  4514.           binary files. For example, if you have a mixture of source
  4515.           files and executables, you can use "chmod /files /type:text
  4516.           664" to give owner/group read/write and world read permission
  4517.           to the text files, and "chmod /files /type:binary 775" to give
  4518.           the same plus execute permission to the executables. Use
  4519.           /SIMULATE to see which files would be affected, without
  4520.           actually changing their permissions.
  4521.           
  4522.    CLEAR KEYBOARD-BUFFER
  4523.           Flushes any as-yet unread characters from the keyboard input
  4524.           buffer. Useful for flushing typeahead in scripts.
  4525.           
  4526.    COPY, RENAME, and TRANSLATE
  4527.           These commands now work on file groups if the target filename
  4528.           is a directory, e.g. "copy oofa.* ..", "rename * ~olga/tmp/"
  4529.           
  4530.    DELETE /ASK
  4531.           Asks permission to delete each file before deleting it. In
  4532.           C-Kermit 7.0, the answers were "yes" (or "ok") and "no".
  4533.           C-Kermit 8.0 adds "go" (meaning, delete all the rest without
  4534.           asking) and "quit" (cancel the DELETE command and return to the
  4535.           prompt).
  4536.           
  4537.    DELETE /DIRECTORIES
  4538.           Deletes not only files but also directories.
  4539.           
  4540.    DELETE /RECURSIVE
  4541.           Deletes all files that match the given file specification in
  4542.           the current (or given) directory and all directories beneath
  4543.           it.
  4544.           
  4545.    DELETE /SUMMARY
  4546.           Prints only the number of files deleted and total size freed,
  4547.           without listing each file.
  4548.           
  4549.    DELETE /TREE
  4550.           Shorthand for DELETE /RECURSIVE /DIRECTORIES /DOTFILES/.
  4551.           Equivalent to Windows DELTREE or Unix "rm -Rf". If no file
  4552.           specification is given, the contents of the current directory,
  4553.           plus all of its subdirectories and their contents, are deleted.
  4554.           
  4555.    DELETE /TYPE:BINARY
  4556.           Delete only regular binary files (requires FILE SCAN ON).
  4557.           
  4558.    DELETE /TYPE:TEXT
  4559.           Delete only regular text files (requires FILE SCAN ON).
  4560.           
  4561.    DIRECTORY /NORECURSIVE xxx
  4562.           If xxx is a directory name, forces listing of the directory
  4563.           itself rather than its contents.
  4564.           
  4565.    DIRECTORY /FOLLOWLINKS xxx
  4566.           (UNIX only) Tells the DIRECTORY command to follow symbolic
  4567.           links. This not the default because it can cause endless loops.
  4568.           
  4569.    DIRECTORY /NOFOLLOWLINKS xxx
  4570.           (UNIX only) Tells the DIRECTORY command not to follow symbolic
  4571.           links, but rather, merely to list them. This is the default.
  4572.           
  4573.    DIRECTORY /OUTPUT:filename
  4574.           Sends the results of the DIRECTORY command to the given file.
  4575.           
  4576.    DIRECTORY /SUMMARY
  4577.           Prints only the number of directories and files and the total
  4578.           size, without listing each file.
  4579.           
  4580.    DIRECTORY /TYPE:{TEXT,BINARY}
  4581.           Shows only files of the selected type, based on file scan.
  4582.           
  4583.    DIRECTORY /XFERMODE
  4584.           Now shows results of file scan (see [333]Section 4).
  4585.           
  4586.    GREP [ switches ] pattern files
  4587.           Similar to Unix grep command: displays file lines that match
  4588.           the given [334]pattern. Switches:
  4589.           
  4590.         /COUNT[:variable]
  4591.                 Don't show the matching lines, just tell how many lines
  4592.                 match. If a variable name is specified, the count is
  4593.                 stored in the given variable.
  4594.                 
  4595.         /DOTFILES
  4596.                 Include files whose names begin with dot.
  4597.                 
  4598.         /LINENUMBERS
  4599.                 Show line numbers of matching lines.
  4600.                 
  4601.         /NAMEONLY
  4602.                 only list the names of files that contain matching lines,
  4603.                 but not the lines themselves.
  4604.                 
  4605.         /NOBACKUP
  4606.                 Skip backup files.
  4607.                 
  4608.         /NOCASE
  4609.                 Ignore alphabetic case while pattern matching.
  4610.                 
  4611.         /NODOTFILES
  4612.                 skip files whose names start with dot (period).
  4613.                 
  4614.         /NOLIST
  4615.                 Suppress output but set SUCCESS or FAILURE according to
  4616.                 search result.
  4617.                 
  4618.         /NOMATCH
  4619.                 Look for lines that do not match the pattern.
  4620.                 
  4621.         /NOPAGE
  4622.                 Don't pause between screens of output.
  4623.                 
  4624.         /OUTPUT:filename
  4625.                 Write results into the given file.
  4626.                 
  4627.         /PAGE
  4628.                 Pause between screens of output.
  4629.                 
  4630.         /RECURSIVE
  4631.                 Search files in subdirectories too.
  4632.                 
  4633.         /TYPE:{TEXT,BINARY}
  4634.                 Search only files of the specified type.
  4635.                 
  4636.           Synonyms: FIND, SEARCH.
  4637.           
  4638.    HEAD [ switches ] filename
  4639.           Equivalent to TYPE /HEAD [ other-switches ] filename.
  4640.           
  4641.    HELP DATE
  4642.           Explains date-time formats, including timezone notation and
  4643.           delta times.
  4644.           
  4645.    HELP FIREWALLS
  4646.           Explains the firewall negotiation capabilities of your version
  4647.           of Kermit.
  4648.           
  4649.    LICENSE
  4650.           Displays the C-Kermit license.
  4651.           
  4652.    MOREfilename
  4653.           Equivalent to TYPE /PAGE.
  4654.           
  4655.    PROMPT [ text ]
  4656.           For use in a macro or command file: enters interactive command
  4657.           mode within the current context ([335]Section 8.1). If the
  4658.           optional text is included, the prompt is set to it. The text
  4659.           can include variables, functions, etc, as in the SET PROMPT
  4660.           command. They are evaluated each time the prompt is printed.
  4661.           Unlike the SET PROMPT command, the text argument applies only
  4662.           to the current command level. Thus you can have different
  4663.           prompts at different levels.
  4664.           
  4665.    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
  4666.           Allows control of the Kermit's Record-Format attribute. Set
  4667.           this to OFF in case incoming file are refused due to unknown or
  4668.           invalid record formats if you want to accept the file anyway
  4669.           (and, perhaps, postprocess it to fix its record format).
  4670.           
  4671.    SET EXIT HANGUP { OFF, ON }
  4672.           Normally ON, meaning that when Kermit exits, it also explicitly
  4673.           hangs up the current SET LINE / SET PORT serial port according
  4674.           to the current SET MODEM TYPE and SET MODEM HANGUP METHOD, and
  4675.           closes the port device if it was opened by Kermit in the first
  4676.           place (as opposed to inherited). SET EXIT HANGUP OFF tells
  4677.           Kermit not to do this. This can't prevent the operating system
  4678.           from closing the device when Kermit exits (and it's a "last
  4679.           close") but if the port or modem have been conditioned to
  4680.           somehow ignore the close and keep the connection open, at least
  4681.           Kermit itself won't do anything explicit to hang it up or close
  4682.           it.
  4683.           
  4684.    SET FILE EOF { CTRL-Z, LENGTH }
  4685.           Specifies the end-of-file detection method to be used by
  4686.           C-Kermit when sending and receiving text files, and in the TYPE
  4687.           and similar text-file oriented commands. The normal and default
  4688.           method is LENGTH. You can specify CTRL-Z when handling CP/M or
  4689.           MS-DOS format text files, in which a Ctrl-Z (ASCII 26)
  4690.           character within the file marks the end of the file.
  4691.           
  4692.    SET FILE LISTSIZE number
  4693.           Allocates space for the given number of filenames to be filled
  4694.           in by the wildcard expander. The current number is shown by
  4695.           SHOW FILE. If you give a command that includes a filename
  4696.           containing a wildcard (such as "*") that matches more files
  4697.           that Kermit's list has room for, you can adjust the list size
  4698.           with this command.
  4699.           
  4700.    SET FILE STRINGSPACE number
  4701.           Allocates space for the given amount of filename strings for
  4702.           use by the wildcard expander. The current number is shown by
  4703.           SHOW FILE. The number is the total number of bytes of all the
  4704.           file specifications that match the given wildcard.
  4705.           
  4706.      If you need to process a bigger list of files than your computer
  4707.      has memory for, you might be able use an external file list. The
  4708.      Kermit SEND and the FTP PUT and GET commands accept a /LISTFILE:
  4709.      switch, which gives the name of a file that contains the list of
  4710.      files to be transferred. Example for UNIX:
  4711.      
  4712.   !find . -print | grep / > /tmp/names
  4713.   ftp put /update /recursive /listfile:/tmp/names
  4714.  
  4715.    SET ROOT directory
  4716.           Like UNIX chroot, without requiring privilege. Sets the root
  4717.           for file access, does not allow reference to or creation of
  4718.           files outside the root, and can't be undone.
  4719.           
  4720.    SET TERMINAL . . .
  4721.           (See [336]Section 12.)
  4722.           
  4723.    SET TRANSFER MESSAGE [ text ]
  4724.           Sets an initial text message to be displayed in the
  4725.           file-transfer display. The transfer message is automatically
  4726.           deleted once used, so must be set each time a message a
  4727.           desired. Any variables in the message are evaluated at the time
  4728.           the SET command is given. If the optional text is omitted, any
  4729.           transfer message that is currently set is removed. Synonym: SET
  4730.           XFER MSG. SHOW TRANSFER displays it if it has been set but not
  4731.           yet used.
  4732.           
  4733.    SHOW COMMUNICATIONS
  4734.           In C-Kermit 8.0, SHOW COMMUNICATIONS, when given in remote mode
  4735.           (i.e. before any connection has been established), tells the
  4736.           typical dialout device name for the particular platform on
  4737.           which it's running (e.g. TXA0: for VMS, or /dev/cua0p0 for
  4738.           HP-UX). On Unix platforms, it also tells the name of the
  4739.           lockfile directory. This way, you have an idea of what the SET
  4740.           LINE device name should look like, and if the SET LINE command
  4741.           fails, you know the name of the directory or device that is
  4742.           protected against you.
  4743.           
  4744.    TAIL [ switches ] filename
  4745.           Equivalent to TYPE /TAIL [ other-switches ] filename.
  4746.           
  4747.    TRANSMIT /NOECHO [ other switches ] filename
  4748.           The /NOECHO switch is equivalent to giving the command SET
  4749.           TRANSMIT ECHO OFF prior to the TRANSMIT command, except the
  4750.           swith affects only the command with which it was given and does
  4751.           not affect the prevailing global setting.
  4752.           
  4753.    TRANSMIT /NOWAIT [ other switches ] filename
  4754.           The /NOWAIT switch is equivalent to giving the command SET
  4755.           TRANSMIT PROMPT 0 prior to the TRANSMIT command, except the
  4756.           swith affects only the command with which it was given and does
  4757.           not affect the prevailing global setting.
  4758.           
  4759.    TRANSMIT /NOWAIT /NOECHO /BINARY [ other switches ] filename
  4760.           When the TRANSMIT command is given with the /NOWAIT, /NOECHO,
  4761.           and /BINARY switches, this activates a special "blast the whole
  4762.           file out the communications connection all at once" mode that
  4763.           Kermit didn't have prior to version 8.0. There has been
  4764.           increasing demand for this type of transmission with the advent
  4765.           of devices that expect image (e.g. .JPG) or sound (e.g. .MP3)
  4766.           files as raw input. The obvious question is: how does the
  4767.           receiving device know when it has the whole file? This depends
  4768.           on the device, of course; usually after a certain amount of
  4769.           time elapses with nothing arriving, or else when Kermit hangs
  4770.           up or closes the connection.
  4771.           
  4772.    TYPE /CHARACTER-SET:name
  4773.           Allows you to specify the character set in which the file to be
  4774.           typed is encoded.
  4775.           
  4776.    TYPE /NUMBER
  4777.           Adds line numbers.
  4778.           
  4779.    TYPE /OUTPUT:filename
  4780.           Sends the results of the TYPE command to the given file.
  4781.           
  4782.    TYPE /TRANSLATE-TO:name
  4783.           Used in conjunction with TYPE /CHARACTER-SET:xxx; allows you to
  4784.           specify the character set in which the file is to be displayed.
  4785.           
  4786.    TYPE /TRANSPARENT
  4787.           Used to disable character-set translation in the TYPE command,
  4788.           which otherwise can take place automatically based on file
  4789.           scanning, even when /CHARACTER-SET and /TRANSLATE-TO switches
  4790.           are not given.
  4791.           
  4792.    VOID text
  4793.           Parses the text, evaluating any backslash items in it (such as
  4794.           function calls) but doesn't do anything further, except
  4795.           possibly printing error messages. Useful for invoking functions
  4796.           that have side effects without using or printing their direct
  4797.           results, e.g. "void \fsplit(\%a,&a)".
  4798.           
  4799.   Symbolic Links in UNIX
  4800.   
  4801.    The UNIX versions of C-Kermit have had /FOLLOWLINKS and /NOFOLLOWLINKS
  4802.    switches added to several commands to control the treatment of
  4803.    symbolic links. Different commands deal differently with symbolic
  4804.    links:
  4805.    
  4806.    Kermit SEND, FTP MPUT
  4807.           /NOFOLLOWLINKS is the default, which means symbolic links are
  4808.           skipped entirely. The alternative, /FOLLOWLINKS, should be used
  4809.           with caution, since an innocent link might point to a whole
  4810.           file system, or it might cause a loop. There is no way in
  4811.           Kermit or FTP protocol to send the link itself. We either skip
  4812.           them or follow them; we can't duplicate them.
  4813.           
  4814.    DIRECTORY
  4815.           /NOFOLLOWLINKS is the default, which means the DIRECTORY
  4816.           command lists symbolic links in a way that shows they are
  4817.           links, but it does not follow them. The alternative,
  4818.           /FOLLOWLINKS, follows links and gives information about the
  4819.           linked-to directories and files.
  4820.           
  4821.    DELETE, RMDIR
  4822.           The DELETE command does not have link-specific switches. DELETE
  4823.           never follows links. If you tell Kermit to delete a symbolic
  4824.           link, it deletes the link itself, not the linked-to file. Ditto
  4825.           for RMDIR.
  4826.           
  4827.    COPY
  4828.           The COPY command behaves just like the UNIX cp command; it
  4829.           always follows links.
  4830.           
  4831.    RENAME
  4832.           The RENAME command behaves just like the UNIX mv command; it
  4833.           operates on links directly rather than following.
  4834.           
  4835.    [ [337]Top ] [ [338]Contents ] [ [339]C-Kermit Home ] [ [340]Kermit
  4836.    Home ]
  4837.   __________________________________________________________________________
  4838.  
  4839. 8. OTHER SCRIPTING IMPROVEMENTS
  4840.  
  4841.   8.1. Performance and Debugging
  4842.   
  4843.    A command cache for frequently used commands plus some related
  4844.    optimizations increases the speed of compute-bound scripts by anywhere
  4845.    from 50% to 1000%.
  4846.    
  4847.    The new PROMPT command can be used to set breakpoints for debugging
  4848.    scripts. If executed in a command file or macro, it gives you an
  4849.    interactive command prompt in the current context of the script, with
  4850.    all its variables, arguments, command stack, etc, available for
  4851.    examination or change, and the ability to resume the script at any
  4852.    point (END resumes it, Ctrl-C or STOP cancels it and returns to top
  4853.    level).
  4854.    
  4855.    The new Ctrl-C trapping feature ([341]Section 8.14) lets you intercept
  4856.    interruption of scripts. This can be used in combination with the
  4857.    PROMPT command to debug scripts. Example:
  4858.    
  4859. define ON_CTRLC {
  4860.     echo INTERRUPTED BY CTRL-C...
  4861.     echo The command stack has not yet been rolled back:
  4862.     show stack
  4863.     echo Type Ctrl-C again or use the END command to return to top level.
  4864.     prompt Debug>
  4865. }
  4866.  
  4867.    Adding this ON_CTRL definition to your script lets you interrupt it at
  4868.    any point and get prompt that is issued at the current command level,
  4869.    so you can query local variables, etc.
  4870.    
  4871.    [ [342]Top ] [ [343]Contents ] [ [344]C-Kermit Home ] [ [345]Kermit
  4872.    Home ]
  4873.      _________________________________________________________________
  4874.    
  4875.   8.2. Using Macros as Numeric Variables
  4876.   
  4877.    A macro is a way to assign a value to a name, and then use the name to
  4878.    refer to the value. Macros are used in two ways in Kermit: as
  4879.    "subroutines" or functions composed of Kermit commands, which are
  4880.    executed, or as variables to hold arbitrary values -- text, numbers,
  4881.    filenames, etc.
  4882.    
  4883.    When a macro is to be executed, its name is given as if it were a
  4884.    C-Kermit command, optionally preceded by the word "do". When a macro
  4885.    is used as a variable, it must be "escaped" with \m(xxx) (or
  4886.    equivalent function, e.g. \s(xxx), \:(xxx), \fdefinition(xxx)), where
  4887.    xxx is the macro name, for example:
  4888.    
  4889.   define filename /usr/olga/oofa.txt
  4890.   send \m(filename)
  4891.  
  4892.    Of course variables can also hold numbers:
  4893.    
  4894.   define size 17
  4895.   declare \&a[\m(size)]
  4896.   ...
  4897.   define index 3
  4898.   if ( == \m(index) 3 ) echo The third value is: \&a[\m(index)]
  4899.   evaluate index (\m(index) * 4)
  4900.   if ( > \m(index) \m(size) ) echo Out of range!
  4901.  
  4902.    But these are contexts in which only numbers are valid. C-Kermit 8.0
  4903.    has been changed to treat non-escaped non-numeric items in strictly
  4904.    numeric contexts as macro names. So it is now possible (but not
  4905.    required) to omit the \m(...) notation and just use the macro name in
  4906.    these contexts:
  4907.    
  4908.   define size 17
  4909.   declare \&a[size]
  4910.   ...
  4911.   define index 3
  4912.   if ( == index 3 ) echo The third value is: \&a[index]
  4913.   evaluate index (index * 4)
  4914.   if ( > index size ) echo Out of range!
  4915.  
  4916.    This is especially nice for loops that deal with arrays. Here, for
  4917.    example, is a loop that reverses the order of the elements in an
  4918.    array. Whereas formerly it was necessary to write:
  4919.    
  4920.   .\%n ::= \fdim(&a)
  4921.   for \%i 1 \%n/2 1 {
  4922.       .tmp := \&a[\%n-\%i+1]
  4923.       .\&a[\%n-\%i+1] := \&a[\%i]
  4924.       .\&a[\%i] := \m(tmp)
  4925.   }
  4926.  
  4927.    Recoding this to use macro names "i" and "n" instead of the backslash
  4928.    variables \%i and \%n, we have:
  4929.    
  4930.   .n ::= \fdim(&a)
  4931.   for i 1 n/2 1 {
  4932.       .tmp := \&a[n-i+1]
  4933.       .\&a[n-i+1] := \&a[i]
  4934.       .\&a[i] := \m(tmp)
  4935.   }
  4936.  
  4937.    which reduces the backslash count to less than half. The final
  4938.    statement in the loop could be written ".\&a[i] ::= tmp" if the array
  4939.    contained only numbers (since ::= indicates arithmetic expression
  4940.    evaluation).
  4941.    
  4942.    Also, now you can use floating-point numbers in integer contexts (such
  4943.    as array subscripts), in which case they are truncated to an integer
  4944.    value (i.e. the fractional part is discarded).
  4945.    
  4946.    Examples of numeric contexts include:
  4947.    
  4948.      * Array subscripts.
  4949.      * Any numeric function argument.
  4950.      * Right-hand side of ::= assignments.
  4951.      * EVALUATE command or \fevaluate() function expression.
  4952.      * The INCREMENT or DECREMENT by-value.
  4953.      * IF =, >, <, !=, >=, and <= comparands.
  4954.      * The IF number construct.
  4955.      * FOR-loop variables.
  4956.      * STOP, END, and EXIT status codes.
  4957.      * The INPUT timeout value.
  4958.      * PAUSE, WAIT, SLEEP, MSLEEP intervals.
  4959.      * The SHIFT argument.
  4960.      * Numeric switch arguments, e.g. TYPE /WIDTH:number, SEND
  4961.        /LARGER:number.
  4962.      * SCREEN MOVE-TO row and column number.
  4963.      * Various SET DIAL parameters (timeout, retry limit, etc).
  4964.      * Various SET SEND or RECEIVE parameters (packet length, window
  4965.        size, etc).
  4966.      * Various other SET parameters.
  4967.        
  4968.    and:
  4969.    
  4970.      * S-Expressions (explained in [346]Section 9).
  4971.        
  4972.    Macro names used in numeric contexts must not include mathematical
  4973.    operators. Although it is legal to create a macro called "foo+bar", in
  4974.    a numeric context this would be taken as the sum of the values of
  4975.    "foo" and "bar". Any such conflict can be avoided, of course, by
  4976.    enclosing the macro name in \m(...).
  4977.    
  4978.    [ [347]Top ] [ [348]Contents ] [ [349]C-Kermit Home ] [ [350]Kermit
  4979.    Home ]
  4980.      _________________________________________________________________
  4981.    
  4982.   8.3. New IF Conditions
  4983.   
  4984.    Several new IF conditions are available:
  4985.    
  4986.    IF DECLARED arrayname
  4987.           Explained in [351]Section 8.6.
  4988.           
  4989.    IF KBHIT
  4990.           Allows a script to test whether a key was pressed without
  4991.           actually trying to read it.
  4992.           
  4993.    IF KERBANG (Unix only)
  4994.           True if Kermit was started from a Kerbang script. This is
  4995.           useful for knowing how to interpret the \&@[] and \&_[]
  4996.           argument vector arrays.
  4997.           
  4998.    IF INTEGER n
  4999.           This is just a synonym for IF NUMERIC, which is true if n
  5000.           contains only digits (or, if n is a variable, its value
  5001.           contains only digits).
  5002.           
  5003.    By contrast, IF FLOAT n succeeds if n is a floating-point number OR an
  5004.    integer (or a variable with floating-point or integer value).
  5005.    Therefore, IF FLOAT should be used whenever any kind of number is
  5006.    acceptable, whereas IF INTEGER (or IF NUMERIC) when only an integer
  5007.    can be used.
  5008.    
  5009.    [ [352]Top ] [ [353]Contents ] [ [354]C-Kermit Home ] [ [355]Kermit
  5010.    Home ]
  5011.      _________________________________________________________________
  5012.    
  5013.   8.4. The ON_UNKNOWN_COMMAND Macro
  5014.   
  5015.    The new ON_UNKNOWN_COMMAND macro, if defined, is executed whenever you
  5016.    give a command that is not known to C-Kermit; any operands are passed
  5017.    as arguments. Here are some sample definitions:
  5018.    
  5019.   DEF ON_UNKNOWN_COMMAND telnet \%1 ; Treat unknown commands as hostnames
  5020.   DEF ON_UNKNOWN_COMMAND dial \%1   ; Treat unknown commands phone numbers
  5021.   DEF ON_UNKNOWN_COMMAND take \%1   ; Treat unknown commands as filenames
  5022.   DEF ON_UNKNOWN_COMMAND !\%*       ; Treat unknown commands as shell commands
  5023.  
  5024.    [ [356]Top ] [ [357]Contents ] [ [358]C-Kermit Home ] [ [359]Kermit
  5025.    Home ]
  5026.      _________________________________________________________________
  5027.    
  5028.   8.5. The SHOW MACRO Command
  5029.   
  5030.    The SHOW MACRO command has been changed to accept more than one macro
  5031.    name:
  5032.    
  5033.   (setq a 1 b 2 c 3)
  5034.   show mac a b c
  5035.   a = 1
  5036.   b = 2
  5037.   c = 3
  5038.  
  5039.    An exact match is required for each name (except that case doesn't
  5040.    matter). If you include wildcard characters, however, a pattern match
  5041.    is performed:
  5042.    
  5043.   show mac [a-c]*x
  5044.  
  5045.    shows all macros whose names start with a, b, or c, and end with x.
  5046.    
  5047.    [ [360]Top ] [ [361]Contents ] [ [362]C-Kermit Home ] [ [363]Kermit
  5048.    Home ]
  5049.      _________________________________________________________________
  5050.    
  5051.   8.6. Arrays
  5052.   
  5053.    A clarification regarding references to array names (as opposed to
  5054.    array elements): You can use array-name "abbreviations" like &a only
  5055.    in contexts that expect array names, like ARRAY commands or array-name
  5056.    function arguments such as the second argument of \fsplit(). In a
  5057.    LOCAL statement, however, you have to write \&a[], since "local &a"
  5058.    might refer to a macro named "&a".
  5059.    
  5060.    In function arguments, however, you MUST use the abbreviated form:
  5061.    \fsplit(\%a,&a) or \fsplit(\%a,&a[]). If you include the backslash (as
  5062.    in "\fsplit(\%a,\&a[])") a parse error occurs.
  5063.    
  5064.    Here are the new array-related commands:
  5065.    
  5066.    IF DECLARED arrayname
  5067.           Allows a script to test whether an array has been declared. The
  5068.           arrayname can be a non-array backslash variable such as \%1 or
  5069.           \m(name), in which case it is evaluated first, and the result
  5070.           is treated as the array name. Otherwise, arrayname is treated
  5071.           as in the ARRAY commands: it can be a, &a, &a[], \&a, \&a[],
  5072.           \&a[3], \&a[3:9], etc, with the appropriate results in each
  5073.           case. Synonym: IF DCL.
  5074.           
  5075.    UNDECLARE arrayname
  5076.           UNDECLARE is a new top-level command to undeclare an array.
  5077.           Previously this could only be done with "declare \&a[0]" (i.e.
  5078.           re-declare the array with a dimension of 0).
  5079.           
  5080.    ARRAY LINK linkname arrayname
  5081.           Creates a symbolic link from the array named by linkname (which
  5082.           must be the name of an array that is not yet declared in the
  5083.           current context) to the array named by arrayname (which must
  5084.           the name of a currently declared array that is not itself a
  5085.           link, or a variable containing the name of such an array). The
  5086.           two names indicate the same array: if you change an array
  5087.           element, the change is reflected in the link too, and vice
  5088.           versa. If you undeclare the link, the real array is unaffected.
  5089.           If you undeclare the real array, all links to it disappear. If
  5090.           you resize an array (directly or through a link), all links to
  5091.           it are updated automatically.
  5092.           
  5093.    Array links let you pass array names as arguments to macros. For
  5094.    example, suppose you had a program that needed to uppercase all the
  5095.    elements of different arrays at different times. You could write a
  5096.    macro to do this, with the array name as an argument. But without
  5097.    array links, there would be no way to refer to the argument array
  5098.    within the macro. Array links make it easy:
  5099.    
  5100.   define arrayupper {
  5101.       local \&e[] \%i
  5102.       array link \&e[] \%1
  5103.       for i 1 \fdim(&e) 1 { .\&e[i] := \fupper(\&e[i]) }
  5104.   }
  5105.   declare \&a[] = these are some words
  5106.   arrayupper &a
  5107.   show array &a
  5108.  
  5109.    The macro declares the array link LOCAL, which means it doesn't
  5110.    conflict with any array of the same name that might exist outside the
  5111.    macro, and that the link is destroyed automatically when the macro
  5112.    exits. This works, by the way, even if the link name and the macro
  5113.    argument name are the same, as long as the link is declared LOCAL.
  5114.    
  5115.    As noted, you can't make a link to a nonexistent array. So when
  5116.    writing a macro whose job is to create an array whose name is passed
  5117.    as an argument, you must declare the array first (the size doesn't
  5118.    matter as long as it's greater than 0). Example:
  5119.    
  5120.   define tryme {                ; Demonstration macro
  5121.       local \&e[]               ; We only need this inside the macro
  5122.       array link \&e[] \%1      ; Make local link
  5123.       shift                     ; Shift argument list
  5124.       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
  5125.   }
  5126.   declare \&a[1]                ; Declare target array in advance
  5127.   tryme &a here are some words  ; Invoke the macro with array name and words
  5128.   show array a                  ; See the results
  5129.  
  5130.    One final improvement allows the macro itself to declare the array
  5131.    (this was not possible in earlier Kermit releases): if the array name
  5132.    in the DECLARE command is a variable (and not an array name), or
  5133.    includes variables, the resulting value is used as the array name. So:
  5134.    
  5135.   define tryme {                ; Demonstration macro
  5136.       declare \%1[1]            ; Preliminary declaration for target array
  5137.       local \&e[]               ; We only need this inside the macro
  5138.       array link \&e[] \%1      ; Make local link
  5139.       shift                     ; Shift argument list
  5140.       void \fsplit(\%*,&e)      ; Split remainder of arg list into array
  5141.   }
  5142.   tryme &a here are some words  ; Invoke the macro with array name and words
  5143.   show array a                  ; See the results
  5144.  
  5145.    The SHOW ARRAY command now indicates whether an array name is a link.
  5146.    
  5147.    Also see the descriptions of [364]\fjoin() and [365]\fsplit(), plus
  5148.    [366]Section 8.10 on the MINPUT command, which shows how an entire
  5149.    array (or segment of it) can be used as the MINPUT target list.
  5150.    
  5151.    [ [367]Top ] [ [368]Contents ] [ [369]C-Kermit Home ] [ [370]Kermit
  5152.    Home ]
  5153.      _________________________________________________________________
  5154.    
  5155.   8.7. New or Improved Built-in Variables and Functions
  5156.   
  5157.    The following new built-in variables are available:
  5158.    
  5159.   \v(buildid)       A date string like "20000808" indicating when C-Kermit was
  5160. built.
  5161.   \v(ftime)         Current time, secs since midnight, including fraction of se
  5162. cond.
  5163.   \v(iprompt)       The current SET PROMPT value
  5164.   \v(sexp)          The most recent S-Expression (see [371]Section 9)
  5165.   \v(sdepth)        The current S-Expression invocation depth ([372]Section 9)
  5166.   \v(svalue)        The value of the most recent S-Expression ([373]Section 9)
  5167.  
  5168.   \v(ftp_code)      Most recent FTP response code ([374]Section 3)
  5169.   \v(ftp_connected) FTP connection status ([375]Section 3)
  5170.   \v(ftp_cpl)       FTP Command Protection Level ([376]Section 3.2)
  5171.   \v(ftp_dpl)       FTP Data Protection Level ([377]Section 3.2)
  5172.   \v(ftp_getputremote) The current SET GET-PUT-REMOTE setting ([378]Section 3.8
  5173. )
  5174.   \v(ftp_host)      Name or IP address of FTP server ([379]Section 3)
  5175.   \v(ftp_loggedin)  FTP login status ([380]Section 3)
  5176.   \v(ftp_message)   Most recent FTP response message ([381]Section 3)
  5177.   \v(ftp_security)  FTP Security method ([382]Section 3.2)
  5178.   \v(ftp_server)    OS type of FTP server ([383]Section 3)
  5179.  
  5180.   \v(http_code)      Most recent HTTP response code
  5181.   \v(http_connected) HTTP connection status
  5182.   \v(http_host)      Name or IP address of HTTP server
  5183.   \v(http_message)   Most recent HTTP response message
  5184.   \v(http_security)  TLS cipher used to secure the HTTP session
  5185.  
  5186.   \v(hour)           Hour of the day, 0 to 23.
  5187.   \v(timestamp)      Equivalent to "\v(ndate) \v(time)".
  5188.  
  5189.    The following new or improved built-in functions are available:
  5190.    
  5191.   \fcmdstack()            Allows programmatic access to the command stack.
  5192.   \fcvtdate()             [384]Section 8.13
  5193.   \fdelta2secs()          [385]Section 8.13
  5194.   \fdostounixpath(s1)     Converts a DOS filename to Unix format.
  5195.   \fsplit()               Now allows grouping/nesting in source string.
  5196.   \fword()                Allows the same grouping and nesting.
  5197.   \fjoin(&a,s1,n1,n2)     Copies an array into a single string.
  5198.   \fsubstitute(s1,s2,s3)  Substitutes characters within a string.
  5199.   \freplace()             Has new 4th "occurrence" argument.
  5200.   \fcvtdate()             Now accepts several format options.
  5201.   \fsexpression()         Evaluates an S-Expression (explained in [386]Section
  5202. 9).
  5203.   \ftrim(), \fltrim()     Now trim CR and LF by default, as well as SP and Tab.
  5204.   \funixtodospath(s1)     Converts a Unix filename to DOS format.
  5205.   \fkeywordval(s1,c1)     Assigns values to keywords (macros) (explained below)
  5206. .
  5207.  
  5208.    Most functions that have "2" in their names to stand for the word "2"
  5209.    can now also be written with "to", e.g. "\fdelta2secs(),"
  5210.    \fdeltatosecs()."
  5211.    
  5212.   8.7.1. The \fkeywordval() Function
  5213.   
  5214.    \fkeywordval(s1,c1) is new. Given a string s1 of the form
  5215.    "name=value", it creates a macro with the given name and assigns it
  5216.    the given value. If no value appears after the equal sign, any
  5217.    existing macro of the given name is undefined. Blanks are
  5218.    automatically trimmed from around the name and value. The optional c1
  5219.    parameter is the assignment operator character, equal sign (=) by
  5220.    default. This function is handy for processing keyword parameters or
  5221.    any other form of parameter-value pair. Suppose, for example, you want
  5222.    to write a macro that accepts keyword parameters rather than
  5223.    positional ones:
  5224.    
  5225.   define MYDIAL {
  5226.       local \%i modem hangup method device speed number
  5227.       def number 5551234          ; Assign default parameter values
  5228.       def speed 57600
  5229.       def modem usrobotics
  5230.       def hangup rs232
  5231.       def method tone
  5232.       def country 1
  5233.       for \%i 1 \v(argc)-1 1 {    ; Parse any keyword parameters...
  5234.           if not \fkeywordval(\&_[\%i]) end 1 Bad parameter: "\&_[\%i]"
  5235.       }
  5236.       set dial country \m(country)
  5237.       set modem type \m(modem)
  5238.       set modem hang \m(hangup)
  5239.       set dial method \m(tone)
  5240.       set line \m(device)
  5241.       if fail stop 1
  5242.       set speed \m(speed)
  5243.       if fail stop 1
  5244.       show comm
  5245.       set dial display on
  5246.       dial \m(number)
  5247.       if success connect
  5248.   }
  5249.  
  5250.    In this example, all the defaults are set up inside the macro, and
  5251.    therefore it can be invoked with no parameters at all. But if you want
  5252.    to have the macro dial a different number, you can supply it as
  5253.    follows:
  5254.    
  5255.   mydial number=7654321
  5256.  
  5257.    You can supply any number of keyword parameters, and you can give them
  5258.    in any order:
  5259.    
  5260.   mydial number=7654321 hangup=modem speed=115200
  5261.  
  5262.   8.7.2. The \fsplit(), \fjoin(), and \fword() Functions
  5263.   
  5264.    \fjoin(&a,s1,n1,n2) is also new; it creates a string from an array (or
  5265.    a piece of one). &a is the name of the array (a range specifier can be
  5266.    included); s1 is a character or string to separate each element in the
  5267.    result string (can be omitted, in which case the elements are not
  5268.    separated at all), and n1 is a grouping mask, explained below. If s1
  5269.    is empty or not specified, the array elements are separated with
  5270.    spaces. If you want the elements concatenated with no separator,
  5271.    include a nonzero n2 argument. Given the array:
  5272.    
  5273.   declare \&a[] = 0 1 2 3 4 5 6 7 8 9
  5274.  
  5275.    you can get effects like this:
  5276.    
  5277.   \fjoin(&a)      0 1 2 3 4 5 6 7 8 9
  5278.   \fjoin(&a,:)    0:1:2:3:4:5:6:7:8:9
  5279.   \fjoin(&a,{,})  0,1,2,3,4,5,6,7,8,9
  5280.   \fjoin(&a,...)  0...1...2...3...4...5...6...7...8...9
  5281.   \fjoin(&a,,,1)  0123456789
  5282.  
  5283.    \fsplit(), \fword(), \fstripb(), and \fjoin() accept a "grouping mask"
  5284.    argument, n1, which is a number from 0 to 63, in which:
  5285.    
  5286.    1 = "" doublequotes
  5287.    2 = {} braces
  5288.    4 = '' singlequotes
  5289.    8 = () parentheses
  5290.   16 = [] square brackets
  5291.   32 = <> angle brackets
  5292.  
  5293.    These can be OR'd (added) together to make any number 0-63 (-1 is
  5294.    treated the same as 63, 0 means no grouping). If a bit is on, the
  5295.    corresponding kind of grouping is selected. (If more than 1 bit is set
  5296.    for \fjoin(), only the lowest-order one is used.)
  5297.    
  5298.    If you include the same character in the grouping mask and the include
  5299.    list, the grouping mask takes precedence. Example:
  5300.    
  5301.   def \%a  a "b c d" e
  5302.   \fsplit(\%a,&a[],,,-1)  = 3  <-- doublequote used for grouping
  5303.   \fsplit(\%a,&a[],,",-1) = 3  <-- doublequote still used for grouping
  5304.  
  5305.    Nesting of matched left and right grouping characters (parentheses,
  5306.    braces, and brackets, but not quotes) is recognized. Example:
  5307.    
  5308.   def \%a a (b c <d e [f g {h i} j k] l m> n o) p
  5309.   \fsplit(\%a,&a,,,0)  = 16 (no grouping)
  5310.   \fsplit(\%a,&a,,,2)  = 15 (braces only)
  5311.   \fsplit(\%a,&a,,,16) = 11 (square brackets only)
  5312.   \fsplit(\%a,&a,,,32) =  7 (angle brackets only)
  5313.   \fsplit(\%a,&a,,,63) =  3 (all)
  5314.   \fsplit(\%a,&a,,,-1) =  3 (all)
  5315.  
  5316.    \fsplit() and \fjoin() are "reciprocal" functions. You can split a
  5317.    string up into an array and join it back into a new string that is
  5318.    equivalent, as long as \fsplit() and \fjoin() are given equivalent
  5319.    grouping masks, except that the type of braces might change. Example:
  5320.    
  5321.   def \%a a {b c [d e] f g} "h i" j <k l> m
  5322.   echo STRING=[\%a]
  5323.   echo WORDS=\fsplit(\%a,&a,,,-1)
  5324.   show array a
  5325.   asg \%b \fjoin(&a,{ },2)
  5326.   echo JOIN  =[\%b]
  5327.   echo WORDS=\fsplit(\%b,&b,,,-1)
  5328.   show array b
  5329.  
  5330.    The arrays a and b are identical. The strings a and b are as follows:
  5331.    
  5332.   \%a: a {b c [d e] f g} "h i" j <k l> m
  5333.   \%b: a {b c [d e] f g} {h i} j {k l} m
  5334.  
  5335.    It is possible to quote separator grouping characters with backslash
  5336.    to override their grouping function. And of course to include
  5337.    backslash itself in the string, it must be quoted too. Furthermore,
  5338.    each backslash must be doubled, so the command parser will still pass
  5339.    one backslash to \fsplit() for each two that it sees. Here are some
  5340.    examples using \fsplit() with a grouping mask of 8 (treat parentheses
  5341.    as grouping characters).
  5342.    
  5343.   String                  Result
  5344.     a b c d e f             6
  5345.     a b\\ c d e f           5
  5346.     a b (c d e) f           4
  5347.     a b \\(c d e\\) f       6
  5348.     a b \\\\(c d e\\\\) f   7
  5349.  
  5350.    \fsplit() has also been changed to create its array (if one is given)
  5351.    each time it is called, so now it can be conveniently called in a loop
  5352.    without having to redeclare the array each time.
  5353.    
  5354.    Incidentally... Sometimes you might want to invoke \fsplit() in a
  5355.    situation where you don't care about its return value, e.g. when you
  5356.    just want to fill the array. Now you can "call" \fsplit() or any other
  5357.    function with the new [387]VOID command:
  5358.    
  5359.   void \fsplit(\%a,&a)
  5360.  
  5361.    \fsplit() and \fjoin() also accept a new, optional 6th argument, an
  5362.    options flag, a number that can specify a number of options. So far
  5363.    there is just one option, whose value is 1:
  5364.    
  5365.    separator-flag
  5366.           Normally separators are collapsed. So, for example,
  5367.           
  5368.   \fword(Three        little          words,2)
  5369.  
  5370.           returns "little" (the second word). Space is a separator, but
  5371.           there are multiple spaces between each word. If the value 1 is
  5372.           included in the option flag, however, each separator counts. If
  5373.           two separators are adjacent, an empty word is produced between
  5374.           them. This is useful for parsing (e.g.) comma-separated lists
  5375.           exported from databases or spreadsheets.
  5376.           
  5377.   8.7.3. The \fcmdstack() Function
  5378.   
  5379.    The new \fcmdstack() function gives access to the command stack:
  5380.    
  5381.    \fcmdstack(n1,n2)
  5382.           Arguments: n1 is the command stack level. If omitted, the
  5383.           current level, \v(cmdlevel), is used. n2 is a function code
  5384.           specifying the desired type of information:
  5385.           
  5386.  
  5387.   0 (default) = name of object at level n1.
  5388.   1 (nonzero) = object type (0 = prompt; 1 = command file; 2 = macro).
  5389.  
  5390.    The default for n2 is 0.
  5391.           
  5392.    The name associated with prompt is "(prompt)". Here's a loop that can
  5393.    be included in a macro or command file to show the stack (similar to
  5394.    what the SHOW STACK command does):
  5395.    
  5396.   for \%i \v(cmdlevel) 0 -1 {
  5397.       echo \%i. [\fcmdstack(\%i,1)] \fcmdstack(\%i,0)
  5398.   }
  5399.  
  5400.    In this connection, note that \v(cmdfile) always indicates the most
  5401.    recently invoked active command file (if any), even if that file is
  5402.    executing a macro. Similarly, \v(macro) indicates the most recently
  5403.    invoked macro (if any), even if the current command source is not a
  5404.    macro. The name of the "caller" of the currently executing object
  5405.    (command file or macro) is:
  5406.    
  5407.   \fcmdstack(\v(cmdlevel)-1)
  5408.  
  5409.    and its type is:
  5410.    
  5411.   \fcmdstack(\v(cmdlevel)-1,1)
  5412.  
  5413.    To find the name of the macro that invoked the currently executing
  5414.    object, even if one or more intermediate command files (or prompting
  5415.    levels) are involved, use a loop like this:
  5416.    
  5417.   for \%i \v(cmdlevel)-1 0 -1 {
  5418.       if = \fcmdstack(\%i,1) 2 echo CALLER = \fcmdstack(\%i,0)
  5419.   }
  5420.  
  5421.    Of course if you make a macro to do this, the macro must account for
  5422.    its own additional level:
  5423.    
  5424.   define CALLER {
  5425.       for \%i \v(cmdlevel)-2 0 -1 {
  5426.           if = \fcmdstack(\%i,1) 2 return \fcmdstack(\%i,0)
  5427.       }
  5428.       return "(none)"
  5429.   }
  5430.  
  5431.    The built-in variable \v(cmdsource) gives the current command source
  5432.    as a word ("prompt", "file", or "macro").
  5433.    
  5434.   8.7.4. The VOID Command
  5435.   
  5436.    VOID is like ECHO in that all functions and variables in its argument
  5437.    text are evaluated. but it doesn't print anything (except possibly an
  5438.    error message if a function was invocation contained or resulted in
  5439.    any errors). VOID sets FAILURE if it encounters any errors, SUCCESS
  5440.    otherwise.
  5441.    
  5442.    [ [388]Top ] [ [389]Contents ] [ [390]C-Kermit Home ] [ [391]Kermit
  5443.    Home ]
  5444.      _________________________________________________________________
  5445.    
  5446.   8.8. The RETURN and END Commands
  5447.   
  5448.    The execution of a macro is terminated in any of the following ways:
  5449.    
  5450.      * With an END [ number [ message ] ] command. If a number is given,
  5451.        the macro succeeds if the number is 0, and fails if it is not
  5452.        zero; if a number is not given, the macro succeeds.
  5453.      * With a STOP command, which works just like END except it peels
  5454.        back the command stack all the way to top level.
  5455.      * With a RETURN [ text ] command, in which case the macro always
  5456.        succeeds.
  5457.      * By running out of commands to execute, in which case the macro
  5458.        succeeds or fails according the most recently executed command
  5459.        that sets success or failure.
  5460.        
  5461.    The same considerations apply to command files invoked by the TAKE
  5462.    command.
  5463.    
  5464.    If a macro does not execute any commands that set success or failure,
  5465.    then invoking the macro does not change the current SUCCESS/FAILURE
  5466.    status. It follows, then, that the mere invocation of a macro does not
  5467.    change the SUCCESS/FAILURE status either. This makes it possible to
  5468.    write macros to react to the status of other commands (or macros), for
  5469.    example:
  5470.    
  5471.   define CHKLINE {
  5472.       if success end 0
  5473.       stop 1 SET LINE failed - please try another device.
  5474.   }
  5475.   set modem type usrobotics
  5476.   set line /dev/cua0
  5477.   chkline
  5478.   set speed 57600
  5479.   dial 7654321
  5480.  
  5481.    By the way, none of this is news. But it was not explicitly documented
  5482.    before, and C-Kermit 7.0 and earlier did not always handle the RETURN
  5483.    statement as it should have.
  5484.    
  5485.    [ [392]Top ] [ [393]Contents ] [ [394]C-Kermit Home ] [ [395]Kermit
  5486.    Home ]
  5487.      _________________________________________________________________
  5488.    
  5489.   8.9. UNDEFINing Groups of Variables
  5490.   
  5491.    The UNDEFINE command, which previously accepted one variable name, now
  5492.    accepts a list of them, and also accepts wildcard notation to allow
  5493.    deletion of variables that match a given pattern.
  5494.    
  5495.    UNDEFINE [ switches ] name [ name [ name [ ... ] ] ]
  5496.           Undefines the variables whose names are given. Up to 64 names
  5497.           may be given in one UNDEFINE command.
  5498.           
  5499.    If you omit the switches and include only one name, the UNDEFINE
  5500.    command works as before.
  5501.    
  5502.    Switches include:
  5503.    
  5504.    /MATCHING
  5505.           Specifies that the names given are to treated as patterns
  5506.           rather than literal variable names. Note: pattern matching
  5507.           can't be used with array references; use the ARRAY command to
  5508.           manipulate arrays and subarrays.
  5509.           
  5510.    /LIST
  5511.           List the name of each variable to be undefined, and whether it
  5512.           was undefined successfully ("ok" or "error"), plus a summary
  5513.           count at the end.
  5514.           
  5515.    /SIMULATE
  5516.           List the names of the variables that would be deleted without
  5517.           actually deleting them. Implies /LIST.
  5518.           
  5519.    The UNDEFINE command fails if there were any errors and succeeds
  5520.    otherwise.
  5521.    
  5522.    The new _UNDEFINE command is like UNDEFINE, except the names are
  5523.    assumed to be variable names themselves, which contain the names (or
  5524.    parts of them) of the variables to be undefined. For example, if you
  5525.    have the following definitions:
  5526.    
  5527.   define \%a foo
  5528.   define foo This is some text
  5529.  
  5530.    then:
  5531.    
  5532.   undef \%a
  5533.  
  5534.    undefines the variable \%a, but:
  5535.    
  5536.   _undef \%a
  5537.  
  5538.    undefines the macro foo.
  5539.    
  5540.    Normal Kermit patterns are used for matching; metacharacters include
  5541.    asterisk, question mark, braces, and square brackets. Thus, when using
  5542.    the /MATCHING switch, if the names of the macros you want to undefine
  5543.    contain any of these characters, you must quote them with backslash to
  5544.    force them to be taken literally. Also note that \%* is not the name
  5545.    of a variable; it is a special notation used within a macro for "all
  5546.    my arguments". The command "undef /match \%*" deletes all \%x
  5547.    variables, where x is 0..9 and a..z. Use "undef /match \%[0-9]" to
  5548.    delete macro argument variables or "undef /match \%[i-n]" to delete a
  5549.    range of \%x variables.
  5550.    
  5551.    [ [396]Top ] [ [397]Contents ] [ [398]C-Kermit Home ] [ [399]Kermit
  5552.    Home ]
  5553.      _________________________________________________________________
  5554.    
  5555.   8.10. The MINPUT Command
  5556.   
  5557.    The MINPUT command can be used to search the incoming data stream for
  5558.    several targets simultaneously. For example:
  5559.    
  5560.   MINPUT 8 one two three
  5561.  
  5562.    waits up to 8 seconds for one of the words "one", "two", or "three" to
  5563.    arrive. Words can be grouped to indicate targets that contain spaces:
  5564.    
  5565.   MINPUT 8 nineteeen twenty "twenty one"
  5566.  
  5567.    And of course you can also use variables in place of (or as part of)
  5568.    the target names:
  5569.    
  5570.   MINPUT 8 \%a \&x[3] \m(foo)
  5571.  
  5572.    Until now you had to know the number of targets in advance when
  5573.    writing the MINPUT statement. Each of the examples above has exactly
  5574.    three targets.
  5575.    
  5576.    But suppose your script needs to look for a variable number of
  5577.    targets. For this you can use arrays and \fjoin(), described in
  5578.    [400]Section 8.7. Any number of \fjoin() invocations can be included
  5579.    in the MINPUT target list, and each one is expanded into the
  5580.    appropriate number of separate targets each time the MINPUT command is
  5581.    executed. Example:
  5582.    
  5583.   declare \&a[10] = one two three
  5584.   minput 10 foo \fjoin(&a) bar
  5585.  
  5586.    This declares an array of ten elements, and assigns values to the
  5587.    first three of them. The MINPUT command looks for these three (as well
  5588.    as the words "foo" and "bar"). Later, if you assign additional
  5589.    elements to the array, the same MINPUT command also looks for the new
  5590.    elements.
  5591.    
  5592.    If an array element contains spaces, each word becomes a separate
  5593.    target. To create one target per array element, use \fjoin()'s
  5594.    grouping feature:
  5595.    
  5596.   dcl \&a[] = {aaa bbb} {ccc ddd} {xxx yyy zzz}
  5597.  
  5598.   minput 10 \fjoin(&a)     <-- 7 targets
  5599.   minput 10 \fjoin(&a,,2)  <-- 3 targets
  5600.  
  5601.    [ [401]Top ] [ [402]Contents ] [ [403]C-Kermit Home ] [ [404]Kermit
  5602.    Home ]
  5603.      _________________________________________________________________
  5604.    
  5605.   8.11. Learned Scripts
  5606.   
  5607.    C-Kermit now includes a simple script recorder that monitors your
  5608.    commands, plus your actions during CONNECT mode, and automatically
  5609.    generates a script program that mimics what it observed. You should
  5610.    think of this feature as a script-writing ASSISTANT since, as you will
  5611.    see [405]later in this section, the result generally needs some
  5612.    editing to make it both secure and flexible. The script recorder is
  5613.    controlled by the new LEARN command:
  5614.    
  5615.    LEARN [ /ON /OFF /CLOSE ] [ filename ]
  5616.           If you give a filename, the file is opened for subsequent
  5617.           recording. The /ON switch enables recording to the current file
  5618.           (if any); /OFF disables recording. /CLOSE closes the current
  5619.           script recording file (if any). If you give a filename without
  5620.           any switches, /ON is assumed.
  5621.           
  5622.    The /OFF and /ON switches let you turn recording off and on during a
  5623.    session without closing the file.
  5624.    
  5625.    When recording:
  5626.    
  5627.      * All commands that you type (or recall) at the prompt are recorded
  5628.        in the file except:
  5629.           + LEARN commands are not recorded.
  5630.           + The CONNECT command is not recorded.
  5631.           + The TELNET command is converted to SET HOST /NETWORK:TCP.
  5632.      * Commands obtained from macros or command files are not recorded.
  5633.      * During CONNECT:
  5634.           + Every line you type is converted to an OUTPUT command.
  5635.           + The last prompt before any line you type becomes an INPUT
  5636.             command.
  5637.           + Timeouts are calculated automatically for each INPUT command.
  5638.           + A PAUSE command is inserted before each OUTPUT command just
  5639.             to be safe.
  5640.        
  5641.    Thus the script recorder is inherently line-oriented. It can't be used
  5642.    to script character-oriented interactions like typing Space to a
  5643.    "More?" prompt or editing a text file with VI or EMACS.
  5644.    
  5645.    But it has advantages too; for example it takes control characters
  5646.    into account that might not be visible to you otherwise, and it
  5647.    automatically converts control characters in both the input and output
  5648.    streams to the appropriate notation. It can tell, for example that the
  5649.    "$ " prompt on the left margin in UNIX is really {\{13}\{10}$ },
  5650.    whereas in VMS it might be {\{13}\{10}\{13}$ }. These sequences are
  5651.    detected and recorded automatically.
  5652.    
  5653.    A learned script should execute correctly when you give a TAKE command
  5654.    for it. However, it is usually appropriate to edit the script a bit.
  5655.    The most important change would be to remove any passwords from it.
  5656.    For example, if the script contains:
  5657.    
  5658.   INPUT 9 {\{13}\{10}Password: }
  5659.   IF FAIL STOP 1 INPUT timeout
  5660.   PAUSE 1
  5661.   OUTPUT bigsecret\{13}
  5662.  
  5663.    you should replace this by something like:
  5664.    
  5665.   INPUT 9 {\{13}\{10}Password: }
  5666.   IF FAIL STOP 1 INPUT timeout
  5667.   ASKQ pswd Please type your password:
  5668.   PAUSE 1
  5669.   OUTPUT \m(pswd)\{13}
  5670.  
  5671.    The LEARN command can't do this for you since it knows nothing about
  5672.    "content"; it only knows about lines and can't be expected to parse or
  5673.    understand them -- after all, the Password prompt might be in some
  5674.    other language. So remember: if you use to LEARN command to record a
  5675.    login script, be sure edit the resulting file to remove any passwords.
  5676.    Also be sure to delete any backup copies your editor or OS might have
  5677.    made of the file.
  5678.    
  5679.    Other manual adjustments might also be appropriate:
  5680.    
  5681.      * If the target of an INPUT command can vary, you can replace the
  5682.        INPUT command with MINPUT and the appropriate target list, and/or
  5683.        the target with a \fpattern(). For example, suppose you are
  5684.        dialing a number that can be answered by any one of 100 terminal
  5685.        servers, whose prompts are ts-00>, ts-01>, ts-02>, ... ts-99>. The
  5686.        script records a particular one of these, but you want it to work
  5687.        for all of them, so change (e.g.):
  5688.  
  5689.   INPUT 10 ts-23>  ; or whatever
  5690.        to:
  5691.  
  5692.   INPUT 10 \fpattern(ts-[0-9][0-9]>)
  5693.      * The INPUT timeout values are conservative, but they are based only
  5694.        on a single observation; you might need to tune them.
  5695.      * The PAUSE commands might not be necessary, or the PAUSE interval
  5696.        might need adjustment.
  5697.      * In case you made typographical errors during recording, they are
  5698.        incorporated in your script; you can edit them out if you want to.
  5699.        
  5700.    Here is a sample script generated by Kermit ("learn vms.ksc") in which
  5701.    a Telnet connection is made to a VMS computer, the user logs in,
  5702.    starts Kermit on VMS, sends it a file, and then logs out:
  5703.    
  5704.   ; Scriptfile: vms.ksc
  5705.   ; Directory:  /usr/olga
  5706.   ; Recorded:   20001124 15:21:23
  5707.  
  5708.   SET HOST /NETWORK:TCP vms.xyzcorp.com
  5709.   IF FAIL STOP 1 Connection failed
  5710.  
  5711.   INPUT 7 {\{13}\{10}\{13}Username: }
  5712.   IF FAIL STOP 1 INPUT timeout
  5713.   PAUSE 1
  5714.   OUTPUT olga\{13}
  5715.   INPUT 3 {\{13}\{10}\{13}Password: }
  5716.   IF FAIL STOP 1 INPUT timeout
  5717.   PAUSE 1
  5718.   OUTPUT secret\{13}
  5719.   INPUT 18 {\{13}\{10}\{13}$ }
  5720.   IF FAIL STOP 1 INPUT timeout
  5721.   PAUSE 1
  5722.   OUTPUT set default [.incoming]\{13}
  5723.   INPUT 12 {\{13}\{10}\{13}$ }
  5724.   IF FAIL STOP 1 INPUT timeout
  5725.   PAUSE 1
  5726.   OUTPUT kermit\{13}
  5727.   INPUT 15 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
  5728.   IF FAIL STOP 1 INPUT timeout
  5729.   PAUSE 1
  5730.   OUTPUT receive\{13}
  5731.   send myfile.txt
  5732.  
  5733.   INPUT 18 {\{13}\{10}\{13}ALTO:[OLGA.INCOMING] C-Kermit>}
  5734.   IF FAIL STOP 1 INPUT timeout
  5735.   PAUSE 1
  5736.   OUTPUT exit\{13}
  5737.   INPUT 6 {\{13}\{10}\{13}$ }
  5738.   IF FAIL STOP 1 INPUT timeout
  5739.   PAUSE 1
  5740.   OUTPUT logout\{13}
  5741.   close
  5742.   exit
  5743.  
  5744.    The commands generated by Kermit during CONNECT (INPUT, IF FAIL,
  5745.    PAUSE, and OUTPUT) have uppercase keywords; the commands typed by the
  5746.    user are in whatever form the user typed them (in this case,
  5747.    lowercase).
  5748.    
  5749.    [ [406]Top ] [ [407]Contents ] [ [408]C-Kermit Home ] [ [409]Kermit
  5750.    Home ]
  5751.      _________________________________________________________________
  5752.    
  5753.   8.12. Pattern Matching
  5754.   
  5755.    A pattern is a character string that is used to match other strings.
  5756.    Patterns can contain metacharacters that represent special actions
  5757.    like "match any single character", "match zero or more characters",
  5758.    "match any single character from a list", and so on. The best known
  5759.    application of patterns is in file specifications that contain
  5760.    wildcards, as in "send *.txt", meaning "send all files whose names end
  5761.    with .txt".
  5762.    
  5763.    Patterns are also used in increasingly many other ways, to the extent
  5764.    it is useful to point out certain important distinctions in the ways
  5765.    in which they are used:
  5766.    
  5767.    Anchored Patterns
  5768.           If an anchored pattern does not begin with "*", it must match
  5769.           the beginning of the string, and if it does not end with "*",
  5770.           it must match the end of the string. For example, the anchored
  5771.           pattern "abc" matches only the string "abc", not "abcde" or
  5772.           "xyzabc" or "abcabc". The anchored pattern "abc*" matches any
  5773.           string that starts with "abc"; the anchored pattern "*abc"
  5774.           matches any string that ends with "abc"; the anchored pattern
  5775.           "*abc*" matches any string that contains "abc" (which including
  5776.           any that start and/or end with it).
  5777.           
  5778.    Floating Patterns
  5779.           A floating pattern matches any string that contains a substring
  5780.           that matches the pattern. In other words, a floating pattern
  5781.           has an implied "*" and the beginning and end. You can anchor a
  5782.           floating pattern to the beginning by starting it with "^", and
  5783.           you can anchor it to the end by ending it with "$" (see
  5784.           examples below).
  5785.           
  5786.    Wildcards
  5787.           A wildcard is an anchored pattern that has the additional
  5788.           property that "*" does not match directory separators.
  5789.           
  5790.    This terminology lets us describe Kermit's commands with a bit more
  5791.    precision. When a pattern is used for matching filenames, it is a
  5792.    wildcard, except in the TEXT-PATTERNS and BINARY-PATTERNS lists and
  5793.    /EXCEPT: clauses, in which case directory separators are not
  5794.    significant (for example, a BINARY-PATTERN of "*.exe" matches any file
  5795.    whose name ends in .exe, no matter how deeply it might be buried in
  5796.    subdirectories. When Kermit parses a file specification directly,
  5797.    however, it uses the strict wildcard definition. For example, "send
  5798.    a*b" sends all files whose names start with "a" and end with "b" in
  5799.    the current directory, and not any files whose names end with "b" that
  5800.    happen to be in subdirectories whose names start with "a". And as
  5801.    noted, wildcards are anchored, so "delete foo" deletes the file named
  5802.    "foo", and not all files whose names happen to contain "foo".
  5803.    
  5804.    Most other patterns are anchored. For example:
  5805.    
  5806.   if match abc bc ...
  5807.  
  5808.    does not succeed (and you would be surprised if it did!). In fact, the
  5809.    only floating patterns are the ones used by commands or functions that
  5810.    search for patterns in files, arrays, or strings. These include:
  5811.    
  5812.      * The GREP and TYPE /MATCH commands.
  5813.      * The \fsearch(), \frsearch(), and \farraylook() functions.
  5814.        
  5815.    Thus these are the only contexts in which explicit anchors ("^" and
  5816.    "$") may be used:
  5817.    
  5818.    grep abc *.txt
  5819.           Prints all lines containing "abc" in all files whose names end
  5820.           with ".txt".
  5821.           
  5822.    grep ^abc *.txt
  5823.           Prints all lines that start with "abc" in all ".txt" files.
  5824.           
  5825.    grep abc$ *.txt
  5826.           Prints all lines that end with "abc" in all ".txt" files.
  5827.           
  5828.    grep ^a*z$ *.txt
  5829.           Prints all lines that start with "a" and end with "z" in all
  5830.           ".txt" files.
  5831.           
  5832.    Similarly for TYPE /PAGE, /fsearch(), /frsearch(), and \farraylook().
  5833.    
  5834.    Here is a brief summary of anchored and floating pattern equivalences:
  5835.    
  5836.   Anchored   Floating
  5837.     abc       ^abc$
  5838.     *abc      abc$
  5839.     abc*      ^abc
  5840.     *abc*     abc
  5841.  
  5842.    [ [410]Top ] [ [411]Contents ] [ [412]C-Kermit Home ] [ [413]Kermit
  5843.    Home ]
  5844.      _________________________________________________________________
  5845.    
  5846.   8.13. Dates and Times
  5847.   
  5848.    C-Kermit's comprehension of date-time formats is considerably expanded
  5849.    in version 8.0. Any command that reads dates, including the DATE
  5850.    command itself, or any switch, such as the /BEFORE: and /AFTER:
  5851.    switches, or any function such as \fcvtdate(), now can understand
  5852.    dates and times expressed in any ISO 8601 format, in Unix "asctime"
  5853.    format, in FTP MDTM format, and in practically any format used in RFC
  5854.    822 or RFC 2822 electronic mail, with or without timezones, and in a
  5855.    great many other formats as well. HELP DATE briefly summarizes the
  5856.    acceptable date-time formats.
  5857.    
  5858.    Furthermore, C-Kermit 8.0 includes a new and easy-to-use form of
  5859.    date-time arithmetic, in which any date or time can be combined with a
  5860.    "delta time", to add or subtract the desired time interval (years,
  5861.    months, weeks, days, hours, minutes, seconds) to/from the given date.
  5862.    And new functions are available to compare dates and to compute their
  5863.    differences.
  5864.    
  5865.    As you can imagine, all this requires quite a bit of "syntax". The
  5866.    basic format is:
  5867.    
  5868.   [ date ] [ time ] [ delta ]
  5869.  
  5870.    Each field is optional, but in most cases (depending on the context)
  5871.    there must be at least one field. If a date is given, it must come
  5872.    first. If no date is given, the current date is assumed. If no time is
  5873.    given, an appropriate time is supplied depending on whether a date was
  5874.    supplied. If no delta is given, no arithmetic is done. If a delta is
  5875.    given without a date or time, the current date and time are used as
  5876.    the base.
  5877.    
  5878.    Date-time-delta fields are likely to contain spaces (although they
  5879.    need not; space-free forms are always available). Therefore, in most
  5880.    contexts -- and notably as switch arguments -- date-time information
  5881.    must be enclosed in braces or doublequotes, for example:
  5882.    
  5883.   send /after:"8-Aug-2001 12:00 UTC" *.txt
  5884.  
  5885.    Kermit's standard internal format for dates and times is:
  5886.    
  5887.   yyyymmdd hh:mm:ss
  5888.  
  5889.    for example:
  5890.    
  5891.   20010208 10:28:01
  5892.  
  5893.    Date-times can always be given in this format. yyyy is the 4-digit
  5894.    year, mm is the two-digit month (1-12; supply leading zero for
  5895.    Jan-Sep), dd is the 2-digit day (leading zero for 1-9), hh is the hour
  5896.    (0-23), mm the minute (0-59), ss the second (0-59), each with leading
  5897.    zero if less than the field width. The date and time can be separated
  5898.    by a space, an underscore, a colon, or the letter T. The time is in
  5899.    24-hour format. Thus the various quantites are at the following fixed
  5900.    positions:
  5901.    
  5902. Position  Contents                    
  5903.    1-4    Year   (4 digits, 0000-9999)
  5904.    5-6    Month  (2 digits, 1-12)
  5905.    7-8    Day    (2 digits, 1-31)
  5906.    9      Date-Time Separator (space, :, _, or the letter T)
  5907.   10-11   Hour   (2 digits, 0-23)
  5908.   12      Hour-Minute Separator (colon)
  5909.   13-14   Minute (2 digits, 0-59)
  5910.   15      Minute-Second Separator (colon)
  5911.   16-17   Second (2 digits, 0-59)
  5912.  
  5913.    Example:
  5914.    
  5915.   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
  5916.  
  5917.    This is the format produced by the DATE command and by any function
  5918.    that returns a date-time. It is suitable for lexical comparison and
  5919.    sorting, and for use as a date-time in any Kermit command. When this
  5920.    format is given as input to a command or function, various date-time
  5921.    separators (as noted) are accepted:
  5922.    
  5923.   19800526 13:07:12  26 May 1980, 13:07:12 (1:07:12PM)
  5924.   20010208_10:28:35  2 February 2001, 10:28:35 AM
  5925.   18580101:12:00:00  1 January 1858, noon
  5926.   20110208T00:00:00  2 February 2011, midnight
  5927.  
  5928.    Certain other special date-time formats that are encountered on
  5929.    computer networks are recognized:
  5930.    
  5931.    Asctime Format
  5932.           
  5933.    This is a fixed format used by Unix, named after Unix's asctime()
  5934.           ("ASCII time") function. It is always exactly 24 characters
  5935.           long. Example: Fri Aug 10 16:38:01 2001
  5936.           
  5937.    Asctime with Timezone
  5938.           
  5939.    This is like Asctime format, but includes a 3-character timezone
  5940.           between the time and year. It is exactly 28 characters long.
  5941.           Example: Fri Aug 10 16:38:01 GMT 2001
  5942.           
  5943.    E-Mail Format
  5944.           E-mail date-time formats are defined in [414]RFC 2822 with a
  5945.           fair amount of flexibility and options. The following examples
  5946.           are typical of e-mails and HTTP (web-page) headers:
  5947.           
  5948.  
  5949.   Sat, 14 Jul 2001 11:49:29                (No timezone)
  5950.   Fri, 24 Mar 2000 14:19:59 EST            (Symbolic timezone)
  5951.   Tue, 26 Jun 2001 10:19:45 -0400 (EDT)    (GMT Offset + comment)
  5952.  
  5953.    FTP MDTM Format
  5954.           
  5955.    This is the date-time format supplied by FTP servers that support the
  5956.           (not yet standard but widely used nevertheless) MDTM command,
  5957.           by which the FTP client asks for a file's modification time:
  5958.           
  5959.   yyyymmddhhmmss[.ffff]
  5960.  
  5961.           where yyyy is the 4-digit year, mm is the 2-digit month, and so
  5962.           on, exactly 14 digits long. An optional fractional part
  5963.           (fraction of second) may also be included, separated by a
  5964.           decimal point (period). Kermit rounds to the nearest second.
  5965.           Example:
  5966.           
  5967.   20020208102835.515                       (8 February 2002 10:28:36 AM)
  5968.  
  5969.     8.13.1. The Date
  5970.     
  5971.    The date, if given, must precede the time and/or delta, and can be in
  5972.    many, many formats. For starters, you can use several symbolic date
  5973.    names in place of actual dates:
  5974.    
  5975.    NOW
  5976.           This is replaced by the current date and time. The time can not
  5977.           be overriden (if you want to supply a specific time, use TODAY
  5978.           rather than NOW).
  5979.           
  5980.    TODAY
  5981.           This is replaced by the current date and a default time of
  5982.           00:00:00 is supplied, but can be overridden by a specific time;
  5983.           for example, if today is 8 February 2002, then "TODAY" is
  5984.           "20020802 00:00:00" but "TODAY 10:28" is "20020802 10:28:00".
  5985.           
  5986.    TOMORROW
  5987.           Like TODAY, but one day later (if today is 8 February 2002,
  5988.           then "TOMORROW" is "20020803 00:00:00" but "TOMORROW 16:30" is
  5989.           "20020803 16:30:00").
  5990.           
  5991.    YESTERDAY
  5992.           Like TODAY, but one day earlier.
  5993.           
  5994.    MONDAY, TUESDAY, WEDNESDAY, ..., SUNDAY
  5995.           The date on the given day of the week, today or later. A
  5996.           default time of 00:00:00 is supplied but can be overridden.
  5997.           Example: "SATURDAY 12:00" means next Saturday (or today, if
  5998.           today is Saturday) at noon.
  5999.           
  6000.    You can give an explicit date in almost any conceivable format, but
  6001.    there are some rules:
  6002.    
  6003.      * If a date is given, it must have three fields: day, month, and
  6004.        year; the order can vary (except that the month can not be last).
  6005.      * If names are used for days, months, etc, they must be English.
  6006.      * The year must lie between 0000 and 9999, inclusive.
  6007.      * All calendar calculations use Gregorian dating, so calculated
  6008.        dates for years prior to 1582 (or later, depending on the country)
  6009.        will not agree with historical dates. Other forms of dating (e.g.
  6010.        Hebrew, Chinese) are not supported.
  6011.        
  6012.    Various date-field separators are accepted: hyphen, slash, space,
  6013.    underscore, period. The same field separator (if any) must be used in
  6014.    both places; for example 18-Sep-2001 but not 18-Sep/2001. Months can
  6015.    be numeric (1-12) or English names or abbreviations. Month name
  6016.    abbreviations are normally three letters, e.g. Apr, May, Jun, Jul.
  6017.    Capitalization doesn't matter.
  6018.    
  6019.    Here are a few examples:
  6020.    
  6021.   18 Sep 2001                              (English month, abbreviated)
  6022.   18 September 2001                        (English month, spelled out)
  6023.   2001 Sept 18                             (Year, month, day)
  6024.   18-Sep-2001                              (With hyphens)
  6025.   18/09/2001                               (All numeric with slashes)
  6026.   18.09.2001                               (Ditto, with periods)
  6027.   18_09_2001                               (Ditto, with underscores)
  6028.   09/18/2001                               (See below)
  6029.   2001/09/18                               (See below)
  6030.   September 18, 2001                       (Correspondence style)
  6031.   Sep-18-2001                              (Month-day-year)
  6032.   20010918                                 (Numeric, no separators)
  6033.  
  6034.    You can also include the day of the week with a specific date, in
  6035.    which case it is accepted (if it is a valid day name), but not
  6036.    verified to agree with the given date:
  6037.    
  6038.   Tue, 18 Sep 2001                         (Abbreviated, with comma)
  6039.   Tue,18 Sep 2001                          (Comma but no space)
  6040.   Tue 18 Sep 2001                          (Abbreviated, no comma)
  6041.   Tuesday 18 Sep 2001                      (Spelled out)
  6042.   Tuesday, 18 Sep 2001                     (etc)
  6043.   Friday, 18 Sep 2001                      (Accepted even if not Friday)
  6044.  
  6045.    In all-numeric dates with the year last, such as 18/09/2001, Kermit
  6046.    identifies the year because it's 4 digits, then decides which of the
  6047.    other two numbers is the month or day based on its value. If both are
  6048.    12 or less and are unequal, the date is ambiguous and is rejected. In
  6049.    all-numeric dates with the year first, the second field is always the
  6050.    month and the third is the day. The month never comes last. A date
  6051.    with no separators is accepted only if it is all numeric and has
  6052.    exactly eight digits, and is assumed to be in yyyymmdd format.
  6053.    
  6054.   20010918                                 (18-Sep-2001 00:00:00)
  6055.  
  6056.    or 14 digits (as in FTP MDTM format):
  6057.    
  6058.   20010918123456                           (18-Sep-2001 12:34:56)
  6059.  
  6060.    You can always avoid ambiguity by putting the year first, or by using
  6061.    an English, rather than numeric, month. A date such as 09/08/2001
  6062.    would be ambiguous but 2001/09/08 is not, nor is 09-Aug-2001.
  6063.    
  6064.    Until the late 1990s, it was common to encounter 2-digit years, and
  6065.    these are found to this day in old e-mails and other documents. Kermit
  6066.    accepts these dates if they have English months, and interprets them
  6067.    according to the windowing rules of [415]RFC 2822: "If a two digit
  6068.    year is encountered whose value is between 00 and 49, the year is
  6069.    interpreted by adding 2000, ending up with a value between 2000 and
  6070.    2049. If a two digit year is encountered with a value between 50 and
  6071.    99, or any three digit year is encountered, the year is interpreted by
  6072.    adding 1900."
  6073.    
  6074.    If you need to specify a year prior to 1000, use leading zeros to
  6075.    ensure it is not misinterpreted as a "non-Y2K-compliant" modern year:
  6076.    
  6077.   7-Oct-77                                 (19771007 00:00:00)
  6078.   7-Oct-0077                               (00771007 00:00:00)
  6079.  
  6080.     8.13.2. The Time
  6081.     
  6082.    The basic time format is hh:mm:dd; that is hours, minutes, seconds,
  6083.    separated by colons, perhaps with an optional fractional second
  6084.    separated by a decimal point (period). The hours are in 24-hour
  6085.    format; 12 is noon, 13 is 1pm, and so on. Fields omitted from the
  6086.    right default to zero. Fields can be omitted from the left or middle
  6087.    by including the field's terminating colon. Examples:
  6088.    
  6089.   11:59:59                                 (11:59:59 AM)
  6090.   11:59                                    (11:59:00 AM)
  6091.   11                                       (11:00:00 AM)
  6092.   11:59:59.33                              (11:59:59 AM)
  6093.   11:59:59.66                              (Noon)
  6094.   03:21:00                                 (3:21:00 AM)
  6095.   3:21:00                                  (3:21:00 AM)
  6096.   15:21:00                                 (3:21:00 PM)
  6097.   :21:00                                   (00:21:00 AM)
  6098.   ::01                                     (00:00:01 AM)
  6099.   11::59                                   (11:00:59 AM)
  6100.  
  6101.    Leading zeros can be omitted, but it is customary and more readable to
  6102.    keep them in the minute and second fields:
  6103.    
  6104.   03:02:01                                 (03:02:01 AM)
  6105.   3:02:01                                  (03:02:01 AM)
  6106.   3:2:1                                    (03:02:01 AM)
  6107.  
  6108.    AM/PM notation is accepted if you wish to use it:
  6109.    
  6110.   11:59:59                                 (11:59:59 AM)
  6111.   11:59:59AM                               (11:59:59 AM)
  6112.   11:59:59A.M.                             (11:59:59 AM)
  6113.   11:59:59am                               (11:59:59 AM)
  6114.   11:59:59a.m.                             (11:59:59 AM)
  6115.   11:59:59PM                               (11:59:59 PM = 23:59:59)
  6116.   11:59:59P.M.                             (11:59:59 PM = 23:59:59)
  6117.   11:59:59pm                               (11:59:59 PM = 23:59:59)
  6118.   11:59:59p.m.                             (11:59:59 PM = 23:59:59)
  6119.  
  6120.    You can omit the colons if you wish, in which case Kermit uses the
  6121.    following rules to interpret the time:
  6122.    
  6123.     1. 6 digits is hh:mm:ss, e.g. 123456 is 12:34:56.
  6124.     2. 5 digits is h:mm:ss, e.g. 12345 is 1:23:45.
  6125.     3. 4 digits is hh:mm, e.g. 1234 is 12:34.
  6126.     4. 3 digits is h:mm, e.g. 123 is 1:23.
  6127.     5. 2 digits is hh, e.g. 12 is 12:00.
  6128.     6. 1 digit is h (the hour), e.g. 1 is 1:00.
  6129.        
  6130.    Examples:
  6131.    
  6132.   1                                        (01:00:00 AM)
  6133.   10                                       (10:00:00 AM)
  6134.   230                                      (02:30:00 AM)
  6135.   230pm                                    (02:30:00 PM = 14:30:00)
  6136.   1115                                     (11:15:00 AM)
  6137.   2315                                     (11:15:00 PM = 23:15:00 PM)
  6138.   23150                                    (02:31:50 AM)
  6139.   231500                                   (23:15:00 PM)
  6140.  
  6141.     8.13.3. Time Zones
  6142.     
  6143.    If a time is given, it can (but need not) be followed by a time zone
  6144.    designator. If no time zone is included, the time is treated as local
  6145.    time and no timezone conversions are performed.
  6146.    
  6147.    The preferred time zone designator is the UTC Offset, as specified in
  6148.    [416]RFC 2822: a plus sign or minus sign immediately followed by
  6149.    exactly four decimal digits, signifying the difference in hh (hours)
  6150.    and mm (minutes) from Universal Coordinated Time (UTC, also known as
  6151.    Greenwich Mean Time, or GMT), with negative numbers to the West and
  6152.    positive numbers to the East. For example:
  6153.    
  6154.   Fri, 13 Jul 2001 12:54:29 -0700
  6155.  
  6156.    indicates a local time of 12:54:29 that is 07 hours and 00 minutes
  6157.    behind (less than, East of) Universal Time. The space is optional, so
  6158.    the example could also be written as:
  6159.    
  6160.   Fri, 13 Jul 2001 12:54:29-0700
  6161.  
  6162.    The following symbolic time zones are also accepted, as specified by
  6163.    [417]RFC 2822 and/or in ISO 8601:
  6164.    
  6165.   GMT  =  +0000       Greenwich Mean Time
  6166.   Z    =  +0000       Zulu (Zero Meridian) Time
  6167.   UTC  =  +0000       Universal Coordinated Time
  6168.   UT   =  +0000       Universal Time
  6169.   EDT  =  -0400       Eastern (USA) Daylight Time
  6170.   EST  =  -0500       Eastern (USA) Standard Time
  6171.   CDT  =  -0500       Central (USA) Daylight Time
  6172.   CST  =  -0600       Central (USA) Standard Time
  6173.   MDT  =  -0600       Mountain (USA) Daylight Time
  6174.   MST  =  -0700       Mountain (USA) Standard Time
  6175.   PDT  =  -0700       Pacific (USA) Daylight Time
  6176.   PST  =  -0800       Pacific (USA) Standard Time
  6177.  
  6178.    Note that GMT, Z, UTC, and UT all express the same concept: standard
  6179.    (not daylight) time at the Zero Meridian. UTC, by the way, is an
  6180.    international standard symbol and does not correspond to the order of
  6181.    the English words, Universal Coordinated Time, but it happens to have
  6182.    the same initial letters as these words. Of course hundreds of other
  6183.    symbolic timezones and variations exist, but they are not
  6184.    standardized, and are therefore not supported by Kermit.
  6185.    
  6186.    When a time zone is included with a time, the time is converted to
  6187.    local time. In case the conversion crosses a midnight boundary, the
  6188.    date is adjusted accordingly. Examples converting to EST (Eastern USA
  6189.    Standard Time = -0500):
  6190.    
  6191.  11:30:00      =  11:30:00
  6192.  11:30:00 EST  =  11:30:00
  6193.  11:30:00 GMT  =  06:30:00
  6194.  11:30:00 PST  =  14:30:00
  6195.  11:30:00Z     =  06:30:00
  6196.  11:30PM GMT   =  18:30:00
  6197.  11:30 -0500   =  11:30:00
  6198.  11:30 -0800   =  08:30:00
  6199.  11:30 +0200   =  04:30:00
  6200.  
  6201.    Unlike most of Kermit's other date-time conversions, timezone
  6202.    knowledge (specifically, the offset of local time from UTC) is
  6203.    embodied in the underlying operating system, not in Kermit itself, and
  6204.    any conversion errors in this department are the fault of the OS. For
  6205.    example, most UNIX platforms do not perform conversions for years
  6206.    prior to 1970.
  6207.    
  6208.     8.13.4. Delta Time
  6209.     
  6210.    Date/time expressions can be composed of a date and/or time and a
  6211.    delta time, or a delta time by itself. When a delta time is given by
  6212.    itself, it is relative to the current local date and time. Delta times
  6213.    have the following general format:
  6214.    
  6215.   {+,-}[number units][hh[:mm[:ss]]]
  6216.  
  6217.    In other words, a delta time always starts with a plus or minus sign,
  6218.    which is followed by a "part1", a "part2", or both. The "part1", if
  6219.    given, specifies a number of days, weeks, months, or years; "part2"
  6220.    specifies a time in hh:mm:ss notation. In arithmetic terms, these
  6221.    represents some number of days or other big time units, and then a
  6222.    fraction of a day expressed as hours, minutes, and seconds; these are
  6223.    to be added to or subtracted from the given (or implied) date and
  6224.    time. The syntax is somewhat flexible, as shown by the following
  6225.    examples:
  6226.    
  6227.   +1 day                (Plus one day)
  6228.   +1day                 (Ditto)
  6229.   +1d                   (Ditto)
  6230.   + 1 day               (Ditto)
  6231.   + 1 day 3:00          (Plus one day and 3 hours)
  6232.   +1d3:00               (Ditto)
  6233.   +1d3                  (Ditto)
  6234.   +3:00:00              (Plus 3 hours)
  6235.   +3:00                 (Ditto)
  6236.   +3                    (Ditto)
  6237.   +2 days               (Plus 2 days)
  6238.   -12 days 7:14:22      (Minus 12 days, 7 hours, 14 minutes, and 22 seconds)
  6239.  
  6240.    The words "week", "month", and "year" can be used like "day" in the
  6241.    examples above. A week is exactly equivalent to 7 days. When months
  6242.    are specified, the numeric month number of the date is incremented or
  6243.    decremented by the given number, and the year and day adjusted
  6244.    accordingly if necessary (for example, 31-Jan-2001 +1month =
  6245.    03-Mar-2001 because February does not have 31 days). When years are
  6246.    specified, they are added or subtracted to the base year. Examples
  6247.    (assuming the current date is 10-Aug-2001 and the current time is
  6248.    19:21:11):
  6249.    
  6250.   18-Sep-2001 +1day              (20010918 00:00:00)
  6251.   today +1day                    (20010811 00:00:00)
  6252.   now+1d                         (20010811 19:21:11)
  6253.   + 1 day                        (20010811 19:21:11)
  6254.   + 1 day 3:14:42                (20010811 22:35:54)
  6255.   + 7 weeks                      (20010928 19:21:11)
  6256.   +1d3:14:42                     (20010811 22:35:54)
  6257.   +1w3:14:42                     (20010817 22:35:54)
  6258.   +1m3:14:42                     (20010910 22:35:54)
  6259.   +1y3:14:42                     (20020810 22:35:54)
  6260.   2 feb 2001 + 10 years          (20110208 00:00:00)
  6261.   2001-02-08 +10y12              (20110208 12:00:00)
  6262.   31-dec-1999 23:59:59+00:00:01  (20000101 00:00:00)
  6263.   28-feb-1996 +1day              (19960229 00:00:00) (leap year)
  6264.   28-feb-1997 +1day              (19970301 00:00:00) (nonleap year)
  6265.   28-feb-1997 +1month            (19970328 00:00:00)
  6266.   28-feb-1997 +1month 11:59:59   (19970328 11:59:59)
  6267.   28-feb-1997 +20years           (20170228 00:00:00)
  6268.   28-feb-1997 +8000years         (99970228 00:00:00)
  6269.  
  6270.    For compatibility with VMS, the following special delta-time format is
  6271.    also accepted:
  6272.    
  6273.   +number-hh:mm:ss
  6274.   -number-hh:mm:ss
  6275.  
  6276.    (no spaces). The hyphen after the number indicates days. It
  6277.    corresponds exactly to the Kermit notation:
  6278.    
  6279.   +numberdhh:mm:ss
  6280.   -numberdhh:mm:ss
  6281.  
  6282.    The following forms all indicate exactly the same date and time:
  6283.    
  6284.   18-Sep-2001 12:34:56 +1-3:23:01
  6285.   18-Sep-2001 12:34:56 +1d3:23:01
  6286.   18-Sep-2001 12:34:56 +1 day 3:23:01
  6287.  
  6288.    and mean "add a day plus 3 hours, 23 minutes, and 1 second" to the
  6289.    given date.
  6290.    
  6291.    Note that delta times are not at all the same as UTC offsets; the
  6292.    former specifies an adjustment to the given date/time and the latter
  6293.    specifies that the local time is a particular distance from Universal
  6294.    Time, for example:
  6295.    
  6296.   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
  6297.   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
  6298.  
  6299.    If you give a time followed by a modifer that starts with a + or -
  6300.    sign, how does Kermit know whether it's a UTC offset or a delta time?
  6301.    It is treated as a UTC offset if the sign is followed by exactly four
  6302.    decimal digits; otherwise it is a delta time. Examples (for USA
  6303.    Eastern Daylight Time):
  6304.    
  6305.   11-Aug-2001 12:34:56 -0800          (20010811 16:34:56 -- UTC Offset)
  6306.   11-Aug-2001 12:34:56 -08:00         (20010811 04:34:56 -- Delta time)
  6307.   11-Aug-2001 12:34:56 -800           (20010811 04:34:56 -- Delta time)
  6308.   11-Aug-2001 12:34:56 -8             (20010811 04:34:56 -- Delta time)
  6309.  
  6310.    The first example says that at some unknown place which is 8 hours
  6311.    ahead of Universal Time, the time is 12:34:56, and this corresponds to
  6312.    16:34:56 in Eastern Daylight time. The second example says to subtract
  6313.    8 hours from the local time. The third and fourth are delta times
  6314.    because, even though a colon is not included, the time does not
  6315.    consist of exactly 4 digits.
  6316.    
  6317.    When a delta time is written after a timezone, however, there is no
  6318.    ambiguity and no syntax distinction is required:
  6319.    
  6320.   11-Aug-2001 12:34:56 -0800 -0800    (20010811 08:34:56)
  6321.   11-Aug-2001 12:34:56 -0800 -08:00   (Ditto)
  6322.   11-Aug-2001 12:34:56 -08:00 -08:00  (Illegal)
  6323.  
  6324.     8.13.5. The DATE Command
  6325.     
  6326.    Obviously a great many combinations of date, time, time zone, and
  6327.    delta time are possible, as well as many formatting options. The
  6328.    purpose of all this flexibility is to comply with as many standards as
  6329.    possible -- Internet RFCs, ISO standards, and proven corporate
  6330.    standards -- as well as with notations commonly used by real people,
  6331.    in order that dates and times from the widest variety of sources can
  6332.    be assigned to a variable and used in any date-time field in any
  6333.    Kermit command.
  6334.    
  6335.    You can test any date-and/or-time format with the DATE command, which
  6336.    converts it to standard yyyymmdd hh:mm:ss format if it is understood,
  6337.    or else gives an explicit error message (rather than just "BAD DATE"
  6338.    as in previous C-Kermit releases) to indicate what is wrong with it.
  6339.    Examples (on Tuesday, 31 July 2001 in New York City, Eastern Daylight
  6340.    Time, UTC -0400):
  6341.    
  6342.   DATE command argument                   Result           
  6343.   12:30                                   20010731 12:30:00
  6344.   12:30:01                                20010731 12:30:01
  6345.   12:30:01.5                              20010731 12:30:02
  6346.   1230                                    20010731 12:30:00
  6347.   230                                     20010731 02:30:00
  6348.   230+1d                                  20010801 02:30:00
  6349.   230+1d3:00                              20010801 05:30:00
  6350.   20010718 19:21:15                       20010718 19:21:15
  6351.   20010718_192115                         20010718 19:21:15
  6352.   20010718T192115                         20010718 19:21:15
  6353.   18 Jul 2001 +0400                       20010717 23:59:59
  6354.   18 Jul 2001 192115                      20010718 19:21:15
  6355.   18 Jul 2001 192115.8                    20010718 19:21:16
  6356.   18-Jul-2001T1921                        20010718 19:21:00
  6357.   18-Jul-2001 1921Z                       20010718 15:21:00
  6358.   18-Jul-2001 1921 GMT                    20010718 15:21:00
  6359.   18-Jul-2001 1921 UTC                    20010718 15:21:00
  6360.   18-Jul-2001 1921 Z                      20010718 15:21:00
  6361.   18-Jul-2001 1921Z                       20010718 15:21:00
  6362.   18-Jul-2001 1921 -04:00:00              20010718 19:21:00
  6363.   21-Jul-2001_08:20:00am                  20010721 08:20:00
  6364.   21-Jul-2001_8:20:00P.M.                 20010721 20:20:00
  6365.   Fri Jul 20 11:26:25 2001                20010720 11:26:25
  6366.   Fri Jul 20 11:26:25 GMT 2001            20010720 07:26:25
  6367.   Sun, 9 Apr 2000 06:46:46 +0100          20000409 01:46:46
  6368.   Sunday, 9 Apr 2000 06:46:46 +0100       20000409 01:46:46
  6369.   now                                     20010731 19:41:12
  6370.   today                                   20010731 00:00:00
  6371.   today 09:00                             20010731 09:00:00
  6372.   tomorrow                                20010801 00:00:00
  6373.   tomorrow 09:00                          20010801 09:00:00
  6374.   tomorrow 09:00 GMT                      20010801 05:00:00
  6375.   yesterday                               20010730 00:00:00
  6376.   yesterday 09:00                         20010730 09:00:00
  6377.   + 3 days                                20010803 00:00:00
  6378.   +3 days                                 20010803 00:00:00
  6379.   +3days                                  20010803 00:00:00
  6380.   + 3days                                 20010803 00:00:00
  6381.   + 3 days 09:00                          20010803 09:00:00
  6382.   + 2 weeks                               20010814 00:00:00
  6383.   + 1 month                               20010831 00:00:00
  6384.   - 7 months                              20001231 00:00:00
  6385.   + 10 years                              20110731 00:00:00
  6386.   friday                                  20010803 00:00:00
  6387.   saturday                                20010804 00:00:00
  6388.   sunday                                  20010805 00:00:00
  6389.   monday                                  20010806 00:00:00
  6390.   tuesday                                 20010731 00:00:00
  6391.   wednesday                               20010801 00:00:00
  6392.   thursday                                20010802 00:00:00
  6393.   friday 07:00                            20010803 07:00:00
  6394.   thursday 1:00pm                         20010802 13:00:00
  6395.   thursday 1:00pm GMT                     20010802 09:00:00
  6396.   Thu, 10 Nov 94 10:50:47 EST             19941110 10:50:47
  6397.   Fri, 20 Oct 1995 18:35:15 -0400 (EDT)   19951020 18:35:15
  6398.   31/12/2001                              20011231 00:00:00
  6399.   12/31/2001                              20011231 00:00:00
  6400.   2001-July-20                            20010720 00:00:00
  6401.   2001-September-30                       20010930 00:00:00
  6402.   30-September-2001                       20010930 00:00:00
  6403.   Sep 30, 2001 12:34:56                   20010930 12:34:56
  6404.   September 30, 2001                      20010930 00:00:00
  6405.   September 30, 2001 630                  20010930 06:30:00
  6406.   September 30 2001 630                   20010930 06:30:00
  6407.   Sep-30-2001 12:34:59                    20010930 12:34:59
  6408.   20010807113542.014                      20010807 11:35.42
  6409.   20010807113542.014Z                     20010807 07:35:42
  6410.  
  6411.     8.13.6. New Date-Time Functions
  6412.     
  6413.    In the following descriptions, date-time function arguments are the
  6414.    same free-format date-time strings discussed above, with the same
  6415.    defaults for missing fields. They are automatically converted to
  6416.    standard format internally prior to processing.
  6417.    
  6418.    \fcvtdate(d1)
  6419.           Converts the date-time d1 to standard format and local time.
  6420.           This function is not new, but now it accepts a wider range of
  6421.           argument formats that can include timezones and/or delta times.
  6422.           
  6423.    \futcdate(d1)
  6424.           Converts the date-time d1 to Universal Coordinated Time (UTC),
  6425.           also known as GMT or Zulu or Zero-Meridian time. The default d1
  6426.           is NOW. If d1 is a valid date-time, the UTC result is returned
  6427.           in standard format, yyyymmdd hh:ss:mm.
  6428.           
  6429.    \fcmpdates(d1,d2)
  6430.           Compares two free-format date-times, d1 and d2, and, if both
  6431.           arguments are valid, returns a number: -1 if d1 is earlier than
  6432.           (before) d2; 0 if d1 is the same as d2; 1 if d1 is later than
  6433.           (after) d2.
  6434.           
  6435.    \fdiffdates(d1,d2)
  6436.           Computes the difference between two free-format date-times, d1
  6437.           and d2. If both arguments are valid, returns a delta time which
  6438.           is negative if d1 is earlier than (before) d2 and positive
  6439.           otherwise. If d1 and d2 are equal, the result is "+0:00".
  6440.           Otherwise, the result consists of the number of days, hours,
  6441.           minutes, and seconds that separate the two date-times. If the
  6442.           number of days is zero, it is omitted. If the number of days is
  6443.           nonzero but the hours, minutes, and seconds are all zero, the
  6444.           time is omitted. if the seconds are zero, they are omitted.
  6445.           
  6446.    \fdelta2secs(dt)
  6447.           Converts a delta time to seconds. For example, "+1d00:00:01" to
  6448.           86401. Valid delta times must start with a + or - sign. Days
  6449.           are accepted as time units, but not years, months, or weeks. If
  6450.           the result would overflow a computer long word (as would happen
  6451.           with 32-bit long words when the number of days is greater than
  6452.           24854), the function fails.
  6453.           
  6454.    HINT: Although Kermit has a number of built-in date and time
  6455.    variables, it doesn't have a single one suitable for writing a
  6456.    timestamp. For this you would normally use something like "\v(ndate)
  6457.    \v(time)". But \fcvtdate() (with no arguments) is equivalent: it
  6458.    returns the current date and time in yyyymmdd hh:mm:ss format,
  6459.    suitable for time stamping.
  6460.    
  6461.     8.13.7. Date-Time Programming Examples
  6462.     
  6463.    Here's a macro that converts any date-time to UTC, which you might use
  6464.    if C-Kermit didn't already have a \futcdate() function:
  6465.    
  6466.   define utcdate {
  6467.       .local := \fcvtdate(\%*)                 ; 1.
  6468.       .tmp := \fcvtdate(\m(local)UTC)          ; 2.
  6469.       .offset := \fdiffdate(\m(local),\m(tmp)) ; 3.
  6470.       .utc := \fcvtdate(\m(local)\m(offset))   ; 4.
  6471.       sho mac utc                              ; 5.
  6472.   }
  6473.  
  6474.    Brief explanation: Line 1 converts the macro argument, a free-format
  6475.    date-time, to standard-format local time. Line 2 appends the "UTC"
  6476.    timezone to the local time and converts the result to local time. In
  6477.    other words, we take the same time as the local time, but pretend it's
  6478.    UTC time, and convert it to local time. For example, if New York time
  6479.    is 4 hours ahead of UTC, then 6:00pm New York time is 2:00pm UTC. Line
  6480.    3 gets the difference of the two results (e.g. "+04:00"). Line 4
  6481.    appends the difference (delta time) to the local time, and converts it
  6482.    again, whic adds (or subtracts) the UTC offset to the given time. Line
  6483.    5 displays the result.
  6484.    
  6485.    Here's a script that opens a web page, gets its headers into an array,
  6486.    scans the array for the "Last-Modified:" header, and inteprets it:
  6487.  
  6488.   http open www.columbia.edu
  6489.   if fail stop 1 HTTP OPEN failed
  6490.   http /array:a head index.html /dev/null
  6491.   if fail stop 1 HTTP GET failed
  6492.   show array a
  6493.   for \%i 1 \fdim(&a) 1 {
  6494.       .\%x := \findex(:,\&a[\%i])
  6495.       if not \%x continue
  6496.       .tag := \fleft(\&a[\%i],\%x-1)
  6497.       .val := \fltrim(\fsubstr(\&a[\%i],\%x+1))
  6498.       if ( eq "\m(tag)" "Last-Modified" ) {
  6499.           echo HTTP Date: \m(val)
  6500.           .rdate := \fcvtdate(\m(val))
  6501.           echo {Standard Date (local): \m(rdate)}
  6502.           echo {Standard Date (UTC):   \futcdate(\m(rdate))}
  6503.           break
  6504.       }
  6505.   }
  6506.   http close
  6507.  
  6508.    The result:
  6509.    
  6510.   HTTP Date: Mon, 13 Aug 2001 20:05:42 GMT
  6511.   Standard Date (local): 20010813 16:05:42
  6512.   Standard Date (UTC):   20010813 20:05:42
  6513.  
  6514.    As you can see, Kermit had no trouble decoding the date-time-string
  6515.    from the website, converting to local time, and converting back to UTC
  6516.    with no conflicts or loss of information. If it had been in any other
  6517.    known format, the result would have been the same.
  6518.    
  6519.    Now suppose we want to download the web page only if it is newer than
  6520.    our local copy. The \fdate(filename) function (which returns the
  6521.    modification date-time of the given file) and the new \fcmpdates()
  6522.    function make it easy. Insert the following just before the BREAK
  6523.    statement:
  6524.    
  6525.   if ( < 0 \fcmpdates(\m(rdate),\fdate(index.html)) ) {
  6526.      echo GETTING index.html...
  6527.      http get index.html index.html
  6528.      if success echo HTTP GET OK
  6529.   } else {
  6530.      echo index.html: no update needed
  6531.   }
  6532.   http close
  6533.   exit
  6534.  
  6535.    This says, "if 0 is less than the comparison of the remote file date
  6536.    and the local file date, get the remote file, otherwise skip it." And
  6537.    it automatically reconciles the time-zone difference (if any).
  6538.    
  6539.    It would be nice to be able to extend this script into a
  6540.    general-purpose website updater, but unfortunately HTTP protocol
  6541.    doesn't provide any mechanism for the client to ask the server for a
  6542.    list of files, recursive or otherwise.
  6543.    
  6544.    [ [418]Top ] [ [419]Contents ] [ [420]C-Kermit Home ] [ [421]Kermit
  6545.    Home ]
  6546.      _________________________________________________________________
  6547.    
  6548.   8.14. Trapping Keyboard Interruption
  6549.   
  6550.    Normally when you type Ctrl-C and Kermit is in command mode (as
  6551.    opposed to CONNECT mode) with COMMAND INTERRUPTION ON (as it is unless
  6552.    you have set it OFF), Kermit interrupts any command that is currently
  6553.    in progress, and if a command file or macro is executing, rolls the
  6554.    command stack back to top level, closing all open command files,
  6555.    deactivating all macros, deallocating all local variables and arrays,
  6556.    and leaving you at the command prompt.
  6557.    
  6558.    Suppose, however, you want certain actions to occur when a script is
  6559.    interrupted; for example, closing open files, writing log entries, or
  6560.    displaying summary results. You can do this by defining a macro named
  6561.    ON_CTRLC. When Ctrl-C is detected, and a macro with this name is
  6562.    defined, Kermit executes it from the current command level, thus
  6563.    giving it full access to the environment in which the interruption
  6564.    occurred, including local variables and open files. Only when the
  6565.    ON_CTRLC macro completes execution is the command stack rolled back to
  6566.    top level.
  6567.    
  6568.    Once the ON_CTRLC macro is defined, it can be executed only once. This
  6569.    is to prevent recursion if the user types Ctrl-C while the ON_CTRLC
  6570.    macro is executing. If you type Ctrl-C while the Ctrl-C macro is
  6571.    active, this does not start a new copy of ON_CTRLC; rather, it returns
  6572.    to the top-level command prompt. After the ON_CTRLC macro returns, it
  6573.    has been removed from the macro table so if you want to use it again
  6574.    or install a different Ctrl-C trap, you must execute a new DEFINE
  6575.    ON_CTRLC command. In any case, as always when you interrupt a script
  6576.    with Ctrl-C, its completion status is FAILURE.
  6577.    
  6578.    Normally the ON_CTRLC macro would be defined in the command file or
  6579.    macro to which it applies, and should be declared LOCAL. This way, if
  6580.    the command file or macro completes successfully without being
  6581.    interrupted, the ON_CTRLC definition disappears automatically.
  6582.    Otherwise the definition would still be valid and the macro would be
  6583.    executed, probably out of context, the next time you typed Ctrl-C.
  6584.    
  6585.    Here's a simple example of a command file that sets a Ctrl-C trap for
  6586.    itself:
  6587.    
  6588.   local on_ctrlc              ; Make Ctrl-C trap local to this command file.
  6589.   define on_ctrlc {           ; Define the ON_CTRLC macro.
  6590.       echo Interrupted at \v(time).
  6591.       echo Iterations: \%n
  6592.   }
  6593.   xecho Type Ctrl-C to quit
  6594.   for \%n 1 999 1 {           ; Prints a dot every second until interrupted.
  6595.       sleep 1
  6596.       xecho .
  6597.   }
  6598.   echo Finished normally at \v(time) ; Get here only if not interrupted.
  6599.   decrement \%n
  6600.   echo Iterations: \%n
  6601.  
  6602.    This prints a summary no matter whether it completes normally or is
  6603.    interrupted from the keyboard. In both cases the trap is automatically
  6604.    removed afterwards.
  6605.    
  6606.    For an example of how to use ON_CTRLC to debug scripts, see
  6607.    [422]Section 8.1.
  6608.    
  6609.    [ [423]Top ] [ [424]Contents ] [ [425]C-Kermit Home ] [ [426]Kermit
  6610.    Home ]
  6611.   __________________________________________________________________________
  6612.  
  6613. 9. S-EXPRESSIONS
  6614.  
  6615.    This section is primarily for those who want to write
  6616.    calculation-intensive scripts, especially if they require
  6617.    floating-point arithmetic, and/or for those who are familiar with the
  6618.    LISP programming language.
  6619.    
  6620.    Ever since C-Kermit version 5 was released in 1988, scripting has been
  6621.    one of its major attractions, and arithmetic is key part of it.
  6622.    Versions 5 and 6 included integer arithmetic only, using traditional
  6623.    algebraic notation, e.g.:
  6624.    
  6625.   echo \fevaluate(3*(2+7)/2)
  6626.   13
  6627.  
  6628.    C-Kermit 7.0 added support for floating-point arithmetic, but only
  6629.    through function calls:
  6630.    
  6631.   echo \fppdivide(\ffpmultiply(3.0,\fpadd(2.0,7.0)),2.0)
  6632.   13.5
  6633.  
  6634.    C-Kermit 8.0 introduces a third form of arithmetic that treats
  6635.    integers and floating-point numbers uniformly, is easier to read and
  6636.    write, and executes very quickly:
  6637.    
  6638.   (/ (* 3 (+ 2 7)) 2)
  6639.   13.5
  6640.  
  6641.    But first some background.
  6642.    
  6643.    The Kermit command and scripting language differs from true
  6644.    programming languages (such as C or Fortran) in many ways; one of the
  6645.    most prominent differences is the way in which variables are
  6646.    distinguished from constants. In a command language, words are taken
  6647.    literally; for example, the Unix shell:
  6648.    
  6649.   cat foo.bar
  6650.  
  6651.    displays the file named foo.bar. Whereas in a programming language
  6652.    like C, words are assumed to be variables:
  6653.    
  6654.   s = foo.bar;    /* Assigns the value of foo.bar to the variable s */
  6655.  
  6656.    To make a programming language take words literally, you have to quote
  6657.    or "escape" them:
  6658.    
  6659.   s = "foo.bar";  /* Assigns a pointer to the string "foo.bar" to the variable
  6660. s */
  6661.  
  6662.    The opposite holds for command languages: to get them to treat a word
  6663.    as a variable rather than a constant, you have to escape them. For
  6664.    example, in the Unix shell:
  6665.    
  6666.   foo=123         ; Assign value 123 to variable foo.
  6667.   echo foo        ; Prints "foo"
  6668.   echo $foo       ; Prints "123"
  6669.  
  6670.    And in Kermit:
  6671.    
  6672.   define foo 123  ; Assign value 123 to variable foo.
  6673.   echo 123        ; This prints "123".
  6674.   echo foo        ; This prints "foo".
  6675.   echo \m(foo)    ; This prints "123".
  6676.  
  6677.    In other words, character strings (such as "foo" above) are
  6678.    interpreted as literal strings, rather than variable names, except in
  6679.    special commands like DEFINE that deal specifically with variable
  6680.    names (or in numeric contexts as explained in [427]Section 8.2). The
  6681.    special "escape" character (dollar sign ($) for the shell, backslash
  6682.    (\) for Kermit) indicates that a variable is to be replaced by its
  6683.    value.
  6684.    
  6685.    The requirement to escape variable names in command languages normally
  6686.    does not impose any special hardship, but can add a considerable
  6687.    notational burden to arithmetic expressions, which are typically full
  6688.    of variables. Especially in Kermit when floating point numbers are
  6689.    involved, where you must use special \ffpxxx() functions, e.g.
  6690.    "\fpadd(\m(a),\m(b))" rather than the simple "+" operator to add two
  6691.    floating-point numbers together, because the original arithmetic
  6692.    handler doesn't support floating point (this might change in the
  6693.    future). To illustrate, the general formula for the area of a triangle
  6694.    is:
  6695.    
  6696.   sqrt(s * (s - a) * (s - b) * (s - c))
  6697.  
  6698.    where a, b, and c are the lengths of the triangle's three sides and:
  6699.    
  6700.   s = (a + b + c) / 2
  6701.  
  6702.    Except in special cases (e.g. a = 3, b = 4, c = 5), the result has a
  6703.    fractional part so the computation must be done using floating-point
  6704.    arithmetic. We can create a Kermit 7.0 function for this as follows:
  6705.    
  6706.   def area {
  6707.       local s t1 t2 t3
  6708.       assign s \ffpdiv(\ffpadd(\ffpadd(\%1,\%2),\%3),2.0)
  6709.       assign t1 \ffpsub(\m(s),\%1)
  6710.       assign t2 \ffpsub(\m(s),\%2)
  6711.       assign t3 \ffpsub(\m(s),\%3)
  6712.       return \ffpsqrt(\ffpmul(\m(s),\ffpmul(\m(t1),\ffpmul(\m(t2),\m(t3)))))
  6713.   }
  6714.  
  6715.    But as you can see, this is rather cumbersome. Note, in particular,
  6716.    that arithmetic functions like \ffpadd(), \ffpmul(), etc, take exactly
  6717.    two operands (like their symbolic counterparts + and *), so obtaining
  6718.    the product of three or more numbers (as we do in this case) is
  6719.    awkward.
  6720.    
  6721.    Using the alternative S-Expression notation, we can reduce this to a
  6722.    form that is both easier to read and executes faster (the details are
  6723.    explained later):
  6724.    
  6725.   def newarea {
  6726.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  6727.       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  6728.   }
  6729.  
  6730.    In both examples, the \%1..3 variables are the normal Kermit macro
  6731.    arguments, referenced by the normal escaping mechanism. For increased
  6732.    readability, we can also assign the macro arguments \%1, \%2, and \%3
  6733.    to the letters a, b, and c corresponding to our formula:
  6734.    
  6735. def newarea {
  6736.     (let a \%1 b \%2 c \%3)
  6737.     (let s (/ (+ a b c) 2.0))
  6738.     (sqrt (* s (- s a) (- s b) (- s c)))
  6739. }
  6740.  
  6741.    And now the Kermit function reads almost like the original formula.
  6742.    Here Kermit behaves more like a regular programming language. In an
  6743.    S-Expression, macro names need not be escaped when they are used as
  6744.    the names of numeric variables.
  6745.    
  6746.    [ [428]Top ] [ [429]Contents ] [ [430]C-Kermit Home ] [ [431]Kermit
  6747.    Home ]
  6748.      _________________________________________________________________
  6749.    
  6750.   9.1. What is an S-Expression?
  6751.   
  6752.    The S-Expression concept is borrowed from the Lisp programming
  6753.    language. "S-Expression" is short for Symbolic Expression (itself
  6754.    sometimes shortened to SEXP). S-Expressions provide a kind of
  6755.    Alternative Mini-Universe within the Kermit command language when the
  6756.    regular rules don't apply, a universe enclosed in parentheses.
  6757.    
  6758.    C-Kermit does not pretend to be a full Lisp interpreter; only the
  6759.    arithmetic parts of Lisp have been incorporated: S-Expressions that
  6760.    operate on numbers and return numeric values (plus extensibility
  6761.    features described in [432]Section 9.8, which allow some degree of
  6762.    string processing).
  6763.    
  6764.    An S-Expression is a list of zero or more items, separated by spaces,
  6765.    within parentheses. Examples:
  6766.    
  6767.   ()
  6768.   (1)
  6769.   (a)
  6770.   (+ a 1)
  6771.   (* 2 a b)
  6772.  
  6773.    If the S-Expression is empty, it has the NIL (empty) value. If it is
  6774.    not empty and the first item is an operator (such as + or *), there
  6775.    can be zero or more subsequent items, called the operands:
  6776.    
  6777.   (+ 1 2)
  6778.  
  6779.    Here the operator is "+" and the operands are "1" and "2", and the
  6780.    value of the S-Expression is the value of the operation (in this case
  6781.    3). The operator always comes first, which is different from the
  6782.    familiar algebraic notation; this because S-Expression operators can
  6783.    allow different numbers of operands:
  6784.    
  6785.   (+ 1)
  6786.   (+ 1 2)
  6787.   (+ 1 2 3 4 5 6 7 8 9)
  6788.  
  6789.    If the first item in the S-Expression is not an operator, then it must
  6790.    be a variable or a number (or a macro; see [433]Section 9.8), and the
  6791.    S-Expression can only contain one item; in this case, the
  6792.    S-Expression's value is the value of the variable or number:
  6793.    
  6794.   (a)
  6795.   (3)
  6796.  
  6797.    Operands can be numbers, variables that have numeric values, functions
  6798.    that return numbers, or other S-Expressions. To illustrate an
  6799.    S-Expression within an S-Expression, observe that:
  6800.    
  6801.   (+ 1 2)
  6802.  
  6803.    is equivalent to any of the following (plus an infinite number of
  6804.    others):
  6805.    
  6806.   (+ 1 (+ 1 1))
  6807.   (+ (- 3 2) (/ 14 (+ 3 4)))
  6808.  
  6809.    S-Expressions can be nested to any reasonable level; for example, the
  6810.    value of the following S-Expression is 64:
  6811.    
  6812.   (- (* (+ 2 (* 3 4)) (- 9 (* 2 2))) 6)
  6813.  
  6814.    Operators have no precedence, implied or otherwise, since they can't
  6815.    be mixed. The only exceptions are unary + and -, which simply indicate
  6816.    the sign of a number:
  6817.    
  6818.   (* 3 -1)
  6819.  
  6820.    Order of evaluation is specified entirely by parentheses, which are
  6821.    required around each operator and its operands: (+ a (* b c)) instead
  6822.    of (a + b * c).
  6823.    
  6824.    S-Expressions provide a simple and isolated environment in which
  6825.    Kermit's macro names can be used without the \m(...) escaping that is
  6826.    normally required. Given:
  6827.    
  6828.   define a 1
  6829.   define b 2
  6830.   define c 3
  6831.  
  6832.    Then:
  6833.    
  6834.   (+ \m(a) \m(b) \m(c))
  6835.  
  6836.    is equivalent to:
  6837.    
  6838.   (+ a b c)
  6839.  
  6840.    Within an S-Expression, as in other strictly numeric contexts
  6841.    ([434]Section 8.2), any operand that starts with a letter is treated
  6842.    as a Kermit macro name. In this context, abbreviations are not
  6843.    accepted; variable names must be spelled out in full. Alphabetic case
  6844.    is not significant; "a" and "A" are the same variable, but both are
  6845.    different from "area".
  6846.    
  6847.    Of course, regular Kermit variables and functions can be used in
  6848.    S-Expressions in the normal ways:
  6849.    
  6850.   (* \v(math_pi) (^ \%r 2))             ; Area of a circle with radius \%r
  6851.   (+ \fjoin(&a))                        ; Sum of all elements of array \&a[]
  6852.  
  6853.    [ [435]Top ] [ [436]Contents ] [ [437]C-Kermit Home ] [ [438]Kermit
  6854.    Home ]
  6855.      _________________________________________________________________
  6856.    
  6857.   9.2. Integer and Floating-Point-Arithmetic
  6858.   
  6859.    Normally, if all numbers in an S-Expression are integers, the result
  6860.    is an integer:
  6861.    
  6862.   (+ 1 1)                               ; Result is 2
  6863.   (/ 9 3)                               ; Result is 3
  6864.  
  6865.    If any of the operands is floating point, however, the result is also
  6866.    floating point:
  6867.    
  6868.   (+ 1 1.0)                             ; Result is 2.0
  6869.   (/ 9.0 3)                             ; Result is 3.0
  6870.  
  6871.    If all the operands are integers but the result has a fractional part,
  6872.    the result is floating point:
  6873.    
  6874.   (/ 10 3)                              ; Result is 3.333333333333333
  6875.  
  6876.    To force an integer result in such cases, use the TRUNCATE operator:
  6877.    
  6878.   (truncate (/ 10 3))                   ; Result is 3
  6879.  
  6880.    Similarly, to force a computation to occur in floating point, you can
  6881.    coerce one of its operands to FLOAT:
  6882.    
  6883.   (+ 1 (float 1))                       ; Result is 1.0
  6884.  
  6885.    The result is also floating point if the magnitude of any integer
  6886.    operand, intermediate result, or the result itself, is larger than the
  6887.    maximum for the underlying machine architecture:
  6888.    
  6889.   (^ 100 100)
  6890.  
  6891.    If the result is too large even for floating-point representation,
  6892.    "Infinity" is printed; if it is too small to be distinguished from 0,
  6893.    0.0 is returned.
  6894.    
  6895.    Large numbers can be used and large results generated, but they are
  6896.    accurate only to the precision of the underlying machine. For example,
  6897.    the result of:
  6898.    
  6899.  (+ 111111111111111111111 222222222222222222222)
  6900.  
  6901.    should be 333333333333333333333, but 333333333333333300000.0 is
  6902.    produced instead if the machine is accurate to only about 16 decimal
  6903.    digits, even with coercion to floating-point. The order of magnitude
  6904.    is correct but the least significant digits are wrong. The imprecise
  6905.    nature of the result is indicated by the ".0" at the end. Contrast
  6906.    with:
  6907.    
  6908.  (+ 111111111 222222222)
  6909.  
  6910.    which produces an exact integer result.
  6911.    
  6912.    [ [439]Top ] [ [440]Contents ] [ [441]C-Kermit Home ] [ [442]Kermit
  6913.    Home ]
  6914.      _________________________________________________________________
  6915.    
  6916.   9.3. How to Use S-Expressions
  6917.   
  6918.    S-Expressions may be given as commands to C-Kermit. Any command whose
  6919.    first character is "(" (left parenthesis) is interpreted as an
  6920.    S-Expression.
  6921.    
  6922.    If you enter an S-Expression at the C-Kermit> prompt, its result is
  6923.    printed:
  6924.    
  6925.   C-Kermit>(/ 10.0 3)
  6926.    3.333333333333333
  6927.   C-Kermit>
  6928.  
  6929.    If an S-Expression is executed within a macro or command file, its
  6930.    value is not printed. However, you can control the printing action
  6931.    with:
  6932.    
  6933.    SET SEXPRESSION ECHO { AUTO, ON, OFF }
  6934.           AUTO is the default, meaning print the value at top level only;
  6935.           ON means always print the value; OFF means never print it.
  6936.           
  6937.    In any case, the value of the most recent S-Expression (and the
  6938.    S-Expression itself) may be accessed programmatically through the
  6939.    following variables:
  6940.    
  6941.    \v(sexpression)
  6942.           The S-Expression most recently executed.
  6943.           
  6944.    \v(svalue)
  6945.           The value of the S-Expression most recently executed.
  6946.           
  6947.    Besides issuing S-Expressions as commands in themselves, you can also
  6948.    execute them anywhere within a Kermit command, but in this case they
  6949.    must be enclosed in a function call (otherwise they are taken
  6950.    literally):
  6951.    
  6952.    \fsexpression(s)
  6953.           The argument "s" is an S-Expression; the outer parentheses may
  6954.           be omitted. The value of the S-Expression is returned. Note
  6955.           that since S-Expressions usually contain spaces, some form of
  6956.           grouping or quoting might be needed in some contexts:
  6957.           
  6958.   echo \fsexpression((+ 1 1))            ; Outer parentheses may be included
  6959.   echo \fsexpr(+ 1 1)                    ; Outer parentheses may be omitted
  6960.   echo Value = "\fsexp(+ 1 a)"           ; Can be embedded in strings
  6961.   echo Value = \&a[\fsexp(/ b 2)]        ; Can be used in array subscripts
  6962.   if = {\fsexp(+ 1 1)} 2 {               ; Braces needed here for grouping
  6963.       echo One plus one still equals two
  6964.   }
  6965.  
  6966.    The IF statement illustrates how to use S-Expressions as (or in) IF or
  6967.    WHILE conditions:
  6968.    
  6969.      * Although S-Expressions and IF conditions are similar in
  6970.        appearance, they are not interchangeable. Therefore you must use
  6971.        \fsexpr() to let Kermit know it's an S-Expression rather than a
  6972.        regular IF condition, or a boolean or algebraic expression within
  6973.        an IF condition.
  6974.      * In contexts where a single "word" is expected, you must enclose
  6975.        the \fsexp() invocation in braces if the S-Expression contains
  6976.        spaces (and most of the do).
  6977.        
  6978.    If an S-Expression is the last command executed in a macro, its value
  6979.    becomes the return value of the macro; no RETURN command is needed.
  6980.    Example:
  6981.    
  6982.   def newarea {
  6983.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  6984.       (sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  6985.   }
  6986.  
  6987.    This is equivalent to (but more efficient than):
  6988.    
  6989.   def newarea {
  6990.       (let s (/ (+ \%1 \%2 \%3) 2.0))
  6991.       return \fsexp(sqrt (* s (- s \%1) (- s \%2) (- s \%3)))
  6992.   }
  6993.  
  6994.    When an S-Expression is entered as a command -- that is, the first
  6995.    nonblank character of the command is a left parenthesis -- then it is
  6996.    allowed to span multiple lines, as many as you like, until the first
  6997.    left parenthesis is matched:
  6998.    
  6999.   (let s (/
  7000.           (+
  7001.            \%1
  7002.            \%2
  7003.            \%3
  7004.            )
  7005.           2.0
  7006.           )
  7007.        )
  7008.   (sqrt (*
  7009.          s
  7010.          (- s \%1)
  7011.          (- s \%2)
  7012.          (- s \%3)
  7013.          )
  7014.         )
  7015.  
  7016.    The S-Expression concept lends itself easily to embedding and
  7017.    recursion, but the depth to which recursion can occur is limited by
  7018.    the resources of the computer (memory size, address space, swap space
  7019.    on disk) and other factors. There is no way that C-Kermit can know
  7020.    what this limit is, since it varies not only from computer to
  7021.    computer, but also from moment to moment. If resources are exhausted
  7022.    by recursion, C-Kermit simply crashes; there's no way to trap this
  7023.    error. However, you can set a depth limit on S-Expressions:
  7024.    
  7025.    SET SEXPRESSION DEPTH-LIMIT number
  7026.           Limits the number of times the S-Expression reader can invoke
  7027.           itself without returning to the given number. The default limit
  7028.           is 1000. This limit applies to S-Expressions embedded within
  7029.           other S-Expressions as well as to S-Expressions that invoke
  7030.           recursive macros. If the limit is exceeded, Kermit prints
  7031.           "?S-Expression depth limit exceeded" and returns to its prompt.
  7032.           More about recursion in [443]Section 9.8.
  7033.           
  7034.    You can also test the depth programmatically:
  7035.    
  7036.    \v(sdepth)
  7037.           The current S-Expression invocation depth. The depth includes
  7038.           both nesting level and recursion. For example, in:
  7039.           (foo (foo (foo (foo (foo))))), the innermost (foo) is at depth
  7040.           5.
  7041.           
  7042.    Help, completion, and syntax checking are not available within an
  7043.    S-Expression. If you type ? within an S-Expression, it says:
  7044.    
  7045.   C-Kermit>(? S-Expression ("help sexp" for details)
  7046.  
  7047.    As it says, typing "help sexp" will display a brief help text.
  7048.    
  7049.    The SHOW SEXPRESSION command displays current SET SEXPRESSION settings
  7050.    and related information.
  7051.    
  7052.    [ [444]Top ] [ [445]Contents ] [ [446]C-Kermit Home ] [ [447]Kermit
  7053.    Home ]
  7054.      _________________________________________________________________
  7055.    
  7056.   9.4. Summary of Built-in Constants and Operators
  7057.   
  7058.    Three constants are built in:
  7059.    
  7060.      * PI, whose value is the value of pi (the quotient of circumference
  7061.        of any circle and its diameter, 3.141592653...) to the underlying
  7062.        machine's precision;
  7063.      * T, which always has the value 1, which signifies truth in Kermit
  7064.        logical expressions or S-Expressions;
  7065.      * NIL, which always has the empty value, and can serve as a False
  7066.        truth value.
  7067.        
  7068.    These constants are specific to S-Expressions and are not visible
  7069.    outside them. They may not be used as the target of an assignment. So,
  7070.    for example:
  7071.    
  7072.   (setq t 0)   Fails
  7073.   assign t 0   Succeeds but this is not the same T!
  7074.  
  7075.    E (the base of natural logarithms, 2.7182818184...) is not built in
  7076.    since it is not intrinsic in most Lisp dialects. If you want E to be
  7077.    the base of natural logarithms you can:
  7078.    
  7079.   (setq e (exp 1))
  7080.  
  7081.    Operators are either symbols (such as "+") or words. Words must be
  7082.    spelled out in full, not abbreviated. Differences of alphabetic case
  7083.    are ignored.
  7084.    
  7085.    The most basic operation in S-Expressions is evaluation:
  7086.    
  7087.    EVAL [ s-expression or variable or number [ another [ another ... ] ]
  7088.           ]
  7089.           Evaluates its operands and returns the value of the last one
  7090.           evaluated. Examples:
  7091.           
  7092.   (eval)                                0
  7093.   (eval 1)                              1
  7094.   (eval a)                              value of a
  7095.   (eval (+ 1 a))                        value of a+1
  7096.   (eval (setq a 1) (setq b (+ a 0.5))   value of b (= a+0.5)
  7097.  
  7098.           You can use "." as a shorthand for EVAL:
  7099.           
  7100.   (.)
  7101.   (. 1)
  7102.   (. a)
  7103.   (. (+ 1 a))
  7104.   (. (setq a 1) (setq b (+ a 0.5))
  7105.  
  7106.    Opposite of EVAL is the operator that suppresses evaluation of its
  7107.    operand:
  7108.    
  7109.    QUOTE item
  7110.           The value (quote item) is "item". If the item is itself an
  7111.           S-Expression, the result is the S-Expression with the outer
  7112.           parentheses stripped. Examples:
  7113.           
  7114.   (quote)                               (illegal)
  7115.   (quote a)                             a
  7116.   (quote hello)                         hello
  7117.   (quote (this is a string))            this is a string
  7118.   (quote this is a string)              (illegal)
  7119.  
  7120.           A shorthand notation is also accepted for quoting:
  7121.           'a is equivalent to (quote a). And therefore:
  7122.           '(a b c) is equivalent to (quote (a b c)).
  7123.           More about quoting in [448]Section 9.8.
  7124.           
  7125.    STRING item
  7126.           Is a combination of EVAL and QUOTE. It evaluates the item as an
  7127.           S-Expression, and then puts quotes around the result (more
  7128.           about this in [449]Section 9.8).
  7129.           
  7130.    The following operators assign values to variables:
  7131.    
  7132.    SETQ [ variable [ value [ variable [ value [ ... ] ] ] ] ]
  7133.           Applies to global variables. For each variable given: if a is
  7134.           not given, the variable is undefined. If a value is given,
  7135.           assigns the value to the variable. The value may be a number, a
  7136.           variable, or anything that resolves to a number including an
  7137.           S-Expression. Returns the value of the last assignment.
  7138.           Examples:
  7139.           
  7140.   (setq)             Does nothing, returns NIL.
  7141.   (setq a)           Undefines a, returns NIL.
  7142.   (setq a 1)         Assigns 1 to a, returns 1.
  7143.   (setq a 1 b 2)     Assigns 1 to a, 2 to b, returns 2.
  7144.   (setq a 1 b 2 c)   Assigns 1 to a, 2 to b, undefines c, returns NIL.
  7145.  
  7146.    To undefine a variable that is not the final one in the list, give it
  7147.    a value of "()" or NIL:
  7148.    
  7149.   (setq a () b 2)    Undefines a, assigns 2 to b, returns 2.
  7150.   (setq a nil b 2)   Ditto.
  7151.  
  7152.    Note that a variable can be used right away once it has a value:
  7153.    
  7154.   (setq a 1 b a)     Assigns 1 to a, the value of a (1) to b, returns 1.
  7155.  
  7156.    The results of SETQ (when used with macro names) can be checked
  7157.    conveniently with SHOW MACRO, e.g:
  7158.    
  7159.   show mac a b c
  7160.  
  7161.    LET [ variable [ value [ variable [ value [ ... ] ] ] ] ]
  7162.           Like SETQ, but applies to local variables. Note that "local" is
  7163.           used in the Kermit sense, not the Lisp sense; it applies to the
  7164.           current Kermit command level, not to the current S-Expression.
  7165.           
  7166.    If you want to use SETQ or LET to assign a value to a backslash
  7167.    variable such as \%a or \&a[2], you must double the backslash:
  7168.    
  7169.   (setq \\%a 3)
  7170.   (setq \\%b (+ \%a 1))
  7171.   (setq \\&a[2] (setq (\\%c (+ \%a \%b))))
  7172.  
  7173.    In other words:
  7174.    
  7175.      * Double the backslash when you want to indicate the variable's
  7176.        NAME;
  7177.      * Don't double the backslash when you want its VALUE.
  7178.        
  7179.    See [450]Section 9.6 for a fuller explanation of variable syntax and
  7180.    scope.
  7181.    
  7182.    Here's a summary table of arithmetic operators; in the examples, a is
  7183.    2 and b is -1.3:
  7184.    
  7185.   Operator  Description                            Example           Result
  7186.   +         Adds all operands (0 or more)          (+ a b)           0.7
  7187.   -         Subtracts all operands (0 or more)     (- 9 5 2 1)       1
  7188.   *         Multiplies all operands (0 or more)    (* a (+ b 1) 3)  -1.80
  7189.   /         Divides all operands (2 or more)       (/ b a 2)        -0.325
  7190.   ^         Raise given number to given power      (^ 3 2)           9
  7191.   ++        Increments variables                   (++ a 1.2)        3.2
  7192.   --        Decrements variables                   (-- a)            1
  7193.   ABS       Absolute value of 1 operand            (abs (* a b 3))   7.8
  7194.   MAX       Maximum of all operands (1 or more)    (max 1 2 3 4)     4
  7195.   MIN       Minimum of all operands (1 or more)    (min 1 2 3 4)     1
  7196.   MOD (%)   Modulus of all operands (1 or more)    (mod 7 4 2)       1
  7197.   FLOAT     Convert an integer to floating-point   (float 1)         1.0
  7198.   TRUNCATE  Integer part of floating-point operand (truncate 3.333)  3
  7199.   CEILING   Ceiling of floating-point operand      (ceiling 1.25)    2
  7200.   FLOOR     Floor of floating-point operand        (floor 1.25)      1
  7201.   ROUND     Operand rounded to nearest integer     (round 1.75)      2
  7202.   SQRT      Square root of 1 operand               (sqrt 2)          1.414..
  7203.   EXP       e (2.71828..) to the given power       (exp -1)          0.367..
  7204.   SIN       Sine of angle-in-radians               (sin (/ pi 2))    1.0
  7205.   COS       Cosine of angle-in-radians             (cos pi)         -1.0
  7206.   TAN       Tangent of angle-in-radians            (tan pi)          0.0
  7207.   LOG       Natural log (base e) of given number   (log 2.7183)      1.000..
  7208.   LOG10     Log base 10 of given number            (log10 1000)      3.0
  7209.  
  7210.    The ++ and -- operators are also assignment operators and work just
  7211.    like SETQ and LET in their interpretations of operators and operands,
  7212.    but:
  7213.    
  7214.      * Each target variable must already be defined and have a numeric
  7215.        value;
  7216.      * The assignment value is the amount by which to increment or
  7217.        decrement the variable.
  7218.      * If an assignment value is not given, 1 is used.
  7219.        
  7220.    If you include more than one variable-value pair in a ++ or --
  7221.    expression, every variable (except, optionally, the last) must be
  7222.    followed by a value. Examples:
  7223.    
  7224.   (++ a)                Equivalent to (setq a (+ a 1)) and to (++ a 1)
  7225.   (++ a 2)              Equivalent to (setq a (+ a 2))
  7226.   (-- a (* 2 pi))       Equivalent to (setq a (- a (* 2 pi)))
  7227.   (++ a 1 b 1 c 1 d)    Equivalent to four SETQs incrementing a,b,c,d by 1.
  7228.  
  7229.    Another group of operators forms the predicates. These return a "truth
  7230.    value", in which 0 (or NIL) is false, and 1 or any other nonzero
  7231.    number is true.
  7232.    
  7233.   Operator  Description                            Example           Result
  7234.   = (or ==) Operands are equal                     (= 1 1.0)         1
  7235.   !=        Operands are not equal                 (!= 1 1.0)        0
  7236.   <         Operands in strictly ascending order   (< 1 2 3)         1
  7237.   <=        Operands in ascending order            ( 3 2 1)         1
  7238.   >=        Operands in descending order           (
  7239.  
  7240. The Exclusive OR of two values is true if one value is true and the other
  7241. value is false.
  7242.  
  7243. And another group operates on bits within an integer word:
  7244.  
  7245.   Operator  Description                            Example           Result
  7246.   &         Bitwise AND                            (& 7 2)           2
  7247.   |         Bitwise OR                             (| 1 2 3 4)       7
  7248.   #         Bitwise Exclusive OR                   (# 3 1)           2
  7249.   ~         Reverses all bits                      (~ 3)            -4
  7250.  
  7251.    These operators coerce their operands to integer by truncation if
  7252.    necessary. The result of bit reversal is hardware dependent.
  7253.    
  7254.    The final category of operator works on truth values:
  7255.    
  7256.   Operator  Description                            Example           Result
  7257.   IF        Conditional evaluation                 (if (1) 2 3)      2
  7258.  
  7259.    IF (predicate) (s1) [ (s2) ]
  7260.           The IF operator is similar to Kermit's IF command. If the
  7261.           predicate is true (i.e. evaluates to a nonzero number), the
  7262.           first S-Expression (s1) is evaluated and its value is returned.
  7263.           Otherwise, if (s2) is given, it is evaluated and its value
  7264.           returned; if (s2) is not given, nothing happens and the NIL
  7265.           (empty) value is returned.
  7266.           
  7267.    You can group multiple expressions in the s2 and s2 expressions using
  7268.    EVAL (or "."):
  7269.    
  7270.   (if (< a 0) (eval (setq x 0) (setq y 0)) (eval (setq x a) (setq y b)))
  7271.  
  7272.    or equivalently:
  7273.    
  7274.   (if (< a 0) (. (setq x 0) (setq y 0)) (. (setq x a) (setq y b)))
  7275.  
  7276.    Each operator has its own requirement as to number and type of
  7277.    operands. In the following table, "number" means any kind of number --
  7278.    integer or floating-point -- or a variable, function, macro, or
  7279.    S-Expression that returns a number; "vname" means variable name,
  7280.    "fpnumber" means a floating-point number (or anything that resolves to
  7281.    one), and "integer" means integer (or anything that resolves to one).
  7282.    "truthvalue" means anything that resolves to a value of zero or an
  7283.    empty value (which indicates false) or a nonzero value (which
  7284.    indicates true). "any" means any kind of value, including none at all.
  7285.    
  7286.   Operator  Number of operands   Type of operands    Returns
  7287.   EVAL  (.) 0 or more            S-Expression        Last value (default NIL)
  7288.   STRING    1                    S-Expression        string
  7289.   QUOTE (') 1                    word                string
  7290.   SETQ      0 or more            vname value pairs   Last value (default NIL)
  7291.   LET       0 or more            vname value pairs   Last value (default NIL)
  7292.   +         0 or more            number              number     (default 0)
  7293.   -         0 or more            number              number     (default 0)
  7294.   *         0 or more            number              number     (see note (1))
  7295.   /         2 or more            number              number
  7296.   ^         2 or more            number              number
  7297.   ++        1 or more            vname value pairs   Result of last increment
  7298.   --        1 or more            vname value pairs   Result of last decrement
  7299.   ABS       1                    number              number
  7300.   MAX       1 or more            number              number
  7301.   MIN       1 or more            number              number
  7302.   MOD (%)   2                    number              number
  7303.   FLOAT     1                    number              fpnumber
  7304.   TRUNCATE  1                    number              integer
  7305.   CEILING   1                    number              integer
  7306.   FLOOR     1                    number              integer
  7307.   ROUND     1                    number              integer
  7308.   SQRT      1                    number              fpnumber
  7309.   EXP       1                    number              fpnumber
  7310.   SIN       1                    number              fpnumber
  7311.   COS       1                    number              fpnumber
  7312.   TAN       1                    number              fpnumber
  7313.   LOG       1                    number              fpnumber
  7314.   LOG10     1                    number              fpnumber
  7315.   = (==)    1 or more            number              truthvalue
  7316.   !=        1 or more            number              truthvalue
  7317.   <         1 or more            number              truthvalue
  7318.   <=        1 or more            number              truthvalue
  7319.   >         1 or more            number              truthvalue
  7320.   >=        1 or more            number              truthvalue
  7321.   AND (&&)  1 or more            truthvalue          truthvalue
  7322.   OR  (||)  1 or more            truthvalue          truthvalue
  7323.   XOR       2                    truthvalue          truthvalue
  7324.   NOT (!)   1                    truthvalue          truthvalue
  7325.   &         1 or more            number (see note 2) integer
  7326.   |         1 or more            number (see note 2) integer
  7327.   #         2                    number (see note 2) integer
  7328.   ~         1                    number (see note 2) integer
  7329.   IF        2 or 3               truthvalue,any,any  any
  7330.  
  7331.    Operators that don't require any arguments return the default values
  7332.    shown.
  7333.    
  7334.     1. The value of "*", when used as an operator, is initially "1" and
  7335.        the value of the most recent S-Expression thereafter, as in Franz
  7336.        Lisp. This is handy when doing a series of calculations by hand:
  7337.  
  7338.   C-Kermit>(* 13272.42 0.40)
  7339.    5308.968
  7340.   C-Kermit>(/ * 2)
  7341.    2654.4840
  7342.   C-Kermit>
  7343.     2. The bitwise operators coerce their operands to integer by
  7344.        truncation.
  7345.        
  7346.    [ [451]Top ] [ [452]Contents ] [ [453]C-Kermit Home ] [ [454]Kermit
  7347.    Home ]
  7348.      _________________________________________________________________
  7349.    
  7350.   9.5. Variables
  7351.   
  7352.    As noted elsewhere in this discussion, all backslash items (variables
  7353.    such as \%a, macro parameters such as \%1, array elements such as
  7354.    \&a[\%i], built-in variables such as \v(ndate), built-in functions
  7355.    such as \fjoin(), macro names enclosed in \m(), \s(), or \:(), etc)
  7356.    are evaluated at "top level" before the S-Expression is sent to the
  7357.    S-Expression reader. To use a backslash variable as the target of an
  7358.    assignment (e.g. by SETQ, LET, ++, or --), you must double the
  7359.    backslash, e.g. (setq \\%r 1234). This is discussed at greater length
  7360.    in the next section.
  7361.    
  7362.    Thus S-Expression reader generally deals only with macro names (not
  7363.    backslash items) as variables. It is important to understand how the
  7364.    reader handles macro names. There are fundamentally two kinds of
  7365.    S-Expressions: those that contain a single element, such as:
  7366.    
  7367.   (foo)
  7368.  
  7369.    and those that contain more than one element:
  7370.    
  7371.   (foo a b c)
  7372.  
  7373.    If an S-Expression contains only one element, and it is the name of a
  7374.    macro, the macro's definition is examined. If the definition is a
  7375.    number (integer or floating-point, positive or negative), then this
  7376.    becomes the value of the expression. If the definition starts with '
  7377.    (apostrophe), then the quoted word or string is the value of the
  7378.    expression (explained in [455]Section 9.8). Otherwise, the macro is
  7379.    assumed to be composed of Kermit commands (possibly including
  7380.    S-Expressions), which are executed. If the macro has a RETURN value,
  7381.    or it executes an S-Expression as its last command, the result becomes
  7382.    the value of the S-Expression; otherwise the result is empty.
  7383.    
  7384.    For S-Expressions that contain more than one element, and the first
  7385.    element is the name of a macro, then this macro is executed with the
  7386.    arguments that are given, after the arguments are evaluated by the
  7387.    S-Expression reader. Likewise, If the first element is a built-in
  7388.    operator, then it is applied to the operands after they are evaluated.
  7389.    In both cases, each operand is fed to the S-Expression reader
  7390.    recursively for evaluation. If an operand is a number or a quoted
  7391.    string, it is used as-is. But if it's a macro name, this degenerates
  7392.    into the first case, and the previous paragraph applies.
  7393.    
  7394.    Examples:
  7395.    
  7396.   define foo 123
  7397.   (foo)                                Result: 123
  7398.   define foo 'abc
  7399.   (foo)                                Result: abc
  7400.   define foo '(one two three)
  7401.   (foo)                                Result: one two three
  7402.   define foo return \frandom(1000)
  7403.   (foo)                                Result: 713 (or other number)
  7404.   define foo (+ a b)
  7405.   (foo)                                Result: The sum of a and b
  7406.  
  7407.    A more difficult example:
  7408.    
  7409.   define foo abc
  7410.   (foo)                                Result: ???
  7411.  
  7412.    The result in the last example depends on the definition of abc:
  7413.    
  7414.      * If it has no definition, an error occurs; otherwise:
  7415.      * If the definition is an S-Expression, the result is the
  7416.        S-Expression's value; otherwise:
  7417.      * If the definition consists of Kermit commands, they are executed.
  7418.        But in this case "(foo)" produces the empty result, because it
  7419.        doesn't RETURN anything.
  7420.        
  7421.    The use of macros as S-Expression operators is described in
  7422.    [456]Section 9.8.
  7423.    
  7424.    [ [457]Top ] [ [458]Contents ] [ [459]C-Kermit Home ] [ [460]Kermit
  7425.    Home ]
  7426.      _________________________________________________________________
  7427.    
  7428.   9.6. Assignments and Scope
  7429.   
  7430.    The assignment operators SETQ and LET apply to global and local
  7431.    variables, respectively. SETQ and LET are standard Lisp operators
  7432.    adapted to Kermit scoping rules. When the operands are numeric or
  7433.    arithmetic, SETQ is equivalent to Kermit's EVALUATE command:
  7434.    
  7435.   (setq a (+ 1 2))
  7436.   evaluate a 1 + 2
  7437.  
  7438.    When the operand is a string, SETQ is equivalent to DEFINE:
  7439.    
  7440.   (setq a '(this is a string))
  7441.   define a this is a string
  7442.  
  7443.    In the first case, both statements create a macro named "a" with a
  7444.    value of 3. But in neither case is the macro "a" necessarily global.
  7445.    If either of these commands executes in an environment (i.e. macro
  7446.    invocation level) where a "local a" command has been given, the "a"
  7447.    macro is global to that environment, but is not visible outside it.
  7448.    
  7449.    LET is equivalent to the Kermit LOCAL command, followed by the
  7450.    corresponding EVALUATE:
  7451.    
  7452.   (let a (+ 1 2))
  7453.  
  7454.    is equivalent to:
  7455.    
  7456.   local a
  7457.   evaluate a 1 + 2
  7458.  
  7459.    Again, "local" in this context applies to the Kermit macro invocation
  7460.    stack, not to the S-Expression nesting level. To illustrate, recall
  7461.    our "newarea" macro:
  7462.    
  7463. def newarea {
  7464.     (let a \%1 b \%2 c \%3)
  7465.     (let s (/ (+ a b c) 2.0))
  7466.     (sqrt (* s (- s a) (- s b) (- s c)))
  7467. }
  7468.  
  7469.    Because SETQ and LET expressions return a value, they can be placed
  7470.    within a larger S-Expression. In this case we can replace the first
  7471.    reference to the "s" variable by its defining expression:
  7472.    
  7473. def newarea {
  7474.     (let a \%1 b \%2 c \%3)
  7475.     (sqrt (* (let s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
  7476. }
  7477.  
  7478.    This would not work if LET were local to the S-Expression, but it
  7479.    works nicely in the context of Kermit macros. The previous definition
  7480.    is equivalent to:
  7481.    
  7482. def newarea {
  7483.     local a b c s
  7484.     (setq a \%1 b \%2 c \%3)
  7485.     (sqrt (* (setq s (/ (+ a b c) 2.0)) (- s a) (- s b) (- s c)))
  7486. }
  7487.  
  7488.    In both cases, the variables a, b, c, and s are local to the "newarea"
  7489.    macro, and global within it.
  7490.    
  7491.    Multiple assignments can be handled in several ways. Here is the
  7492.    obvious way to initialize a series of variables to the same value:
  7493.    
  7494.   (setq a 0)
  7495.   (setq b 0)
  7496.   (setq c 0)
  7497.   (setq s 0)
  7498.  
  7499.    Here is a more compact and efficient way of doing the same thing:
  7500.    
  7501.   (setq a 0 b 0 c 0 s 0)
  7502.  
  7503.    However, in case the value was more complex, it's better to put only
  7504.    one copy of it in the S-Expression; in this case we rely on the fact
  7505.    that SETQ returns the value of its last assignment:
  7506.    
  7507.   (setq a (setq b (setq c (setq s (* x (^ y 2))))))
  7508.  
  7509.    Similarly, to set a series of variables to x, x+1, x+2, ...
  7510.    
  7511.   (setq c (+ (setq b (+ (setq a (+ (setq s x) 1)) 1)) 1))
  7512.  
  7513.    In the last example, you can see why "last" does not always correspond
  7514.    to "rightmost" (the leftmost variable "c" is assigned last).
  7515.    
  7516.    If you are working with backslash variables like \%a or array elements
  7517.    like \&a[1], remember two rules:
  7518.     1. Don't put spaces inside array brackets.
  7519.     2. You must double the backslash when using SETQ, LET, ++, or -- to
  7520.        assign a value to a backslash variable.
  7521.        
  7522.    Examples of assigning to a backslash variable:
  7523.    
  7524.   (setq x 1)
  7525.   (setq \\%a 0)
  7526.   (setq \\&a[x+1] 1)
  7527.   (++ \\%x)
  7528.   (-- \\&a[x+2])
  7529.  
  7530.    Examples of referring to a backslash variable's value:
  7531.    
  7532.   (setq a (+ \%a 1))
  7533.   (setq b (+ \%a \&a[1]))
  7534.   (++ a \%x)
  7535.   (-- b \&a[1])
  7536.  
  7537.    The special notation is required because all backslashed items (\%x
  7538.    variables, array elements, built-in \v(xxx) variables, and \fxxx()
  7539.    function invocations) are evaluated in a single pass BEFORE the
  7540.    S-Expression is executed; any other approach would result in
  7541.    unacceptable performance. So, for example, in:
  7542.    
  7543.   declare \&a[] = 1 2 3
  7544.   define \%x 4
  7545.   define \%y 0
  7546.   (setq \\%y (+ \%x \&a[1]))
  7547.  
  7548.    the S-Expression becomes:
  7549.    
  7550.   (setq \%y (+ 4 1))
  7551.  
  7552.    before it is sent to the S-Expression evaluator. If the backslash had
  7553.    not been doubled on the assignment target, the result would have been:
  7554.    
  7555.   (setq 0 (+ 4 1))
  7556.  
  7557.    which is illegal because you can't assign a value to a number.
  7558.    Conversely, if backslashes were doubled on right-hand-side values:
  7559.    
  7560.   (setq \\%y (+ \\%x \\&a[1])
  7561.  
  7562.    this too, would give an error (not numeric - "\%x").
  7563.    
  7564.    If you omit the double backslash in the assignment target, the result
  7565.    depends on whether the variable already has a value:
  7566.    
  7567.   (setq \%a (* 3 3))
  7568.  
  7569.    If \%a has a non-numeric single-word value, then this becomes the name
  7570.    of the variable that is assigned by SETQ. To illustrate:
  7571.    
  7572.   define \%a foo
  7573.   echo \%a
  7574.   foo
  7575.   (setq \%a (* 3 3))
  7576.   echo \%a
  7577.   foo
  7578.   show macro foo
  7579.   foo = 9
  7580.  
  7581.    If \%a has no value, a numeric value, or a multiword value, an
  7582.    "invalid assignment" error occurs.
  7583.    
  7584.    [ [461]Top ] [ [462]Contents ] [ [463]C-Kermit Home ] [ [464]Kermit
  7585.    Home ]
  7586.      _________________________________________________________________
  7587.    
  7588.   9.7. Conditional Expressions
  7589.   
  7590.    The IF operator provides a compact form of decision-making within
  7591.    S-Expressions. An IF expression can stand wherever a number might
  7592.    stand, as long is it returns a number. Here's a quick way to obtain
  7593.    the average value of all the elements in an array that contains only
  7594.    numbers:
  7595.    
  7596.   (/ (+ \fjoin(&a)) (float \fdim(&a)))
  7597.  
  7598.    This results in a "Divide by zero" error if the array is empty. If you
  7599.    want to define the average value of an empty array to be 0 instead of
  7600.    getting an error, you can use IF to check the array size:
  7601.    
  7602.   (if \fdim(&a) (/ (+ \fjoin(&a)) (float \fdim(&a))) 0)
  7603.  
  7604.    or equivalently:
  7605.    
  7606.   (if (not \fdim(&a)) 0 (/ (+ \fjoin(&a)) (float \fdim(&a))))
  7607.  
  7608.    Of course, IF can fit anywhere else into an S-Expression:
  7609.    
  7610.   (setq a (+ b (if (< c 0) 0 c)
  7611.  
  7612.    and the IF expression can be as complex as you like:
  7613.    
  7614.   (setq a (+ b (if (and (or (> x 0) (> y 0)) (< c 0) (> d 1) (!= e 0)) 1 0)))
  7615.  
  7616.    and the "then" and "else" parts can contain multiple S-Expressions
  7617.    enclosed within (EVAL ...):
  7618.    
  7619.   (if x (eval (...) (...) (...)) (eval (...) (...) (...)))
  7620.  
  7621.    AND and OR operators are guaranteed to "short circuit". If any operand
  7622.    of AND is false, none of the subsequent operands is evaluated;
  7623.    likewise, if an OR operand is true, no further operands are evaluated.
  7624.    
  7625.    Bear in mind that the S-Expression IF is not the same as Kermit IF;
  7626.    the condition is only allowed to be an S-Expression or a variable or
  7627.    number, not the whole list of possibilities you see when you type "if
  7628.    ?" at the C-Kermit> prompt. But keep reading...
  7629.    
  7630.    [ [465]Top ] [ [466]Contents ] [ [467]C-Kermit Home ] [ [468]Kermit
  7631.    Home ]
  7632.      _________________________________________________________________
  7633.    
  7634.   9.8. Extensibility
  7635.   
  7636.    To extend the capabilities of S-Expressions, you can use Kermit macro
  7637.    names as operators, with the following limitations:
  7638.    
  7639.      * The macro must not have the same name as a built-in operator.
  7640.      * You must use the full macro name, not an abbreviation.
  7641.        
  7642.    And with the following enhancement:
  7643.    
  7644.      * If the last statement executed by the macro is an S-Expression,
  7645.        its value is returned automatically. In other words:
  7646.        
  7647.   define bump (++ \%1)
  7648.  
  7649.    is equivalent to:
  7650.    
  7651.   define bump return \fsexpression(++ \%1)
  7652.  
  7653.    Here's an example in which we define a FIBONACCI operator that returns
  7654.    the nth element, n > 0, of the Fibonacci series, 0 1 1 2 3 5 8 13 21
  7655.    34 55, . . ., in which the first element is 0, the second is 1, and
  7656.    each subsequent element is the sum of the two before it. This series
  7657.    was devised by Leonardo Pisano, Filius Bonacci (Fibonacci for short)
  7658.    in 1202 to describe how fast rabbits can breed, and also forms the
  7659.    basis for the Golden Mean, the branching behavior of plants, the
  7660.    spiral of a nautilus shell, etc.
  7661.    
  7662.    We can write a FIBONACCI function as a macro easily with
  7663.    S-Expressions:
  7664.    
  7665.   define FIBONACCI {
  7666.       (if (< \%1 3) (- \%1 1) (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1))))
  7667.   }
  7668.  
  7669.    You can read this as:
  7670.    
  7671.      If the argument (\%1) is less than 3, return the argument minus 1;
  7672.      otherwise:
  7673.      return the sum of fibonacci(argument - 2) and fibonacci(argument -
  7674.      1)
  7675.      
  7676.    Note that a RETURN statement is not needed, since S-Expressions
  7677.    automatically set the return value of their containing macros.
  7678.    
  7679.    For comparison, here's how it would be coded without S-Expressions:
  7680.    
  7681.   define FIBONACCI {
  7682.       if < \%1 3 return \feval(\%1-1)
  7683.       return \feval(\fexec(fibonacci \feval(\%1-2)) -
  7684.            + \fexec(fibonacci \feval(\%1-1)))
  7685.   }
  7686.  
  7687.    Now we can use the FIBONACCI function (whichever way you write it)
  7688.    just as if it were a built-in operator:
  7689.    
  7690.   (fibonacci 6)
  7691.  
  7692.    Or:
  7693.    
  7694.   (setq a 10)
  7695.   (fibonacci a)
  7696.  
  7697.    Within S-Expressions only (not outside them), S-Expressions themselves
  7698.    can be used as macro arguments:
  7699.    
  7700.   (setq a 2 b 4)
  7701.   (setq x (fibonacci (* a b )))
  7702.  
  7703.    The value of the S-Expression (in this case "8"), and not the
  7704.    S-Expression itself, is sent to the macro.
  7705.    
  7706.    Your macro is responsible for argument validation and error handling.
  7707.    A robust Fibonacci macro would be more like this:
  7708.    
  7709.   define FIBONACCI {
  7710.       if < \v(argc) 2 end 1 ?\%0: Missing argument
  7711.       if > \v(argc) 2 end 1 ?\%0: Too many arguments
  7712.       if not integer \%1 end 1 ?\%0: Integers only
  7713.       if < \%1 1 end 1 ?\%0: Argument out of range
  7714.       (if (< \%1 2) (\%1) (+ (fibonacci (- \%1 2)) (fibonacci (- \%1 1))))
  7715.   }
  7716.  
  7717.    Recall that "END nonzero-number [ message ]" causes a macro invocation
  7718.    to fail. When the macro is the operator in an S-Expression, this makes
  7719.    the S-Expression fail too. Also note that our Fibonacci macro is just
  7720.    an illustration, not a practical example. Since it is recursive (calls
  7721.    itself), it won't work for large arguments because the call stack can
  7722.    exceed available memory. See [469]Section 9.9.2 for a practical
  7723.    alternative.
  7724.    
  7725.    Kermit macros, when used as S-Expression operators, can do anything at
  7726.    all except initiate file transfers: they can print messages on the
  7727.    screen, read and write files, interact with the user, and so on. For
  7728.    example, here's a macro ASKME that asks you to enter a number, makes
  7729.    sure that you did, and then returns its value for use in the
  7730.    S-Expression:
  7731.    
  7732.   define ASKME {
  7733.       local \%n
  7734.       while true {
  7735.           ask \%n { Number: }
  7736.           if not def \%n continue
  7737.           if not numeric \%n {
  7738.               echo Not numeric - "\%n"
  7739.               continue
  7740.           }
  7741.           break
  7742.       }
  7743.       return \%n
  7744.   }
  7745.   (setq a (* 2 (askme)) ; Get number from user, double it, assign result to a.
  7746.  
  7747.    Here's a macro you can use to validate that a number is in a given
  7748.    range:
  7749.    
  7750.   define inrange {
  7751.       if != \v(argc) 4 end 1 ?\%0: Wrong number of arguments
  7752.       if ( < \%1 \%2 || > \%1 \%3 ) return 0
  7753.       return 1
  7754.   }
  7755.  
  7756.    The first argument is the number to be checked, the second is the
  7757.    minimum acceptable value, the third is the maximum. You can use this
  7758.    (for example) in IF conditions:
  7759.    
  7760.   define yes echo \%1 IS OK
  7761.   define no echo \%1 IS NOT OK
  7762.  
  7763.   (setq a -1 b 999)
  7764.   (if (inrange a 0 100) (yes a) (no a))
  7765.   (if (inrange b -1000 +1000) (yes b) (no b))
  7766.  
  7767.    This is just an illustration, of course; there's already a built-in
  7768.    operator to let you do range checking without help from macros:
  7769.    
  7770.   (if (<= 0 a 100) (yes a) (no a))
  7771.   (if (<= -1000 b +1000) (yes b) (no b))
  7772.  
  7773.    To send string parameters to a macro, some kind of quoting is required
  7774.    to tell the S-Expression parser to take a given "word" literally
  7775.    rather than replacing it by its value. For this we use the Lisp QUOTE
  7776.    operator:
  7777.    
  7778.   define length return \flength(\%1)
  7779.   (length (quote abcdefghijklmnopqrstuvwxyz))
  7780.   26
  7781.  
  7782.    This causes the string "abcdefghijklmnopqrstuvwxyz" to be sent
  7783.    literally to the LENGTH macro. Kermit, like Lisp, also offers a
  7784.    shortcut for QUOTE, that lets us quote a word by prefixing it with a
  7785.    single quote (') character, also called apostophe (ASCII 39):
  7786.    
  7787.   (length 'abcdefghijklmnopqrstuvwxyz)
  7788.   26
  7789.  
  7790.    The two forms are equivalent.
  7791.    
  7792.    How the macro treats its arguments is up to the macro. In the example
  7793.    above, the argument is treated as a literal string. However, it can
  7794.    also be treated as a variable name:
  7795.    
  7796.   define string This is a string
  7797.   define length return \flength(\m(\%1))
  7798.   (length 'string)
  7799.   16
  7800.  
  7801.    Note the construct \m(\%1). This means "the value of the macro whose
  7802.    name is the value of
  7803.    \%1". The value of \%1 in this case is the word "string", and the
  7804.    value of the macro whose name is "string" is "This is a string".
  7805.    
  7806.    What if the macro takes multiple arguments, or a variable number of
  7807.    them? Here's a simple macro that prints a phrase that includes its
  7808.    arguments:
  7809.    
  7810.   define complain echo It's too \%*!
  7811.  
  7812.    (Recall that \%* means "all arguments".)
  7813.    
  7814.    It can be called in the traditional way:
  7815.    
  7816.   complain hot                       Result: "It's too hot!"
  7817.   complain cold and wet              Result: "It's too cold and wet!"
  7818.  
  7819.    Or from an S-Expression if you quote the arguments:
  7820.    
  7821.   (complain 'hot)                    Result: "It's too hot!"
  7822.   (complain 'cold 'and 'wet)         Result: "It's too cold and wet!"
  7823.  
  7824.    To group multiple words into a single argument, use parentheses:
  7825.    
  7826.   (complain (quote (cold and wet)))  Result: "It's too cold and wet!"
  7827.   (complain '(cold and wet))         Result: "It's too cold and wet!"
  7828.  
  7829.    Note the difference:
  7830.    
  7831.   (complain 'cold 'and 'wet)         Three arguments
  7832.   (complain '(cold and wet))         One argument
  7833.  
  7834.    Since the COMPLAIN macro uses \%* to refer to all its arguments, no
  7835.    matter how many, it doesn't care which form you use. But it makes a
  7836.    difference in cases where the macro refers to its arguments
  7837.    individually.
  7838.    
  7839.    To illustrate, let's consider a macro that receives the name of a
  7840.    macro and its argument list and executes it with its arguments,
  7841.    without knowing how many arguments there are. The following LOOP macro
  7842.    is used to execute the given macro with the given argument list the
  7843.    requested number of times:
  7844.    
  7845.   def loop { local i, for i 1 \%1 1 do \%2 \%3 }
  7846.  
  7847.    Within the LOOP macro, the first argument (\%1) is the loop count, \%2
  7848.    is the macro name, and \%3 is the argument list. When the LOOP macro
  7849.    is invoked traditionally like this:
  7850.    
  7851.   loop 3 complain hot
  7852.  
  7853.    it prints "It's too hot!" three times. To invoke it from an
  7854.    S-Expression, you must quote both the macro name as well as the
  7855.    argument, since in this case the macro name itself is an argument:
  7856.    
  7857.   (loop 3 'complain 'hot)
  7858.  
  7859.    Now what if you need to send different or variable numbers of
  7860.    arguments to the LOOP macro? The LOOP macro can handle it already,
  7861.    provided you group the arguments into LOOP's third argument (\%3). In
  7862.    Kermit syntax, without grouping:
  7863.    
  7864.   loop 3 complain cold and wet
  7865.  
  7866.    prints "It's too cold!" three times ("and wet" is lost); but with
  7867.    grouping (either of the following two forms):
  7868.    
  7869.   loop 3 complain {cold and wet}
  7870.   loop 3 complain "cold and wet"
  7871.  
  7872.    the LOOP macro prints "It's too cold and wet!" three times as desired.
  7873.    
  7874.    To do the same thing in an S-Expression, just use the Lisp forms of
  7875.    quoting instead of the Kermit forms; the following two are equivalent:
  7876.    
  7877.   (loop 3 'complain (quote (cold and wet)))
  7878.   (loop 3 'complain '(cold and wet))
  7879.  
  7880.    Here's a similar example in which we write a macro that shows both the
  7881.    name and the value of one or more other macros, whose names are given
  7882.    as arguments (similar to "show macro"):
  7883.    
  7884.   define display {
  7885.       local \%i
  7886.       for \%i 1 \v(argc)-1 1 {
  7887.           echo \&_[\%i] = \m(\&_[\%i])
  7888.       }
  7889.   }
  7890.  
  7891.    (Recall that \&_[] is the macro's argument vector array, equivalent to
  7892.    \%1, \%2, ...) The DISPLAY macro can be used in S-Expressions like
  7893.    this:
  7894.    
  7895.   (setq a 1 b 2 c 3)
  7896.   (display 'a 'b 'c 'd)
  7897.  
  7898.    which prints:
  7899.    
  7900.   a = 1
  7901.   b = 2
  7902.   c = 3
  7903.   d =
  7904.  
  7905.    The names must be quoted to prevent their evaluation before they are
  7906.    sent to the macro. This ability to pass variables "by name" to macros,
  7907.    rather than by value, lets you write macros that change the values of
  7908.    argument variables. For example, here's a macro that doubles the value
  7909.    of its argument variable:
  7910.    
  7911.   define double (++ \%1 \%1)
  7912.  
  7913.    which you can call like this:
  7914.    
  7915.   (setq a 12)
  7916.   (double 'a)
  7917.  
  7918.    In the macro, \%1 is replace by the variable name "a"; "(++ a a)" adds
  7919.    "a" to itself, and sets the value of "a" to the result.
  7920.    
  7921.    There are no built-in operators other than QUOTE, ', and STRING for
  7922.    handling strings in S-Expressions, but using just these, plus macros
  7923.    that use Kermit's regular string-handling features, you can easily
  7924.    extend S-Expressions to do string manipulation:
  7925.    
  7926.   define len return \flen(\%1)               Returns length of argument string
  7927.   define cap return \fupper(\%1)             Uppercase argument string
  7928.   define rev return \freverse(\%1)           Reverses argument string
  7929.   define sub return \fsubstr(\%1,\%2,\%3)    Returns substring of arg string
  7930.  
  7931.   (len '(this is a string))                  Result: 16
  7932.   (rev '(this is a string))                  Result: gnirts a si siht
  7933.   (rev (cap '(this is a string)))            Result: GNIRTS A SI SIHT
  7934.   (sub (rev (cap '(this is a string))) 5 9)  Result: TS A SI S
  7935.  
  7936.    You can assign a string to a macro name as follows:
  7937.    
  7938.   (setq foo '(this is a string)))
  7939.   (setq foo (quote (this is a string))))
  7940.  
  7941.    The two are exactly equivalent. In both cases, the macro "foo" has the
  7942.    value:
  7943.    
  7944.   '(this is a string)
  7945.  
  7946.    so when it is retrieved it can be identified as a string rather than a
  7947.    number or commands to be executed. Thus:
  7948.    
  7949.   (setq foo (quote (this is a string))))
  7950.   show macro foo
  7951.   foo = '(this is a string)
  7952.   (foo)
  7953.   this is a string
  7954.  
  7955.    Note the different results for "show macro foo" and "(foo)". The
  7956.    former shows the internal definition; the latter evaluates the
  7957.    variable, which removes the quoting. And perhaps more important, note
  7958.    that if the apostrophe and surrounding parentheses were not stored as
  7959.    part of the definition, (foo) would try to execute "this is a string"
  7960.    as a command.
  7961.    
  7962.    Given the assignment above, the following work as expected:
  7963.    
  7964.   (len foo)                                  Result: 16
  7965.   (rev foo)                                  Result: gnirts a si siht
  7966.   (rev (cap foo))                            Result: GNIRTS A SI SIHT
  7967.   (sub (rev (cap foo)) 5 8)                  Result: TS A SI S
  7968.  
  7969.    Note that, unlike built-in S-Expression operators that return numbers
  7970.    or truth values, these operators return strings. If you want to assign
  7971.    their return values to other variables, you can do so:
  7972.    
  7973.   (setq bar (rev (cap foo)))                 Result: GNIRTS A SI SIHT
  7974.  
  7975.    But now the S-Expression processor doesn't know the value of "bar" is
  7976.    supposed to be a string, rather than a macro to execute. For this you
  7977.    need one final special operator, STRING. The STRING operator takes an
  7978.    S-Expression as an operand, evaluates it, and then returns its value
  7979.    enclosed in '(), so you can use the value as a string is subsequent
  7980.    S-Expressions. Use STRING for referencing macros that return strings:
  7981.    
  7982.   (setq bar (string (rev (cap foo))))        Result: '(GNIRTS A SI SIHT)
  7983.  
  7984.    STRING is like QUOTE, except that it evaluates its operand before
  7985.    applying the quoting, rather than taking the operand literally.
  7986.    
  7987.    To reference backslash variables or functions that return string
  7988.    values, you must use the regular quoting mechanisms:
  7989.    
  7990.   (setq time '(\v(time)))
  7991.   (setq date '(\v(date)))
  7992.   assign \%r this is a string
  7993.   (setq s1 '(\%r))
  7994.  
  7995.    That's because backslash items are evaluated BEFORE the S-Expression
  7996.    parser ever sees them, and the values of \v(time) and so on are not
  7997.    valid S-Expressions, so STRING won't like them.
  7998.    
  7999.    Finally a brief word on the touchy topic of quoting. Suppose you want
  8000.    to include (say) literal parentheses in a string that will later be
  8001.    processed by the S-Expression reader (or \fsplit() or \fword()).
  8002.    Normally, you can't do this because parentheses are meaningful in
  8003.    these contexts. To defeat the normal parsing rules, you can quote the
  8004.    parentheses with backslash. However, due to the many levels of string
  8005.    processing involved, a surprisingly large amount of backslashes might
  8006.    be required, for example:
  8007.    
  8008.   (setq s '(a b (c d) \\\\\\\\\\\\\\\\(e f (g h) x\\\\\\\\\\\\\\\\) j k))
  8009.  
  8010.    This is nearly impossible to explain(*). Instead, just remember two
  8011.    points:
  8012.    
  8013.      * In situations like this, it's better to use DEFINE to create the
  8014.        string, rather than SETQ. The example above requires only double
  8015.        backslashes when DEFINE is used:
  8016.  
  8017.   define s '(a b (c d) \\(e f (g h) x\\j k))
  8018.      * The level of quoting depends on how many levels of evaluation the
  8019.        string must pass through, which is not always obvious. However,
  8020.        the number of backslashes required in any given situation is
  8021.        always a power of 2. So if 1 doesn't work, try 2; if 2 doesn't
  8022.        work, try 4; if 4 doesn't work, try 8, 16, 32, and so on.
  8023.        
  8024.    Considerations like this apply in any scripting language (shell, Tcl,
  8025.    Perl, Python, etc). The situation is known as "Quoting Hell".
  8026.    
  8027.    (*) If you really want an explanation, here it is:
  8028.    
  8029.      * Every SEXP has its backslash items evaluated in a single pass at
  8030.        top level before being passed to the SEXP reader, so \%1,
  8031.        \v(ftime), etc, can be evaluated up front, freeing the SEXP reader
  8032.        of having to know about such things, which in turn makes it much
  8033.        more efficient. Therefore one level of quoting is lost right away,
  8034.        and therefore you must double each backslash that is to be used as
  8035.        a quote.
  8036.      * When the SEXP reader sees '\', it treats it as a quote; discards
  8037.        it and keeps the next character. Thus '\\' becomes '\'. This would
  8038.        be the end of it, except that:
  8039.      * The SEXP reader must call itself recursively on its operands, so
  8040.        we must double any quotes in the operands: 2^2 = 4.
  8041.      * If the result is to be passed as an argument to a macro, the
  8042.        backslashes must again be doubled, because the macro processor
  8043.        evaluates the arguments before sending them to the macro: 2^3 = 8.
  8044.      * If the macro itself is to see the quotes, rather than just the
  8045.        result of the quoting, the quotes must be doubled again: 2^4 = 16.
  8046.        
  8047.    Moral: To create string constants in which grouping characters must be
  8048.    quoted, use DEFINE rather than SETQ.
  8049.    
  8050.    [ [470]Top ] [ [471]Contents ] [ [472]C-Kermit Home ] [ [473]Kermit
  8051.    Home ]
  8052.      _________________________________________________________________
  8053.    
  8054.   9.9. Examples
  8055.   
  8056.     9.9.1. Statistics
  8057.     
  8058.    The following program computes statistics -- means, maxima, mimima,
  8059.    variance, standard deviation, and correlation -- from data stored in
  8060.    parallel arrays, \&x[] and \&y[], which can contain any mixture of
  8061.    integer and floating-point numbers: positive, negative, or zero. Array
  8062.    setup and validation are not shown. Except for the traditional FOR
  8063.    loop and printing the results at the end, the entire computation is
  8064.    done with S-Expressions:
  8065.    
  8066. ; Initialize sums, maxima, minima, and number of elements
  8067.  
  8068.   (setq xsum 0 ysum 0 xsum2 0 ysum2 0 xysum 0)
  8069.   (setq xmin (setq xmax \&x[1]) ymin (setq ymax \&y[1]))
  8070.   (setq n \fdim(&x))
  8071.  
  8072. ; Loop through elements and accumulate sums, maxima, and minima
  8073.  
  8074.   for i 1 n 1 {
  8075.       (setq x \&x[i] y \&y[i])                    ; Notational convenience
  8076.       (setq xmax (max xmax x) ymax (max ymax y))  ; X and Y maxima
  8077.       (setq xmin (min xmin x) ymin (min ymin y))  ; X and Y minima
  8078.       (++ xsum x ysum y)                          ; X and Y sums
  8079.       (++ xsum2 (^ x 2) ysum2 (^ y 2))            ; Sum of X and Y squares
  8080.       (++ xysum (* x y))                          ; Sum of XY products
  8081.   }
  8082.  
  8083. ; Calculate results
  8084.  
  8085.   (setq xmean (/ xsum n) ymean (/ ysum n))        ; Mean X and Y
  8086.   (setq xss (- xsum2 (/ (^ xsum 2) n)))           ; Intermediate values
  8087.   (setq yss (- ysum2 (/ (^ ysum 2) n)))
  8088.   (setq xyss (- xysum (/ (* xsum ysum) n)))
  8089.   (setq xvar (/ xss n) yvar (/ yss n))            ; X and Y variance
  8090.   (setq sdx (sqrt xvar) sdy (sqrt yvar))          ; Std deviation in X and Y
  8091.   (setq tmp (* xss yss))
  8092.   (setq cc (if tmp (/ xyss (sqrt tmp)) 1.0))      ; Correlation coefficient
  8093.   show macro xmean ymean xvar yvar sdx sdy cc     ; Print the results
  8094.  
  8095.    The final "if tmp" check accounts for the possibility that both arrays
  8096.    contain all 0's. Results can also be printed with "echo CC = \m(cc)",
  8097.    or any other desired way. Interestingly, if we had not needed the sum
  8098.    of the squares and products, we could have obtained the sums, maxima,
  8099.    and minima of the X's and Y's without a loop like this:
  8100.    
  8101.   (setq xsum (+ \fjoin(&x)) ysum (+ \fjoin(&y))
  8102.   (setq xmax (max \fjoin(&x)) ymax (max \fjoin(&y))
  8103.   (setq xmin (min \fjoin(&x)) ymin (min \fjoin(&y))
  8104.  
  8105.    Any Kermit function that returns numbers or lists of numbers can be
  8106.    included in an S-Expression as an operand.
  8107.      _________________________________________________________________
  8108.    
  8109.     9.9.2. Practical Fibonacci Series
  8110.     
  8111.    The recursive Fibonacci example given previously is simple and
  8112.    elegent, but not very useful since it causes memory occupation to grow
  8113.    each time it calls itself, until eventually both physical memory and
  8114.    disk swap space are filled and the program crashes. Even for small
  8115.    arguments, like 17, execution time can be prohibitive:
  8116.    
  8117.   (setq t1 \v(ftime))
  8118.   (setq result (fibonacci 17))
  8119.   (setq t2 (- \v(ftime) t1))
  8120.   echo FIBONACCI(17) = \m(result): TIME = \ffpround(t2,3)
  8121.  
  8122.    prints (on a certain rather slow computer):
  8123.    
  8124.   FIBONACCI(17) = 987: TIME = 27.544
  8125.  
  8126.    Any recursive function can be recoded iteratively. The result is not
  8127.    as pretty, but execution is far less expensive:
  8128.    
  8129.   define FIBONACCI {
  8130.       local i n r s
  8131.       (setq n \%1 r 1 s 0)
  8132.       if < n 3 return \fsexp(-- n)
  8133.       for i 3 n 1 { (setq tmp r r (+ r s) s tmp) }
  8134.       (r)
  8135.   }
  8136.  
  8137.    Here's the result on the same computer for the same argument of 17:
  8138.    
  8139.   FIBONACCI(17) = 987: TIME = 0.125
  8140.  
  8141.    (220 times faster.) Execution time increases proportionally to the
  8142.    size of the argument in the iterative case, whereas in the recursive
  8143.    case it goes up geometrically, quickly reaching infinity.
  8144.    
  8145.    [ [474]Top ] [ [475]Contents ] [ [476]C-Kermit Home ] [ [477]Kermit
  8146.    Home ]
  8147.      _________________________________________________________________
  8148.    
  8149.   9.10. Differences from Algebraic Notation
  8150.   
  8151.    In C-Kermit:
  8152.    
  8153.      * Algebraic notation uses infix operators and normal rules of
  8154.        operator precedence, with parentheses used to force exceptions to
  8155.        the rules; many operations can be included in an expression.
  8156.        S-Expressions use prefix operators with no intrinsic precedence;
  8157.        each operation is enclosed in parentheses, and the arrangement of
  8158.        parentheses determines precedence.
  8159.      * Algebraic infix operators require two operands; S-Expression
  8160.        prefix operators can accept a variable number of operands.
  8161.      * You can use algebraic notation anywhere that C-Kermit accepts a
  8162.        number, e.g. "echo \&a[((1+1)*2-1]", but you can use S-Expressions
  8163.        only as top-level commands. You can, however, use either algebraic
  8164.        or S-Expressions anywhere at all by enclosing them in \fevaluate()
  8165.        or \fsexpression(), respectively.
  8166.      * You can use any mixture of integer and floating-point numbers in
  8167.        S-Expressions, but only integers are permitted in algebraic
  8168.        expressions. Outside of S-Expressions, floating point arithmetic
  8169.        is supported only by \ffp...() function calls.
  8170.      * Operators and operands in S-Expressions must be separated by
  8171.        spaces, e.g. "(+ a b)". Spaces are not required in algebraic
  8172.        expressions: "((a+b)*c)".
  8173.      * When assigning values to backslash variables (such as \%x or
  8174.        \&a[2]) using SETQ or LET, you must double the backslash.
  8175.        
  8176.    [ [478]Top ] [ [479]Contents ] [ [480]C-Kermit Home ] [ [481]Kermit
  8177.    Home ]
  8178.      _________________________________________________________________
  8179.    
  8180.   9.11. Differences from Lisp
  8181.   
  8182.      * Kermit has a lot of built-in operators not found in Lisp: ++, ^,
  8183.        etc.
  8184.      * Most dialects of real Lisp do not allow S-Expressions that don't
  8185.        start with an operator, for example:
  8186.  
  8187.   (a)
  8188.        This expression can cause an error in Lisp (even if "a" has a
  8189.        value), but is acceptable in Kermit, where it returns the value of
  8190.        the variable "a". Similarly, (1) returns the value "1".
  8191.      * In real Lisp, EVAL requires exactly one operand. In Kermit, it can
  8192.        have 0, 1, 2, or more operands. It returns the value of the last
  8193.        operand evaluated.
  8194.      * Real Lisp SETQ and LET usually require an even number of operands.
  8195.        Kermit allows an odd number, in which case the last (or only)
  8196.        variable is undefined (i.e. deleted, destroyed).
  8197.      * Kermit does not support ratios such as "7/8". Some Lisp dialects
  8198.        accept ratios as numbers, and generate ratios when told to divide
  8199.        two integers whose quotient is not a whole number; e.g. in Common
  8200.        Lisp:
  8201.  
  8202.   [13] USER(37): (/ (+ 1 2 3 4) 3)
  8203.   10/3
  8204.   [13] USER(38):
  8205.      * The result of (/ 10 3) is 3.333.... Some Lisp dialects truncate
  8206.        the result to 3 since both operands are integers, some don't; some
  8207.        give the result as a ratio. C-Kermit always gives a floating point
  8208.        result when there is a fractional part. If you want an integer
  8209.        result, you can use TRUNCATE, FLOOR, or CEILING, e.g. (truncate (/
  8210.        10 3)).
  8211.      * There is currently no "bignum" support. Large numbers can be used
  8212.        and large results generated, but (as noted in [482]Section 9.2)
  8213.        they are accurate only to the precision of the underlying machine.
  8214.        \v(math_precision) gives the machine precision as a number of
  8215.        decimal digits, e.g. 16.
  8216.      * Scientific notation for floating-point numbers is not supported.
  8217.        If the magnitude of a number is greater than the precision of the
  8218.        underlying hardware, the less-significant digits are shown but
  8219.        their values are meaningless. If it the number is too small to be
  8220.        represented internally, it is shown as "0.0".
  8221.      * Many Lisp features are omitted: List processing (CAR, CDR, etc),
  8222.        DEFUN, Lisp-specific control structures, and so on.
  8223.        
  8224.    [ [483]Top ] [ [484]Contents ] [ [485]C-Kermit Home ] [ [486]Kermit
  8225.    Home ]
  8226.    
  8227. 1
  8228.   __________________________________________________________________________
  8229.  
  8230. 10. FILE TRANSFER
  8231.  
  8232.    New commands and switches:
  8233.    
  8234.    SEND /TYPE:{TEXT,BINARY}
  8235.           Sends only files of the given type (see [487]Section 4).
  8236.           
  8237.    SEND /NOFOLLOWLINKS:
  8238.           (UNIX only) Skip over symbolic links rather than following them
  8239.           (default). This applies to wildcard and/or recursive SENDs; if
  8240.           a single filename is given, and it happens to be a symbolic
  8241.           link, the file it points to is sent.
  8242.           
  8243.    SEND /FOLLOWLINKS:
  8244.           (UNIX only) Follow (resolve) symbolic links. Watch out for
  8245.           circular links, endless loops, etc.
  8246.           
  8247.    SET SEND I-PACKETS { OFF, ON }
  8248.           When sending commands to a Kermit server, this tells whether
  8249.           command packets should be preceded by an I (information)
  8250.           packet, which is used to synchronize parameters prior to
  8251.           executing the command. Normally ON. The only reason to set this
  8252.           OFF is for communicating with buggy Kermit servers that
  8253.           misbehave when an I packet is sent to them. There is also a SET
  8254.           RECEIVE I-PACKETS command, but presently it has no effect.
  8255.           
  8256.    SET TRANSFER MESSAGE [ text ]
  8257.           Sets an initial message to be shown in the Last Message field
  8258.           of the fullscreen file-transfer display.
  8259.           
  8260.    SET TRANSFER TRANSLATION { ON, OFF }
  8261.           Inhibits or re-enables text-file transfer character-set
  8262.           translation globally.
  8263.           
  8264.    { SEND, MSEND, GET, RECEIVE } /TRANSPARENT
  8265.           Inhibits character-set translation for this transfer only.
  8266.           
  8267.    { GET, RECEIVE } /PIPES:{ON,OFF}
  8268.           Overrides global TRANSFER PIPES setting for this transfer only;
  8269.           ON allows incoming files with names like "!tar xf -" to be
  8270.           opened as pipelines rather than regular files.
  8271.           
  8272.    The following new "hot keys" are available when Kermit's file-transfer
  8273.    display is visible:
  8274.    
  8275.      D: Turn on debugging, open "debug.log" if not already open.
  8276.      d: Turn off debugging but leave log open (if it was open).
  8277.      T: Turn on debug-log timestamps.
  8278.      t: Turn off debug-log timestamps.
  8279.    
  8280.    Other improvements:
  8281.      * SET FILE DOWNLOAD-DIRECTORY now works for external protocols (e.g.
  8282.        sz/rz) too.
  8283.      * Improved automatic per-file text/binary switching, described in
  8284.        [488]Section 4.
  8285.      * When sending a file group (e.g. "send *.*"), failure to open a
  8286.        file is no longer fatal; now C-Kermit simply goes ahead to the
  8287.        next file.
  8288.      * Transaction log entries are now made for external protocols too.
  8289.        
  8290.    [ [489]Top ] [ [490]Contents ] [ [491]C-Kermit Home ] [ [492]Kermit
  8291.    Home ]
  8292.   __________________________________________________________________________
  8293.  
  8294. 11. MODEMS AND DIALING
  8295.  
  8296.    In C-Kermit 8.0, the default modem type for dialing has changed from
  8297.    NONE (= DIRECT, meaning no modem) to GENERIC. This change should have
  8298.    no impact on direct connections. For dialing, it means that, unless
  8299.    you SET MODEM TYPE to a specific type, such as USROBOTICS or CONEXANT,
  8300.    Kermit assumes:
  8301.    
  8302.     1. The modem uses the Hayes AT command set.
  8303.     2. The modem supports error correction, data compression, and
  8304.        hardware flow control and is already configured to use them.
  8305.        
  8306.    In fact, Kermit assumes the modem is completely configured, and
  8307.    therefore does not send it an initialization string or any
  8308.    configuration commands. Instead, it sends only the simplest and most
  8309.    portable commands:
  8310.    
  8311.      ATQ0V1          Give dial result codes.
  8312.      ATDTnumber      Dial the number.
  8313.    
  8314.    (or ATD or ATDP, as appropriate).
  8315.    
  8316.    The new defaults work for direct connections and for most modern
  8317.    modems on most platforms, and they work much faster than
  8318.    "full-treatment" dialing. If the new defaults don't work for you, or
  8319.    if you need to perform explicit modem configuations or interactions,
  8320.    then set a specific modem type and use the SET MODEM and SET DIAL
  8321.    commands as documented in Using C-Kermit.
  8322.    
  8323.      WARNING: Don't use the generic modem on hosts that do not support
  8324.      RTS/CTS flow control. If Xon/Xoff is in use on the serial port,
  8325.      you'll need to select a particular modem type so Kermit knows what
  8326.      command to give it to enable Xon/Xoff flow control between itself
  8327.      and your serial port.
  8328.      
  8329.    The following new modem types were added in C-Kermit 8.0:
  8330.    
  8331.      lucent:          Lucent Venus chipset
  8332.      pctel:           PCTel V.90 chipset
  8333.      conexant:        Conexant (ex-Rockwell) modem family
  8334.      zoom-v32bis:     New name for "Zoom"
  8335.      zoom-v34         Zoom V.34
  8336.      zoom-v90         Zoom V.90 56K
  8337.      zoom-v92:        Zoom V.92 with V.44 data compression
  8338.      zoltrix-v34:     New name for "zoltrix"
  8339.      zoltrix-hsp-v90: Synonym for PCTel
  8340.      zoltrix-hcf-v90: Synonym for ITU-T-V250
  8341.      smartlink-v90:   Synonym for usrobotics (same chipset)
  8342.      acer-v90:        Synonym for Rockwell-v90
  8343.    
  8344.    New DIAL-related variables:
  8345.    
  8346.      \v(dm_hf):  Dial modifier: Wait for Hook-Flash.
  8347.      \v(dm_wb):  Dial modifier: Wait for Bong.
  8348.    
  8349.    Finally, if dialing fails, Kermit now prints a context-sensitive hint
  8350.    suggesting possible reasons and remedies.
  8351.    
  8352.    [ [493]Top ] [ [494]Contents ] [ [495]C-Kermit Home ] [ [496]Kermit
  8353.    Home ]
  8354.   __________________________________________________________________________
  8355.  
  8356. 12. TERMINAL CONNECTION
  8357.  
  8358.    Now that 7-bit connections are no longer the norm, the default
  8359.    terminal bytesize (also called "data size" or "word size") in C-Kermit
  8360.    8.0 is 8 bits, rather than 7 bits as it was in C-Kermit 7.0 and
  8361.    earlier:
  8362.    
  8363.    SET TERMINAL AUTODOWNLOAD ERROR { STOP, CONTINUE }
  8364.           When Kermit has a terminal connection to another computer, and
  8365.           a file transfer is initiated automatically because a Kermit
  8366.           packet was received in CONNECT mode (i.e. in the terminal
  8367.           screen), this command tells what Kermit should do if the
  8368.           transfer fails. The default is to STOP, which leaves Kermit in
  8369.           command mode with its file-transfer display showing, so you can
  8370.           see that the transfer failed and why. If you SET TERMINAL
  8371.           AUTODOWNLOAD ERROR CONTINUE, this causes Kermit to return
  8372.           automatically to its terminal screen (i.e. resume its CONNECT
  8373.           session) as if the transfer had succeeded; this can be
  8374.           desirable if the entire session is under control of a
  8375.           host-based script.
  8376.           
  8377.    SET TERMINAL BYTESIZE { 7, 8 }
  8378.           The byte size to use during CONNECT and INPUT command
  8379.           execution, which can be more restrictive than the bytesize
  8380.           implied by the current PARITY setting, but not less
  8381.           restrictive. In C-Kermit 7.0 and earlier, the terminal bytesize
  8382.           was 7 by default to protect against the likelihood that parity
  8383.           was in use on the connection without the user's knowledge. When
  8384.           the terminal bytesize is 8 (as it is in C-Kermit 8.0 and
  8385.           later), the user will see garbage in this (increasingly
  8386.           unlikely) situation. Note that 8 data bits are required for
  8387.           most character sets other than ASCII: Latin-1, UTF-8, and so
  8388.           on.
  8389.           
  8390.    A new command has been added to produce timestamped session logs:
  8391.    
  8392.    SET TERMINAL SESSION-LOG TIMESTAMPED-TEXT
  8393.           Records the terminal session in text mode (like SET TERMINAL
  8394.           SESSION-LOG TEXT) but adds a timestamp at the beginning of each
  8395.           line. The timestamp format is hh:mm:ss.nnn, and indicates the
  8396.           time at which the first character of the line appeared.
  8397.           
  8398.    In most UNIX versions (those built with the select()-capable CONNECT
  8399.    module -- pretty much all the ones that have or could have TELNET
  8400.    included), an idle timeout feature has been added:
  8401.    
  8402.    SET TERMINAL IDLE-TIMEOUT number
  8403.           If the number is not 0, then Kermit is to take an action when
  8404.           the given amount of time passes with no activity during CONNECT
  8405.           mode. If the number is positive it is the maximum number of
  8406.           idle seconds; if number is negative it represents milliseconds
  8407.           (thousandths of seconds). If 0 is given as the number, there
  8408.           are no idle timeouts. Synonym: SET TERMINAL IDLE-LIMIT.
  8409.           
  8410.    SET TERMINAL IDLE-ACTION { RETURN, HANGUP, EXIT, OUTPUT [ string ] }
  8411.           The action to be taken upon an idle timeout in CONNECT mode.
  8412.           RETURN to the prompt, HANGUP the connection, EXIT from Kermit,
  8413.           or OUTPUT the given string (if no string is given, a NUL (ASCII
  8414.           0) character is sent).
  8415.           
  8416.    SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }
  8417.           Actions that can be selected on Telnet connections only, that
  8418.           might be useful if idle limits are enforced by the Telnet
  8419.           server or in the TCP/IP protocol: TELNET-NOP sends a "NO
  8420.           Operation" (do-nothing) command, which causes no response from
  8421.           the server; TELNET-AYT sends an "Are You There" message to the
  8422.           server, which should make the server send back a message.
  8423.           Neither of these actions interferes with your remote session.
  8424.           
  8425.    SET TERMINAL IDLE-ACTION is useful for connections to hosts or
  8426.    services that automatically log you out after a certain amount of idle
  8427.    time, e.g.:
  8428.    
  8429.   set term idle-timeout 300
  8430.   set term idle-action output \32
  8431.  
  8432.    sends a space (as if you had pressed the space bar) every 300 seconds
  8433.    (five minutes) while there is no activity (32 is the ASCII code for
  8434.    space).
  8435.    
  8436.    When C-Kermit returns from CONNECT to command mode, the reason for the
  8437.    transition is given in a new variable, \v(cx_status):
  8438.    
  8439.       0  No CONNECT command given yet.
  8440.       1  User escaped back manually.
  8441.       2  A trigger string was encountered.
  8442.       3  IKSD entered server mode.
  8443.       4  Application Program Command received from host.
  8444.       5  Idle timeout.
  8445.       6  Telnet protocol error.
  8446.       7  Keystroke macro.
  8447.       8  Time limit exceeded.
  8448.     100  Internal error.
  8449.     101  Carrier required by not detected.
  8450.     102  I/O error on connection.
  8451.     103  Disconnected by host.
  8452.     104  Disconnected by user.
  8453.     105  Session limit exceeded.
  8454.     106  Rejected due to Telnet policy.
  8455.     107  Received kill signal.
  8456.    
  8457.    Values 100 and above indicate there is no connection.
  8458.    
  8459.    [ [497]Top ] [ [498]Contents ] [ [499]C-Kermit Home ] [ [500]Kermit
  8460.    Home ]
  8461.   __________________________________________________________________________
  8462.  
  8463. 13. CHARACTER SETS
  8464.  
  8465.    See the section on [501]file scanning above, and the section on
  8466.    character-set conversion in [502]FTP. Also:
  8467.    
  8468.      * True support for CP1252 (rather than treating it as Latin-1).
  8469.      * Proper handling of C1 values when converting ISO 8-bit text to
  8470.        UTF-8.
  8471.      * TYPE /CHARACTER-SET: /TRANSLATE-TO: allows specific translations.
  8472.      * The TRANSLATE command now works on multiple files.
  8473.      * K_CHARSET environment variable to set the file character-set.
  8474.      * SET TRANSFER TRANSLATION OFF.
  8475.      * FTP client character-set translation ([503]Section 3.7).
  8476.        
  8477.    [ [504]Top ] [ [505]Contents ] [ [506]C-Kermit Home ] [ [507]Kermit
  8478.    Home ]
  8479.   __________________________________________________________________________
  8480.  
  8481. 14. DIALOUT FROM TELNET TERMINAL SERVERS
  8482.  
  8483.    For years, C-Kermit has supported dialing out from Telnet modem
  8484.    servers (also called reverse terminal servers or access servers), but
  8485.    until now there was no way for Kermit to control the communication
  8486.    parameters (speed, parity, etc) on the serial port of the terminal
  8487.    server; it had to use whatever was there.
  8488.    
  8489.    But now, if you make a connection to a server that supports the Telnet
  8490.    Com Port Control Option, [508]RFC 2217, you have the same degree of
  8491.    control as you would have over a serial port on the computer where
  8492.    Kermit is running: SET SPEED, SET FLOW, SET PARITY, SET STOP-BITS,
  8493.    SHOW COMM, WAIT, SET CARRIER-WATCH, the modem-signal variables,
  8494.    sending Break, and so on, apply to the connection between the terminal
  8495.    server and the modem.
  8496.    
  8497.    For example, using a Cisco Access Server 2509, where specifying a TCP
  8498.    port in the 6000's selects a serial port that can be used for dialing
  8499.    out:
  8500.    
  8501.   set host xxx 6001      ; xxx is the IP hostname or address of the server
  8502.   (log in if necessary)  ; With a script or by hand
  8503.   set modem type usr     ; Tell Kermit what kind of modem it has
  8504.   set speed 57600        ; This affects the server's port
  8505.   set flow rts/cts       ; Ditto
  8506.   dial 7654321
  8507.  
  8508.    The modem server might or might not require a login sequence. It might
  8509.    also allow for automatic authentication, e.g. via Kerberos tickets.
  8510.    NOTE: If the modem server requires a login sequence, then REDIAL might
  8511.    not work as expected.
  8512.    
  8513.    When you have a Telnet Com Port connection, your SET SPEED and SET
  8514.    FLOW options change automatically to reflect the capabilities of the
  8515.    server, rather than those of your local computer.
  8516.    
  8517.    See the configuration manual for your server for additional
  8518.    information. For example, how to set up the server to drop the Telnet
  8519.    connection automatically when the telephone call is hung up (e.g.
  8520.    "autohangup" on Cisco models).
  8521.    
  8522.    For a Linux-based Telnet Com-Port server, click the Srdird link:
  8523.    
  8524.    [ [509]Top ] [ [510]Contents ] [ [511]Sredird ] [ [512]C-Kermit Home ]
  8525.    [ [513]Kermit Home ]
  8526.   __________________________________________________________________________
  8527.  
  8528. 15. COPING WITH BROKEN KERMIT PARTNERS
  8529.  
  8530.    There are lots of faulty Kermit protocol implementations out there,
  8531.    found mainly in 3rd-party products ranging from communications
  8532.    software packages to file-transfer functions imbedded within devices.
  8533.    This topic is covered [514]HERE for C-Kermit 7.0, but C-Kermit 8.0
  8534.    adds some additional tricks.
  8535.    
  8536.    SET ATTRIBUTE RECORD-FORMAT { ON, OFF }
  8537.           Allows control of the Kermit's Record-Format attribute. Set
  8538.           this to OFF in case incoming file are refused due to unknown or
  8539.           invalid record formats if you want to accept the file anyway.
  8540.           
  8541.    SET SEND I-PACKETS { ON, OFF }
  8542.           A Kermit server is supposed to accept I-packets; this is how
  8543.           the client lets the server know its capabilities and
  8544.           preferences before sending a command. Apparently there is at
  8545.           least one Kermit server implementation that does not accept
  8546.           I-packets, and does not properly respond with an Error packet
  8547.           if it gets one. To get around such situations in C-Kermit 8.0,
  8548.           you can use SET SEND I-PACKETS OFF to inhibit the sending of I
  8549.           packets. In this case, the client must be able to adjust to the
  8550.           server's configuration, rather than the other way around as we
  8551.           are used to.
  8552.           
  8553.    SET PROTOCOL KERMIT {} {} {}
  8554.           C-Kermit 6.0 and later automatically send "autoupload" and
  8555.           "autodownload" commands when in local mode and you give a file
  8556.           transfer command. For example, if you tell kermit to "send
  8557.           oofa.txt", Kermit sends "kermit -r" and a carriage return, in
  8558.           case you had forgotten to start Kermit on the far end and told
  8559.           it to receive a file. If a Kermit program had already been
  8560.           started on the far end, it should harmlessly absorb this
  8561.           string. However, some Kermit programs violate the Kermit
  8562.           protocol definition and treat such strings as Kermit packets
  8563.           even though they are not. In such cases, give this command to
  8564.           set the Kermit protocol autoupload and download strings to
  8565.           nothing, which tells Kermit not to send them. (This is not a
  8566.           new feature, but it was not previously included in the "Coping"
  8567.           section of the documentation.)
  8568.           
  8569.    [ [515]Top ] [ [516]Contents ] [ [517]C-Kermit Home ] [ [518]Kermit
  8570.    Home ]
  8571.   __________________________________________________________________________
  8572.  
  8573. 16. NEW COMMAND-LINE OPTIONS
  8574.  
  8575.    kermit -h Now prints a complete listing of its command-line options,
  8576.    rather than an abbreviated list squeezed into a 24x80 space.
  8577.    
  8578.    -dd              Debug, like -d but adds timestamps
  8579.    --version  Shows C-Kermit version number.
  8580.    --noperms  Equivalent to SET ATTRIBUTE PROTECTION OFF.
  8581.    
  8582.    Kermit now accepts a selection of URLs (Universal Resource Locators)
  8583.    as its first command-line argument. These are:
  8584.    
  8585.    telnet:hostname
  8586.           Makes a Telnet connection to the given host (IP hostname or
  8587.           address).
  8588.           
  8589.    ftp://[user[:password]@]hostname[/path...]
  8590.           Makes an FTP connection to the given host (IP hostname or
  8591.           address). If a username is given, Kermit tries to log you in;
  8592.           if a password is given, it is used; if not, you are prompted
  8593.           for one. If no username is given, an anonymous login is
  8594.           performed. If a pathname is included, Kermit tries to GET the
  8595.           given file. See [519]Section 3.1.3 for details.
  8596.           
  8597.    ftps://[user[:password]@]hostname[/path...]
  8598.           Makes a secure FTP connection over SSL.
  8599.           
  8600.    telnets://[user[:password]@]hostname
  8601.           Makes a secure Telnet connection over SSL.
  8602.           
  8603.    kermit://[user[:password]@]hostname[/path...]
  8604.           Makes a connection to an [520]Internet Kermit Server.
  8605.           
  8606.    http://[user[:password]@]hostname[/path...]
  8607.           Makes a connection to Web server.
  8608.           
  8609.    https://[user[:password]@]hostname[/path...]
  8610.           Makes a connection to secure Web server.
  8611.           
  8612.    [ [521]Top ] [ [522]Contents ] [ [523]C-Kermit Home ] [ [524]Kermit
  8613.    Home ]
  8614.   __________________________________________________________________________
  8615.  
  8616. 17. LOGS
  8617.  
  8618.    In C-Kermit 8.0, we make an effort to keep passwords out of the debug
  8619.    log. This can never be 100% effective, but it's far better than
  8620.    before, when there were no precautions at all. Whenever Kermit knows
  8621.    it's prompting for, parsing, or transmitting a password, it
  8622.    temporarily turns off logging and then turns it back on afterwards.
  8623.    This keeps the debug log password-free in most common cases, but there
  8624.    can be no guarantees.
  8625.    
  8626.    As noted elsewhere, the new "-dd" command-line option selects a
  8627.    timestamped debug log (equivalent to "set debug timestamps on", "log
  8628.    debug debug.log").
  8629.    
  8630.    C-Kermit 8.0 also supports a new timestamped session log via "set
  8631.    session-log timestamped-text", "log session".
  8632.    
  8633.    There have been requests for other kinds of logs, for example a
  8634.    command log. These might be added at some point. One person wanted to
  8635.    be able to log commands with timestamps, but only commands issued at
  8636.    the prompt, not commands from files or macros, and also wanted a
  8637.    header line at the beginning showing the date, user, and host. This
  8638.    can be done as follows:
  8639.    
  8640.   .filename := \v(home)commands.log  ; (for example)
  8641.   fopen /write \%c \m(filename)
  8642.   if success {
  8643.       fwrite /line \%c \v(date): User=\v(user) Host=\v(host)
  8644.       fclose \%c
  8645.       set debug timestamps on
  8646.       log debug {| grep "CMD(P)" >> \m(filename)} append
  8647.   }
  8648.  
  8649.    [ [525]Top ] [ [526]Contents ] [ [527]C-Kermit Home ] [ [528]Kermit
  8650.    Home ]
  8651.      _________________________________________________________________
  8652.    
  8653.    C-Kermit 8.0 Update Notes / [529]The Kermit Project / Columbia
  8654.    University / 16 Nov 2001
  8655.  
  8656. References
  8657.  
  8658.    1. http://www.columbia.edu/kermit/ckermit80.html#contents
  8659.    2. http://www.columbia.edu/kermit/ckermit.html
  8660.    3. http://www.columbia.edu/kermit/index.html
  8661.    4. http://www.columbia.edu/kermit/ckermit80.html
  8662.    5. mailto:kermit-support@columbia.edu
  8663.    6. http://www.columbia.edu/kermit/
  8664.    7. http://www.kermit-project.org/
  8665.    8. http://www.columbia.nyc.ny.us/kermit/
  8666.    9. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
  8667.   10. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
  8668.   11. http://www.columbia.edu/kermit/ckermit80.html#xv
  8669.   12. http://www.columbia.edu/kermit/ck60manual.html
  8670.   13. http://www.columbia.edu/kermit/ckermit70.html
  8671.   14. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt
  8672.   15. http://www.columbia.edu/kermit/ckututor.html
  8673.   16. ftp://kermit.columbia.edu/kermit/f/ckuker.nr
  8674.   17. http://www.columbia.edu/kermit/security80.html
  8675.   18. http://www.columbia.edu/kermit/telnet80.html
  8676.   19. http://www.columbia.edu/kermit/ftpscripts.html
  8677.   20. http://www.columbia.edu/kermit/ckcbwr.html
  8678.   21. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
  8679.   22. http://www.columbia.edu/kermit/ckubwr.html
  8680.   23. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  8681.   24. http://www.columbia.edu/kermit/ckvbwr.html
  8682.   25. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
  8683.   26. http://www.columbia.edu/kermit/ckuins.html
  8684.   27. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
  8685.   28. http://www.columbia.edu/kermit/ckvins.html
  8686.   29. ftp://kermit.columbia.edu/kermit/f/ckvins.txt
  8687.   30. http://www.columbia.edu/kermit/ckccfg.html
  8688.   31. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  8689.   32. http://www.columbia.edu/kermit/ckcplm.html
  8690.   33. ftp://kermit.columbia.edu/kermit/f/ckcplm.txt
  8691.   34. http://www.columbia.edu/kermit/iksd.html
  8692.   35. http://www.columbia.edu/kermit/ckermit80.html#top
  8693.   36. http://www.columbia.edu/kermit/ckermit.html
  8694.   37. http://www.columbia.edu/kermit/index.html
  8695.   38. http://www.columbia.edu/kermit/ckermit80.html#x0
  8696.   39. http://www.columbia.edu/kermit/ckermit80.html#x1
  8697.   40. http://www.columbia.edu/kermit/ckermit80.html#x2
  8698.   41. http://www.columbia.edu/kermit/ckermit80.html#x2.1
  8699.   42. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  8700.   43. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
  8701.   44. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
  8702.   45. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
  8703.   46. http://www.columbia.edu/kermit/ckermit80.html#x2.2.4
  8704.   47. http://www.columbia.edu/kermit/ckermit80.html#x2.2.5
  8705.   48. http://www.columbia.edu/kermit/ckermit80.html#x2.2.6
  8706.   49. http://www.columbia.edu/kermit/ckermit80.html#x3
  8707.   50. http://www.columbia.edu/kermit/ckermit80.html#x3.1
  8708.   51. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
  8709.   52. http://www.columbia.edu/kermit/ckermit80.html#x3.1.2
  8710.   53. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  8711.   54. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  8712.   55. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  8713.   56. http://www.columbia.edu/kermit/ckermit80.html#x3.3
  8714.   57. http://www.columbia.edu/kermit/ckermit80.html#x3.4
  8715.   58. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  8716.   59. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
  8717.   60. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  8718.   61. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
  8719.   62. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  8720.   63. http://www.columbia.edu/kermit/ckermit80.html#x3.6.1
  8721.   64. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  8722.   65. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
  8723.   66. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  8724.   67. http://www.columbia.edu/kermit/ckermit80.html#x3.7.1
  8725.   68. http://www.columbia.edu/kermit/ckermit80.html#x3.7.2
  8726.   69. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  8727.   70. http://www.columbia.edu/kermit/ckermit80.html#x3.9
  8728.   71. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  8729.   72. http://www.columbia.edu/kermit/ckermit80.html#x3.10.1
  8730.   73. http://www.columbia.edu/kermit/ckermit80.html#x3.10.2
  8731.   74. http://www.columbia.edu/kermit/ckermit80.html#x3.11
  8732.   75. http://www.columbia.edu/kermit/ckermit80.html#x4
  8733.   76. http://www.columbia.edu/kermit/ckermit80.html#x5
  8734.   77. http://www.columbia.edu/kermit/ckermit80.html#x6
  8735.   78. http://www.columbia.edu/kermit/ckermit80.html#x6.1
  8736.   79. http://www.columbia.edu/kermit/ckermit80.html#x6.2
  8737.   80. http://www.columbia.edu/kermit/ckermit80.html#x6.3
  8738.   81. http://www.columbia.edu/kermit/ckermit80.html#x6.4
  8739.   82. http://www.columbia.edu/kermit/ckermit80.html#x7
  8740.   83. http://www.columbia.edu/kermit/ckermit80.html#x8
  8741.   84. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  8742.   85. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  8743.   86. http://www.columbia.edu/kermit/ckermit80.html#x8.3
  8744.   87. http://www.columbia.edu/kermit/ckermit80.html#x8.4
  8745.   88. http://www.columbia.edu/kermit/ckermit80.html#x8.5
  8746.   89. http://www.columbia.edu/kermit/ckermit80.html#x8.6
  8747.   90. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  8748.   91. http://www.columbia.edu/kermit/ckermit80.html#x8.8
  8749.   92. http://www.columbia.edu/kermit/ckermit80.html#x8.9
  8750.   93. http://www.columbia.edu/kermit/ckermit80.html#x8.10
  8751.   94. http://www.columbia.edu/kermit/ckermit80.html#x8.11
  8752.   95. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  8753.   96. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  8754.   97. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  8755.   98. http://www.columbia.edu/kermit/ckermit80.html#x9
  8756.   99. http://www.columbia.edu/kermit/ckermit80.html#x9.1
  8757.  100. http://www.columbia.edu/kermit/ckermit80.html#x9.2
  8758.  101. http://www.columbia.edu/kermit/ckermit80.html#x9.3
  8759.  102. http://www.columbia.edu/kermit/ckermit80.html#x9.4
  8760.  103. http://www.columbia.edu/kermit/ckermit80.html#x9.5
  8761.  104. http://www.columbia.edu/kermit/ckermit80.html#x9.6
  8762.  105. http://www.columbia.edu/kermit/ckermit80.html#x9.7
  8763.  106. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  8764.  107. http://www.columbia.edu/kermit/ckermit80.html#x9.9
  8765.  108. http://www.columbia.edu/kermit/ckermit80.html#x9.10
  8766.  109. http://www.columbia.edu/kermit/ckermit80.html#x9.11
  8767.  110. http://www.columbia.edu/kermit/ckermit80.html#x10
  8768.  111. http://www.columbia.edu/kermit/ckermit80.html#x11
  8769.  112. http://www.columbia.edu/kermit/ckermit80.html#x12
  8770.  113. http://www.columbia.edu/kermit/ckermit80.html#x13
  8771.  114. http://www.columbia.edu/kermit/ckermit80.html#x14
  8772.  115. http://www.columbia.edu/kermit/ckermit80.html#x15
  8773.  116. http://www.columbia.edu/kermit/ckermit80.html#x16
  8774.  117. http://www.columbia.edu/kermit/ckermit80.html#x17
  8775.  118. http://www.columbia.edu/kermit/ckermit80.html#top
  8776.  119. http://www.columbia.edu/kermit/ckermit.html
  8777.  120. http://www.columbia.edu/kermit/index.html
  8778.  121. http://www.columbia.edu/kermit/ckuins.html#x5
  8779.  122. http://www.columbia.edu/kermit/ckuins.html
  8780.  123. http://www.columbia.edu/kermit/ckermit80.html#x5
  8781.  124. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  8782.  125. http://www.columbia.edu/kermit/ckermit80.html#contents
  8783.  126. http://www.columbia.edu/kermit/ckermit80.html#x15
  8784.  127. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  8785.  128. http://www.columbia.edu/kermit/ckermit80.html#ftpdates
  8786.  129. http://www.columbia.edu/kermit/ckermit80.html#ftpcheck
  8787.  130. http://www.columbia.edu/kermit/ckermit80.html#ftpnamelist
  8788.  131. http://www.columbia.edu/kermit/ckermit80.html#srvrename
  8789.  132. http://www.columbia.edu/kermit/ckermit80.html#ftpvdir
  8790.  133. http://www.columbia.edu/kermit/ckermit80.html#setftptype
  8791.  134. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  8792.  135. http://www.columbia.edu/kermit/ckermit80.html#x15
  8793.  136. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  8794.  137. http://www.columbia.edu/kermit/x2.1
  8795.  138. http://www.columbia.edu/kermit/ckermit80.html#x2.2
  8796.  139. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  8797.  140. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  8798.  141. http://www.columbia.edu/kermit/ckermit80.html#x8.13
  8799.  142. http://www.columbia.edu/kermit/ckututor.html
  8800.  143. http://www.columbia.edu/kermit/ckuins.html
  8801.  144. http://www.columbia.edu/kermit/ckermit80.html#top
  8802.  145. http://www.columbia.edu/kermit/ckermit80.html#contents
  8803.  146. http://www.columbia.edu/kermit/ckermit.html
  8804.  147. http://www.columbia.edu/kermit/index.html
  8805.  148. http://www.columbia.edu/kermit/ckermit80.html#top
  8806.  149. http://www.columbia.edu/kermit/ckermit80.html#contents
  8807.  150. http://www.columbia.edu/kermit/ckermit.html
  8808.  151. http://www.columbia.edu/kermit/index.html
  8809.  152. http://www.columbia.edu/kermit/ckermit80.html#x3
  8810.  153. ftp://ftp.isi.edu/in-notes/rfc1738.txt
  8811.  154. http://www.columbia.edu/kermit/ckermit80.html#x2.2.2
  8812.  155. http://www.columbia.edu/kermit/ckermit80.html#x2.2.1
  8813.  156. ftp://ftp.isi.edu/in-notes/rfc2396.txt
  8814.  157. ftp://ftp.isi.edu/in-notes/rfc2616.txt
  8815.  158. http://www.columbia.edu/kermit/ckermit80.html#x2.2.3
  8816.  159. ftp://ftp.isi.edu/in-notes/rfc2616.txt
  8817.  160. http://www.columbia.edu/kermit/ckermit80.html#x8.13.7
  8818.  161. http://www.columbia.edu/kermit/security80.html#x5.4
  8819.  162. http://www.columbia.edu/kermit/security80.html#x15
  8820.  163. http://www.columbia.edu/kermit/security80.html#x6.2
  8821.  164. http://www.columbia.edu/kermit/security80.html
  8822.  165. http://www.columbia.edu/kermit/ckermit80.html#x16
  8823.  166. http://www.columbia.edu/kermit/ckermit80.html#top
  8824.  167. http://www.columbia.edu/kermit/ckermit80.html#contents
  8825.  168. http://www.columbia.edu/kermit/ckermit.html
  8826.  169. http://www.columbia.edu/kermit/index.html
  8827.  170. http://www.columbia.edu/kermit/security80.html
  8828.  171. http://www.columbia.edu/kermit/ftpd.html
  8829.  172. http://www.columbia.edu/kermit/ckcsets.html
  8830.  173. http://www.columbia.edu/kermit/unicode.html
  8831.  174. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  8832.  175. http://www.columbia.edu/kermit/case10.html
  8833.  176. http://www.columbia.edu/kermit/ckermit80.html#x4
  8834.  177. http://www.columbia.edu/kermit/ftpscripts.html
  8835.  178. http://www.columbia.edu/kermit/ckermit80.html#top
  8836.  179. http://www.columbia.edu/kermit/ckermit80.html#contents
  8837.  180. http://www.columbia.edu/kermit/ftpclient.html
  8838.  181. http://www.columbia.edu/kermit/ftpscripts.html
  8839.  182. http://www.columbia.edu/kermit/ckermit.html
  8840.  183. http://www.columbia.edu/kermit/index.html
  8841.  184. http://www.columbia.edu/kermit/ckermit80.html#x3.1.1
  8842.  185. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  8843.  186. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  8844.  187. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  8845.  188. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  8846.  189. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  8847.  190. http://www.columbia.edu/kermit/ckermit80.html#x3.5
  8848.  191. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  8849.  192. http://www.columbia.edu/kermit/ftpscript.html
  8850.  193. http://www.columbia.edu/kermit/ck60manual.html
  8851.  194. http://www.columbia.edu/kermit/ckermit80.html#ftpautolog
  8852.  195. http://www.columbia.edu/kermit/ckermit80.html#ftpuser
  8853.  196. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  8854.  197. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  8855.  198. http://www.columbia.edu/kermit/ckermit80.html#top
  8856.  199. http://www.columbia.edu/kermit/ckermit80.html#contents
  8857.  200. http://www.columbia.edu/kermit/ckermit.html
  8858.  201. http://www.columbia.edu/kermit/index.html
  8859.  202. http://www.columbia.edu/kermit/ckermit80.html#top
  8860.  203. http://www.columbia.edu/kermit/ckermit80.html#contents
  8861.  204. http://www.columbia.edu/kermit/ckermit.html
  8862.  205. http://www.columbia.edu/kermit/index.html
  8863.  206. http://www.columbia.edu/kermit/ck60manual.html
  8864.  207. http://www.columbia.edu/kermit/ckermit70.html#x4.17
  8865.  208. http://www.columbia.edu/kermit/ckermit70.html
  8866.  209. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  8867.  210. http://www.columbia.edu/kermit/ckermit80.html#x3.1.4
  8868.  211. http://www.columbia.edu/kermit/security80.html
  8869.  212. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  8870.  213. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  8871.  214. http://www.columbia.edu/kermit/ckermit80.html#permswitch
  8872.  215. http://www.columbia.edu/kermit/ckermit80.html#ftpchmod
  8873.  216. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  8874.  217. http://www.columbia.edu/kermit/ckermit80.html#x4
  8875.  218. http://www.columbia.edu/kermit/ckermit80.html#top
  8876.  219. http://www.columbia.edu/kermit/ckermit80.html#contents
  8877.  220. http://www.columbia.edu/kermit/ckermit.html
  8878.  221. http://www.columbia.edu/kermit/index.html
  8879.  222. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  8880.  223. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  8881.  224. http://www.columbia.edu/kermit/ck60manual.html
  8882.  225. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  8883.  226. http://www.columbia.edu/kermit/ckermit80.html#x3.10
  8884.  227. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  8885.  228. http://www.columbia.edu/kermit/ckermit80.html#setftptype
  8886.  229. http://www.columbia.edu/kermit/ckermit80.html#top
  8887.  230. http://www.columbia.edu/kermit/ckermit80.html#contents
  8888.  231. http://www.columbia.edu/kermit/ckermit.html
  8889.  232. http://www.columbia.edu/kermit/index.html
  8890.  233. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  8891.  234. http://www.columbia.edu/kermit/ckermit80.html#x3.5.1
  8892.  235. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  8893.  236. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  8894.  237. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  8895.  238. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  8896.  239. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  8897.  240. http://www.columbia.edu/kermit/ckermit70.html
  8898.  241. http://www.columbia.edu/kermit/ckermit80.html#x4
  8899.  242. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  8900.  243. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  8901.  244. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  8902.  245. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  8903.  246. http://www.columbia.edu/kermit/ckermit80.html#x3.5.2
  8904.  247. http://www.columbia.edu/kermit/ckermit80.html#erroraction
  8905.  248. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  8906.  249. http://www.columbia.edu/kermit/ckermit80.html#ftpperms
  8907.  250. http://www.columbia.edu/kermit/ckermit80.html#ftpunique
  8908.  251. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  8909.  252. http://www.columbia.edu/kermit/ckermit80.html#note_utc
  8910.  253. http://www.columbia.edu/kermit/ckermit80.html#note_date
  8911.  254. http://www.columbia.edu/kermit/ckermit80.html#x3.6
  8912.  255. http://www.boulder.nist.gov/timefreq/faq/faq.htm#10:
  8913.  256. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  8914.  257. http://www.columbia.edu/kermit/ckermit80.html#top
  8915.  258. http://www.columbia.edu/kermit/ckermit80.html#contents
  8916.  259. http://www.columbia.edu/kermit/ckermit.html
  8917.  260. http://www.columbia.edu/kermit/index.html
  8918.  261. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  8919.  262. http://www.columbia.edu/kermit/ckermit70.html
  8920.  263. http://www.columbia.edu/kermit/ckermit80.html#x5
  8921.  264. http://www.columbia.edu/kermit/ckermit80.html#x3.6.3
  8922.  265. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  8923.  266. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  8924.  267. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  8925.  268. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  8926.  269. http://www.columbia.edu/kermit/ckermit80.html#x3.6.2
  8927.  270. http://www.columbia.edu/kermit/ckermit80.html#srvrename
  8928.  271. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  8929.  272. http://www.columbia.edu/kermit/ckermit70.html
  8930.  273. http://www.columbia.edu/kermit/ck60manual.html
  8931.  274. http://www.columbia.edu/kermit/ckermit80.html#ftpfilenames
  8932.  275. http://www.columbia.edu/kermit/ckermit80.html#x3.5.3
  8933.  276. http://www.proftpd.net/
  8934.  277. http://www.columbia.edu/kermit/ckermit80.html#top
  8935.  278. http://www.columbia.edu/kermit/ckermit80.html#contents
  8936.  279. http://www.columbia.edu/kermit/ckermit.html
  8937.  280. http://www.columbia.edu/kermit/index.html
  8938.  281. http://www.columbia.edu/kermit/ck60manual.html
  8939.  282. http://www.columbia.edu/kermit/ckcsets.html
  8940.  283. http://www.columbia.edu/kermit/unicode.html
  8941.  284. http://www.columbia.edu/kermit/ckcsets.html
  8942.  285. http://www.columbia.edu/kermit/ckcsets.html
  8943.  286. http://www.columbia.edu/kermit/ckermit80.html#x4
  8944.  287. http://www.columbia.edu/kermit/utf8.html
  8945.  288. http://www.columbia.edu/kermit/ckcsets.html
  8946.  289. http://www.columbia.edu/kermit/ckermit80.html#x4
  8947.  290. ftp://ftp.isi.edu/in-notes/rfc2640.txt
  8948.  291. http://www.columbia.edu/kermit/ckermit80.html#top
  8949.  292. http://www.columbia.edu/kermit/ckermit80.html#contents
  8950.  293. http://www.columbia.edu/kermit/ckermit.html
  8951.  294. http://www.columbia.edu/kermit/index.html
  8952.  295. http://www.columbia.edu/kermit/ckermit80.html#top
  8953.  296. http://www.columbia.edu/kermit/ckermit80.html#contents
  8954.  297. http://www.columbia.edu/kermit/ckermit.html
  8955.  298. http://www.columbia.edu/kermit/index.html
  8956.  299. http://www.columbia.edu/kermit/ckermit80.html#top
  8957.  300. http://www.columbia.edu/kermit/ckermit80.html#contents
  8958.  301. http://www.columbia.edu/kermit/ckermit.html
  8959.  302. http://www.columbia.edu/kermit/index.html
  8960.  303. http://www.columbia.edu/kermit/ftpscripts.html
  8961.  304. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  8962.  305. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  8963.  306. ftp://ftp.isi.edu/in-notes/rfc959.txt
  8964.  307. http://www.columbia.edu/kermit/ckscripts.html
  8965.  308. http://www.columbia.edu/kermit/ftpscript.html
  8966.  309. http://www.columbia.edu/kermit/ckermit80.html#top
  8967.  310. http://www.columbia.edu/kermit/ckermit80.html#contents
  8968.  311. http://www.columbia.edu/kermit/ckermit.html
  8969.  312. http://www.columbia.edu/kermit/index.html
  8970.  313. http://www.columbia.edu/kermit/ckermit80.html#top
  8971.  314. http://www.columbia.edu/kermit/ckermit80.html#contents
  8972.  315. http://www.columbia.edu/kermit/ckermit.html
  8973.  316. http://www.columbia.edu/kermit/index.html
  8974.  317. http://www.columbia.edu/kermit/ckermit80.html#x3
  8975.  318. http://www.columbia.edu/kermit/ckermit80.html#ucs2
  8976.  319. http://www.columbia.edu/kermit/ckermit80.html#top
  8977.  320. http://www.columbia.edu/kermit/ckermit80.html#contents
  8978.  321. http://www.columbia.edu/kermit/ckermit.html
  8979.  322. http://www.columbia.edu/kermit/index.html
  8980.  323. http://www.columbia.edu/kermit/ckermit80.html#top
  8981.  324. http://www.columbia.edu/kermit/ckermit80.html#contents
  8982.  325. http://www.columbia.edu/kermit/ckermit.html
  8983.  326. http://www.columbia.edu/kermit/index.html
  8984.  327. http://www.columbia.edu/kermit/ck60manual.html
  8985.  328. http://www.columbia.edu/kermit/ckermit80.html#top
  8986.  329. http://www.columbia.edu/kermit/ckermit80.html#contents
  8987.  330. http://www.columbia.edu/kermit/ckermit.html
  8988.  331. http://www.columbia.edu/kermit/index.html
  8989.  332. http://www.columbia.edu/kermit/ckermit80.html#x4
  8990.  333. http://www.columbia.edu/kermit/ckermit80.html#x4
  8991.  334. http://www.columbia.edu/kermit/ckermit80.html#x8.12
  8992.  335. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  8993.  336. http://www.columbia.edu/kermit/ckermit80.html#x12
  8994.  337. http://www.columbia.edu/kermit/ckermit80.html#top
  8995.  338. http://www.columbia.edu/kermit/ckermit80.html#contents
  8996.  339. http://www.columbia.edu/kermit/ckermit.html
  8997.  340. http://www.columbia.edu/kermit/index.html
  8998.  341. http://www.columbia.edu/kermit/ckermit80.html#x8.14
  8999.  342. http://www.columbia.edu/kermit/ckermit80.html#top
  9000.  343. http://www.columbia.edu/kermit/ckermit80.html#contents
  9001.  344. http://www.columbia.edu/kermit/ckermit.html
  9002.  345. http://www.columbia.edu/kermit/index.html
  9003.  346. http://www.columbia.edu/kermit/ckermit80.html#x9
  9004.  347. http://www.columbia.edu/kermit/ckermit80.html#top
  9005.  348. http://www.columbia.edu/kermit/ckermit80.html#contents
  9006.  349. http://www.columbia.edu/kermit/ckermit.html
  9007.  350. http://www.columbia.edu/kermit/index.html
  9008.  351. http://www.columbia.edu/kermit/ckermit80.html#x8.6
  9009.  352. http://www.columbia.edu/kermit/ckermit80.html#top
  9010.  353. http://www.columbia.edu/kermit/ckermit80.html#contents
  9011.  354. http://www.columbia.edu/kermit/ckermit.html
  9012.  355. http://www.columbia.edu/kermit/index.html
  9013.  356. http://www.columbia.edu/kermit/ckermit80.html#top
  9014.  357. http://www.columbia.edu/kermit/ckermit80.html#contents
  9015.  358. http://www.columbia.edu/kermit/ckermit.html
  9016.  359. http://www.columbia.edu/kermit/index.html
  9017.  360. http://www.columbia.edu/kermit/ckermit80.html#top
  9018.  361. http://www.columbia.edu/kermit/ckermit80.html#contents
  9019.  362. http://www.columbia.edu/kermit/ckermit.html
  9020.  363. http://www.columbia.edu/kermit/index.html
  9021.  364. http://www.columbia.edu/kermit/ckermit80.html#fjoin
  9022.  365. http://www.columbia.edu/kermit/ckermit80.html#fsplit
  9023.  366. http://www.columbia.edu/kermit/ckermit80.html#x8.10
  9024.  367. http://www.columbia.edu/kermit/ckermit80.html#top
  9025.  368. http://www.columbia.edu/kermit/ckermit80.html#contents
  9026.  369. http://www.columbia.edu/kermit/ckermit.html
  9027.  370. http://www.columbia.edu/kermit/index.html
  9028.  371. http://www.columbia.edu/kermit/ckermit80.html#x9
  9029.  372. http://www.columbia.edu/kermit/ckermit80.html#x9
  9030.  373. http://www.columbia.edu/kermit/ckermit80.html#x9
  9031.  374. http://www.columbia.edu/kermit/ckermit80.html#x3
  9032.  375. http://www.columbia.edu/kermit/ckermit80.html#x3
  9033.  376. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9034.  377. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9035.  378. http://www.columbia.edu/kermit/ckermit80.html#x3.8
  9036.  379. http://www.columbia.edu/kermit/ckermit80.html#x3
  9037.  380. http://www.columbia.edu/kermit/ckermit80.html#x3
  9038.  381. http://www.columbia.edu/kermit/ckermit80.html#x3
  9039.  382. http://www.columbia.edu/kermit/ckermit80.html#x3.2
  9040.  383. http://www.columbia.edu/kermit/ckermit80.html#x3
  9041.  384. http://www.columbia.edu/kermit/x8.13
  9042.  385. http://www.columbia.edu/kermit/x8.13
  9043.  386. http://www.columbia.edu/kermit/ckermit80.html#x9
  9044.  387. http://www.columbia.edu/kermit/ckermit80.html#x8.7.4
  9045.  388. http://www.columbia.edu/kermit/ckermit80.html#top
  9046.  389. http://www.columbia.edu/kermit/ckermit80.html#contents
  9047.  390. http://www.columbia.edu/kermit/ckermit.html
  9048.  391. http://www.columbia.edu/kermit/index.html
  9049.  392. http://www.columbia.edu/kermit/ckermit80.html#top
  9050.  393. http://www.columbia.edu/kermit/ckermit80.html#contents
  9051.  394. http://www.columbia.edu/kermit/ckermit.html
  9052.  395. http://www.columbia.edu/kermit/index.html
  9053.  396. http://www.columbia.edu/kermit/ckermit80.html#top
  9054.  397. http://www.columbia.edu/kermit/ckermit80.html#contents
  9055.  398. http://www.columbia.edu/kermit/ckermit.html
  9056.  399. http://www.columbia.edu/kermit/index.html
  9057.  400. http://www.columbia.edu/kermit/ckermit80.html#x8.7
  9058.  401. http://www.columbia.edu/kermit/ckermit80.html#top
  9059.  402. http://www.columbia.edu/kermit/ckermit80.html#contents
  9060.  403. http://www.columbia.edu/kermit/ckermit.html
  9061.  404. http://www.columbia.edu/kermit/index.html
  9062.  405. http://www.columbia.edu/kermit/ckermit80.html#scriptedit
  9063.  406. http://www.columbia.edu/kermit/ckermit80.html#top
  9064.  407. http://www.columbia.edu/kermit/ckermit80.html#contents
  9065.  408. http://www.columbia.edu/kermit/ckermit.html
  9066.  409. http://www.columbia.edu/kermit/index.html
  9067.  410. http://www.columbia.edu/kermit/ckermit80.html#top
  9068.  411. http://www.columbia.edu/kermit/ckermit80.html#contents
  9069.  412. http://www.columbia.edu/kermit/ckermit.html
  9070.  413. http://www.columbia.edu/kermit/index.html
  9071.  414. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  9072.  415. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  9073.  416. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  9074.  417. ftp://ftp.isi.edu/in-notes/rfc2822.txt
  9075.  418. http://www.columbia.edu/kermit/ckermit80.html#top
  9076.  419. http://www.columbia.edu/kermit/ckermit80.html#contents
  9077.  420. http://www.columbia.edu/kermit/ckermit.html
  9078.  421. http://www.columbia.edu/kermit/index.html
  9079.  422. http://www.columbia.edu/kermit/ckermit80.html#x8.1
  9080.  423. http://www.columbia.edu/kermit/ckermit80.html#top
  9081.  424. http://www.columbia.edu/kermit/ckermit80.html#contents
  9082.  425. http://www.columbia.edu/kermit/ckermit.html
  9083.  426. http://www.columbia.edu/kermit/index.html
  9084.  427. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  9085.  428. http://www.columbia.edu/kermit/ckermit80.html#top
  9086.  429. http://www.columbia.edu/kermit/ckermit80.html#contents
  9087.  430. http://www.columbia.edu/kermit/ckermit.html
  9088.  431. http://www.columbia.edu/kermit/index.html
  9089.  432. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9090.  433. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9091.  434. http://www.columbia.edu/kermit/ckermit80.html#x8.2
  9092.  435. http://www.columbia.edu/kermit/ckermit80.html#top
  9093.  436. http://www.columbia.edu/kermit/ckermit80.html#contents
  9094.  437. http://www.columbia.edu/kermit/ckermit.html
  9095.  438. http://www.columbia.edu/kermit/index.html
  9096.  439. http://www.columbia.edu/kermit/ckermit80.html#top
  9097.  440. http://www.columbia.edu/kermit/ckermit80.html#contents
  9098.  441. http://www.columbia.edu/kermit/ckermit.html
  9099.  442. http://www.columbia.edu/kermit/index.html
  9100.  443. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9101.  444. http://www.columbia.edu/kermit/ckermit80.html#top
  9102.  445. http://www.columbia.edu/kermit/ckermit80.html#contents
  9103.  446. http://www.columbia.edu/kermit/ckermit.html
  9104.  447. http://www.columbia.edu/kermit/index.html
  9105.  448. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9106.  449. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9107.  450. http://www.columbia.edu/kermit/ckermit80.html#x9.6
  9108.  451. http://www.columbia.edu/kermit/ckermit80.html#top
  9109.  452. http://www.columbia.edu/kermit/ckermit80.html#contents
  9110.  453. http://www.columbia.edu/kermit/ckermit.html
  9111.  454. http://www.columbia.edu/kermit/index.html
  9112.  455. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9113.  456. http://www.columbia.edu/kermit/ckermit80.html#x9.8
  9114.  457. http://www.columbia.edu/kermit/ckermit80.html#top
  9115.  458. http://www.columbia.edu/kermit/ckermit80.html#contents
  9116.  459. http://www.columbia.edu/kermit/ckermit.html
  9117.  460. http://www.columbia.edu/kermit/index.html
  9118.  461. http://www.columbia.edu/kermit/ckermit80.html#top
  9119.  462. http://www.columbia.edu/kermit/ckermit80.html#contents
  9120.  463. http://www.columbia.edu/kermit/ckermit.html
  9121.  464. http://www.columbia.edu/kermit/index.html
  9122.  465. http://www.columbia.edu/kermit/ckermit80.html#top
  9123.  466. http://www.columbia.edu/kermit/ckermit80.html#contents
  9124.  467. http://www.columbia.edu/kermit/ckermit.html
  9125.  468. http://www.columbia.edu/kermit/index.html
  9126.  469. http://www.columbia.edu/kermit/ckermit80.html#x9.9.2
  9127.  470. http://www.columbia.edu/kermit/ckermit80.html#top
  9128.  471. http://www.columbia.edu/kermit/ckermit80.html#contents
  9129.  472. http://www.columbia.edu/kermit/ckermit.html
  9130.  473. http://www.columbia.edu/kermit/index.html
  9131.  474. http://www.columbia.edu/kermit/ckermit80.html#top
  9132.  475. http://www.columbia.edu/kermit/ckermit80.html#contents
  9133.  476. http://www.columbia.edu/kermit/ckermit.html
  9134.  477. http://www.columbia.edu/kermit/index.html
  9135.  478. http://www.columbia.edu/kermit/ckermit80.html#top
  9136.  479. http://www.columbia.edu/kermit/ckermit80.html#contents
  9137.  480. http://www.columbia.edu/kermit/ckermit.html
  9138.  481. http://www.columbia.edu/kermit/index.html
  9139.  482. http://www.columbia.edu/kermit/ckermit80.html#x9.2
  9140.  483. http://www.columbia.edu/kermit/ckermit80.html#top
  9141.  484. http://www.columbia.edu/kermit/ckermit80.html#contents
  9142.  485. http://www.columbia.edu/kermit/ckermit.html
  9143.  486. http://www.columbia.edu/kermit/index.html
  9144.  487. http://www.columbia.edu/kermit/ckermit80.html#x4
  9145.  488. http://www.columbia.edu/kermit/ckermit80.html#x4
  9146.  489. http://www.columbia.edu/kermit/ckermit80.html#top
  9147.  490. http://www.columbia.edu/kermit/ckermit80.html#contents
  9148.  491. http://www.columbia.edu/kermit/ckermit.html
  9149.  492. http://www.columbia.edu/kermit/index.html
  9150.  493. http://www.columbia.edu/kermit/ckermit80.html#top
  9151.  494. http://www.columbia.edu/kermit/ckermit80.html#contents
  9152.  495. http://www.columbia.edu/kermit/ckermit.html
  9153.  496. http://www.columbia.edu/kermit/index.html
  9154.  497. http://www.columbia.edu/kermit/ckermit80.html#top
  9155.  498. http://www.columbia.edu/kermit/ckermit80.html#contents
  9156.  499. http://www.columbia.edu/kermit/ckermit.html
  9157.  500. http://www.columbia.edu/kermit/index.html
  9158.  501. http://www.columbia.edu/kermit/ckermit80.html#x4
  9159.  502. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9160.  503. http://www.columbia.edu/kermit/ckermit80.html#x3.7
  9161.  504. http://www.columbia.edu/kermit/ckermit80.html#top
  9162.  505. http://www.columbia.edu/kermit/ckermit80.html#contents
  9163.  506. http://www.columbia.edu/kermit/ckermit.html
  9164.  507. http://www.columbia.edu/kermit/index.html
  9165.  508. ftp://ftp.isi.edu/in-notes/rfc2217.txt
  9166.  509. http://www.columbia.edu/kermit/ckermit80.html#top
  9167.  510. http://www.columbia.edu/kermit/ckermit80.html#contents
  9168.  511. ftp://kermit.columbia.edu/kermit/sredird/
  9169.  512. http://www.columbia.edu/kermit/ckermit.html
  9170.  513. http://www.columbia.edu/kermit/index.html
  9171.  514. http://www.columbia.edu/kermit/ckermit70.html#x4.22
  9172.  515. http://www.columbia.edu/kermit/ckermit80.html#top
  9173.  516. http://www.columbia.edu/kermit/ckermit80.html#contents
  9174.  517. http://www.columbia.edu/kermit/ckermit.html
  9175.  518. http://www.columbia.edu/kermit/index.html
  9176.  519. http://www.columbia.edu/kermit/ckermit80.html#x3.1.3
  9177.  520. http://www.columbia.edu/kermit/cuiksd.html
  9178.  521. http://www.columbia.edu/kermit/ckermit80.html#top
  9179.  522. http://www.columbia.edu/kermit/ckermit80.html#contents
  9180.  523. http://www.columbia.edu/kermit/ckermit.html
  9181.  524. http://www.columbia.edu/kermit/index.html
  9182.  525. http://www.columbia.edu/kermit/ckermit80.html#top
  9183.  526. http://www.columbia.edu/kermit/ckermit80.html#contents
  9184.  527. http://www.columbia.edu/kermit/ckermit.html
  9185.  528. http://www.columbia.edu/kermit/index.html
  9186.  529. http://www.columbia.edu/kermit/index.html
  9187.