home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / cku201.zip / ckermit70.txt < prev    next >
Text File  |  2002-02-13  |  820KB  |  18,074 lines

  1.  
  2.    [ [1]Contents ] [ [2]C-Kermit ] [ [3]Kermit Home ]
  3.    
  4.                  Supplement to Using C-Kermit, Second Edition
  5.                                        
  6. For C-Kermit 7.0
  7.  
  8.   D R A F T
  9.  
  10. As of C-Kermit version:  7.0.197
  11. This file last updated:  30 July 2000
  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/ckermit70.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, 2000, Frank da Cruz and Christine M. Gianone.
  36.           All rights reserved.
  37.           
  38.    Kermit 95:
  39.           Copyright ⌐ 1995, 2000, Trustees of Columbia University in the
  40.           City of New York. All rights reserved.
  41.           
  42.    C-Kermit:
  43.           Copyright ⌐ 1985, 2000,
  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 SSL
  50.           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 the second edition of
  67.    the book [12]Using C-Kermit was published and C-Kermit 6.0 was
  68.    released in November 1996. Use this file as a supplement to the second
  69.    edition of Using C-Kermit until the third edition is published some
  70.    time in 2000. If the "most recent update" shown above is long ago,
  71.    contact Columbia University to see if there is a newer release.
  72.    
  73.    For further information, also see the [13]CKCBWR.TXT ("C-Kermit
  74.    beware") file for hints, tips, tricks, restrictions, frequently asked
  75.    questions, etc, plus the system-specific "beware file", e.g.
  76.    [14]CKUBWR.TXT for UNIX, [15]CKVBWR.TXT for VMS, etc, and also any
  77.    system-specific update files such as KERMIT95.HTM for Kermit 95 (in
  78.    the DOCS\MANUAL\ subdirectory of your K95 directory).
  79.    
  80.      This Web-based copy of the C-Kermit 7.0 update notes supersedes the
  81.      plain-text [16]CKERMIT2.TXT file. All changes after 19 January 2000
  82.      appear only here in the Web version. If you need an up-to-date
  83.      plain-text copy, use your Web browser to save this page as plain
  84.      text.
  85.      _________________________________________________________________
  86.    
  87.   ABOUT FILENAMES
  88.   
  89.    In this document, filenames are generally shown in uppercase, but on
  90.    file systems with case-sensitive names such as UNIX, OS-9, and AOS/VS,
  91.    lowercase names are used: [17]ckubwr.txt, [18]ckermit2.txt, etc.
  92.      _________________________________________________________________
  93.    
  94.   ADDITIONAL FILES
  95.   
  96.    Several other files accompany this new Kermit release:
  97.    
  98.    SECURITY.TXT
  99.           Discussion of Kermit's new authentication and encryption
  100.           features:
  101.           
  102.           + [19]Plain-text version
  103.           + [20]HTML (hypertext) version
  104.             
  105.    IKSD.TXT
  106.           How to install and manage an Internet Kermit Service Daemon.
  107.           
  108.           + [21]Plain-text version
  109.           + [22]HTML (hypertext) version
  110.             
  111.           Also see [23]cuiksd.html for instructions for use.
  112.           
  113.    TELNET.TXT
  114.           A thorough presentation of Kermit's new advanced Telnet
  115.           features and controls.
  116.           
  117.           + [24]Plain-text version
  118.           + [25]HTML (hypertext) version
  119.      _________________________________________________________________
  120.    
  121.   THE NEW C-KERMIT LICENSE
  122.   
  123.    The C-Kermit license was rewritten for version 7.0 to grant automatic
  124.    permission to packagers of free operating-system distributions to
  125.    include C-Kermit 7.0. Examples include Linux (GNU/Linux), FreeBSD,
  126.    NetBSD, etc. The new license is in the [26]COPYING.TXT file, and is
  127.    also displayed by C-Kermit itself when you give the VERSION or
  128.    COPYRIGHT command. The new C-Kermit license does not apply to
  129.    [27]Kermit 95.
  130.      _________________________________________________________________
  131.    
  132.   ACKNOWLEDGMENTS
  133.   
  134.    Thanks to Jeff Altman, who joined the Kermit Project in 1995, for much
  135.    of what you see in C-Kermit 7.0, especially in the networking and
  136.    security areas, and his key role in designing and implementing the
  137.    Internet Kermit Service Daemon. And special thanks to Lucas Hart for
  138.    lots of help with the VMS version; to Peter Eichhorn for continuous
  139.    testing on the full range of HP-UX versions and for a consolidated set
  140.    of HP-UX makefile targets; and to Colin Allen, Mark Allen, Roger
  141.    Allen, Ric Anderson, William Bader, Mitch Baker, Mitchell Bass, Nelson
  142.    Beebe, Gerry Belanger, Jeff Bernsten, Mark Berryman, John Bigg, Volker
  143.    Borchert, Jonathan Boswell, Tim Boyer, Frederick Bruckman, Kenneth
  144.    Cochran, Jared Crapo, Bill Delaney, Igor Sobrado Delgado, Clarence
  145.    Dold, Joe Doupnik, John Dunlap, Max Evarts, Patrick French, Carl
  146.    Friedberg, Carl Friend, Hirofumi Fujii, Andrew Gabriel, Gabe Garza,
  147.    Boyd Gerber, David Gerber, George Gilmer, Hunter Goatley, DJ Hagberg,
  148.    Kevin Handy, Andy Harper, Randolph Herber, Sven Holstr÷m, Michal
  149.    Jaegermann, Graham Jenkins, Dick Jones, Terry Kennedy, Robert D Keys,
  150.    Nick Kisseberth, Igor Kovalenko, David Lane, Adam Laurie, Jeff
  151.    Liebermann, Eric Lonvick, Hoi Wan Louis, Arthur Marsh, Gregorie
  152.    Martin, Peter Mauzey, Dragan Milicic, Todd Miller, Christian Mondrup,
  153.    Daniel Morato, Dat Nguyen, Herb Peyerl, Jean-Pierre Radley, Mitchell
  154.    Pilot, Steve Rance, Stephen Riehm, Nigel Roles, Larry Rosenman, Jay S
  155.    Rouman, David Sanderson, John Santos, Michael Schmitz, Steven Schultz,
  156.    Bob Shair, Richard Shuford, Fred Smith, Michael Sokolov, Jim Spath,
  157.    Jerry Sutton, Peter Szell, Ted T'so, Brian Tillman, Linus Torvalds,
  158.    Patrick Volkerding, Martin VorlΣnder, Peter WΣchtler, Steve Walton,
  159.    Ken Weaverling, John Weekley, Martin Whitaker, Jim Whitby, Matt
  160.    Willman, Joellen Windsor, Farrell Woods, and many others for binaries,
  161.    hosting, reviews, suggestions, advice, bug reports, and all the rest
  162.    over the 3+ year C-Kermit 7.0 development cycle. Thanks to Russ Nelson
  163.    and the board of the Open Software Initiative
  164.    ([28]http://www.opensource.org) for their cooperation in developing
  165.    the new C-Kermit license and to the proprietors of those free UNIX
  166.    distributions that have incorporated C-Kermit 7.0 for their
  167.    cooperation and support, especially FreeBSD's J÷rg Wunsch.
  168.      _________________________________________________________________
  169.    
  170.   NOTE TO KERMIT 95 USERS
  171.   
  172.    Kermit 95 and C-Kermit share the same command and scripting language,
  173.    the same Kermit file-transfer protocol implementation, and much else
  174.    besides.
  175.    
  176.    Like the book [29]Using C-Kermit, this file concentrates on the
  177.    aspects of C-Kermit that are common to all versions: UNIX, VMS,
  178.    Windows, OS/2, VOS, AOS/VS, etc. Please refer to your Kermit 95
  179.    documentation for information that is specific to Kermit 95.
  180.    
  181.    C-Kermit 7.0 corresponds to Kermit 95 1.1.19.
  182.      _________________________________________________________________
  183.    
  184.   C-KERMIT VERSIONS AND VERSION NUMBERS
  185.   
  186.    "C-Kermit" refers to all the many programs that are compiled in whole
  187.    or in part from common C-language source code, comprising:
  188.    
  189.      * A Kermit file transfer protocol module
  190.      * A command parser and script execution module
  191.      * A modem-dialing module
  192.      * A network support module
  193.      * A character-set translation module.
  194.        
  195.    and several others. These "system-independent" modules are combined
  196.    with system-dependent modules for each platform to provide the
  197.    required input/output functions, and also in some cases overlaid with
  198.    an alternative user interface, such as Macintosh Kermit's
  199.    point-and-click interface, and in some cases also a terminal emulator,
  200.    as Kermit 95.
  201.    
  202.    The C-Kermit version number started as 1.0, ... 3.0, 4.0, 4.1 and then
  203.    (because of confusion at the time with Berkeley UNIX 4.2), 4B, 4C, and
  204.    so on, with the specific edit number in parentheses, for example
  205.    4E(072) or 5A(188). This scheme was used through 5A(191), but now we
  206.    have gone back to the traditional numbering scheme with decimal
  207.    points: major.minor.edit; for example 7.0.196. Internal version
  208.    numbers (the \v(version) variable), however, are compatible in
  209.    C-Kermit 5A upwards.
  210.    
  211.    Meanwhile, C-Kermit derivatives for some platforms (Windows,
  212.    Macintosh) might go through several releases while C-Kermit itself
  213.    remains the same. These versions have their own platform-specific
  214.    version numbers, such as Kermit 95 1.1.1, 1.1.2, and so on.
  215.    
  216.    C-Kermit Version History:
  217.    
  218.   1.0       1981-1982         Command-line only, 4.2 BSD UNIX only
  219.   2.0       (*)               (who remembers...)
  220.   3.0       May 1984          Command-line only, supports several platforms
  221.   4.0-4.1   Feb-Apr 1985 (*)  First interactive and modular version
  222.   4C(050)   May 1985
  223.   4D(060)   April 1986
  224.   4E(066)   August 1987       Long packets
  225.   4E(068)   January 1988
  226.   4E(072)   January 1989
  227.   4F(095)   August 1989 (*)   Attribute packets
  228.   5A(188)   November 1992     Scripting, TCP/IP, sliding windows (1)
  229.   5A(189)   September 1993    Control-char unprefixing
  230.   5A(190)   October 1994      Recovery
  231.   5A(191)   April 1995        OS/2 only
  232.   6.0.192   September 1996    Intelligent dialing, autodownload, lots more (2)
  233.   6.1.193   1997-98 (*)       Development only
  234.   6.1.194   June 1998         K95 only - switches, directory recursion, more
  235.   7.0.195   August 1999       IKSD + more (CU only as K95 1.1.18-CU)
  236.   7.0.196   1 January 2000    Unicode, lots more
  237.   7.0.197   8 February 2000   Same as 196 but builds on additional platforms(3)
  238.  
  239.    (*) Never formally released (4.0 was a total rewrite)
  240.    (1) Using C-Kermit, 1st Edition
  241.    (2) Using C-Kermit, 2nd Edition
  242.    (3) There is no functional difference between 196 and 197, not even
  243.    bug fixes. The only changes are to #ifdefs, declarations, and the
  244.    makefile, sufficient to make it build on several platforms where 196
  245.    did not build. Binaries that announce themselves as 197 are
  246.    functionally identical to 196 binaries.
  247.      _________________________________________________________________
  248.    
  249. CONTENTS
  250.  
  251.  I.  [30]C-KERMIT DOCUMENTATION
  252.  
  253.  II. [31]NEW FEATURES
  254.  
  255.      (0) [32]INCOMPATIBILITIES WITH PREVIOUS RELEASES
  256.      (1) [33]PROGRAM AND FILE MANAGEMENT AND COMMANDS
  257.          1.0.  [34]Bug fixes
  258.          1.1.  [35]Command Continuation
  259.          1.2.  [36]Editor Interface
  260.          1.3.  [37]Web Browser and FTP Interface
  261.          1.4.  [38]Command Editing
  262.          1.5.  [39]Command Switches
  263.                1.5.1. [40]General Switch Syntax
  264.                1.5.2. [41]Order and Effect of Switches
  265.                1.5.3. [42]Distinguishing Switches from Other Fields
  266.                1.5.4. [43]Standard File Selection Switches
  267.                1.5.5. [44]Setting Preferences for Different Commands
  268.          1.6.  [45]Dates and Times
  269.          1.7.  [46]Partial Completion of Keywords
  270.          1.8.  [47]Command Recall
  271.          1.9.  [48]EXIT Messages
  272.          1.10. [49]Managing Keyboard Interruptions
  273.          1.11. [50]Taming the Wild Backslash -- Part Deux
  274.                1.11.1. [51]Background
  275.                1.11.2. [52]Kermit's Quoting Rules
  276.                1.11.3. [53]Passing DOS Filenames from Kermit to Shell Commands
  277.                1.11.4. [54]Using Variables to Hold DOS Filenames
  278.                1.11.5. [55]Passing DOS Filenames as Parameters to Macros
  279.                1.11.6. [56]Passing DOS File Names from Macro Parameters to the
  280. DOS Shell
  281.                1.11.7. [57]Passing DOS Filenames to Kermit from the Shell
  282.          1.12. [58]Debugging
  283.          1.13. [59]Logs
  284.          1.14. [60]Automatic File-Transfer Packet Recognition at the Command Pr
  285. ompt
  286.          1.15. [61]The TYPE Command
  287.          1.16. [62]The RESET Command
  288.          1.17. [63]The COPY and RENAME Commands
  289.          1.18. [64]The MANUAL Command
  290.          1.19. [65]String and Filename Matching Patterns
  291.          1.20. [66]Multiple Commands on One Line
  292.          1.21. [67]What Do I Have?
  293.          1.22. [68]Generalized File Input and Output
  294.                1.22.1. [69]Why Another I/O System?
  295.                1.22.2. [70]The FILE Command
  296.                1.22.3. [71]FILE Command Examples
  297.                1.22.4. [72]Channel Numbers
  298.                1.22.5. [73]FILE Command Error Codes
  299.                1.22.6. [74]File I/O Variables
  300.                1.22.7. [75]File I/O Functions
  301.                1.22.8. [76]File I/O Function Examples
  302.          1.23. [77]The EXEC Command
  303.          1.24. [78]Getting Keyword Lists with '?'
  304.      (2) [79]MAKING AND USING CONNECTIONS
  305.          2.0. [80]SET LINE and SET HOST Command Switches
  306.          2.1. [81]Dialing
  307.               2.1.1. [82]The Dial Result Message
  308.               2.1.2. [83]Long-Distance Dialing Changes
  309.               2.1.3. [84]Forcing Long-Distance Dialing
  310.               2.1.4. [85]Exchange-Specific Dialing Decisions
  311.               2.1.5. [86]Cautions about Cheapest-First Dialing
  312.               2.1.6. [87]Blind Dialing (Dialing with No Dialtone)
  313.               2.1.7. [88]Trimming the Dialing Dialog
  314.               2.1.8. [89]Controlling the Dialing Speed
  315.               2.1.9. [90]Pretesting Phone Number Conversions
  316.               2.1.10. [91]Greater Control over Partial Dialing
  317.               2.1.11. [92]New DIAL-related Variables and Functions
  318.               2.1.12. [93]Increased Flexibility of PBX Dialing
  319.               2.1.13. [94]The DIAL macro - Last-Minute Phone Number Conversions
  320.               2.1.14. [95]Automatic Tone/Pulse Dialing Selection
  321.               2.1.15. [96]Dial-Modifier Variables
  322.               2.1.16. [97]Giving Multiple Numbers to the DIAL Command
  323.          2.2. [98]Modems
  324.               2.2.1. [99]New Modem Types
  325.               2.2.2. [100]New Modem Controls
  326.          2.3. [101]TELNET and RLOGIN
  327.               2.3.0. [102]Bug Fixes
  328.               2.3.1. [103]Telnet Binary Mode Bug Adjustments
  329.               2.3.2. [104]VMS UCX Telnet Port Bug Adjustment
  330.               2.3.3. [105]Telnet New Environment Option
  331.               2.3.4. [106]Telnet Location Option
  332.               2.3.5. [107]Connecting to Raw TCP Sockets
  333.               2.3.6. [108]Incoming TCP Connections
  334.          2.4. [109]The EIGHTBIT Command
  335.          2.5. [110]The Services Directory
  336.          2.6. [111]Closing Connections
  337.          2.7. [112]Using C-Kermit with External Communication Programs
  338.               2.7.0. [113]C-Kermit over tn3270 and tn5250
  339.               2.7.1. [114]C-Kermit over Telnet
  340.               2.7.2. [115]C-Kermit over Rlogin
  341.               2.7.3. [116]C-Kermit over Serial Communication Programs
  342.               2.7.4. [117]C-Kermit over Secure Network Clients
  343.               2.7.4.1. [118]SSH
  344.               2.7.4.2. [119]SSL
  345.               2.7.4.3. [120]SRP
  346.               2.7.4.4. [121]SOCKS
  347.               2.7.4.5. [122]Kerberos and SRP
  348.          2.8. [123]Scripting Local Programs
  349.          2.9. [124]X.25 Networking
  350.               2.9.1. [125]IBM AIXLink/X.25 Network Provider Interface for AIX
  351.               2.9.2. [126]HP-UX X.25
  352.          2.10. [127]Additional Serial Port Controls
  353.          2.11. [128]Getting Access to the Dialout Device
  354.          2.12. [129]The Connection Log
  355.          2.13. [130]Automatic Connection-Specific Flow Control Selection
  356.          2.14. [131]Trapping Connection Establishment and Loss
  357.          2.15. [132]Contacting Web Servers with the HTTP Command
  358.      (3) [133]TERMINAL CONNECTION
  359.          3.1. [134]CONNECT Command Switches
  360.          3.2. [135]Triggers
  361.          3.3. [136]Transparent Printing
  362.          3.4. [137]Binary and Text Session Logs
  363.      (4) [138]FILE TRANSFER AND MANAGEMENT
  364.          4.0. [139]Bug Fixes, Minor Changes, and Clarifications
  365.          4.1. [140]File-Transfer Filename Templates
  366.          4.1.1. [141]Templates in the As-Name
  367.          4.1.2. [142]Templates on the Command Line
  368.          4.1.3. [143]Post-Transfer Renaming
  369.          4.2. [144]File-Transfer Pipes and Filters
  370.          4.2.1. [145]Introduction
  371.          4.2.1.1. [146]Terminology
  372.          4.2.1.2. [147]Notation
  373.          4.2.1.3. [148]Security
  374.          4.2.2. [149]Commands for Transferring from and to Pipes
  375.          4.2.2.1. [150]Sending from a Command
  376.          4.2.2.2. [151]Receiving to a Command
  377.          4.2.3. [152]Using File-Transfer Filters
  378.          4.2.3.1. [153]The SEND Filter
  379.          4.2.3.2. [154]The RECEIVE Filter
  380.          4.2.4. [155]Implicit Use of Pipes
  381.          4.2.5. [156]Success and Failure of Piped Commands
  382.          4.2.6. [157]Cautions about Using Pipes to Transfer Directory Trees
  383.          4.2.7. [158]Pipes and Encryption
  384.          4.2.8. [159]Commands and Functions Related to Pipes
  385.          4.2.8.1. [160]The OPEN !READ and OPEN !WRITE Commands
  386.          4.2.8.2. [161]The REDIRECT Command
  387.          4.2.8.3. [162]Receiving Mail and Print Jobs
  388.          4.2.8.4. [163]Pipe-Related Functions
  389.          4.3. [164]Automatic Per-File Text/Binary Mode Switching
  390.          4.3.1. [165]Exceptions
  391.          4.3.2. [166]Overview
  392.          4.3.3. [167]Commands
  393.          4.3.4. [168]Examples
  394.          4.4. [169]File Permissions
  395.          4.4.1. [170]When ATTRIBUTES PROTECTION is OFF
  396.          4.4.1.1. [171]Unix
  397.          4.4.1.2. [172]VMS
  398.          4.4.2. [173]When ATTRIBUTES PROTECTION is ON
  399.          4.4.2.1. [174]System-Specific Permissions
  400.          4.4.2.1.1. [175]UNIX
  401.          4.4.2.1.2. [176]VMS
  402.          4.4.2.2. [177]System-Independent Permissions
  403.          4.5. [178]File Management Commands
  404.          4.5.1. [179]The DIRECTORY Command
  405.          4.5.2. [180]The CD and BACK Commands
  406.          4.5.2.1. [181]Parsing Improvements
  407.          4.5.2.2. [182]The CDPATH
  408.          4.5.3. [183]Creating and Removing Directories
  409.          4.5.4. [184]The DELETE and PURGE Commands
  410.          4.6. [185]Starting the Remote Kermit Server Automatically
  411.          4.7. [186]File-Transfer Command Switches
  412.          4.7.1. [187]SEND Command Switches
  413.          4.7.2. [188]GET Command Switches
  414.          4.7.3. [189]RECEIVE Command Switches
  415.          4.8. [190]Minor Kermit Protocol Improvements
  416.          4.8.1. [191]Multiple Attribute Packets
  417.          4.8.2. [192]Very Short Packets
  418.          4.9. [193]Wildcard / File Group Expansion
  419.          4.9.1. [194]In UNIX C-Kermit
  420.          4.9.2. [195]In Kermit 95
  421.          4.9.3. [196]In VMS, AOS/VS, OS-9, VOS, etc.
  422.          4.10. [197]Additional Pathname Controls
  423.          4.11. [198]Recursive SEND and GET: Transferring Directory Trees
  424.          4.11.1. [199]Command-Line Options
  425.          4.11.2. [200]The SEND /RECURSIVE Command
  426.          4.11.3. [201]The GET /RECURSIVE Command
  427.          4.11.4. [202]New and Changed File Functions
  428.          4.11.5. [203]Moving Directory Trees Between Like Systems
  429.          4.11.6. [204]Moving Directory Trees Between Unlike Systems
  430.          4.12. [205]Where Did My File Go?
  431.          4.13. [206]File Output Buffer Control
  432.          4.14. [207]Improved Responsiveness
  433.          4.15. [208]Doubling and Ignoring Characters for Transparency
  434.          4.16. [209]New File-Transfer Display Formats
  435.          4.17. [210]New Transaction Log Formats
  436.          4.17.1. [211]The BRIEF Format
  437.          4.17.2. [212]The FTP Format
  438.          4.18. [213]Unprefixing NUL
  439.          4.19. [214]Clear-Channel Protocol
  440.          4.20. [215]Streaming Protocol
  441.          4.20.1. [216]Commands for Streaming
  442.          4.20.2. [217]Examples of Streaming
  443.          4.20.2.1. [218]Streaming on Socket-to-Socket Connections
  444.          4.20.2.2. [219]Streaming on Telnet Connections
  445.          4.20.2.3. [220]Streaming with Limited Packet Length
  446.          4.20.2.4. [221]Streaming on Dialup Connections
  447.          4.20.2.5. [222]Streaming on X.25 Connections
  448.          4.20.3. [223]Streaming - Preliminary Conclusions
  449.          4.21. [224]The TRANSMIT Command
  450.          4.22. [225]Coping with Faulty Kermit Implementations
  451.          4.22.1. [226]Failure to Accept Modern Negotiation Strings
  452.          4.22.2. [227]Failure to Negotiate 8th-bit Prefixing
  453.          4.22.3. [228]Corrupt Files
  454.          4.22.4. [229]Spurious Cancellations
  455.          4.22.5. [230]Spurious Refusals
  456.          4.22.6. [231]Failures during the Data Transfer Phase
  457.          4.22.7. [232]Fractured Filenames
  458.          4.22.8. [233]Bad File Dates
  459.          4.23. [234]File Transfer Recovery
  460.          4.24. [235]FILE COLLISION UPDATE Clarification
  461.          4.25. [236]Autodownload Improvements
  462.      (5) [237]CLIENT/SERVER
  463.          5.0. [238]Hints
  464.          5.1. [239]New Command-Line Options
  465.          5.2. [240]New Client Commands
  466.          5.3. [241]New Server Capabilities
  467.          5.3.1. [242]Creating and Removing Directories
  468.          5.3.2. [243]Directory Listings
  469.          5.4. [244]Syntax for Remote Filenames with Embedded Spaces
  470.          5.5. [245]Automatic Orientation Messages upon Directory Change
  471.          5.6. [246]New Server Controls
  472.          5.7. [247]Timeouts during REMOTE HOST Command Execution
  473.      (6) [248]INTERNATIONAL CHARACTER SETS
  474.          6.0. [249]ISO 8859-15 Latin Alphabet 9
  475.          6.1. [250]The HP-Roman8 Character Set
  476.          6.2. [251]Greek Character Sets
  477.          6.3. [252]Additional Latin-2 Character Sets
  478.          6.4. [253]Additional Cyrillic Character Sets
  479.          6.5. [254]Automatic Character-Set Switching
  480.          6.6. [255]Unicode
  481.          6.6.1. [256]Overview of Unicode
  482.          6.6.2. [257]UCS Byte Order
  483.          6.6.2. [258]UCS Transformation Formats
  484.          6.6.3. [259]Conformance Levels
  485.          6.6.4. [260]Relationship of Unicode with Kermit's Other Character Sets
  486.          6.6.5. [261]Kermit's Unicode Features
  487.          6.6.5.1. [262]File Transfer
  488.          6.6.5.2. [263]The TRANSLATE Command
  489.          6.6.5.3. [264]Terminal Connection
  490.          6.6.5.4. [265]The TRANSMIT Command
  491.          6.6.5.5. [266]Summary of Kermit Unicode Commands
  492.          6.7. [267]Client/Server Character-Set Switching
  493.      (7) [268]SCRIPT PROGRAMMING
  494.          7.0. [269]Bug Fixes
  495.          7.1. [270]The INPUT Command
  496.          7.1.1. [271]INPUT Timeouts
  497.          7.1.2. [272]New INPUT Controls
  498.          7.1.3. [273]INPUT with Pattern Matching
  499.          7.1.4. [274]The INPUT Match Result
  500.          7.2. [275]New or Improved Built-In Variables
  501.          7.3. [276]New or Improved Built-In Functions
  502.          7.4. [277]New IF Conditions
  503.          7.5. [278]Using More than Ten Macro Arguments
  504.          7.6. [279]Clarification of Function Call Syntax
  505.          7.7. [280]Autodownload during INPUT Command Execution
  506.          7.8. [281]Built-in Help for Functions.
  507.          7.9. [282]Variable Assignments
  508.          7.9.1. [283]Assignment Operators
  509.          7.9.2. [284]New Assignment Commands
  510.          7.10. [285]Arrays
  511.          7.10.1. [286]Array Initializers
  512.          7.10.2. [287]Turning a String into an Array of Words
  513.          7.10.3. [288]Arrays of Filenames
  514.          7.10.4. [289]Automatic Arrays
  515.          7.10.5. [290]Sorting Arrays
  516.          7.10.6. [291]Displaying Arrays
  517.          7.10.7. [292]Other Array Operations
  518.          7.10.8. [293]Hints for Using Arrays
  519.          7.10.9. [294]Do-It-Yourself Arrays
  520.          7.10.10. [295]Associative Arrays
  521.          7.11. [296]OUTPUT Command Improvements
  522.          7.12. [297]Function and Variable Diagnostics
  523.          7.13. [298]Return Value of Macros
  524.          7.14. [299]The ASSERT, FAIL, and SUCCEED Commands.
  525.          7.15. [300]Using Alarms
  526.          7.16. [301]Passing Arguments to Command Files
  527.          7.17. [302]Dialogs with Timed Responses
  528.          7.18. [303]Increased Flexibility of SWITCH Case Labels
  529.          7.19. "[304]Kerbang" Scripts
  530.          7.20. [305]IF and XIF Statement Syntax
  531.          7.20.1. [306]The IF/XIF Distinction
  532.          7.20.2. [307]Boolean Expressions (The IF/WHILE Condition)
  533.          7.21. [308]Screen Formatting and Cursor Control
  534.          7.22. [309]Evaluating Arithmetic Expressions
  535.          7.23. [310]Floating-Point Arithmetic
  536.          7.24. [311]Tracing Script Execution
  537.          7.25. [312]Compact Substring Notation
  538.          7.26. [313]New WAIT Command Options
  539.          7.26.1. [314]Waiting for Modem Signals
  540.          7.26.2. [315]Waiting for File Events
  541.          7.27. [316]Relaxed FOR and SWITCH Syntax
  542.      (8) [317]USING OTHER FILE TRANSFER PROTOCOLS
  543.      (9) [318]COMMAND-LINE OPTIONS
  544.          9.0. [319]Extended-Format Command-Line Options
  545.          9.1. [320]Command Line Personalities
  546.          9.2. [321]Built-in Help for Command Line Options
  547.          9.3. [322]New Command-Line Options
  548.     (10) [323]C-KERMIT AND G-KERMIT
  549.  
  550. III. [324]APPENDICES
  551.  
  552. III.1. [325]Character Set Tables
  553. III.1.1. [326]The Hewlett Packard Roman8 Character Set
  554. III.1.2. [327]Greek Character Sets
  555. III.1.2.1. [328]The ISO 8859-7 Latin / Greek Alphabet
  556. III.1.2.2. [329]The ELOT 927 Character Set
  557. III.1.2.3. [330]PC Code Page 869
  558. III.2. [331]Updated Country Codes
  559.  
  560. IV. [332]ERRATA & CORRIGENDA: Corrections to "Using C-Kermit" 2nd Edition.
  561. V. [333]ADDITIONAL COPYRIGHT NOTICES
  562.      _________________________________________________________________
  563.    
  564. I. C-KERMIT DOCUMENTATION
  565.  
  566.    The user manual for C-Kermit is:
  567.    
  568.      Frank da Cruz and Christine M. Gianone, [334]Using C-Kermit, Second
  569.      Edition, Digital Press / Butterworth-Heinemann, Woburn, MA, 1997,
  570.      622 pages, ISBN 1-55558-164-1.
  571.      
  572.    [335]CLICK HERE for reviews.
  573.    
  574.    The present document is a supplement to Using C-Kermit 2nd Ed, not a
  575.    replacement for it.
  576.    
  577.    US single-copy price: $44.95; quantity discounts available. Available
  578.    in bookstores or directly from Columbia University:
  579.    
  580.   The Kermit Project
  581.   Columbia University
  582.   612 West 115th Street
  583.   New York NY  10025-7799
  584.   USA
  585.   Telephone: +1 (212) 854-3703
  586.   Fax:       +1 (212) 663-8202
  587.  
  588.    Domestic and overseas orders accepted. Price: US $44.95 (US, Canada,
  589.    and Mexico). Shipping: $4.00 within the USA; $15.00 to all other
  590.    countries. Orders may be paid by MasterCard or Visa, or prepaid by
  591.    check in US dollars. Add $65 bank fee for checks not drawn on a US
  592.    bank. Do not include sales tax. Inquire about quantity discounts.
  593.    
  594.    You can also order by phone from the publisher, Digital Press /
  595.    [336]Butterworth-Heinemann, with MasterCard, Visa, or American
  596.    Express:
  597.    
  598.   +1 800 366-2665   (Woburn, Massachusetts office for USA & Canada)
  599.   +44 1865 314627   (Oxford, England distribution centre for UK & Europe)
  600.   +61 03 9245 7111  (Melbourne, Vic, office for Australia & NZ)
  601.   +65 356-1968      (Singapore office for Asia)
  602.   +27 (31) 2683111  (Durban office for South Africa)
  603.  
  604.    A [337]German-language edition of the First Edition is also available:
  605.    
  606.      Frank da Cruz and Christine M. Gianone, C-Kermit - Einfⁿhrung und
  607.      Referenz, Verlag Heinz Heise, Hannover, Germany (1994). ISBN
  608.      3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 88,00.
  609.      Verlag Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625
  610.      Hannover. Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 52-1 29.
  611.      
  612.    The [338]Kermit file transfer protocol is specified in:
  613.    
  614.      Frank da Cruz, Kermit, A File Transfer Protocol, Digital Press,
  615.      Bedford, MA, 1987, 379 pages, ISBN 0-932376-88-6. US single-copy
  616.      price: $39.95. Availability as above.
  617.      
  618.    News and articles about Kermit software and protocol are published
  619.    periodically in the journal, [339]Kermit News. Subscriptions are free;
  620.    contact Columbia University at the address above.
  621.    
  622.    Online news about Kermit is published in the
  623.    [340]comp.protocols.kermit.announce and
  624.    [341]comp.protocols.kermit.misc newsgroups.
  625.      _________________________________________________________________
  626.    
  627. II. NEW FEATURES
  628.  
  629.    Support for the Bell Labs Plan 9 operating system was added to version
  630.    6.0 too late to be mentioned in the book (although it does appear on
  631.    the cover).
  632.    
  633.    Specific changes and additions are grouped together by major topic,
  634.    roughly corresponding to the chapters of [342]Using C-Kermit.
  635.      _________________________________________________________________
  636.    
  637.   0. INCOMPATIBILITIES WITH PREVIOUS RELEASES
  638.   
  639.     1. C-Kermit 7.0 uses FAST Kermit protocol settings by default. This
  640.        includes "unprefixing" of certain control characters. Because of
  641.        this, file transfers that worked with previous releases might not
  642.        work in the new release (but it is more likely that they will
  643.        work, and much faster). If a transfer fails, you'll get a
  644.        context-sensitive hint suggesting possible causes and cures.
  645.        Usually SET PREFIXING ALL does the trick.
  646.     2. C-Kermit 7.0 transfers files in BINARY mode by default. To restore
  647.        the previous behavior, put SET FILE TYPE TEXT in your C-Kermit
  648.        initialization file.
  649.     3. No matter whether FILE TYPE is BINARY or TEXT by default, C-Kermit
  650.        7.0 now switches between text and binary mode automatically on a
  651.        per-file basis according to various criteria, including (a) which
  652.        kind of platform is on the other end of the connection (if known),
  653.        (b) the version of Kermit on the other end, and (c) the file's
  654.        name (see [343]Section 4, especially [344]4.3). To disable this
  655.        automatic switching and restore the earlier behavior, put SET
  656.        TRANSFER MODE MANUAL in your C-Kermit initialization file. To
  657.        disable automatic switching for a particular transfer, include a
  658.        /TEXT or /BINARY switch with your SEND or GET command.
  659.     4. The RESEND and REGET commands automatically switch to binary mode;
  660.        previously if RESEND or REGET were attempted when FILE TYPE was
  661.        TEXT, these commands would fail immediately, with a message
  662.        telling you they work only when the FILE TYPE is BINARY. Now they
  663.        simply do this for you. See [345]Section 4.23 for additional
  664.        (important) information.
  665.     5. SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10
  666.        and 138) in case rlogin, ssh, or cu are "in the middle", since
  667.        otherwise <LF>~ might appear in Kermit packets, and this would
  668.        cause rlogin, ssh, or cu to disconnect, suspend,escape back, or
  669.        otherwise wreck the file transfer. Xon and Xoff are now always
  670.        prefixed too, even when Xon/Xoff flow control is not in effect,
  671.        since unprefixing them has proven dangerous on TCP/IP connections.
  672.     6. In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built
  673.        into C-Kermit itself rather than implemented by running an
  674.        external command or program. The built-in command might not behave
  675.        the way the platform-specific external one did, but many options
  676.        are available for customization. Of course the underlying
  677.        platform-specific command can still be accessed with "!", "@", or
  678.        "RUN" wherever the installation does not forbid. In UNIX, the "ls"
  679.        command can be accessed directly as "ls" in C-Kermit. See
  680.        [346]Section 4.5.1 for details.
  681.     7. SEND ? prints a list of switches rather than a list of filenames.
  682.        If you want to see a list of filenames, use a (system-dependent)
  683.        construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND
  684.        []? (VMS), etc. See [347]Sections 1.5 and [348]4.7.1.
  685.     8. In UNIX, OS-9, and Kermit 95, the wildcard characters in previous
  686.        versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and
  687.        }, with dash used inside []'s to denote ranges and comma used
  688.        inside {} to separate list elements. If you need to include any of
  689.        these characters literally in a filename, precede each one with
  690.        backslash (\). See [349]Section 4.9.
  691.     9. SET QUIET { ON, OFF } is now on the command stack, just like SET
  692.        INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458
  693.        of [350]Using C-Kermit, 2nd Edition. This allows any macro or
  694.        command file to SET QUIET ON or OFF without worrying about saving
  695.        and restoring the global QUIET value. For example, this lets you
  696.        write a script that tries SET LINE on lots of devices until it
  697.        finds one free without spewing out loads of error messages, and
  698.        also without disturbing the global QUIET setting, whatever it was.
  699.    10. Because of the new "." operator (which introduces assignments),
  700.        macros whose names begin with "." can not be invoked "by name".
  701.        However, they still can be invoked with DO.
  702.    11. The syntax of the EVALUATE command has changed. See [351]Section
  703.        7.9.2. To restore the previous syntax, use SET EVALUATE OLD.
  704.    12. The \v(directory) variable now includes the trailing directory
  705.        separator; in previous releases it did not. This is to allow
  706.        constructions such as:
  707.  
  708.   cd \v(dir)data.tmp
  709.        to work across platforms that might have different directory
  710.        notation, such as UNIX, Windows, and VMS.
  711.    13. Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and
  712.        sticky. In C-Kermit 7.0, there is an array of default flow-control
  713.        values for each kind of connection, that are applied automatically
  714.        at SET LINE/PORT/HOST time. Thus a SET FLOW command given before
  715.        SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can
  716.        be guaranteed to have the desired effect only if given after the
  717.        SET LINE/PORT/HOST command.
  718.    14. Character-set translation works differently in the TRANSMIT
  719.        command when (a) the file character-set is not the same as the
  720.        local end of the terminal character-set, or (b) when the terminal
  721.        character-set is TRANSPARENT.
  722.      _________________________________________________________________
  723.    
  724.   1. PROGRAM AND FILE MANAGEMENT AND COMMANDS
  725.   
  726.   1.0. Bug Fixes
  727.   
  728.    The following patches were issued to correct bugs in C-Kermit 6.0.
  729.    These are described in detail in the 6.0 PATCHES file. All of these
  730.    fixes have been incorporated in C-Kermit 6.1 (never released except as
  731.    K95 1.1.16-17) and 7.0.
  732.    
  733.  0001   All UNIX         C-Kermit mishandles timestamps on files before 1970
  734.  0002   Solaris 2.5++    Compilation error on Solaris 2.5 with Pro C
  735.  0003   All VMS          CKERMIT.INI Fix for VMS
  736.  0004   VMS/VAX/UCX 2.0  C-Kermit 6.0 can't TELNET on VAX/VMS with UCX 2.0
  737.  0005   All              C-Kermit Might Send Packets Outside Window
  738.  0006   All              MOVE from SEND-LIST does not delete original files
  739.  0007   Solaris 2.5++    Higher serial speeds on Solaris 2.5
  740.  0008   All              C-Kermit application file name can't contain spaces
  741.  0009   AT&T 7300 UNIXPC setuid and hardware flow-control problems
  742.  0010   Linux on Alpha   Patch to make ckutio.c compile on Linux/Alpha
  743.  0011   OS-9/68000 2.4   Patch to make ck9con.c compile on OS-9/68000 2.4
  744.  0012   MW Coherent 4.2  Patches for successful build on Coherent 4.2
  745.  0013   SINIX-Y 5.43     "delay" variable conflicts with <sys/clock.h>
  746.  0014   VMS/VAX/CMU-IP   Subject: Patches for VAX/VMS 5.x + CMU-IP
  747.  0015   All              XECHO doesn't flush its output
  748.  0016   VMS              CD and other directory operations might not work
  749.  0017   Linux 1.2.x++    Use standard POSIX interface for high serial speeds
  750.  0018   UNIX             SET WILDCARD-EXPANSION SHELL dumps core
  751.  0019   All              Hayes V.34 modem init string problem
  752.  0020   All              READ command does not fail if file not open
  753.  0021   All              Problems with long function arguments
  754.  0022   All              Certain \function()s can misbehave
  755.  0023   All              X MOD 0 crashes program
  756.  0024   All              Internal bulletproofing for lower() function
  757.  0025   OpenBSD          Real OpenBSD support for C-Kermit 6.0
  758.  0026   All              Incorrect checks for macro/command-file nesting depth
  759.  0027   All              ANSWER doesn't automatically CONNECT
  760.  0028   All              Overzealous EXIT warning
  761.  0029   All              OUTPUT doesn't echo when DUPLEX is HALF
  762.  0030   All              Minor problems with REMOTE DIRECTORY/DELETE/etc
  763.  0031   All              CHECK command broken
  764.  0032   All              Problem with SET TRANSMIT ECHO
  765.  0033   UNIX, VMS, etc   HELP SET SERVER says too much
  766.  0034   All              READ and !READ too picky about line terminators
  767.  0035   All              END from inside SWITCH doesn't work
  768.  0036   All              Problem telnetting to multihomed hosts
  769.  0037   All              Redirection failures in REMOTE xxx > file
  770.  
  771.    REDIRECT was missing in many UNIX C-Kermit implementations; in version
  772.    7.0, it should be available in all of them.
  773.      _________________________________________________________________
  774.    
  775.   1.1. Command Continuation
  776.   
  777.    Comments that start with ";" or "#" can no longer be continued. In:
  778.    
  779.   ; this is a comment -
  780.   echo blah
  781.  
  782.    the ECHO command will execute, rather than being taken as a
  783.    continuation of the preceding comment line. This allows easy
  784.    "commenting out" of commands from macro definitions.
  785.    
  786.    However, the text of the COMMENT command can still be continued onto
  787.    subsequent lines:
  788.    
  789.   comment this is a comment -
  790.   echo blah
  791.  
  792.    As of version 6.0, backslash is no longer a valid continuation
  793.    character. Only hyphen should be used for command continuation. This
  794.    is to make it possible to issue commands like "cd a:\" on DOS-like
  795.    systems.
  796.    
  797.    As of version 7.0:
  798.    
  799.      * You can quote a final dash to prevent it from being a continuation
  800.        character:
  801.  
  802.   echo foo\-
  803.        This prints "foo-". The command is not continued.
  804.      * You can enter commands such as:
  805.  
  806.   echo foo - ; this is a comment
  807.        interactively and they are properly treated as continued commands.
  808.        Previously this worked only in command files.
  809.      _________________________________________________________________
  810.    
  811.   1.2. Editor Interface
  812.   
  813.    SET EDITOR name [ options ]
  814.           Lets you specify a text-editing program. The name can be a
  815.           fully specified pathname like /usr/local/bin/emacs19/emacs, or
  816.           it can be the name of any program in your PATH, e.g. "set
  817.           editor emacs". In VMS, it must be a DCL command like "edit",
  818.           "edit/tpu", "emacs", etc. If an environment variable EDITOR is
  819.           defined when Kermit starts, its value is the default editor.
  820.           You can also specify options to be included on the editor
  821.           command line. Returns to Kermit when the editor exits.
  822.           
  823.    EDIT [ filename ]
  824.           If the EDIT command is given without a filename, then if a
  825.           previous filename had been given to an EDIT command, it is
  826.           used; if not, the editor is started without a file. If a
  827.           filename is given, the editor is started on that file, and the
  828.           filename is remembered for subsequent EDIT commands.
  829.           
  830.    SHOW EDITOR
  831.           Displays the full pathname of your text editor, if any, along
  832.           with any command line options, and the file most recently
  833.           edited (and therefore the default filename for your next EDIT
  834.           command).
  835.           
  836.    Related variables: \v(editor), \v(editopts), \v(editfile).
  837.      _________________________________________________________________
  838.    
  839.   1.3. Web Browser and FTP Interface
  840.   
  841.    C-Kermit includes an FTP command, which simply runs the FTP program;
  842.    C-Kermit does not include any built-in support for Internet File
  843.    Transfer Protocol, nor any method for interacting directly with an FTP
  844.    server. In version 7.0, however, C-Kermit lets you specify your FTP
  845.    client:
  846.    
  847.    SET FTP-CLIENT [ name [ options ] ]
  848.           The name is the name of the FTP executable. In UNIX, Windows,
  849.           or OS/2, it can be the filename of any executable program in
  850.           your PATH (e.g. "ftp.exe" in Windows, "ftp" in UNIX); elsewhere
  851.           (or if you do not have a PATH definition), it must be the fully
  852.           specified pathname of the FTP program. If the name contains any
  853.           spaces, enclose it braces. Include any options after the
  854.           filename; these depend the particular ftp client.
  855.           
  856.    The Web browser interface is covered in the following subsections.
  857.      _________________________________________________________________
  858.    
  859.     1.3.1. Invoking your Browser from C-Kermit
  860.     
  861.    BROWSE [ url ]
  862.           Starts your preferred Web browser on the URL, if one is given,
  863.           otherwise on the most recently given URL, if any. Returns to
  864.           Kermit when the browser exits.
  865.           
  866.    SET BROWSER [ name [ options ] ]
  867.           Use this command to specify the name of your Web browser
  868.           program, for example: "set browser lynx". The name must be in
  869.           your PATH, or else it must be a fully specified filename; in
  870.           VMS it must be a DCL command.
  871.           
  872.    SHOW BROWSER
  873.           Displays the current browser, options, and most recent URL.
  874.           
  875.    Related variables: \v(browser), \v(browsopts), \v(browsurl).
  876.    
  877.    Also see [352]Section 2.15: Contacting Web Servers with the HTTP
  878.    Command.
  879.      _________________________________________________________________
  880.    
  881.     1.3.2. Invoking C-Kermit from your Browser
  882.     
  883.    The method for doing this depends, of course, on your browser. Here
  884.    are some examples:
  885.    
  886.    Netscape on UNIX (X-based)
  887.           In the Options->Applications section, set your Telnet
  888.           application to:
  889.           
  890.   xterm -e /usr/local/bin/kermit/kermit -J %h %p
  891.  
  892.           (replace "/usr/local/bin/kermit/kermit" by C-Kermit's actual
  893.           pathname). -J is C-Kermit's command-line option to "be like
  894.           Telnet"; %h and %p are Netscape placeholders for hostname and
  895.           port.
  896.           
  897.    Lynx on UNIX
  898.           As far as we know, this can be done only at compile time. Add
  899.           the following line to the Lynx userdefs.h file before building
  900.           the Lynx binary:
  901.           
  902.   #define TELNET_COMMAND "/opt/bin/kermit -J"
  903.  
  904.           And then add lines like the following to the Lynx.cfg file:
  905.           
  906.   DOWNLOADER:Kermit binary download:/opt/bin/kermit -i -V -s %s -a %s:TRUE
  907.   DOWNLOADER:Kermit text download:/opt/bin/kermit -s %s -a %s:TRUE
  908.  
  909.   UPLOADER:Kermit binary upload:/opt/bin/kermit -i -r -a %s:TRUE
  910.   UPLOADER:Kermit text upload:/opt/bin/kermit -r -a %s:TRUE
  911.   UPLOADER:Kermit text get:/opt/bin/kermit -g %s:TRUE
  912.   UPLOADER:Kermit binary get:/opt/bin/kermit -ig %s:TRUE
  913.  
  914.    But none of the above is necessary if you make C-Kermit your default
  915.    Telnet client, which you can do by making a symlink called 'telnet' to
  916.    the C-Kermit 7.0 binary. See [353]Section 9.1 for details.
  917.      _________________________________________________________________
  918.    
  919.   1.4. Command Editing
  920.   
  921.    Ctrl-W ("Word delete") was changed in 7.0 to delete back to the
  922.    previous non-alphanumeric, rather than all the way back to the
  923.    previous space.
  924.      _________________________________________________________________
  925.    
  926.   1.5. Command Switches
  927.   
  928.    As of version 7.0, C-Kermit's command parser supports a new type of
  929.    field, called a "switch". This is an optional command modifier.
  930.    
  931.     1.5.1. General Switch Syntax
  932.     
  933.    A switch is a keyword beginning with a slash (/). If it takes a value,
  934.    then the value is appended to it (with no intervening spaces),
  935.    separated by a colon (:) or equal sign (=). Depending on the switch,
  936.    the value may be a number, a keyword, a filename, a date/time, etc.
  937.    Examples:
  938.    
  939.   send oofa.txt                              ; No switches
  940.   send /binary oofa.zip                      ; A switch without a value
  941.   send /protocol:zmodem oofa.zip             ; A switch with a value (:)
  942.   send /protocol=zmodem oofa.zip             ; A switch with a value (=)
  943.   send /text /delete /as-name:x.x oofa.txt   ; Several switches
  944.  
  945.    Like other command fields, switches are separated from other fields,
  946.    and from each other, by whitespace, as shown in the examples just
  947.    above. You can not put them together like so:
  948.    
  949.   send/text/delete/as-name:x.x oofa.txt
  950.  
  951.    (as you might do in VMS or DOS, or as we might once have done in
  952.    TOPS-10 or TOPS0-20, or PIP). This is primarily due to ambiguity
  953.    between "/" as switch introducer versus "/" as UNIX directory
  954.    separator; e.g. in:
  955.    
  956.   send /delete/as-name:foo/text oofa.txt
  957.  
  958.    Does "foo/text" mean the filename is "foo" and the transfer is to be
  959.    in text mode, or does it mean the filename is "foo/text"? Therefore we
  960.    require whitespace between switches to resolve the ambiguity. (That's
  961.    only one of several possible ambiguities -- it is also conceivable
  962.    that a file called "text" exists in the path "/delete/as-name:foo/").
  963.    
  964.    In general, if a switch can take a value, but you omit it, then either
  965.    a reasonable default value is supplied, or an error message is
  966.    printed:
  967.    
  968.   send /print:-Plaserwriter oofa.txt         ; Value included = print options
  969.   send /print oofa.txt                       ; Value omitted, OK
  970.   send /mail:kermit@columbia.edu oofa.txt    ; Value included = address
  971.   send /mail oofa.txt                        ; Not OK - address required
  972.   ?Address required
  973.  
  974.    Context-sensitive help (?) and completion (Esc or Tab) are available
  975.    in the normal manner:
  976.    
  977.   C-Kermit> send /pr? Switch, one of the following:
  978.     /print /protocol
  979.   C-Kermit> send /pro<ESC>tocol:?  File-transfer protocol,
  980.    one of the following:
  981.     kermit   xmodem   ymodem   ymodem-g   zmodem
  982.   C-Kermit> send /protocol:k<TAB>ermit
  983.  
  984.    If a switch takes a value and you use completion on it, a colon (:) is
  985.    printed at the end of its name to indicate this. If it does not take a
  986.    value, a space is printed.
  987.    
  988.    Also, if you type ? in a switch field, switches that take values are
  989.    shown with a trailing colon; those that don't take values are shown
  990.    without one.
  991.      _________________________________________________________________
  992.    
  993.     1.5.2. Order and Effect of Switches
  994.     
  995.    The order of switches should not matter, except that they are
  996.    evaluated from left to right, so if you give two switches with
  997.    opposite effects, the rightmost one is used:
  998.    
  999.   send /text /binary oofa.zip                ; Sends oofa.zip in binary mode.
  1000.  
  1001.    Like other command fields, switches have no effect whatsoever until
  1002.    the command is entered (by pressing the Return or Enter key). Even
  1003.    then, switches affect only the command with which they are included;
  1004.    they do not have global effect or side effects.
  1005.      _________________________________________________________________
  1006.    
  1007.     1.5.3. Distinguishing Switches from Other Fields
  1008.     
  1009.    All switches are optional. A command that uses switches lets you give
  1010.    any number of them, including none at all. Example:
  1011.    
  1012.   send /binary oofa.zip
  1013.   send /bin /delete oofa.zip
  1014.   send /bin /as-name:mupeen.zip oofa.zip
  1015.   send oofa.zip
  1016.  
  1017.    But how does Kermit know when the first "non-switch" is given? It has
  1018.    been told to look for both a switch and for something else, the data
  1019.    type of the next field (filename, number, etc). In most cases, this
  1020.    works well. But conflicts are not impossible. Suppose, for example, in
  1021.    UNIX there was a file named "text" in the top-level directory. The
  1022.    command to send it would be:
  1023.    
  1024.   send /text
  1025.  
  1026.    But C-Kermit would think this was the "/text" switch. To resolve the
  1027.    conflict, use braces:
  1028.    
  1029.   send {/text}
  1030.  
  1031.    or other circumlocutions such as "send //text", "send /./text", etc.
  1032.    
  1033.    The opposite problem can occur if you give an illegal switch that
  1034.    happens to match a directory name. For example:
  1035.    
  1036.   send /f oofa.txt
  1037.  
  1038.    There is no "/f" switch (there are several switches that begin with
  1039.    "/f", so "/f" is ambiguous). Now suppose there is an "f" directory in
  1040.    the root directory; then this command would be interpreted as:
  1041.    
  1042.      Send all the files in the "/f" directory, giving each one an
  1043.      as-name of "oofa.txt".
  1044.      
  1045.    This could be a mistake, or it could be exactly what you intended;
  1046.    C-Kermit has no way of telling the difference. To avoid situations
  1047.    like this, spell switches out in full until you are comfortable enough
  1048.    with them to know the minimum abbreviation for each one. Hint: use ?
  1049.    and completion while typing switches to obtain the necessary feedback.
  1050.      _________________________________________________________________
  1051.    
  1052.     1.5.4. Standard File Selection Switches
  1053.     
  1054.    The following switches are used on different file-oriented commands
  1055.    (such as SEND, DIRECTORY, DELETE, PURGE) to refine the selection of
  1056.    files that match the given specification.
  1057.    
  1058.    /AFTER:date-time
  1059.           Select only those files having a date-time later than the one
  1060.           given. See [354]Section 1.6 for date-time formats. Synonym:
  1061.           /SINCE.
  1062.           
  1063.    /NOT-AFTER:date-time
  1064.           Select only those files having a date-time not later than (i.e.
  1065.           earlier or equal to) the one given. Synonym: /NOT-SINCE.
  1066.           
  1067.    /BEFORE:date-time
  1068.           Select only those files having a date-time earlier than the one
  1069.           given.
  1070.           
  1071.    /NOT-BEFORE:date-time
  1072.           Select only those files having a date-time not earlier than
  1073.           (i.e. later or equal to) the one given.
  1074.           
  1075.    /DOTFILES
  1076.           UNIX and OS-9 only: The filespec is allowed to match files
  1077.           whose names start with (dot) period. Normally these files are
  1078.           not shown.
  1079.           
  1080.    /NODOTFILES
  1081.           (UNIX and OS-9 only) Don't show files whose names start with
  1082.           dot (period). This is the opposite of /DOTFILES, and is the
  1083.           default. Note that when a directory name starts with a period,
  1084.           the directory and (in recursive operations) all its
  1085.           subdirectories are skipped.
  1086.           
  1087.    /LARGER-THAN:number
  1088.           Only select files larger than the given number of bytes.
  1089.           
  1090.    /SMALLER-THAN:number
  1091.           Only select files smaller than the given number of bytes.
  1092.           
  1093.    /EXCEPT:pattern
  1094.           Specifies that any files whose names match the pattern, which
  1095.           can be a regular filename, or may contain "*" and/or "?"
  1096.           metacharacters (wildcards), are not to be selected. Example:
  1097.           
  1098.   send /except:*.log *.*
  1099.  
  1100.           sends all files in the current directory except those with a
  1101.           filetype of ".log". Another:
  1102.           
  1103.   send /except:*.~*~ *.*
  1104.  
  1105.           sends all files except the ones that look like Kermit or EMACS
  1106.           backup files (such as "oofa.txt.~17~") (of course you can also
  1107.           use the /NOBACKUP switch for this).
  1108.           
  1109.           The pattern matcher is the same one used by IF MATCH string
  1110.           pattern ([355]Section 7.4), so you can test your patterns using
  1111.           IF MATCH. If you need to match a literal * or ? (etc), precede
  1112.           it by a backslash (\). If the pattern contains any spaces, it
  1113.           must be enclosed in braces:
  1114.           
  1115.   send /except:{Foo bar} *.*
  1116.  
  1117.           The pattern can also be a list of up to 8 patterns. In this
  1118.           case, the entire pattern must be enclosed in braces, and each
  1119.           sub-pattern must also be enclosed in braces; this eliminates
  1120.           the need for designating a separator character, which is likely
  1121.           to also be a legal filename character on some platform or
  1122.           other, and therefore a source of confusion. You may include
  1123.           spaces between the subpatterns but they are not necessary. The
  1124.           following two commands are equivalent:
  1125.           
  1126.   send /except:{{ck*.o} {ck*.c}} ck*.?
  1127.   send /except:{{ck*.o}{ck*.c}} ck*.?
  1128.  
  1129.           If a pattern is to include a literal brace character, precede
  1130.           it with "\". Also note the apparent conflict of this list
  1131.           format and the string-list format described in [356]Section
  1132.           4.9.1. In case you want to include a wildcard string-list with
  1133.           braces on its outer ends as an /EXCEPT: argument, do it like
  1134.           this:
  1135.           
  1136.   send /except:{{{ckuusr.c,ckuus2.c,ckuus6.c}}} ckuus*.c
  1137.      _________________________________________________________________
  1138.    
  1139.     1.5.5. Setting Preferences for Different Commands
  1140.     
  1141.    Certain oft-used commands offer lots of switches because different
  1142.    people have different requirements or preferences. For example, some
  1143.    people want to be able to delete files without having to watch a list
  1144.    of the deleted files scroll past, while others want to be prompted for
  1145.    permission to delete each file. Different people prefer different
  1146.    directory-listing styles. And so on. Such commands can be tailored
  1147.    with the SET OPTIONS command:
  1148.    
  1149.    SET OPTIONS command [ switch [ switch [ ... ] ] ]
  1150.           Sets each switch as the default for the given command,
  1151.           replacing the "factory default". Of course you can also
  1152.           override any defaults established by the SET OPTIONS command by
  1153.           including the relevant switches in the affected command any
  1154.           time you issue it.
  1155.           
  1156.    SHOW OPTIONS
  1157.           Lists the commands that allows option-setting, and the options
  1158.           currently in effect, if any, for each. Switches that have
  1159.           synonyms are shown under their primary name; for example. /LOG
  1160.           and /VERBOSE are shown as /LIST.
  1161.           
  1162.    Commands for which options may be set include DIRECTORY, DELETE,
  1163.    PURGE, and TYPE. Examples:
  1164.    
  1165.   SET OPTIONS DIRECTORY /PAGE /NOBACKUP /HEADING /SORT:DATE /REVERSE
  1166.   SET OPTIONS DELETE /LIST /NOHEADING /NOPAGE /NOASK /NODOTFILES
  1167.   SET OPTIONS TYPE /PAGE
  1168.  
  1169.    Not necessarily all of a command's switches can be set as options. For
  1170.    example, file selection switches, since these would normally be
  1171.    different for each command.
  1172.    
  1173.    Put the desired SET OPTIONS commands in your C-Kermit customization
  1174.    file for each command whose default switches you want to change every
  1175.    time you run C-Kermit.
  1176.      _________________________________________________________________
  1177.    
  1178.   1.6. Dates and Times
  1179.   
  1180.    Some commands and switches take date-time values, such as:
  1181.    
  1182.   send /after:{8-Feb-2000 10:28:01}
  1183.  
  1184.    Various date-time formats are acceptable. The rules for the date are:
  1185.    
  1186.      * The year must have 4 digits.
  1187.      * If the year comes first, the second field is the month.
  1188.      * The day, month, and year may be separated by spaces, /, -, or
  1189.        underscore.
  1190.      * The month may be numeric (1 = January) or spelled out or
  1191.        abbreviated in English.
  1192.        
  1193.    If the date-time string contains any spaces, it must be enclosed in
  1194.    braces. Examples of legal dates:
  1195.    
  1196.                            Interpretation:
  1197.   2000-Feb-8                8 February 2000
  1198.   {2000 Feb 8}              8 February 2000
  1199.   2000/Feb/8                8 February 2000
  1200.   2000_Feb_8                8 February 2000
  1201.   2000-2-8                  8 February 2000
  1202.   2000-02-08                8 February 2000
  1203.   8-Feb-2000                8 February 2000
  1204.   08-Feb-2000               8 February 2000
  1205.   12/25/2000                25 December 2000
  1206.   25/12/2000                25 December 2000
  1207.  
  1208.    The last two examples show that when the year comes last, and the
  1209.    month is given numerically, the order of the day and month doesn't
  1210.    matter as long as the day is 13 or greater (mm/dd/yyyy is commonly
  1211.    used in the USA, whereas dd/mm/yyyy is the norm in Europe). However:
  1212.    
  1213.   08/02/2000                Is ambiguous and therefore not accepted.
  1214.  
  1215.    If a date is given, the time is optional and defaults to 00:00:00. If
  1216.    the time is given with a date, it must follow the date, separated by
  1217.    space, /, -, or underscore, and with hours, minutes, and seconds
  1218.    separated by colon (:). Example:
  1219.    
  1220.   2000-Feb-8 10:28:01       Represents 8 February 2000, 10:28:01am
  1221.  
  1222.    If a date is not given, the current date is used and a time is
  1223.    required.
  1224.    
  1225.    Time format is hh:mm:ss or hh:mm or hh in 24-hour format, or followed
  1226.    by "am" or "pm" (or "AM" or "PM") to indicate morning or afternoon.
  1227.    Examples of times that are acceptable:
  1228.    
  1229.                            Interpretation:
  1230.   3:23:56                    3:23:56am
  1231.   3:23:56am                  3:23:56am
  1232.   3:23:56pm                  3:23:56pm = 15:23:56
  1233.  15:23:56                    3:23:56pm = 15:23:56
  1234.   3:23pm                     3:23:00pm = 15:23:00
  1235.   3:23PM                     3:23:00pm = 15:23:00
  1236.   3pm                        3:00:00pm = 15:00:00
  1237.  
  1238.    Examples of legal date-times:
  1239.    
  1240.   send /after:{8 Feb 2000 10:28:01}
  1241.   send /after:8_Feb_2000_10:28:01
  1242.   send /after:8-Feb-2000/10:28:01
  1243.   send /after:2000/02/08/10:28:01
  1244.   send /after:2000/02/08_10:28:01
  1245.   send /after:2000/02/08_10:28:01am
  1246.   send /after:2000/02/08_10:28:01pm
  1247.   send /after:2000/02/08_10:28pm
  1248.   send /after:2000/02/08_10pm
  1249.   send /after:10:00:00pm
  1250.   send /after:10:00pm
  1251.   send /after:10pm
  1252.   send /after:22
  1253.  
  1254.    Finally, there is a special all-numeric format you can use:
  1255.    
  1256.   yyyymmdd hh:mm:ss
  1257.  
  1258.    For example:
  1259.    
  1260.   20000208 10:28:01
  1261.  
  1262.    This is Kermit's standard date-time format (based on ISO 8601), and is
  1263.    accepted (among other formats) by any command or switch that requires
  1264.    a date-time, and is output by any function whose result is a calendar
  1265.    date-time.
  1266.    
  1267.    There are no optional parts to this format and it must be exactly 17
  1268.    characters long, punctuated as shown (except you can substitute
  1269.    underscore for space in contexts where a single "word" is required).
  1270.    The time is in 24-hour format (23:00:00 is 11:00pm). This is the
  1271.    format returned by \fdate(filename), so you can also use constructions
  1272.    like this:
  1273.    
  1274.   send /after:\fdate(oofa.txt)
  1275.  
  1276.    which means "all files newer than oofa.txt".
  1277.    
  1278.    Besides explicit dates, you can also use the any of the following
  1279.    shortcuts:
  1280.    
  1281.    TODAY
  1282.           Stands for the current date at 00:00:00.
  1283.           
  1284.    TODAY 12:34:56
  1285.           Stands for the current date at the given time.
  1286.           
  1287.    YESTERDAY
  1288.           Stands for yesterday's date at 00:00:00. A time may also be
  1289.           given.
  1290.           
  1291.    TOMORROW
  1292.           Stands for tomorrow's date at 00:00:00. A time may also be
  1293.           given.
  1294.           
  1295.    + number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
  1296.           Is replaced by the future date indicated, relative to the
  1297.           current date. If the time is omitted, 00:00:00 is used.
  1298.           Examples: +3days, +2weeks, +1year, +37months.
  1299.           
  1300.    - number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
  1301.           
  1302.           Is replaced by the past date indicated, relative to the current
  1303.           date. If the time is omitted, 00:00:00 is used.
  1304.           
  1305.    The time can be separated from the date shortcut by any of the same
  1306.    separators that are allowed for explicit date-times: space, hyphen,
  1307.    slash, period, or underscore. In switches and other space-delimited
  1308.    fields, use non-spaces to separate date/time fields, or enclose the
  1309.    date-time in braces, e.g.:
  1310.    
  1311.   purge /before:-4days_12:00:00
  1312.   purge /before:{- 4 days 12:00:00}
  1313.  
  1314.    Of course you can also use variables:
  1315.    
  1316.   define \%n 43
  1317.   purge /before:-\%ndays_12:00:00
  1318.  
  1319.    Shortcut names can be abbreviated to any length that still
  1320.    distinguishes them from any other name that can appear in the same
  1321.    context, e.g. "TOD" for today, "Y" for yesterday. Also, the special
  1322.    abbreviation "wks" is accepted for WEEKS, and "yrs" for "YEARS".
  1323.    
  1324.    (To see how to specify dates relative to a specific date, rather than
  1325.    the current one, see the [357]\fmjd() function description below.)
  1326.    
  1327.    You can check date formats with the DATE command. DATE by itself
  1328.    prints the current date and time in standard format: yyyymmdd
  1329.    hh:mm:ss. DATE followed by a date and/or time (including shortcuts)
  1330.    converts it to standard format if it can understand it, otherwise it
  1331.    prints an error message.
  1332.    
  1333.    The following variables and functions deal with dates and times; any
  1334.    function argument designated as "date-time" can be in any of the
  1335.    formats described above.
  1336.    
  1337.    \v(day)
  1338.           The first three letters of the English word for the current day
  1339.           of the week, e.g. "Wed".
  1340.           
  1341.    \fday(date-time)
  1342.           The first three letters of the English word for day of the week
  1343.           of the given date. If a time is included, it is ignored.
  1344.           Example: \fday(8 Feb 1988) = "Mon".
  1345.           
  1346.    \v(nday)
  1347.           The numeric day of the week: 0 = Sunday, 1 = Monday, ..., 6 =
  1348.           Saturday.
  1349.           
  1350.    \fnday(date-time)
  1351.           The numeric day of the week for the given date. If a time is
  1352.           included, it is ignored. Example: \fnday(8 Feb 1988) = "1".
  1353.           
  1354.    \v(date)
  1355.           The current date as dd mmm yyyy, e.g. "08 Feb 2000" (as in this
  1356.           example, a leading zero is supplied for day-of-month less than
  1357.           10).
  1358.           
  1359.    \v(ndate)
  1360.           The current date in numeric format: yyyymmdd, e.g. "20000208".
  1361.           
  1362.    \v(time)
  1363.           The current time as hh:mm:ss, e.g. "15:27:14".
  1364.           
  1365.    \ftime(time)
  1366.           The given free-format date and/or time (e.g. "3pm") returns the
  1367.           time (without the date) converted to hh:mm:ss 24-hour format,
  1368.           e.g. "15:00:00" (the date, if given, is ignored).
  1369.           
  1370.    \v(ntime)
  1371.           The current time as seconds since midnight, e.g. "55634".
  1372.           
  1373.    \v(tftime)
  1374.           The elapsed time of the most recent file-transfer operation in
  1375.           seconds.
  1376.           
  1377.    \v(intime)
  1378.           The elapsed time for the most recent INPUT command to complete,
  1379.           in milliseconds.
  1380.           
  1381.    \fntime(time)
  1382.           The given free-format date and/or time is converted to seconds
  1383.           since midnight (the date, if given, is ignored). This function
  1384.           replaces \ftod2secs(), which is now a synonym for \fntime().
  1385.           Unlike \ftod2secs(), \fntime() allows a date to be included,
  1386.           and it allows the time to be in free format (like 3pm), and it
  1387.           allows the amount of time to be more than 24 hours. E.g.
  1388.           \fntime(48:00:00) = 172800. Example of use:
  1389.           
  1390.  
  1391.   set alarm \fntime(48:00:00) ; set alarm 48 hours from now.
  1392.  
  1393.    \fn2time(seconds)
  1394.           The given number of seconds is converted to hh:mm:ss format.
  1395.           
  1396.    \fdate(filename)
  1397.           Returns the modification date-time of the given file in
  1398.           standard format: yyyymmdd hh:mm:ss.
  1399.           
  1400.    \fcvtdate(date-time)
  1401.           Converts a free-format date and/or time to Kermit standard
  1402.           format: yyyymmdd hh:mm:ss. If no argument is given, returns the
  1403.           current date-time in standard format. If a date is given but no
  1404.           time, the converted date is returned with a time of 00:00:00.
  1405.           If a time is given with no date, the current date is supplied.
  1406.           Examples:
  1407.           
  1408.  
  1409.   \fcvtdate(4 Jul 2000 2:21:17pm) = 20000704 14:21:17
  1410.   \fcvtdate() = 20000704 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
  1411.   \fcvtd(4 Jul 2000) = 20000704 00:00:00
  1412.   \fcvtd(6pm) = 20000704 18:00:00 (on 4 Jul 2000 at 6:00pm).
  1413.  
  1414.    \fdayofyear(date-time)
  1415.           
  1416.    \fdoy(date-time)
  1417.           Converts a free-format date and/or time to yyyyddd, where ddd
  1418.           is the 3-digit day of the year, and 1 January is Day 1. If a
  1419.           time is included with the date, it is returned in standard
  1420.           format. If a date is included but no time, the date is returned
  1421.           without a time. If a time is given with no date, the time is
  1422.           converted and the current date is supplied. If no argument is
  1423.           given, the current date-time is returned. Synonym: \fdoy().
  1424.           Examples:
  1425.           
  1426.   \fddayofyear(4 Jul 2000 2:21:17pm) = 2000185 14:21:17
  1427.   \fdoy() = 2000185 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
  1428.   \fdoy(4 Jul 2000) = 2000185
  1429.   \fdoy(6pm) = 2000185 18:00:00 (on 4 Jul 2000 at 6:00pm).
  1430.  
  1431.    Note: The yyyyddd day-of-year format is often erroneously referred to
  1432.    as a Julian date. However, a true Julian date is a simple counting
  1433.    number, the number of days since a certain fixed day in the past.
  1434.    [358]See \fmjd() below.
  1435.    
  1436.    \fdoy2date(date-time)
  1437.           Converts a date or date-time in day-of-year format to a
  1438.           standard format date. A yyyyddd-format date must be supplied;
  1439.           time is optional. The given date is converted to yyyymmdd
  1440.           format. If a time is given, it is converted to 24-hour format.
  1441.           Examples:
  1442.           
  1443.   \fdoy2date(2000185) = 20000704
  1444.   \fdoy2(2000185 3pm) = 20000704 15:00:00
  1445.  
  1446.    \fmjd(date-time)
  1447.           Converts free-format date and/or time to a Modified Julian Date
  1448.           (MJD), the number of days since 17 Nov 1858 00:00:00. If a time
  1449.           is given, it is ignored. Examples:
  1450.           
  1451.   \fmjd(4 Jul 2000) = 50998
  1452.   \fmjd(17 Nov 1858) = 0
  1453.   \fmjd(16 Nov 1858) = -1
  1454.  
  1455.    \fmjd2date(mjd)
  1456.           Converts an MJD (integer) to standard date format, yyyymmdd:
  1457.           
  1458.   \fmjd2(50998) = 4 Jul 1998
  1459.   \fmjd2(0) = 17 Nov 1858
  1460.   \fmjd2(-1) = 16 Nov 1858
  1461.   \fmjd2(-365) = 17 Nov 1857
  1462.  
  1463.    MJDs are normal integers and, unlike DOYs, may be added, subtracted,
  1464.    etc, with each other or with other integers, to obtain meaningful
  1465.    results. For example, to find out the date 212 days ago:
  1466.    
  1467.   echo \fmjd2date(\fmjd()-212)
  1468.  
  1469.    Constructions such as this can be used in any command where a
  1470.    date-time is required, e.g.:
  1471.    
  1472.   send /after:\fmjd2date(\fmjd()-212)
  1473.  
  1474.    to send all files that are not older than 212 days (this is equivalent
  1475.    to "send /after:-212days").
  1476.    
  1477.    MJDs also have other regularities not exhibited by other date formats.
  1478.    For example, \fmodulus(\fmjd(any-date),7) gives the day of the week
  1479.    for any date (where 4=Sun, 5=Mon, ..., 3=Sat). (However, it is easier
  1480.    to use \fnday() for this purpose, and it gives the more conventional
  1481.    result of 0=Sun, 1=Mon, ..., 6=Sat).
  1482.    
  1483.    Note that if MJDs are to be compared, they must be compared
  1484.    numerically (IF <, =, >) and not lexically (IF LLT, EQUAL, LGT),
  1485.    whereas DOYs must be compared lexically if they include a time (which
  1486.    contains ":" characters); however, if DOYs do not include a time, they
  1487.    may also be compared numerically.
  1488.    
  1489.    In any case, lexical comparison of DOYs always produces the
  1490.    appropriate result, as does numeric comparison of MJDs.
  1491.    
  1492.    The same comments apply to sorting. Also note that DOYs are fixed
  1493.    length, but MJDs can vary in length. However, all MJDs between 3 April
  1494.    1886 and 30 Aug 2132 are 5 decimal digits long. (MJDs become 6 digits
  1495.    long on 31 Aug 2132, and 7 digits long on 13 Oct 4596).
  1496.      _________________________________________________________________
  1497.    
  1498.   1.7. Partial Completion of Keywords
  1499.   
  1500.    Partial completion of keywords was added in C-Kermit 7.0. In prior
  1501.    versions, if completion was attempted (by pressing the Esc or Tab key)
  1502.    on a string that matched different keywords, you'd just get a beep.
  1503.    Now Kermit completes up to the first character where the possibly
  1504.    matching keywords differ and then beeps. For example:
  1505.    
  1506.   C-Kermit> send /n<Tab>
  1507.  
  1508.    which matches /NOT-BEFORE and /NOT-AFTER, now completes up to the
  1509.    dash:
  1510.    
  1511.   C-Kermit> send /n<Tab>ot-<Beep>
  1512.  
  1513.    Partial completion works for filenames too (as it has for some years).
  1514.      _________________________________________________________________
  1515.    
  1516.   1.8. Command Recall
  1517.   
  1518.    C-Kermit has had a command history buffer for some time, which could
  1519.    be scrolled interactively using control characters or (in Kermit 95
  1520.    only) arrow keys. Version 7.0 adds a REDO command that allows the most
  1521.    recent command matching a given pattern to be re-executed:
  1522.    
  1523.    { REDO, RR, ^ } [ pattern ]
  1524.           Search the command history list for the most recent command
  1525.           that matches the given pattern, and if one is found, execute it
  1526.           again.
  1527.           
  1528.    The pattern can be a simple string (like "send"), in which case the
  1529.    last SEND command is re-executed. Or it can contain wildcard
  1530.    characters "*" and/or "?", which match any string and any single
  1531.    character, respectively (note that "?" must be preceded by backslash
  1532.    to override its normal function of giving help), and in most C-Kermit
  1533.    versions may also include [] character lists and {} string lists (see
  1534.    [359]Section 4.9).
  1535.    
  1536.    The match works by appending "*" to the end of the given pattern (if
  1537.    you didn't put one there yourself). Thus "redo *oofa" becomes "redo
  1538.    *oofa*" and therefore matches the most recent command that contains
  1539.    "oofa" anywhere within the command. If you want to inhibit the
  1540.    application of the trailing "*", e.g. to force matching a string at
  1541.    the end of a command, enclose the pattern in braces:
  1542.    
  1543.   redo {*oofa}
  1544.  
  1545.    matches the most recent command that ends with "oofa".
  1546.    
  1547.    REDO commands themselves are not entered into the command history
  1548.    list. If no pattern is given, the previous (non-REDO) command is
  1549.    re-executed. The REDOne command is reinserted at the end of the
  1550.    command history buffer, so the command scrollback character (Ctrl-P,
  1551.    Ctrl-B, or Uparrow) can retrieve it.
  1552.    
  1553.    Examples:
  1554.    
  1555.   C-Kermit> echo foo
  1556.   foo
  1557.   C-Kermit> show alarm
  1558.   (no alarm set)
  1559.   C-Kermit> echo blah
  1560.   blah
  1561.   C-Kermit> redo          ; Most recent command
  1562.   blah
  1563.   C-Kermit> redo s        ; Most recent command starting with "s"
  1564.   (no alarm set)
  1565.   C-Kermit> redo echo f   ; Most recent command starting with "echo f"
  1566.   foo
  1567.   C-Kermit> redo *foo     ; Most recent command that has "foo" in it
  1568.   foo
  1569.   C-Kermit> <Ctrl-P>      ; Scroll back
  1570.   C-Kermit> echo foo      ; The REDOne command is there
  1571.   C-Kermit> redo {*foo}   ; Most recent command that ends with "foo"
  1572.   foo
  1573.   C-Kermit>
  1574.  
  1575.    Since REDO, REDIAL, and REDIRECT all start the same way, and RED is
  1576.    the designated non-unique abbreviation for REDIAL, REDO must be
  1577.    spelled out in full. For convenience, RR is included as an invisible
  1578.    easy-to-type synonym for REDO. You can also use the "^" character for
  1579.    this:
  1580.    
  1581.   C-Kermit> ^             ; Most recent command
  1582.   C-Kermit> ^ s           ; Most recent command starting with "s"
  1583.   C-Kermit> ^s            ; Ditto (space not required after "^").
  1584.   C-Kermit> ^*foo         ; Most recent command that has "foo" in it.
  1585.   C-Kermit> ^{*foo}       ; Most recent command ends with "foo".
  1586.  
  1587.    Unlike the manual command-history-scrolling keys, the REDO command can
  1588.    be used in a script, but it's not recommended (since the command to be
  1589.    REDOne might not be found, so if the REDO command fails, you can't
  1590.    tell whether it was because REDO failed to find the requested command,
  1591.    or because the command was found but it failed).
  1592.      _________________________________________________________________
  1593.    
  1594.   1.9. EXIT Messages
  1595.   
  1596.    The EXIT and QUIT commands now accept an optional message to be
  1597.    printed. This makes the syntax of EXIT and QUIT just like END and
  1598.    STOP:
  1599.    
  1600.    { EXIT, QUIT, END, STOP } [ status-code [ message ] ]
  1601.    
  1602.    where status-code is a number (0 indicating success, nonzero
  1603.    indicating failure). This is handy in scripts that are never supposed
  1604.    to enter interactive mode:
  1605.    
  1606.   dial 7654321
  1607.   if fail exit 1 Can't make connection - try again later.
  1608.  
  1609.    Previously this could only be done in two steps:
  1610.    
  1611.   dial 7654321
  1612.   xif fail { echo Can't make connection - try again later, exit 1 }
  1613.  
  1614.    A status code must be included in order to specify a message. In the
  1615.    case of EXIT and QUIT, the default status code is contained in the
  1616.    variable \v(exitstatus), and is set automatically by various events
  1617.    (file transfer failures, etc; it can also be set explicitly with the
  1618.    SET EXIT STATUS command). If you want to give an EXIT or QUIT command
  1619.    with a message, but without changing the exit status from what it
  1620.    normally would have been, use the \v(exitstatus) variable, e.g.:
  1621.    
  1622.    exit \v(existatus) Goodbye from \v(cmdfile).
  1623.  
  1624.    The EXIT status is returned to the system shell or whatever other
  1625.    process invoked C-Kermit, e.g. in UNIX:
  1626.    
  1627.   C-Kermit> exit 97 bye bye
  1628.   bye bye
  1629.   $ echo $?
  1630.   97
  1631.   $
  1632.      _________________________________________________________________
  1633.    
  1634.   1.10. Managing Keyboard Interruptions
  1635.   
  1636.    When C-Kermit is in command or file-transfer mode (as opposed to
  1637.    CONNECT mode), it can be interrupted with Ctrl-C. Version 7.0 adds the
  1638.    ability to disarm the Ctrl-C interrupt:
  1639.    
  1640.    SET COMMAND INTERRUPT { ON, OFF }
  1641.           COMMAND INTERRUPT is ON by default, meaning the Ctrl-C can be
  1642.           used to interrupt a command or a file transfer in progress. Use
  1643.           OFF to disable these interruptions, and use it with great
  1644.           caution for obvious reasons.
  1645.           
  1646.    SET TRANSFER INTERRUPT { ON, OFF }
  1647.           This can be used to disable keyboard interruption of file
  1648.           transfer when C-Kermit is in local mode, or to re-enable it
  1649.           after it has been disabled. This applies to the X, Z, E, and
  1650.           similar keys as well as to the system interrupt character,
  1651.           usually Ctrl-C. This is distinct from SET TRANSFER
  1652.           CANCELLATION, which tells whether packet mode can be exited by
  1653.           sending a special sequence of characters.
  1654.           
  1655.    Several other commands can be interrupted by pressing any key while
  1656.    they are active. Version 7.0 adds the ability to disable this form of
  1657.    interruption also:
  1658.    
  1659.    SET INPUT CANCELLATION { ON, OFF }
  1660.           Whether an INPUT command in progress can be interrupted by
  1661.           pressing a key. Normally ON. Setting INPUT CANCELLATION OFF
  1662.           makes INPUT commands uninterruptible except by Ctrl-C (unless
  1663.           COMMAND INTERRUPTION is also OFF).
  1664.           
  1665.    SET SLEEP CANCELLATION { ON, OFF }
  1666.           Whether a SLEEP, PAUSE, or WAIT command in progress can be
  1667.           interrupted by pressing a key. Normally ON. Setting SLEEP
  1668.           CANCELLATION OFF makes these commands uninterruptible except by
  1669.           Ctrl-C (unless COMMAND INTERRUPTION is also OFF). Synonyms: SET
  1670.           PAUSE CANCELLATION, SET WAIT CANCELLATION.
  1671.           
  1672.    So to make certain a script is not interruptible by the user, include
  1673.    these commands:
  1674.    
  1675.   SET TRANSFER INTERRUPT OFF
  1676.   SET SLEEP CANCELLATION OFF
  1677.   SET INPUT CANCELLATION OFF
  1678.   SET COMMAND INTERRUPTION OFF
  1679.  
  1680.    Make sure to turn them back on afterwards if interruption is to be
  1681.    re-enabled.
  1682.    
  1683.    When a PAUSE, SLEEP, WAIT, or INPUT command is interrupted from the
  1684.    keyboard, the new variable \v(kbchar) contains a copy of the (first)
  1685.    character that was typed and caused the interruption, provided it was
  1686.    not the command interrupt character (usually Ctrl-C). If these
  1687.    commands complete successfully or time out without a keyboard
  1688.    interruption, the \v(kbchar) variable is empty.
  1689.    
  1690.    The \v(kbchar) variable (like any other variable) can be tested with:
  1691.    
  1692.   if defined \v(kbchar) command
  1693.  
  1694.    The command is executed if the variable is not empty.
  1695.    
  1696.    The \v(kbchar) variable can be reset with WAIT 0 (PAUSE 0, SLEEP 0,
  1697.    etc).
  1698.      _________________________________________________________________
  1699.    
  1700.   1.11. Taming The Wild Backslash -- Part Deux
  1701.   
  1702.    [360]Using C-Kermit, 2nd Edition, contains a brief section, "Taming
  1703.    the Wild Backslash", on page 48, which subsequent experience has shown
  1704.    to be inadequate for Kermit users intent on writing scripts that deal
  1705.    with Windows, DOS, and OS/2 filenames, in which backslash (\) is used
  1706.    as the directory separator. This section fills in the blanks.
  1707.    
  1708.     1.11.1. Background
  1709.     
  1710.    The Kermit command language shares a certain unavoidable but annoying
  1711.    characteristic with most other command languages that are capable of
  1712.    string replacement, namely the necessity to "quote" certain characters
  1713.    when you want them to be taken literally. This is a consequence of the
  1714.    facts that:
  1715.    
  1716.     1. One or more characters must be set aside to denote replacement,
  1717.        rather than acting as literal text.
  1718.     2. We have only 96 printable characters to work with in ASCII, which
  1719.        is still the only universally portable character set.
  1720.     3. There is no single printable character that is unused everywhere.
  1721.     4. Variables are not restricted to certain contexts, as they are in
  1722.        formal programming languages like C and Fortran, but can appear
  1723.        anywhere at all within a command, and therefore require special
  1724.        syntax.
  1725.        
  1726.    Thus there can be conflicts. To illustrate, the standard UNIX shell
  1727.    uses dollar sign ($) to introduce variables. So the shell command:
  1728.    
  1729.   echo $TERM
  1730.  
  1731.    displays the value of the TERM variable, e.g. vt320. But suppose you
  1732.    want to display a real dollar sign:
  1733.    
  1734.   echo The price is $10.20
  1735.  
  1736.    This causes the shell to evaluate the variable "$1", which might or
  1737.    might not exist, and substitute its value, e.g.:
  1738.    
  1739.   The price is 0.20
  1740.  
  1741.    (in this case the $1 variable had no value.) This is probably not what
  1742.    you wanted. To force the dollar sign to be taken literally, you must
  1743.    apply a "quoting rule", such as "precede a character by backslash (\)
  1744.    to force the shell to take the character literally":
  1745.    
  1746.   echo The price is \$10.20
  1747.   The price is $10.20
  1748.  
  1749.    But now suppose you want the backslash AND the dollar sign to be taken
  1750.    literally:
  1751.    
  1752.   echo The price is \\$10.20
  1753.  
  1754.    This doesn't work, since the first backslash quotes the second one,
  1755.    thereby leaving the dollar sign unquoted again:
  1756.    
  1757.   The price is \0.20
  1758.  
  1759.    Quoting the dollar sign requires addition of a third backslash:
  1760.    
  1761.   echo The price is \\\$10.20
  1762.   The price is \$10.20
  1763.  
  1764.    The first backslash quotes the second one, and the third backslash
  1765.    quotes the dollar sign.
  1766.    
  1767.    Every command language -- all UNIX shells, VMS DCL, DOS Batch, AOS/VS
  1768.    CLI, etc etc -- has similar rules. UNIX shell rules are probably the
  1769.    most complicated, since many printable characters -- not just one --
  1770.    are special there: dollar sign, single quote, double quote, backslash,
  1771.    asterisk, accent grave, number sign, ampersand, question mark,
  1772.    parentheses, brackets, braces, etc -- practically every
  1773.    non-alphanumeric character needs some form of quoting if it is to be
  1774.    taken literally. And to add to the confusion, the UNIX shell offers
  1775.    many forms of quoting, and many alternative UNIX shells are available,
  1776.    each using slightly different syntax.
  1777.      _________________________________________________________________
  1778.    
  1779.     1.11.2. Kermit's Quoting Rules
  1780.     
  1781.    Kermit's basic quoting rules are simple by comparison (there are, of
  1782.    course, additional syntax requirements for macro definitions, command
  1783.    blocks, function calls, etc, but they are not relevant here).
  1784.    
  1785.    The following characters are special in Kermit commands:
  1786.    
  1787.    Backslash (\)
  1788.           Introduces a variable, or the numeric representation of a
  1789.           special character, or a function, or other item for
  1790.           substitution. If the backslash is followed by a digit or by any
  1791.           of the following characters:
  1792.           
  1793.   x, o, d, m, s, f, v, $, %, &, :, {
  1794.  
  1795.           this indicates a special substitution item; otherwise the
  1796.           following character is to be taken literally (exceptions: \ at
  1797.           end of line is taken literally; \n, \b, and \n are special
  1798.           items in the OUTPUT command only).
  1799.           
  1800.    Semicolon (;)
  1801.           (Only when at the beginning of a line or preceded by at least
  1802.           one space or tab) Introduces a comment.
  1803.           
  1804.    Number sign (#)
  1805.           (Only when at the beginning of a line or preceded by at least
  1806.           one space or tab) Just like semicolon; introduces a comment.
  1807.           
  1808.    Question mark (?)
  1809.           (Only at the command prompt - not in command files or macros)
  1810.           Requests context-sensitive help.
  1811.           
  1812.    To force Kermit to take any of these characters literally, simply
  1813.    precede it by a backslash (\).
  1814.    
  1815.    Sounds easy! And it is, except when backslash also has a special
  1816.    meaning to the underlying operating system, as it does in DOS,
  1817.    Windows, and OS/2, where it serves as the directory separator in
  1818.    filenames such as:
  1819.    
  1820.   D:\K95\KEYMAPS\READ.ME
  1821.  
  1822.    Using our rule, we would need to refer to this file in Kermit commands
  1823.    as follows:
  1824.    
  1825.   D:\\K95\\KEYMAPS\\READ.ME
  1826.  
  1827.    But this would not be obvious to new users of Kermit software on DOS,
  1828.    Windows, or OS/2, and it would be annoying to seasoned ones. Thus
  1829.    MS-DOS Kermit and Kermit 95 go to rather extreme lengths to allow the
  1830.    more natural notation, as in:
  1831.    
  1832.   send d:\k95\keymaps\read.me
  1833.  
  1834.    The reason this is tricky is that we also need to allow for variables
  1835.    and other expressions introduced by backslash in the same command. For
  1836.    example, suppose \%a is a variable whose value is "oofa" (without the
  1837.    quotes). What does the following command do?
  1838.    
  1839.   send d:\%a
  1840.  
  1841.    Does it send the file named "oofa" in the current directory of the D:
  1842.    disk, or does it send a file named "%a" in the root directory of the
  1843.    D: disk? This is the kind of trouble we get into when we attempt to
  1844.    bend the rules in the interest of user friendliness. (The answer is:
  1845.    if the variable \%a has definition that is the name of an existing
  1846.    file, that file is sent; if a file d:\%a exists, it is sent; otherwise
  1847.    if both conditions are true, the variable takes precedence, and the
  1848.    literal filename can be forced by quoting: \\%a.)
  1849.    
  1850.    In Kermit 95 (but not MS-DOS Kermit), we also bend the rules another
  1851.    way by allowing you to use forward slash (/) rather than backslash (\)
  1852.    as the directory separator:
  1853.    
  1854.   send d:/k95/keymaps/read.me
  1855.  
  1856.    This looks more natural to UNIX users, and in fact is perfectly
  1857.    acceptable to the Windows 95/98/NT and OS/2 operating systems on the
  1858.    API level. BUT (there is always a "but") the Microsoft shell,
  1859.    COMMAND.COM, for Windows 95/98 and NT does not allow this notation,
  1860.    and therefore it can not be used in any Kermit command -- such as RUN
  1861.    -- that invokes the Windows command shell AND your command shell is
  1862.    COMMAND.COM or any other shell that does not allow forward slash as
  1863.    directory separator (some alternative shells do allow this).
  1864.    
  1865.      NOTE: There exists a wide variety of alternative shells from third
  1866.      parties that do not have this restriction. If you are using a shell
  1867.      that accepts forward slash as a directory separator, you can stop
  1868.      reading right now -- UNLESS (there is always an "unless") you want
  1869.      your scripts to be portable to systems that have other shells. Also
  1870.      note that some Windows shells might actually REQUIRE forward
  1871.      slashes (instead of backslashes) as directory separators; we do not
  1872.      treat this situation below, but the treatment is obvious -- use
  1873.      slash rather backslash as the directory separator.
  1874.      _________________________________________________________________
  1875.    
  1876.     1.11.3. Passing DOS Filenames from Kermit to Shell Commands
  1877.     
  1878.    The following Kermit commands invoke the system command shell:
  1879.    
  1880.   RUN (and its synonyms ! and @)
  1881.   REDIRECT
  1882.   PIPE
  1883.  
  1884.    Each of these commands takes a shell command as an operand. These
  1885.    shell commands are not, and can not be, parsed by Kermit since Kermit
  1886.    does not know the syntax of shell commands, and so can't tell the
  1887.    difference between a keyword, a filename, a variable, a switch, or
  1888.    other item. Therefore the rules can not be bent since Kermit doesn't
  1889.    know where or how to bend them. To illustrate (using the regular
  1890.    Windows shell):
  1891.    
  1892.   run c:\\windows\\command\\chkdsk.exe
  1893.  
  1894.    works OK, but:
  1895.    
  1896.   run c:/windows/command/chkdsk.exe
  1897.  
  1898.    is not accepted by COMMAND.COM. But:
  1899.    
  1900.   run c:\windows\command\chkdsk.exe
  1901.  
  1902.    results in Kermit applying its quoting rules before sending the text
  1903.    to the shell. Since "w" and "c" are not in the list of backslash-item
  1904.    codes, the backslash means "take the following character literally".
  1905.    Thus, by the time this filename gets to the Windows shell, it has
  1906.    become:
  1907.    
  1908.   c:windowscommandchkdsk.exe
  1909.  
  1910.    which is probably not what you wanted. (If "w" and "c" were in the
  1911.    list, the results could be even stranger.) Even more confusing is the
  1912.    case where a directory or filename starts with one or more digits:
  1913.    
  1914.   run c:\123\lotus.exe
  1915.  
  1916.    in which "\123" is the Kermit notation for ASCII character 123, which
  1917.    happens to be left brace ({), resulting in "c:{lotus.exe".
  1918.    
  1919.    So when passing filenames to a Windows shell, always use double
  1920.    backslashes as directory separators, to ensure that the shell gets
  1921.    single backslashes:
  1922.    
  1923.   run c:\\windows\\command\\chkdsk.exe
  1924.   run c:\\123\\lotus.exe
  1925.  
  1926.    Similar problems might occur with the built-in EDIT, BROWSE, and FTP
  1927.    commands. These commands result in Kermit building a shell command
  1928.    internally to invoke the associated helper program; the form of this
  1929.    command might conflict with the form demanded by certain alternative
  1930.    shells.
  1931.      _________________________________________________________________
  1932.    
  1933.     1.11.4. Using Variables to Hold DOS Filenames
  1934.     
  1935.    Now to the next level. Suppose you want to write a script in which
  1936.    filenames are parameters, and therefore are stored in variables.
  1937.    Example:
  1938.    
  1939.   define \%f c:\windows\command\chkdsk.exe
  1940.   ...
  1941.   run \%f
  1942.  
  1943.    Obviously this won't work for the reasons just noted; the RUN command
  1944.    requires directory separators be coded as double backslashes:
  1945.    
  1946.   define \%f c:\\windows\\command\\chkdsk.exe
  1947.   ...
  1948.   run \%f
  1949.  
  1950.    This will work; no surprises here. However, if you had used ASSIGN
  1951.    rather than DEFINE, you might have been surprised after all; review
  1952.    pages 348-349 of [361]Using C-Kermit (2nd Ed) for the difference
  1953.    between DEFINE and ASSIGN.
  1954.    
  1955.    We have said that any Kermit 95 or MS-DOS Kermit command that parses
  1956.    filenames itself -- SEND, for example -- does not require double
  1957.    backslashes since it knows it is parsing a filename. So since the
  1958.    following works:
  1959.    
  1960.   send c:\windows\command\chkdsk.exe
  1961.  
  1962.    Should the following also work?
  1963.    
  1964.   define \%f c:\windows\command\chkdsk.exe
  1965.   ...
  1966.   send \%f
  1967.  
  1968.    Answer: No. Why? Because \%f is evaluated "recursively", to allow for
  1969.    the possibility that its definition contains further variable
  1970.    references. This is true of all "backslash-percent-letter" (or -digit)
  1971.    variables, and also for array references. So \%f becomes
  1972.    c:\windows\command\chkdsk.exe, which becomes
  1973.    c:windowscommandchkdsk.exe.
  1974.    
  1975.    The trick here is to use the "other" kind of variable, that is
  1976.    evaluated only "one level deep" rather than recursively:
  1977.    
  1978.   define filename c:\windows\command\chkdsk.exe
  1979.   ...
  1980.   send \m(filename)
  1981.  
  1982.    Similarly if you want to prompt the user for a filename:
  1983.    
  1984.   ask filename { Please type a filename: }
  1985.    Please type a filename: c:\windows\command\chkdsk.exe
  1986.   send \m(filename)
  1987.      _________________________________________________________________
  1988.    
  1989.     1.11.5. Passing DOS Filenames as Parameters to Macros
  1990.     
  1991.    Suppose you want to pass a DOS filename containing backslashes as a
  1992.    parameter to a Kermit macro. This raises two issues:
  1993.    
  1994.     1. Parameters to macros are "just text" and so are fully evaluated
  1995.        before they are passed to the macro.
  1996.     2. Once inside the macro, the formal parameters \%1, \%2, ... \%9 are
  1997.        the type of variable that is evaluated recursively.
  1998.        
  1999.    Thus a DOS filename is ruined once in the act of parsing the macro
  2000.    invocation, and again when referring to it from within the macro. To
  2001.    illustrate, suppose "test" is a macro. Then in the invocation:
  2002.    
  2003.   test c:\mydir\blah.txt
  2004.  
  2005.    "c:mydirblah.txt" is assigned to \%1. However, if we double the
  2006.    backslashes:
  2007.    
  2008.   test c:\\mydir\\blah.txt
  2009.  
  2010.    "c:\mydir\blah.txt" is assigned to \%1. But then when you refer to \%1
  2011.    in the macro, it is evaluated recursively, resulting in
  2012.    "c:mydirblah.txt". To illustrate:
  2013.    
  2014.   define test echo \%1
  2015.   test c:\mydir\blah.txt
  2016.   c:mydirblah.txt
  2017.   test c:\\mydir\\blah.txt
  2018.   c:mydirblah.txt
  2019.   test c:\\\\mydir\\\\blah.txt
  2020.   c:\mydir\blah.txt
  2021.  
  2022.    Let's address each part of the problem separately. First, inside the
  2023.    macro. You can use the \fcontents() function to force a
  2024.    backslash-percent variable (such as a macro argument) to be evaluated
  2025.    one level deep instead of recursively, for example:
  2026.    
  2027.   define test echo { The filename is "\fcontents(\%1)"}
  2028.  
  2029.   test c:\mydir\blah.txt               ; We don't expect this to work
  2030.    The filename is "c:mydirblah.txt"   ; and it doesn't.
  2031.   test c:\\mydir\\blah.txt             ; But this does...
  2032.    The filename is "c:\mydir\blah.txt"
  2033.  
  2034.    Thus if the filename arrives inside the macro with single backslashes,
  2035.    the backslashes are preserved if you always refer to the parameter
  2036.    through the \fcontents() function.
  2037.    
  2038.    Now how to ensure that backslashes are not stripped or misinterpreted
  2039.    when passing a filename to a macro? This brings us back to what we
  2040.    learned in earlier sections:
  2041.    
  2042.     1. If it is a literal filename, either double the backslashes, or (if
  2043.        the filename is to be used only within Kermit itself and not
  2044.        passed to a DOS shell, or it is to be passed to an alternative
  2045.        shell that accepts forward slash as a directory separator), use
  2046.        forward slash instead of backslash as the directory separator.
  2047.     2. If it is a variable that contains a filename, make sure you use a
  2048.        macro-style variable name, rather than a
  2049.        backslash-percent-character name.
  2050.        
  2051.    Examples:
  2052.    
  2053.   define test echo \fcontents(\%1)
  2054.   define filename c:\mydir\blah.txt
  2055.  
  2056.   test c:\\mydir\\blah.txt  ; Literal filename with double backslashes
  2057.   c:\mydir\blah.txt
  2058.  
  2059.   test c:/mydir/blah.txt    ; Literal filename with forward slashes
  2060.   c:/mydir/blah.txt
  2061.  
  2062.   test \m(filename)         ; Variable
  2063.   c:\mydir\blah.txt
  2064.  
  2065.    But what if you don't like these rules and you still want to pass a
  2066.    literal filename containing single backslashes to a macro? This is
  2067.    possible too, but a bit tricky: turn command quoting off before
  2068.    invoking the macro, and then turn it back on inside the macro.
  2069.    Example:
  2070.    
  2071.   define test set command quoting on, echo \fcontents(\%1)
  2072.  
  2073.   set command quoting off
  2074.   test c:\mydir\blah.txt
  2075.   c:\mydir\blah.txt
  2076.  
  2077.    Upon return from the macro, command quoting is back on (since the
  2078.    macro turned it on).
  2079.    
  2080.    Obviously this trick can not be used if the filename is stored in a
  2081.    variable, since it prevents the variable from being evaluated.
  2082.      _________________________________________________________________
  2083.    
  2084.     1.11.6. Passing DOS File Names from Macro Parameters to the DOS Shell
  2085.     
  2086.    Now suppose you need to pass a DOS filename to a macro, and the macro
  2087.    needs to pass it, in turn, to the Windows shell via (say) Kermit's RUN
  2088.    command. This works too:
  2089.    
  2090.   define xrun run \fcontents(\%1)
  2091.   xrun c:\\windows\\command\\chkdsk.exe
  2092.  
  2093.    (or you can use the SET COMMAND QUOTING OFF / ON technique described
  2094.    above to avoid the double backslashes.) But..
  2095.    
  2096.   xrun c:/windows/command/chkdsk.exe
  2097.  
  2098.    does not work if the Windows shell does not recognize "/" as a
  2099.    directory separator. If there is a chance that a filename might be
  2100.    passed to the macro in this form, the macro will need to convert it to
  2101.    a form acceptable to the shell:
  2102.    
  2103.   define xrun run \freplace(\fcontents(\%1),/,\\)
  2104.  
  2105.    Here we replace all occurrences (if any) of "/" in the argument with
  2106.    "\" prior to issuing the RUN command. Of course, in order to specify
  2107.    "\" as a literal character in the \freplace() argument list, we have
  2108.    to double it.
  2109.      _________________________________________________________________
  2110.    
  2111.     1.11.7. Passing DOS Filenames to Kermit from the Shell
  2112.     
  2113.    As noted in the manual, the \&@[] array contains Kermit's command-line
  2114.    arguments. Suppose one of these arguments, say \&@[3], is a DOS
  2115.    filename such as C:\FOO\BAR\BAZ\OOFA.TXT. (Note: In C-Kermit 7.0 and
  2116.    K95 1.1.18 and later, command-line arguments after "=" or "--" are
  2117.    also available in the top-level \%1..9 variables; see [362]Section
  2118.    7.5.)
  2119.    
  2120.    Of course you can eliminate any problems by using forward slashes
  2121.    rather than backslashes in the filename, but sometimes this is not
  2122.    possible, as when the Kermit command line is being generated by
  2123.    another program than can only generate "native" format DOS filenames.
  2124.    
  2125.    As noted in the manual, "\%x" variables and \&x[] arrays are always
  2126.    evaluated "all the way" (recursively). If the contents of one of these
  2127.    variables contains backslashes, this causes another level of
  2128.    evaluation.
  2129.    
  2130.    There is another kind of variable, which is evaluated only "one level
  2131.    deep". You can use this to prevent interpretation of the backslashes
  2132.    in the filenames. Example:
  2133.    
  2134.   assign filename \fcontents(\&@[3])  ; Transfer contents
  2135.   ...
  2136.   send \m(filename)
  2137.  
  2138.    Or, more simply:
  2139.    
  2140.   send \fcontents(\&@[3])
  2141.      _________________________________________________________________
  2142.    
  2143.   1.12. Debugging
  2144.   
  2145.    The debug log is produced when you give a "log debug" command. This is
  2146.    normally done at the request of the Kermit help desk, for forwarding
  2147.    to the Kermit developers for analysis as a last resort in
  2148.    troubleshooting problems. (Last resort because it can grow quite huge
  2149.    in a very short time.) In cases where timing information is critical
  2150.    to understanding a problem, you can tell C-Kermit to put a timestamp
  2151.    on each debug log line by giving the command:
  2152.    
  2153.   SET DEBUG TIMESTAMP ON
  2154.  
  2155.    At any time before or after activating the debug log (SET DEBUG
  2156.    TIMESTAMP OFF turns off timestamping). Timestamps can be turned off
  2157.    and on as desired while logging. Obviously, they increase the size and
  2158.    growth rate of the log significantly, and so should be used sparingly.
  2159.    Timestamps are of the form hh:mm:ss.xxx, where .xxx is thousands of a
  2160.    second (but is included only on platforms that include this feature).
  2161.      _________________________________________________________________
  2162.    
  2163.   1.13. Logs
  2164.   
  2165.    In UNIX C-Kermit and in K-95, you can now direct any log to a pipe.
  2166.    This not only lets you send your logs to places other than disk files,
  2167.    but also lets you customize them to any desired degree.
  2168.    
  2169.    LOG { DEBUG, PACKETS, SESSION, TRANSACTION, CONNECTION } { file, pipe
  2170.           } ...
  2171.           A "pipe" is the name of a command, preceded by a vertical bar.
  2172.           If the pipe contains any spaces, it must be enclosed in braces.
  2173.           
  2174.    Here are some examples for UNIX (always remember the importance of
  2175.    getting the UNIX shell quoting rules right):
  2176.    
  2177.    LOG TRANSACTIONS |lpr
  2178.           This sends the transaction log to the default UNIX printer,
  2179.           rather than to a file (use "lp" rather than "lpr" if
  2180.           necessary).
  2181.           
  2182.    LOG TRANSACTIONS {| myfilter > t.log}
  2183.           For those who don't like the format of the transaction log, or
  2184.           want to extract certain information from it; write your own
  2185.           output filter.
  2186.           
  2187.    LOG SESSION {| lpr -Plaserwriter}
  2188.           This sends the session log to a specific UNIX printer, rather
  2189.           than to a file. Note the braces around the pipeline. These are
  2190.           required because it contains spaces.
  2191.           
  2192.    LOG DEBUG {| tail -100 > debug.log}
  2193.           This causes the debug log file to contain only the final 100
  2194.           lines. Suppose C-Kermit crashes under some unpredictable
  2195.           circumstances, and you need a debug log to catch it in the act.
  2196.           But the debug log can grow to huge proportions very quickly,
  2197.           possibly filling up the disk. Piping the debug log through
  2198.           "tail" results in keeping only the last 100 lines (or other
  2199.           number of your choice).
  2200.           
  2201.    LOG DEBUG {| grep "^TELNET" > debug.log}
  2202.           This one shows how to log only Telnet negotiations. Piping the
  2203.           debug log through grep or egrep lets you log only specific
  2204.           information, rather than everything. "man grep" for further
  2205.           info.
  2206.           
  2207.    LOG DEBUG {| gzip -c > debug.log.gz}
  2208.           Creates a full debug log, but compressed by gzip to save space.
  2209.           
  2210.    LOG PACKETS {| tr "\\01" "X" | cut -c9- > packet.log}
  2211.           This one writes the regular packet log, but translates the
  2212.           Ctrl-A that starts each packet to the letter "X" and removes
  2213.           the s-nn-nn- notation from the beginning of each line. Note the
  2214.           double backslash (normal Kermit quoting rules). "man tr" and
  2215.           "man cut" for further info.
  2216.           
  2217.    See [363]Section 2.12 for information about the new connection log.
  2218.      _________________________________________________________________
  2219.    
  2220.   1.14. Automatic File-Transfer Packet Recognition at the Command Prompt
  2221.   
  2222.    Beginning in version 7.0, C-Kermit can recognize Kermit (and in some
  2223.    cases also Zmodem) file-transfer packets while at its command prompt.
  2224.    This is convenient (for example), if you escaped back from a remote
  2225.    Kermit program and told the local Kermit program to send a file, but
  2226.    forgot to tell the remote Kermit program to receive it (and the local
  2227.    Kermit did not have the "send a Kermit receive command" feature
  2228.    available). This feature is controlled by the following command:
  2229.    
  2230.    SET COMMAND AUTODOWNLOAD { ON, OFF }
  2231.           When ON, which is the default, the command parser recognizes
  2232.           Kermit packets when Kermit is in remote mode. An S packet makes
  2233.           it go into receive mode, an I packet makes it go into server
  2234.           mode. When OFF, packet recognition is disabled and the behavior
  2235.           when a packet is received at the command prompt is as it was in
  2236.           C-Kermit 6.1 and earlier (namely to print an error message).
  2237.           
  2238.    COMMAND AUTODOWNLOAD is the command-mode equivalent of TERMINAL
  2239.    AUTODOWNLOAD, which is effective during CONNECT mode.
  2240.      _________________________________________________________________
  2241.    
  2242.   1.15. The TYPE Command
  2243.   
  2244.    The TYPE command now accepts a selection of optional switches
  2245.    ([364]Section 1.5), and also sets several variables.
  2246.    
  2247.    Syntax: TYPE [ switches... ] filename
  2248.    
  2249.    Variables:
  2250.    
  2251.    \v(ty_ln)
  2252.           Line number of current line (during TYPE command; see /PREFIX)
  2253.           
  2254.    \v(ty_lc)
  2255.           Line count of file most recently TYPEd.
  2256.           
  2257.    \v(ty_mc)
  2258.           Match count of file most recently TYPEd (see /MATCH).
  2259.           
  2260.    Switches:
  2261.    
  2262.    /PAGE
  2263.           If /PAGE is included, Kermit pauses at the end of each
  2264.           screenful and issues a "more?" prompt. You may press the space
  2265.           bar to view the next page (screenful), or press "q" or "n" to
  2266.           return to the C-Kermit prompt. If this switch is given, it
  2267.           overrides the COMMAND MORE-PROMPTING setting for this command
  2268.           only. If it is not given, paging is according to COMMAND
  2269.           MORE-PROMPTING.
  2270.           
  2271.    /NOPAGE
  2272.           Do not pause at the end of each screenful; show the whole file
  2273.           (or all selected lines) at once. If this switch is given, it
  2274.           overrides the COMMAND MORE-PROMPTING setting for this command
  2275.           only. If it is not given, paging is according to COMMAND
  2276.           MORE-PROMPTING.
  2277.           
  2278.    /HEAD[:n]
  2279.           Only show the first n lines of the file (where n is a number).
  2280.           If n is omitted, 10 is used.
  2281.           
  2282.    /TAIL[:n]
  2283.           Only show the last n lines of the file (where n is a number).
  2284.           If nis omitted, 10 is used. Note: /HEAD and /TAIL can't be
  2285.           combined; if you give both switches, only the most recent one
  2286.           is used.
  2287.           
  2288.    /MATCH:pattern
  2289.           Only type lines from the file that match the given pattern (see
  2290.           [365]Section 4.9.1 for pattern notation). UNIX users familiar
  2291.           with grep should note a significant difference: there is no
  2292.           implied "*" at the beginning and end of the pattern. Thus:
  2293.           
  2294.   TYPE /MATCH:foo    Lists lines whose entire contents are "foo".
  2295.   TYPE /MATCH:foo*   Lists lines that start with "foo".
  2296.   TYPE /MATCH:*foo   Lists lines that end with "foo".
  2297.   TYPE /MATCH:*foo*  Lists lines that have "foo" anywhere in them.
  2298.  
  2299.           /HEAD and /TAIL apply after /MATCH, so "type /tail:20
  2300.           /match:x*" shows the last 20 lines in the file that start with
  2301.           "x".
  2302.           
  2303.    /PREFIX:string
  2304.           Print the given string at the beginning of each line. The
  2305.           string may be a constant, a variable, or a quoted variable. If
  2306.           it's an unquoted variable, its value at the time the TYPE
  2307.           command was given is used as a constant. If it is a quoted
  2308.           variable, it is re-evaluated for each line; a useful variable
  2309.           for this context is \v(ty_ln) (the line number of the current
  2310.           line being typed). If the prefix is to include spaces, it must
  2311.           be enclosed in braces. Examples:
  2312.           
  2313.         type /prefix:{oofa.txt: } /match:*thing* oofa.txt
  2314.                 Prints all lines in oofa.txt that contain "thing" with
  2315.                 the filename itself as the prefix (similar to UNIX grep).
  2316.                 
  2317.         type /prefix:{\v(time). } oofa.txt
  2318.                 Prefixes each line of oofa.txt with the time at which the
  2319.                 TYPE command was given (one backslash)
  2320.                 
  2321.         type /prefix:{\\v(time). } oofa.txt
  2322.                 Prefixes each line of oofa.txt with the time at which
  2323.                 that line is being typed (two backslashes).
  2324.                 
  2325.         type /prefix:{\\v(ty_ln). } oofa.txt
  2326.                 Prefixes each line of oofa.txt with its line number.
  2327.                 
  2328.         type /prefix:{\\flpad(\\v(ty_ln),4). } oofa.txt
  2329.                 Same as the previous example, except the line number is
  2330.                 right-adjusted in a 4-column field.
  2331.                 
  2332.    /WIDTH[:n]
  2333.           Truncates each line at column n (which must be a number) prior
  2334.           to printing it. This option can be used for long lines when you
  2335.           don't want them to wrap. If nis omitted, your current screen
  2336.           width is used.
  2337.           
  2338.    /COUNT
  2339.           Counts lines and -- if /MATCH was included, matches -- but does
  2340.           not print any lines from the file. The line and match count is
  2341.           shown at the end, and the variables \v(ty_lc) and \v(ty_lm) are
  2342.           set accordingly.
  2343.           
  2344.    SET OPTIONS TYPE { /PAGE, /NOPAGE, /WIDTH:n }
  2345.           Sets the paging default for TYPE commands, which can be
  2346.           overridden in any particular TYPE command by including the
  2347.           desired switch.
  2348.           
  2349.    If a TYPE command is given with no switch, and no SET OPTIONS TYPE
  2350.    selection is in effect, paging is according to your COMMAND
  2351.    MORE-PROMPTING setting (SHOW COMMAND).
  2352.      _________________________________________________________________
  2353.    
  2354.   1.16. The RESET Command
  2355.   
  2356.    The RESET command, added in 7.0, closes all open files and logs, but
  2357.    does not affect the open connection (if any).
  2358.      _________________________________________________________________
  2359.    
  2360.   1.17. The COPY and RENAME Commands
  2361.   
  2362.    As of C-Kermit 7.0, in the UNIX version only, the COPY and RENAME
  2363.    commands are built in and do not call the underlying platform's COPY
  2364.    or RENAME command. This allows them to work in "NOPUSH" versions and
  2365.    other circumstances where it can't access system commands, and it
  2366.    allows file copying and renaming to be done portably in scripts. The
  2367.    characteristics of the built-in COPY or RENAME include:
  2368.      * It fails if the source file is a directory or is wild or lacks
  2369.        read access.
  2370.      * It fails if the source file is the destination file.
  2371.      * It allows the destination file to be a directory, in which case
  2372.        the source file is copied (or renamed) into it with the same name.
  2373.      * It overwrites an existing destination file if its permission
  2374.        allows.
  2375.      * It sets the new file's permission according to umask but also
  2376.        carries forward the source file's execute permission bits if the
  2377.        destination file did not already exist.
  2378.      * It fails if interrupted by Ctrl-C.
  2379.      * Upon error, it prints an appropriate message.
  2380.      * It returns standardized error codes that can be tested by IF
  2381.        SUCCESS / FAIL.
  2382.        
  2383.    These commands now also accept the following switches:
  2384.    
  2385.   /LIST (/LOG, /VERBOSE)    = Print "file1 => file2 (OK)" (or error message).
  2386.   /NOLIST (/NOLOG, /QUIET)  = Don't print anything (except error messages).
  2387.  
  2388.    /NOLIST is the default.
  2389.    
  2390.    The same built-in code is used by the UNIX C-Kermit server to execute
  2391.    REMOTE COPY commands (except in this case no switches are available).
  2392.    
  2393.    The COPY command also accepts the following additional switches. When
  2394.    any of these are given (and they can be used in any combination except
  2395.    /SWAP and /APPEND), some of the checks listed above are relaxed, and
  2396.    thus it might be possible to get into trouble in certain cases, e.g.
  2397.    when the source and target files are the same file:
  2398.    
  2399.   /APPEND                   = Append source file to destination file.
  2400.   /SWAP-BYTES               = Swap bytes (see [366]Section 6.6.5).
  2401.   /FROMB64                  = Decode the source file from Base64 encoding.
  2402.   /TOB64                    = Encode the target file in Base64.
  2403.  
  2404.    Base64 is the encoding commonly used for enclosures in Internet email.
  2405.      _________________________________________________________________
  2406.    
  2407.   1.18. The MANUAL Command
  2408.   
  2409.    The MANUAL command can be used to access the appropriate Kermit manual
  2410.    or other manual. The general syntax is:
  2411.    
  2412.    MANUAL [ string ]
  2413.           If the string is omitted, C-Kermit asks the underlying system
  2414.           to access the C-Kermit manual using whatever method is
  2415.           appropriate for the system.
  2416.           
  2417.    The specific action depends on the system. In UNIX, a "man" command is
  2418.    issued; "kermit" is the default argument but other manual topics may
  2419.    be specified. If the "man" command allows index or string searching,
  2420.    the appropriate syntax may be included.
  2421.    
  2422.    In Kermit 95, the MANUAL command brings up the HTML online K95 manual.
  2423.    
  2424.    In VMS and elsewhere, "man" is simply translated to "help", with a
  2425.    default argument of "kermit"; other and/or additional arguments may be
  2426.    included according to the definition of the system's "help" command.
  2427.    
  2428.    Correct operation of the "man" command in C-Kermit depends on the
  2429.    appropriate man page or help topic having been installed in the right
  2430.    place with the right permissions and format.
  2431.      _________________________________________________________________
  2432.    
  2433.   1.19. String and Filename Matching Patterns
  2434.   
  2435.    A pattern is a string that includes special notation for matching
  2436.    classes or sequences of characters. C-Kermit 7.0 / K95 1.1.19 supports
  2437.    patterns in several places:
  2438.    
  2439.      * Filenames ([367]Section 4.9)
  2440.      * SWITCH case labels ([368]Section 7.18)
  2441.      * The new IF MATCH statement ([369]Section 7.4)
  2442.      * TYPE /MATCH ([370]Section 1.15)
  2443.      * SET FILE TEXT-PATTERNS and BINARY-PATTERNS ([371]Section 4.3)
  2444.      * The \fsearch() and \farraylook() functions ([372]Sections 7.3 and
  2445.        [373]7.10.7)
  2446.      * The \fpattern() function used with [M,RE]INPUT ([374]Section 7.1)
  2447.        
  2448.    Patterns are also called wildcards, especially when used for filename
  2449.    matching. C-Kermit's pattern syntax is explained in [375]Section
  2450.    4.9.1, and also by the HELP WILDCARDS command.
  2451.      _________________________________________________________________
  2452.    
  2453.   1.20. Multiple Commands on One Line
  2454.   
  2455.    As of C-Kermit 7.0, commands can be grouped together on one line by
  2456.    separating the commands with commas and enclosing the list in braces.
  2457.    For example:
  2458.    
  2459.   C-Kermit> { echo One, echo Two, echo Three }
  2460.   C-Kermit> do { echo One, echo Two, echo Three }
  2461.  
  2462.    Command lists can be nested:
  2463.    
  2464.   [ do ] { echo One, echo Two, if true { echo A, echo B}, echo Three }
  2465.  
  2466.    and the END command works as it does in macros:
  2467.    
  2468.   [ do ] { echo One, echo Two, if true end, echo Three }
  2469.  
  2470.    The "one line" stricture is, of course, pliant to line-continuation
  2471.    conventions, namely that lines ending in hyphen (-) or left brace ({)
  2472.    are to be continued. Thus the first example can also be rendered:
  2473.    
  2474.   [ do ] {
  2475.       echo One
  2476.       echo Two
  2477.       echo Three
  2478.   }
  2479.  
  2480.    (the "do" is optional).
  2481.      _________________________________________________________________
  2482.    
  2483.   1.21. What Do I Have?
  2484.   
  2485.    C-Kermit can be built for hundreds of different platforms with
  2486.    practically countless configuration options. Certain commands might
  2487.    not be available in certain configurations, etc. Even on the same
  2488.    platform, different builds are possible: "maximum functionality",
  2489.    "minimum size", "maximum performance", and so on. You can find out a
  2490.    lot about the configuration of your C-Kermit program with the SHOW
  2491.    FEATURES command. Of course, a lot of what it says, especially in the
  2492.    bottom part, might seem like gibberish, but can be deciphered with a
  2493.    Rosetta Stone (such as the C-Kermit source or the [376]ckccfg.txt
  2494.    file). In any case, the output from SHOW FEATURES might easily explain
  2495.    why some expected feature is missing, or some buffer is smaller than
  2496.    expected. Here's a sample of the bottom section for the SunOS version:
  2497.    
  2498. C-Kermit 7.0.196, 1 Jan 2000
  2499.  
  2500. Major optional features included:
  2501.  Network support (type SHOW NET for further info)
  2502.  Telnet Kermit Option
  2503.  Hardware flow control
  2504.  External XYZMODEM protocol support
  2505.  Latin-1 (West European) character-set translation
  2506.  Latin-2 (East European) character-set translation
  2507.  Cyrillic (Russian, Ukrainian, etc) character-set translation
  2508.  Greek character-set translation
  2509.  Hebrew character-set translation
  2510.  Japanese character-set translation
  2511.  Unicode character-set translation
  2512.  Pseudoterminal control
  2513.  REDIRECT command
  2514.  RESEND command
  2515.  Fullscreen file transfer display
  2516.  Control-character unprefixing
  2517.  Streaming
  2518.  Autodownload
  2519.  
  2520. Major optional features not included:
  2521.  No Kerberos(TM) authentication
  2522.  No SRP(TM) (Secure Remote Password) protocol
  2523.  No Secure Sockets Layer (SSL) protocol
  2524.  No Transport Layer Security (TLS) protocol
  2525.  No encryption
  2526.  No X Windows forwarding
  2527.  
  2528. Host info:
  2529.  Machine:    sun4m
  2530.  Model:      (unknown)
  2531.  OS:         SunOS
  2532.  OS Release: 4.1.3_U1
  2533.  OS Version: 4
  2534.  
  2535. Target: sunos41gsc
  2536. GCC version: 2.7.2
  2537. Compiled Dec 31 1999 10:38:54, options:
  2538.  __GNUC__ __STDC__ _POSIX_JOB_CONTROL _SC_JOB_CONTROL ARRAYREFLEN=1024 BIGBUFOK
  2539.  BROWSER BSD4 CK_ANSIC CK_APC CK_AUTODL CK_CURSES CK_DNS_SRV CK_ENVIRONMENT
  2540.  CK_FAST CK_LOGIN CK_MKDIR CK_NAWS CK_PCT_BAR CK_PERMS CK_RECALL CK_RTSCTS
  2541.  CK_SPEED CK_TIMERS CK_TMPDIR CK_TTGWSIZ CK_TTYFD CK_WREFRESH CKEXEC
  2542.  CKFLOAT=double CKGHNLHOST ckmaxfiles=64 CKMAXOPEN=64 CKMAXPATH=1023 CKREALPATH
  2543.  CKREGEX CKSYSLOG CKTUNING CMDBL=32763 CMDDEP=64 CONGSPD DCMDBUF DIRENT DYNAMIC
  2544.  FNFLOAT FORDEPTH=32 GFTIMER HADDRLIST HDBUUCP IFDEBUG IKS_OPTION IKSDB
  2545.  IKSDCONF INBUFSIZE=32768 INPBUFSIZ=4096 MAC_MAX=16384 MACLEVEL=128 MAXDDIR=32
  2546.  MAXDNUMS=4095 MAXGETPATH=128 MAXTAKE=54 MAXWLD=102400 MSENDMAX=1024 NETCMD
  2547.  NETCONN NETPTY NOKVERBS NOSETBUF OBUFSIZE=32768 PARSENSE PATTERNS PIPESEND
  2548.  RENAME RLOGCODE SAVEDUID SELECT SIG_V SOL_SOCKET sparc STREAMING sun SUNOS4
  2549.  SYSTIMEH TCPSOCKET TIMEH TLOG TNCODE TTLEBUF TTSPDLIST UIDBUFLEN=256 UNIX
  2550.  UNPREFIXZERO USE_LSTAT USE_MEMCPY VNAML=4096 WHATAMI XFRCAN Z_MAXCHAN=46
  2551.  z_maxchan=46 ZXREWIND
  2552.  
  2553.  byte order: big endian
  2554.  
  2555.  sizeofs: int=4 long=4 short=2 char=1 char*=4 float=4 double=8
  2556.  
  2557.  floating-point: precision=16 rounding=1
  2558.  
  2559.    Without going into detail about what all the notation means, notice a
  2560.    couple things:
  2561.    
  2562.      * The Options section shows symbols ("macros") in effect during
  2563.        compilation, together with their values (for those that have
  2564.        values). The options are listed in alphabetical order to make any
  2565.        particular option easier to find.
  2566.      * MAXWLD is the maximum number of files that a wildcard can expand
  2567.        to.
  2568.      * Anything starting with "NO" is a feature (or something other than
  2569.        a feature) that has been deliberately "compiled out", or omitted.
  2570.      * Important items for script writers include: CMDBL=32763 (the size
  2571.        of the command buffer and therefore the maximum length for a macro
  2572.        or variable definition; CMDDEP=64 (the limit on recursion depth);
  2573.        FORDEPTH=32 (the nesting limit on FOR loops); INBUFSIZE=32768 (the
  2574.        size of the INPUT command circular buffer); MAC_MAX=16384 (the
  2575.        maximum number of macros), etc.
  2576.        
  2577.    See the [377]ckccfg.txt file for details.
  2578.      _________________________________________________________________
  2579.    
  2580.   1.22. Generalized File Input and Output
  2581.   
  2582.    C-Kermit 7.0 adds a new generalized I/O system for stream files,
  2583.    augmenting (and to some extent, overlapping with) the older OPEN,
  2584.    READ, WRITE, and CLOSE commands. In the new file i/o system, which can
  2585.    be used simultaneously with the old one, all commands are grouped
  2586.    together under the new FILE keyword, and some related functions and
  2587.    variables are added.
  2588.    
  2589.     1.22.1. Why Another I/O System?
  2590.     
  2591.    The well-known LOG, OPEN, READ, WRITE, and CLOSE commands have the
  2592.    following restrictions:
  2593.    
  2594.     1. Only one READ file and one WRITE file can be open at a time.
  2595.     2. The READ and WRITE commands are strictly line oriented.
  2596.     3. These commands can not be used with binary files.
  2597.     4. They do not support read/write access or random access.
  2598.     5. The syntax is a bit counterintuitive for programmers.
  2599.        
  2600.    The new file i/o system allows multiple files to be open at once, in
  2601.    any desired combination of modes (read/write/append) supported by the
  2602.    operating system, for line, block (record), or character i/o, for
  2603.    sequential or random access, using consistent syntax and conventions.
  2604.    
  2605.    The new system, however, does not replace the old one, since the old
  2606.    system still must be used for:
  2607.    
  2608.     1. The session, packet, debug, transaction, and connection logs.
  2609.     2. Reading and writing commands rather than files.
  2610.     3. Existing scripts.
  2611.        
  2612.    The new system works only with regular files, not with commands or
  2613.    pipes or mailboxes or pseudoterminals. No special provisions are made
  2614.    in the FILE commands for handling devices or network connections, nor
  2615.    for preventing you from trying to open them; if the underlying
  2616.    operating system treats them like regular stream disk files, the FILE
  2617.    commands (except, of course SEEK, REWIND, and COUNT) might work with
  2618.    them. (In C programming terms, the FILE commands are, at present,
  2619.    nothing more than a front end to fopen() / fread() / fwrite() /
  2620.    fclose() and friends, which are a portable API to sequential files,
  2621.    but this might change in the future for platforms like VMS and VOS
  2622.    that have more complicated file systems.)
  2623.    
  2624.    Definitions:
  2625.    
  2626.    Channel
  2627.           A number assigned to a file when it is opened, by which it must
  2628.           be referred to in all input/output operations.
  2629.           
  2630.    Read/Write Pointer
  2631.           The current position in an open file, expressed as the 0-based
  2632.           byte count from the beginning.
  2633.      _________________________________________________________________
  2634.    
  2635.     1.22.2. The FILE Command
  2636.     
  2637.    FILE keyword [ switches ] channel [ data ]
  2638.           The keyword specifies the function: FILE OPEN, FILE READ, FILE
  2639.           WRITE, FILE CLOSE, etc. For convenience (and for familiarity to
  2640.           C programmers), the two-word FILE commands can be shortened to
  2641.           the single words FOPEN, FREAD, FWRITE, FCLOSE, and so on.
  2642.           Switches are optional, and modify or amplify the requested file
  2643.           function.
  2644.           
  2645.    As in C, Fortran, and other programming languages, open files are
  2646.    referred to by "channels", integers such as 0, 1, 2, 3, and so on. A
  2647.    channel number is assigned when you open a file. The number of
  2648.    available channels depends on the underlying operating system, and can
  2649.    be seen in the variable:
  2650.    
  2651.   \v(f_max)
  2652.  
  2653.    or by giving the FILE LIST (FLIST) command. Channels are discussed in
  2654.    greater detail in [378]Section 1.22.4.
  2655.    
  2656.    FILE command errors can be caught with IF FAIL after the FILE command.
  2657.    In addition, the \v(f_error) variable is set to the completion code of
  2658.    the command: 0 if no error, or a negative number if there was an
  2659.    error. The error codes are listed in [379]Section 1.22.5.
  2660.    
  2661.    The command to open a file is:
  2662.    
  2663.    FILE OPEN [ switches ] variable filename
  2664.           Opens a file for the type of access specified by the switches,
  2665.           or for read-only access if no switches are given. Upon success,
  2666.           a channel number is assigned to this file and stored in the
  2667.           given variable so you can refer to the open file in subsequent
  2668.           i/o commands. If the file can not be opened, the FILE OPEN
  2669.           command fails. Synonym: FOPEN.
  2670.           
  2671.    The FILE OPEN switches are:
  2672.    
  2673.    /READ
  2674.           Open the file for read access. If no switches are given, /READ
  2675.           is assumed. If the file does not exist or can't be opened for
  2676.           read access, the FILE OPEN command fails.
  2677.           
  2678.    /WRITE
  2679.           Allow writing. If a file of the same name already exists, it is
  2680.           overwritten unless /READ or /APPEND is also included. If a file
  2681.           of the given name does not exist, it is created.
  2682.           
  2683.    /APPEND
  2684.           Equivalent to /WRITE, except that if the file exists, it is not
  2685.           destroyed. The read/write pointer is set to the end of the
  2686.           file, so unless you change it with FILE SEEK or REWIND (see
  2687.           below), the first FILE WRITE command adds to the end of the
  2688.           file, preserving what was there already. If /WRITE is also
  2689.           given, it is ignored.
  2690.           
  2691.    /BINARY
  2692.           Open the file in "binary" mode, rather than text mode. This
  2693.           switch is meaningless (but still can be used) in UNIX. In VMS,
  2694.           Windows, and OS/2, it inhibits end-of-line processing and
  2695.           conversion, and so should be used for binary files and/or files
  2696.           that are to be accessed in record or character mode rather than
  2697.           line by line.
  2698.           
  2699.    The variable for the channel number can be any kind of variable: the
  2700.    \%x kind, a macro name, or an array element. But it must be a
  2701.    variable, not a number -- C-Kermit assigns the channel number; you
  2702.    can't tell it what number to use.
  2703.    
  2704.    Example:
  2705.    
  2706.   FILE OPEN \%c oofa.txt                  ; Open oofa.txt for reading.
  2707.   IF FAIL exit 1 Can't open oofa.txt      ; Always check to see if it worked.
  2708.   ECHO oofa.txt: channel = \%c
  2709.  
  2710.    If the file oofa.txt is opened successfully, a channel number is
  2711.    assigned to the variable \%c. Here's another example using a macro
  2712.    name for the channel number:
  2713.    
  2714.   FILE OPEN channel oofa.txt              ; Open oofa.txt for reading.
  2715.   IF SUCCESS ECHO oofa.txt: channel = \m(channel)
  2716.  
  2717.    Switches can be combined when it makes sense and the underlying
  2718.    operating system allows it. For example, to open a file in binary mode
  2719.    for reading and writing (sometimes called "update"):
  2720.    
  2721.   FILE OPEN /READ /WRITE /BINARY \%c budget.db
  2722.  
  2723.    Some combinations might be allowed, others not. For example /READ
  2724.    /APPEND will usually not be allowed. /WRITE /APPEND is treated as
  2725.    /APPEND.
  2726.    
  2727.    A major advantage of the new system over the older one is that you can
  2728.    have multiple files open at once. Suppose, for example, that you want
  2729.    to open all the files in a certain directory at once:
  2730.    
  2731.   .\%n := \ffiles(/usr/olga*,&f)          ; Get file list into array.
  2732.   if ( > \%n \v(f_max) ) {                ; Make sure there aren't too many.
  2733.       exit 1 {\v(dir): \%n = Too many files}
  2734.   }
  2735.   declare \&c[\%n]                        ; Make array for channel numbers.
  2736.   for \%i 1 \%n 1 {                       ; Loop to open every file...
  2737.       file open \&c[\%i] \&f[\%i]         ; Try to open this one
  2738.       if fail exit 1 Open error: \&f[\%i] ; Check for failure
  2739.   }
  2740.  
  2741.    If this loop completes successfully, the \&c[] array will contain \%n
  2742.    channel numbers of open files in elements 1 through \%n.
  2743.    
  2744.    Any file that you open with FILE OPEN stays open until you close it.
  2745.    The command to close a file is:
  2746.    
  2747.    FILE CLOSE { ALL, channel }
  2748.           If a channel number is given and the channel refers to an open
  2749.           file, the file is closed and the channel is freed for reuse; if
  2750.           the channel does not refer to an open file, an error message is
  2751.           printed and the command fails. If ALL is specified instead of a
  2752.           specific channel, all files opened with FILE OPEN are closed
  2753.           and if all open files were closed successfully (even if no
  2754.           files were open), the command succeeds; if any open file could
  2755.           not be closed, the command fails; however, all open files that
  2756.           could be closed are still closed. Synonym: FCLOSE.
  2757.           
  2758.    FILE CLOSE might fail because, for example, the disk filled up or a
  2759.    quota was exceeded. Example:
  2760.    
  2761.   fopen /write \%c new.txt                ; Open new.txt for writing.
  2762.   if fail exit 1                          ; Check for error.
  2763.   fclose \%c                              ; Close the file we just opened.
  2764.  
  2765.    This creates a 0-length file called new.txt.
  2766.    
  2767.    Note that FILE OPEN /WRITE (without /READ or /APPEND) always creates a
  2768.    new file, and therefore destroys any file with the same name that
  2769.    might already exist (assuming you have permission to delete it). To
  2770.    avoid overwriting existing files, simply check first:
  2771.    
  2772.   if exist new.txt exit 1 {Fatal - new.txt already exists}
  2773.   fopen /write \%c new.txt
  2774.   if fail ...
  2775.  
  2776.    The next two commands give information about open files:
  2777.    
  2778.    FILE STATUS channel
  2779.           Tells the name of the file, if any, open on the given channel
  2780.           and the switches it was opened with. The read/write pointer is
  2781.           also shown; this is where the next read or write will occur;
  2782.           "[EOF]" is shown if the current position in the open file is
  2783.           the end -- i.e. the next read will fail if the file was opened
  2784.           in /READ mode; the next write will add material to the end. The
  2785.           current line number (0-based) is also shown if known. The FILE
  2786.           STATUS command succeeds if the channel is open, and fails if
  2787.           there is no open file on the given channel, or if the channel
  2788.           number is invalid or out of range. Synonym: FSTATUS.
  2789.           
  2790.    FILE LIST
  2791.           Lists the channel number and name of each open file, along with
  2792.           its OPEN modes (R, W, A, B, RW, etc) and its current read/write
  2793.           pointer or "[EOF]" if it is at the end. Also tells the number
  2794.           of files currently opened with FILE OPEN, plus the maximum
  2795.           number of open files allowed by the system and the maximum
  2796.           number allowed for FILE OPEN. Synonym: FLIST.
  2797.           
  2798.    Next come the commands for reading and writing files:
  2799.    
  2800.    FILE READ [ switches ] channel [ variable ]
  2801.           Reads data from the file on the given channel number into the
  2802.           variable, if one was given; if no variable was given, the
  2803.           result is printed on the screen. IMPORTANT: The variable should
  2804.           normally be a macro name rather than a \%x or \&x[] variable if
  2805.           you want backslash characters in the file to be taken literally
  2806.           (see pp.408-412 of [380]Using C-Kermit for an explanation; you
  2807.           can also read into a \%x or \&x[] variable, but then you must
  2808.           remember to protect future references to by \fcontents() if you
  2809.           don't want C-Kermit to process any backslashes it might
  2810.           contain). The desired amount of data (according to the
  2811.           switches) is read from the file at the current read/write
  2812.           pointer, and upon completion the read/write position is updated
  2813.           to first byte after the data that was read, no matter what
  2814.           switches were given. Synonym: FREAD.
  2815.           
  2816.    FILE WRITE [ switches ] channel text
  2817.           Writes the given text to the file on the given channel number.
  2818.           The text, of course, can be literal text or a variable, or any
  2819.           combination. If the text might contain leading or trailing
  2820.           spaces, it must be enclosed in braces if you want to preserve
  2821.           them. Synonym: FWRITE.
  2822.           
  2823.    Before proceeding, a caution about the NUL character. C-Kermit is so
  2824.    named because it is a Kermit program written in the C language. In C,
  2825.    character strings are represented as a sequence of non-NUL bytes
  2826.    terminated by a NUL byte (a byte in which all bits are 0). Thus a C
  2827.    string can not contain NUL bytes; it always ends with the first NUL
  2828.    byte. C-Kermit variables are implemented as C strings and therefore
  2829.    can't contain NUL bytes either, so the FILE READ and FILE WRITE
  2830.    commands do not handle files or strings that contain NUL bytes, except
  2831.    when the /CHARACTER switch is included with the FILE READ or WRITE
  2832.    command, or when /LPAD:0 or /RPAD:0 is given with the FILE WRITE
  2833.    command; these switches are explained below.
  2834.    
  2835.    Also note that Kermit can not be used read or write binary numbers in
  2836.    the machine's internal format (integer or floating-point); in general,
  2837.    numbers can be processed only when represented as numeric or
  2838.    floating-point strings.
  2839.    
  2840.    FILE READ switches are:
  2841.    
  2842.    /LINE
  2843.           Specifies that a line of text is to be read. A line is defined
  2844.           according to the underlying operating system's text-file
  2845.           format. For example, in UNIX a line is a sequence of characters
  2846.           up to and including a linefeed, or the end of the file, which
  2847.           ever comes first. The line terminator (if any) is removed
  2848.           before assigning the text to the variable. If no switches are
  2849.           included with the FILE READ command, /LINE is assumed. Normally
  2850.           this switch should not be used with files opened in /BINARY
  2851.           mode (but nothing prevents it either).
  2852.           
  2853.    /SIZE:number
  2854.           Specifies that the given number of bytes (characters) is to be
  2855.           read. The actual number of bytes returned will be less if the
  2856.           end of file is reached (or a NUL byte is encountered). For
  2857.           example, if a file is 514 bytes long, FILE READ /SIZE:512
  2858.           returns 512 bytes the first time and 2 bytes the second time.
  2859.           FILE READ /SIZE provides a kind of "record i/o" for files that
  2860.           do not necessarily contain lines. The resulting block of
  2861.           characters is assigned to the variable without any editing.
  2862.           Synonym: /BLOCK.
  2863.           
  2864.    /CHARACTER
  2865.           Equivalent to /SIZE:1. If FILE READ /CHAR succeeds but the
  2866.           variable is empty, this indicates a NUL byte was read. Synonym:
  2867.           BYTE.
  2868.           
  2869.    FILE WRITE switches are:
  2870.    
  2871.    /LINE
  2872.           Specifies that an appropriate line terminator is to be added to
  2873.           the end of the text. If no switches are included, /LINE is
  2874.           assumed.
  2875.           
  2876.    /SIZE:number
  2877.           Specifies that the given number of bytes (characters) is to be
  2878.           written. If the given text is longer than the requested size,
  2879.           it is truncated; if is shorter, it is padded according /LPAD
  2880.           and /RPAD switches. Synonym: /BLOCK.
  2881.           
  2882.    /LPAD[:value]
  2883.           If /SIZE was given, but the text is shorter than the requested
  2884.           size, the text is padded on the left with sufficient copies of
  2885.           the character whose ASCII value is given to write the given
  2886.           length. If no value is specified, 32 (the code for Space) is
  2887.           used. The value can also be 0 to write the indicated number of
  2888.           NUL bytes. If /SIZE was not given, this switch is ignored.
  2889.           
  2890.    /RPAD[:value]
  2891.           Like LPAD, but pads on the right.
  2892.           
  2893.    /CHARACTER
  2894.           Specifies that one character should be written. If the text is
  2895.           empty or not given, a NUL character is written; otherwise the
  2896.           first character of text is given. Synonym: /BYTE.
  2897.           
  2898.    /STRING
  2899.           Specifies that the text is to be written as-is, with no
  2900.           terminator added.
  2901.           
  2902.    Here's an example in which we copy a text file line by line:
  2903.    
  2904.   file open /read \%c oofa.txt            ; Open input file
  2905.   if fail exit 1 Can't open input file    ; Check that it's open
  2906.   file open /write \%d new.txt            ; Open output file
  2907.   if fail exit 1 Can't open output file   ; Check
  2908.   while true {                            ; Loop to copy lines
  2909.       file read /line \%c line            ; Read a line
  2910.       if fail break                       ; Assume failure = end of file
  2911.       file write /line \%d {\m(line)}     ; Write the line to output file
  2912.       if fail exit 1 Write failure        ; Failure here is fatal
  2913.   }
  2914.   file close \%c                          ; Close the two files
  2915.   file close \%d
  2916.  
  2917.    Note that since /LINE is the default for both FILE READ and FILE
  2918.    WRITE, it can be omitted as in the following example, where we also
  2919.    use the short names for the FILE commands.
  2920.    
  2921.   fopen /read \%c oofa.txt                ; Open input file
  2922.   if fail exit 1 Can't open input file    ; Check that it's open
  2923.   fopen /write \%d new.txt                ; Open output file
  2924.   if fail exit 1 Can't open output file   ; Check
  2925.   while true {                            ; Loop to copy lines
  2926.       fread \%c line                      ; Read a line
  2927.       if fail break                       ; Assume failure = end of file
  2928.       fwrite \%d {\m(line)}               ; Write the line to output file
  2929.       if fail exit 1 Write failure        ; Failure here is fatal
  2930.   }
  2931.   fclose \%c                              ; Close the two files
  2932.   fclose \%d
  2933.  
  2934.    Here's the same example using "record i/o" (the open and close
  2935.    sequences are are omitted since they are the same as above). The
  2936.    result is the same, but execution is much faster:
  2937.    
  2938.   while true {                            ; Loop to copy blocks
  2939.       fread /size:512 \%c block           ; Read a block into \%a
  2940.       if fail break                       ; Assume failure = end of file
  2941.       fwrite /string \%d {\m(block)}      ; Write the block to output file
  2942.       if fail exit 1 Write failure        ; Failure here is fatal
  2943.   }
  2944.  
  2945.    Although record i/o is faster, it should not be used in line-oriented
  2946.    applications, since it returns arbitrary chunks of the file to your
  2947.    script, rather than lines. In this example, FWRITE /STRING is used
  2948.    rather than FWRITE /SIZE:512 to avoid the last output block being
  2949.    padded beyond the original file's length.
  2950.    
  2951.    A file can also be copied character by character, but this is much
  2952.    slower than line i/o and VERY much slower than block i/o:
  2953.    
  2954.   while true {                            ; Loop to copy blocks
  2955.       fread /char \%c c                   ; Read a character into c
  2956.       if fail break                       ; Assume failure = end of file
  2957.       fwrite /char \%d {\m(c)}            ; Write character to output file
  2958.       if fail exit 1 Write failure        ; Failure is fatal
  2959.   }
  2960.  
  2961.    Although character i/o is slow, it is the only way to process files
  2962.    that contain NUL characters (i.e. bytes composed of only zero bits).
  2963.    In the example above, when "fread /char \%c c" returns a NUL, the c
  2964.    variable is empty. But since the FREAD /CHAR command did not fail, we
  2965.    know the result was really a NUL. FWRITE /CHAR, when given an empty
  2966.    variable (or no variable at all) writes a NUL. Thus the loop above
  2967.    will copy any file at all (very slowly). In non-copying applications,
  2968.    NULs are detected like this:
  2969.    
  2970.   fread /char \%c c
  2971.   if fail (do something)
  2972.   if not def c (a NUL byte was read)
  2973.  
  2974.    Finally some advanced file operations:
  2975.    
  2976.    FILE FLUSH channel
  2977.           For output files only: commits all previous writes to disk, in
  2978.           case the computer was buffering them. Synonym: FFLUSH.
  2979.           
  2980.    FILE COUNT [ { /BYTES, /LINES, /LIST, /NOLIST } ] channel
  2981.           By default, or if the /BYTES switch is given, counts the bytes
  2982.           in the file, if any, open on the given channel. If the /LINES
  2983.           switch is given, counts lines in the file. If the /LIST switch
  2984.           is given, the result is printed. If the /NOLIST switch is
  2985.           given, the result is not printed. /QUIET is a synonym for
  2986.           /NOLIST. If neither /LIST nor /NOLIST is given, the result is
  2987.           printed if the command is given at top level, i.e. not from a
  2988.           command file or macro. In all cases, the result of the most
  2989.           recent FILE COUNT command is stored in the variable
  2990.           \v(f_count). Note that FILE COUNT /LINE works (and can only
  2991.           work) by reading the entire file; expect it to take some time
  2992.           if the file is large. Synonym: FCOUNT.
  2993.           
  2994.    FILE REWIND channel
  2995.           Moves the read/write pointer to the beginning of the file.
  2996.           Equivalent to FILE SEEK channel 0. Synonym: FREWIND.
  2997.           
  2998.    FILE SEEK [ switches ] channel { [{+,-}]number, LAST, EOF }
  2999.           Moves the read/write pointer for the file on this channel to
  3000.           the given position, which may be a byte (character) number or a
  3001.           line number, expressed in either absolute or relative terms.
  3002.           Switches:
  3003.           
  3004.         /BYTE
  3005.                 The number given is a byte number. Synonym: /CHARACTER.
  3006.                 
  3007.         /LINE
  3008.                 The number given is a line number.
  3009.                 
  3010.         /ABSOLUTE
  3011.                 The number given is absolute.
  3012.                 
  3013.         /RELATIVE
  3014.                 The number given is relative to the current position.
  3015.                 
  3016.           By default, or if the /BYTE switch is given, the number is a
  3017.           byte number (0 = first byte). If /LINE is given, the number is
  3018.           a line number (0 = first line). EOF means to move to the end of
  3019.           the file. LAST means to move to the last line or character of
  3020.           the file, depending on whether it's a line or character seek.
  3021.           
  3022.           If neither the /RELATIVE nor the /ABSOLUTE switch is given,
  3023.           then if a signed number is given, the motion is relative to the
  3024.           current position. An expression that evaluates to a negative
  3025.           number is not considered signed for this purpose; that is, a
  3026.           sign (+ or -) must be included as the first character of the
  3027.           number in the command itself to force a relative seek (in the
  3028.           absence of /RELATIVE or /ABSOLUTE).
  3029.           
  3030.           If the number has no sign, or if the /ABSOLUTE switch is given,
  3031.           the number represents an absolute position (relative to the
  3032.           beginning of the file). Subsequent FILE READs or WRITEs will
  3033.           take place at the new position.
  3034.           
  3035.           If the read/write pointer is placed after the end of the file,
  3036.           a subsequent FILE READ will fail, but a FILE WRITE will succeed
  3037.           (possibly creating a file with "holes"). If a FILE SEEK /BYTE
  3038.           command is given, the current line becomes unknown (unless the
  3039.           position is 0) and subsequent FILE SEEK /RELATIVE /LINE
  3040.           commands will fail until the next non-relative FILE SEEK /LINE
  3041.           command is given. Synonym: FSEEK.
  3042.           
  3043.    An absolute FILE SEEK to a negative position fails silently, as does a
  3044.    relative seek to a position before the beginning of the file.
  3045.    
  3046.    A caution about relative SEEKs: remember that the number is relative
  3047.    to the current position. Whenever you read or write, this changes the
  3048.    position. In each of the following examples, assume the file open on
  3049.    channel \%c is positioned at line n (the FREAD target variable is
  3050.    omitted for lack of space):
  3051.    
  3052.   { FREAD \%c, FSEEK /LINE \%c -1, FREAD \%c }  <-- Reads line n twice
  3053.   { FREAD \%c, FSEEK /LINE \%c +0, FREAD \%c }  <-- Reads lines n and n+1
  3054.   { FREAD \%c, FSEEK /LINE \%c +1, FREAD \%c }  <-- Reads lines n and n+2
  3055.   { FREAD \%c, FSEEK /LINE \%c -2, FREAD \%c }  <-- Reads lines n and n-1
  3056.   { FREAD \%c, FSEEK /LINE \%c -3, FREAD \%c }  <-- Reads lines n and n-2
  3057.  
  3058.    Another caution: Using FSEEK and FREAD /SIZE to repeatedly read the
  3059.    same disk block (e.g. when sampling a database record that is
  3060.    frequently updated) might not give you updated disk blocks due to the
  3061.    internal buffering and caching of the C library (this probably varies
  3062.    from one platform/compiler combination to another). If necessary you
  3063.    can force a fresh disk read with a close/open sequence:
  3064.    
  3065.   FCLOS \%c
  3066.   FOPEN \%c samefilename
  3067.   FSEEK \%c samespot
  3068.   FREAD /SIZE:howmanybytes \%c variable
  3069.      _________________________________________________________________
  3070.    
  3071.     1.22.3. FILE Command Examples
  3072.     
  3073.    To read the last 10 lines of a text file into an array:
  3074.    
  3075.   fopen /read \%c oofa.txt                ; Open the file
  3076.   if fail exit 1 Can't open oofa.txt      ; Always check for failure
  3077.   dcl \&a[10]                             ; Declare a 10-element array
  3078.   fcount /line \%c                        ; Count lines in the file
  3079.   fseek /line \%c \v(f_count)-10          ; Seek to 10 lines from the end
  3080.   if fail exit 1 Can't seek               ; Check for failure
  3081.   for \%i 1 10 1 { fread \%c \&a[\%i] }   ; Read the last 10 lines
  3082.   fclose \%c                              ; Close the file
  3083.  
  3084.    Note that blank lines show up as empty (undefined) array elements, for
  3085.    example if you give a "show array a" command at this point. This is
  3086.    normal. You can still use these elements; e.g.:
  3087.    
  3088.   for \%i 1 10 1 { echo \%i. \&a[\%i] }   ; Display the 10 lines
  3089.  
  3090.    Here is how to read the last line of a file (already open on channel
  3091.    \%c):
  3092.    
  3093.   fseek /line \%c last                    ; Seek directly to last line
  3094.  
  3095.    Alternatively:
  3096.    
  3097.   fseek /line \%c eof                     ; Seek to end of file
  3098.   fseek /line \%c -1                      ; Seek to beginning of last line
  3099.  
  3100.    Alternatively:
  3101.    
  3102.   fcount /line \%c                        ; Count the file's lines
  3103.   fseek /line \%c \v(f_count)-1           ; Seek to last line
  3104.   fread \%c                               ; Read it
  3105.  
  3106.    To read every other line from the file (using relative SEEK), skipping
  3107.    the first line:
  3108.    
  3109.   fopen /read \%c oofa.txt                ; Open the file
  3110.   while ( success ) {                     ; Loop through lines
  3111.       fseek /line \%c +1                  ; Skip a line
  3112.       if success fread \%c                ; Read & display a line
  3113.   }
  3114.   fclose \%c                              ; Close the file
  3115.  
  3116.    Here is how to read the lines of a file in reverse order:
  3117.    
  3118.   fopen /read \%c oofa.txt                ; Open
  3119.   if fail exit 1                          ; Check
  3120.   fseek /line \%c last                    ; Seek to last line
  3121.   while success {                         ; Loop
  3122.       fread \%c                           ; Read line
  3123.       fseek /line \%c -2                  ; Seek backwards two lines
  3124.   }
  3125.   fclose \%c                              ; Close the file
  3126.  
  3127.    The loop works because a relative SEEK outside the file fails.
  3128.    
  3129.    It is also possible to use block i/o to manage random-access files
  3130.    with fixed-length records (as long as they don't contain NUL
  3131.    characters). Suppose, for example, you have a file of "card image"
  3132.    records with fixed-field information about customers, such as:
  3133.    
  3134.   Name:     Columns  1-32  (column numbers are 1-based)
  3135.   Address:  Columns 33-72
  3136.   Balance:  Columns 73-80
  3137.  
  3138.    The records are indexed by customer number, starting with 0. There are
  3139.    no line terminators separating them. Therefore the record for customer
  3140.    number n starts at position nx 80 (\%n*80).
  3141.    
  3142.    Now suppose we received a payment from customer number 173 and want to
  3143.    update the balance:
  3144.    
  3145.   .\%n = 173                               ; Customer (record) number
  3146.   .\%a = 12.72                             ; Amount
  3147.   fopen /read /write \%c customer.db       ; Open the file
  3148.   if fail stop 1 OPEN FAILED: \f_errmsg()  ; Check
  3149.   fseek /byte \%c 80*\%n                   ; Seek to record
  3150.   fread /size:80 \%c r                     ; Read the record
  3151.   if fail stop 1 READ FAILED: \f_errmsg()  ; Check (IMPORTANT)
  3152.   .\%b := \fright(\m(r),8)                 ; Extract the balance
  3153.   .\%b := \ffpadd(\%b,\%a,2)               ; Add the new payment
  3154.   if fail stop 1 ARITHMETIC ERROR: \%b/\%a ; Catch bad records
  3155.   .r := {\fleft(\m(r),72)\flpad(\%b,8)}    ; Update the record
  3156.   fseek /byte \%c 80*\%n                   ; Reposition to same spot
  3157.   fwrite /size:80 \%c {\m(r)}              ; Replace the record
  3158.   if fail stop 1 WRITE FAILED: \f_errmsg() ; Check
  3159.   fclose \%c                               ; Close the file
  3160.  
  3161.    REMEMBER: Using FILE SEEK to move beyond the end of file can result in
  3162.    a file with holes when writing; when reading, an end-of-file error
  3163.    will occur -- be sure to check for it.
  3164.      _________________________________________________________________
  3165.    
  3166.     1.22.4. Channel Numbers
  3167.     
  3168.    C-Kermit's channel numbers are integers from 0 to some
  3169.    platform-dependent limit, such as 46 or 1985 (the value of \v(f_max)).
  3170.    This is the limit placed by the operating system on the number of
  3171.    files that may be opened by one process or user or job, minus the
  3172.    standard input, output, and error files, and minus the number of files
  3173.    reserved by C-Kermit for logs, OPEN READ and WRITE, and file transfer
  3174.    (and maybe some command files -- the \v(f_max) number can't be exact).
  3175.    
  3176.    Although you must include a variable in the FILE OPEN command, to
  3177.    which the channel number is assigned, you don't have to use a variable
  3178.    in the other FILE commands if you know what the number is -- you can
  3179.    just put the number. This saves you a few keystrokes when typing
  3180.    commands at the prompt:
  3181.    
  3182.   fopen \%c oofa.txt
  3183.   flist
  3184.   0. /usr/olga.oofa.txt (R) 0
  3185.  
  3186.    This tells the channel number is 0 (the number on the left is the
  3187.    channel file's channel number). Of course you can also find it by
  3188.    echoing the variable:
  3189.    
  3190.   echo \%c
  3191.   0
  3192.  
  3193.    Or with "fstatus \%c". Now you can type commands like:
  3194.    
  3195.   fread 0
  3196.  
  3197.    to read a line from the file. Obviously, however, using digits rather
  3198.    than a variable for the channel number would be poor practice in a
  3199.    script.
  3200.    
  3201.    If in commands like:
  3202.    
  3203.   fread \%c \%a
  3204.  
  3205.    you have trouble remembering which variable is which, note that the
  3206.    channel number is, indeed, a number. Anywhere C-Kermit accepts a
  3207.    number it can also accept an expression, so you can put parentheses
  3208.    around the channel number to remind you it's the channel number and
  3209.    not the variable into which data is to be read:
  3210.    
  3211.   fread (\%c) \%a
  3212.  
  3213.    Normally channel numbers are assigned sequentially as 0, 1, 2, ... up
  3214.    to the limit. However, once you start closing files, there can be
  3215.    holes in the sequence. New channels are assigned to fill in the holes.
  3216.    Thus you can't depend on channel numbers being in any particular
  3217.    sequence.
  3218.      _________________________________________________________________
  3219.    
  3220.     1.22.5. FILE Command Errors
  3221.     
  3222.    Each FILE command sets the variable \v(f_error) to one of the
  3223.    following values:
  3224.    
  3225.     0 = No error
  3226.    -1 = System error
  3227.    -2 = Attempt to read after end of file
  3228.    -3 = Channel not open
  3229.    -4 = Channel number out of range (negative or too large)
  3230.    -5 = Numeric argument (size, ...) out of range
  3231.    -6 = File not found
  3232.    -7 = Bad or missing filename
  3233.    -8 = Too many files are already open (FILE OPEN only)
  3234.    -9 = Forbidden operation (e.g. write to a read-only file)
  3235.   -10 = Access denied
  3236.   -11 = Illegal combination of OPEN modes (FILE OPEN only)
  3237.   -12 = Buffer overflow
  3238.   -13 = Current line number unknown (for relative line seeks)
  3239.   -14 through -98: Reserved.
  3240.   -99 = Requested operation not implemented in this version of C-Kermit
  3241.  -999 = Unknown error
  3242.  
  3243.    When \v(f_error) is -1, this means the FILE command failed because
  3244.    because of a system error, in which case you can examine the following
  3245.    variables:
  3246.    
  3247.   \v(errno)     = System error number.
  3248.   \v(errstring) = Error message corresponding to \v(errno).
  3249.  
  3250.    A special function is available for translating the \v(f_error) code
  3251.    to an error message string:
  3252.    
  3253. \f_errmsg([code])
  3254.   If the code is -1, returns error message of the most recent system
  3255.   error; otherwise if the code is a valid \v(f_error) value, the associated
  3256.   message is returned.  If the code is omitted, the status message
  3257.   corresponding to the current \v(f_error) value is returned.
  3258.  
  3259.    A FILE command that fails prints the appropriate error message
  3260.    automatically, except when the command is READ or SEEK and the error
  3261.    is -2 (end of file); in that case, the command still fails, but does
  3262.    not print a message. This allows constructions such as:
  3263.    
  3264.   fopen \%c oofa.txt
  3265.   while success { fread \%c }
  3266.   fclose \%c
  3267.  
  3268.    to work as expected, i.e. without an annoying message when the end of
  3269.    file is reached.
  3270.      _________________________________________________________________
  3271.    
  3272.     1.22.6. File I/O Variables
  3273.     
  3274.    The variables associated with the file i/o package are:
  3275.    
  3276.    \v(f_count)
  3277.           Result of the most recent FILE COUNT (FCOUNT) command.
  3278.           
  3279.    \v(f_error)
  3280.           Numeric error code of most recent FILE command (0 = no error).
  3281.           
  3282.    \v(f_max)
  3283.           Maximum number of files open simultaneously.
  3284.      _________________________________________________________________
  3285.    
  3286.     1.22.7. File I/O Functions
  3287.     
  3288.    Some of the FILE commands can also be issued as function calls, which
  3289.    makes script writing a bit more convenient, especially for C
  3290.    programmers. Also, several functions are provided that do not have
  3291.    command equivalents. Each of these functions takes a channel number as
  3292.    the first argument. These functions do not work for OPEN { READ,
  3293.    !READ, WRITE, !WRITE, and APPEND } files.
  3294.    
  3295.    \f_status(channel)
  3296.           Returns 0 if the channel is not open, otherwise a number
  3297.           between 1 and 15 which is the sum of the OPEN modes:
  3298.           
  3299.   1 = /READ
  3300.   2 = /WRITE
  3301.   4 = /APPEND
  3302.   8 = /BINARY
  3303.  
  3304.    The remaining functions work only for open channels. Each of these
  3305.    functions can fail for the applicable reasons listed in [381]Section
  3306.    1.22.5. For instructions on handling function errors, see [382]Section
  3307.    7.12.
  3308.    
  3309.    \f_pos(channel)
  3310.           Returns the file's current read/write pointer (0-based). There
  3311.           is no FILE command equivalent.
  3312.           
  3313.    \f_line(channel)
  3314.           Returns the file's current line number (0-based), if known,
  3315.           otherwise -1. There is no FILE command equivalent. The line
  3316.           number is known as long as no character or block i/o has been
  3317.           done on the channel.
  3318.           
  3319.    \f_handle(channel)
  3320.           Returns the "file handle" of the file. That is, it translates
  3321.           the portable C-Kermit channel number into a system-specific
  3322.           file handle or number that can be passed to other programs on
  3323.           the same platform. In UNIX this is a file descriptor. There is
  3324.           no FILE command equivalent.
  3325.           
  3326.    \f_eof(channel)
  3327.           Returns 1 if the read/write pointer of the file on the given
  3328.           channel is at the end of the file, 0 otherwise. Convenient in
  3329.           WHILE statements, e.g.:
  3330.           
  3331.     while not \f_eof(\%c) { fread \%c }
  3332.  
  3333.    \f_getchar(channel)
  3334.           Equivalent to FREAD /CHAR. Returns the character actually read.
  3335.           If \f_getchar() does not fail but the return value is empty,
  3336.           this means a NULL character was read.
  3337.           
  3338.    \f_getline(channel)
  3339.           Equivalent to FREAD /LINE. Returns the line actually read, but
  3340.           with the line terminator stripped. If \f_getline() does not
  3341.           fail but the return value is empty, this normally means an
  3342.           empty line was read.
  3343.           
  3344.    \f_getblock(channel,n)
  3345.           Equivalent to FREAD /SIZE:n. Returns the block of characters
  3346.           actually read. If the returned block is smaller than n, it
  3347.           indicates either that the end of file was reached or a NUL
  3348.           character is in the block.
  3349.           
  3350.    \f_putchar(channel,c)
  3351.           Equivalent to FWRITE /CHARACTER. Writes the character c. If c
  3352.           contains more than one character, only the first is written. If
  3353.           c is empty a NUL is written. Returns the number of characters
  3354.           written on success, or a negative error code upon failure.
  3355.           
  3356.    \f_putline(channel,string)
  3357.           Equivalent to FWRITE /LINE. Writes the string and adds the
  3358.           appropriate line termination character or sequence. If the
  3359.           string is empty or omitted, an empty line is written. Returns
  3360.           the number of characters written on success, or a negative
  3361.           error code upon failure.
  3362.           
  3363.    \f_putblock(channel,string)
  3364.           Equivalent to FWRITE /STRING. Writes the string as given. If
  3365.           the string is empty or omitted, nothing is written. Returns the
  3366.           number of characters written on success, or a negative error
  3367.           code upon failure.
  3368.      _________________________________________________________________
  3369.    
  3370.     1.22.8. File I/O Function Examples
  3371.     
  3372.   fopen /read \%c oofa.txt            ; Open our favorite file for reading
  3373.   if failure exit 1                   ; Check that it's open
  3374.   while not \f_eof(\%c) {             ; Loop until EOF
  3375.       .line := \f_getline(\%c)        ; Get a line
  3376.       if success echo {\m(line)}      ; Echo it
  3377.   }
  3378.   if not \f_eof(\%c) {                ; Check reason for loop exit
  3379.       exit 1 File Error: \f_errmsg()  ; If not EOF say so.
  3380.   }
  3381.  
  3382.   frewind \%c                         ; Rewind the file
  3383.   while not \f_eof(\%c) {             ; Same thing but with block i/o
  3384.       .block := \f_getblock(\%c,256)  ; (much faster than line i/o)
  3385.       if success xecho {\m(block)}
  3386.   }
  3387.  
  3388.   frewind \%c                         ; Rewind again
  3389.   while not \f_eof(\%c) {             ; Same deal but with character i/o
  3390.       .c := \f_getchar(\%c)           ; (much slower than line i/o)
  3391.       if success xecho {\m(c)}
  3392.   }
  3393.   close \%c
  3394.  
  3395.    To close all open files (equivalent to FCLOSE ALL):
  3396.    
  3397.   for \%i 0 \v(f_max)-1 1 {
  3398.       if \f_status(\%i) fclose \%i
  3399.   }
  3400.      _________________________________________________________________
  3401.    
  3402.   1.23. The EXEC Command
  3403.   
  3404.    The EXEC command is available only in UNIX.
  3405.    
  3406.    EXEC [ /REDIRECT ] command [ arg1 [ arg2 [ ... ] ]
  3407.           Runs the given command with the arguments in such a way that
  3408.           the command replaces C-Kermit in memory, and C-Kermit ceases to
  3409.           execute. EXEC is like RUN, except instead of returning to
  3410.           C-Kermit when finished, the command returns to whatever process
  3411.           invoked Kermit.
  3412.           
  3413.    In the normal case, no files are closed, so the EXEC'd command
  3414.    inherits the open files, read/write pointers, working directory,
  3415.    process ID, user ID (unless command is SUID), group ID (unless command
  3416.    is SGID), groups, etc. (In UNIX, the EXEC command is simply a front
  3417.    end for execvp().)
  3418.    
  3419.    If the /REDIRECT switch is included, then if a connection is open (SET
  3420.    LINE or SET HOST), it becomes the standard input and output of the
  3421.    EXEC'd program. If no connection is open, the /REDIRECT switch has no
  3422.    effect. For example to use C-Kermit for PPP dialing in Linux:
  3423.    
  3424.   set modem type usr          ; Specify the kind of modem you have
  3425.   set line /dev/ttyS1         ; Specify the device it's connected to
  3426.   set speed 57600             ; and the speed
  3427.   set flow rts/cts            ; and flow control.
  3428.   set dial retries 100        ; Try the dial sequence up to 100 times.
  3429.   dial {{9-212-555-1212}{9-212-555-1213}{9-212-555-1214}{9-212-555-1215}}
  3430.   if fail exit 1
  3431.   for \%i 1 16 1 {            ; Try up to 16 times to get login prompt
  3432.       input 10 Login:         ; Wait 10 sec for it to appear
  3433.       if success break        ; Got it - proceed...
  3434.       output \13              ; Send a carriage return and try again
  3435.   }
  3436.   if ( > \%i 16 ) stop 1 NO LOGIN PROMPT
  3437.   lineout \(myuserid)         ; Send user ID
  3438.   input 30 assword:           ; Wait for Password prompt
  3439.   if fail stop 1 NO PASSWORD PROMPT
  3440.   lineout \m(mypassword)      ; Send the password.
  3441.   exec /redirect pppd         ; Replace ourselves with pppd.
  3442.  
  3443.    In this example we assume that the script has already set up the
  3444.    myuserid and mypassword variables -- normally the password should be
  3445.    prompted for, rather than stored on disk. Notice the advantages over
  3446.    the well-known "chat script":
  3447.      * You don't have to control the modem itself with AT commands;
  3448.        Kermit's DIAL command does this for you.
  3449.      * You can have Kermit automatically redial as many times as you want
  3450.        until it gets a connection (if this is legal in your country).
  3451.      * You can have Kermit fetch the number or numbers from a dialing
  3452.        directory.
  3453.      * You can have Kermit cycle through a list of phone numbers (this is
  3454.        new in C-Kermit 7.0; see [383]Section 2.1.16) without having to
  3455.        enter the numbers in a dialing directory.
  3456.      * Dialing is location-independent; you can use the same script to
  3457.        dial from different areas or countries.
  3458.      * Once the connection is made, the full power of Kermit's script
  3459.        language is available to manage the dialog with the terminal
  3460.        server or other device that answers the phone call.
  3461.        
  3462.    NOTE: PPP and SLIP dialing are not available in Windows 95/98/NT/2000,
  3463.    whose APIs do not provide a method for an application to hand over a
  3464.    connection to the PPP or SLIP driver.
  3465.      _________________________________________________________________
  3466.    
  3467.   1.24. Getting Keyword Lists with '?'
  3468.   
  3469.    Suppose you type "te" at the C-Kermit> 6.0 prompt and then Esc or Tab
  3470.    to request keyword completion. Kermit beeps, indicating that more than
  3471.    one command starts with "te". But if you type '?' to see what they
  3472.    are, Kermit shows only "telnet". So why the beep? Because of invisible
  3473.    keywords like "telopt", "terminal", and "text". Lots of keywords are
  3474.    invisible because they are either synonyms for other keywords or else
  3475.    esoteric options to be used only in special circumstances, so we don't
  3476.    want them cluttering up the menus.
  3477.    
  3478.    But then there is no way for you to discover them. So in C-Kermit 7.0,
  3479.    if you type '?' AFTER the beginning of a keyword field, then invisible
  3480.    keywords are shown too:
  3481.    
  3482.   C-Kermit> te<Esc><BEEP>
  3483.   C-Kermit> te? Command, one of the following:
  3484.    telnet    telopt    terminal  text
  3485.   C-Kermit>te
  3486.  
  3487.    But if '?' is typed at the beginning of a field, only visible keywords
  3488.    are shown, as before (so, in this example, if '?' is typed at the
  3489.    C-Kermit> prompt, "telnet" is the only command shown that starts with
  3490.    "te").
  3491.      _________________________________________________________________
  3492.    
  3493.   2. MAKING AND USING CONNECTIONS The SET LINE, SET HOST, and SET PORT (a
  3494.   synonym for SET LINE) commands have new synonyms, in which the word SET is
  3495.   replaced by the word OPEN: OPEN LINE, etc. There is no new functionality
  3496.   here, but OPEN is a better verb, since SET generally takes no action, whereas
  3497.   these commands actually try to open a connection. Furthermore, there is the
  3498.   symmetry with CLOSE.
  3499.     ________________________________________________________________________
  3500.   
  3501.   2.0. SET LINE and SET HOST Command SwitchesThe SET LINE (SET PORT) and SET
  3502.   HOST commands now allow switches before the device or host name, in most
  3503.   cases, and under certain circumstances, also at the end. The new syntax is
  3504.   backwards compatible with the previous syntax; thus SET LINE, SET PORT, and
  3505.   SET HOST commands in command files written for C-Kermit 6.0 or earlier still
  3506.   work. The expanded syntax is:
  3507.   
  3508.   { OPEN, SET } { LINE, PORT, HOST } [ switches ] device-or-address [ switches
  3509.   ]
  3510.   
  3511.   The first group of switches is:
  3512.   
  3513.    /NETWORK-TYPE:{TCP/IP,X.25,PIPE,PTY...}
  3514.           When more than one network type is available, this lets you
  3515.           specify the type of network to use for this connection without
  3516.           affecting your global SET NETWORK TYPE. See [384]Section 2.7
  3517.           about pipes and ptys.
  3518.           
  3519.    /USERID:[string]
  3520.           This switch is equivalent to SET LOGIN USERID. If a string is
  3521.           given, it sent to host during Telnet negotiations; if this
  3522.           switch is given but the string is omitted, no user ID is sent
  3523.           to the host. If this switch is not given, your current LOGIN
  3524.           USERID (\v(userid) value), if any, is sent. Unlike most other
  3525.           switches, this one is "sticky", since the value must persist
  3526.           throughout the session in case the server requests the ID
  3527.           string at a later time.
  3528.           
  3529.    /CONNECT
  3530.           Enter CONNECT mode immediately and automatically after the
  3531.           device or connection is open. On serial devices, however, when
  3532.           CARRIER-WATCH is not OFF, wait up to 1 second for the Carrier
  3533.           Detect signal to appear before trying to connect, to give the
  3534.           device time to react DTR, which might have been off prior to
  3535.           opening the device.
  3536.           
  3537.    /SERVER
  3538.           Enter server mode immediately and automatically after the
  3539.           device or connection is open. Treatment of carrier is the same
  3540.           as for /CONNECT.
  3541.           
  3542.    /WAIT
  3543.           
  3544.    /NOWAIT
  3545.           For Telnet connections only: Like SET TELNET WAIT { ON, OFF },
  3546.           but applies only to this connection, and in fact applies only
  3547.           when OPENing this connection (which is usually the only place
  3548.           it matters). Typically you would use TELNET /NOWAIT to make a
  3549.           connection to a misbehaving Telnet server that does not reply
  3550.           to negotiations as required by the Telnet protocol definition.
  3551.           
  3552.    Note: /CONNECT and /SERVER switches are not available in the RLOGIN
  3553.    and TELNET commands, since these commands already include an implicit
  3554.    /CONNECT and preclude automatic entry into server mode.
  3555.    
  3556.    The /CONNECT and /SERVER switches are especially useful with "set host
  3557.    *" connections. For example, suppose you want to start a Kermit server
  3558.    on socket 3000 of your TCP host. Normally you would have to give the
  3559.    command:
  3560.    
  3561.   set host * 3000
  3562.  
  3563.    and then wait for a connection to come in, and only then could you
  3564.    give the SERVER command (or else define a macro to do this, and then
  3565.    execute the macro). Now you can do it in one step:
  3566.    
  3567.   set host /server * 3000
  3568.  
  3569.    This tells C-Kermit to wait for the connection and then enter server
  3570.    mode once it comes in, no matter how long it takes. Similarly, "set
  3571.    host /conn *" can be used to wait for a "chat" connection to come in.
  3572.    
  3573.    Another set of switches is available in VMS only, for use only with
  3574.    SET LINE:
  3575.    
  3576.    /SHARE
  3577.           Allows the SET LINE device to be opened in shared mode.
  3578.           Normally it makes no sense to open a serial device in shared
  3579.           mode, but it's necessary when C-Kermit is running in an
  3580.           environment such as DECIntact, that opens your job's
  3581.           controlling terminal in such a way that C-Kermit can't open it
  3582.           too, unless it enables SHARE privilege. Note: SHARE privilege
  3583.           is required.
  3584.           
  3585.    /NOSHARE
  3586.           Requires that the SET LINE device not be in use by any other
  3587.           process in order for it to be successfully opened by C-Kermit.
  3588.           If neither /SHARE nor /NOSHARE is specified, /NOSHARE is used.
  3589.           
  3590.    The second group of switches is:
  3591.    
  3592.    /NO-TELNET-INIT
  3593.           Do not send initial Telnet negotiations even if this is a
  3594.           Telnet port.
  3595.           
  3596.    /RAW-SOCKET
  3597.           This is a connection to a raw TCP socket ([385]Section 2.3.5).
  3598.           
  3599.    /RLOGIN
  3600.           Use Rlogin protocol even if this is not an Rlogin port.
  3601.           
  3602.    /TELNET
  3603.           Send initial Telnet negotiations even if this is not a Telnet
  3604.           port.
  3605.           
  3606.    As of C-Kermit 7.0 and K95 1.1.19, the TELNET command includes an
  3607.    implicit /TELNET switch. So if you TELNET to a non-TELNET port, Kermit
  3608.    sends initial Telnet negotiations. This makes sense, since that's what
  3609.    "telnet" means.
  3610.    
  3611.    If you want to make a connection to a non-Telnet port without sending
  3612.    initial Telnet negotiations, use:
  3613.    
  3614.   set host [ /connect ] name-or-address port
  3615.  
  3616.    or:
  3617.    
  3618.   telnet name-or-address port /no-telnet-init
  3619.  
  3620.    Additional switches might be added in the future; type "set host ?" or
  3621.    "set line ?" to see a current list.
  3622.      _________________________________________________________________
  3623.    
  3624.   2.1. Dialing
  3625.   
  3626.    Automatic redialing is illegal or restricted in many countries, so
  3627.    until C-Kermit 7.0, it was disabled by default, i.e. until a SET DIAL
  3628.    RETRIES command was given. In C-Kermit 7.0, if no SET DIAL RETRIES
  3629.    command has been given, a default is picked dynamically at DIAL time
  3630.    based on the calling country code, if known. At this writing, the only
  3631.    country code known to have no restrictions on automatic redialing is
  3632.    1. So in this case a limit of 10 is chosen; otherwise 1. If you have
  3633.    not given an explicit SET DIAL RETRIES command, SHOW DIAL shows the
  3634.    value as "(auto)", and then the value actually used is shown when you
  3635.    give the DIAL command.
  3636.    
  3637.    As of C-Kermit 7.0, automatic redialing is automatically canceled if
  3638.    the call could not be placed because no dialtone was detected.
  3639.      _________________________________________________________________
  3640.    
  3641.     2.1.1. The Dial Result Message
  3642.     
  3643.    If DIAL DISPLAY is not ON, the "Call complete" message now shows the
  3644.    modem's call result message, for example:
  3645.    
  3646.   Dialing: ...
  3647.   Call complete: "CONNECT 31200/ARQ/V32/LAPM/V42BIS"
  3648.  
  3649.    The exact format and contents of this message, of course, depends on
  3650.    the make, model, and configuration of your modem, so use your modem
  3651.    manual to interpret it. The call result message is also available in
  3652.    C-Kermit's \v(dialresult) variable.
  3653.    
  3654.   C-Kermit> echo \v(dialresult)
  3655.   CONNECT 31200/ARQ/V32/LAPM/V42BIS
  3656.   C-Kermit> echo Speed = \fword(\v(dialresult),2)
  3657.   Speed = 31200
  3658.   C-Kermit>
  3659.  
  3660.    Suppose your modem reports the modulation speed as shown above and you
  3661.    want to ensure your call is completed at (say) 24000 bps or more. You
  3662.    can use a little macro to do the job:
  3663.    
  3664. define HSDIAL {                ; High Speed DIAL
  3665.     local \%s
  3666.     if < \v(argc) 1 if not def \v(dialnumber) end 1 Usage: \%0 number
  3667.     set dial retries 100
  3668.     set dial interval 1
  3669.     while true {
  3670.         dial \%*
  3671.         if fail end 1 DIAL failed.
  3672.         asg \%s \fword(\v(dialresult),2)
  3673.         if def \%s if numeric \%s if not < \%s 24000 break
  3674.     }
  3675. }
  3676.  
  3677.    (See [386]Section 7.5 about the \%* variable.)
  3678.      _________________________________________________________________
  3679.    
  3680.     2.1.2. Long-Distance Dialing Changes
  3681.     
  3682.    Due to the glut of cell phones, pagers, fax machines, ISPs, etc, area
  3683.    codes and dialing rules are changing all the time. In the North
  3684.    American Numbering Plan (NANP) countries (USA, Canada, etc), area
  3685.    codes are split or overlayed with increasing frequency, and 10- and
  3686.    11-digit dialing is gradually becoming the norm for local calls.
  3687.    Changes are occurring In Europe, too, partly for these reasons and
  3688.    partly because of some new EC rules.
  3689.    
  3690.    In France, effective 18 October 1996, all calls, even local ones, must
  3691.    be dialed with an area code. French area codes are presently 1-digit
  3692.    numbers, 1-6, and the long-distance dialing prefix is 0. All calls
  3693.    within France are considered long distance and begin with 01, 02, ...,
  3694.    06.
  3695.    
  3696.    Effective 1 May 1997, all calls within the US state of Maryland, even
  3697.    local ones, must be dialed with an area code but without the
  3698.    long-distance prefix -- this is the now widely-known North American
  3699.    phenomenon of "ten digit dialing". The same is happening elsewhere --
  3700.    many cities in Florida adopted 10-digit dialing in 1998.
  3701.    
  3702.    In Italy beginning 19 June 1998, all calls to fixed (as opposed to
  3703.    mobile) numbers must be prefixed by 0. When calling into Italy from
  3704.    outside, the 0 must follow the country code (39). Calls to cell
  3705.    phones, however, must be placed without the 0. Then on 29 December
  3706.    2000, the 0 will become a 4 (for calling fixed numbers) and a prefix
  3707.    of 3 must used for calling mobile phones. More info at:
  3708.    http://www.telecomitalia.it/npnn/.
  3709.    
  3710.    In Spain, effective 4 April 1998, with hard cutover on 18 July 1998,
  3711.    all calls within the country must be dialed with 9 digits, and all
  3712.    calls from outside Spain must also be dialed with 9 digits (after the
  3713.    country code, 34). The new 9-digit numbers all begin with "9". More
  3714.    info at: [387]http://www.telefonica.es/cambiodenumeracion/
  3715.    
  3716.    Several new dialing features and commands have been added in version
  3717.    6.1 and 7.0 to address these changes.
  3718.    
  3719.    C-Kermit 6.0 and Kermit 95 1.1.11 and earlier handle the French
  3720.    situation via a reasonable subterfuge (setting the local area code to
  3721.    a nonexistent one), but did not handle "ten-digit dialing" well at
  3722.    all; the recommended technique was to change the long-distance dialing
  3723.    prefix to nothing, but this defeated Kermit's "list numbers for one
  3724.    name" feature when the numbers were in different locations. For
  3725.    example:
  3726.    
  3727.   set dial ld-prefix
  3728.   dial onlineservice
  3729.  
  3730.    where "onlineservice" is a dialing directory entry name corresponding
  3731.    to entries that are in (say) Maryland as well as other states, would
  3732.    not correctly dial the numbers not in Maryland.
  3733.    
  3734.    A new command lets you specify a list of area codes to be considered
  3735.    local, except that the area code must be dialed:
  3736.    
  3737.    SET DIAL LC-AREA-CODES [ areacode [ areacode [ areacode [ ... ] ] ] ]
  3738.           The list may include up to 32 area codes. If a number is called
  3739.           whose area code is in this list, it is dialed WITHOUT the
  3740.           long-distance prefix, but WITH the area code.
  3741.           
  3742.    So in Maryland, which (last time we looked) has two area codes, 410
  3743.    and 301, the setup would be:
  3744.    
  3745.   SET DIAL LC-AREA-CODES 410 301
  3746.  
  3747.    Example:
  3748.    
  3749.   SET DIAL LD-PREFIX 1
  3750.   SET DIAL AREA-CODE 301
  3751.   SET DIAL LC-AREA-CODES 410 301 <-- Area codes in 10-digit dialing region
  3752.   DIAL +1 (301) 765-4321         <-- Dials 3017654321  (local with area code)
  3753.   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
  3754.   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
  3755.  
  3756.    The SET DIAL LC-AREA-CODES command does not replace the SET DIAL
  3757.    AREA-CODE command. The latter specifies the area code you are dialing
  3758.    from. If the called number is in the same area code, then the area
  3759.    code is dialed if it is also in the LC-AREA-CODES list, and it is not
  3760.    dialed otherwise. So if "301" had not appeared in the LC-AREA-CODES
  3761.    list in the previous example:
  3762.    
  3763.   SET DIAL LD-PREFIX 1
  3764.   SET DIAL AREA-CODE 301
  3765.   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
  3766.   DIAL +1 (301) 765-4321         <-- Dials 7654321     (local)
  3767.   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
  3768.   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
  3769.  
  3770.    The new Kermit versions also add a Local Call Prefix and Local Call
  3771.    Suffix, in case you have any need for it. These are added to the
  3772.    beginning and of local phone numbers (i.e. numbers that are not
  3773.    long-distance or international). Examples:
  3774.    
  3775.   SET DIAL LD-PREFIX 1
  3776.   SET DIAL LC-PREFIX 9
  3777.   SET DIAL LC-SUFFIX *
  3778.   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
  3779.   SET DIAL AREA-CODE 301
  3780.   DIAL +1 (301) 765-4321         <-- Dials 97654321*     (local)
  3781.   DIAL +1 (410) 765-4321         <-- Dials 94107654321*  (local with area code)
  3782.   DIAL +1 (212) 765-4321         <-- Dials 12127654321   (long distance)
  3783.      _________________________________________________________________
  3784.    
  3785.     2.1.3. Forcing Long-Distance Dialing
  3786.     
  3787.    Suppose a number is in your country and area, but for some reason you
  3788.    need to dial it long-distance anyway (as is always the case in
  3789.    France). There have always been various ways to handle this:
  3790.    
  3791.     1. Temporarily set your area code to a different (or nonexistent or
  3792.        impossible) one (but this required knowledge of which area codes
  3793.        were nonexistent or impossible in each country).
  3794.     2. Dial the number literally instead of using the portable format,
  3795.        but this defeats the purpose of the portable dialing directory.
  3796.        
  3797.    Now there is also a new command that, very simply, can force
  3798.    long-distance dialing:
  3799.    
  3800.    SET DIAL FORCE-LONG-DISTANCE { ON, OFF }
  3801.           If a call is placed to a portable phone number within the same
  3802.           country code as the calling number, it is dialed with the
  3803.           long-distance prefix and the area code if FORCE-LONG-DISTANCE
  3804.           is ON. If OFF, the regular rules and procedures apply.
  3805.           
  3806.    Example (France):
  3807.    
  3808.   SET DIAL COUNTRY-CODE 33
  3809.   SET DIAL AREA-CODE 6
  3810.   SET DIAL FORCE-LONG-DISTANCE ON
  3811.  
  3812.    (In fact, SET DIAL COUNTRY-CODE 33 automatically sets DIAL
  3813.    FORCE-LONG-DISTANCE ON...)
  3814.    
  3815.    Example (USA, for a certain type of reverse-charge calling in which
  3816.    the called number must always be fully specified):
  3817.    
  3818.   SET DIAL PREFIX 18002666328$     ; 1-800-COLLECT
  3819.   SET DIAL COUNTRY-CODE 1
  3820.   SET DIAL AREA-CODE 212
  3821.   SET DIAL FORCE-LONG-DISTANCE ON
  3822.  
  3823.    Example (Toronto, where calls to exchange 976 within area code 416
  3824.    must be dialed as long distance, even when you are dialing from area
  3825.    code 416):
  3826.    
  3827.   SET DIAL COUNTRY-CODE 1
  3828.   SET DIAL AREA-CODE 416
  3829.   SET DIAL FORCE-LONG-DISTANCE ON
  3830.   DIAL +1 (416) 976-xxxx
  3831.  
  3832.    If dialing methods were consistent and sensible, of course it would be
  3833.    possible to always dial every domestic call as if it were long
  3834.    distance. But in many locations this doesn't work or if it does, it
  3835.    costs extra. The following macro can be used for dialing any given
  3836.    number with forced long-distance format:
  3837.    
  3838.   define LDIAL {
  3839.       local \%x
  3840.       set dial force-long-distance on
  3841.       dial \%*
  3842.       asg \%x \v(success)
  3843.       set dial force-long-distance off
  3844.       end \%x
  3845.   }
  3846.  
  3847.    (See [388]Section 7.5 about the \%* variable.)
  3848.      _________________________________________________________________
  3849.    
  3850.     2.1.4. Exchange-Specific Dialing Decisions
  3851.     
  3852.    This applies mainly to the North American Numbering Plan (NANP). Refer
  3853.    to the section "Alternative notations" in [389]Using C-Kermit 2nd
  3854.    Edition, pages 106-107, and the story about Toronto on page 110. Using
  3855.    the new LC-AREA-CODES list, we can address the problem by treating the
  3856.    exchange as part of the area code:
  3857.    
  3858.   SET DIAL LD-PREFIX 1
  3859.   SET DIAL AREA-CODE 416
  3860.   SET DIAL LC-AREA-CODES 905276
  3861.   DIAL +1 416 765 4321               <-- 7654321      (local)
  3862.   DIAL +1 905 276 4321               <-- 9052764321   (local with area code)
  3863.   DIAL +1 905 528 4321               <-- 19055284321  (long distance)
  3864.  
  3865.    The same technique can be used in Massachusetts (story at top of page
  3866.    111) and in any other place where dialing to some exchanges within a
  3867.    particular area code is local, but to others in the same area code is
  3868.    long distance.
  3869.      _________________________________________________________________
  3870.    
  3871.     2.1.5. Cautions about Cheapest-First Dialing
  3872.     
  3873.    Kermit does not maintain a knowledge base of telephony information; it
  3874.    only provides the tools to let you enter a phone number in a standard
  3875.    format and dial it correctly from any location in most cases.
  3876.    
  3877.    In particular, Kermit does not differentiate the charging method from
  3878.    the dialing method. If a call that is DIALED as long-distance (e.g.
  3879.    from 212 to 718 in country code 1) is not CHARGED as long distance, we
  3880.    have no way of knowing that without keeping a matrix of charging
  3881.    information for every area-code combination within every country, and
  3882.    any such matrix would be obsolete five minutes after it was
  3883.    constructed. Thus, "cheapest-first" sorting is only as reliable as our
  3884.    assumption that the charging method follows the dialing method. A good
  3885.    illustration would be certain online services that have toll-free
  3886.    dialup numbers which they charge you a premium (in your online service
  3887.    bill) for using.
  3888.      _________________________________________________________________
  3889.    
  3890.     2.1.6. Blind Dialing (Dialing with No Dialtone)
  3891.     
  3892.    C-Kermit's init string for Hayes-like modems generally includes an X4
  3893.    command to enable as many result codes as possible, so that Kermit can
  3894.    react appropriately to different failure reasons. One of the result
  3895.    codes that X4 enables is "NO DIALTONE". A perhaps not obvious side
  3896.    effect of enabling this result code that the modem must hear dialtone
  3897.    before it will dial.
  3898.    
  3899.    It is becoming increasingly necessary to force a modem to dial even
  3900.    though it does not hear a dialtone on the phone line; for example,
  3901.    with PBXs that have strange dialtones, or with phone systems in
  3902.    different countries, or with ISDN phones, etc. This is called "blind
  3903.    dialing".
  3904.    
  3905.    C-Kermit 7.0 has two new commands to cope with this situation:
  3906.    
  3907.    SET DIAL IGNORE-DIALTONE { ON, OFF }
  3908.           OFF (the default) means to tell the modem to wait for dialtone
  3909.           before dialing. ON means to enable "blind dialing", i.e. tell
  3910.           the modem NOT to wait for dialtone before dialing. Generally
  3911.           this is accomplished by sending ATX3 to the modem just prior to
  3912.           dialing. SET MODEM TYPE xxx and then SHOW MODEM displays
  3913.           Kermit's built-in "ignore dialtone" command.
  3914.           
  3915.    SET DIAL COMMAND IGNORE-DIALTONE text
  3916.           This lets you change the built-in ignore-dialtone command (such
  3917.           as ATX3) to whatever you choose, in case the built-in one does
  3918.           not work, or another command works better.
  3919.           
  3920.    Notes:
  3921.     1. The ignore-dialtone command is not sent unless SET DIAL
  3922.        IGNORE-DIALTONE is ON.
  3923.     2. The ATX3 command generally disables not only NO DIALTONE, but also
  3924.        BUSY. So this will prevent Kermit from detecting when the line is
  3925.        busy. This is a property of the modem, not of Kermit.
  3926.      _________________________________________________________________
  3927.    
  3928.     2.1.7. Trimming the Dialing Dialog
  3929.     
  3930.    The command:
  3931.    
  3932.   SET MODEM COMMAND action [ command ]
  3933.  
  3934.    is used to override Kermit's built-in modem commands for each action,
  3935.    for each kind of modem in its internal database. If you include a
  3936.    command, this is used instead of the built-in one. If you omit the
  3937.    command, this restores the original built-in command.
  3938.    
  3939.    If you want to omit the command altogether, so Kermit doesn't send the
  3940.    command at all, or wait for a response, use:
  3941.    
  3942.   SET MODEM COMMAND action {}
  3943.  
  3944.    That is, specify a pair of empty braces as the command, for example:
  3945.    
  3946.   SET MODEM COMMAND ERROR-CORRECTION ON {}
  3947.      _________________________________________________________________
  3948.    
  3949.     2.1.8. Controlling the Dialing Speed
  3950.     
  3951.    The rate at which characters are sent to the modem during dialing is
  3952.    normally controlled by the built-in modem database. You might want to
  3953.    override this if Kermit seems to be dialing too slowly, or it is
  3954.    sending characters to the modem faster than the modem handle them. A
  3955.    new command was added for this in C-Kermit 7.0:
  3956.    
  3957.    SET DIAL PACING number
  3958.           Specifies the number of milliseconds (thousandths of seconds)
  3959.           to pause between each character when sending commands to the
  3960.           modem during DIAL or ANSWER command execution. 0 means no pause
  3961.           at all, -1 (the default) or any other negative number means to
  3962.           use the value from the database. Any number greater than 0 is
  3963.           the number of milliseconds to pause.
  3964.           
  3965.    HINT: You might also need to control the rate at which the modem
  3966.    generates Touch Tones during dialing, for example when sending a
  3967.    numeric page. There are two ways to do this. One way is to insert
  3968.    pause characters into the dialing string. For modems that use the AT
  3969.    command set, the pause character is comma (,) and causes a 2-second
  3970.    pause. On most modems, you can use the S8 register to change the pause
  3971.    interval caused by comma in the dialing string. The other way is to
  3972.    set your modem's tone generation interval, if it has a command for
  3973.    that. Most AT-command-set modems use S11 for this; the value is in
  3974.    milliseconds. For example on USR modems:
  3975.    
  3976.   ATS11=200
  3977.  
  3978.    selects an interval of 200 milliseconds to separate each dialing tone.
  3979.    
  3980.    Hint: To add S-Register settings or other commands to your dialing
  3981.    procedure, use the new SET MODEM COMMAND PREDIAL-INIT command
  3982.    ([390]Section 2.2.2).
  3983.      _________________________________________________________________
  3984.    
  3985.     2.1.9. Pretesting Phone Number Conversions
  3986.     
  3987.    The LOOKUP command now accepts telephone numbers as well as
  3988.    directory-entry names, for example:
  3989.    
  3990.   LOOKUP +1 (212) 7654321
  3991.  
  3992.    When given a phone number, LOOKUP prints the result of converting the
  3993.    phone number for dialing under the current dialing rules. For example,
  3994.    if my country code is 1 and my area code is 212, and I am dialing out
  3995.    from a PBX whose outside-line prefix is "93,":
  3996.    
  3997.   C-Kermit> lookup +1 (212) 7654321
  3998.   +1 (212) 7654321 => 93,7654321
  3999.   C-Kermit>
  4000.  
  4001.    You can also use the \fdialconvert(phone-number) function
  4002.    ([391]Section 2.1.11) to do this programmatically:
  4003.    
  4004.   C-Kermit> echo "\fdialconvert(+1 (212) 7654321)"
  4005.   "93,7654321"
  4006.   C-Kermit>
  4007.  
  4008.    So the new LOOKUP behaves as follows:
  4009.    
  4010.    LOOKUP portable-format-phone-number
  4011.           Displays how the number would actually be dialed Sets FAILURE
  4012.           if there was a conversion error, otherwise SUCCESS.
  4013.           
  4014.    LOOKUP literal-format-phone-number
  4015.           Displays the same literal-format-phone-number Always sets
  4016.           SUCCESS.
  4017.           
  4018.    LOOKUP dialing-directory-name
  4019.           Displays all matching entries and converts portable phone
  4020.           numbers. Sets SUCCESS if at least one entry was found,
  4021.           otherwise FAILURE.
  4022.           
  4023.    LOOKUP =anything
  4024.           Displays "=anything" and sets SUCCESS.
  4025.           
  4026.    There is, at present, no programmatic way to fetch numbers from the
  4027.    dialing directory. This will be considered for a future release.
  4028.      _________________________________________________________________
  4029.    
  4030.     2.1.10. Greater Control over Partial Dialing
  4031.     
  4032.    The following rules now apply to partial dialing:
  4033.    
  4034.      * Phone number transformations based on country and area code,
  4035.        application of prefixes, etc, are performed only on the first
  4036.        PDIAL.
  4037.      * Each PDIAL argument is looked up in the dialing directory, so it
  4038.        is possible have directory entries for pieces of phone numbers or
  4039.        other information.
  4040.      * Suffixes are not applied automatically, since there is no way for
  4041.        C-Kermit to know in which PDIAL segment you want them to be
  4042.        applied.
  4043.        
  4044.    However, the suffix that *would* have been applied, based on the
  4045.    dialing rules that were invoked when processing the first PDIAL
  4046.    command, is stored in the variable:
  4047.    
  4048.   \v(dialsuffix)
  4049.  
  4050.    which you can include in any subsequent PDIAL or DIAL commands.
  4051.    
  4052.    Example:
  4053.    
  4054.   pdial {\m(my_long_distance_pager_number_part_1)}
  4055.   pdial {\m(my_long_distance_pager_number_part_2)}
  4056.   pdial {\v(dialsuffix)}
  4057.   pdial {\m(my_long_distance_pager_number_part_3)}
  4058.   pdial {@\m(numeric_pager_code)#}
  4059.      _________________________________________________________________
  4060.    
  4061.     2.1.11. New DIAL-related Variables and Functions
  4062.     
  4063.    \fdialconvert(s)
  4064.           s is a phone number in either literal or portable format (not a
  4065.           dialing directory entry name). The function returns the dial
  4066.           string that would actually be used by the DIAL command when
  4067.           dialing from the current location, after processing country
  4068.           code, area code, and other SET DIAL values, and should be the
  4069.           same as the result of LOOKUP when given a telephone number.
  4070.           
  4071.    \v(dialsuffix)
  4072.           Contains the suffix, if any, that was applied in the most
  4073.           recent DIAL command, or the suffix that would have been applied
  4074.           in the most recent PDIAL command. Use this variable to send the
  4075.           dial suffix at any desired point in a PDIAL sequence.
  4076.           
  4077.    \v(dialtype)
  4078.           A number indicating the type of call that was most recently
  4079.           placed. Can be used after a normal DIAL command, or after the
  4080.           first PDIAL command in a PDIAL sequence. Values are:
  4081.           
  4082.   -2: Unknown because TAPI handled the phone number translation.
  4083.   -1: Unknown because some kind of error occured.
  4084.    0: Internal within PBX.
  4085.    1: Toll-free.
  4086.    2: Local within calling area.
  4087.    3: Unknown (e.g. because a literal-format phone number was given).
  4088.    4: Long distance within country.
  4089.    5: International
  4090.  
  4091.    \v(dialcount)
  4092.           The current value of the DIAL retry counter, for use in a DIAL
  4093.           macro ([392]Section 2.1.13).
  4094.           
  4095.    \v(d$px)
  4096.           PBX Exchange (see [393]Section 2.1.12).
  4097.           
  4098.    Other dial-related variables, already documented in [394]Using
  4099.    C-Kermit (or other sections of this document, e.g. [395]Section
  4100.    2.1.1), include \v(dialnumber), \v(dialstatus), etc. A convenient way
  4101.    to display all of them is:
  4102.    
  4103.   show variable dial  ; hint: abbreviate "sho var dial"
  4104.  
  4105.    This shows the values of all the variables whose names start with
  4106.    "dial". Also "show variable d$" (to show the \v(d$...) variables).
  4107.      _________________________________________________________________
  4108.    
  4109.     2.1.12. Increased Flexibility of PBX Dialing
  4110.     
  4111.    Refer to [396]Using C-Kermit, 2nd Edition, pages 107-108. Recall that
  4112.    three commands are needed to configure C-Kermit for dialing from a
  4113.    PBX:
  4114.    
  4115.   SET DIAL PBX-EXCHANGE number
  4116.   SET DIAL PBX-INSIDE-PREFIX number
  4117.   SET DIAL PBX-OUTSIDE-PREFIX number
  4118.  
  4119.    Unfortunately, this model does not accommodate PBXs that have more
  4120.    than one exchange. For example our PBX at Columbia University (which
  4121.    must handle more than 10,000 phones) has 853-xxxx and 854-xxxx
  4122.    exchanges.
  4123.    
  4124.    Beginning in C-Kermit 7.0, the SET DIAL PBX-EXCHANGE command accepts a
  4125.    list of exchanges, e.g.:
  4126.    
  4127.   SET DIAL PBX-EXCHANGE 853 854
  4128.  
  4129.    (multiple exchanges are separated by spaces, not commas).
  4130.    
  4131.    So now when dialing a portable-format number that has the same country
  4132.    and area codes as those of your dialing location, C-Kermit compares
  4133.    the exchange of the dialed number with each number in the PBX Exchange
  4134.    list (rather than with a single PBX Exchange number, as it did
  4135.    formerly) to determine whether this is an internal PBX number or an
  4136.    external call. If it is an external call, then the PBX Outside Prefix
  4137.    is applied, and then the normal dialing rules for local or
  4138.    long-distance calls.
  4139.    
  4140.    If it is an inside call, the exchange is replaced by the PBX Inside
  4141.    Prefix. But if the PBX has more than one exchange, a single fixed PBX
  4142.    Inside Prefix is probably not sufficient. For example, at Columbia
  4143.    University, we must dial 3-xxxx for an internal call to 853-xxxx, but
  4144.    4-xxxx for a call to 854-xxxx. That is, the inside prefix is the final
  4145.    digit of the exchange we are dialing. For this reason, C-Kermit 7.0
  4146.    provides a method to determine the inside prefix dynamically at
  4147.    dialing time, consisting of a new variable and new syntax for the SET
  4148.    DIAL PBX-INSIDE-PREFIX command:
  4149.    
  4150.    \v(d$px)
  4151.           This variable contains the exchange that was matched when a PBX
  4152.           internal call was detected. For example, if the PBX exchange
  4153.           list is "853 854" and a call is placed to +1 (212) 854-9999,
  4154.           \v(d$px) is set to 854.
  4155.           
  4156.    SET DIAL PBX-INSIDE-PREFIX \fxxx(...)
  4157.           If the PBX Inside Prefix is defined to be a function, its
  4158.           evaluation is deferred until dialing time. Normally, this would
  4159.           be a string function having \v(d$px) as an operand. Of course,
  4160.           you can still specify a constant string, as before.
  4161.           
  4162.    So given the following setup:
  4163.    
  4164.   SET DIAL COUNTRY-CODE 1
  4165.   SET DIAL AREA-CODE 212
  4166.   SET DIAL PBX-OUTSIDE-PREFIX 93,
  4167.   SET DIAL PBX-EXCHANGE 853 854
  4168.   SET DIAL PBX-INSIDE-PREFIX \fright(\v(d$px),1)
  4169.  
  4170.    The following numbers give the results indicated:
  4171.    
  4172.  Number                   Result
  4173.   +1 (212) 854-9876        4-9876
  4174.   +1 (212) 853-1234        3-1234
  4175.   +1 (212) 765-4321        93,765-4321
  4176.   +1 (333) 765-4321        93,1333765-4321
  4177.  
  4178.    Furthermore, the K_PBX_XCH environment variable may now be set to a
  4179.    list of exchanges to automatically initialize C-Kermit's PBX exchange
  4180.    list, for example (in UNIX ksh or bash):
  4181.    
  4182.   export K_PBX_XCH="853 854"
  4183.  
  4184.    (Quotes required because of the space.) Of course, this variable can
  4185.    also be set to a single exchange, as before:
  4186.    
  4187.   export K_PBX_XCH=853
  4188.      _________________________________________________________________
  4189.    
  4190.     2.1.13. The DIAL macro - Last-Minute Phone Number Conversions
  4191.     
  4192.    After a DIAL or LOOKUP command is given, a list of phone numbers is
  4193.    assembled from the dialing directory (if any), with all
  4194.    location-dependent conversion rules applied as described in Chapter 5
  4195.    of [397]Using C-Kermit.
  4196.    
  4197.    However, additional conversions might still be required at the last
  4198.    minute based on local or ephemeral conditions. So that you can have
  4199.    the final word on the exact format of the dial string, C-Kermit 7.0
  4200.    lets you pass the converted string through a macro of your own design
  4201.    for final processing before dialing. The relevant command is:
  4202.    
  4203.    SET DIAL MACRO [ name ]
  4204.           Specifies the name of a macro to be run on each phone number
  4205.           after all built-in conversions have been applied, just before
  4206.           the number is dialed. If no name is given, no macro is run. The
  4207.           phone number, as it would have been dialed if there were no
  4208.           dial macro, is passed to the macro.
  4209.           
  4210.    The dial macro can do anything at all (except start a file transfer).
  4211.    However, the normal use for the macro would be to modify the phone
  4212.    number. For this reason the phone number is passed to the macro as
  4213.    argument number 1 (\%1). To cause a modified number to be dialed, the
  4214.    macro should terminate with a RETURN statement specifying a return
  4215.    value. To leave the number alone, the macro should simply end.
  4216.    Example:
  4217.    
  4218.   define xxx return 10108889999$\%1
  4219.   set dial macro xxx
  4220.   dial xyzcorp
  4221.  
  4222.    This defines a DIAL MACRO called xxx, which puts an access code on the
  4223.    front of the number. Another example might be:
  4224.    
  4225.   def xxx if equal "\v(modem)" "hayes-1200" return \freplace(\%1,$,{,,,,,})
  4226.   set dial macro xxx
  4227.   dial xyzcorp
  4228.  
  4229.    which replaces any dollar-sign in the dial string by a series of five
  4230.    commas, e.g. because this particular modem does not support the "wait
  4231.    for bong" feature (remember that commas that are to be included
  4232.    literally in function arguments must be enclosed in braces to
  4233.    distinguish them from the commas that separate the arguments) and when
  4234.    the IF condition is not satisfied, the macro does not return a value,
  4235.    and so the number is not modified. Then when a DIAL command is given
  4236.    referencing a dialing directory entry, "xyzcorp". The macro is
  4237.    automatically applied to each matching number.
  4238.    
  4239.    Numerous dial-, modem-, communications-, and time-related variables
  4240.    are available for decision making your dial macro. Type SHOW VARIABLES
  4241.    for a list. Of particular interest is the \v(dialcount) variable,
  4242.    which tells how many times the DIAL command gone through its retry
  4243.    loop: 1 on the first try, 2 on the second, 3 on the third, and so on,
  4244.    and the \v(dialresult) and \v(dialstatus) variables.
  4245.    
  4246.    Here are some other applications for the DIAL MACRO (from users):
  4247.    
  4248.      * Phone numbers in the dialing directory are formatted with '-' for
  4249.        readability, but some modems don't like the hyphens, so the DIAL
  4250.        macro is used to remove them before dialing; e.g
  4251.        0090-123-456-78-99 becomes 00901234567899: "def xxx return
  4252.        \freplace(\%1,-)".
  4253.      * To set some specific modem (or other) options depending on the
  4254.        called customer or telephone number.
  4255.      * Choosing the most appropriate provider based on (e.g.) time of
  4256.        day, or cycling through a list of providers in case some providers
  4257.        might be busy.
  4258.        
  4259.    To illustrate the final item, suppose you have a choice among many
  4260.    phone service providers; the provider is chosen by dialing an access
  4261.    code before the number. Different providers might be better (e.g.
  4262.    cheaper) for certain times of day or days of the week, or for dialing
  4263.    certain locations; you can use the DIAL macro to add the access for
  4264.    the most desirable provider.
  4265.    
  4266.    Similarly, when the same number might be reached through multiple
  4267.    providers, it's possible that one provider might not be able to
  4268.    complete the call, but another one can. In that case, you can use the
  4269.    DIAL macro to switch providers each time through the DIAL loop --
  4270.    that's where the \v(dialcount) variable comes in handy.
  4271.    
  4272.    The following command can be used to debug the DIAL macro:
  4273.    
  4274.    SET DIAL TEST { ON, OFF }
  4275.           Normally OFF, so the DIAL command actually dials. When ON, the
  4276.           DIAL command performs all lookups and number conversions, and
  4277.           then goes through the number list and retry loop, but instead
  4278.           of actually dialing, lists the numbers it would have called if
  4279.           none of the DIAL attempts succeeded (or more precisely, every
  4280.           number was always busy).
  4281.      _________________________________________________________________
  4282.    
  4283.     2.1.14. Automatic Tone/Pulse Dialing Selection
  4284.     
  4285.    SET DIAL METHOD { AUTO, DEFAULT, PULSE, TONE }
  4286.           Chooses the dialing method for subsequent calls.
  4287.           
  4288.    Prior to version 7.0, C-Kermit's DIAL METHOD was DEFAULT by default,
  4289.    meaning it does not specify a dialing method to the modem, but relies
  4290.    on the modem to have an appropriate default dialing method set. So,
  4291.    for example, when using Hayes compatible modems, the dial string would
  4292.    be something like ATD7654321, rather than ATDT7654321 or ATDP7654321.
  4293.    
  4294.    In C-Kermit 7.0 and K95 1.1.19, the dial method can be set from the
  4295.    environment variable:
  4296.    
  4297.   K_DIAL_METHOD
  4298.  
  4299.    when Kermit starts. The values can be TONE, PULSE, or DEFAULT, e.g.
  4300.    (UNIX):
  4301.    
  4302.   set K_DIAL_METHOD=TONE; export K_DIAL_METHOD
  4303.  
  4304.    In the absence of a K_DIAL_METHOD definition, the new default SET DIAL
  4305.    METHOD is AUTO rather than DEFAULT. When DIAL METHOD is AUTO and the
  4306.    local country code is known, then if tone dialing is universally
  4307.    available in the corresponding area, tone dialing is used; if dialing
  4308.    from a location where pulse dialing is mandatory, pulse dialing is
  4309.    used.
  4310.    
  4311.    The "tone country" and "pulse country" lists are preloaded according
  4312.    to our knowledge at the time of release. You can see their contents in
  4313.    the SHOW DIAL listing. You can change the lists with:
  4314.    
  4315.    SET DIAL TONE-COUNTRIES [ cc [ cc [ ... ] ] ]
  4316.           Replaces the current TONE-COUNTRIES list with the one given.
  4317.           Each cc is a country code; separate them with spaces (not
  4318.           commas). Example:
  4319.           
  4320.   set dial tone-countries 1 358 44 46 49
  4321.  
  4322.           If no country codes are given, the current list, if any, is
  4323.           removed, in which case SET DIAL METHOD AUTO is equivalent to
  4324.           SET DIAL METHOD DEFAULT.
  4325.           
  4326.    SET DIAL PULSE-COUNTRIES [ cc [ cc [ ... ] ] ]
  4327.           Replaces the current PULSE-COUNTRIES list with the one give.
  4328.           Syntax and operation is like SET DIAL TONE-COUNTRIES.
  4329.           
  4330.    If the same country code appears in both lists, Pulse takes
  4331.    precedence.
  4332.    
  4333.    The SET DIAL TONE- and PULSE-COUNTRIES commands perform no
  4334.    verification whatsoever on the cc's, since almost any syntax might be
  4335.    legal in some settings. Furthermore, there is no facility to edit the
  4336.    lists; you can only replace the whole list. However, since the only
  4337.    purpose of these lists is to establish a basis for picking tone or
  4338.    pulse dialing automatically, all you need to override the effect of
  4339.    the list is to set a specific dialing method with SET DIAL METHOD TONE
  4340.    or SET DIAL METHOD PULSE.
  4341.      _________________________________________________________________
  4342.    
  4343.     2.1.15. Dial-Modifier Variables
  4344.     
  4345.    As of C-Kermit 7.0, dial modifiers are available in the following
  4346.    variables:
  4347.    
  4348.  \v(dm_lp) Long pause
  4349.  \v(dm_sp) Short pause
  4350.  \v(dm_pd) Pulse dial
  4351.  \v(dm_td) Tone dial
  4352.  \v(dm_wa) Wait for answer
  4353.  \v(dm_wd) Wait for dialtone
  4354.  \v(dm_rc) Return to command mode
  4355.  
  4356.    You can use these in your dial strings in place of hardwired modifiers
  4357.    like "@", ",", etc, for increased portability of scripts. Example:
  4358.    
  4359.   C-Kermit>set modem type usrobotics
  4360.   C-Kermit>sho variables dm
  4361.    \v(dm_lp) = ,
  4362.    \v(dm_sp) = /
  4363.    \v(dm_pd) = P
  4364.    \v(dm_td) = T
  4365.    \v(dm_wa) = @
  4366.    \v(dm_wd) = W
  4367.    \v(dm_rc) = ;
  4368.   C-Kermit>exit
  4369.      _________________________________________________________________
  4370.    
  4371.     2.1.16. Giving Multiple Numbers to the DIAL Command
  4372.     
  4373.    Prior to C-Kermit 7.0, the only way to give a DIAL command a list of
  4374.    phone numbers to try until one answers was to create a dialing
  4375.    directory that had multiple entries under the same name, and then use
  4376.    that entry name in the DIAL command. Now a list of numbers can be
  4377.    given to the DIAL command directly in the following format:
  4378.    
  4379.   dial {{number1}{number2}{number3}...}
  4380.  
  4381.    This is the same list format used by SEND /EXCEPT: and other commands
  4382.    that allow a list where normally a single item is given. Restrictions
  4383.    on this form of the DIAL command are:
  4384.    
  4385.      * The first two braces must be adjacent; spacing is optional
  4386.        thereafter.
  4387.      * Each number must be an actual number to dial, not a dialing
  4388.        directory entry.
  4389.      * Dialing directory entries may not contain number lists in this
  4390.        format.
  4391.        
  4392.    In all other respects, the numbers are treated as if they had been
  4393.    fetched from the dialing directory; they can be in literal or portable
  4394.    format, etc. Example:
  4395.    
  4396.   dial {{7654321} {+1 (212) 5551212} { 1-212-5556789 }}
  4397.  
  4398.    The list can be any length at all, within reason.
  4399.    
  4400.    This feature is especially handy for use with the K95 Dialer, allowing
  4401.    a list of phone numbers to be specified in the Telephone Number box
  4402.    without having to set up or reference a separate dialing directory.
  4403.    
  4404.    You can also use it to add commonly-dialed sequences as variables in
  4405.    your C-Kermit customization file, e.g.:
  4406.    
  4407.   define work {{7654321}{7654322}{7654323}}
  4408.  
  4409.    and then:
  4410.    
  4411.   dial {\m(work)}
  4412.  
  4413.    (the variable name must be enclosed in braces).
  4414.    
  4415.    Or more simply:
  4416.    
  4417.   define work dial {{7654321}{7654322}{7654323}}
  4418.  
  4419.    and then:
  4420.    
  4421.   work
  4422.      _________________________________________________________________
  4423.    
  4424.   2.2. Modems
  4425.   
  4426.     2.2.1. New Modem Types
  4427.     
  4428.    Since C-Kermit 6.0:
  4429.    
  4430.   atlas-newcom-33600ifxC Atlas/Newcom 33600
  4431.   att-keepintouch        AT&T KeepinTouch PCMCIA V.32bis Card Modem
  4432.   att-1900-stu-iii       AT&T Secure Data STU-III Model 1900
  4433.   att-1910-stu-iii       AT&T Secure Data STU-III Model 1910
  4434.   bestdata               Best Data
  4435.   cardinal               Cardinal V.34 MVP288X series.
  4436.   compaq                 Compaq Data+Fax (e.g. in Presario)
  4437.   fujitsu                Fujitsu Fax/Modem Adapter
  4438.   generic-high-speed     Any modern error-correcting data-compressing modem
  4439.   itu-t-v25ter/v250      ITU-T (CCITT) V.25ter (V.250) standard command set
  4440.   megahertz-att-v34      Megahertz AT&T V.34
  4441.   megahertz-xjack        Megahertz X-Jack
  4442.   motorola-codex         Motorola Codex 326X Series
  4443.   motorola-montana       Motorola Montana
  4444.   mt5634zpx              Multitech MT5634ZPX
  4445.   rockwell-v90           Rockwell V.90 56K
  4446.   rolm-244pc             Siemens/Rolm 244PC (AT command set)
  4447.   rolm-600-series        Siemens/Rolm 600 Series (AT command set)
  4448.   spirit-ii              QuickComm Spirit II
  4449.   suprasonic             SupraSonic V288+
  4450.   supra-express-v90      Supra Express V.90
  4451.  
  4452.    One of the new types, "generic-high-speed" needs a bit of explanation.
  4453.    This type was added to easily handle other types that are not
  4454.    explicitly covered, without going through the bother of adding a
  4455.    complete user-defined modem type. This one works for modern modems
  4456.    that use the AT command set, on the assumption that all the default
  4457.    ("factory") settings of the modem (a) are appropriate for Kermit, (b)
  4458.    include error correction, data compression, and speed buffering; and
  4459.    (c) are recallable with the command AT&F.
  4460.    
  4461.    If the command to recall your modem's profile is not AT&F, use the SET
  4462.    MODEM COMMAND INIT-STRING command to specify the appropriate modem
  4463.    command. The default init-string is AT&F\13 (that is, AT, ampersand,
  4464.    F, and then carriage return); a survey of about 20 modern modem types
  4465.    shows they all support this, but they might mean different things by
  4466.    it. For example, the USR Sportster or Courier needs AT&F1 (not AT&F,
  4467.    which is equivalent to AT&F0, which recalls an inappropriate profile),
  4468.    so for USR modems:
  4469.    
  4470.   set modem type generic-high-speed
  4471.   set modem command init AT&F1\13
  4472.  
  4473.    Of course, USR modems already have their own built-in modem type. But
  4474.    if you use this one instead, it will dial faster because it has fewer
  4475.    commands to give to the modem; in that sense "&F1" is like a macro
  4476.    that bundles numerous commands into a single one. See your modem
  4477.    manual for details about factory profiles and commands to recall them.
  4478.    
  4479.    WARNING: Do not use the generic-high-speed modem type in operating
  4480.    systems like VMS where hardware flow control is not available, at
  4481.    least not unless you change the init string from AT&F\13 to something
  4482.    else that enables local Xon/Xoff or other appropriate type of flow
  4483.    control.
  4484.    
  4485.    Also see [398]Section 2.1.7 for additional hints about making dialing
  4486.    go faster.
  4487.      _________________________________________________________________
  4488.    
  4489.     2.2.2. New Modem Controls
  4490.     
  4491.    SET MODEM CAPABILITIES list
  4492.           In C-Kermit 7.0, this command automatically turns MODEM
  4493.           SPEED-MATCHING OFF if SB (Speed Buffering) is in the list, and
  4494.           turns it ON if SB is absent.
  4495.           
  4496.    SET MODEM COMMAND PREDIAL-INIT [ text ]
  4497.           Commands to be sent to the modem just prior to dialing.
  4498.           Normally none.
  4499.           
  4500.    SET MODEM SPEAKER { ON, OFF }
  4501.           Determines whether modem speaker is on or off while call is
  4502.           being placed. ON by default. Note: This command does not
  4503.           provide fine-grained control over when the speaker is on or
  4504.           off. Normally, ON means while the call is being placed, until
  4505.           the point at which carrier is successfully established. If your
  4506.           modem has a different speaker option that you want to choose,
  4507.           then use the SET MODEM COMMAND SPEAKER ON text command to
  4508.           specify this option.
  4509.           
  4510.    SET MODEM COMMAND SPEAKER { ON, OFF } [ text ]
  4511.           Specify or override the commands to turn your modem's speaker
  4512.           on and off.
  4513.           
  4514.    SET MODEM VOLUME { LOW, MEDIUM, HIGH }
  4515.           When MODEM SPEAKER is on, select volume. Note: In some modems,
  4516.           especially internal ones, these commands have no effect; this
  4517.           is a limitation of the particular modem, not of Kermit.
  4518.           
  4519.    SET MODEM COMMAND VOLUME { LOW, MEDIUM, HIGH } [ text ]
  4520.           Specify or override the commands to set your modem's speaker
  4521.           volume.
  4522.           
  4523.    SET MODEM COMMAND IGNORE-DIALTONE [ text ]
  4524.           The command to enable blind dialing ([399]Section 2.1.6).
  4525.           
  4526.    SET MODEM ESCAPE-CHARACTER code
  4527.           Has been augmented to allow codes of 0 or less: < 0 means the
  4528.           escape mechanism is disabled. = 0 means to use (restore) the
  4529.           default value from the modem database. > 0 and < 128 is a
  4530.           literal value to be used instead of the default one. > 127
  4531.           means the escape mechanism is disabled. This affects "modem
  4532.           hangup". When the escape mechanism is disabled, but SET MODEM
  4533.           HANGUP-METHOD is MODEM-COMMAND, it sends the hangup command
  4534.           immediately, without the <pause>+++<pause> business first. This
  4535.           is useful (for example) when sending lots of numeric pages, a
  4536.           process in which never we go online, and so never need to
  4537.           escape back. Eliminating the unnecessary pauses and escape
  4538.           sequence allows a lot more pages to be sent per unit time.
  4539.           
  4540.    Recall that C-Kermit can dial modems to which it is connected via
  4541.    TCP/IP (Telnet or Rlogin) as described on page 126 of [400]Using
  4542.    C-Kermit, 2nd Ed. In this case the MODEM HANGUP-METHOD should be
  4543.    MODEM-COMMAND, since RS-232 signals don't work over TCP/IP
  4544.    connections. As noted in the manual, such connections are set up by
  4545.    the following sequence:
  4546.    
  4547.   set host host [ port ]
  4548.   set modem type name
  4549.   dial number
  4550.  
  4551.    But this can cause complications when you use Kermit to switch between
  4552.    serial and TCP/IP connections. In the following sequence:
  4553.    
  4554.   set host name
  4555.   set modem type name
  4556.   set port name
  4557.  
  4558.    the first two commands obey the rules for dialing out over Telnet.
  4559.    However, the SET PORT command requires that Kermit close its current
  4560.    (Telnet) connection before it can open the serial port (since Kermit
  4561.    can only have one connection open at a time). But since a modem type
  4562.    was set after the "set host" command was given, Kermit assumes it is a
  4563.    Telnet dialout connection and so sends the modem's hangup sequence is
  4564.    sent to the Telnet host. To avoid this, close the network connection
  4565.    explicitly before opening the serial one:
  4566.    
  4567.   set host name
  4568.   close
  4569.   set modem type name
  4570.   set port name
  4571.      _________________________________________________________________
  4572.    
  4573.   2.3. TELNET and RLOGIN
  4574.   
  4575.    For additional background, please also read the [401]TELNET.TXT file,
  4576.    also available on the Web in [402]HTML format.
  4577.    
  4578.    Cautions:
  4579.    
  4580.      * If making a Telnet connection with C-Kermit takes a very long
  4581.        time, like over a minute, whereas the system Telnet program makes
  4582.        the same connection immediately, try including the /NOWAIT switch:
  4583.  
  4584.   C-Kermit> telnet /nowait hostname
  4585.        See [403]TELNET.TXT or [404]TELNET.HTML for details. If it also
  4586.        takes a very long time to make a Telnet connection with system
  4587.        Telnet, then the delay is most likely caused by reverse DNS
  4588.        lookups when your host is not properly registered in DNS.
  4589.      * When supplying numeric IP addresses to C-Kermit or to any other
  4590.        application (regular Telnet, Rlogin, etc), do not include leading
  4591.        0's in any fields unless you intend for those fields to be
  4592.        interpreted as octal (or hex) numbers. The description of the
  4593.        Internet address interpreter (the sockets library inet_addr()
  4594.        routine) includes these words:
  4595.        
  4596.      All numbers supplied as "parts" in a "." notation may be decimal,
  4597.      octal, or hexadecimal, as specified in the C language (that is, a
  4598.      leading 0x or 0X implies hexadecimal; otherwise, a leading 0
  4599.      implies octal; otherwise, the number is interpreted as decimal).
  4600.        To illustrate, 128.59.39.2 and 128.059.039.002 are not the same
  4601.        host! Even though most of the fields contain non-octal digits.
  4602.        Using system Telnet (not Kermit):
  4603.  
  4604.   $ telnet 128.059.039.002
  4605.   Trying 128.49.33.2 ...
  4606.        Of course the same thing happens with Kermit because it uses (as
  4607.        it must) the same system service for resolving network addresses
  4608.        that Telnet, FTP, and all other TCP/IP applications use.
  4609.      * The RLOGIN section on page 123 does not make it clear that you can
  4610.        use the SET TELNET TERMINAL-TYPE command to govern the terminal
  4611.        type that is reported by C-Kermit to the RLOGIN server.
  4612.      * Note that the SET TCP commands described on pages 122-123 might be
  4613.        absent; some platforms that support TCP/IP do not support these
  4614.        particular controls.
  4615.        
  4616.    New commands:
  4617.    
  4618.    TELOPT { AO, AYT, BREAK, CANCEL, EC, EL, EOF, EOR, GA, IP, DMARK,
  4619.           DO, DONT, NOP, SB, SE, SUSP, WILL, WONT }
  4620.           This command was available previously, but supported only DO,
  4621.           DONT, WILL, and WONT. Now it lets you send all the Telnet
  4622.           protocol commands. Note that certain commands do not require a
  4623.           response, and therefore can be used as nondestructive "probes"
  4624.           to see if the Telnet session is still open; e.g.:
  4625.           
  4626.   set host xyzcorp.com
  4627.   ...
  4628.   telopt nop
  4629.   if fail stop 1 Connection lost
  4630.  
  4631.    SET TCP ADDRESS [ ip-address ]
  4632.           Specifies the IP address of the computer that C-Kermit is
  4633.           running on. Normally this is not necessary. The exception would
  4634.           be if your machine has multiple network adapters (physical or
  4635.           virtual) with a different address for each adapter AND you want
  4636.           C-Kermit to use a specific address when making outgoing
  4637.           connections or accepting incoming connections.
  4638.           
  4639.    SET TCP DNS-SERVICE-RECORDS { ON, OFF }
  4640.           Tells C-Kermit whether to try to use DNS SRV records to
  4641.           determine the host and port number upon which to find an
  4642.           advertised service. For example, if a host wants regular Telnet
  4643.           connections redirected to some port other than 23, this feature
  4644.           allows C-Kermit to ask the host which port it should use. Since
  4645.           not all domain servers are set up to answer such requests, this
  4646.           feature is OFF by default.
  4647.           
  4648.    SET TCP REVERSE-DNS-LOOKUP { ON, OFF, AUTO }
  4649.           Tells Kermit whether to perform a reverse DNS lookup on TCP/IP
  4650.           connections. This allows Kermit to determine the actual
  4651.           hostname of the host it is connected to, which is useful for
  4652.           connections to host pools, and is required for Kerberos
  4653.           connections to host pools and for incoming connections. If the
  4654.           other host does not have a DNS entry, the reverse lookup could
  4655.           take a long time (minutes) to fail, but the connection will
  4656.           still be made. Turn this option OFF for speedier connections if
  4657.           you do not need to know exactly which host you are connected to
  4658.           and you are not using Kerberos. AUTO, the default, means the
  4659.           lookup is done on hostnames, but not on numeric IP addresses.
  4660.           
  4661.    SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF }
  4662.           Each Telnet option must be fully negotiated either On or Off
  4663.           before the session can continue. This is especially true with
  4664.           options that require sub-negotiations such as Authentication,
  4665.           Encryption, and Kermit; for proper support of these options
  4666.           Kermit must wait for the negotiations to complete. Of course,
  4667.           Kermit has no way of knowing whether a reply is delayed or not
  4668.           coming at all, and so will wait a minute or more for required
  4669.           replies before continuing the session. If you know that
  4670.           Kermit's Telnet partner will not be sending the required
  4671.           replies, you can set this option of OFF to avoid the long
  4672.           timeouts. Or you can instruct Kermit to REFUSE specific options
  4673.           with the SET TELOPT command.
  4674.           
  4675.    SET TELOPT [ { /CLIENT, /SERVER } ] option
  4676.           { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  4677.           [ { ACCEPTED, REFUSED, REQUESTED, REQUIRED } ]
  4678.           SET TELOPT lets you specify policy requirements for Kermit's
  4679.           handling of Telnet option negotiations. Setting an option is
  4680.           REQUIRED causes Kermit to offer the option to the peer and
  4681.           disconnect if the option is refused. REQUESTED causes Kermit to
  4682.           offer an option to the peer. ACCEPTED results in no offer but
  4683.           Kermit will attempt to negotiate the option if it is requested.
  4684.           REFUSED instructs Kermit to refuse the option if it is
  4685.           requested by the peer.
  4686.           
  4687.           Some options are negotiated in two directions and accept
  4688.           separate policies for each direction; the first keyword applies
  4689.           to Kermit itself, the second applies to Kermit's Telnet
  4690.           partner; if the second keyword is omitted, an appropriate
  4691.           (option-specific) default is applied. You can also include a
  4692.           /CLIENT or /SERVER switch to indicate whether the given
  4693.           policies apply when Kermit is the Telnet client or the Telnet
  4694.           server; if no switch is given, the command applies to the
  4695.           client.
  4696.           
  4697.           Note that some of Kermit's Telnet partners fail to refuse
  4698.           options that they do not recognize and instead do not respond
  4699.           at all. In this case it is possible to use SET TELOPT to
  4700.           instruct Kermit to REFUSE the option before connecting to the
  4701.           problem host, thus skipping the problematic negotiation.
  4702.           
  4703.           Use SHOW TELOPT to view current Telnet Option negotiation
  4704.           settings. SHOW TELNET displays current Telnet settings.
  4705.      _________________________________________________________________
  4706.    
  4707.     2.3.0. Bug Fixes
  4708.     
  4709.    If "set host nonexistent-host" was given (and it properly failed),
  4710.    followed by certain commands like SEND, the original line and modem
  4711.    type were not restored and C-Kermit thought that it still had a
  4712.    network hostname; fixed in 7.0.
  4713.    
  4714.     2.3.1. Telnet Binary Mode Bug Adjustments
  4715.     
  4716.    SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF } was added to edit 192
  4717.    after the book was printed. Also SET TELNET BUG BINARY-U-MEANS-ME-TOO.
  4718.    The default for both is OFF. ON should be used when communicating with
  4719.    a Telnet partner (client or server) that mistakenly believes that
  4720.    telling C-Kermit to enter Telnet binary mode also means that it, too,
  4721.    is in binary mode, contrary to the Telnet specification, which says
  4722.    that binary mode must be negotiated in each direction separately.
  4723.    
  4724.     2.3.2. VMS UCX Telnet Port Bug Adjustment
  4725.     
  4726.    A new command, SET TCP UCX-PORT-BUG, was added for VMS versions with
  4727.    UCX (DEC TCP/IP), applying only to early versions of UCX, like 2.2 or
  4728.    earlier. If you try to use VMS C-Kermit to make a Telnet connection
  4729.    using a port name (like "telnet", which is used by default), the
  4730.    underlying UCX getservbyname() function might return the service
  4731.    number with its bytes swapped and the connection will fail. If "telnet
  4732.    hostname 23" works, then your version of UCX has this bug and you can
  4733.    put "set tcp ucx-port-bug on" in your CKERMIT.INI file to get around
  4734.    it.
  4735.    
  4736.     2.3.3. Telnet New Environment Option
  4737.     
  4738.    The TELNET NEW-ENVIRONMENT option ([405]RFC 1572) is supported as 7.0.
  4739.    This option allows the C-Kermit Telnet client to send certain
  4740.    well-known variables to the Telnet server, including USER, PRINTER,
  4741.    DISPLAY, and several others. This feature is enabled by default in
  4742.    Windows and OS/2, disabled by default elsewhere. The command to enable
  4743.    and disable it is:
  4744.    
  4745.   SET TELNET ENVIRONMENT { ON, OFF }
  4746.  
  4747.    When ON, and you Telnet to another computer, you might (or might not)
  4748.    notice that the "login:" or "Username:" prompt does not appear --
  4749.    that's because your username was sent ahead, in which case the remote
  4750.    system might prompt you only for your password (similar to Rlogin).
  4751.    Use "set telnet environment off" to defeat this feature, particularly
  4752.    in scripts where the dialog must be predictable. You can also use this
  4753.    command to specify or override specific well-known environment
  4754.    variable values:
  4755.    
  4756.  SET TELNET ENVIRONMENT { ACCT,DISPLAY,JOB,PRINTER,SYSTEMTYPE,USER } [ text ]
  4757.  
  4758.     2.3.4. Telnet Location Option
  4759.     
  4760.    The TELNET LOCATION option ([406]RFC 779) is supported in 7.0. This
  4761.    option allows the C-Kermit Telnet client to send a location string to
  4762.    the server if the server indicates its willingness to accept one. If
  4763.    an environment variable named LOCATION exists at the time C-Kermit
  4764.    starts, its value is used as the location string. If you want to
  4765.    change it, use:
  4766.    
  4767.   SET TELNET LOCATION text
  4768.  
  4769.    If you omit the text from this command, the Telnet location feature is
  4770.    disabled.
  4771.    
  4772.    SET TELNET ENVIRONMENT DISPLAY is used to set the DISPLAY variable
  4773.    that is sent to the host, as well as the the XDISPLAY location.
  4774.    
  4775.     2.3.5. Connecting to Raw TCP Sockets
  4776.     
  4777.    The SET HOST and TELNET commands now accept an optional switch,
  4778.    /RAW-SOCKET, at the end, only if you first give a host and a port.
  4779.    Example:
  4780.    
  4781.   set host xyzcorp.com 23 /raw-socket
  4782.   set host 128.49.39.2:2000 /raw-socket
  4783.   telnet xyzcorp.com 3000 /raw
  4784.  
  4785.    Without this switch, C-Kermit behaves as a Telnet client when (a) the
  4786.    port is 23 or 1649, or (b) the port is not 513 and the server sent
  4787.    what appeared to be Telnet negotiations -- that is, messages starting
  4788.    with 0xFF (IAC). With this switch, Kermit should treat all incoming
  4789.    bytes as raw data, and will not engage in any Telnet negotiations or
  4790.    NVT CRLF manipulations. This allows transparent operation through
  4791.    (e.g.) raw TCP ports on Cisco terminal servers, through the 'modemd'
  4792.    modem server, etc.
  4793.    
  4794.     2.3.6. Incoming TCP Connections
  4795.     
  4796.    Accomplished via SET HOST * port, were introduced in C-Kermit 6.0, but
  4797.    for UNIX only. In Version 7.0, they are also available for VMS.
  4798.      _________________________________________________________________
  4799.    
  4800.   2.4. The EIGHTBIT Command
  4801.   
  4802.    EIGHTBIT is simply a shorthand for: SET PARITY NONE, SET TERMINAL
  4803.    BYTESIZE 8, SET COMMAND BYTESIZE 8; that is, a way to set up an 8-bit
  4804.    clean connection in a single command.
  4805.      _________________________________________________________________
  4806.    
  4807.   2.5. The Services Directory
  4808.   
  4809.    Chapter 7 of [407]Using C-Kermit does not mention the ULOGIN macro,
  4810.    which is used by our sample services directory, CKERMIT.KND. Unlike
  4811.    UNIXLOGIN, VMSLOGIN, etc, this one is for use with systems that
  4812.    require a user ID but no password. Therefore it doesn't prompt for a
  4813.    password or wait for a password prompt from the remote service.
  4814.    
  4815.    In version 7.0, the CALL macro was changed to not execute a SET MODEM
  4816.    TYPE command if the given modem type was the same as the current one;
  4817.    otherwise the new SET MODEM TYPE command would overwrite any
  4818.    customizations that the user had made to the modem settings. Ditto for
  4819.    SET LINE / SET PORT and SET SPEED.
  4820.      _________________________________________________________________
  4821.    
  4822.   2.6. Closing Connections
  4823.   
  4824.    Until version 7.0, there was never an obvious and general way to close
  4825.    a connection. If a serial connection was open, it could be closed by
  4826.    "set line" or "set port" (giving no device name); if a network
  4827.    connection was open, it could be closed by "set host" (no host name).
  4828.    
  4829.    In version 7.0, a new command closes the connection in an obvious and
  4830.    straightforward way, no matter what the connection type:
  4831.    
  4832.   CLOSE [ CONNECTION ]
  4833.  
  4834.    The CLOSE command was already present, and required an operand such as
  4835.    DEBUG-LOG, WRITE-FILE, etc, and so could never be given by itself. The
  4836.    new CONNECTION operand is now the default operand for CLOSE, so CLOSE
  4837.    by itself closes the connection, if one is open, just as you would
  4838.    expect, especially if you are a Telnet or Ftp user.
  4839.    
  4840.    Also see the description of the new SET CLOSE-ON-DISCONNECT command in
  4841.    [408]Section 2.10.
  4842.      _________________________________________________________________
  4843.    
  4844.   2.7. Using C-Kermit with External Communication Programs
  4845.   
  4846.    C-Kermit 7.0 includes a new ability to create and conduct sessions
  4847.    through other communications programs. Two methods are available:
  4848.    
  4849.     1. Pty (pseudoterminal): The external program is run on a
  4850.        "pseudoterminal", which is controlled by Kermit. This method works
  4851.        with practically any external program, but it is not portable. At
  4852.        this writing, it works only on some (not all) UNIX versions, and
  4853.        not on any non-UNIX platforms.
  4854.     2. Pipe: The external program's standard input and output are
  4855.        redirected through a "pipe" controlled by Kermit. This method is
  4856.        relatively portable -- it should work across all UNIX versions,
  4857.        and it also works in Windows and OS/2 -- but it is effective only
  4858.        when the external program actually uses standard i/o (and many
  4859.        don't).
  4860.        
  4861.    The two methods are started differently but are used the same way
  4862.    thereafter.
  4863.    
  4864.    The purpose of this feature is to let you use C-Kermit services like
  4865.    file transfer, character-set translation, scripting, automatic
  4866.    dialing, etc, on connections that Kermit can't otherwise make itself.
  4867.    
  4868.    This feature is the opposite of the REDIRECT feature, in which
  4869.    C-Kermit makes the connection, and redirects an external (local)
  4870.    command or program over this connection. In a pty or pipe connection,
  4871.    C-Kermit runs and controls a local command or program, which makes the
  4872.    connection. (The same method can be used to simply to control a local
  4873.    program without making a connection; see [409]Section 2.8.)
  4874.    
  4875.    To find out if your version of Kermit includes PTY support, type "show
  4876.    features" and look for NETPTY in the alphabetical list of options. For
  4877.    pipes, look for NETCMD.
  4878.    
  4879.    The commands are:
  4880.    
  4881.    SET NETWORK TYPE PTY or SET NETWORK TYPE PIPE
  4882.           
  4883.    SET HOST command
  4884.           where command is any interactive command. If the command does
  4885.           not use standard i/o, you must use SET NETWORK TYPE PTY.
  4886.           
  4887.    Notes:
  4888.    
  4889.      * COMMAND is an invisible synonym for PIPE.
  4890.      * The command and its arguments are case-sensitive in UNIX.
  4891.        
  4892.    The SET NETWORK TYPE, SET HOST sequence sets the given network type
  4893.    for all subsequent SET HOST commands until another SET NETWORK TYPE
  4894.    command is given to change it.
  4895.    
  4896.    You can also use the new /NETWORK-TYPE:PTY or /NETWORK-TYPE:PIPE (or
  4897.    simply /PIPE or /PTY) switches on the SET HOST command itself:
  4898.    
  4899.   SET HOST /NETWORK-TYPE:PIPE command  ; These two are the same
  4900.   SET HOST /PIPE command
  4901.  
  4902.   SET HOST /NETWORK-TYPE:PTY command   ; Ditto
  4903.   SET HOST /PTY command
  4904.  
  4905.    These are like SET NETWORK TYPE followed by SET HOST, except they
  4906.    apply only to the connection being made and do not change the global
  4907.    network type setting (see [410]Section 1.5 about the difference
  4908.    between switches and SET commands).
  4909.    
  4910.    Include any command-line options with the command that might be
  4911.    needed, as in this example where C-Kermit uses another copy of itself
  4912.    as the communications program:
  4913.    
  4914.   SET HOST /PIPE /CONNECT kermit -YQJ xyzcorp.com
  4915.  
  4916.    As usual, if you include the /CONNECT switch, SET HOST enters CONNECT
  4917.    mode immediately upon successful execution of the given command.
  4918.    Therefore new commands are available as a shorthand for SET HOST
  4919.    /CONNECT /PTY and /PIPE:
  4920.    
  4921.    PTY [ command ]
  4922.           
  4923.    PIPE [ command ]
  4924.           The PTY and PIPE commands work like the TELNET and RLOGIN
  4925.           commands: they set up the connection (in this case, using the
  4926.           given command) and then enter CONNECT mode automatically (if
  4927.           the PIPE or PTY command is given without a command, it
  4928.           continues the current session if one is active; otherwise it
  4929.           gives an error message).
  4930.           
  4931.    The PIPE command is named after the mechanism by which C-Kermit
  4932.    communicates with the command: UNIX pipes. C-Kermit's i/o is "piped"
  4933.    through the given command. Here is a typical example:
  4934.    
  4935.   PIPE rlogin -8 xyzcorp.com
  4936.  
  4937.    This is equivalent to:
  4938.    
  4939.   SET HOST /PIPE rlogin -8 xyzcorp.com
  4940.   CONNECT
  4941.  
  4942.    and to:
  4943.    
  4944.   SET HOST /PIPE /CONNECT rlogin -8 xyzcorp.com
  4945.  
  4946.    IMPORTANT:
  4947.           If you are writing a script, do not use the PIPE, PTY, TELNET,
  4948.           or RLOGIN command unless you really want C-Kermit to enter
  4949.           CONNECT mode at that point. Normally SET HOST is used in
  4950.           scripts to allow the login and other dialogs to be controlled
  4951.           by the script itself, rather than by an actively participating
  4952.           human at the keyboard.
  4953.           
  4954.    Throughput of pty and pipe connections is limited by the performance
  4955.    of the chosen command or program and by the interprocess communication
  4956.    (IPC) method used and/or buffering capacity of the pipe or pty, which
  4957.    in turn depends on the underlying operating system.
  4958.    
  4959.    In one trial (on SunOS 4.1.3), we observed file transfer rates over an
  4960.    rlogin connection proceeding at 200Kcps for downloads, but only 10Kcps
  4961.    for uploads on the same connection with the same settings (similar
  4962.    disparities were noted in HP-UX). Examination of the logs revealed
  4963.    that a write to the pipe could take as long as 5 seconds, whereas
  4964.    reads were practically instantaneous. On the other hand, using Telnet
  4965.    as the external program rather than rlogin, downloads and uploads were
  4966.    better matched at about 177K each.
  4967.    
  4968.    Most external communication programs, like C-Kermit itself, have
  4969.    escape characters or sequences. Normally these begin with (or consist
  4970.    entirely of) a control character. You must be sure that this control
  4971.    character is not "unprefixed" when uploading files, otherwise the
  4972.    external program will "escape back" to its prompt, or close the
  4973.    connection, or take some other unwanted action. When in CONNECT mode,
  4974.    observe the program's normal interaction rules. Of course C-Kermit's
  4975.    own escape character (normally Ctrl-\) is active too, unless you have
  4976.    taken some action to disable it.
  4977.    
  4978.    On PTY connections, the underlying PTY driver is not guaranteed to be
  4979.    transparent to control characters -- for example, it might expand
  4980.    tabs, translate carriage returns, generate signals if it sees an
  4981.    interrupt character, and so on. Similar things might happen on a PIPE
  4982.    connection. For this reason, if you plan to transfer files over a PTY
  4983.    or PIPE connection, tell the file sender to:
  4984.    
  4985.    SET PREFIXING ALL
  4986.           This causes all control characters to be prefixed and
  4987.           transmitted as printable ASCII characters.
  4988.           
  4989.    If the external connection program is not 8-bit clean, you should
  4990.    also:
  4991.    
  4992.    SET PARITY SPACE
  4993.           This causes 8-bit data to be encoded in 7 bits using single
  4994.           and/or locking shifts.
  4995.           
  4996.    And if it does not make a reliable connection (such as those made by
  4997.    Telnet, Rlogin, Ssh, etc), you should:
  4998.    
  4999.    SET STREAMING OFF
  5000.           This forces C-Kermit to treat the connection as unreliable and
  5001.           to engage in its normal ACK/NAK protocol for error detection
  5002.           and correction, rather than "streaming" its packets, as it
  5003.           normally does on a network connection ([411]Section 4.20).
  5004.           
  5005.    In some cases, buffer sizes might be restricted, so you might also
  5006.    need to reduce the Kermit packet length to fit; this is a
  5007.    trial-and-error affair. For example, if transfers always fail with
  5008.    4000-byte packets, try 2000. If that fails too, try 1000, and so on.
  5009.    The commands are:
  5010.    
  5011.    SET RECEIVE PACKET-LENGTH number
  5012.           This tells the file receiver to tell the file sender the
  5013.           longest packet length it can accept.
  5014.           
  5015.    SET SEND PACKET-LENGTH number
  5016.           This tells the file sender not to send packets longer than the
  5017.           given length, even if the receiver says longer ones are OK. Of
  5018.           course, if the receiver's length is shorter, the shorter length
  5019.           is used.
  5020.           
  5021.    If none of this seems to help, try falling back to the bare minimum,
  5022.    lowest-common-denominator protocol settings:
  5023.    
  5024.    ROBUST
  5025.           No sliding windows, no streaming, no control-character
  5026.           unprefixing, packet length 90.
  5027.           
  5028.    And then work your way back up by trial and error to get greater
  5029.    throughput.
  5030.    
  5031.    Note that when starting a PIPE connection, and the connection program
  5032.    (such as telnet or rlogin) prints some greeting or information
  5033.    messages before starting the connection, these are quite likely to be
  5034.    printed with a stairstep effect (linefeed without carriage return).
  5035.    This is because the program is not connected with the UNIX terminal
  5036.    driver; there's not much Kermit can do about it. Once the connection
  5037.    is made, everything should go back to normal. This shouldn't happen on
  5038.    a PTY connection because a PTY is, indeed, a terminal.
  5039.    
  5040.    On a similar note, some connection programs (like Solaris 2.5 rlogin)
  5041.    might print lots of error messages like "ioctl TIOCGETP: invalid
  5042.    argument" when used through a pipe. They are annoying but usually
  5043.    harmless. If you want to avoid these messages, and your shell allows
  5044.    redirection of stderr, you can redirect stderr in your pipe command,
  5045.    as in this example where the user's shell is bash:
  5046.    
  5047.   PIPE rlogin xyzcorp.com 2> /dev/null
  5048.  
  5049.    Or use PTY rather than PIPE, since PTY is available on Solaris.
  5050.      _________________________________________________________________
  5051.    
  5052.     2.7.0. C-Kermit over tn3270 and tn5250
  5053.     
  5054.    Now you can make a connection from C-Kermit "directly" to an IBM
  5055.    mainframe and transfer files with it, assuming it has Kermit-370
  5056.    installed. Because tn3270 is neither 8-bit clean nor transparent to
  5057.    control characters, you must give these commands:
  5058.    
  5059.   SET PREFIXING ALL   ; Prefix all control characters
  5060.   SET PARITY SPACE    ; Telnet connections are usually not 8-bit clean
  5061.  
  5062.    and then:
  5063.    
  5064.   SET HOST /PTY /CONNECT tn3270 abccorp.com
  5065.  
  5066.    or simply:
  5067.    
  5068.   pty tn3270 abccorp.com
  5069.  
  5070.    SET HOST /PIPE does not work in this case, at least not for file
  5071.    transfer. File transfer does work, however, with SET HOST /PTY,
  5072.    provided you use the default packet length of 90 bytes; anything
  5073.    longer seems to kill the session.
  5074.    
  5075.    You can also make connections to IBM AS/400 computers if you have a
  5076.    tn5250 program installed:
  5077.    
  5078.   pty tn5250 hostname
  5079.  
  5080.    In this case, however, file transfer is probably not in the cards
  5081.    since nobody has ever succeeded in writing a Kermit program for the
  5082.    AS/400. Hint:
  5083.    
  5084.   define tn3270 {
  5085.       check pty
  5086.       if fail end 1 Sorry - no PTY support...
  5087.       pty tn3270 \%*
  5088.   }
  5089.  
  5090.    Similarly for tn5250. Note that CHECK PTY and CHECK PIPE can be used
  5091.    in macros and scripts to test whether PTY or PIPE support is
  5092.    available.
  5093.      _________________________________________________________________
  5094.    
  5095.     2.7.1. C-Kermit over Telnet
  5096.     
  5097.    Although C-Kermit includes its own Telnet implementation, you might
  5098.    need to use an external Telnet program to make certain connections;
  5099.    perhaps because it has access or security features not available in
  5100.    C-Kermit itself. As noted above, the only precautions necessary are
  5101.    usually:
  5102.    
  5103.   SET PREFIXING ALL   ; Prefix all control characters
  5104.   SET PARITY SPACE    ; Telnet connections might not be 8-bit clean
  5105.  
  5106.    and then:
  5107.    
  5108.   SET HOST /PTY (or /PIPE) /CONNECT telnet abccorp.com
  5109.  
  5110.    or, equivalently:
  5111.    
  5112.   PTY (or PIPE) telnet abccorp.com
  5113.      _________________________________________________________________
  5114.    
  5115.     2.7.2. C-Kermit over Rlogin
  5116.     
  5117.    C-Kermit includes its own Rlogin client, but this can normally be used
  5118.    only if you are root, since the rlogin TCP port is privileged. But
  5119.    ptys and pipes let you make rlogin connections with C-Kermit through
  5120.    your computer's external rlogin program, which is normally installed
  5121.    as a privileged program:
  5122.    
  5123.   SET PREFIXING ALL
  5124.  
  5125.    and then:
  5126.    
  5127.   SET HOST /PTY (or /PIPE) /CONNECT rlogin -8 abccorp.com
  5128.  
  5129.    or, equivalently:
  5130.    
  5131.   PTY (or PIPE) rlogin -8 abccorp.com
  5132.  
  5133.    The "-8" option to rlogin enables transmission of 8-bit data. If this
  5134.    is not available, then include SET PARITY SPACE if you intend to
  5135.    transfer files.
  5136.    
  5137.    Note that the normal escape sequence for rlogin is Carriage Return
  5138.    followed by Tilde (~), but only when the tilde is followed by certain
  5139.    other characters; the exact behavior depends on your rlogin client, so
  5140.    read its documentation.
  5141.      _________________________________________________________________
  5142.    
  5143.     2.7.3. C-Kermit over Serial Communication Programs
  5144.     
  5145.    Ptys and pipes also let you use programs that make serial connections,
  5146.    such as cu or tip. For example, C-Kermit can be used through cu to
  5147.    make connections that otherwise might not be allowed, e.g. because
  5148.    C-Kermit is not installed with the required write permissions to the
  5149.    dialout device and the UUCP lockfile directory.
  5150.    
  5151.    Suppose your UUCP Devices file contains an entry for a serial device
  5152.    tty04 to be used for direct connections, but this device is protected
  5153.    against you (and Kermit when you run it). In this case you can:
  5154.    
  5155.   SET CONTROL PREFIX ALL
  5156.   PTY (or PIPE) cu -l tty04
  5157.  
  5158.    (Similarly for dialout devices, except then you also need to include
  5159.    the phone number in the "cu" command.)
  5160.    
  5161.    As with other communication programs, watch out for cu's escape
  5162.    sequence, which is the same as the rlogin program's: Carriage Return
  5163.    followed by Tilde (followed by another character to specify an action,
  5164.    like "." for closing the connection and exiting from cu).
  5165.      _________________________________________________________________
  5166.    
  5167.     2.7.4. C-Kermit over Secure Network Clients
  5168.     
  5169.      DISCLAIMER: There are laws in the USA and other countries regarding
  5170.      use, import, and/or export of encryption and/or decryption or other
  5171.      forms of security software, algorithms, technology, and
  5172.      intellectual property. The Kermit Project attempts to follow all
  5173.      known statutes, and neither intends nor suggests that Kermit
  5174.      software can or should be used in any way, in any location, that
  5175.      circumvents any regulations, laws, treaties, covenants, or other
  5176.      legitimate canons or instruments of law, international relations,
  5177.      trade, ethics, or propriety.
  5178.      
  5179.    For secure connections or connections through firewalls, C-Kermit 7.0
  5180.    can be a Kerberos, SRP, and/or SOCKS client when built with the
  5181.    appropriate options and libraries. But other application-level
  5182.    security acronyms and methods -- SSH, SSL, SRP, TLS -- pop up at an
  5183.    alarming rate and are (a) impossible to keep up with, (b) usually
  5184.    mutually incompatible, and (c) have restrictions on export or
  5185.    redistribution and so cannot be included in C-Kermit itself.
  5186.    
  5187.    However, if you have a secure text-based Telnet (or other) client that
  5188.    employs one of these security methods, you can use C-Kermit "through"
  5189.    it via a pty or pipe.
  5190.      _________________________________________________________________
  5191.    
  5192.     2.7.4.1. SSH
  5193.     
  5194.    C-Kermit does not and can not incorporate SSH due to licensing,
  5195.    patent, and USA export law restrictions.
  5196.    
  5197.    The UNIX SSH client does not use standard input/output, and therefore
  5198.    can be used only by Kermit's PTY interface, if one is present. The
  5199.    cautions about file transfer, etc, are the same as for Rlogin.
  5200.    Example:
  5201.    
  5202.   SET PREFIXING ALL
  5203.   PTY ssh XYZCORP.COM
  5204.  
  5205.    Or, for a scripted session:
  5206.    
  5207.   SET PREFIXING ALL
  5208.   SET HOST /PTY ssh XYZCORP.COM
  5209.  
  5210.    Hint:
  5211.    
  5212.   define ssh {
  5213.       check pty
  5214.       if fail end 1 Sorry - no PTY support...
  5215.       pty ssh \%*
  5216.   }
  5217.      _________________________________________________________________
  5218.    
  5219.     2.7.4.2. SSL
  5220.     
  5221.    Secure Sockets Layer (SSL) is another TCP/IP security overlay, this
  5222.    one designed by and for Netscape. An SSL Telnet client is available
  5223.    for UNIX from the University of Queensland. More info at:
  5224.    
  5225.   [412]http://www.psy.uq.oz.au/~ftp/Crypto/
  5226.  
  5227.    Interoperability with C-Kermit is unknown. C-Kermit also includes its
  5228.    own built-in SSL/TLS support, but it is not exportable; [413]CLICK
  5229.    HERE file for details.
  5230.      _________________________________________________________________
  5231.    
  5232.     2.7.4.3. SRP
  5233.     
  5234.    SRP(TM) is Stanford University's Secure Remote Password protocol. An
  5235.    SRP Telnet client is available from Stanford:
  5236.    
  5237.   [414]http://srp.stanford.edu/srp/
  5238.  
  5239.    Stanford's SRP Telnet client for UNIX has been tested on SunOS and
  5240.    works fine with C-Kermit, as described in [415]Section 2.7.1, e.g.
  5241.    
  5242.   SET PREFIX ALL
  5243.   PTY (or PIPE) srp-telnet xenon.stanford.edu
  5244.  
  5245.    C-Kermit itself can be built as an SRP Telnet client on systems that
  5246.    have libsrp.a installed; the C-Kermit support code, however, may not
  5247.    be exported outside the USA or Canada.
  5248.      _________________________________________________________________
  5249.    
  5250.     2.7.4.4. SOCKS
  5251.     
  5252.    C-Kermit can be built as a SOCKS-aware client on systems that have a
  5253.    SOCKS library. See section 8.1.1 of the [416]ckccfg.txt file.
  5254.    
  5255.    C-Kermit 7.0 can also be run over SOCKSified Telnet or rlogin clients
  5256.    with SET NETWORK TYPE COMMAND. Suppose the Telnet program on your
  5257.    system is SOCKS enabled but C-Kermit is not. Make Kermit connections
  5258.    like this:
  5259.    
  5260.   SET PREFIX ALL
  5261.   PTY (or PIPE) telnet zzz.com
  5262.      _________________________________________________________________
  5263.    
  5264.     2.7.4.5. Kerberos
  5265.     
  5266.    UNIX C-Kermit can be built with MIT Kerberos IV or V authentication
  5267.    and encryption. Instructions are available in a [417]separate
  5268.    document. Additional modules are required that can not be exported
  5269.    from the USA to any country except Canada, by US law.
  5270.    
  5271.    If you have Kerberos installed but you don't have a Kerberized version
  5272.    of C-Kermit, you can use ktelnet as C-Kermit's external communications
  5273.    program to make secure connections without giving up C-Kermit's
  5274.    services:
  5275.    
  5276.   SET PREFIX ALL
  5277.   PTY (or PIPE) ktelnet cia.gov
  5278.      _________________________________________________________________
  5279.    
  5280.   2.8. Scripting Local Programs
  5281.   
  5282.    If your version of Kermit has PTY support built in, then any
  5283.    text-based program can be invoked with SET HOST /PTY or equivalent
  5284.    command and controlled using the normal sequence of OUTPUT, INPUT, IF
  5285.    SUCCESS commands (this is the same service that is provided by the
  5286.    'expect' program, but controlled by the Kermit script language rather
  5287.    than Tcl).
  5288.    
  5289.    When PTY service is not available, then any program that uses standard
  5290.    input and output can be invoked with SET HOST /PIPE.
  5291.    
  5292.    Here's an example in which we start an external Kermit program, wait
  5293.    for its prompt, give it a VERSION command, and then extract the
  5294.    numeric version number from its response:
  5295.    
  5296.   set host /pty kermit -Y
  5297.   if fail stop 1 {Can't start external command}
  5298.   input 10 C-Kermit>
  5299.   if fail stop 1 {No C-Kermit> prompt}
  5300.   output version\13
  5301.   input 10 {Numeric: }
  5302.   if fail stop 1 {No match for "Numeric:"}
  5303.   clear input
  5304.   input 10 \10
  5305.   echo VERSION = "\fsubstr(\v(input),1,6)"
  5306.   output exit\13
  5307.  
  5308.    This technique could be used to control any other interactive program,
  5309.    even those that do screen formatting (like Emacs or Vi), if you can
  5310.    figure out the sequence of events. If your Kermit program doesn't have
  5311.    PTY support, then the commands are restricted to those using standard
  5312.    i/o, including certain shells, interactive text-mode "hardcopy"
  5313.    editors like ex, and so on.
  5314.    
  5315.    If you are using the PTY interface, you should be aware that it runs
  5316.    the given program or command directly on the pty, without any
  5317.    intervening shell to interpret metacharacters, redirectors, etc. If
  5318.    you need this sort of thing, include the appropriate shell invocation
  5319.    as part of your command; for example:
  5320.    
  5321.   pty echo *
  5322.  
  5323.    just echoes "*"; whereas:
  5324.    
  5325.   pty ksh -c "echo *"
  5326.  
  5327.    echoes all the filenames that ksh finds matching "*".
  5328.    
  5329.    Similarly for redirection:
  5330.    
  5331.   set host /pty ksh -c "cat > foo"  ; Note: use shell quoting rules here
  5332.   set transmit eof \4
  5333.   transmit bar
  5334.  
  5335.    And for that matter, for built-in shell commands:
  5336.    
  5337.   set host /pty ksh -c "for i in *; do echo $i; done"
  5338.  
  5339.    The PIPE interface, on the other hand, invokes the shell
  5340.    automatically, so:
  5341.    
  5342.   pipe echo *
  5343.  
  5344.    prints filenames, not "*".
  5345.      _________________________________________________________________
  5346.    
  5347.   2.9. X.25 Networking
  5348.   
  5349.    X.25 networking is documented in [418]Using C-Kermit, 2nd Edition.
  5350.    When the book was published, X.25 was available only in SunOS,
  5351.    Solaris, and Stratus VOS. Unlike TCP/IP, X.25 APIs are not
  5352.    standardized; each vendor's X.25 libraries and services (if they have
  5353.    them at all) are unique.
  5354.    
  5355.    This section describes new additions.
  5356.      _________________________________________________________________
  5357.    
  5358.     2.9.1. IBM AIXLink/X.25 Network Provider Interface for AIX
  5359.     
  5360.    Support for X.25 was added via IBM's Network Provider Interface (NPI),
  5361.    AIXLink/X.25 1.1, to the AIX 4.x version of C-Kermit 7.0.
  5362.    Unfortunately, AIXLink/X.25 is a rather bare-bones facility, lacking
  5363.    in particular any form of PAD support (X.3, X.28, X.29). Thus, the AIX
  5364.    version of C-Kermit, when built to include X.25 networking, has
  5365.    neither a PAD command, nor a SET PAD command. The same is true for the
  5366.    underlying AIX system: no PAD support. Thus it is not possible to have
  5367.    an interactive shell session over an X.25 connection into an AIX
  5368.    system (as far as we know), even from X.25-capable Kermit versions
  5369.    (such as Solaris or VOS) that do include PAD support.
  5370.    
  5371.    Thus the X.25 capabilities in AIX C-Kermit are limited to peer-to-peer
  5372.    connections, e.g. from a C-Kermit client to a C-Kermit server. Unlike
  5373.    the Solaris, SunOS, and VOS versions, the AIX version can accept
  5374.    incoming X.25 connections:
  5375.    
  5376.   set network type x.25
  5377.   if fail stop 1 Sorry - no X.25 support
  5378.   ; Put any desired DISABLE or ENABLE or SET commands here.
  5379.   set host /server *
  5380.   if fail stop 1 X.25 "set host *" failed
  5381.  
  5382.    And then access it from the client as follows:
  5383.    
  5384.   set network type x.25
  5385.   if fail stop 1 Sorry - no X.25 support
  5386.   set host xxxxxxx ; Specify the X.25/X.121 address
  5387.   if fail stop 1 Can't open connection
  5388.  
  5389.    And at this point the client can use the full range of client
  5390.    commands: SEND, GET, REMOTE xxx, FINISH, BYE.
  5391.    
  5392.    The AIX version also adds two new variables:
  5393.    
  5394.    \v(x25local_nua)
  5395.           The local X.25 address.
  5396.           
  5397.    \v(x25remote_nua)
  5398.           The X.25 address of the host on the other end of the
  5399.           connection.
  5400.           
  5401.    C-Kermit's AIX X.25 client has not been tested against anything other
  5402.    than a C-Kermit X.25 server on AIX. It is not known if it will
  5403.    interoperate with C-Kermit servers on Solaris, SunOS, or VOS.
  5404.    
  5405.    To make an X.25 connection from AIX C-Kermit, you must:
  5406.    
  5407.   set x25 call-user-data xxxx
  5408.  
  5409.    where xxxx can be any even-length string of hexadecimal digits, e.g.
  5410.    123ABC.
  5411.      _________________________________________________________________
  5412.    
  5413.     2.9.2. HP-UX X.25
  5414.     
  5415.    Although C-Kermit presently does not include built-in support for
  5416.    HP-UX X.25, it can still be used to make X.25 connections as follows:
  5417.    start Kermit and tell it to:
  5418.    
  5419.   set prefixing all
  5420.   set parity space
  5421.   pty padem address
  5422.  
  5423.    This should work in HP-UX 9.00 and later (see [419]Section 2.7). If
  5424.    you have an earlier HP-UX version, or the PTY interface doesn't work
  5425.    or isn't available, try:
  5426.    
  5427.   set prefixing all
  5428.   set parity space
  5429.   pipe padem address
  5430.  
  5431.    Failing that, use Kermit to telnet to localhost and then after logging
  5432.    back in, start padem as you would normally do to connect over X.25.
  5433.      _________________________________________________________________
  5434.    
  5435.   2.10. Additional Serial Port Controls
  5436.   
  5437.    C-Kermit 7.0 adds the following commands for greater control over
  5438.    serial ports. These commands are available only in C-Kermit versions
  5439.    whose underlying operating systems provide the corresponding services
  5440.    (such as POSIX and UNIX System V), and even then their successful
  5441.    operation depends on the capabilities of the specific device and
  5442.    driver.
  5443.    
  5444.    SET DISCONNECT { ON, OFF }
  5445.           On a SET LINE or SET PORT connection with SET CARRIER ON or
  5446.           AUTO, if the carrier signal drops during the connection,
  5447.           indicating that the connection has been lost, and C-Kermit
  5448.           notices it, this setting governs what happens next. With SET
  5449.           DISCONNECT OFF, which is consistent with previous behavior, and
  5450.           therefore the default, C-Kermit continues to keep the device
  5451.           open and allocated. With SET DISCONNECT ON, C-Kermit
  5452.           automatically closes and releases the device when it senses a
  5453.           carrier on-to-off transition, thus allowing others to use it.
  5454.           However, it remains the default device for i/o (DIAL, REDIAL,
  5455.           INPUT, SEND, CONNECT, etc), so if a subsequent i/o command is
  5456.           given, the device is reopened if it is still available. When it
  5457.           has been automatically closed in this manner, SHOW
  5458.           COMMUNICATIONS puts "(closed)" after its name, and in UNIX, the
  5459.           lockfile disappears -- both from SHOW COMM and from the
  5460.           lockfile directory itself. Synonym: SET CLOSE-ON-DISCONNECT.
  5461.           
  5462.    SET EXIT ON-DISCONNECT { ON, OFF }
  5463.           Like DISCONNECT, but makes the program exit if a connection
  5464.           drops.
  5465.           
  5466.    Note that SET CLOSE-ON-DISCONNECT and SET EXIT ON-DISCONNECT apply
  5467.    only to connections that drop; they do not apply to connections that
  5468.    can't be made in the first place. For example, they have no effect
  5469.    when a SET LINE, SET HOST, TELNET, or DIAL command fails.
  5470.    
  5471.    HANGUP
  5472.           If [CLOSE-ON-]DISCONNECT is ON, and the HANGUP command is given
  5473.           on a serial device, and the carrier signal is no longer present
  5474.           after the HANGUP command, the device is closed and released.
  5475.           
  5476.    SET PARITY HARDWARE { EVEN, ODD }
  5477.           Unlike SET PARITY { EVEN, ODD, MARK, SPACE }, which selects 7
  5478.           data bits plus the indicated kind of parity (to be done in
  5479.           software by Kermit itself), SET PARITY HARDWARE selects 8 data
  5480.           bits plus even or odd parity, to be done by the underlying
  5481.           hardware, operating system, or device driver. This command is
  5482.           effective only with a SET LINE or SET PORT device. That is, it
  5483.           has no effect in remote mode, nor on network connections. There
  5484.           is presently no method for selecting 8 data bits plus mark or
  5485.           space parity. If hardware parity is in effect, the variable
  5486.           \v(hwparity) is set to "even" or "odd". Note: some platforms
  5487.           might also support settings of SPACE, MARK, or NONE.
  5488.           
  5489.    SET STOP-BITS { 1, 2 }
  5490.           This tells the number of 1-bits to insert after an outbound
  5491.           character's data and parity bits, to separate it from the next
  5492.           character. Normally 1. Choosing 2 stop bits should do no harm,
  5493.           but will slow down serial transmission by approximately 10
  5494.           percent. Historically, 2 stop bits were used with Teletypes (at
  5495.           110 bps or below) for print-head recovery time. There is
  5496.           presently no method for choosing any number of stop bits
  5497.           besides 1 and 2.
  5498.           
  5499.    SET SERIAL [ dps ]
  5500.           dps stands for Data-bits, Parity, Stop-bits. This is the
  5501.           notation familiar to many people for serial port configuration:
  5502.           7E1, 8N1, 7O2, etc. The data bits number also becomes the
  5503.           TERMINAL BYTESIZE setting. The second character is E for Even,
  5504.           O for Odd, M for Mark, S for Space, or N for None. The list of
  5505.           available options depends on the capabilities of the specific
  5506.           platform. If dps is omitted, 8N1 is used. Type "set serial ?"
  5507.           for a list of available choices. Examples:
  5508.           
  5509.         SET SERIAL 7E1
  5510.                 Equivalent to SET PARITY EVEN, SET STOP-BITS 1, SET TERM
  5511.                 BYTE 7.
  5512.                 
  5513.         SET SERIAL 8N1
  5514.                 Equivalent to SET PARITY NONE, SET STOP-BITS 1, SET TERM
  5515.                 BYTE 8.
  5516.                 
  5517.         SET SERIAL 7E2
  5518.                 Equivalent to SET PARITY EVEN and SET STOP-BITS 2, SET
  5519.                 TERM BYTE 7.
  5520.                 
  5521.         SET SERIAL 8E2
  5522.                 Same as SET PARITY HARDWARE EVEN, SET STOP-BITS 2, SET
  5523.                 TERM BYTE 8.
  5524.                 
  5525.         SET SERIAL
  5526.                 Same as SET PARITY NONE and SET STOP-BITS 1, SET TERM
  5527.                 BYTE 8.
  5528.                 
  5529.    Notes:
  5530.    
  5531.      * The SET SERIAL xx2 options are available only in Kermit versions
  5532.        where the SET PARITY HARDWARE command is also available. (SHOW
  5533.        FEATURES includes "HWPARITY" in its options list.)
  5534.      * The SET SERIAL 7xx and 8N1 options affect the software parity
  5535.        setting, even for network connections.
  5536.      * As noted in the manual, selecting 8 data bits does not give you
  5537.        8-bit terminal sessions in CONNECT mode unless you also SET
  5538.        TERMINAL BYTESIZE 8. The default terminal bytesize remains 7, to
  5539.        protect against the situation where the remote host is generating
  5540.        parity but you don't know about it. If the terminal bytesize was 8
  5541.        by default and you CONNECTed to such a host, you would see only
  5542.        garbage on your screen.
  5543.      * If you do not give a SET STOP-BITS or SET SET SERIAL command,
  5544.        C-Kermit does not attempt to set the device's stop bits; instead,
  5545.        it uses whatever setting the device uses when not given explicit
  5546.        instructions about stop bits.
  5547.        
  5548.    SHOW COMMUNICATIONS displays the current settings. Stop bits and
  5549.    hardware parity are shown only for SET PORT / SET LINE (serial)
  5550.    devices, since they do not apply to network connections or to remote
  5551.    mode. STOP-BITS is shown as "(default)" if you have not given an
  5552.    explicit SET STOP-BITS or SET SERIAL command.
  5553.    
  5554.    The \v(serial) variable shows the SET SERIAL setting (8N1, 7E1, etc).
  5555.      _________________________________________________________________
  5556.    
  5557.   2.11. Getting Access to the Dialout Device
  5558.   
  5559.      This section is for UNIX only; note the special words about QNX at
  5560.      the end. Also see [420]Section 2.0 for SET LINE switches,
  5561.      particularly the /SHARE switch for VMS only.
  5562.      
  5563.    C-Kermit does its best to obey the UUCP lockfile conventions of each
  5564.    platform (machine, operating system, OS version) where it runs, if
  5565.    that platform uses UUCP.
  5566.    
  5567.    But simply obeying the conventions is often not good enough, due to
  5568.    the increasing likelihood that a particular serial device might have
  5569.    more than one name (e.g. /dev/tty00 and /dev/term/00 are the same
  5570.    device in Unixware 7; /dev/cua and /dev/cufa are the same device in
  5571.    NeXTSTEP), plus the increasingly widespread use of symlinks for device
  5572.    names, such as /dev/modem.
  5573.    
  5574.    C-Kermit 7.0 goes to greater lengths than previous versions to
  5575.    successfully interlock with other communications program (and other
  5576.    instances of Kermit itself); for example, by:
  5577.    
  5578.      * Creation of dual lockfiles whenever a symlink is used; one for the
  5579.        link name and one for the real name.
  5580.      * Creation of dual lockfiles in HP-UX according to HP rules.
  5581.      * Creation of dual uppercase/lowercase lockfile names in SCO
  5582.        UNIX/ODT/OSR5.
  5583.      * The use of ttylock() in versions of AIX where it works.
  5584.      * The use, wherever possible, of lockfile names based on
  5585.        inode/major/minor device number rather than device name.
  5586.        
  5587.    See the [421]ckuins.txt and [422]ckubwr.txt files for details.
  5588.    
  5589.    QNX is almost unique among UNIX varieties in having no UUCP programs
  5590.    nor UUCP-oriented dialout-device locking conventions. QNX does,
  5591.    however, allow a program to get the device open count. This can not be
  5592.    a reliable form of locking unless all applications do it (and they
  5593.    don't), so by default, Kermit uses this information only for printing
  5594.    a warning message such as:
  5595.    
  5596.   C-Kermit>set line /dev/ser1
  5597.   WARNING - "/dev/ser1" looks busy...
  5598.  
  5599.    However, if you want to use it as a lock, you can do so with:
  5600.    
  5601.   SET QNX-PORT-LOCK { ON, OFF }
  5602.  
  5603.    QNX-PORT-LOCK is OFF by default; if you set in ON, C-Kermit fails to
  5604.    open any dialout device when its open count indicates that another
  5605.    process has it open. SHOW COMM (in QNX only) displays the setting, and
  5606.    if you have a port open, it also shows the current open count (with
  5607.    C-Kermit's own access always counting as 1).
  5608.      _________________________________________________________________
  5609.    
  5610.   2.12. The Connection Log
  5611.   
  5612.    C-Kermit 7.0 adds the ability to log connections, so you can see where
  5613.    you've been and have a record of calls you've made. A connection is
  5614.    defined as any communications session that is begun by SET LINE, SET
  5615.    PORT, DIAL, SET HOST, TELNET, or RLOGIN. Connections are not logged
  5616.    unless you request it; the command is:
  5617.    
  5618.    LOG CX [ filename [ { NEW, APPEND } ] ]
  5619.           Enables logging of connections in the given file. If the
  5620.           trailing { NEW, APPEND } keyword is omitted, the file is opened
  5621.           for appending; i.e. new records are written to the end. If NEW
  5622.           is specified, a new file is created; if a file of the same name
  5623.           already existed, it is overwritten. If the filename is omitted,
  5624.           CX.LOG in your home (login) directory is used (note:
  5625.           uppercase). To accept all defaults, just use "log connections"
  5626.           (or "l c" for short). Synonym: LOG CONNECTIONS.
  5627.           
  5628.    CLOSE CX-LOG
  5629.           This closes the connection log if it was open. (Note, the CLOSE
  5630.           CONNECTION command closes the connection itself).
  5631.           
  5632.    SHOW CX
  5633.           This shows your current connection, if any, including the
  5634.           elapsed time (since you opened it). Synonym: SHOW CONNECTION.
  5635.           
  5636.    \v(cx_time)
  5637.           This variable shows the elapsed time of your current
  5638.           connection, or if there is no current connection, of your most
  5639.           recent connection, of if there have been no connections, 0.
  5640.           
  5641.    The connection contains one line per connection, of the form:
  5642.    
  5643.   yyyymmdd hh:mm:ss username pid p=v [ p=v [ ... ] ]
  5644.  
  5645.    where the timestamp (in columns 1-18) shows when the connection was
  5646.    made; username is the login identity of the person who made the
  5647.    connection; pid is Kermit's process ID when it made the connection.
  5648.    The p's are parameters that depend on the type of connection, and the
  5649.    v's are their values:
  5650.    
  5651.   T = Connection Type (TCP, SERIAL, DIAL, DECNET, etc).
  5652.   H = The name of the Host from which the connection was made.
  5653.   N = Destination phone Number or Network host name or address.
  5654.   D = Serial connections only: Device name.
  5655.   O = Dialed calls only: Originating country code & area code if known.
  5656.   E = Elapsed time in hh:mm:ss format (or hhh:mm:ss, etc).
  5657.  
  5658.    If you always want to keep a connection log, simply add:
  5659.    
  5660.   log connections
  5661.  
  5662.    to your C-Kermit customization file. Note, however, that if you make a
  5663.    lot of connections, your CX.LOG will grow and grow. You can handle
  5664.    this by adding a "logrotate" procedure like the following to your
  5665.    customization file, before the "log connections" command:
  5666.    
  5667.   define LOGROTATE {                    ; Define LOGROTATE macro
  5668.       local \%i \%m \%d \%n \%f MAX
  5669.       def MAX 4                         ; How many months to keep
  5670.       if not def \%1 -                  ; No argument given
  5671.         end 1 \%0: No filename given
  5672.       if not = 1 \ffiles(\%1) -         ; Exactly 1 file must match
  5673.         end 1 \%0: \%1 - File not found
  5674.       .\%d := \fsubstr(\fdate(\%1),1,6) ; Arg OK - get file year & month
  5675.       if = \%d -                        ; Compare file year & month
  5676.         \fsubstr(\v(ndate),1,6) -       ; with current year & month
  5677.           end 0                         ; Same year & month - done
  5678.       rename \%1 \%1.\%d                ; Different - rename file
  5679.       .\%n := \ffiles(\%1.*)            ; How many old files
  5680.       if < \%n \m(MAX) end 0            ; Not enough to rotate
  5681.       .\%m := \%1.999999                ; Initial compare string
  5682.       for \%i 1 \%n 1 {                 ; Loop thru old logs
  5683.          .\%f := \fnextfile()           ; Get next file name
  5684.          if llt \%f \%m .\%m := \%f     ; If this one older remember it
  5685.       }
  5686.       delete \%m                        ; Delete the oldest one
  5687.   }
  5688.   log connections                       ; Now open the (possibly new) log
  5689.   logrotate \v(home)CX.LOG              ; Run the LOGROTATE macro
  5690.  
  5691.    As you can see, this compares the yyyymm portion of the modification
  5692.    date (\fdate()) of the given file (\%1) with the current yyyymm. If
  5693.    they differ, the current file has the yyyymm suffix (from its most
  5694.    recent modification date) appended to its name. Then we search through
  5695.    all other such files, find the oldest one, and delete it. Thus the
  5696.    current log, plus the logs from the most recent four months, are kept.
  5697.    This is all done automatically every time you start C-Kermit.
  5698.    
  5699.    On multiuser systems, it is possible to keep a single, shared,
  5700.    system-wide connection log, but this is not recommended since (a) it
  5701.    requires you keep a publicly write-accessible logfile (a glaring
  5702.    target for mischief), and (b) it would require each user to log to
  5703.    that file and not disable logging. A better method for logging
  5704.    connections, in UNIX at least, is syslogging (see [423]ckuins.txt
  5705.    Section 15 and [424]Section 4.2 of the [425]IKSD Administration Guide
  5706.    for details).
  5707.      _________________________________________________________________
  5708.    
  5709.   2.13. Automatic Connection-Specific Flow Control Selection
  5710.   
  5711.    Beginning in C-Kermit 7.0, the appropriate flow-control method for
  5712.    each connection type is kept in a table, for example:
  5713.    
  5714.   Remote:           NONE
  5715.   Modem:            RTS/CTS
  5716.   Direct-Serial:    NONE
  5717.   TCPIP:            NONE
  5718.  
  5719.    The size of the table and values for each connection type can vary
  5720.    from platform to platform. Type "set flow ?" for a list of available
  5721.    flow-control types.
  5722.    
  5723.    The table is used to automatically select the appropriate kind of flow
  5724.    control whenever you make a connection. You can display the table
  5725.    with:
  5726.    
  5727.   SHOW FLOW-CONTROL
  5728.  
  5729.    The defaults are as follows:
  5730.    
  5731.    Remote:
  5732.           NONE or XON/XOFF. This is because C-Kermit is not allowed to
  5733.           find out what type of connection the incoming user has (*). No
  5734.           kind of flow control will work on every kind of connection,
  5735.           including (unexpectedly) KEEP, which we would have liked to
  5736.           use, but not turning off flow control at the remote end during
  5737.           file transfer on TCP/IP connections is fatal to the transfer
  5738.           (except in VMS and HP-UX, where it must be set to Xon/Xoff!)
  5739.           Therefore if you are dialing in to a serial port on a server
  5740.           (UNIX or VMS) where C-Kermit is running, you will need to tell
  5741.           C-Kermit to "set flow keep" before transferring files (assuming
  5742.           the modem and port are configured correctly by the system
  5743.           administrator; otherwise you'll need to give a specific kind of
  5744.           flow control, e.g. "set flow xon/xoff"), so in this case
  5745.           C-Kermit will not disable flow control, as it must do when you
  5746.           are coming via Telnet (directly or through a terminal server,
  5747.           except on VMS and HP-UX).
  5748.           
  5749.    Modem:
  5750.           This applies when you dial out with a modem. In this case, the
  5751.           MODEM FLOW-CONTROL setting takes affect after the SET FLOW
  5752.           setting, so it can pick the most appropriate flow control for
  5753.           the combination of the particular modem and the
  5754.           computer/port/driver that is dialing.
  5755.           
  5756.    Direct-Serial:
  5757.           The default here is NONE because C-Kermit has no way of knowing
  5758.           what kind of flow control, if any, is or can be done by the
  5759.           device at the other end of the connection. RTS/CTS would be a
  5760.           bad choice here, because if the CTS signal is not asserted, the
  5761.           connection will hang. And since direct connections are often
  5762.           made with 3-wire cables, there is a good chance the CTS signal
  5763.           will not be received.
  5764.           
  5765.    TCPIP:
  5766.           NONE, since TCP and IP provide their own flow control
  5767.           transparently to the application, except in VMS, where Xon/Xoff
  5768.           is the default due to the requirements of the VMS TCP/IP
  5769.           products.
  5770.           
  5771.    Other networks:
  5772.           NONE, since networks should provide their flow control
  5773.           transparently to the application.
  5774.           
  5775.    (*) This is possibly the worst feature of UNIX, VMS, and other
  5776.    platforms where C-Kermit runs. If C-Kermit was able to ask the
  5777.    operating system what kind of connection it had to the user, it could
  5778.    set up many things for you automatically.
  5779.    
  5780.    You can modify the default-flow-control table with:
  5781.    
  5782.   SET FLOW-CONTROL /xxx { NONE, KEEP, RTS/CTS, XON/XOFF, ... }
  5783.  
  5784.    where "xxx" is the connection type, e.g.
  5785.    
  5786.   SET FLOW /REMOTE NONE
  5787.   SET FLOW /DIRECT RTS/CTS
  5788.  
  5789.    If you leave out the switch, SET FLOW works as before, choosing the
  5790.    flow control method to be used on the current connection:
  5791.    
  5792.   SET FLOW XON/XOFF
  5793.  
  5794.    Thus, whenever you make a connection with SET PORT, SET LINE, DIAL,
  5795.    SET HOST, TELNET, RLOGIN, etc, an appropriate form of flow control is
  5796.    selected automatically. You can override the automatic selection with
  5797.    a subsequent SET FLOW command, such as SET FLOW NONE (no switch
  5798.    included).
  5799.    
  5800.    The flow control is changed automatically too when you give a SET
  5801.    MODEM TYPE command. For example, suppose your operating system (say
  5802.    Linux) supports hardware flow control (RTS/CTS). Now suppose you give
  5803.    the following commands:
  5804.    
  5805.   set line /dev/ttyS2    ; Automatically sets flow to NONE
  5806.   set modem type usr     ; Automatically sets flow to RTS/CTS
  5807.   set modem type rolm    ; Doesn't support RTS/CTS so now flow is XON/XOFF
  5808.  
  5809.    IMPORTANT: This new feature tends to make the order of SET LINE/HOST
  5810.    and SET FLOW commands matter, where it didn't before. For example, in
  5811.    VMS:
  5812.    
  5813.   SET FLOW KEEP
  5814.   SET LINE TTA0:
  5815.  
  5816.    the SET LINE undoes the SET FLOW KEEP command; the sequence now must
  5817.    be:
  5818.    
  5819.   SET FLOW /DIRECT KEEP
  5820.   SET LINE TTA0:
  5821.  
  5822.    or:
  5823.    
  5824.   SET LINE TTA0:
  5825.   SET FLOW KEEP
  5826.      _________________________________________________________________
  5827.    
  5828.   2.14. Trapping Connection Establishment and Loss
  5829.   
  5830.    If you define a macro called ON_OPEN, it is executed any time that a
  5831.    SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or similar command
  5832.    succeeds in opening a connection. The argument is the host or device
  5833.    name (as shown by SHOW COMMUNICATIONS, and the same as \v(line)). This
  5834.    macro can be used for all sorts of things, like automatically setting
  5835.    connection- or host-specific parameters when the connection is opened.
  5836.    Example:
  5837.    
  5838.   def ON_OPEN {
  5839.       switch \%1 {
  5840.         :abccorp.com, set reliable off, break
  5841.         :xyzcorp.com, set receive packet-length 1000, break
  5842.         etc etc...
  5843.       }
  5844.   }
  5845.  
  5846.    If you define a macro called ON_CLOSE, it will be executed any time
  5847.    that a SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or any other kind
  5848.    of connection that C-Kermit has made is closed, either by the remote
  5849.    or by a local CLOSE, HANGUP, or EXIT command or other local action,
  5850.    such as when a new connection is opened before an old one was
  5851.    explicitly closed.
  5852.    
  5853.    As soon as C-Kermit notices the connection has been closed, the
  5854.    ON_CLOSE macro is invoked at (a) the top of the command parsing loop,
  5855.    or (b) when a connection is closed implicitly by a command such as SET
  5856.    LINE that closes any open connection prior to making a new connection,
  5857.    or (c) when C-Kermit closes an open connection in the act of exiting.
  5858.    
  5859.    The ON_CLOSE macro was inspired by the neverending quest to unite
  5860.    Kermit and SSH. In this case using the "tunnel" mechanism:
  5861.    
  5862.   def TUNNEL {                                ; \%1 = host to tunnel to
  5863.       local \%p
  5864.       if not def \%1 stop 1
  5865.       assign tunnelhost \%1                   ; Make global copy
  5866.       undef on_close
  5867.       set macro error off
  5868.       close connection                        ; Ignore any error
  5869.       open !read tunnel start \%1
  5870.       read \%p                                ; Get port number
  5871.       if fail stop 1 Tunnel failure: \%1
  5872.       close read
  5873.       if fail stop 1 Tunnel failure: \%1      ; See [426]Section 4.2.8.1
  5874.       assign on_close {                       ; Set up close handler
  5875.           echo Closing tunnel: \m(tunnelhost)
  5876.           !tunnel stop \m(tunnelhost)
  5877.           undef on_close
  5878.       }
  5879.       set host localhost:\%p /telnet
  5880.       if success end 0
  5881.       undef on_close
  5882.       stop 1 Connection failure: \%1
  5883.   }
  5884.  
  5885.    In this case, when the connection stops, we also need to shut down the
  5886.    tunnel, even if it is at a later time after TUNNEL has finished
  5887.    executing. This way we can escape back, reconnect, transfer files, and
  5888.    so on until the connection is broken by logging out from the remote,
  5889.    or by explicitly closing it, or by EXITing from C-Kermit, at which
  5890.    time the tunnel is shut down.
  5891.    
  5892.    When the connection is closed, no matter how, the ON_CLOSE macro
  5893.    executes and then undefines (destroys) itself, since we don't want to
  5894.    be closing tunnels in the future when we close subsequent connections.
  5895.    
  5896.    Other such tricks can be imagined, including ending ON_CLOSE with a
  5897.    STOP command to force the command stack to be peeled all the way back
  5898.    to the top, for example in a deeply nested script that depends on the
  5899.    connection being open:
  5900.    
  5901.   def on_close { stop 1 CONNECTION LOST }
  5902.  
  5903.    When C-Kermit invokes the ON_CLOSE macro, it supplies one argument
  5904.    (\%1): the reason the connection was closed as a number, one of the
  5905.    following:
  5906.    
  5907.   2 - Fatal failure to negotiate a required item on a network connection.
  5908.   1 - Closed by C-Kermit command.
  5909.   0 - All others (normally closed by remote).
  5910.  
  5911.    which may be used for any purpose; for example, to add a comment to
  5912.    the connection log:
  5913.    
  5914.   def on_close {
  5915.       local \%m
  5916.       if not open cx end 0
  5917.       switch \%1 {
  5918.         :0, .\%m = Closed by remote, break
  5919.         :1, .\%m = Closed by me, break
  5920.         :2, .\%m = Network protocol negotiation failure, break
  5921.       }
  5922.       if def \%m writeln cx {# \%m}
  5923.   }
  5924.      _________________________________________________________________
  5925.    
  5926.   2.15. Contacting Web Servers with the HTTP Command
  5927.   
  5928.    C-Kermit 7.0 (at this writing, the UNIX version only) supports direct
  5929.    contact and interaction with Web servers via HTTP 1.0 protocol. To
  5930.    make a connection, use Kermit's normal method for making a TCP/IP
  5931.    connection, but specify the HTTP port:
  5932.    
  5933.   SET HOST host http [ switches ]
  5934.  
  5935.    where host is the IP hostname or address, and http is the name of the
  5936.    TCP port for the Web server. Relevant switches include:
  5937.    
  5938.    /RAW
  5939.           Treat the connection as a transparent binary pipe. This switch
  5940.           may be required if a port other than 'http' is used.
  5941.           
  5942.    /SSL
  5943.           Make an secure private connection with SSL (only if SSL support
  5944.           is included in your version of Kermit). In this case the port
  5945.           name might need to be https rather than http, e.g. "set host
  5946.           secureserver.xyxcorp.com https /ssl".
  5947.           
  5948.    /TLS
  5949.           Make an secure private connection with TLS (only if TLS support
  5950.           is included in your version of Kermit). In this case the port
  5951.           name would be https rather than http.
  5952.           
  5953.    Then you can issue an HTTP command. In most cases, the server closes
  5954.    the connection when the command is complete. Example:
  5955.    
  5956.   SET HOST www.columbia.edu http
  5957.   IF FAIL EXIT 1 Can't contact server
  5958.   HTTP GET kermit/index.html
  5959.  
  5960.    At this point the connection is closed, since that's how HTTP 1.0
  5961.    works. If you want to perform additional operations, you must
  5962.    establish a new connection with another SET HOST command.
  5963.    
  5964.    The HTTP command acts as a client to the Web server, except instead of
  5965.    displaying the results like a Web browser would, it stores them. Any
  5966.    HTTP command can (but need not) include any or all of the following
  5967.    switches:
  5968.    
  5969.    /AGENT:user-agent
  5970.           Identifies the client to the server; "C-Kermit" or "Kermit-95"
  5971.           by default.
  5972.           
  5973.    /HEADER:header-line
  5974.           Used for specifying any optional headers. A list of headers is
  5975.           provided using braces for grouping:
  5976.           
  5977.   /HEADER:{{tag:value}{tag:value}...}
  5978.  
  5979.           For a listing of valid tag value and value formats see [427]RFC
  5980.           1945: Hypertext Transfer Protocol -- HTTP/1.0. A maximum of
  5981.           eight headers may be specified.
  5982.           
  5983.    /USER:name
  5984.           In case a page requires a username for access.
  5985.           
  5986.    /PASSWORD:password
  5987.           In case a page requires a password for access.
  5988.           
  5989.    /ARRAY:arrayname
  5990.           Tells Kermit to store the response headers in the given array,
  5991.           one line per element. The array need not be declared in
  5992.           advance. Example:
  5993.           
  5994.   C-Kermit? http /array:c get kermit/index.html
  5995.   C-Kermit? show array c
  5996.   Dimension = 9
  5997.   1. Date: Fri, 26 Nov 1999 23:12:22 GMT
  5998.   2. Server: Apache/1.3.4 (Unix)
  5999.   3. Last-Modified: Mon, 06 Sep 1999 22:35:58 GMT
  6000.   4. ETag: "bc049-f72-37d441ce"
  6001.   5. Accept-Ranges: bytes
  6002.   6. Content-Length: 3954
  6003.   7. Connection: close
  6004.   8. Content-Type: text/html
  6005.  
  6006.    As you can see, the header lines are like MIME e-mail header lines:
  6007.    identifier, colon, value. The /ARRAY switch is the only method
  6008.    available to a script to process the server responses for a POST or
  6009.    PUT command.
  6010.    
  6011.    The HTTP commands are:
  6012.    
  6013.    HTTP [ switches ] GET remote-filename [ local-filename ]
  6014.           Retrieves the named file. If a local-filename is given, the
  6015.           file is stored locally under that name; otherwise it is stored
  6016.           with its own name.
  6017.           
  6018.    HTTP [ switches ] HEAD remote-filename local-filename
  6019.           Like GET except without actually getting the file; instead it
  6020.           gets only the headers, storing them into the given file, whose
  6021.           name must be given, one line per header item, as shown above in
  6022.           the /ARRAY: switch description.
  6023.           
  6024.    HTTP [ switches ] INDEX remote-directory [ local-filename ]
  6025.           Retrieves the file listing for the given server directory.
  6026.           NOTE: This command is not supported by most Web servers.
  6027.           
  6028.    HTTP [ switches ] POST [ /MIME-TYPE:type ] local-file remote-file
  6029.           Used to send a response as if it were sent from a form. The
  6030.           data to be posted must be read from a file.
  6031.           
  6032.    HTTP [ switches ] PUT [ /MIME-TYPE:type ] local-file remote-file
  6033.           Uploads a local file to a server file.
  6034.           
  6035.    HTTP [ switches ] DELETE remote-filename
  6036.           Instructs the server to delete the specified filename.
  6037.      _________________________________________________________________
  6038.    
  6039.   3. TERMINAL CONNECTION
  6040.   
  6041.   3.1. CONNECT Command Switches
  6042.   
  6043.    The following switches (see [428]Section 1.5) were added to the
  6044.    CONNECT command in 7.0:
  6045.    
  6046.    /QUIETLY
  6047.           Don't print the "Connecting to..." or "Back at..." messages. CQ
  6048.           is an invisible command synonym for CONNECT /QUIETLY.
  6049.           
  6050.    /TRIGGER:string
  6051.           Specify a trigger or triggers ([429]Section 3.2) effective for
  6052.           this CONNECT command only, temporarily overriding any current
  6053.           SET TERMINAL TRIGGER values ([430]Section 3.2).
  6054.           
  6055.    Note: Other switches might also be available; type "connect ?" for a
  6056.    list, "help connect" for a description of each.
  6057.      _________________________________________________________________
  6058.    
  6059.   3.2. Triggers
  6060.   
  6061.    Triggers were added for UNIX, VMS, AOS/VS, and K95 in C-Kermit 7.0.
  6062.    
  6063.    SET TERMINAL TRIGGER string
  6064.           Tells C-Kermit to look for the given string during all
  6065.           subsequent CONNECT sessions, and if seen, to return to command
  6066.           mode automatically, as if you had escaped back manually. If the
  6067.           string includes any spaces, you must enclose it in braces.
  6068.           Example:
  6069.           
  6070.   set terminal trigger {NO CARRIER}
  6071.  
  6072.    Comparisons are made after character-set translation.
  6073.    
  6074.    If a string is to include a literal brace character, precede it with a
  6075.    backslash:
  6076.    
  6077.   ; My modem always makes this noise when the connection is lost:
  6078.   set terminal trigger |||ppp\{\{\{\{UUUUUUU
  6079.  
  6080.    If you want Kermit to look for more than one string simultaneously,
  6081.    use the following syntax:
  6082.    
  6083.   set terminal trigger {{string1}{string2}...{stringn}}
  6084.  
  6085.    In this case, C-Kermit will return to command mode automatically if
  6086.    any of the given strings is encountered. Up to 8 strings may be
  6087.    specified.
  6088.    
  6089.    If the most recent return to command mode was caused by a trigger, the
  6090.    new variable, \v(trigger), shows the trigger value; otherwise
  6091.    \v(trigger) is empty.
  6092.    
  6093.    The SHOW TRIGGER command displays the SET TERMINAL TRIGGER values as
  6094.    well as the \v(trigger) value.
  6095.      _________________________________________________________________
  6096.    
  6097.   3.3. Transparent Printing
  6098.   
  6099.    As noted in the manual, C-Kermit's CONNECT command on UNIX is not a
  6100.    terminal emulator, but rather a "semitransparent pipe" between the
  6101.    terminal or emulator you are using to access C-Kermit, and the remote
  6102.    host to which C-Kermit is connected. The "semitransparent" qualifier
  6103.    is because of character-set translation as well as several actions
  6104.    taken by the emulator in response to the characters or strings that
  6105.    pass through it, such as APCs, Kermit packets (autodownload),
  6106.    triggers, etc.
  6107.    
  6108.    The UNIX version of C-Kermit 7.0 adds another such action: Transparent
  6109.    printing, also called Controller printing (as distinct from Autoprint
  6110.    or line or screen print). It is intended mainly for use on UNIX
  6111.    workstation consoles (as opposed to remote logins), but with some care
  6112.    can also be used when accessing C-Kermit remotely.
  6113.    
  6114.    Transparent printing is related to APC by sharing C-Kermit's built-in
  6115.    ANSI escape-sequence parser to detect "printer on" and "printer off"
  6116.    sequences from the host. When the printer-on sequence is received, all
  6117.    subsequent arriving characters -- including NUL, control characters,
  6118.    and escape sequences -- are sent to the SET PRINTER device instead of
  6119.    to your screen until the printer-off sequence is received, or you
  6120.    escape back, whichever happens first. These bytes are not translated
  6121.    or modified or filtered in any way by Kermit (except for possibly
  6122.    stripping of the 8th bit, as noted below), but if filtering or
  6123.    translation is desired, this can be accomplished by your SET PRINTER
  6124.    selection (e.g. by choosing a pipeline of filters).
  6125.    
  6126.    By default, your SET PRINTER device is your default UNIX printer, but
  6127.    it can also be a file, a command, or the null device (which causes all
  6128.    printer material to be discarded). See [431]Using C-Kermit, 2nd Ed.,
  6129.    p.41 for details.
  6130.    
  6131.    Transparent printing is controlled by the command:
  6132.    
  6133.    SET TERMINAL PRINT { ON, OFF }
  6134.           When ON, transparent-print sequences are obeyed, and printing
  6135.           occurs on the system where C-Kermit is running. When OFF,
  6136.           transparent print sequences are ignored and passed through to
  6137.           your actual terminal or emulator, along with the data they
  6138.           enclose. OFF is the default, for compatibility with earlier
  6139.           C-Kermit releases. As noted in the manual, when the current SET
  6140.           PRINTER device is a file, transparent-print material is
  6141.           appended to it; the file is not overwritten.
  6142.           
  6143.    SET TERMINAL BYTESIZE { 7, 8 }
  6144.           
  6145.    SET PARITY { EVEN, ODD, MARK, SPACE, NONE }
  6146.           If the terminal bytesize is 7, or PARITY is not NONE, the 8th
  6147.           bit of each byte is stripped prior to printing.
  6148.           
  6149.    The transparent-print escape sequences are:
  6150.    
  6151.    <ESC>[5i
  6152.           Printer On. Send all subsequent incoming bytes to the printer
  6153.           without any kind of filtering, translation, or alteration.
  6154.           Note: <ESC> stands for ASCII character number 27 (decimal),
  6155.           Escape.
  6156.           
  6157.    <ESC>[4i
  6158.           Printer Off. Resume displaying incoming bytes on the screen.
  6159.           
  6160.    These are the same sequences used by DEC VT100 and higher terminals
  6161.    and other ANSI X3.64 and ISO 6429 compatible terminals. There is no
  6162.    provision for selecting other printer-control sequences.
  6163.    
  6164.    Restrictions:
  6165.    
  6166.     1. You must SET TERM PRINT ON before you can use this feature.
  6167.     2. Only the 7-bit forms of the escape sequences are supported. The
  6168.        8-bit CSI C1 control is not recognized.
  6169.     3. Autoprint is not supported, since this requires a full-fledged
  6170.        terminal emulator with direct access to the screen.
  6171.     4. The start-print and stop-print sequences pass through to the
  6172.        screen (there is no way to avoid this without causing unacceptable
  6173.        delays or deadlocks in CONNECT mode). Thus if your terminal or
  6174.        emulator also supports transparent printing via these same
  6175.        sequences, an empty file will be sent to its printer. Normally
  6176.        this has no effect.
  6177.        
  6178.    Point (4) is similar to the situation with autodownload and APC --
  6179.    when you have several Kermit clients in a chain, you should take care
  6180.    that these features are enabled in only one of them.
  6181.    
  6182.    Example 1:
  6183.    
  6184.   set printer {|lpr -Plaser}  ; Specify the printer (if not default).
  6185.   set term print on           ; Enable transparent printing.
  6186.   set term byte 8             ; Enable 8-bit characters.
  6187.   connect                     ; Enter CONNECT mode.
  6188.  
  6189.    Example 2:
  6190.    
  6191.   set printer /home/users/olga/printer.log  ; Send printer material to a file.
  6192.  
  6193.    Example 3:
  6194.    
  6195.   set printer {| grep -v ^Received | lpr}   ; Filter out some lines
  6196.  
  6197.    Then use "pcprint" or "vtprint" commands on the host to initiate
  6198.    transparent print operations. See [432]Using C-Kermit, 2nd Ed., p.406
  6199.    for details.
  6200.    
  6201.    Here is a sample "pcprint" shell script for UNIX:
  6202.    
  6203.   #!/bin/sh
  6204.   echo -n '<ESC>[5i'
  6205.   if [ $# -eq 0 ]; then
  6206.     cat
  6207.   else
  6208.     cat $*
  6209.   fi
  6210.   echo -n '<FF><ESC>[4i'
  6211.   # (end)
  6212.  
  6213.    (Replace "<ESC>" by the actual ASCII Escape character and "<FF>" by
  6214.    the ASCII Formfeed character).
  6215.    
  6216.    If you always want transparent printing enabled, put "set term print
  6217.    on" in your C-Kermit customization file (~/.mykermrc in UNIX). The
  6218.    "set term bytesize" selection, however, is a property of each separate
  6219.    connection.
  6220.      _________________________________________________________________
  6221.    
  6222.   3.4. Binary and Text Session Logs
  6223.   
  6224.    C-Kermit 7.0 corrects an oversight in earlier releases, in which
  6225.    binary session logs (SET SESSION-LOG BINARY) translated character sets
  6226.    and performed various formatting transformations (e.g. "newline mode")
  6227.    before writing characters to the session log. In C-Kermit 7.0,
  6228.    binary-mode session logging writes characters as they come in, before
  6229.    anything (other that parity-bit stripping) is done to them. Text-mode
  6230.    session logging records the characters after processing.
  6231.      _________________________________________________________________
  6232.    
  6233.   4. FILE TRANSFER
  6234.   
  6235.    Every file is transferred either in text mode (which implies
  6236.    record-format and character-set translation) or binary mode (in which
  6237.    each byte is sent literally without any kind of conversion). The mode
  6238.    in which a file is transferred is controlled by (a) the default mode,
  6239.    in the absence of any other indications; (b) the SET FILE TYPE
  6240.    command; (c) various automatic mechanisms based on client/server
  6241.    negotiations, directory information or filename patterns, etc.
  6242.    
  6243.    The default FILE TYPE was changed from TEXT to BINARY in C-Kermit 7.0
  6244.    because:
  6245.    
  6246.      * Transferring a text file in binary mode does less damage than
  6247.        transferring a binary file in text mode.
  6248.      * Only binary-mode transfers can be recovered from the point of
  6249.        failure.
  6250.      * The automatic transfer-mode mechanisms switch to text mode on a
  6251.        per-file basis anyway, so only those files that are not covered by
  6252.        the automatic mechanisms are affected.
  6253.      * All file transfers on the Web are done in binary mode, so people
  6254.        are accustomed to it and expect it.
  6255.      _________________________________________________________________
  6256.    
  6257.   4.0. BUG FIXES, MINOR CHANGES, AND CLARIFICATIONS
  6258.   
  6259.     4.0.0. Filenames with Spaces
  6260.     
  6261.    Filenames that contain spaces are a major nuisance to a program like
  6262.    Kermit, whose command language is line- and word-oriented, in which
  6263.    words are separated by spaces and a filename is assumed to be a
  6264.    "word". In general (unless noted otherwise in the description of a
  6265.    particular command), there is only one way to refer to such files in
  6266.    Kermit commands, and that is to enclose the name in braces:
  6267.    
  6268.   send {this file}
  6269.  
  6270.    Tells Kermit to send the file whose name is "this file" (two words, no
  6271.    quotes). Of course, various circumlocutions are also possible, such
  6272.    as:
  6273.    
  6274.   define \%a this file
  6275.   send \%a
  6276.  
  6277.    BUT, perhaps contrary to expectation, you can't use "\32" to represent
  6278.    the space:
  6279.    
  6280.   send this\32file
  6281.  
  6282.    does not work. Why? Because the Kermit parser, which must work on many
  6283.    operating systems including Windows, has no way of knowing what you
  6284.    mean by "this\32file". Do you mean a file whose name is "this file" in
  6285.    the current directory? Or do you mean a file whose name is "32file" in
  6286.    the "this" subdirectory of the current directory? Guessing won't do
  6287.    here; Kermit must behave consistently and deterministically in all
  6288.    cases on all platforms.
  6289.    
  6290.    Note that you can't use Esc or Tab within {...} for filename
  6291.    completion, or question mark to get a filename list. However, you can
  6292.    include wildcards; for example:
  6293.    
  6294.   send {* *}
  6295.  
  6296.    sends all files whose name contains a space.
  6297.    
  6298.    All things considered, it is best to avoid spaces in file and
  6299.    directory names if you can. Also see [433]Section 5.4 on this topic.
  6300.      _________________________________________________________________
  6301.    
  6302.     4.0.1. Packet out of Window
  6303.     
  6304.    C-Kermit 6.0 could send packets "out of window" if the window size was
  6305.    greater than 1 and ACKs had arrived out of order. Fixed in 6.1.
  6306.      _________________________________________________________________
  6307.    
  6308.     4.0.2. MOVE after ADD SEND-LIST
  6309.     
  6310.    ADD SEND-LIST followed by MOVE did not delete original files; fixed in
  6311.    6.1. Carrier loss was not detected during transfer; in 7.0 C-Kermit
  6312.    checks for this (but results can not be guaranteed). In any case, the
  6313.    protocol will eventually time out if the connection is lost.
  6314.      _________________________________________________________________
  6315.    
  6316.     4.0.3. GET and RECEIVE As-Names
  6317.     
  6318.    In 5A(190) through 6.0.192, the GET and RECEIVE as-name did not
  6319.    properly override the RECEIVE PATHNAMES setting. In 7.0 it does.
  6320.      _________________________________________________________________
  6321.    
  6322.     4.0.4. New Brief Statistics Listing
  6323.     
  6324.    Version 7.0 adds a /BRIEF switch to the STATISTICS command, to display
  6325.    a short file-transfer statistics report. /BRIEF is now the default.
  6326.    Use /VERBOSE to see the full display, which is about 25 lines long.
  6327.      _________________________________________________________________
  6328.    
  6329.     4.0.5. Improved FAST Command
  6330.     
  6331.    The preinstalled definition of the FAST macro did not take enough
  6332.    factors into account. Now it sets packet lengths and window sizes
  6333.    appropriate to the configuration. Furthermore, in IRIX only, it might
  6334.    restrict the SEND packet length to 4000, to work around a bug in the
  6335.    IRIX Telnet server, depending on the IRIX version (see
  6336.    [434]ckubwr.txt, IRIX section). To see the built-in definition of the
  6337.    FAST macro, type "show macro fast". To change it, simply define it to
  6338.    be whatever you want -- it's just a macro, like any other.
  6339.      _________________________________________________________________
  6340.    
  6341.     4.0.6. The SET SEND BACKUP Command
  6342.     
  6343.    Version 7.0 adds SET SEND BACKUP { ON, OFF }. This tells whether
  6344.    backup files should be sent. Backup files are the ones created by
  6345.    Kermit (and EMACS, and possibly other applications) to preserve old
  6346.    copies of files when creating new ones with the same name. Kermit does
  6347.    this when receiving a file and its FILE COLLISION setting is BACKUP
  6348.    (or RENAME, in which case it the new file gets the backup name). On
  6349.    most platforms, the backup name is formed by adding:
  6350.    
  6351.   .~n~
  6352.  
  6353.    to the end of the filename, where "n" is a number. For example, if the
  6354.    original file is oofa.txt, a backup file might be called:
  6355.    
  6356.   oofa.txt.~1~
  6357.  
  6358.    (or oofa.txt.~2~, etc). If you SET SEND BACKUP OFF, this tells Kermit
  6359.    not to send files that have backup names. Normally, SET SEND BACKUP is
  6360.    ON (as shown by SHOW PROTOCOL), and backup files are sent if their
  6361.    names match the SEND file specification.
  6362.    
  6363.    Also see PURGE, SET FILE COLLISION, SEND /NOBACKUP, DIRECTORY
  6364.    /[NO]BACKUP.
  6365.      _________________________________________________________________
  6366.    
  6367.     4.0.7. The SET { SEND, RECEIVE } VERSION-NUMBERS Command
  6368.     
  6369.    VMS Only. Normally when sending files, VMS C-Kermit strips the version
  6370.    number. For example, if the file is FOO.BAR;34, the name is sent as
  6371.    FOO.BAR (without the ";34"). If you want to keep version numbers on
  6372.    when sending files, use SET SEND VERSION-NUMBERS ON. The effect
  6373.    depends on the receiver.
  6374.    
  6375.    Normally when receiving files, and an incoming filename includes a
  6376.    VMS-style version number (such as FOO.BAR;34) VMS C-Kermit strips it
  6377.    before trying to create the new file; this way the new file receives
  6378.    the next highest version number in the customary manner for VMS. If
  6379.    you want version numbers on incoming filenames to be used in creating
  6380.    the new files, use SET RECEIVE VERSION-NUMBERS ON.
  6381.    
  6382.    Normally these commands would be effective only when VMS C-Kermit is
  6383.    exchanging files with a non-VMS Kermit program, since VMS-to-VMS
  6384.    transfers use labeled mode unless you have gone out of your way to
  6385.    defeat it.
  6386.    
  6387.    Example: You want to send all versions of all files in the current
  6388.    directory from a VMS C-Kermit client to a UNIX C-Kermit server. Use:
  6389.    
  6390.   set send version-numbers on
  6391.   send *.*;*
  6392.  
  6393.    The resulting Unix files will have VMS-style version numbers as part
  6394.    of their name, for example "foo.bar;1", "foo.bar;2", etc.
  6395.    
  6396.    Now suppose you want to send these files from Unix to another VMS
  6397.    system and preserve the version numbers. Again we have a Unix C-Kermit
  6398.    server and VMS C-Kermit client. Give these commands to the client:
  6399.    
  6400.   set receive version-numbers on
  6401.   get *
  6402.      _________________________________________________________________
  6403.    
  6404.     4.0.8. The SET { SEND, RECEIVE } { MOVE-TO, RENAME-TO } Commands
  6405.     
  6406.    These commands are persistent global versions of the /MOVE-TO: and
  6407.    /RENAME-TO: switches of the SEND, GET, and RECEIVE commands. They
  6408.    should normally be used only when setting up a dedicated
  6409.    transaction-processing application, in which each file is to be moved
  6410.    or renamed immediately after, and only if, it is transferred
  6411.    successfully, so that (for example) an independent, concurrent process
  6412.    can notice when new files appear and process them immediately without
  6413.    having to guess whether they are complete.
  6414.      _________________________________________________________________
  6415.    
  6416.     4.0.9. SET FILE INCOMPLETE AUTO
  6417.     
  6418.    SET FILE INCOMPLETE { KEEP, DISCARD }, which tells whether to keep or
  6419.    discard incompletely received files, has a new option, AUTO, which is
  6420.    also the default. It means KEEP the incomplete file if the transfer is
  6421.    in binary mode, otherwise DISCARD it. This reduces the chances that a
  6422.    subsequent recovery operation (RESEND, REGET, etc) could produce a
  6423.    corrupt file, since recovery works only for binary-mode transfers.
  6424.      _________________________________________________________________
  6425.    
  6426.   4.1. FILE-TRANSFER FILENAME TEMPLATES
  6427.   
  6428.    File-transfer filename templates allow files to be renamed
  6429.    automatically by the file sender, the receiver, or both, during
  6430.    transfer of groups of files.
  6431.    
  6432.     4.1.1. Templates in the As-Name
  6433.     
  6434.    Prior to C-Kermit 6.1 and Kermit 95 1.1.12 the only options that could
  6435.    be used to affect the names of files being transferred were SET
  6436.    FILENAMES { LITERAL, CONVERTED } and SET { SEND, RECEIVE } PATHNAMES {
  6437.    ON, OFF }, plus the "as-name" feature of the SEND (MOVE, etc) and
  6438.    RECEIVE commands.
  6439.    
  6440.    Previously, the as-name could be used only for a single file. For
  6441.    example:
  6442.    
  6443.   SEND FOO BAR
  6444.  
  6445.    would send the file FOO under the name BAR, but:
  6446.    
  6447.   SEND *.TXT anything
  6448.  
  6449.    was not allowed, since it would give the same name to each file that
  6450.    was sent. When receiving:
  6451.    
  6452.   RECEIVE FOO
  6453.  
  6454.    would rename the first incoming file to FOO before storing it on the
  6455.    disk, but subsequent files would not be renamed to FOO, since this
  6456.    would result in overwriting the same file repeatedly. Instead, they
  6457.    were stored under the names they arrived with.
  6458.    
  6459.    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to
  6460.    specify as-names in SEND, RECEIVE, and related commands even for file
  6461.    groups. This is accomplished by using replacement variables in the
  6462.    as-name, along with optional material such character-string functions
  6463.    and/or constant strings. An as-name containing replacement variables
  6464.    is called a filename template.
  6465.    
  6466.    The key to filename templates is the new variable:
  6467.    
  6468.   \v(filename)
  6469.  
  6470.    During file transfer it is replaced by the name of each file currently
  6471.    being transferred (after transfer, it is the name of the last file
  6472.    transferred).
  6473.    
  6474.    So, for example:
  6475.    
  6476.   send *.txt \v(filename).new
  6477.  
  6478.    sends each file with its own name, but with ".new" appended to it. Of
  6479.    course if the name already contains periods, this could confuse the
  6480.    file receiver, so you can also achieve fancier effects with
  6481.    constructions like:
  6482.    
  6483.   send *.txt \freplace(\v(filename),.,_).new
  6484.  
  6485.    which replaces all periods in the original filename by underscores,
  6486.    and then appends ".new" to the result. So, for example, oofa.txt would
  6487.    be sent as oofa_txt.new.
  6488.    
  6489.    Another new variable that is useful in this regard is \v(filenumber),
  6490.    which is the ordinal number of the current file in the file group, so
  6491.    you can also:
  6492.    
  6493.   send *.txt FILE\flpad(\v(filenum),2,0)
  6494.  
  6495.    resulting in a series of files called FILE00, FILE01, FILE02, etc. (At
  6496.    the end of the transfer, \v(filenum) tells the number of files that
  6497.    were transferred).
  6498.    
  6499.    If you specify a constant as-name when sending a file group:
  6500.    
  6501.   send *.txt thisnameonly
  6502.  
  6503.    Kermit complains and asks you to include replacement variables in the
  6504.    as-name. You should generally use \v(filename) or \v(filenumber) for
  6505.    this purpose, since other variables (with the possible exception of
  6506.    date/time related variables) do not change from one file to the next.
  6507.    But Kermit accepts any as-name at all that contains any kind of
  6508.    variables for file group, even if the variable will not change. So:
  6509.    
  6510.   send *.txt \%a
  6511.  
  6512.    is accepted, but all files are sent with the same name (the value of
  6513.    \%a, if it has one and it is constant). If the variable has no value
  6514.    at all, the files are sent under their own names.
  6515.    
  6516.    Of course, the value of \%a in the previous example need not be
  6517.    constant:
  6518.    
  6519.   define \%a FILE\flpad(\v(filenum),2,0)_at_\v(time)
  6520.   send *.txt \%a
  6521.  
  6522.    The RECEIVE command, when given without an as-name, behaves as always,
  6523.    storing all incoming files under the names they arrive with, subject
  6524.    to SET FILE NAME and SET RECEIVE PATHNAMES modifications ([435]Section
  6525.    4.10).
  6526.    
  6527.    However, when an as-name is given in the RECEIVE command, it is
  6528.    applied to all incoming files rather than to just the first. If it
  6529.    does not contain replacement variables, then the current FILE
  6530.    COLLISION setting governs the result. For example:
  6531.    
  6532.   receive foo
  6533.  
  6534.    will result in incoming files named foo, foo.~1~, foo.~2~, and so on,
  6535.    with the default FILE COLLISION setting of BACKUP. If it does contain
  6536.    replacement variables, of course they are used.
  6537.    
  6538.    When receiving files, the \v(filename) variable refers to the name
  6539.    that was received in the incoming file-header packet, BEFORE any
  6540.    processing by SET FILE NAMES or SET RECEIVE PATHNAMES. Since the
  6541.    filenames in file-header packets are usually in uppercase, you would
  6542.    need to convert them explicitly if you want them in lowercase, e.g.:
  6543.    
  6544.   receive \flower(\v(filename)).new
  6545.      _________________________________________________________________
  6546.    
  6547.     4.1.2. Templates on the Command Line
  6548.     
  6549.    On the command-line, use templates as shown above as the -a option
  6550.    argument, bearing in mind the propensity of UNIX and perhaps other
  6551.    shells to treat backslash as a shell escape character. So in UNIX (for
  6552.    example):
  6553.    
  6554.   kermit -s oofa.* -a x.\\v(filenum)
  6555.  
  6556.    By the way, this represents a change from 6.0 and earlier releases in
  6557.    which the as-name (-a argument or otherwise) was not evaluated by the
  6558.    command parser. Thus, for example, in VMS (where the shell does not
  6559.    care about backslashes), it was possible to:
  6560.    
  6561.   kermit -s oofa.txt -a c:\tmp\oofa.txt
  6562.  
  6563.    Now backslashes in the as-name must be quoted not only for the shell
  6564.    (if necessary) but also for Kermit itself:
  6565.    
  6566.   kermit -s oofa.txt -a c:\\tmp\\oofa.txt      ; Kermit only
  6567.   kermit -s oofa.txt -a c:\\\\tmp\\\\oofa.txt  ; Shell and Kermit
  6568.  
  6569.    You can also use the \fliteral() function for this:
  6570.    
  6571.   kermit -s oofa.txt -a \fliteral(c:\tmp\oofa.txt)      ; Kermit only
  6572.   kermit -s oofa.txt -a \\fliteral(c:\\tmp\\oofa.txt)   ; Shell and Kermit
  6573.      _________________________________________________________________
  6574.    
  6575.     4.1.3. Post-Transfer Renaming
  6576.     
  6577.    Filename templates are now also useful in SET { SEND, RECEIVE }
  6578.    RENAME-TO and in the /RENAME-TO: switch, that can be given to the
  6579.    SEND, GET, or RECEIVE commands; this is similar to an as-name, but is
  6580.    effective on a per-file basis if and only if the file was transferred
  6581.    successfully.
  6582.    
  6583.    MOVE-TO and RENAME-TO address a requirement commonly stated for
  6584.    transaction processing and similar systems. Suppose, for example, a
  6585.    central system "X" accepts connections from multiple clients
  6586.    simultaneously; a process on X waits for a file to appear and then
  6587.    processes the file. This process must have a way of knowing when the
  6588.    file has been completely and successfully transferred before it starts
  6589.    to process it. This can be accomplished easily using C-Kermit's SET {
  6590.    SEND, RECEIVE } { MOVE-TO, RENAME-TO } command or /MOVE-TO: or
  6591.    /RENAME-TO: switches, described in [436]Sections 4.7.1 through
  6592.    [437]4.7.3.
  6593.    
  6594.    Here's an example for the client side, in which files to be sent are
  6595.    placed in a certain directory (/usr/olga/tosend in this example) by
  6596.    another process when they are ready to go. This might be in a hospital
  6597.    or big doctor's office, where medical insurance claims are entered at
  6598.    a number of workstations, and then deposited in the "tosend"
  6599.    directory, from which they are sent to a claims clearinghouse. We
  6600.    assume the connection is already made and a Kermit server is on the
  6601.    other end.
  6602.    
  6603.   local srcdir findir              ; Declare local (automatic) variables
  6604.   assign srcdir /usr/olga/tosend   ; Local source directory (files to send)
  6605.   assign findir /usr/olga/sent     ; Where to move files after they are sent
  6606.   log transactions                 ; Keep a log of transfers
  6607.   cd \m(srcdir)                    ; Change to the source directory
  6608.   while true {                     ; Loop forever...
  6609.       send /move-to:\m(findir) *   ; Send all files
  6610.       sleep 60                     ; Sleep a minute
  6611.   }                                ; Go back and do it again
  6612.  
  6613.    Note how simple this is. Once each file is sent, it is moved so it
  6614.    won't be sent again (you could also use SEND /RENAME-TO: or even SEND
  6615.    /DELETE). If a transfer fails, the file is not moved and so we try
  6616.    again to send it next time around. If there are no files to send, the
  6617.    SEND command does nothing but a message is printed; you can avoid the
  6618.    message by checking first to see if any files are in the directory:
  6619.    
  6620.   while true {                     ; Loop forever...
  6621.       if > \ffiles(*) 0 -          ; If there are any files
  6622.         send /move-to:\m(findir) * ; send them.
  6623.       sleep 60                     ; Sleep a minute.
  6624.   }                                ; Go back and do it again.
  6625.  
  6626.    It's even simpler on the server side (here again we assume the
  6627.    connection is already in place):
  6628.    
  6629.   local rcvdir findir              ; Declare local (automatic) variables
  6630.   assign rcvdir /usr/ivan/tmp      ; Temporary receiving directory
  6631.   assign findir /usr/ivan/new      ; Where to move files after reception
  6632.   log transactions                 ; Keep a log of transfers
  6633.   cd \m(rcvdir)                    ; Change to the source directory
  6634.   set receive move-to \m(findir)   ; Declare move-to directory.
  6635.   server                           ; Enter server mode.
  6636.  
  6637.    A separate process (e.g. the medical claim-form decoder) can look for
  6638.    files appearing in the /usr/ivan/new directory and process them with
  6639.    every confidence that they have been completely received.
  6640.    
  6641.    Note that the use of MOVE-TO can result in moved files overwriting one
  6642.    another (the application would normally avoid this by assigning each
  6643.    transaction a unique, e.g. based on customer number and claim number).
  6644.    But if filename collisions are a possibility in your application,
  6645.    RENAME-TO might be a better choice; you can use any variables you like
  6646.    in the template to ensure uniqueness of the RENAME-TO filename; for
  6647.    example:
  6648.    
  6649.   SET RECEIVE RENAME-TO \v(filename)_\v(ndate)_\v(ntime)_\v(userid)_\v(pid)
  6650.      _________________________________________________________________
  6651.    
  6652.   4.2. FILE-TRANSFER PIPES AND FILTERS
  6653.   
  6654.     4.2.1. INTRODUCTION
  6655.     
  6656.    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to send
  6657.    from a command, or "pipe", as well as from a file, and to receive to a
  6658.    pipe or command. In a typical example, we might want to transfer an
  6659.    entire directory tree from one UNIX system to another (but without
  6660.    using the methods described in [438]Sections 4.3 , [439]4.10,
  6661.    [440]4.11, and [441]4.15). We could do this in multiple steps as
  6662.    follows:
  6663.    
  6664.   1. Create a tar archive of the desired directory tree
  6665.   2. Compress the tar archive
  6666.   3. Transfer it in binary mode to the other computer
  6667.   4. Decompress it
  6668.   5. Extract the directory tree from the tar archive
  6669.  
  6670.    But this is inconvenient and it requires a temporary file, which might
  6671.    be larger than we have room for.
  6672.    
  6673.    The new pipe-transfer feature lets you do such things in a single
  6674.    step, and without intermediate files.
  6675.    
  6676.    Additional new features, also discussed here, let you specify pre- and
  6677.    post- processing filters for outbound and incoming files, and give you
  6678.    a way to insert the output from shell or system commands into C-Kermit
  6679.    commands.
  6680.    
  6681.    The file-transfer related features are available only with Kermit
  6682.    protocol, not with any external protocols, nor with K95's built-in
  6683.    XYZMODEM protocols (because XYZMODEM recovers from transmission errors
  6684.    by rewinding the source file, and you can't rewind a pipe).
  6685.    
  6686.    This section begins by discussing the simple and straightforward use
  6687.    of these features in UNIX, in which pipes and input/output redirection
  6688.    are a fundamental component and therefore "just work", and then goes
  6689.    on to discuss their operation in Windows and OS/2, where matters are
  6690.    much more complicated.
  6691.      _________________________________________________________________
  6692.    
  6693.     4.2.1.1. TERMINOLOGY
  6694.     
  6695.    Standard Input
  6696.           This is a precise technical term denoting the normal source of
  6697.           input for a command or program, which is the keyboard of your
  6698.           terminal by default, but which can be redirected to a file or
  6699.           pipe.
  6700.           
  6701.    Stdin
  6702.           Abbreviation for Standard Input.
  6703.           
  6704.    Standard Output
  6705.           A precise technical term denoting the normal destination for
  6706.           output from a command or program, which is your terminal screen
  6707.           by default, but which can be redirected to a file.
  6708.           
  6709.    Stdout
  6710.           Abbreviation for Standard Output.
  6711.           
  6712.    Stdio
  6713.           Abbreviation for Standard Input / Standard Output.
  6714.           
  6715.    I/O
  6716.           Abbreviation for Input / Output.
  6717.           
  6718.    Shell
  6719.           Text-based system command processor, such as the UNIX shell,
  6720.           DOS COMMAND.COM, etc.
  6721.           
  6722.    Pipe
  6723.           A mechanism by which the standard output of one program is sent
  6724.           to the standard input of another.
  6725.           
  6726.    Pipeline
  6727.           A series of programs connected by pipes.
  6728.      _________________________________________________________________
  6729.    
  6730.     4.2.1.2. NOTATION
  6731.     
  6732.    In command descriptions, "command" is replaced by a shell or system
  6733.    command or pipeline. The command names specified in these commands are
  6734.    interpreted by your shell, just as if you were typing them at the
  6735.    shell prompt, and so if they are in your PATH, they will be found in
  6736.    the expected manner. Therefore you don't have to specify complete
  6737.    pathnames for commands that are programs (but it shouldn't hurt if you
  6738.    do).
  6739.    
  6740.    The normal notation for I/O redirection is as follows:
  6741.    
  6742.   <  Read Stdin from the given file.
  6743.   >  Send Stdout to the given file.
  6744.   |  Send Stdout from the command on the left to Stdin of the command on the ri
  6745. ght.
  6746.  
  6747.    Examples:
  6748.    
  6749.    sort < foo > bar
  6750.           Sorts the lines in file "foo" and writes the results to file
  6751.           "bar"
  6752.           
  6753.    grep -c "some text" *.txt | grep -v ":0" | sort | pr -3 | lpr
  6754.           This is a command pipeline composed of 5 commands:
  6755.           
  6756.    grep -c "some text" *.txt
  6757.           Looks in all files whose names end with ".txt" for the string
  6758.           "some text" and writes to Stdout the names of each file
  6759.           followed by a colon and the number of occurrences in each.
  6760.           
  6761.    grep -v ":0"
  6762.           Prints to Stdout the lines from Stdin that do NOT contain the
  6763.           string ":0". When combined with the previous example:
  6764.           
  6765.   grep -c "some text" *.txt | grep -v ":0"
  6766.  
  6767.           it removes the names of files that do not contain "some text".
  6768.           
  6769.    sort
  6770.           Sorts the lines from Stdin alphabetically to Stdout.
  6771.           
  6772.    pr -3
  6773.           Arranges the lines from Stdin in three columns.
  6774.           
  6775.    lpr
  6776.           Prints its Stdin on the default printer.
  6777.           
  6778.    Note that the Kermit features described here work only with commands
  6779.    that use Stdio. If you attempt to use them with commands whose input
  6780.    and output can not be redirected, Kermit will most likely get stuck.
  6781.    Kermit has no way of telling how an external command works, nor what
  6782.    the syntax of the shell is, so it's up to you to make sure you use
  6783.    these features only with redirectable commands.
  6784.    
  6785.    The quoting rules of your shell apply to the command. Thus in UNIX,
  6786.    where C-Kermit tries to use your preferred shell for running commands,
  6787.    shell "metacharacters" within commands must be escaped if they are to
  6788.    be taken literally, using the methods normal for your shell. For
  6789.    example, the UNIX tr (translate) command must have its arguments in
  6790.    quotes:
  6791.    
  6792.   tr "[a-z]" "[A-Z]"
  6793.  
  6794.    otherwise the shell is likely to replace them by all filenames that
  6795.    match, which is probably not what you want. This is also true when
  6796.    using your shell directly, and has nothing to do with Kermit.
  6797.      _________________________________________________________________
  6798.    
  6799.     4.2.1.3. SECURITY
  6800.     
  6801.    Some sites might not wish to allow access to system commands or
  6802.    external programs from within Kermit. Such access, including all the
  6803.    features described here, can be disabled in various ways:
  6804.    
  6805.     1. When building from source code, include -DNOPUSH among the CFLAGS.
  6806.     2. At runtime, give the NOPUSH command.
  6807.     3. For server mode, give the DISABLE HOST command.
  6808.     4. Implicit use of pipes can be disabled as described in [442]Section
  6809.        4.2.4.
  6810.        
  6811.    Note: 3 and 4 are not necessary if you have done 1 or 2.
  6812.      _________________________________________________________________
  6813.    
  6814.     4.2.2. Commands for Transferring from and to Pipes
  6815.     
  6816.    SEND /COMMAND sends data from a command or command pipeline, and
  6817.    RECEIVE /COMMAND writes data to a command or pipeline. The GET
  6818.    /COMMAND command asks a server to send material, and then writes the
  6819.    incoming material to a command or pipeline. These features, along with
  6820.    switches (like "/COMMAND", described in [443]Section 4.7) are new to
  6821.    C-Kermit 6.1. The following synonyms are also provided:
  6822.    
  6823.   CSEND    = SEND /COMMAND
  6824.   CRECEIVE = RECEIVE /COMMAND
  6825.   CGET     = GET /COMMAND
  6826.  
  6827.    None of these commands can be used if a SEND or RECEIVE FILTER
  6828.    (respectively, [444]Section 4.2.3) is in effect, or if a NOPUSH
  6829.    command ([445]Section 4.2.1.3) has been given, or if the current
  6830.    protocol is not Kermit.
  6831.      _________________________________________________________________
  6832.    
  6833.     4.2.2.1. Sending from a Command
  6834.     
  6835.    SEND /COMMAND command [ as-name ]
  6836.           
  6837.    SEND /AS-NAME:as-name /COMMAND command
  6838.           
  6839.    CSEND command [ as-name ]
  6840.           These three forms are the same. They work like the SEND
  6841.           command, but instead of sending a file, it sends the standard
  6842.           output of the given command, either under the command's own
  6843.           name, or else with the given as-name. If the command contains
  6844.           spaces, it must be enclosed in braces. Braces should also be
  6845.           used for the as-name if it contains spaces. If braces are
  6846.           included around either the command or the as-name, they are
  6847.           removed after parsing but before use. As with SEND, the
  6848.           transfer is in text or binary mode according the current FILE
  6849.           TYPE setting, unless you override the global transfer mode by
  6850.           including a /TEXT or /BINARY switch. The command must require
  6851.           no terminal input.
  6852.           
  6853.    When sending from a command or pipeline, C-Kermit has no way of
  6854.    knowing in advance how much data will be sent, so it can not send the
  6855.    size to the other Kermit in the Attribute packet, and so the receiving
  6856.    Kermit has no way of displaying "percent done" or a progress bar
  6857.    (thermometer).
  6858.    
  6859.    Examples that make sense in text mode (illustrated by common UNIX
  6860.    commands):
  6861.    
  6862.    SEND /COMMAND finger
  6863.           
  6864.    CSEND finger
  6865.           sends the current "finger" listing (who's logged in) under the
  6866.           name "finger".
  6867.           
  6868.    SEND /COMMAND:{finger}
  6869.           
  6870.    CSEND {finger}
  6871.           Same as previous example (braces are removed from "{finger}").
  6872.           
  6873.    SEND /COMMAND:{ finger }
  6874.           
  6875.    CSEND { finger }
  6876.           Same as previous example, but note that the spaces are kept.
  6877.           This does not prevent the shell from running the "finger"
  6878.           program, but its output is sent under the name " finger " (with
  6879.           a leading and trailing space).
  6880.           
  6881.    SEND /COMMAND:finger /AS-NAME:userlist
  6882.           
  6883.    CSEND finger userlist
  6884.           sends the current finger listing under the name "userlist".
  6885.           
  6886.    SEND /COMMAND:{finger | sort -r} /AS-NAME:userlist
  6887.           
  6888.    CSEND {finger | sort -r} userlist
  6889.           sends the current finger listing, sorted in reverse order,
  6890.           under the name "userlist". The braces are needed because the
  6891.           command contains spaces.
  6892.           
  6893.    SEND /COMMAND:{finger | sort -r} /AS-NAME:{userlist}
  6894.           
  6895.    CSEND {finger | sort -r} {userlist}
  6896.           Same as previous example (braces are removed from
  6897.           "{userlist}").
  6898.           
  6899.    SEND /COMMAND:{finger | sort -r}
  6900.           /AS-NAME:{\freplace(\v(filename),\32,_)}
  6901.           
  6902.    CSEND {finger | sort -r} {\freplace(\v(filename),\32,_)}
  6903.           Like the previous example, but sends the output of the command
  6904.           under the name of the command, but with all spaces (\32)
  6905.           replaced by underscores, so the as-name is "finger_|_sort_-r".
  6906.           
  6907.    Examples that make sense in binary mode (three equivalent forms are
  6908.    shown):
  6909.    
  6910.    SEND /COMMAND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
  6911.           
  6912.    SEND /COMMAND /BINARY /AS-NAME:mydir.tar.gz {tar cf - . | gzip -c}
  6913.           
  6914.    CSEND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
  6915.           Makes a tar archive of the current directory, compresses it
  6916.           with the GNU gzip program, and sends it as "mydir.tar.gz". The
  6917.           other Kermit can, of course, just store it as a file, or it can
  6918.           use CRECEIVE to uncompress and dearchive it as part of the
  6919.           transfer process.
  6920.           
  6921.    When using a "pipeline" of commands in the command field, obviously,
  6922.    the first command must not require any input (or, if it does, it must
  6923.    be redirected from a file), and the last command should produce some
  6924.    output, and all intermediate commands should get some input and
  6925.    produce some output.
  6926.      _________________________________________________________________
  6927.    
  6928.     4.2.2.2. Receiving to a Command
  6929.     
  6930.    RECEIVE /COMMAND command
  6931.           
  6932.    CRECEIVE command
  6933.           This is like RECEIVE, except incoming material is written to
  6934.           the standard input of the given command, in text or binary mode
  6935.           according to the normal rules for file reception. Be sure to
  6936.           include a redirector to a file (if the command normally writes
  6937.           to standard output), or the output of the command won't go
  6938.           anywhere. The command may contain spaces; braces are not
  6939.           needed, but they are removed if used.
  6940.           
  6941.    WARNING: C-Kermit has no way of knowing anything about the command, or
  6942.    even whether it is a command. Thus this command will always cause
  6943.    C-Kermit to enter protocol mode, as long as some text is specified in
  6944.    the command field. However, if the text does not correspond to a
  6945.    command, the transfer will eventually fail with a message such as
  6946.    "Error writing data" or "Failure to close file".
  6947.    
  6948.    Examples for text mode (in UNIX):
  6949.    
  6950.    RECEIVE /COMMAND sort -r > reverse.txt
  6951.           
  6952.    CRECEIVE sort -r > reverse.txt
  6953.           The text that is received is sorted in reverse order and stored
  6954.           in the file "reverse.txt". The two forms shown are equivalent.
  6955.           
  6956.    RECEIVE /COMMAND {sort -r > reverse.txt}
  6957.           
  6958.    CRECEIVE {sort -r > reverse.txt}
  6959.           The same as the previous example; if braces are included, they
  6960.           are simply removed.
  6961.           
  6962.    RECEIVE /COMMAND {sort -r > \flower(\v(filename)).reverse}
  6963.           
  6964.    CRECEIVE {sort -r > \flower(\v(filename)).reverse}
  6965.           Same but stores result under the incoming filename, lowercased,
  6966.           and with ".reverse" appended to it.
  6967.           
  6968.    RECEIVE /COMMAND sort
  6969.           
  6970.    CRECEIVE sort
  6971.           Does nothing useful, since the output of sort has nowhere to
  6972.           go.
  6973.           
  6974.    RECEIVE /COMMAND sort -r | pr -3 | lpr -Plaserjet
  6975.           
  6976.    CRECEIVE sort -r | pr -3 | lpr -Plaserjet
  6977.           The text that is received is sorted in reverse order, arranged
  6978.           into three columns, and sent to the "laserjet" printer.
  6979.           
  6980.    Examples for binary mode:
  6981.    
  6982.    RECEIVE /COMMAND:{gunzip -c | tar xf -}
  6983.           
  6984.    CRECEIVE {gunzip -c | tar xf -}
  6985.           Assuming the data that is received is a compressed tar archive,
  6986.           uncompresses the archive and passes it to tar for extraction.
  6987.           In this case the braces are needed because otherwise the final
  6988.           "-" would be taken as a command continuation character (see
  6989.           [446]Using C-Kermit, 2nd Edition, p.33).
  6990.           
  6991.    GET /COMMAND remote-file command
  6992.           
  6993.    GET /COMMAND /AS-NAME:command remote-file
  6994.           
  6995.    CGET remote-file command
  6996.           This command tells the Kermit client to send a GET request for
  6997.           the given remote file to a Kermit server. Unlike GET, however,
  6998.           the incoming material is written to a command, rather than to a
  6999.           file. If the remote-file or the command contain spaces, they
  7000.           must be enclosed in braces. The same cautions about the command
  7001.           apply as for CRECEIVE.
  7002.           
  7003.    Examples (for UNIX):
  7004.    
  7005.    GET /COMMAND oofa.txt sort -r > oofa.new
  7006.           
  7007.    GET /COMMAND {oofa.txt} {sort -r > oofa.new}
  7008.           
  7009.    CGET oofa.txt sort -r > oofa.new
  7010.           
  7011.    CGET {oofa.txt} {sort -r > oofa.new}
  7012.           These four are equivalent. Each of them requests the server to
  7013.           send its "oofa.txt" file, and as it arrives, it is sorted in
  7014.           reverse order and written to "oofa.new".
  7015.           
  7016.    GET /COMMAND {profile exec a} lpr
  7017.           
  7018.    GET /COMMAND {profile exec a} {lpr}
  7019.           
  7020.    GET /COMMAND /AS-NAME:lpr {profile exec a}
  7021.           
  7022.    GET /COMMAND /AS-NAME:{lpr} {profile exec a}
  7023.           
  7024.    GET /COMMAND /AS:lpr {profile exec a}
  7025.           
  7026.    CGET {profile exec a} lpr
  7027.           
  7028.    CGET {profile exec a} {lpr}
  7029.           Here the remote filename contains spaces so it MUST be enclosed
  7030.           in braces. As it arrives it is sent to the lpr program for
  7031.           printing. Braces are optional around "lpr" since it contains no
  7032.           spaces.
  7033.           
  7034.    GET /COMMAND *.txt {cat >> new.txt}
  7035.           
  7036.    GET /AS-NAME:{cat >> new.txt} /COMMAND *.txt
  7037.           
  7038.    CGET *.txt {cat >> new.txt}
  7039.           This gets all the ".txt" files from the server and concatenates
  7040.           them all into a single "new.txt" file on the client.
  7041.           
  7042.    GET /COMMAND *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
  7043.           
  7044.    CGET *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
  7045.           As above, but inserts each file's name before its contents.
  7046.      _________________________________________________________________
  7047.    
  7048.     4.2.3. Using File-Transfer Filters
  7049.     
  7050.    The commands described in [447]Section 4.2.2 let you send the output
  7051.    of a command, or receive data into a command. But what if you want to
  7052.    specify preprocessing for files that you send, or postprocessing of
  7053.    files that you receive, even when multiple files are involved? For
  7054.    this you need a way to specify send and receive filters. The commands
  7055.    are SET SEND FILTER and SET RECEIVE FILTER; SHOW PROTOCOL displays the
  7056.    current settings.
  7057.    
  7058.     4.2.3.1. The SEND Filter
  7059.     
  7060.    SET SEND FILTER [ command ]
  7061.           This command specifies a command to be run on any file that you
  7062.           SEND (or MOVE, MSEND, etc). It also applies to files sent when
  7063.           in server mode, in response to GET commands, but not to the
  7064.           results of REMOTE commands like REMOTE DIRECTORY, REMOTE TYPE,
  7065.           REMOTE HOST, etc. The command may be, but need not be, enclosed
  7066.           in braces; if it is, the braces are stripped before use. The
  7067.           output of this command is sent, rather than the file itself.
  7068.           The current FILE TYPE setting (TEXT or BINARY) applies to the
  7069.           output of the command. The command must contain at least one
  7070.           instance of \v(filename), for which the name of the actual file
  7071.           is substituted. If the command is omitted, the send filter is
  7072.           removed and files are sent in the normal manner.
  7073.           
  7074.    The SET SEND FILTER sets up a "global" filter -- that is, one that
  7075.    applies to all subsequent file-sending commands until you change or
  7076.    remove it. You can also specify a "local" filter to be used in a
  7077.    specific file-sending command by using the /FILTER switch (see
  7078.    [448]Section 1.5); for example:
  7079.    
  7080.   SEND /FILTER:command [ other-switches ] filename
  7081.  
  7082.    Besides \v(filename), you can include any other script programming
  7083.    notation in the send filter: variable names, array references, calls
  7084.    to built-in string or other functions, and so on. These are evaluated
  7085.    during file transfer, NOT during parsing, and they are evaluated
  7086.    separately for each file.
  7087.    
  7088.    When the SEND or MOVE (SEND /DELETE) command is used with a send
  7089.    filter, the output from the filter is sent under the file's original
  7090.    name unless you specify an "as-name" or template. The Attribute packet
  7091.    (if any) contains the original file's attributes (size, creation date,
  7092.    etc). So (for example) if the filter changes the file's size, the
  7093.    progress thermometer might be wrong. (We can't send the size of the
  7094.    output from the filter, because it is not known until the transfer is
  7095.    finished.) If you prefer that the size not be sent, use "set
  7096.    attributes size off".
  7097.    
  7098.    You can not use send filters with RESEND (SEND /RECOVER) or PSEND
  7099.    (SEND /START).
  7100.    
  7101.    Examples for text mode:
  7102.    
  7103.    SET SEND FILTER sort -r \v(filename) ; Braces may be omitted
  7104.           
  7105.    SET SEND FILTER {sort -r \v(filename)} ; Braces may be included
  7106.           
  7107.    SEND *.txt
  7108.           This sends every file in the current directory whose name ends
  7109.           with ".txt" under its own name, but with its lines sorted in
  7110.           reverse order.
  7111.           
  7112.    SEND /FILTER:{sort -r \v(filename)} *.txt
  7113.           Same as above, but the filter applies only to this SEND
  7114.           command. Braces are required in this case.
  7115.           
  7116.    SET SEND FILTER {sort -r \v(filename)}
  7117.           
  7118.    SEND oofa.txt reverse.txt
  7119.           Sends the oofa.txt file with its lines sorted in reverse order
  7120.           under the name "reverse.txt".
  7121.           
  7122.    SET SEND FILTER {sort -r \v(filename).reverse}
  7123.           
  7124.    SEND oofa.* \v(filename).reverse
  7125.           Sends all the oofa.* files with their lines sorted in reverse
  7126.           order; each file is sent under its own name but with ".reverse"
  7127.           appended to it.
  7128.           
  7129.    SET SEND FILTER {tr "[a-z]" "[A-Z]" < \v(filename)}
  7130.           
  7131.    SEND *.txt
  7132.           Sends all ".txt" files under their own names, but uppercasing
  7133.           their contents.
  7134.           
  7135.    Note that the SEND FILTER applies not only to files that are sent with
  7136.    SEND, MOVE, MSEND, etc, but also to files sent by the C-Kermit server
  7137.    in response to GET requests.
  7138.    
  7139.    Examples for binary mode:
  7140.    
  7141.    SET SEND FILTER {gzip -c \v(filename)}
  7142.           
  7143.    SEND /BINARY oofa.txt oofa.txt.gz
  7144.           Sends the oofa.txt file, compressed by gzip, as oofa.txt.gz.
  7145.           
  7146.    SEND /BINARY /FILTER:{gzip -c \v(filename)} oofa.txt oofa.txt.gz
  7147.           As above, but the filter applies only to this SEND command.
  7148.           
  7149.    SET SEND FILTER {gzip -c \v(filename)}
  7150.           
  7151.    SEND /BINARY oofa.* \fupper(\replace(\v(filename),.,_)).GZ
  7152.           Sends all the oofa.* files, compressed by gzip, each under its
  7153.           own name, but with the name uppercased, all periods within the
  7154.           name converted to underscores, and ".GZ" appended to it. So,
  7155.           for example, "oofa.txt" is sent as "OOFA_TXT.GZ".
  7156.           
  7157.    In the gzip examples, note that the amount of data that is sent is
  7158.    normally less than the original file size because gzip compresses the
  7159.    file. But Kermit sends the original file size ahead in the attribute
  7160.    packet anyway (unless you tell it not too). Thus the transfer will
  7161.    probably appear to terminate early, e.g. when the receiver's
  7162.    file-transfer display thermometer is only at 40%. If this annoys you,
  7163.    tell Kermit to "set attribute length off". On the other hand, you can
  7164.    use the final position of the thermometer as a measure of the
  7165.    effectiveness of compression.
  7166.      _________________________________________________________________
  7167.    
  7168.     4.2.3.2. The RECEIVE Filter
  7169.     
  7170.    SET RECEIVE FILTER [ command ]
  7171.           This command specifies that the given command will be run on
  7172.           any file that is received before it is written to disk. The
  7173.           command may be, but need not be, enclosed in braces; if it is
  7174.           the braces are stripped before use. The following two commands
  7175.           are equivalent:
  7176.           
  7177.   SET RECEIVE FILTER sort -r > \v(filename)
  7178.   SET RECEIVE FILTER {sort -r > \v(filename)}
  7179.  
  7180.    The RECEIVE filter command may contain a "\v(filename)" sequence to be
  7181.    replaced by the incoming filename from the file header packet, but it
  7182.    is not required. However you must use it whenever your filter would
  7183.    normally write to Stdout, otherwise its output will be lost.
  7184.    
  7185.    The RECEIVE filter command may contain one or more "\v(filename)"
  7186.    sequence to be replaced by the incoming filename from the file header
  7187.    packet, but it is not required. However you must use it whenever your
  7188.    filter would normally write to Stdout, otherwise its output will be
  7189.    lost.
  7190.    
  7191.    RECEIVE /FILTER:command and GET /FILTER:command can also be used to
  7192.    specify a filter to be used for only one file-transfer operation.
  7193.    
  7194.    UNIX examples for text mode:
  7195.    
  7196.    SET RECEIVE FILTER lpr
  7197.           
  7198.    RECEIVE
  7199.           All the files that are received are sent to the default UNIX
  7200.           print spooler.
  7201.           
  7202.    RECEIVE /FILTER:lpr
  7203.           Same as above, except the lpr filter is used only with this
  7204.           RECEIVE command.
  7205.           
  7206.    RECEIVE lpr
  7207.           This is probably not what you want; it creates a file called
  7208.           lpr.
  7209.           
  7210.    SET RECEIVE FILTER {sort -r > \v(filename)}
  7211.           
  7212.    RECEIVE
  7213.           Stores each incoming file with its lines sorted in reverse
  7214.           order, under its own name.
  7215.           
  7216.    RECEIVE /FILTER:{sort -r > \v(filename)}
  7217.           As above, but the filter is used only for this RECEIVE command.
  7218.           
  7219.    SET RECEIVE FILTER sort -r > \v(filename)
  7220.           
  7221.    RECEIVE reverse.txt
  7222.           Stores each incoming file with its lines sorted in reverse
  7223.           order, under the name "reverse.txt". The actual result depends
  7224.           on the FILE COLLISION setting. If it is OVERWRITE and multiple
  7225.           files arrive, then each incoming file destroys the previous
  7226.           one. If it is BACKUP (the default), filename conflicts are
  7227.           resolve by adding "version numbers" to the filenames:
  7228.           reverse.txt, reverse.txt.~1~, reverse.txt.~2~, etc.
  7229.           
  7230.    SET RECEIVE FILTER sort -r > \v(filename).reverse
  7231.           
  7232.    RECEIVE \v(filename).reverse
  7233.           Stores each incoming file with its lines sorted in reverse
  7234.           order, under the name it arrived with, but with ".reverse"
  7235.           appended to it.
  7236.           
  7237.    SET RECEIVE FILTER sort -r > \v(filename)
  7238.           
  7239.    RECEIVE \flower(\v(filename)).reverse
  7240.           Like the previous example, but ensures that the filename is
  7241.           lowercase.
  7242.           
  7243.           Examples for binary mode:
  7244.           
  7245.    SET RECEIVE FILTER gunzip -c > \v(filename)
  7246.           
  7247.    RECEIVE
  7248.           This receives one or more presumably compressed file and
  7249.           uncompresses each one into a file having the same name it was
  7250.           sent with. For example, if the file is sent with the name
  7251.           OOFA.TXT.GZ, it is stored with that name, even after
  7252.           decompression.
  7253.           
  7254.    SET RECEIVE FILTER gunzip -c > \v(filename)
  7255.           
  7256.    RECEIVE \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
  7257.           Like the previous example, but the resulting filename has its
  7258.           rightmost three characters removed from it and the remainder is
  7259.           lowercased. So if the incoming filename is OOFA.TXT.GZ, it is
  7260.           stored as oofa.txt after decompression.
  7261.           
  7262.    Of course you don't want to type such long hideous commands, so we
  7263.    have also introduced several new functions:
  7264.    
  7265.    \fstripx(string[,character])
  7266.           This function removes the rightmost segment of the string that
  7267.           starts with the given character. If no character is given,
  7268.           period (.) is used. Thus it is most conveniently used for
  7269.           stripping the extension from a filename (or the decimal portion
  7270.           from a floating-point number written in US/UK style). Examples:
  7271.           
  7272.    \fstripx(OOFA.TXT.GZ)             => OOFA.TXT
  7273.    \fstripx(OOFA.TXT.GZ,.)           => OOFA.TXT
  7274.    \fstripx(OOFA.TXT.GZ,X)           => OOFA.T
  7275.    \fstripx(\fstripx(OOFA.TXT.GZ))   => OOFA
  7276.    \fstripx($100.00)                 => $100
  7277.  
  7278.    \fstripn(string,number)
  7279.           Removes the rightmost number characters from the string.
  7280.           Examples:
  7281.           
  7282.    \fstripn(OOFA.TXT.GZ)             => OOFA.TXT.GZ
  7283.    \fstripn(OOFA.TXT.GZ,3)           => OOFA.TXT
  7284.    \fstripn(OOFA.TXT.GZ,7)           => OOFA
  7285.  
  7286.    \fstripb(string[,c1[,c2]])
  7287.           Strips enclosing matching braces, brackets, parentheses, or
  7288.           quotes from the string. The second argument, c1, specifies
  7289.           which kind of enclosure to look for; if not specified, any
  7290.           enclosing (), [], <>, {}, "", '', or `' are removed. If c1 is
  7291.           specified and c2 is not, then if c1 is an opening brace,
  7292.           bracket, or parenthesis, the matching closing one is supplied
  7293.           automatically as c2. If both c1 and c2 are specified, then to
  7294.           be stripped the string must begin with c1 and end with c2. If
  7295.           the string is not enclosed in the indicated manner, the result
  7296.           is the original string. Examples:
  7297.           
  7298.    \fstripb("abc")                   => abc
  7299.    \fstripb([abc])                   => abc
  7300.    \fstripb([abc)                    => [abc
  7301.    \fstripb(<abc>)                   => abc
  7302.    \fstripb(<abc>,[)                 => <abc>
  7303.    \fstripb((abc))                   => abc
  7304.    \fstripb((abc),[)                 => (abc)
  7305.    \fstripb((abc),{(})               => abc
  7306.    \fstripb(+abc+)                   => +abc+
  7307.    \fstripb(+abc+,+)                 => abc
  7308.    \fstripb(+abc+,+,^)               => +abc+
  7309.    \fstripb(+abc^,+,^)               => abc
  7310.    \fstripb('abc')                   => abc
  7311.    \fstripb(`abc')                   => abc
  7312.    \fstripb(``abc'')                 => `abc'
  7313.    \fstripb(\fstripb(``abc''))       => abc
  7314.  
  7315.           Notice the special syntax required for including a literal
  7316.           parenthesis in the argument list. As the last two examples
  7317.           illustrate, \fstripb() strips only one level at at a time;
  7318.           nesting can be used to strip a small fixed number of levels;
  7319.           loops can be used to strip larger or indeterminate numbers of
  7320.           levels.
  7321.           
  7322.    \flop(string[,char])
  7323.           Removes the leftmost segment of the string that ends with the
  7324.           given character. If no character is given, period (.) is used.
  7325.           Examples:
  7326.           
  7327.   \flop(OOFA.TXT.GZ)               => TXT.GZ
  7328.   \flop(OOFA.TXT.GZ,.)             => TXT.GZ
  7329.   \flop(OOFA.TXT.GZ,X)             => T.GZ
  7330.  
  7331.           To remove the leftmost number characters, just use
  7332.           \fsubstring(s,number+1). To return the rightmost number
  7333.           characters, use \fright(s,number).
  7334.           
  7335.    So the hideous example:
  7336.    
  7337.   receive \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
  7338.  
  7339.    can now be written as:
  7340.    
  7341.   receive \flower(\fstripx(\v(filename)))
  7342.  
  7343.    That is, the filename stripped of its extension and then lowercased.
  7344.    This is not only shorter and less hideous, but also does not depend on
  7345.    the length of the extension being 3.
  7346.    
  7347.    Note that when a receive filter is in effect, this overrides your FILE
  7348.    COLLISION setting, since Kermit has no way of knowing what the final
  7349.    destination filename will be (because it does not know, and can not be
  7350.    expected to know, the syntax of every version of every command shell
  7351.    on every platform on the planet).
  7352.      _________________________________________________________________
  7353.    
  7354.     4.2.4. Implicit Use of Pipes
  7355.     
  7356.    If you wish, C-Kermit can also examine incoming filenames to see if
  7357.    they start with "!", and if so, the subsequent text is treated as a
  7358.    command to read from or write to. For example, if a Kermit client is
  7359.    given the following command:
  7360.    
  7361.   get {!finger | sort}
  7362.  
  7363.    the server on the other end, if it supports this feature, will run the
  7364.    "finger" program, pipe its standard output to the "sort" program, and
  7365.    send sort's standard output back to you. Similarly, if you:
  7366.    
  7367.   send oofa.txt !sort -r > oofa.new
  7368.  
  7369.    or, equivalently:
  7370.    
  7371.   send oofa.txt {!sort -r > oofa.new}
  7372.  
  7373.    or:
  7374.    
  7375.   send /as-name:{!sort -r > oofa.new} oofa.txt
  7376.  
  7377.    this has the receiver send the contents of the incoming oofa.txt file
  7378.    to the sort program, which sorts the text in reverse order and stores
  7379.    the result in oofa.new.
  7380.    
  7381.    This use of the exclamation mark should be familiar to UNIX users as
  7382.    the "bang" feature that lets you run an external application or
  7383.    command from within another application.
  7384.    
  7385.    Kermit's "bang" feature is disabled by default, since it is not
  7386.    unheard for filenames to actually begin with "!". So if you want to
  7387.    use this feature, you must enable it with the following command:
  7388.    
  7389.    SET TRANSFER PIPES { ON, OFF }
  7390.           ON enables the recognition of "!" notation in incoming
  7391.           filenames during file transfer as an indicator that the
  7392.           remaining text is the name of a command. OFF, the default,
  7393.           disables this feature and uses the text as a filename in the
  7394.           normal fashion. This command does NOT affect SEND /COMMAND, GET
  7395.           /COMMAND, CSEND, etc.
  7396.           
  7397.    So using a combination of CSEND (SEND /COMMAND) and the "bang"
  7398.    feature, you can transfer a directory tree all in one command
  7399.    (assuming the remote Kermit supports pipe transfers and has them
  7400.    enabled):
  7401.    
  7402.   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
  7403.  
  7404.    or:
  7405.    
  7406.   SEND /COMMAND:{tar cf - . | gzip -c} /as:{!gunzip -c | tar xf -}
  7407.  
  7408.    Pay close attention to the syntax. Braces are needed around the
  7409.    command because it contains spaces; braces are needed around the
  7410.    as-name because it ends with "-". The as-name must begin with "!" or
  7411.    the receiving Kermit will not recognize it as a command. The CSEND
  7412.    command must NOT begin with "!" unless you are running a command whose
  7413.    name really does start that character.
  7414.    
  7415.    Similarly, you can have a Kermit server send a directory tree to be
  7416.    unpacked on the client end:
  7417.    
  7418.   CGET {!tar cf - . | gzip -c} {gunzip -c | tar xf -}
  7419.  
  7420.    or:
  7421.    
  7422.   GET /COMMAND {!tar cf - . | gzip -c} /as:{gunzip -c | tar xf -}
  7423.  
  7424.    Notice how, in this case, the bang is required in the remote command,
  7425.    to distinguish it from a filename, but not in the local command, since
  7426.    by definition of CGET (or GET /COMMAND), it is known to be a command.
  7427.    
  7428.    SEND and RECEIVE FILTERs supersede the bang feature. For example, if a
  7429.    file arrives under the name "!gunzip -c | tar xf -", but the receiving
  7430.    Kermit also has been given a command like:
  7431.    
  7432.   set receive filter sort -r > \v(filename)
  7433.  
  7434.    then the incoming data will be sorted rather than gunzipped.
  7435.    
  7436.    Finally, if SET TRANSFER PIPES is ON (and in this case, this must be
  7437.    done in your C-Kermit initialization file), you can send from a pipe
  7438.    on the C-Kermit command line:
  7439.    
  7440.   kermit -s "!finger | sort -r" -a userlist
  7441.  
  7442.    In this case the "filename" contains spaces and so must be quoted
  7443.    using your shell's quoting rules.
  7444.      _________________________________________________________________
  7445.    
  7446.     4.2.5. Success and Failure of Piped Commands
  7447.     
  7448.    Commands or programs started by Kermit as a result of CSEND or
  7449.    CRECEIVE commands, CGET, SEND /COMMAND, REDIRECT commands (see
  7450.    [449]Section 4.2.8.2), implicit use of pipes, RUN commands, and so
  7451.    forth, should return their exit status codes to the Kermit command
  7452.    that caused them to be run, and therefore IF SUCCESS and IF FAILURE
  7453.    tests after these commands should work as expected. For example:
  7454.    
  7455.   CSEND blah < filename
  7456.  
  7457.    should fail if there is no command called "blah" or if there is no
  7458.    file called "filename". However, this is not foolproof and sometimes
  7459.    C-Kermit might think a command succeeded when it failed, or vice
  7460.    versa. This is most likely to happen when the highly system-dependent
  7461.    methods that Kermit must use to determine a command's exit status code
  7462.    do not supply the right information.
  7463.    
  7464.    It can also happen because some commands might define success and
  7465.    failure differently from what you expect, or because you are using a
  7466.    pipeline composed of many commands, and one of them fails to pass
  7467.    failing exit status codes up the chain. The most likely culprit is the
  7468.    shell itself, which in most cases must be interposed between Kermit
  7469.    and any external program to be run.
  7470.    
  7471.    In any case, you can examine the following variable to find out the
  7472.    exit status code returned to Kermit by the process most recently run
  7473.    by any command that runs external commands or programs, including
  7474.    CSEND, CRECEIVE, REDIRECT, RUN, etc:
  7475.    
  7476.   \v(pexitstat)
  7477.  
  7478.    In UNIX, Windows and OS/2, the value should be -2 if no command has
  7479.    been run yet, 0 if the most recent command succeeded, -1, -3, or -4 if
  7480.    there was an internal error, and a positive number returned by the
  7481.    command itself if the command failed. If the number is in the range
  7482.    1-127, this is the program's exit status code. If it is 128 or
  7483.    greater, this is supposed to indicate that the command or program was
  7484.    interrupted or terminated from outside itself.
  7485.    
  7486.    In Windows 95 and 98, the return values of the default shell are
  7487.    unreliable; various third-party shells can be used to work around this
  7488.    deficiency.
  7489.    
  7490.    In VMS, it is the actual exit status code of the command that was run.
  7491.    This is an odd number if the command succeeded, and an even number if
  7492.    it failed. You can see the associated message as follows:
  7493.    
  7494.   run write sys$output f$message(\v(pexitstat))
  7495.  
  7496.    Or, more conveniently, use the new Kermit function:
  7497.    
  7498.   echo \ferrstring(\v(pexitstat))
  7499.  
  7500.    which converts a system error code (number) to the corresponding
  7501.    message.
  7502.      _________________________________________________________________
  7503.    
  7504.     4.2.6. Cautions about Using Pipes to Transfer Directory Trees
  7505.     
  7506.    Although utilities such as tar and zip/unzip might be available on
  7507.    different platforms (such as UNIX and Windows), this does not
  7508.    necessarily mean you can use them successfully to transfer directory
  7509.    trees between unlike platforms. For example:
  7510.    
  7511.   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
  7512.  
  7513.    when used from UNIX to Windows will have satisfactory results for
  7514.    binary files, but not for text files. UNIX text files have lines
  7515.    ending with Linefeed (LF) only, whereas Windows text files have lines
  7516.    ending in Carriage Return and Linefeed (CRLF). Thus any text files
  7517.    that were in the archive formed by the first tar command will be
  7518.    unpacked by the second tar command in their original form, and will
  7519.    display and print incorrectly in Windows (except in applications that
  7520.    have been explicitly coded to handle UNIX-format text files). On the
  7521.    other hand if you told gzip to use "text mode" to do record format
  7522.    conversion (assuming there was a way to tell it, as there is with most
  7523.    "zip" programs), this would destroy any binary files in the archive.
  7524.    
  7525.    Furthermore, if the archive contains text files that are written in
  7526.    languages other than English, the "special" (accented and/or
  7527.    non-Roman) characters are NOT translated, and are therefore likely
  7528.    show up as gibberish on the target system. For example, West European
  7529.    languages are usually encoded in ISO Latin Alphabet 1 in UNIX, but in
  7530.    PC code page 850 on the PC. Capital A with acute accent is code point
  7531.    193 (decimal) Latin-1, but 181 in CP850. So A-acute in the UNIX file
  7532.    becomes Middle Box Bottom on the PC, and similarly for all the other
  7533.    special characters, and for all other languages -- Greek, Russian,
  7534.    Hebrew, Japanese, etc.
  7535.    
  7536.    So when transferring text files between unlike platforms, you should
  7537.    use direct Kermit file transfers so Kermit can apply the needed
  7538.    record-format and character-set transformations. Use pipelines
  7539.    containing archivers like tar or zip only if all the files are binary
  7540.    or the two systems use the same record format and character set for
  7541.    text files.
  7542.    
  7543.    Also see [450]Sections 4.3, [451]4.10, [452]4.11, and [453]4.15 for
  7544.    how to transfer directory trees between both like and unlike systems
  7545.    directly with Kermit.
  7546.      _________________________________________________________________
  7547.    
  7548.     4.2.7. Pipes and Encryption
  7549.     
  7550.    Of course pipelines could be used for encrypted file transfers,
  7551.    assuming proper precautions could be taken concerning the transmission
  7552.    of the key. But there is rarely a good way to do this. To illustrate
  7553.    using UNIX crypt:
  7554.    
  7555.   csend {crypt key < filename} {!crypt key > filename}
  7556.  
  7557.    Or, more ambitiously:
  7558.    
  7559.   csend {tar cf - . | gzip -c | crypt key} {!crypt key | gunzip -c | tar xf -}
  7560.  
  7561.    transmits the key in the file header packet as part of the
  7562.    (clear-text) remote command, defeating the entire purpose of
  7563.    encrypting the file data.
  7564.    
  7565.    But if you are connected in terminal mode to the remote computer and
  7566.    type:
  7567.    
  7568.   creceive {crypt key > filename}
  7569.  
  7570.    at the remote Kermit prompt, you have also transmitted the key in
  7571.    clear text over the communications link.
  7572.    
  7573.    At present, the only secure way to use CSEND and CRECEIVE with an
  7574.    encryption filter is to have a human operator at both ends, so the key
  7575.    does not have to be transmitted (or to perform the transfer over a
  7576.    connection that is, itself, encrypted or otherwise secured).
  7577.    
  7578.    Theoretically it would be possible to use PGP software (Pretty Good
  7579.    Privacy, by Phil Zimmerman, Phil's Pretty Good Software) to avoid key
  7580.    transmission (since PGP uses separate public and private key and "lets
  7581.    you communicate securely with people you've never met, with no secure
  7582.    channels needed for prior exchange of keys"), but the specific method
  7583.    has yet to be worked out.
  7584.    
  7585.      HINT: See the PGP User's Guide, e.g. at:
  7586.      [454]http://www.telstra.com.au/docs/PGP/
  7587.      Especially the topic "Using PGP as a UNIX-Style Filter":
  7588.      [455]http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
  7589.      
  7590.    In any case, better and more convenient security options are now
  7591.    available: Kerberos authentication and encryption ([456]CLICK HERE for
  7592.    details) and the new ability to run C-Kermit "though" other
  7593.    communication programs, described in [457]Section 2.7.
  7594.      _________________________________________________________________
  7595.    
  7596.     4.2.8. Commands and Functions Related to Pipes
  7597.     
  7598.     4.2.8.1. The OPEN !READ and OPEN !WRITE Commands
  7599.     
  7600.    These are described in [458]Using C-Kermit, and are generally useful
  7601.    with reading output from commands that produce more than one line on
  7602.    their standard output, or writing multiple lines into commands that
  7603.    accept them on their standard input.
  7604.    
  7605.    In C-Kermit 7.0 CLOSE !READ is accepted as a synonym for CLOSE READ,
  7606.    and CLOSE !WRITE for CLOSE WRITE.
  7607.    
  7608.    Testing the success and failure of these commands, however, can be a
  7609.    bit tricky. Consider:
  7610.    
  7611.   open !read lalaskjfsldkfjsldkfj
  7612.  
  7613.    (where "lalaskjfsldkfjsldkfj" is neither a valid command nor the name
  7614.    of a program or script that can be run). OPEN !READ, in UNIX at least,
  7615.    translates this into execl(shellpath,shellname,"-c",command). This
  7616.    means it starts your preferred shell (e.g. from the SHELL environment
  7617.    variable) and asks it to execute the given command. It must be this
  7618.    way, because your command can be a either an internal shell command
  7619.    (which only your shell can execute) or an external command, which only
  7620.    your shell knows how to find (it knows your PATH and interprets, etc).
  7621.    Therefore unless OPEN !READ can't start your shell, it always
  7622.    succeeds.
  7623.    
  7624.    Continuing with the nonexistent-command example:
  7625.    
  7626.   C-Kermit> open !read lalaskjfsldkfjsldkfj
  7627.   C-Kermit> status
  7628.    SUCCESS
  7629.   C-Kermit> read line
  7630.   C-Kermit> status
  7631.    SUCCESS
  7632.   C-Kermit> echo "\m(line)"
  7633.   "bash: lalaskjfsldkfjsldkfj: command not found"
  7634.   C-Kermit> close read
  7635.   C-Kermit> status
  7636.    FAILURE
  7637.   C-Kermit>
  7638.  
  7639.    In other words, the failure can not be detected on OPEN, since the
  7640.    OPEN command succeeds if it can start your shell. It can't be detected
  7641.    on READ, since all this does is read output from the shell, which in
  7642.    this case happens to be an error message. However, failure IS detected
  7643.    upon close, since this is the occasion upon which the shell gives
  7644.    Kermit its exit status code.
  7645.    
  7646.    For an illustration of this situation, see [459]Section 2.14.
  7647.      _________________________________________________________________
  7648.    
  7649.     4.2.8.2. The REDIRECT Command
  7650.     
  7651.    A second method of I/O redirection is offered by the REDIRECT command.
  7652.    This is a rather advanced and tricky feature that is presently
  7653.    supported only in UNIX C-Kermit, in OS-9 C-Kermit, and in Kermit 95.
  7654.    Syntax:
  7655.    
  7656.    REDIRECT command
  7657.           Runs the given command, sending its standard output to the
  7658.           current communications channel (SET LINE, SET PORT, or SET HOST
  7659.           connection), and reading its standard input from the same
  7660.           connection. Works only in local mode -- i.e. a connection is
  7661.           required -- and then only if the given command uses Standard
  7662.           I/O.
  7663.           
  7664.    Example:
  7665.    
  7666.   redirect finger
  7667.  
  7668.    runs the local "finger" command and sends its output over the
  7669.    connection as plain text, where presumably there is a process set up
  7670.    to read it. Another example:
  7671.    
  7672.   redirect finger | sort -r
  7673.  
  7674.    shows the use of a pipeline.
  7675.    
  7676.    Note: REDIRECT differs from CSEND/CRECEIVE in two important ways: (1)
  7677.    it does not use the Kermit protocol, and (2) it uses a bidirectional
  7678.    pipe rather than a one-way pipe.
  7679.    
  7680.    The primary use of the REDIRECT command is to run external protocols,
  7681.    such as sz/rz in UNIX for ZMODEM, when they work over Standard I/O(*).
  7682.    Example:
  7683.    
  7684.   set host xyzcorp.com
  7685.   (login, etc)
  7686.   redirect sz oofa.zip
  7687.  
  7688.    lets you make a Telnet connection with C-Kermit and then do a ZMODEM
  7689.    transfer over it. ZMODEM protocol messages go both ways over the same
  7690.    connection simultaneously.
  7691.    
  7692.    It is possible to use C-Kermit on UNIX as your PPP dialer and then to
  7693.    REDIRECT the connection to the PPP software, but C-Kermit 7.0 offers a
  7694.    better approach to PPP dialing in its new EXEC command ([460]Section
  7695.    1.23).
  7696.    
  7697.    In theory, you can also redirect an interactive process. For example,
  7698.    suppose you tell Kermit 95 to wait for an incoming TCP/IP connection:
  7699.    
  7700.   set host * 3000
  7701.  
  7702.    and then tell C-Kermit on UNIX to:
  7703.    
  7704.   set host kermit95hostname 3000
  7705.   redirect ksh
  7706.  
  7707.    and then tell Kermit 95 to CONNECT: now you are talking to the UNIX
  7708.    K-shell; you can give commands (pwd, ls, etc) and see the results. In
  7709.    practice, the K-shell's terminal modes are messed up because (a) it is
  7710.    not going through the Unix terminal driver, and (b) it is "smart" and
  7711.    knows it is being redirected, and so acts in a decidedly inhospitable
  7712.    manner (other applications like EMACS, vi, etc, simply refuse to run
  7713.    if their standard i/o has been redirected).
  7714.    
  7715.      (*) The publicly-distributed sz/rz programs do not work as clients.
  7716.      However, Omen Technology does offer an up-to-date redirectable
  7717.      client XYZMODEM program called crzsz.
  7718.      _________________________________________________________________
  7719.    
  7720.     4.2.8.3. Receiving Mail and Print Jobs
  7721.     
  7722.    As of 7.0, and in UNIX only, files that are sent to C-Kermit as mail
  7723.    (when the other Kermit uses a MAIL or SEND /MAIL command) or to be
  7724.    printed (via REMOTE PRINT or SEND /PRINT) are now piped directly to
  7725.    the mail or print program, rather than written to temporary files and
  7726.    then mailed or printed and then deleted. This has the advantages of
  7727.    (a) not requiring a temporary file, and (b) allowing mail to have a
  7728.    proper subject in place of the filename. Temporary files were bad not
  7729.    only because they required (a) space, and (b) writeability of the
  7730.    current directory, but also because using them could result in wiping
  7731.    out an existing file. See [461]Section 4.7 for more about SEND /MAIL
  7732.    and SEND /PRINT.
  7733.      _________________________________________________________________
  7734.    
  7735.     4.2.8.4. Pipe-Related Functions
  7736.     
  7737.    The \fcommand(command) function runs the given shell or system command
  7738.    and returns the command's standard output as its value (with any
  7739.    newline characters stripped from the end), unless the result is too
  7740.    long, in which case it returns the empty string. The maximum length
  7741.    for the result is at least 1022 bytes, and it might be longer on some
  7742.    platforms. Examples (UNIX):
  7743.    
  7744.   C-Kermit> echo "\fcommand(date)"
  7745.   "Fri Apr 18 13:31:42 1997"
  7746.   C-Kermit> echo "\fcommand(finger | wc -l)" ; how many users logged in?
  7747.   "      83"
  7748.   C-Kermit> evaluate \fcommand(finger | wc -l) * 2
  7749.   166
  7750.   C-Kermit> echo Welcome to \fcommand(tty) on \fcommand(date)
  7751.   Welcome to /dev/ttyre on Fri Apr 18 13:31:42 1997
  7752.   C-Kermit> echo "\fcommand(ls oofa.*)"
  7753.   "oofa.c
  7754.   oofa.h
  7755.   oofa.o"
  7756.   C-Kermit> cd /directory-with-thousands-of-files
  7757.   C-Kermit> echo "\fcommand(ls -l)" ; This would be too long
  7758.   ""
  7759.   C-Kermit>
  7760.  
  7761.    If a command's output would be too long, you can use the other, more
  7762.    laborious method of reading from a command: OPEN !READ command, READ
  7763.    each line, CLOSE !READ.
  7764.    
  7765.    The \frawcommand(command) function is identical to \fcommand(command),
  7766.    except it does not remove trailing newline characters:
  7767.    
  7768.   C-Kermit> echo "\frawcommand(date)"
  7769.   "Fri Apr 18 13:31:42 1997
  7770.   "
  7771.   C-Kermit> echo "\frawcommand(ls oofa.*)"
  7772.   "oofa.c
  7773.   oofa.h
  7774.   oofa.o
  7775.   "
  7776.   C-Kermit>
  7777.  
  7778.    Use \frawcommand() if you want to retain the final line terminators,
  7779.    or if the command's output is "binary". But remember that if the
  7780.    result of this (or any other) function contains any NUL (ASCII code 0)
  7781.    characters, the first NUL will terminate the result string because
  7782.    this is how C strings work (it's "C-Kermit", remember?).
  7783.    
  7784.    These functions are useful not only locally, but also in the
  7785.    client/server arena. If you need to get the results from a system
  7786.    command on the server end into a variable on the client end, just do:
  7787.    
  7788.   [ remote ] query kermit command(date)
  7789.  
  7790.    The result is in the local \v(query) variable; see [462]Using
  7791.    C-Kermit, 2nd Ed., pp.359-360 for details.
  7792.      _________________________________________________________________
  7793.    
  7794.   4.3. Automatic Per-File Text/Binary Mode Switching
  7795.   
  7796.    When transferring files between like systems (e.g. UNIX-to-UNIX),
  7797.    binary mode can be used for all files unless character-set translation
  7798.    is needed, and in fact Kermit programs of recent vintage recognize
  7799.    each others' platforms and switch to binary mode automatically when it
  7800.    is appropriate (e.g. DOS to OS/2, or UNIX to UNIX). (Exception:
  7801.    LABELED mode is chosen for VMS-to-VMS and OS/2-to-OS/2 transfers so
  7802.    complex file formats can be preserved.)
  7803.    
  7804.    On a client/server connection between like systems, the transfer mode
  7805.    is currently determined by the file sender, rather than always by the
  7806.    client. If the client is sending, it controls the transfer mode. If a
  7807.    GET command is sent to the server, the server sends all files in
  7808.    binary mode if its TRANSFER CHARACTER-SET is TRANSPARENT; otherwise it
  7809.    uses text mode for text files (according to its text-pattern list) and
  7810.    binary mode for binary files. Of course, the client can control the
  7811.    server's transfer character-set with the REMOTE SET TRANSFER
  7812.    CHARACTER-SET command.
  7813.    
  7814.    When transferring files between unlike systems, however, (e.g.
  7815.    UNIX-to-DOS), some files (such as executable program images) must be
  7816.    transferred in binary mode but others (such as plain-text files) must
  7817.    be transferred in text mode so their record format and character sets
  7818.    can be appropriately converted. If a binary file is transferred in
  7819.    text mode, it is ruined. If a text file is transferred in binary mode,
  7820.    then at the very least, its format can be incorrect; at worst it is
  7821.    also corrupted because its character set was not converted (in extreme
  7822.    cases the corruption is total, e.g. because one system is ASCII-based
  7823.    and the other EBCDIC).
  7824.      _________________________________________________________________
  7825.    
  7826.     4.3.1. Exceptions
  7827.     
  7828.    VMS C-Kermit, when sending files to a non-VMS system, switches to text
  7829.    or binary mode automatically for each file, based on the record format
  7830.    in the file's directory entry; thus the mechanisms described in this
  7831.    section do not apply to VMS C-Kermit, yet the effect is the same:
  7832.    automatic text/binary mode switching when VMS C-Kermit is sending
  7833.    files. See the VMS Appendix of [463]Using C-Kermit for details.
  7834.    
  7835.    Kermit versions that support LABELED or IMAGE transfer mode are
  7836.    likewise not affected by this feature when one of those modes is
  7837.    selected (normally used only when transferring between like systems).
  7838.    
  7839.    Kermit versions that support file-transfer pipes and filters are not
  7840.    affected by this feature when pipes or filters are used, since the
  7841.    output of a pipe or filter (such as gzip) is likely to require
  7842.    transfer in a different mode than the original file.
  7843.    
  7844.    Finally, SEND /TEXT or SEND /BINARY will force files to be sent in the
  7845.    indicated mode, overriding all automatic transfer-mode-choosing
  7846.    mechanisms.
  7847.      _________________________________________________________________
  7848.    
  7849.     4.3.2. Overview
  7850.     
  7851.    Suppose you give C-Kermit a command like:
  7852.    
  7853.   SEND *.*
  7854.  
  7855.    And suppose the pattern *.* matches a mixture of text files (such as
  7856.    program source code) and binary files (such os object modules or
  7857.    executable programs).
  7858.    
  7859.    C-Kermit 6.0 and earlier (except on VMS) send all files in the same
  7860.    mode: whatever you said in your most recent SET FILE TYPE command, or
  7861.    else whatever mode was chosen automatically according to the rules on
  7862.    page 236 of Using C-Kermit, 2nd Ed.
  7863.    
  7864.    But when text and binary files are mixed in the same group, and the
  7865.    files are being transferred to an unlike system (e.g. UNIX to IBM
  7866.    Mainframe), this results in corruption of either all the text files or
  7867.    all the binary files.
  7868.    
  7869.    Stream-oriented file systems such as in UNIX and DOS do not record any
  7870.    information about the file to tell us whether the file should be
  7871.    transferred in binary or text mode, making it impossible to select the
  7872.    transfer mode for each file in a group automatically with any
  7873.    certainty.
  7874.    
  7875.    However, we can use some fairly-well established file naming
  7876.    conventions for this purpose. C-Kermit 7.0 lets you provide lists of
  7877.    filename patterns that are used to separately determine the file type
  7878.    for each individual file being transfered. A pattern is a string,
  7879.    possibly containing the special characters "*" (asterisk, which
  7880.    matches any string of zero of more characters) and/or "?" (question
  7881.    mark, which matches any single character). For example "a*b" matches
  7882.    all files whose names start with "a" and end with "b", such as "ab",
  7883.    "arb", "ababababab", etc, but not "abba". And "a?b" matches any file
  7884.    whose name starts with "a", ends with "b", and is exactly 3 characters
  7885.    long.
  7886.    
  7887.      NOTE: When typing commands at the C-Kermit prompt, you must prefix
  7888.      "?" with \ to override its normal function of giving help.
  7889.      
  7890.    (Also see [464]Section 4.9 for additional pattern-matching notations
  7891.    that might be available in your version of C-Kermit.)
  7892.    
  7893.    When you have specified filename recognition patterns, C-Kermit can
  7894.    transfer the ones whose names match any of the binary-mode patterns in
  7895.    binary mode, and those with names that match any of the text-mode
  7896.    patterns in text mode, and those whose names match neither in the
  7897.    prevailing mode you have chosen, or that was chosen automatically via
  7898.    peer recognition.
  7899.      _________________________________________________________________
  7900.    
  7901.     4.3.3. Commands
  7902.     
  7903.    SET FILE PATTERNS { ON, OFF, AUTO }
  7904.           This tells Kermit whether to do per-file filename
  7905.           pattern-matching to determine text or binary mode. The normal
  7906.           and default setting is AUTO, which means to use pattern lists
  7907.           to switch transfer mode only when it is certain that the other
  7908.           Kermit program supports automatic notification of transfer mode
  7909.           (via Attribute packets) on a per-file basis (this information
  7910.           is obtained automatically during protocol startup negotiation).
  7911.           ON means to always determine the transfer mode from the
  7912.           filename and pattern list when sending files. Use OFF to
  7913.           disable this feature (without resetting your pattern lists).
  7914.           Also note that if you have selected LABELED file transfer (SET
  7915.           FILE TYPE LABELED), this takes precedence over
  7916.           filename-matching patterns and all files are sent in labeled
  7917.           mode.
  7918.           
  7919.    SET TRANSFER MODE MANUAL
  7920.           Disables the use of filename patterns, no matter what the FILE
  7921.           PATTERNS setting.
  7922.           
  7923.    REMOTE SET TRANSFER MODE MANUAL
  7924.           Client command to disable automatic transfer mode, and
  7925.           therefore also filename patterns, in the server. Synonym:
  7926.           REMOTE SET XFER MODE MANUAL.
  7927.           
  7928.    { GET, SEND, etc } { /BINARY, /TEXT }
  7929.           Including a /BINARY or /TEXT (or, where supported, /IMAGE or
  7930.           /LABELED) switch with a file-transfer command changes the
  7931.           transfer mode to manual for that command only, and therefore
  7932.           disables patterns that that command.
  7933.           
  7934.    SET FILE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7935.           A list of zero or more patterns, separated by spaces (not
  7936.           commas). Letters in a pattern are case-sensitive if the
  7937.           underlying filenames are case sensitive (as in UNIX), and
  7938.           case-insensitive otherwise (as in Windows). If a file's name is
  7939.           matched by any pattern in the list and SET FILE PATTERNS is ON,
  7940.           the file is sent in binary mode. Examples:
  7941.           
  7942.   SET FILE BINARY-PATTERNS *.gz *.Z *.tar *.zip *.o *.so *.a *.out ; UNIX
  7943.   SET FILE BINARY-PATTERNS *.EXE *.ZIP *.OBJ *.COM ; DOS or OS/2 or Windows
  7944.  
  7945.           If a pattern contains spaces, enclose it in braces.
  7946.           
  7947.    SET FILE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7948.           Like SET FILE BINARY-PATTERNS, but the patterns choose text
  7949.           files rather than binary ones. Examples:
  7950.           
  7951.   SET FILE TEXT-PATTERNS *.TXT *.KSC *.HTM* *.BAT ; DOS, Windows, OS/2
  7952.  
  7953.    ADD BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7954.           Adds one or more patterns to the BINARY-PATTERN list.
  7955.           
  7956.    ADD TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7957.           Adds one or more patterns to the TEXT-PATTERN list.
  7958.           
  7959.    REMOVE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7960.           Removes one or more patterns from the BINARY-PATTERN list. The
  7961.           given patterns are matched with the ones in the BINARY-PATTERNS
  7962.           list with case sensitivity if the underlying file system has
  7963.           case-sensitive names (as do UNIX and OS-9), otherwise with case
  7964.           independence.
  7965.           
  7966.    REMOVE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7967.           Removes one or more patterns from the TEXT-PATTERN list.
  7968.           
  7969.    SHOW PATTERNS
  7970.           Displays the current pattern selections.
  7971.           
  7972.    Whenever you give a SET FILE BINARY-PATTERNS or SET FILE TEXT-PATTERNS
  7973.    command, the previous list is replaced. If you give one of these
  7974.    commands without a pattern list, the previous list is removed.
  7975.    
  7976.    When patterns are active and files are being sent, text patterns (if
  7977.    any) are applied first (but only if not RESENDing and not sending in
  7978.    LABELED mode), then binary patterns, so if the same pattern appears in
  7979.    both lists, binary mode is chosen.
  7980.      _________________________________________________________________
  7981.    
  7982.     4.3.4. Examples
  7983.     
  7984.    Here's an example that might be used when sending files from UNIX:
  7985.    
  7986.   set file type binary
  7987.   set file text-patterns *.c *.h *.w *.txt makefile
  7988.   set file binary-patterns *.o
  7989.   msend makefile wermit wart ck*.[cwho] ck*.txt
  7990.  
  7991.    Note that "wermit" and "wart" do not match any patterns so they are
  7992.    sent in the prevailing mode, which is binary. Also note the use of
  7993.    "makefile" as a pattern that does not contain any wildcard characters
  7994.    (there is no other convention to distinguish among "wermit" and
  7995.    "wart", which are binary executables, and "makefile", which is a text
  7996.    file, purely by their names).
  7997.    
  7998.    Most C-Kermit implementations have a default pattern list built in,
  7999.    which includes patterns that are almost certain to succeed in picking
  8000.    the right transfer mode. Others are omitted due to ambiguity. For
  8001.    example ".hlp", and ".ini" are generally binary types in Windows but
  8002.    text types everywhere else.
  8003.    
  8004.      NOTE: ".doc", used for decades to denote plain-text documentation
  8005.      files, now more often than not denotes a Microsoft Word Document,
  8006.      so ".doc" is now considered a binary type since it does less harm
  8007.      to transfer a plain-text document in binary mode than it does to
  8008.      transfer an MS Word file in text mode (except when IBM mainframes
  8009.      are involved!)
  8010.      
  8011.      ANOTHER NOTE: ".com" files are binary in DOS-like operating
  8012.      systems, but they are text (DCL command procedures) in VMS. VMS
  8013.      C-Kermit sends .COM files in text mode; K95 sends them in binary
  8014.      mode. If you download a .COM file from VMS to DOS or Windows, and
  8015.      then upload it to another VMS system, be sure to use SEND /TEXT to
  8016.      preserve its textness.
  8017.      
  8018.    You can see the default pattern list by starting C-Kermit without its
  8019.    initialization file (e.g. "kermit -Y") and using the SHOW PATTERNS
  8020.    command. If you will be depending on this feature, be sure to examine
  8021.    the list carefully in conjunction with the applications that you use.
  8022.    
  8023.    The default pattern list does not take "backup files" into account
  8024.    because (a) people usually don't want to transfer them; and (b) it
  8025.    would make the pattern lists more than twice as long. For example, we
  8026.    would need to include both *.txt and *.txt.~[0-9]*~ for ".txt" files,
  8027.    and similarly for all the others. Instead, you can use SEND /NOBACKUP
  8028.    (or SET SEND BACKUP OFF) to skip over all backup files.
  8029.    
  8030.    Put your most commonly-used safe pattern declarations in your C-Kermit
  8031.    customization file (ckermod.ini, .mykermrc, k95custom.ini, etc).
  8032.    
  8033.    As noted, SET FILE PATTERNS is ON by default. Sometimes, however, it
  8034.    is desirable, or necessary, to force files to be sent in a particular
  8035.    mode, and often this must be done from the command line (e.g. when
  8036.    using Kermit as a download helper in a Web browser like Lynx). The -V
  8037.    command-line options is equivalent to SET FILE PATTERNS OFF and SET
  8038.    TRANSFER MODE MANUAL. Example:
  8039.    
  8040.   kermit -Vis oofa.txt
  8041.  
  8042.    forces oofa.txt to be sent in binary mode, even though ".txt" might
  8043.    match a text pattern.
  8044.      _________________________________________________________________
  8045.    
  8046.   4.4. File Permissions
  8047.   
  8048.    "Permissions" refers to a code associated with a file that specifies
  8049.    who is allowed to access it, and in what manner. For example, the
  8050.    owner, the members of one or more groups, the system administrator,
  8051.    and everybody else, might be allowed various combinations of Read,
  8052.    Write, Append, Execute, or Listing access.
  8053.    
  8054.    The permission code goes by different names on different platforms. In
  8055.    UNIX, it might be called the filemode. In VMS, it is called the file
  8056.    protection (or protection mask).
  8057.    
  8058.    The comments in this section presently apply only to the UNIX and VMS
  8059.    versions of C-Kermit, to which these features were added in version
  8060.    7.0; the DOS, Windows, and OS/2 file systems embody no notions of
  8061.    protection, and so MS-DOS Kermit and Kermit 95 do not send file
  8062.    permissions, and ignore them when received.
  8063.    
  8064.    The permissions for a received file are determined by a combination of
  8065.    the file transfer mode (VMS-to-VMS transfers only), whether a file of
  8066.    the same name exists already, whether permissions of the file are
  8067.    received in the file attribute packet, and the setting of ATTRIBUTES
  8068.    PROTECTION.
  8069.    
  8070.    The default for ATTRIBUTES PROTECTION is ON. If no attributes are
  8071.    received, the effect is the same as if attributes PROTECTION were OFF.
  8072.    
  8073.    For VMS-to-VMS transfers, the default LABELED mode simply copies the
  8074.    protection code from source to destination.
  8075.      _________________________________________________________________
  8076.    
  8077.     4.4.1. When ATTRIBUTES PROTECTION is OFF
  8078.     
  8079.    If no file of the same name exists, system defaults determine the
  8080.    permissions of the new file. Otherwise, the actions taken depend on
  8081.    the current FILE COLLISION setting: BACKUP, OVERWRITE, RENAME, etc, as
  8082.    documented in [465]Using C-Kermit. But now the new file (if it is
  8083.    created at all) automatically inherits the permissions (mode bits) of
  8084.    the existing file in a way that is appropriate for the platform.
  8085.    
  8086.     4.4.1.1. Unix
  8087.     
  8088.    All mode bits are inherited except the directory bit, since the
  8089.    incoming file can not possibly be a directory. (In any case, it is not
  8090.    possible to receive a file that has the same name as an existing
  8091.    directory unless FILE COLLISION is set to RENAME).
  8092.    
  8093.     4.4.1.2. VMS
  8094.     
  8095.    Files with the same name as an existing file, transferred in modes
  8096.    other than LABELED between VMS systems, inherit the protection of the
  8097.    prior version.
  8098.      _________________________________________________________________
  8099.    
  8100.     4.4.2 When ATTRIBUTES PROTECTION is ON
  8101.     
  8102.    File permissions can be conveyed as part of the file transfer process,
  8103.    in accordance with the Kermit protocol definition. If the file sender
  8104.    puts system-dependent and/or system-independent versions of the file
  8105.    protection (permissions) into the Attribute (A) packet, the file
  8106.    receiver can set the new file's permissions from them. Otherwise, the
  8107.    permissions are set the same as for ATTRIBUTES PROTECTION OFF.
  8108.    
  8109.    When the incoming A packet contains system-dependent permissions, the
  8110.    file receiver checks to see if the sender has the same system ID (e.g.
  8111.    both the sending and receiving systems are UNIX, or both are VMS); if
  8112.    so, it decodes and uses the system-dependent permissions; otherwise it
  8113.    uses the generic ones (if any) and applies them to the owner field,
  8114.    setting the other fields appropriately as described in the following
  8115.    sections.
  8116.    
  8117.    Setting the incoming file's protection from the A packet is controlled
  8118.    by SET ATTRIBUTES PROTECTION (or PERMISSION), which is ON by default,
  8119.    and its status is displayed by SHOW ATTRIBUTES.
  8120.    
  8121.    The main benefit of this feature is to not have to "chmod +x" an
  8122.    executable file after transfer from UNIX to UNIX. Its cross-platform
  8123.    benefits are less evident, perhaps to retain the status of the Unix
  8124.    'x' bit on a VMS system, for subsequent transfer back to a Unix
  8125.    system.
  8126.      _________________________________________________________________
  8127.    
  8128.     4.4.2.1. System-Specific Permissions
  8129.     
  8130.    System-specific file permissions are used when the two Kermit programs
  8131.    recognize each other as running on the same type of system. For
  8132.    example, both are running under some form of UNIX (it doesn't matter
  8133.    which UNIX variation -- HP-UX, Solaris, AIX, etc -- all use the same
  8134.    scheme for file permissions); or both are running under VMS (even if
  8135.    one is on an Alpha and the other on a VAX, and/or one is old and the
  8136.    other is new).
  8137.    
  8138.     4.4.2.1.1. UNIX
  8139.     
  8140.    UNIX supports three categories of users, File Owner, Group, and World,
  8141.    and three types of file access permission: Read, Write, and Execute.
  8142.    Thus, a UNIX file's permissions are expressed in 9 bits.
  8143.    
  8144.    The system-dependent permission string for UNIX is a 3-digit octal
  8145.    string, the low-order 9 bits of the st_mode member of the stat struct;
  8146.    we deliberately chop off the "file format" bits because they are not
  8147.    permissions, nor do we convey the setuid/setgid bits, lock bit, sticky
  8148.    bit, etc.
  8149.    
  8150.     4.4.2.1.2. VMS
  8151.     
  8152.    VMS supports four categories of users, System, File Owner, Group, and
  8153.    World, and four types of file access permission: Read, Write, Execute,
  8154.    and Delete. Thus, a VMS file's permissions are expressed in 16 bits.
  8155.    
  8156.    The system-dependent protection string for VMS is a 4-digit
  8157.    hexadecimal string, corresponding to the internal-format protection
  8158.    word of the file (RWED for each of World,Group,Owner,System). A new
  8159.    file normally gets all 16 protection bits from the original file of
  8160.    the same name.
  8161.    
  8162.    Note: VMS-to-VMS transfers take place in LABELED mode when the two
  8163.    C-Kermits recognize each other's platform as VMS (unless you have
  8164.    disabled LABELED-mode transfers). In this case, all of a file's
  8165.    attributes are preserved in the transfer and the protection mask (and
  8166.    other information) is taken from the file's internal information, and
  8167.    this takes precedence over any information in the Attribute packets.
  8168.    You can defeat the automatic switching into LABELED mode (if you want
  8169.    to) with SET TRANSFER MODE MANUAL.
  8170.      _________________________________________________________________
  8171.    
  8172.     4.4.2.2. System-Independent Permissions
  8173.     
  8174.    The system-independent ("generic") protection is used when the system
  8175.    IDs of the two Kermit programs do not agree (e.g. one is UNIX, the
  8176.    other is VMS). The generic protection attribute includes the following
  8177.    permissions (not all are applicable to every file system): Read,
  8178.    Write, Append, Execute, Delete, Search. The generic permissions are
  8179.    derived from the owner permissions of the source file, thus, a Unix
  8180.    'w' permission becomes VMS Write,Delete.
  8181.    
  8182.    The Owner field of the new file's permissions is set from the incoming
  8183.    generic protection attribute.
  8184.    
  8185.    In UNIX, the Group and World permissions are set according to your
  8186.    umask, except that execute permission is NOT set in these fields if it
  8187.    was not also set in the generic protection (and consequently, is set
  8188.    in the Owner field).
  8189.    
  8190.    In VMS, the System, Group, and World permissions are set according to
  8191.    the process default file permission (as shown in VMS by SHOW
  8192.    PROTECTION), except that no permissions are allowed in these fields
  8193.    that are not included in the generic permissions.
  8194.    
  8195.    Note that the VMS and UNIX interpretations of Execute permission are
  8196.    not identical. In UNIX, a file (binary executable, shell script, etc)
  8197.    may not be executed unless it has Execute permission, and normally
  8198.    files that are not intended for execution do not have Execute
  8199.    permission. In VMS, Read permission implicitly supplies Execute
  8200.    capability. Generally files that have Read permission also have
  8201.    explicit Execute permission, but files (binary executables, DCL
  8202.    command procedures) that have Read permission and not Execute
  8203.    permission can still be executed.
  8204.      _________________________________________________________________
  8205.    
  8206.   4.5. File Management Commands
  8207.   
  8208.     4.5.1. The DIRECTORY Command
  8209.     
  8210.    Prior to C-Kermit 7.0, the DIRECTORY command always ran an external
  8211.    system command (such as "ls" on UNIX) or program to product the
  8212.    directory listing. This had certain advantages, mostly that you could
  8213.    include system-dependent options for customized listings, e.g. on
  8214.    UNIX:
  8215.    
  8216.   dir -lt c* | more
  8217.  
  8218.    or in VMS:
  8219.    
  8220.   directory /size/date/protection/except=*.obj oofa.*;0
  8221.  
  8222.    This approach, however, carries some disadvantages: C-Kermit can't
  8223.    return SUCCESS or FAILURE status for (e.g.) "dir foo" according to
  8224.    whether the file "foo" exists; and it runs an inferior process, which
  8225.    might be a problem in some environments for resource and/or security
  8226.    reasons, and won't work at all in a "nopush" environment (e.g. one in
  8227.    which C-Kermit is configured to forbid access to exterior commands and
  8228.    programs, e.g. in a VMS "captive account").
  8229.    
  8230.    In C-Kermit 7.0 on VMS and UNIX, and in K95 1.1.19 and later, the
  8231.    DIRECTORY command is internal to Kermit. It can be run in a "nopush"
  8232.    environment and returns SUCCESS or FAILURE status appropriately. In
  8233.    UNIX it prints all dates and times in a consistent way (unlike ls). In
  8234.    VMS it prints precise file sizes, rather than "blocks". It offers
  8235.    several formatting and other options, but it is not necessarily more
  8236.    flexible than the corresponding external commands or programs (the
  8237.    UNIX "ls" program, the VMS "directory" command). The syntax is:
  8238.    
  8239.    DIRECTORY [ switch [ switch [ ... ] ] ] [ filespec ]
  8240.    
  8241.    If no filespec is given, all files in the current directory are
  8242.    listed.
  8243.    
  8244.    Optional switches include all the standard file-selection switches
  8245.    presented in [466]Section 1.5.4, plus:
  8246.    
  8247.    /ALL
  8248.           Show both regular files and directories; this is the default.
  8249.           
  8250.    /ARRAY:x
  8251.           Instead of displaying a directory listing, put the files that
  8252.           would have been shown (based on the filespec and other
  8253.           selection switches) in the given array. The array need not (and
  8254.           should not) be predeclared; if the array already exists, it is
  8255.           destroyed and reused. The array name can be a single letter,
  8256.           like "a", or any fuller form, such as "&a", "\&a", "\&a[]",
  8257.           etc. If the /ARRAY switch is included, the following other
  8258.           switches are ignored: /BRIEF, /VERBOSE, /HEADING, /PAGE,
  8259.           /ENGLISHDATE, /ISODATE, /XFERMODE, /MESSAGE, /SORT, /REVERSE,
  8260.           /ASCENDING. In other words, only file selection switches are
  8261.           meaningful with /ARRAY: /FILES, /DIRECTORIES, /ALL, /DOTFILES,
  8262.           /NOBACKUP, /RECURSIVE, /SMALLER, /LARGER, /AFTER, /BEFORE,
  8263.           /EXCEPT, etc. The resulting array has the number of files (n)
  8264.           as its 0th element, and the filenames in elements 1 through n
  8265.           Example:
  8266.           
  8267.   dir /array:&a /files /nobackup /after:19990101 /larger:10000 [ab]*
  8268.   show array &a
  8269.  
  8270.    /FILES
  8271.           Only show regular files.
  8272.           
  8273.    /DIRECTORIES
  8274.           Only show directories.
  8275.           
  8276.    /BACKUP
  8277.           In UNIX, OS-9, K-95, and other versions that support SET FILE
  8278.           COLLISION BACKUP and create backup files by appending .~n~ to
  8279.           the filename (where "n" is a number), /BACKUP means to include
  8280.           these files in directory listings. This is the default.
  8281.           
  8282.    /NOBACKUP
  8283.           This is the opposite of /BACKUP: that is, do not include backup
  8284.           files in the listing.
  8285.           
  8286.    /BRIEF
  8287.           List filenames only; use a compact format, as many filenames as
  8288.           will fit across the screen (based on the longest name). A brief
  8289.           listing is always sorted alphabetically.
  8290.           
  8291.    /VERBOSE
  8292.           List one file per line, and include date, size, and (in UNIX
  8293.           only) permissions of each file. This is the opposite of /BRIEF,
  8294.           and is the default.
  8295.           
  8296.    /PAGE
  8297.           Pause at the end of each screenful and give a "more?" prompt,
  8298.           even if SET COMMAND MORE-PROMPTING is OFF.
  8299.           
  8300.    /NOPAGE
  8301.           Don't pause at the end of each screenful and give a "more?"
  8302.           prompt, even if SET COMMAND MORE-PROMPTING is ON. If neither
  8303.           /PAGE or /NOPAGE is given, paging is according to the
  8304.           prevailing COMMAND MORE-PROMPTING setting (which can be
  8305.           displayed with SHOW COMMAND).
  8306.           
  8307.    /ENGLISHDATE
  8308.           Show dates in dd-mmm-yyyy format; mmm is the first three
  8309.           letters of the English month name.
  8310.           
  8311.    /ISODATE
  8312.           Show dates in yyyy-mm-dd format; mm is the month number, 1-12.
  8313.           This is the opposite of /ENGLISHDATE, and is the default.
  8314.           
  8315.    /HEADINGS
  8316.           Print a heading before the listing and a summary at the end.
  8317.           
  8318.    /NOHEADINGS
  8319.           Don't print a heading before the listing or a summary at the
  8320.           end. This is the opposite of /HEADINGS, and is the default.
  8321.           
  8322.    /XFERMODE
  8323.           Only in Kermit programs that support SET FILE PATTERNS. If this
  8324.           switch is included, and the filename matches any FILE
  8325.           BINARY-PATTERN ([467]Section 4.3), "(B)" is printed after the
  8326.           filename; otherwise, if it matches a FILE TEXT-PATTERN, "(T)"
  8327.           is printed.
  8328.           
  8329.    /NOXFERMODE
  8330.           Don't display transfer-mode indicators. This is the opposite of
  8331.           /XFERMODE and is the default.
  8332.           
  8333.    /RECURSIVE
  8334.           Show files not only in the given directory, but also in its
  8335.           subdirectories (if any), their subdirectories, etc.
  8336.           
  8337.    /NORECURSIVE
  8338.           Don't show files in subdirectories. This is the opposite of
  8339.           /RECURSIVE, and is the default.
  8340.           
  8341.    /MESSAGE:text
  8342.           This lets you specify a short text string to be appended to the
  8343.           end of each directory listing line (a space is supplied
  8344.           automatically). If the text contains any spaces, enclose it in
  8345.           braces, e.g. /MESSAGE:{two words}.
  8346.           
  8347.    /NOMESSAGE
  8348.           Don't append any message to the end of each directory listing
  8349.           line (default).
  8350.           
  8351.    /SORT:[{NAME,SIZE,DATE}]
  8352.           Sort the listing by name, size, or date. If the /SORT switch is
  8353.           given but the "sort-by" keyword is omitted, the listing is
  8354.           sorted by name. /SORT:NAME /ASCENDING (alphabetic sort by name)
  8355.           is the default.
  8356.           
  8357.    /NOSORT
  8358.           Don't sort the listing. Files are listed in whatever order they
  8359.           are supplied by the operating system, e.g. inode order in UNIX.
  8360.           
  8361.    /REVERSE
  8362.           If the /SORT switch is given, reverse the order of the sort.
  8363.           Synonym: /DESCENDING.
  8364.           
  8365.    /ASCENDING
  8366.           If the /SORT switch is given, sort the listing in normal order.
  8367.           This is the opposite of /REVERSE and is the default.
  8368.           
  8369.    Note that most of the DIRECTORY-specific switches come in pairs, in
  8370.    which one member of a pair (e.g. /NOHEADINGS) is the opposite of the
  8371.    other (e.g. /HEADINGS).
  8372.    
  8373.    If you always want to use certain options, you can set them with the
  8374.    SET OPTIONS DIRECTORY command ([468]Section 1.5.5). Use SHOW OPTIONS
  8375.    to list the options currently in effect. To make the desired options
  8376.    apply every time you run C-Kermit, put a SET OPTIONS DIRECTORY command
  8377.    in your C-Kermit customization file, specifying the desired options.
  8378.    Options set in this manner apply to every subsequent DIRECTORY
  8379.    command. Of course, if you include switches in a DIRECTORY command,
  8380.    these override any defaults, built-in or custom. Example:
  8381.    
  8382.   DIRECTORY            ; Use "factory defaults"
  8383.   SET OPTIONS DIRECTORY /SORT:SIZE /REVERSE /HEADINGS  ; Customize defaults
  8384.   DIRECTORY            ; Use customized defaults
  8385.   DIR /SORT:NAME       ; Override customized default SORT key
  8386.   SET OPT DIR /RECURS  ; Add /RECURSIVE to customized defaults
  8387.   DIR /ASCEND          ; Override customized default SORT order
  8388.  
  8389.    Notes:
  8390.    
  8391.      * Only a single sort key is supported; there is presently no way to
  8392.        have multiple sort keys.
  8393.      * If the /BRIEF switch is given, all other switches (except
  8394.        /[NO]RECURSIVE, /[NO]DOTFILES, /DIRECTORIES, /FILES, and /ALL) are
  8395.        ignored.
  8396.      * /SORT:anything gives incorrect results if any files have lengths
  8397.        greater than 10 digits (i.e. that are more than 9999999999 bytes
  8398.        long, i.e. if they are 10GB or more in size) because the overlong
  8399.        length field causes the date and name fields to be misaligned.
  8400.      * /SORT:NAME is redundant in VMS since VMS returns filenames in
  8401.        alphabetic order anyway.
  8402.      * /SORT:NAME ignores alphabetic case on platforms where case does
  8403.        not matter in filenames, but this works only for unaccented Roman
  8404.        letters A-Z.
  8405.      * /SORT:NAME is currently based on code values, and so works fine
  8406.        for ASCII, but will probably produce unexpected results for files
  8407.        with non-ASCII or 8-bit characters in their names. (Locale-based
  8408.        sorting raises rather significant issues of portability, size,
  8409.        performance, etc.)
  8410.      * /SORT:DATE works right only for ISO-format dates, not English
  8411.        ones.
  8412.      * /SORT:SIZE sorts the size field lexically. On some platforms (e.g.
  8413.        Windows), the size of a directory file is listed as "<DIR>" rather
  8414.        than as a number; in this case, the "<DIR>" files are gathered at
  8415.        the end (or beginning, depending on the sort order) of the
  8416.        listing.
  8417.      * /RECURSIVE is accepted but ignored in AOS/VS. Use the normal
  8418.        system-specific filespec notation, e.g. "dir #.txt".
  8419.      * /RECURSIVE has no affect when a full, absolute pathname is given;
  8420.        e.g. "dir /recursive /tmp/foo" (where "foo" is a regular file)
  8421.        only shows the "/tmp/foo" file. If you want to see all "foo" files
  8422.        in the /tmp tree, do "cd /tmp" and then "dir /recursive foo".
  8423.      * If a file size of -1 is shown, or date-time of 0000-00-00
  8424.        00:00:00, this means the file was located, but access to
  8425.        information about the file was denied to C-Kermit.
  8426.      * In VMS, if FOO.DIR;1 is a directory within your current directory,
  8427.        "directory foo" and "directory [.foo]" list the files in the
  8428.        [.FOO] subdirectory, but "directory foo.dir" lists the directory
  8429.        file itself; similarly for "*.dir" versus "[.*]", etc.
  8430.      * In UNIX, if "foo" is a directory within your current directory,
  8431.        "directory foo" lists the files in the foo directory. If you want
  8432.        to list the foo directory file itself, put an asterisk at the end:
  8433.        "dir foo*".
  8434.        
  8435.    Hint: How to find the biggest files in a directory tree:
  8436.    
  8437.   cd xxx ; (root of tree)
  8438.   directory /sort:size /recursive /reverse /dotfiles /page
  8439.  
  8440.    Another hint: If you often use several different directory-listing
  8441.    formats, define macro shortcuts for them:
  8442.    
  8443.   DEFINE WD DIRECTORY /SORT:DATE /REVERSE \%*  ; Reverse chronological order
  8444.   DEFINE SD DIRECTORY /SORT:SIZE /REVERSE \%*  ; Reverse order of size
  8445.   DEFINE ND DIRECTORY /SORT:NAME /ASCEND \%*   ; Alphabetical by name
  8446.   DEFINE DL DIR /DIR /SORT:NAME /ASCEND \%*    ; Alphabetical directory list
  8447.  
  8448.    Put these definitions in your C-Kermit customization file. Note that
  8449.    "\%*" ([469]Section 7.5) in these definitions lets you include other
  8450.    switches in your macro invocations, e.g.:
  8451.    
  8452.   wd /headings *.txt
  8453.  
  8454.    Of course you can still access your external directory listing program
  8455.    by using RUN or "!", e.g. in VMS:
  8456.    
  8457.   run directory /size/date/protection/except=*.obj oofa.*;0
  8458.  
  8459.    or:
  8460.    
  8461.   !dir /size/date/prot/exc=*.obj oofa.*;0
  8462.  
  8463.    In UNIX, use "!ls" or just "ls" (which is a special synonym for
  8464.    "!ls").
  8465.      _________________________________________________________________
  8466.    
  8467.     4.5.2. The CD and BACK Commands
  8468.     
  8469.    In C-Kermit 7.0, the CD command has a new friend, the BACK command.
  8470.    BACK means "CD to my previous current directory". A second BACK brings
  8471.    you back to where you were before the first one; thus successive BACK
  8472.    commands switch back and forth between two directories.
  8473.    
  8474.     4.5.2.1. Parsing Improvements
  8475.     
  8476.    The CD command, as well as other commands that parse a directory name,
  8477.    were changed in 7.0 to provide all the expected functions: completion
  8478.    on Tab or Esc, directory-name lists on ?, etc. Other affected commands
  8479.    include SET SERVER GET-PATH, SET TEMP-DIRECTORY, SET FILE
  8480.    DOWNLOAD-DIRECTORY, and SPACE. CD and REMOTE CD also now work with
  8481.    logical names.
  8482.    
  8483.    In VMS, the situation is a bit complicated since a directory name can
  8484.    look like "DEV:", "[FOO.BAR]", "DEV:[FOO.BAR]", "[FOO]BAR.DIR;1", etc.
  8485.    Completion and ?-help might not always work, but they do in many
  8486.    cases. Examples:
  8487.    
  8488.   cd ?           Lists all subdirectories of the current directory
  8489.   cd []?         Ditto
  8490.   cd k?          Ditto, but only those starting with K
  8491.   cd [foo]?      Lists all subdirectories of the [FOO] directory
  8492.   cd [-]?        Lists all subdirectories of the superior directory
  8493.   cd [--]?       Lists all subdirectories of the directory 2 levels up
  8494.   cd [...]?      Lists all directories below the current one
  8495.   cd [foo.?      Does not work.
  8496.  
  8497.    C-Kermit allows all of the following in VMS:
  8498.    
  8499.   cd bar         CD to subdirectory BAR of the current directory
  8500.   cd .bar        Ditto
  8501.   cd [.bar]      Ditto
  8502.   cd bar.dir     etc...
  8503.   cd bar.dir;
  8504.   cd bar.dir;1
  8505.   cd [foo.bar]
  8506.   cd bar.baz     This can go more than 1 level deep...
  8507.   cd dir:        (where logical name DIR is defined as [FOO.BAR])
  8508.  
  8509.    As well as the following:
  8510.    
  8511.   cd ..          Go up one level as in UNIX
  8512.   cd .           The current directory
  8513.   cd             My login directory
  8514.  
  8515.    Note that "cd -" (go up one level) does not work as expected, because
  8516.    "-" is Kermit's command continuation character. However, "cd [-]", and
  8517.    "
  8518.    cd {-}" have the desired effect (and so does "cd ..", which is easier
  8519.    to type).
  8520.      _________________________________________________________________
  8521.    
  8522.     4.5.2.2. The CDPATH
  8523.     
  8524.    The CD command in the UNIX, Windows, OS/2, and VMS versions of
  8525.    C-Kermit, as of version 6.1 / 1.1.12, searches the CDPATH for the
  8526.    given directory, if it is not absolute and if a CDPATH environment
  8527.    variable is defined. Example (in UNIX ksh or bash):
  8528.    
  8529.   $ export CDPATH=$HOME:$HOME/kermit:/tmp
  8530.  
  8531.    Now if you give a "cd xxx" command, no matter what your current
  8532.    directory is, if the "xxx" directory is not a subdirectory of your
  8533.    current directory, then the xxx subdirectory of your home directory is
  8534.    used or if that does not exist, then the xxx subdirectory of the
  8535.    kermit subdirectory of your home directory is used or if that does not
  8536.    exist, then /tmp/xxx is used. This is how the ksh "cd" command works,
  8537.    and now the C-Kermit CD command works the same way.
  8538.    
  8539.    In VMS, you can define CDPATH to be a list of directories that contain
  8540.    actual directory delimiters, and/or logical names representing
  8541.    directories, using commas to separate them, e.g.:
  8542.    
  8543.   $ define cdpath [HOME],[SOMEOTHERDIR],[HOME.MISC]
  8544.   $ define cdpath SYS$LOGIN:,DISK1:[HOME],DISK2:[SCRATCH.IVAN]
  8545.  
  8546.    Example:
  8547.    
  8548.   $ define cdpath SYS$LOGIN:,[IVAN],[OLAF],[OLGA.MISC]
  8549.   $ kermit
  8550.   DISK1:[OLGA] C-Kermit> cd blah
  8551.  
  8552.    tries the BLAH subdirectory of the user's login directory, then
  8553.    [OLGA.BLAH], [IVAN.BLAH], [OLAF.BLAH], and [OLGA.MISC.BLAH], in that
  8554.    order, using the first one it finds, failing if it finds none.
  8555.    
  8556.    In C-Kermit 7.0, you may also set the CDPATH from the Kermit prompt:
  8557.    
  8558.    SET CD PATH path
  8559.           Allows the CD PATH to be set from within C-Kermit.
  8560.           
  8561.    SHOW CD shows the CD path and all other information relevant to the CD
  8562.    command.
  8563.      _________________________________________________________________
  8564.    
  8565.     4.5.2.3. CD Messages
  8566.     
  8567.    Whenever you change directory, you can have C-Kermit display a "Read
  8568.    Me" file from the new directory automatically. The commands are:
  8569.    
  8570.    SET CD MESSAGE { ON, OFF, FILE list }
  8571.           ON enables this feature; OFF (the default) disables it. File
  8572.           lets you specify the name of the "Read Me" file. A list of
  8573.           names to look for can be given in the following format:
  8574.           
  8575.   {{name1}{name2}{name3}{...}}
  8576.  
  8577.           e.g.:
  8578.           
  8579.   SET SERVER CD-MESSAGE FILE {{./.readme}{README.TXT}{READ.ME}}
  8580.  
  8581.           The default list of CD-message files is system dependent.
  8582.           
  8583.    SHOW CD shows your current directory, previous directory, CD path, and
  8584.    CD message info.
  8585.      _________________________________________________________________
  8586.    
  8587.     4.5.3. Creating and Removing Directories
  8588.     
  8589.    The MKDIR command now allows you to create multiple directories at
  8590.    once:
  8591.    
  8592.   C-Kermit> mkdir a/b/c/d
  8593.  
  8594.    creates the directory a in the current directory (if it doesn't exist
  8595.    already), and then creates subdirectory b in the a directory (if it
  8596.    didn't exist already), and so on.
  8597.    
  8598.    If you use MKDIR to try to create a directory that already exists,
  8599.    C-Kermit will print a warning ("?Directory already exists"), but the
  8600.    MKDIR command will still succeed. If you want to avoid the warning
  8601.    message, use IF DIRECTORY first to check if the directory already
  8602.    exists.
  8603.    
  8604.    The RMDIR command, however, will not remove more than one directory,
  8605.    nor will it remove a directory that contains any files. (There is, as
  8606.    yet, no RMDIR /RECURSIVE command, although one might be added later.)
  8607.    
  8608.    In VMS, these commands (like CD) are more forgiving of your syntax
  8609.    than is the DCL command shell; "mkdir oofa" is equivalent to "mkdir
  8610.    [.oofa]" and so on. Also in VMS, you'll find that C-Kermit's RMDIR
  8611.    command is easier than deleting a directory in DCL, since it
  8612.    automatically first gives it owner delete permission if you are the
  8613.    owner.
  8614.      _________________________________________________________________
  8615.    
  8616.     4.5.4. The DELETE and PURGE Commands
  8617.     
  8618.    The DELETE command now offers a selection of switches, and has a new
  8619.    companion, the PURGE command. First, DELETE:
  8620.    
  8621.    DELETE [ switches... ] filespec
  8622.           Deletes the file or files that match the filespec, which may
  8623.           contain wildcards ([470]Section 4.9).
  8624.           
  8625.    Optional switches include the standard file-selection switches
  8626.    presented in [471]Section 1.5.4, plus:
  8627.    
  8628.    /ASK
  8629.           Before deleting each file, ask permission interactively.
  8630.           Answers are Yes or OK (delete the file), No (don't delete it),
  8631.           or Quit (stop executing the DELETE command).
  8632.           
  8633.    /NOASK
  8634.           Don't ask permission to delete each file.
  8635.           
  8636.    /LIST
  8637.           List each file and show whether it was deleted. Synonyms: /LOG,
  8638.           /VERBOSE.
  8639.           
  8640.    /NOLIST
  8641.           Don't list files while deleting them. Synonyms: /NOLOG, /QUIET.
  8642.           
  8643.    /HEADING
  8644.           Print a heading and summary line.
  8645.           
  8646.    /NOHEADING
  8647.           Don't print a heading and summary line.
  8648.           
  8649.    /PAGE
  8650.           When listing, pause at the end of each screenful and give the
  8651.           "More?" prompt. If you reply "n" (no), the DELETE command
  8652.           terminates.
  8653.           
  8654.    /SIMULATE
  8655.           Do everything implied by the given switches and filespec,
  8656.           except do not actually delete any files. This lets you preview
  8657.           which files would be deleted; implies /LIST.
  8658.           
  8659.    Now the PURGE command:
  8660.    
  8661.    PURGE [ switches... ] [ filespec ]
  8662.           (VMS only) Runs the DCL PURGE command. Switches and filespec,
  8663.           if any, are passed directly to DCL without parsing or
  8664.           verification. Deletes excess versions of the given (or all)
  8665.           files. The rest of this section does not apply to VMS.
  8666.           
  8667.    PURGE [ switches... ] [ filespec ]
  8668.           (UNIX only) Deletes "backup files" that match the filespec,
  8669.           which may contain wildcards ([472]Section 4.9). If no filespec
  8670.           is given, all backup files in the current directory are
  8671.           selected (subject to modification by any switches). Do not
  8672.           include backup notation in the filespec.
  8673.           
  8674.    Explanation:
  8675.    
  8676.    To avoid destroying preexisting files when a new file arrives that has
  8677.    the same name, C-Kermit backs up the old file by appending a "backup
  8678.    number" to its name. In UNIX, the backup suffix consists of a period,
  8679.    a tilde, a number, and another tilde. For example, if a file called
  8680.    oofa.txt exists and a new oofa.txt file arrives, the original is
  8681.    renamed to oofa.txt.~1~. If another oofa.txt file arrives, the
  8682.    existing one is renamed to oofa.txt.~2~. And so on. This system is
  8683.    compatible with the one used by EMACS. Thus over time, if you receive
  8684.    a lot of files with C-Kermit or edit them with EMACS, backup files can
  8685.    build up. The new PURGE command lets you clean out accumulated backup
  8686.    files:
  8687.    
  8688.    Optional switches include the standard file-selection switches
  8689.    presented in [473]Section 1.5.4, plus all the switches listed above
  8690.    for the DELETE command, plus:
  8691.    
  8692.    /KEEP:n
  8693.           Retains the n most recent (highest-numbered) backup files for
  8694.           each file. For example, if oofa.txt, oofa.txt.~1~,
  8695.           oofa.txt.~2~, oofa.txt.~10~, oofa.txt.~12~, and oofa.txt.~100~
  8696.           exist, "purge /keep:2 oofa.txt" deletes oofa.txt.~1~,
  8697.           oofa.txt.~2~, and oofa.txt.~10~, and keeps oofa.txt,
  8698.           oofa.txt.~12~, and oofa.txt.~100~. If /KEEP is given without a
  8699.           number, one (the highest numbered) backup file is kept.
  8700.           
  8701.    CAUTION: The PURGE command should be used only when *.~*~ files truly
  8702.    are backup files. This is the case for EMACS, and it is the DEFAULT
  8703.    for C-Kermit. However, if C-Kermit's FILE COLLISION has been set to
  8704.    RENAME, newly received files will look like backup files. In that
  8705.    case, don't use the PURGE command or you'll be removing new files
  8706.    rather than old ones. (Use SHOW FILE to find the FILE COLLISION
  8707.    setting.)
  8708.    
  8709.    The PURGE command is presently available only in UNIX. The command
  8710.    succeeds if it deleted any files, or if it deleted no files but there
  8711.    were no errors. It fails if it deleted no files and there were errors
  8712.    (i.e. deletion was attempted but failed). In VMS, backup file versions
  8713.    are handled automatically by the OS, and a PURGE command can be used
  8714.    at the VMS prompt to clean them up.
  8715.    
  8716.    If you want certain switches to be supplied automatically with each
  8717.    DELETE or PURGE command, you can set them with SET OPTIONS
  8718.    ([474]Section 1.5.5) and you can display any such settings with SHOW
  8719.    OPTIONS. Of course you can override them on a per-command basis by
  8720.    including switches in your PURGE or DELETE command.
  8721.    
  8722.    Also see SET FILE COLLISION, SHOW FILE, SEND /NOBACKUP, SET SEND
  8723.    BACKUP, and DIRECTORY /[NO]BACKUP.
  8724.      _________________________________________________________________
  8725.    
  8726.   4.6. Starting the Remote Kermit Server Automatically
  8727.   
  8728.    As noted on pages 275-276 of [475]Using C-Kermit 2nd edition, you can
  8729.    have Kermit send "kermit receive" commands automatically when it is in
  8730.    local mode and you give a SEND or similar command, to start the remote
  8731.    Kermit receiver in case it is not already started. The "kermit
  8732.    receive" commands are specified by:
  8733.    
  8734.   SET PROTOCOL KERMIT binary-receive-command text-receive-command
  8735.  
  8736.    As of version 7.0, a Kermit protocol option has been added to send a
  8737.    string to the host in advance of any Kermit packets when you give a
  8738.    GET-class or REMOTE command. This will switch the remote C-Kermit into
  8739.    the appropriate mode or, if the remote system is at a system command
  8740.    (shell) prompt, execute the string on the remote system. The new
  8741.    syntax of the SET PROTOCOL KERMIT command is:
  8742.    
  8743.   SET PROTOCOL KERMIT [ s1 [ s2 [ s3 ] ] ]
  8744.  
  8745.    where:
  8746.    
  8747.        Default         Meaning
  8748.   s1  {kermit -ir}     Remote "kermit receive in binary mode" command.
  8749.   s2  {kermit -r}      Remote "kermit receive in text mode" command.
  8750.   s3  {kermit -x}      Remote "start kermit server" command.
  8751.  
  8752.    NOTE: If the remote Kermit is 6.0, the following are recommended for
  8753.    fast startup and high-performance file transfer (see Appendix I in
  8754.    [476]Using C-Kermit, second Edition, for command-line options):
  8755.    
  8756.   s1   kermit -YQir   (Kermit receive binary, skip init file, fast.)
  8757.   s2   kermit -YQTr   (Kermit receive text, skip init file, fast.)
  8758.   s3   kermit -YQx    (Kermit server, skip init file, fast.)
  8759.  
  8760.    If the remote is C-Kermit 7.0 or later, change the -x option (enter
  8761.    server mode) to -O (uppercase letter O), which means "enter server
  8762.    mode for One transaction only); this way, it is not stuck in server
  8763.    after the transfer. Also note that the Q is redundant in version 7.0,
  8764.    since fast Kermit protocol settings are now the default.
  8765.    
  8766.    Note that in case the C-Kermit executable is called "wermit" or
  8767.    "ckermit" you can change "kermit" in the strings above to "wermit" or
  8768.    "ckermit" and C-Kermit 7.0 or later will recognize these as synonyms
  8769.    for "kermit", in case it is at its command prompt when one of these
  8770.    strings is sent to it.
  8771.      _________________________________________________________________
  8772.    
  8773.   4.7. File-Transfer Command Switches
  8774.   
  8775.    Over the years, various new methods of transferring a file have
  8776.    accumulated, until we had, in addition to the SEND command, also MOVE
  8777.    (send and then delete), MAIL (send as email), REMOTE PRINT (send to be
  8778.    printed), CSEND (send the output of a command), PSEND (send a part of
  8779.    a file), BSEND (send in binary mode), RESEND (resume an interrupted
  8780.    SEND), etc etc. Similarly: GET, REGET, CGET, RETRIEVE, and so on.
  8781.    
  8782.    Not only is it confusing to have different names for these commands,
  8783.    many of which are not real words, but this also does not allow all
  8784.    combinations, like "send a file as mail, then delete it".
  8785.    
  8786.    In C-Kermit 7.0, the SEND, GET, and RECEIVE commands were restructured
  8787.    to accept modifier switches (switches are explained in [477]Section
  8788.    1.5).
  8789.      _________________________________________________________________
  8790.    
  8791.     4.7.1. SEND Command Switches
  8792.     
  8793.    Without switches, the SEND command still works exactly as before:
  8794.    
  8795.   send oofa.txt      ; send a single file
  8796.   send oofa.*        ; send multiple files
  8797.   send oofa.txt x.x  ; send oofa.txt as x.x (tell receiver its name is x.x)
  8798.   send               ; send from SEND-LIST
  8799.  
  8800.    But now the following modifier switches may be included between "send"
  8801.    and the filename. Zero, one, two, or more switches may be included in
  8802.    any combination that makes sense. Switch names (such as /BINARY) can
  8803.    be abbreviated, just like any other keywords. Most of these switches
  8804.    work only when using Kermit protocol (/TEXT and /BINARY are the
  8805.    exceptions).
  8806.    
  8807.    /AFTER:date-time
  8808.           Specifies that only those files modified (or, in VMS, created)
  8809.           after the given date-time (see [478]Section 1.6) are to be
  8810.           sent. Examples:
  8811.           
  8812.   send /text /after:{2-Feb-1997 10:28:30} *.txt
  8813.   send /text /after:\fdate(oofa.txt) *.txt
  8814.  
  8815.           Synonym: /SINCE.
  8816.           
  8817.    /ARRAY:arrayname
  8818.           Specifies that instead of sending a file, C-Kermit is to send
  8819.           the contents of the given array. Since an array does not have a
  8820.           filename, you should include an /AS-NAME switch to specify the
  8821.           name under which the array is to be sent (if you do not, the
  8822.           name "_array_x_" is used, where 'x' is replaced by the array
  8823.           designator). See [479]section 7.10 for array-name syntax. As
  8824.           noted in that section, you can also include a range to have a
  8825.           segment of the array sent, rather than the whole thing; for
  8826.           example: "send /array:&a[100:199]". It is strongly recommended
  8827.           that you accompany the /ARRAY switch with a /TEXT or /BINARY
  8828.           switch to force the desired transfer mode, since otherwise the
  8829.           various automatic mechanisms might switch to binary mode when
  8830.           you really wanted text, or vice versa. In text mode a line
  8831.           terminator is added to the end of each array element, but not
  8832.           in binary mode. For details and examples see [480]Section
  8833.           7.10.11.
  8834.           
  8835.    /AS-NAME:text
  8836.           Specifies "text" as the name to send the file under. You can
  8837.           also still specify the as-name as the second filename on the
  8838.           SEND command line. The following two commands are equivalent:
  8839.           
  8840.   send oofa.txt oofa.new
  8841.   send /as:oofa.new oofa.txt
  8842.  
  8843.    /BEFORE:date-time
  8844.           Specifies that only those files modified (or, in VMS, created)
  8845.           before the given date-time ([481]Section 1.6) are to be sent.
  8846.           
  8847.    /BINARY
  8848.           Performs this transfer in binary mode without affecting the
  8849.           global transfer mode, overriding not only the FILE TYPE and
  8850.           TRANSFER MODE settings, but also the FILE PATTERN setting, but
  8851.           for this SEND command only. In other words, SEND /BINARY means
  8852.           what it says: send the file in binary mode, regardless of any
  8853.           other settings. Example:
  8854.           
  8855.   set file type text      ; Set global transfer mode to text
  8856.   send /binary oofa.zip   ; Send a file in binary
  8857.   send oofa.txt           ; This one is sent in text mode
  8858.  
  8859.    /COMMAND
  8860.           SEND /COMMAND is equivalent to CSEND ([482]Section 4.2.2) -- it
  8861.           says to send the output from a command, rather than the
  8862.           contents of a file. The first "filename" on the SEND command
  8863.           line is interpreted as the name of a command; the second (if
  8864.           any) is the as-name. Examples:
  8865.           
  8866.   send /command {grep Sunday oofa.txt} sunday.txt
  8867.   send /as-name:sunday.txt /command {grep Sunday oofa.txt}
  8868.   send /bin /command {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
  8869.  
  8870.    /DELETE
  8871.           Deletes the file (or each file in the group) after it has been
  8872.           sent successfully (but does not delete it if it was not sent
  8873.           successfully). SEND /DELETE is equivalent to MOVE. Has no
  8874.           effect when used with /COMMAND. Example:
  8875.           
  8876.   send /delete *.log
  8877.  
  8878.    /DOTFILES
  8879.           (UNIX and OS-9 only) Normally files whose names begin with "."
  8880.           are skipped when matching wildcards that do not also beging
  8881.           with ".". Include /DOTFILES to force these files to be included
  8882.           too.
  8883.           
  8884.    /RECURSIVE
  8885.           Descend the through the directory tree when locating files to
  8886.           send. Automatically sets /PATHNAMES:RELATIVE. Explained in
  8887.           [483]Section 4.11 .
  8888.           
  8889.    /EXCEPT:pattern
  8890.           See [484]Section 1.5.4.
  8891.           
  8892.    /NOBACKUP
  8893.           This means to skip backup files when sending, even if they
  8894.           match the SEND file specification. This is equivalent to using
  8895.           SEND /EXCEPT and including *.~[0-9]*~ in the exception list (or
  8896.           *.~*~ if Kermit was built without pattern-matching support; see
  8897.           [485]Section 4.9.1). Including this switch is equivalent to
  8898.           giving SET SEND BACKUP OFF ([486]Section 4.0.6) prior to SEND,
  8899.           except its effect is local to the SEND command with which it
  8900.           was given.
  8901.           
  8902.    /NODOTFILES
  8903.           The opposite of /DOTFILES (q.v.)
  8904.           
  8905.    /FILENAMES:{CONVERTED,LITERAL}
  8906.           Use this switch to override the current global SET FILE NAMES
  8907.           setting for this transfer only.
  8908.           
  8909.    /FILTER:command
  8910.           This specifies a filter to pass the file through before sending
  8911.           it. See the [487]section on file-transfer pipes and filters.
  8912.           The /FILTER switch applies only to the file-transfer command it
  8913.           is given with; it does not affect the global SEND FILTER
  8914.           setting, if any.
  8915.           
  8916.    /IMAGE
  8917.           VMS: Sends in image mode. Non-VMS: same as /BINARY.
  8918.           
  8919.    /LABELED
  8920.           VMS and OS/2 only: Sends in labeled mode.
  8921.           
  8922.    /LARGER-THAN:number
  8923.           Specifies that only those files that are longer than the given
  8924.           number of bytes are to be sent.
  8925.           
  8926.    /LISTFILE:filename
  8927.           Specifies that the files to be sent are listed in a file with
  8928.           the given filename. The file contains one filename per line.
  8929.           These filenames are not checked in any way; each filename is
  8930.           taken and does not use or depend on any Kermit-specific syntax.
  8931.           In particular, backslashes are not treated specially, leading
  8932.           and trailing spaces are not stripped, etc. However, if a
  8933.           filename contains wildcards, they are expanded. Example: If a
  8934.           file named files.txt contains the following lines:
  8935.           
  8936.   blah.txt
  8937.   oofa*
  8938.   x.x
  8939.  
  8940.           (but without leading or trailing spaces), then the C-Kermit
  8941.           command "send /listfile:files.txt" will send the files
  8942.           blah.txt, x.x, and all files whose names start with "oofa",
  8943.           assuming the files exist and are readable. The /LISTFILE
  8944.           switch, can, of course, be used with other switches when it
  8945.           makes sense, for example, /EXCEPT, /BINARY, /AFTER, /SMALLER,
  8946.           /MOVE-TO, /DELETE, /AS-NAME with a template, etc.
  8947.           
  8948.    /MAIL:address
  8949.           Sends the file as e-mail to the given address or addresses.
  8950.           "send /mail:address filename" is equivalent to "mail filename
  8951.           address". You can include multiple addresses separated by
  8952.           commas. Examples:
  8953.           
  8954.   send /mail:kermit-support@columbia.edu packet.log
  8955.   send /mail:cmg,fdc,jrd oofa.txt
  8956.  
  8957.           As with any switch argument, if the address or address list
  8958.           contains any spaces, you must enclose it in braces. The format
  8959.           of the addresses must agree with that understood by the
  8960.           mail-sending program on the receiver's computer.
  8961.           
  8962.    /MOVE-TO:directory-name
  8963.           Specifies that after each (or the only) source file is sent
  8964.           successfully, and ONLY if it is sent successfully, it should be
  8965.           moved to the named directory. If the directory name contains
  8966.           spaces, enclose it in braces. If the directory does not exist,
  8967.           it is created if possible; if it can't be created, the command
  8968.           fails and an error message is printed. Example:
  8969.           
  8970.   send /text /move-to:/users/olga/backup/ *.txt
  8971.  
  8972.    /NOT-AFTER:date-time
  8973.           Specifies that only those files modified at or before the given
  8974.           date and time are to be sent.
  8975.           
  8976.    /NOT-BEFORE:date-time
  8977.           Specifies that only those files modified at or after the given
  8978.           date and time are to be sent.
  8979.           
  8980.    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE}
  8981.           Use this switch to override the current global SET SEND
  8982.           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE
  8983.           or RELATIVE also sets /FILENAMES:LITERAL (also for this
  8984.           transfer only) since pathnames are not sent otherwise.
  8985.           
  8986.    /RENAME-TO:text
  8987.           Specifies that after the (or each) source file is sent
  8988.           successfully, and ONLY if it is sent successfully, it should be
  8989.           renamed to the name given. If the name contains spaces, enclose
  8990.           it in braces. If a file group is being sent, then the "text"
  8991.           must contain a variable reference such as \v(filename) (see
  8992.           [488]Section 4.1). Example:
  8993.           
  8994.   send /rename-to:ok_\v(filename) *.*
  8995.  
  8996.           This sends each file in the current directory and if it was
  8997.           sent successfully, changes its name to begin with "ok_".
  8998.           
  8999.    /SMALLER-THAN:number
  9000.           Specifies that only those files that are smaller than the given
  9001.           number of bytes are to be sent.
  9002.           
  9003.    /SUBJECT:text
  9004.           Subject for email. Actually, this is just a synonym for
  9005.           /AS-NAME. If the text includes spaces, you must enclose it in
  9006.           braces. If you don't specify a subject (or as-name), the name
  9007.           of the file is used as the subject. Example:
  9008.           
  9009.   send /mail:kermit-support@columbia.edu /subj:{As requested} packet.log
  9010.  
  9011.    /PRINT:options
  9012.           Sends the file to be printed, optionally specifying options for
  9013.           the printer. Equivalent to REMOTE PRINT filename options.
  9014.           Examples:
  9015.           
  9016.   send /print oofa.txt              ; No options.
  9017.   send /print:/copies=3 oofa.txt    ; "/copies=3" is a VMS PRINT switch.
  9018.   send /print:-#3 oofa.txt          ; "-#3" is a UNIX lpr switch.
  9019.  
  9020.    /PROTOCOL:name
  9021.           Uses the given protocol to send the file (Kermit, Zmodem, etc)
  9022.           for this transfer without changing global protocol. Only
  9023.           available in Kermit 95, UNIX, and OS-9. Example:
  9024.           
  9025.   set protocol kermit               ; Set global protocol
  9026.   send /proto:zmodem /bin oofa.zip  ; Send just this file with Zmodem
  9027.   send oofa.txt                     ; This file is sent with Kermit
  9028.  
  9029.    /QUIET
  9030.           When sending in local mode, this suppresses the file-transfer
  9031.           display.
  9032.           
  9033.    /RECOVER
  9034.           Used to recover from a previously interrupted transfer; SEND
  9035.           /RECOVER is equivalent to RESEND. Recovery only works in binary
  9036.           mode; SEND /RECOVER and RESEND include an implied /BINARY
  9037.           switch. Even then, recovery will successful only if (a) the
  9038.           original (interrupted) transfer was also in binary mode, or (b)
  9039.           if it was in text mode, the two Kermit programs run on
  9040.           platforms where text-mode transfers are not length-changing.
  9041.           
  9042.    /STARTING:number
  9043.           Starts sending the file from the given byte position. SEND
  9044.           /STARTING:n filename is equivalent to PSEND filename n.
  9045.           
  9046.    /TEXT
  9047.           Performs this transfer in text mode without affecting the
  9048.           global transfer mode, overriding not only the FILE TYPE and
  9049.           TRANSFER MODE settings, but also the FILE PATTERN setting, for
  9050.           this SEND command only. In other words, SEND /TEXT really send
  9051.           the file in text mode, regardless of any other settings or
  9052.           negotiations.
  9053.           
  9054.    About mail... Refer to [489]Section 4.7.1. The same rules apply as for
  9055.    file transfer. If you are mailing multiple files, you can't use an
  9056.    as-name (in this case, a subject) unless it contains replacement
  9057.    variables like \v(filenum). For example, if you:
  9058.    
  9059.   send /mail:somebody@xyz.com *.txt
  9060.  
  9061.    Then each file will arrive as a separate email message with its name
  9062.    as the subject. But if you:
  9063.    
  9064.   send /mail:somebody@xyz.com /subject:{Here is a file} *.txt
  9065.  
  9066.    Then each file message will have the same subject, which is probably
  9067.    not what you want. You can get around this with constructions like:
  9068.    
  9069.   send /mail:somebody@xyz.com /subject:{Here is \v(filename)} *.txt
  9070.  
  9071.    which embed the filename in the subject.
  9072.    
  9073.    The MOVE, CSEND, MAIL, and RESEND commands now also accept the same
  9074.    switches. And the switches are also operative when sending from a
  9075.    SEND-LIST (see [490]Using C-Kermit, 2nd Ed, pp.191-192), so, for
  9076.    example, it is now possible to SEND /PRINT or SEND /MAIL from a
  9077.    SEND-LIST.
  9078.    
  9079.    The MSEND and MMOVE commands also take switches, but not all of them.
  9080.    With these commands, which take an arbitrary list of filespecs, you
  9081.    can use /BINARY, /DELETE, /MAIL, /PRINT, /PROTOCOL, /QUIET, /RECOVER,
  9082.    and /TEXT (and /IMAGE or /LABELED, depending on the platform). MMOVE
  9083.    is equivalent to MSEND /DELETE. (If you want to send a group of files,
  9084.    but in mixed transfer modes with per-file as-names, use ADD SEND-LIST
  9085.    and then SEND.)
  9086.    
  9087.    The MSEND/MMOVE switches come before the filenames, and apply to all
  9088.    of them:
  9089.    
  9090.   msend /print /text *.log oofa.txt /etc/motd
  9091.  
  9092.    If you type any of these commands (SEND, CSEND, MSEND, etc) followed
  9093.    by a question mark (?), you will see a list of the switches you can
  9094.    use. If you want to see a list of filenames, you'll need to type
  9095.    something like "send ./?" (UNIX, OS/2, Windows, etc), or "send []?"
  9096.    (VMS), etc. Of course, you can also type pieces of a filename
  9097.    (anything that does not start with "/") and then "?" to get a list of
  9098.    filenames that start that way; e.g. "send x.?" still works as before.
  9099.    
  9100.    In UNIX, where "/" is also the directory separator, there is usually
  9101.    no ambiguity between a fully-specified pathname and a switch, except
  9102.    when a file in the root directory has the same name as a switch (as
  9103.    noted in [491]Section 1.5):
  9104.    
  9105.   send /etc/motd                        ; Works as expected
  9106.   send /command                         ; ???
  9107.  
  9108.    The second example interprets "/command" as a switch, not a filename.
  9109.    To send a file actually called "command" in the root directory, use:
  9110.    
  9111.   send {/command}
  9112.  
  9113.    or other system-dependent forms such as //command, /./command,
  9114.    c:/command, etc, or cd to / and then "send command".
  9115.      _________________________________________________________________
  9116.    
  9117.     4.7.2. GET Command Switches
  9118.     
  9119.    Without switches, the GET command still works about the same as
  9120.    before:
  9121.    
  9122.   get oofa.txt                          ; GET a single file
  9123.   get oofa.*                            ; GET multiple files
  9124.  
  9125.    However, the mechanism for including an "as-name" has changed.
  9126.    Previously, in order to include an as-name, you were required to use
  9127.    the "multiline" form of GET:
  9128.    
  9129.   get
  9130.   remote-filespec
  9131.   local-name
  9132.  
  9133.    This was because the remote filespec might contain spaces, and so
  9134.    there would be no good way of telling where it ended and where the
  9135.    local name began, e.g:
  9136.    
  9137.   get profile exec a foo
  9138.  
  9139.    But now since we can use {braces} for grouping, we don't need the
  9140.    multiline GET form any more, and in fact, support for it has been
  9141.    removed. If you give a GET command by itself on a line, it fails and
  9142.    an error message is printed. The new form is:
  9143.    
  9144.    GET [ switches... ] remote-name [ local-name ]
  9145.           Ask the server to send the file whose name is remote-name. If
  9146.           the optional local-name is given, store it locally under this
  9147.           name. If the remote-name or local-name contains spaces, they
  9148.           must be enclosed in braces:
  9149.           
  9150.   get {profile exec a} foo
  9151.   get oofa.txt {~/My Files/Oofa text}
  9152.  
  9153.    If you want to give a list of remote file specifications, use the MGET
  9154.    command:
  9155.    
  9156.    MGET [ switches... ] remote-name [ remote-name [ remote-name ... ] ]
  9157.           Ask the server to send the files whose names are given.
  9158.           
  9159.    Now you can also include modifier switches between GET or MGET and the
  9160.    remote-name; most of the same switches as SEND:
  9161.    
  9162.    /AS-NAME:text
  9163.           Specifies "text" as the name to store the incoming file under.
  9164.           (This switch is not available for MGET.) You can also still
  9165.           specify the as-name as the second filename on the GET command
  9166.           line. The following two commands are equivalent:
  9167.           
  9168.   get oofa.txt oofa.new
  9169.   get /as:oofa.new oofa.txt
  9170.  
  9171.    /BINARY
  9172.           Tells the server to send the given file(s) in binary mode
  9173.           without affecting the global transfer mode. Example:
  9174.           
  9175.   set file type text      ; Set global transfer mode to text
  9176.   get /binary oofa.zip    ; get a file in binary mode
  9177.   get oofa.txt            ; This one is transferred in text mode
  9178.  
  9179.           Or, perhaps more to the point:
  9180.           
  9181.   get /binary foo.txt     ; where "*.txt" is a text-pattern
  9182.  
  9183.           This has the expected effect only if the server is C-Kermit 7.0
  9184.           or later or K95 1.1.19 or later.
  9185.           
  9186.    /COMMAND
  9187.           GET /COMMAND is equivalent to CGET ([492]Section 4.2.2) -- it
  9188.           says to receive the file into the standard input of a command,
  9189.           rather than saving it on disk. The /AS-NAME or the second
  9190.           "filename" on the GET command line is interpreted as the name
  9191.           of a command. Examples:
  9192.           
  9193.   get /command sunday.txt {grep Sunday oofa.txt}
  9194.   get /command /as-name:{grep Sunday oofa.txt} sunday.txt
  9195.   get /bin /command {!gunzip -c | tar xf -} {tar cf - . | gzip -c}
  9196.  
  9197.    /DELETE
  9198.           Asks the Kermit server to delete the file (or each file in the
  9199.           group) after it has been transferred successfully (but not to
  9200.           delete it if it was not sent successfully). GET /DELETE is
  9201.           equivalent to RETRIEVE. Example:
  9202.           
  9203.   get /delete *.log
  9204.  
  9205.    /EXCEPT:pattern
  9206.           Specifies that any files whose names match the pattern, which
  9207.           can be a regular filename, or may contain "*" and/or "?"
  9208.           metacharacters, are to be refused upon arrival. To specify
  9209.           multiple patterns (up to 8), use outer braces around the group,
  9210.           and inner braces around each pattern:
  9211.           
  9212.   /EXCEPT:{{pattern1}{pattern2}...}
  9213.  
  9214.           See the description of SEND /EXCEPT in [493]Section 4.7.1 for
  9215.           examples, etc. Refusal is accomplished using the Attribute
  9216.           Rejection mechanism (reason "name"), which works only when
  9217.           Attribute packets have been successfully negotiated.
  9218.           
  9219.    /FILENAMES:{CONVERTED,LITERAL}
  9220.           Use this switch to override the current global SET FILE NAMES
  9221.           setting for this transfer only.
  9222.           
  9223.    /FILTER:command
  9224.           This specifies a filter to pass the incoming file through
  9225.           before writing to disk. See the [494]section on file-transfer
  9226.           pipes and filters. The /FILTER switch applies only to the
  9227.           file-transfer command it is given with; it does not affect the
  9228.           global RECEIVE FILTER setting, if any.
  9229.           
  9230.    /IMAGE
  9231.           VMS: Transfer in image mode. Non-VMS: same as /BINARY.
  9232.           
  9233.    /LABELED
  9234.           VMS and OS/2 only: Specifies labeled transfer mode.
  9235.           
  9236.    /MOVE-TO:directory
  9237.           This tells C-Kermit to move each file that is successfully
  9238.           received to the given directory. Files that are not
  9239.           successfully received are not moved. By default, files are not
  9240.           moved.
  9241.           
  9242.    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE,AUTO}
  9243.           Use this switch to override the current global SET RECEIVE
  9244.           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE
  9245.           or RELATIVE also sets /FILENAMES:LITERAL (also for this
  9246.           transfer only) since incoming pathnames would not be treated as
  9247.           pathnames otherwise. See [495]Section 4.10.
  9248.           
  9249.    /QUIET
  9250.           When sending in local mode, this suppresses the file-transfer
  9251.           display.
  9252.           
  9253.    /RECOVER
  9254.           Used to recover from a previously interrupted transfer; GET
  9255.           /RECOVER is equivalent to REGET. Recovery only works in binary
  9256.           mode; SEND /RECOVER and RESEND include an implied /BINARY
  9257.           switch. Even then, recovery will successful only if (a) the
  9258.           original (interrupted) transfer was also in binary mode, or (b)
  9259.           if it was in text mode, the two Kermit programs run on
  9260.           platforms where text-mode transfers are not length-changing.
  9261.           
  9262.    /RECURSIVE
  9263.           Tells the server that the GET file specification applies
  9264.           recursively. This switch also automatically sets
  9265.           /PATHNAMES:RELATIVE in both the server AND the client. When
  9266.           used in conjunction with /DELETE, this "moves" a directory tree
  9267.           from the server's computer to the client's computer (except
  9268.           that only regular files are deleted from the server's computer,
  9269.           not directories; thus the original directories will be left,
  9270.           but will contain no files). Note that all servers that support
  9271.           /RECURSIVE do not necessarily do so in combination with other
  9272.           switches, such as /RECOVER. (Servers that do include C-Kermit
  9273.           7.0 and later, K95 1.1.19 and later.)
  9274.           
  9275.    /RENAME-TO:string
  9276.           This tells C-Kermit to rename each file that is successfully
  9277.           received to the given string. Files that are not successfully
  9278.           received are not renamed. By default, files are not renamed.
  9279.           The string can be a literal string, which is appropriate when
  9280.           only one file is being received, or it can contain one or more
  9281.           variables that are to be evaluated at the time each file is
  9282.           received, such as \v(filename), \v(filenumber), \v(ntime),
  9283.           \v(pid), \v(user), etc. WARNING: if you give a literal string
  9284.           and more than one file arrives, each incoming file will be
  9285.           given the same name (but SET FILE COLLISION BACKUP or RENAME
  9286.           can be used to keep the incoming files from overwriting each
  9287.           other).
  9288.           
  9289.    /TEXT
  9290.           Tells the server to perform this transfer in text mode without
  9291.           affecting its global transfer mode. See /BINARY for additional
  9292.           info.
  9293.           
  9294.    The /MAIL and /PRINT options are not available (as they are for SEND),
  9295.    but you can use /COMMAND to achieve the same effect, as in these UNIX
  9296.    examples:
  9297.    
  9298.   get /command oofa.txt {mail kermit@columbia.edu}
  9299.   get /command oofa.txt lpr
  9300.  
  9301.    In OS/2 or Windows, you can GET and print like this:
  9302.    
  9303.   get oofa.txt prn
  9304.  
  9305.    The CGET, REGET, RETRIEVE commands also accept the same switches as
  9306.    GET. CGET automatically sets /COMMAND; REGET automatically sets
  9307.    /RECOVER and /BINARY, and RETRIEVE automatically sets /DELETE.
  9308.      _________________________________________________________________
  9309.    
  9310.     4.7.3. RECEIVE Command Switches
  9311.     
  9312.    Without switches, the RECEIVE command still works as before:
  9313.    
  9314.   receive            ; Receives files under their own names
  9315.   receive /tmp       ; Ditto, but into the /tmp directory
  9316.   r                  ; Same as "receive"
  9317.   receive foo.txt    ; Receives a file and renames to foo.txt
  9318.  
  9319.    Now you can also include modifier switches may be included between
  9320.    "receive" and the as-name; most of the same switches as GET:
  9321.    
  9322.    /AS-NAME:text
  9323.           Specifies "text" as the name to store the incoming file under.
  9324.           You can also still specify the as-name as a filename on the
  9325.           command line. The following two commands are equivalent:
  9326.           
  9327.   r oofa.new
  9328.   r /as:oofa.new
  9329.  
  9330.    /BINARY
  9331.           Performs this transfer in binary mode without affecting the
  9332.           global transfer mode. NOTE: This does not override the incoming
  9333.           filetype (as it does with GET), so this switch is useful only
  9334.           if ATTRIBUTE TYPE is OFF, or if the other Kermit does not send
  9335.           a TYPE (text or binary) attribute. In any case, it has no
  9336.           affect whatsoever on the file sender.
  9337.           
  9338.    /COMMAND
  9339.           RECEIVE /COMMAND is equivalent to CRECEIVE ([496]Section 4.2.2)
  9340.           -- it says to receive the file into the standard input of a
  9341.           command, rather than saving it on disk. The /AS-NAME or the
  9342.           "filename" on the RECEIVE command line is interpreted as the
  9343.           name of a command.
  9344.           
  9345.   r /command {grep Sunday oofa.txt}
  9346.   r /command /as-name:{grep Sunday oofa.txt}
  9347.   r /bin /command {tar cf - . | gzip -c}
  9348.  
  9349.    /EXCEPT:pattern
  9350.           Specifies that any files whose names match the pattern, which
  9351.           can be a regular filename, or may contain "*" and/or "?"
  9352.           metacharacters, are to be refused upon arrival. To specify
  9353.           multiple patterns (up to 8), use outer braces around the group,
  9354.           and inner braces around each pattern:
  9355.           
  9356.   /EXCEPT:{{pattern1}{pattern2}...}
  9357.  
  9358.           See the description of SEND /EXCEPT in [497]Section 4.7.1 for
  9359.           examples, etc. Refusal is accomplished using the Attribute
  9360.           Rejection mechanism (reason "name"), which works only when
  9361.           Attribute packets have been successfully negotiated.
  9362.           
  9363.    /FILENAMES:{CONVERTED,LITERAL}
  9364.           Use this switch to override the current global SET FILE NAMES
  9365.           setting for this transfer only.
  9366.           
  9367.    /FILTER:command
  9368.           This specifies a filter to pass the incoming file through
  9369.           before writing to disk. See the [498]section on file-transfer
  9370.           pipes and filters. The /FILTER switch applies only to the
  9371.           file-transfer command it is given with; it does not affect the
  9372.           global RECEIVE FILTER setting, if any.
  9373.           
  9374.    /IMAGE
  9375.           VMS: Transfer in image mode. Non-VMS: same as /BINARY. See
  9376.           comments under RECEIVE /BINARY.
  9377.           
  9378.    /LABELED
  9379.           VMS and OS/2 only: Specifies labeled transfer mode. See
  9380.           comments under RECEIVE /BINARY.
  9381.           
  9382.    /MOVE-TO:directory
  9383.           This tells C-Kermit to move each file that is successfully
  9384.           received to the given directory. Files that are not
  9385.           successfully received are not moved. By default, files are not
  9386.           moved.
  9387.           
  9388.    /PATHNAMES:{ABSOLUTE,RELATIVE,OFF,AUTO}
  9389.           Use this switch to override the current global SET RECEIVE
  9390.           PATHNAMES setting for this transfer only. See [499]Section
  9391.           4.10.
  9392.           
  9393.    /RECURSIVE
  9394.           When used with the RECEIVE command, /RECURSIVE is simply a
  9395.           synonym for /PATHNAMES:RELATIVE.
  9396.           
  9397.    /RENAME-TO:string
  9398.           This tells C-Kermit to rename each file that is successfully
  9399.           received to the given string. Files that are not successfully
  9400.           received are not renamed. By default, files are not renamed.
  9401.           The string can be a literal string, which is appropriate when
  9402.           only one file is being received, or it can contain one or more
  9403.           variables that are to be evaluated at the time each file is
  9404.           received, such as \v(filename), \v(filenumber), \v(ntime),
  9405.           \v(pid), \v(user), etc. WARNING: if you give a literal string
  9406.           and more than one file arrives, each incoming file will be
  9407.           given the same name (but SET FILE COLLISION BACKUP or RENAME
  9408.           can be used to keep the incoming files from overwriting each
  9409.           other).
  9410.           
  9411.    /QUIET
  9412.           When receiving in local mode, this suppresses the file-transfer
  9413.           display.
  9414.           
  9415.    /TEXT
  9416.           Receives in text mode without affecting the global transfer
  9417.           mode. See comments under RECEIVE /BINARY.
  9418.           
  9419.    The /MAIL and /PRINT options are not available, but you can use
  9420.    /COMMAND to achieve the same effect, as in these UNIX examples:
  9421.    
  9422.   r /command {mail kermit@columbia.edu}
  9423.   r /command lpr
  9424.  
  9425.    In OS/2 or Windows, you can RECEIVE and print like this:
  9426.    
  9427.   receive prn
  9428.  
  9429.    The CRECEIVE command now also accepts the same switches.
  9430.      _________________________________________________________________
  9431.    
  9432.   4.8. Minor Kermit Protocol Improvements
  9433.   
  9434.     4.8.1. Multiple Attribute Packets
  9435.     
  9436.    C-Kermit 7.0 now sends more than one Attribute packet if a file's
  9437.    attributes do not fit into a single packet of the negotiated length.
  9438.    If a particular attribute (such as file creation date-time) does not
  9439.    fit within the negotiated length (which will only happen when the
  9440.    negotiated length is around 20 or less), that attribute is not sent at
  9441.    all.
  9442.    
  9443.     4.8.2. Very Short Packets
  9444.     
  9445.    There are certain situations where extremely short packets must be
  9446.    used; 20 or 30 bytes at most. This can happen when one or more devices
  9447.    along the communication path have very small buffers and lack an
  9448.    effective means of flow control. Examples are sometimes cited
  9449.    involving radio modems.
  9450.    
  9451.    When the maximum packet length is shorter than certain packets that
  9452.    would be sent, those packets are either truncated or else broken up
  9453.    into multiple packets. Specifically:
  9454.    
  9455.     1. Parameter negotiation packets (I, S, and their ACKs) are truncated
  9456.        to the negotiated length. Any parameters that do not fit are reset
  9457.        to their default values. There is no provision in the Kermit
  9458.        protocol for fragmentation and reassembly of parameter strings.
  9459.     2. File header packets (containing the filename) are simply
  9460.        truncated. There is no provision in the Kermit protocol for
  9461.        fragmentation and reassembly of filenames.
  9462.     3. Attribute packets are fragmented and reassembled as described in
  9463.        4.8.1 without loss of data, except in case a field will not fit at
  9464.        all in the negotiated length (the longest attribute is usually the
  9465.        date and time of file creation/modification) because of the rule
  9466.        that attributes may not be broken across packets.
  9467.     4. Data packets and other packets are unaffected -- they can be as
  9468.        short as they need to be, within reason.
  9469.      _________________________________________________________________
  9470.    
  9471.   4.9. Wildcard / File Group Expansion
  9472.   
  9473.    "Wildcard" refers to the notation used in filenames to specify a group
  9474.    of files by pattern matching.
  9475.    
  9476.     4.9.1. In UNIX C-Kermit
  9477.     
  9478.    Prior to C-Kermit 7.0, C-Kermit was capable of expanding wildcard
  9479.    strings containing only the "metacharacters" '*' and '?':
  9480.    
  9481.    *
  9482.           Matches any sequence of zero or more characters. For example:
  9483.           "ck*.c" matches all files whose names start with "ck" and end
  9484.           with ".c", including "ck.c".
  9485.           
  9486.    ?
  9487.           Matches any single character. For example, "ck?.c" matches all
  9488.           files whose names are exactly 5 characters long and start with
  9489.           "ck" and end with ".c". When typing commands at the prompt, you
  9490.           must precede any question mark to be used for matching by a
  9491.           backslash (\) to override the normal function of question mark,
  9492.           which is providing menus and file lists.
  9493.           
  9494.    C-Kermit 7.0 adds the additional features that users of ksh, csh, and
  9495.    bash are accustomed to:
  9496.    
  9497.    [abc]
  9498.           Square brackets enclosing a list of characters matches any
  9499.           single character in the list. Example: ckuusr.[ch] matches
  9500.           ckuusr.c and ckuusr.h.
  9501.           
  9502.    [a-z]
  9503.           Square brackets enclosing a range of characters; the hyphen
  9504.           separates the low and high elements of the range. For example,
  9505.           [a-z] matches any character from a to z.
  9506.           
  9507.    [acdm-z]
  9508.           Lists and ranges may be combined. This example matches a, c, d,
  9509.           or m through z.
  9510.           
  9511.    {string1,string2,...}
  9512.           Braces enclose a list of strings to be matched. For example:
  9513.           ck{ufio,vcon,cmai}.c matches ckufio.c, ckvcon.c, or ckcmai.c.
  9514.           The strings may themselves contain metacharacters, bracket
  9515.           lists, or indeed, other lists of strings, but (when matching
  9516.           filenames) they may not contain directory separators.
  9517.           
  9518.           Thus, the metacharacters in filenames (and in any other field
  9519.           that can be a pattern, such as the IF MATCH pattern, SEND or
  9520.           GET exception lists, etc) are:
  9521.           
  9522.  * ? [ {
  9523.  
  9524.           And within braces only, comma (,) is a metacharacter.
  9525.           
  9526.    To include a metacharacter in a pattern literally, precede it with a
  9527.    backslash '\' (or two if you are passing the pattern to a macro).
  9528.    Examples:
  9529.    
  9530.   send a*b      ; Send all files whose names start with 'a' and end with 'b'.
  9531.   send a?b      ; Ditto, but the name must be exactly three characters long.
  9532.   send a[a-z]b  ; Ditto, but the second character must be a lowercase letter.
  9533.   send a[x\-z]b ; Ditto, except the second character must be 'x', '-', or 'y'.
  9534.   send a[ghi]b  ; Ditto, except the second character must be 'g', 'h', or 'i'.
  9535.   send a[?*]b   ; Ditto, except the second character must be '?' or '*'.
  9536.   send a[\?\*]b ; Same as previous.
  9537.   send *?[a-z]* ; All files with names containing at least one character
  9538.                 ; that is followed by a lowercase letter.
  9539.  
  9540.    Or, more practically:
  9541.    
  9542.   send ck[cuw]*.[cwh]  ; Send the UNIX C-Kermit source files.
  9543.  
  9544.    To refer to the C-Kermit sources files and makefile all in one
  9545.    filespec:
  9546.    
  9547.   {{makefile,ck[cuw]*.[cwh]}}
  9548.  
  9549.    (NOTE: if the entire pattern is a {stringlist}, you must enclose it it
  9550.    TWO pairs of braces, since the SEND command strips the outer brace
  9551.    pair, because of the "enclose in braces if the filename contains
  9552.    spaces" rule).
  9553.    
  9554.    If the makefile is called ckuker.mak:
  9555.    
  9556.   ck[cuw]*.{[cwh],mak}
  9557.  
  9558.    (NOTE: double braces are not needed here since the pattern does not
  9559.    both begin and end with a brace.)
  9560.    
  9561.    To add in all the C-Kermit text files:
  9562.    
  9563.   ck[cuw]*.{[cwh],mak,txt}
  9564.  
  9565.    All of these features can be used anywhere you would type a filename
  9566.    that is allowed to contain wildcards.
  9567.    
  9568.    When you are typing at the command prompt, an extra level of quoting
  9569.    is required for the '?' character to defeat its regular function of
  9570.    producing a list of files that match what you have typed so far, for
  9571.    example:
  9572.    
  9573.   send ck[cu]?
  9574.  
  9575.    lists all the files whose names start with ckc and cku. If you quote
  9576.    the question mark, it is used as a pattern-matching character, for
  9577.    example:
  9578.    
  9579.   send ck\?[ft]io.c
  9580.  
  9581.    sends all the file and communications i/o modules for all the
  9582.    platforms: ckufio.c, ckutio.c, ckvfio.c, ckvtio.c, etc.
  9583.    
  9584.    If, however, a filename actually contains a question mark and you need
  9585.    to refer to it on the command line, you must use three (3)
  9586.    backslashes. For example, if the file is actually called ck?fio.c, you
  9587.    would use:
  9588.    
  9589.   send ck\\\?fio.c
  9590.  
  9591.    Further notes on quoting:
  9592.    
  9593.      * A single backslash is sufficient for quoting a special character
  9594.        at the command prompt or in a command file. However, when passing
  9595.        patterns to macros you'll need double backslashes, and when
  9596.        referring to these patterns within the macro, you'll need to use
  9597.        \fcontents(\%1) (see [500]Section 1.11.5). You should enclose
  9598.        macro argument references in braces in case grouped arguments were
  9599.        passed. Example:
  9600.  
  9601.  define ismatch {
  9602.      if match {\fcont(\%1)} {\fcont(\%2)} {
  9603.          end 0 MATCH
  9604.      } else {
  9605.          end 1 NO MATCH
  9606.      }
  9607.  }
  9608.  ismatch ab*yz a*\\**z           ; Backslash must be doubled
  9609.  ismatch {abc def xyz} *b*e*y*   ; Braces must be used for grouping
  9610.      * Watch out for possible conflicts between {} in filename patterns
  9611.        and {} used for grouping multiple words into a single field, when
  9612.        the pattern has outer braces. For example, in:
  9613.  
  9614.      if match {abc xyz} {a* *z} echo THEY MATCH
  9615.        braces must be used to group "abc xyz" into a single string.
  9616.        Kermit strips off the braces before comparing the string with the
  9617.        pattern. Therefore:
  9618.  
  9619.  if match makefile {makefile,Makefile} echo THEY MATCH
  9620.        does not work, but:
  9621.  
  9622.  if match makefile {{makefile,Makefile}} echo THEY MATCH
  9623.        does.
  9624.      * If you use a pattern that has outer braces, like {*.txt,*.doc}, in
  9625.        a field that accepts a pattern list (like SEND /EXCEPT:xxx),
  9626.        you'll need to add two extra sets of outer braces:
  9627.  
  9628.  send /except:{{{*.txt,*.doc}}} *.*
  9629.  
  9630.    C-Kermit's new pattern matching capabilities are also used when
  9631.    C-Kermit is in server mode, so now you can send requests such as:
  9632.    
  9633.   get ck[cuw]*.[cwh]
  9634.  
  9635.    to a C-Kermit server without having to tell it to SET WILD SHELL
  9636.    first. Previously this would have required:
  9637.    
  9638.   mget ckc*.c ckc*.w ckc*.h cku*.c cku*.w cku*.h ckw*.c ckw*.w ckw*.h
  9639.  
  9640.    The new pattern matching features make SET WILD SHELL redundant, and
  9641.    barring any objections, it will eventually be phased out. (One
  9642.    possible reason for retaining it would be as an escape mechanism when
  9643.    Kermit does not understand the underlying file system.)
  9644.    
  9645.    By the way, patterns such as these are sometimes referred to as
  9646.    "regular expressions", but they are not quite the same. In a true
  9647.    regular expression (for example), "*" means "zero or more repetitions
  9648.    of the previous item", so (for example), "([0-9]*)" would match zero
  9649.    or more digits in parentheses. In Kermit (and in most shells), this
  9650.    matches one digit followed by zero or more characters, within
  9651.    parentheses. Here are some hints:
  9652.    
  9653.      * Although you can't match any sequence of digits (or letters, etc),
  9654.        you can match (say) 1, 2, or 3 of them in row. For example, the
  9655.        following pattern matches Kermit backup files (with backup numbers
  9656.        from 1 to 999):
  9657.  
  9658.  *.~{[1-9],[1-9][0-9],[1-9][0-9][0-9]}~
  9659.      * There is presently no NOT operator, so no way to match any
  9660.        character or string EXCEPT the one(s) shown.
  9661.        
  9662.    In other wildcarding news...
  9663.    
  9664.      * You may now "send xxx" where "xxx" is a directory name, and this
  9665.        will send all the files from the directory xxx, as if you had
  9666.        typed "send xxx/*". You can also use the special shorthand "send
  9667.        ." to send all the files from the current directory.
  9668.      * To easily skip over backup files (the ones whose names end like
  9669.        .~22~) when sending, you can use SEND /NOBACKUP (see [501]Section
  9670.        4.0.6 for details).
  9671.      * When choosing Kermit to expand wildcards, rather than the shell,
  9672.        you can choose whether "dot files" -- files whose names begin with
  9673.        ".", which are normally "invisible" -- should be matched:
  9674.  
  9675.  SET WILD KERMIT /NO-MATCH-DOT-FILES (this is the default)
  9676.  SET WILD KERMIT /MATCH-DOT-FILES    (this allows matching of "." files)
  9677.        or include the /DOTFILES or /NODOTFILES switch on the command you
  9678.        are using, such as SEND or DIRECTORY.
  9679.      * Commands such as DIRECTORY and SEND allow recursive directory
  9680.        traversal. There are also new functions for this to use in
  9681.        scripts. See [502]Section 4.11 for details.
  9682.        
  9683.    When building file lists in UNIX, C-Kermit follows symbolic links.
  9684.    Because of this, you might encounter any or all of the following
  9685.    phenomena:
  9686.    
  9687.      * Multiple copies of the same file; e.g. one from its real directory
  9688.        and others from links to its real directory, if both the real
  9689.        directory and the links to it are in the wildcard expansion list.
  9690.      * A command might unexpectedly "hang" for a long time because an NFS
  9691.        link might not be responding, or the directory you are looking at
  9692.        contains a link to a huge directory tree (example: "directory
  9693.        /recursive /etc" when /etc/spool is a symlink to /var/spool, which
  9694.        is a large organization's incoming email directory, containing
  9695.        tens of thousands of subdirectories).
  9696.        
  9697.    The size of the file list that Kermit can build is limited in most
  9698.    C-Kermit implementations. The limit, if any, depends on the
  9699.    implementation. Use the SHOW FEATURES command and look in the
  9700.    alphabetized options list for MAXWLD to see the value.
  9701.    
  9702.     4.9.2. In Kermit 95
  9703.     
  9704.    Kermit 95 1.1.19 and later uses the same pattern matching syntax as in
  9705.    UNIX, but (as always) you will encounter numerous difficulties if you
  9706.    use backslash (\) as the directory separator. In any command where K95
  9707.    parses filenames itself (that is, practically any file-oriented
  9708.    command except RUN), you can use forward slash (/) as the directory
  9709.    separator to avoid all the nasty conflicts.
  9710.    
  9711.     4.9.3. In VMS, AOS/VS, OS-9, VOS, etc.
  9712.     
  9713.    Platforms other than UNIX, Windows 95/98/NT, and OS/2 have their own
  9714.    filename matching capabilities that are, in general, different from
  9715.    Kermit's built-in ones and in any case might conflict with them. For
  9716.    example, [] encloses directory names in VMS.
  9717.    
  9718.    Nevertheless you can still use all the pattern-matching capabilities
  9719.    described in [503]Section 4.9.1 by loading a file list into an array
  9720.    (e.g. with \ffiles(*,&a), see [504]Section 4.11.3) and then using IF
  9721.    MATCH on the members.
  9722.      _________________________________________________________________
  9723.    
  9724.   4.10. Additional Pathname Controls
  9725.   
  9726.    In version 6.0 and earlier, C-Kermit's SET { SEND, RECEIVE } PATHNAMES
  9727.    command had only ON and OFF as options. In version 7.0, there are more
  9728.    choices:
  9729.    
  9730.    SET SEND PATHNAMES OFF
  9731.           When sending a file, strip all disk/directory information from
  9732.           the name. Example: "send /usr/olga/letters/oofa.txt" sends the
  9733.           file as "oofa.txt". This applies to actual filenames, not to
  9734.           any as-name you might specify.
  9735.           
  9736.    SET SEND PATHNAMES RELATIVE
  9737.           When sending a file, leave the pathname on as given. For
  9738.           example, if your current directory is /usr/olga, "send
  9739.           letters/oofa.txt" sends the file as "letters/oofa.txt", not
  9740.           "/usr/olga/letters/oofa.txt" or "letters.txt".
  9741.           
  9742.    SET SEND PATHNAMES ABSOLUTE
  9743.           When sending a file, convert its name to the full, absolute
  9744.           local pathname. For example, if your current directory is
  9745.           /usr/olga, "send letters/oofa.txt" sends the file as
  9746.           "/usr/olga/letters/oofa.txt". NOTE: Even with this setting,
  9747.           device and/or node names are not included. For example, in VMS,
  9748.           any node or device name is stripped; in Windows or OS/2, any
  9749.           disk letter is stripped.
  9750.           
  9751.    SET RECEIVE PATHNAMES OFF
  9752.           When receiving a file, strip all disk/directory information
  9753.           from the name before attempting to store it. This applies to
  9754.           incoming filename, not to any as-name you might specify.
  9755.           Example: If a file arrives under the name
  9756.           "/usr/olga/letters/oofa.txt" it is stored simply as "oofa.txt"
  9757.           in your download directory or, if no download directory has
  9758.           been specified, in your current directory.
  9759.           
  9760.    SET RECEIVE PATHNAMES RELATIVE
  9761.           When receiving a file, leave the pathname on as it appears in
  9762.           the incoming name, but if the incoming name appears to be
  9763.           absolute, make it relative to your current or download
  9764.           directory. Examples:
  9765.           
  9766.           + "oofa.txt" is stored as "oofa.txt".
  9767.           + "letters/oofa.txt" is stored as "letters/oofa.txt"; the
  9768.             "letters" subdirectory is created if it does not already
  9769.             exist.
  9770.           + "/usr/olga/letters/oofa.txt" is stored as
  9771.             "usr/olga/letters/oofa.txt" in your current or download
  9772.             directory, and the "usr", "usr/olga", etc, directories are
  9773.             created if they do not exist.
  9774.             
  9775.    SET RECEIVE PATHNAMES ABSOLUTE
  9776.           The incoming filename is used as given. Thus it cannot be
  9777.           stored unless the given path (if any) already exists or can be
  9778.           created. In this case, node, device, or disk designations are
  9779.           NOT stripped, since they most likely were given explicitly by
  9780.           the user as an as-name, meant to be used as given.
  9781.           
  9782.    SET RECEIVE PATHNAMES AUTO
  9783.           This is the default, and means RELATIVE if the sender tells me
  9784.           it is a recursive transfer, OFF otherwise.
  9785.           
  9786.    Set FILE NAMES CONVERTED now also affects pathnames too. When
  9787.    PATHNAMES are RELATIVE or ABSOLUTE and FILE NAMES are CONVERTED, the
  9788.    file sender converts its native directory-name format to UNIX format,
  9789.    and the file receiver converts from UNIX format to its native one;
  9790.    thus UNIX format is the common intermediate representation for
  9791.    directory hierarchies, as it is in the ZIP/UNZIP programs (which is
  9792.    why ZIP archives are transportable among, UNIX, DOS, and VMS).
  9793.    
  9794.    Here's an example in which a file is sent from Windows to UNIX with
  9795.    relative pathnames and FILE NAMES CONVERTED:
  9796.    
  9797.   Source name                Intermediate name      Destination Name
  9798.   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       k95/tmp/oofa.txt
  9799.  
  9800.    In a more complicated example, we send the same file from Windows to
  9801.    VMS:
  9802.    
  9803.   Source name                Intermediate name      Destination Name
  9804.   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       [.K95.TMP]OOFA.TXT
  9805.  
  9806.    (Note that disk letters and device designations are always stripped
  9807.    when pathnames are relative).
  9808.    
  9809.    As you can imagine, as more and more directory formats are considered,
  9810.    this approach keeps matters simple: on each platform, Kermit must know
  9811.    only its own local format and the common intermediate one. In most
  9812.    cases, the receiver can detect which format is used automatically.
  9813.      _________________________________________________________________
  9814.    
  9815.   4.11. Recursive SEND and GET: Transferring Directory Trees
  9816.   
  9817.    C-Kermit 7.0 in selected versions (UNIX, VMS, VOS, AOS/VS, Windows,
  9818.    and OS/2 at this writing) now permits the SEND command to traverse
  9819.    directories "recursively" if you ask it to; that is, to send files
  9820.    from the current or specified directory and all of its subdirectories
  9821.    too, and their subdirectories, etc. (Some other commands can do this
  9822.    too, including DIRECTORY.)
  9823.    
  9824.    This feature is new to UNIX, Windows, VOS, and OS/2. VMS and AOS/VS
  9825.    have always included "wildcard" or "template" characters that allow
  9826.    this, and in this case, recursive directory traversal could happen
  9827.    behind Kermit's back, i.e. Kermit does not have to do it itself (in
  9828.    VMS, the notation is "[...]" or "[directory...]"; in AOS/VS is "#").
  9829.    In C-Kermit 7.0, however, SEND /RECURSIVE is supported by C-Kermit
  9830.    itself for VMS.
  9831.      _________________________________________________________________
  9832.    
  9833.     4.11.1. Command-Line Options
  9834.     
  9835.    To descend a directory tree when sending files, use the -L
  9836.    command-line option to indicate that the send operation is to be
  9837.    recursive, and include a name or pattern to be sent. When giving a
  9838.    pattern, you should enclose it in quotes to prevent the shell from
  9839.    expanding it. Examples:
  9840.    
  9841.   $ kermit -Ls "/usr/olga/*" # send all of Olga's files in all her directories
  9842.   $ kermit -Ls foo.txt       # send all foo.txt files in this directory tree
  9843.   $ kermit -Ls "*.txt"       # send all .txt files in this directory tree
  9844.   $ kermit -Ls "letters/*"   # send all files in the letters directory tree
  9845.   $ kermit -Ls letters       # send all files in the letters directory tree
  9846.   $ kermit -Ls "*"           # send all files in this directory tree
  9847.   $ kermit -Ls .             # UNIX only: send all files in this directory tree
  9848.   $ kermit -s .              # UNIX only: a filename of . implies -L
  9849.  
  9850.    If you let the shell expand wildcards, Kermit only sends files whose
  9851.    names match files in the current or given directory, because the shell
  9852.    replaces an unquoted wildcard expression with the list of matching
  9853.    files -- and the shell does not build recursive lists. Note that the
  9854.    "." notation for the tree rooted at the current directory is allowed
  9855.    only in UNIX, since in Windows and OS/2, it means "*.*"
  9856.    (nonrecursive).
  9857.      _________________________________________________________________
  9858.    
  9859.     4.11.2. The SEND /RECURSIVE Command
  9860.     
  9861.    If you include the /RECURSIVE switch in a SEND (or MOVE, or similar)
  9862.    command, it means to descend the current or specified directory tree
  9863.    searching for files whose names match the given name or pattern. Since
  9864.    this is not terribly useful unless you also include pathnames with the
  9865.    outbound files, the /RECURSIVE switch also includes an implicit
  9866.    /PATHNAMES:RELATIVE switch (which you can undo by including an
  9867.    explicit /PATHNAMES switch after the /RECURSIVE switch).
  9868.    
  9869.    Examples:
  9870.    
  9871.    SEND /RECURSIVE *
  9872.           Sends all of the files in the current directory and all the
  9873.           files in all of its subdirectories, and all of their
  9874.           subdirectories, etc, including their relative pathnames. Empty
  9875.           directories are not sent.
  9876.           
  9877.    SEND /RECURSIVE /PATHNAMES:ABSOLUTE *
  9878.           Sends all of the files in the current directory and all the
  9879.           files in all of its subdirectories, and all of their
  9880.           subdirectories, etc, including their absolute pathnames.
  9881.           
  9882.    SEND /RECURSIVE /PATHNAMES:OFF *
  9883.           Sends all of the files in the current directory and all the
  9884.           files in all of its subdirectories, and all of their
  9885.           subdirectories, etc, without pathnames.
  9886.           
  9887.    SEND /RECURSIVE /usr/olga/*
  9888.           Sends all of the files in the /usr/olga directory and all the
  9889.           files in all of its subdirectories, and all of their
  9890.           subdirectories, etc.
  9891.           
  9892.    SEND /RECURSIVE /usr/olga (or /usr/olga/)
  9893.           Same as above. If the name is a directory name (with or without
  9894.           a trailing slash), its files are sent, and those of its
  9895.           subdirectories, and their subdirectories, etc (see [505]Section
  9896.           4.9).
  9897.           
  9898.    SEND /RECURSIVE /TEXT /usr/olga/*.txt
  9899.           As above, but only files whose names end with ".txt" are sent,
  9900.           and they are sent in text mode (as they would be by default
  9901.           anyway if SET FILE PATTERNS is ON or AUTO).
  9902.           
  9903.    SEND .
  9904.           UNIX only: Send all the files in the current directory.
  9905.           
  9906.    SEND /RECURSIVE .
  9907.           UNIX only: Sends all of the files in the current directory and
  9908.           all of its subdirectories, etc ([506]Section 4.9).
  9909.           
  9910.    The /RECURSIVE switch is different from most other switches in that
  9911.    its effect is immediate (but still local to the command in which it is
  9912.    given), because it determines how filenames are to be parsed. For
  9913.    example, "send *.txt" fails with a parse error ("No files match") if
  9914.    there are no *.txt files in the current directory, but "send
  9915.    /recursive *.txt" succeeds if there are ".txt" files anywhere in the
  9916.    tree rooted at the current directory.
  9917.    
  9918.    The /RECURSIVE switch also affects the file lists displayed if you
  9919.    type "?" in a filename field. "send ./?" lists the regular files in
  9920.    the current directory, but "send /recursive ./?" lists the entire
  9921.    directory tree rooted at the current directory.
  9922.      _________________________________________________________________
  9923.    
  9924.     4.11.3. The GET /RECURSIVE Command
  9925.     
  9926.    In a client/server setting, the client can also request a recursive
  9927.    transfer with:
  9928.    
  9929.    GET /RECURSIVE [ other switches ] remote-filespec [ local-spec ]
  9930.    
  9931.    In which remote file specification can be a directory name, a
  9932.    filename, a wildcard, or any combination. If the local-spec is not
  9933.    given (and PATHNAMES are RELATIVE), incoming files and directories go
  9934.    into the current local directory. If local-spec is given and is a
  9935.    directory, it becomes the root of the tree into which the incoming
  9936.    files and directories are placed. If local-spec has the syntax of a
  9937.    directory name (e.g. in UNIX it ends with /), C-Kermit creates the
  9938.    directory and then places the incoming files into it. If local-spec is
  9939.    a filename (not recommended), then all incoming files are stored with
  9940.    that name with collisions handled according to the FILE COLLISION
  9941.    setting.
  9942.    
  9943.    Again, the normal method for transferring directory trees uses
  9944.    relative pathnames, and this is the default when the sender has been
  9945.    given the /RECURSIVE switch. The action at the receiver depends on its
  9946.    RECEIVE PATHNAMES setting. The default is AUTO, meaning that if the
  9947.    sender tells it to expect a recursive transfer, then it should
  9948.    automatically switch to relative pathnames for this transfer only;
  9949.    otherwise it obeys the RECEIVE PATHNAMES setting of OFF, ABSOLUTE, or
  9950.    RELATIVE.
  9951.    
  9952.    What happens if a file arrives that has an absolute pathname, when the
  9953.    receiver has been told to use only relative pathnames? As a security
  9954.    precaution, in this case the receiver treats the name as if it was
  9955.    relative. For example, if a file arrives as:
  9956.    
  9957.   /usr/olga/oofa.txt
  9958.  
  9959.    The receiver creates a "usr" subdirectory in its current directory,
  9960.    and then an "olga" subdirectory under the "usr" subdirectory in which
  9961.    to store the incoming file.
  9962.    
  9963.    Suppose, however there is a sequence of directories:
  9964.    
  9965.   /usr/olga/a/b/c/d/
  9966.  
  9967.    in which "a" contains nothing but a subdirectory "b", which in turn
  9968.    contains nothing but a subdirectory "c", which in turn contains
  9969.    nothing but a subdirectory "d", which contains nothing at all. Thus
  9970.    there are no files in the "/usr/olga/a/" tree, and so it is not sent,
  9971.    and therefore it is not reproduced on the target computer.
  9972.      _________________________________________________________________
  9973.    
  9974.     4.11.4. New and Changed File Functions
  9975.     
  9976.    C-Kermit 7.0 adds the following functions:
  9977.    
  9978.    \ffiles(pattern[,&a])
  9979.           This function has been changed to match only regular files in
  9980.           the current or given directory, and to take an optional array
  9981.           name as a second argument (explained below).
  9982.           
  9983.    \fdirectories(pattern[,&a])
  9984.           Returns the number of directories that match the given pattern.
  9985.           If the pattern does not include a directory, then the search is
  9986.           performed in the current directory.
  9987.           
  9988.    \frfiles(pattern[,&a])
  9989.           Returns the number of files in the current or given directory
  9990.           and all of its subdirectories, and their subdirectories, etc,
  9991.           that match the given pattern. Warning -- this one can take
  9992.           quite some time if performed at the root of a large directory
  9993.           tree.
  9994.           
  9995.    \frdirectories(pattern[,&a])
  9996.           Returns the number of directories in the current or given
  9997.           directory and all of its subdirectories, and their
  9998.           subdirectories, etc, that match the given pattern.
  9999.           
  10000.    Each of these functions builds up a list of files to be returned by
  10001.    the \fnextfile() function, just as \ffiles() always has done. (This
  10002.    can also be done with the /ARRAY switch of the DIRECTORY command; see
  10003.    [507]Sections 4.5.1 and [508]7.10).
  10004.    
  10005.    Each of these functions can be given an array name as an optional
  10006.    second argument. If an array name is supplied, the array will contain
  10007.    the number of files as its 0th element, and the filenames in elements
  10008.    1 through last. If the array already existed, its previous contents
  10009.    are lost. For example, if the current directory contains two files,
  10010.    oofa.txt and foo.bar, then "\ffiles(*,&a)" creates an array \&a[] with
  10011.    a dimension of 2, containing the following elements:
  10012.    
  10013.  \&a[0] = 2
  10014.  \&a[1] = oofa.txt
  10015.  \&a[2] = foo.bar
  10016.  
  10017.    If no files match the specification given in the first argument, the
  10018.    array gets a dimension of 0, which is the same as undeclaring the
  10019.    array.
  10020.    
  10021.    Note that the order in which the array is filled (and in which
  10022.    \fnextfile() returns filenames) is indeterminate (but see [509]Section
  10023.    7.10.5).
  10024.    
  10025.    Here's an example that builds and prints a list of all the file whose
  10026.    names end in .txt in the current directory and all its descendents:
  10027.    
  10028.   asg \%n \frfiles(*.txt)
  10029.   declare \&a[\%n]
  10030.   for \%i 1 \%n 1 {
  10031.       asg \&a[\%i] \fnextfile()
  10032.       echo \flpad(\%i,4). "\&a[\%i]"
  10033.   }
  10034.  
  10035.    Alternatively, using the array method, and then printing the filenames
  10036.    in alphabetic order (see [510]Section 7.10.3 and [511]7.10.5):
  10037.    
  10038.   asg \%n \frfiles(*.txt,&a)
  10039.   sort &a
  10040.   for \%i 1 \%n 1 {
  10041.       echo \flpad(\%i,4). "\&a[\%i]"
  10042.   }
  10043.  
  10044.    Or even more simply:
  10045.    
  10046.   asg \%n \frfiles(*.txt,&a)
  10047.   sort &a
  10048.   show array &a
  10049.  
  10050.    As noted elsewhere, the file lists built by \ffiles(), \frfiles(),
  10051.    etc, are now "safe" in the sense that SEND and other file-related
  10052.    commands can reference \fnextfile() without resetting the list:
  10053.    
  10054.   set send pathnames relative
  10055.   for \%i 1 \frfiles(*.txt) 1 {
  10056.       asg \%a \fnextfile()
  10057.       echo Sending \%a...
  10058.       send \%a
  10059.       if fail break
  10060.   }
  10061.  
  10062.    Copying to an array (as shown on p.398 of [512]Using C-Kermit 2nd Ed)
  10063.    is no longer necessary.
  10064.      _________________________________________________________________
  10065.    
  10066.     4.11.5. Moving Directory Trees Between Like Systems
  10067.     
  10068.     4.11.5.1. UNIX to UNIX
  10069.     
  10070.    Transferring a directory tree from one computer to another replicates
  10071.    the file sender's arrangement of files and directories on the file
  10072.    receiver's computer. Normally this is done using relative pathnames,
  10073.    since the user IDs might not be identical on the two computers. Let's
  10074.    say both computers are UNIX based, running C-Kermit 7.0 or later. On
  10075.    the sending computer (leaving out the connection details, etc):
  10076.    
  10077.   C-Kermit> cd /usr/olga
  10078.   C-Kermit> send /recursive .
  10079.  
  10080.    The /RECURSIVE switch tells C-Kermit to descend through the directory
  10081.    tree and to include relative pathnames on outbound filenames.
  10082.    
  10083.    On the receiving computer:
  10084.    
  10085.   C-Kermit> mkdir olgas-files           ; Make a new directory.
  10086.   C-Kermit> cd olgas-files              ; CD to it.
  10087.   C-Kermit> receive /recursive          ; = /PATHNAMES:RELATIVE
  10088.  
  10089.    Each Kermit program recognizes that the other is running under UNIX
  10090.    and switches to binary mode and literal filenames automatically.
  10091.    Directories are automatically created on the receiving system as
  10092.    needed. File dates and permissions are automatically reproduced from
  10093.    source to destination.
  10094.    
  10095.     4.11.5.2. VMS to VMS
  10096.     
  10097.    To send recursively from VMS, simply include the /RECURSIVE switch,
  10098.    for example at the sender:
  10099.    
  10100.   $ kermit
  10101.   C-Kermit> cd [olga]
  10102.   C-Kermit> send /recursive *.*;0
  10103.  
  10104.    And at the receiver:
  10105.    
  10106.   C-Kermit> cd [.olga]
  10107.   C-Kermit> receive /recursive
  10108.  
  10109.    The notation "..." within directory brackets in VMS means "this
  10110.    directory and all directories below it"; the /RECURSIVE switch, when
  10111.    given to the sender, implies the use of "..." in the file
  10112.    specification so you don't have to include "..."; but it makes no
  10113.    difference if you do:
  10114.    
  10115.   $ kermit
  10116.   C-Kermit> send /recursive [olga...]*.*;0
  10117.  
  10118.    And at the receiver:
  10119.    
  10120.   C-Kermit> cd [.olga]
  10121.   C-Kermit> receive /recursive
  10122.  
  10123.    In either case, since both systems recognize each other as VMS, they
  10124.    switch into LABELED transfer mode automatically.
  10125.      _________________________________________________________________
  10126.    
  10127.     4.11.6. Moving Directory Trees Between Unlike Systems
  10128.     
  10129.    There are several difficulties with recursive transfers between unlike
  10130.    systems:
  10131.    
  10132.      * File formats can be different, especially text files character
  10133.        sets and record formats. This can now be handled by using SET FILE
  10134.        PATTERN, SET FILE TEXT-PATTERNS, and SET FILE BINARY-PATTERNS
  10135.        ([513]Section 4.3).
  10136.      * File naming conventions are different. For example, one system
  10137.        might allow (and use) longer filenames than the other. You can
  10138.        tell Kermit how to handle file names with the normal "set file
  10139.        names" and "set file collision" mechanisms. Most modern Kermits
  10140.        are fairly tolerant of illegal filenames and should not fail
  10141.        simply because of an incoming filename; rather, it will do its
  10142.        best to convert it to a recognizable and unique legal filename.
  10143.      * Directory notations can be different, e.g. backslashes instead of
  10144.        slashes, brackets, parentheses, spaces, etc. But this is now
  10145.        handled by converting pathnames to a standard format during
  10146.        transfer ([514]Section 4.10).
  10147.        
  10148.    So now, for the first time, it is possible to send directory trees
  10149.    among any combination of UNIX, DOS, Windows, OS/2, VMS, AOS/VS, etc.
  10150.    Here's an example sending files from an HP-UX system (where text files
  10151.    are encoded in the HP Roman8 character set) to a PC with K95 (where
  10152.    text files are encoded in CP850):
  10153.    
  10154.  Sender:
  10155.   cd xxx                           ; CD to root of source tree
  10156.   set file type binary             ; Default transfer mode
  10157.   set file character-set hp-roman8 ; Local character set for text files
  10158.   set xfer character-set latin1    ; Transfer character set
  10159.   set file patterns on             ; Enable automatic file-type switching...
  10160.   set file binary-patterns *.Z *.gz *.o  ; based on these patterns...
  10161.   set file text-patterns *.txt *.c *.h   ; for binary and text files.
  10162.   send /recursive *                ; Send all the file in this directory tree
  10163.  
  10164.  Receiver:
  10165.   cd yyy                           ; CD to root of destination tree
  10166.   set file character-set cp850     ; Local character set for text files
  10167.   receive /pathnames:relative      ; Receive with pathnames
  10168.  
  10169.    Notes:
  10170.      * Replace "xxx" and "yyy" with the desired directories.
  10171.      * Replace the file character sets appropriately.
  10172.      * Change the patterns as needed (or just use the built-in default
  10173.        lists).
  10174.      * SEND /RECURSIVE also implies /PATHNAMES:RELATIVE.
  10175.      * The file sender tells the file receiver the transfer mode of each
  10176.        file.
  10177.      * The file sender tells the file receiver the transfer character
  10178.        set.
  10179.      * By default, destination file dates will be the same as on the
  10180.        source.
  10181.      * Many of the settings shown might already be set by default.
  10182.      * See [515]Sections 4.3, [516]4.10, and [517]4.15 for additional
  10183.        explanation.
  10184.        
  10185.    If you are refreshing an existing directory on the destination
  10186.    computer, use "set file collision update" or other appropriate file
  10187.    collision option to handle filename collisions.
  10188.      _________________________________________________________________
  10189.    
  10190.   4.12. Where Did My File Go?
  10191.   
  10192.    Now that Kermit can be started by clicking on desktop icons (thus
  10193.    obscuring the concept of "current directory"), and can have a download
  10194.    directory, and can create directories for incoming files on the fly,
  10195.    etc, sometimes it is easy to lose a file after transfer. Of course, if
  10196.    you keep a transaction log:
  10197.    
  10198.   LOG TRANSACTIONS
  10199.  
  10200.    it will record the fate and final resting place of each file. But in
  10201.    case you did not keep a log, the new command:
  10202.    
  10203.   WHERE
  10204.  
  10205.    added in C-Kermit 7.0, gives you as much information as it has about
  10206.    the location of the last files transferred, including the pathname
  10207.    reported by the receiving Kermit, if any, when C-Kermit is the sender.
  10208.    This information was also added to SHOW FILE in somewhat less detail.
  10209.      _________________________________________________________________
  10210.    
  10211.   4.13. File Output Buffer Control
  10212.   
  10213.    (UNIX only). The new command SET FILE OUTPUT lets you control how
  10214.    incoming files are written to disk:
  10215.    
  10216.    SET FILE OUTPUT BUFFERED [ size ]
  10217.           Chooses buffered file output; this is the default. UNIX does
  10218.           its normal sort of disk buffering. The optional size specifies
  10219.           Kermit's own file output buffer size, and therefore the
  10220.           frequency of disk accesses (write() system calls) -- the bigger
  10221.           the size, the fewer the disk accesses.
  10222.           
  10223.    SET FILE OUTPUT UNBUFFERED [ size ]
  10224.           This forces each file output write() call to actually commit
  10225.           the data to disk immediately. Choosing this option will usually
  10226.           slow file reception down.
  10227.           
  10228.    SET FILE OUTPUT BLOCKING
  10229.           Write() calls should not return until they are complete. This
  10230.           is the normal setting, and it lets Kermit detect disk-write
  10231.           errors immediately.
  10232.           
  10233.    SET FILE OUTPUT NONBLOCKING
  10234.           Write() calls should return immediately. This can speed up file
  10235.           reception, but also delay the detection of disk-write errors.
  10236.           
  10237.    Experimentation with these parameters should be harmless, and might
  10238.    (or might not) have a perceptible, even dramatic, effect on
  10239.    performance.
  10240.      _________________________________________________________________
  10241.    
  10242.   4.14. Improved Responsiveness
  10243.   
  10244.    In version 7.0, C-Kermit's file-transfer protocol engine has been
  10245.    tuned for additional speed and responsiveness.
  10246.    
  10247.      * Binary-mode transfers over 8-bit connections, a very common case,
  10248.        are now handled in a special way that minimizes overhead.
  10249.      * SET TRANSFER CRC-CALCULATION is now OFF by default, rather than
  10250.        ON. (This affects only the overall per-transfer CRC, \v(crc16),
  10251.        not the per-packet CRCs)
  10252.      * Connection loss during file transfer is now detected immediately
  10253.        in most cases on Internet connections and on serial connections
  10254.        when CARRIER-WATCH is not set to OFF.
  10255.      _________________________________________________________________
  10256.    
  10257.   4.15. Doubling and Ignoring Characters for Transparency
  10258.   
  10259.    The following commands were added in 7.0, primarily to allow
  10260.    successful file transfer through ARPAnet TACs and with Honeywell DPS6
  10261.    systems, but can be used in any setting where they might be needed:
  10262.    
  10263.    SET SEND DOUBLE-CHAR { [ char [ char [ ... ] ] ], NONE }
  10264.           Tells C-Kermit to double the specified characters (use decimal
  10265.           notation) in packets that it sends. For example, if you are
  10266.           sending files through a device that uses @ as an escape
  10267.           character, but allows you to send a single copy of @ through by
  10268.           doubling it, use "set send double 64".
  10269.           
  10270.    SET RECEIVE IGNORE-CHAR [ char [ char [ ... ] ] ]
  10271.           Tells C-Kermit to ignore the specified character(s) in incoming
  10272.           packets. Use this, for example, when something between the
  10273.           sender and receiver is inserting linefeeds for wrapping, NULs
  10274.           for padding, etc.
  10275.      _________________________________________________________________
  10276.    
  10277.   4.16. New File-Transfer Display Formats
  10278.   
  10279.    SET TRANSFER DISPLAY { BRIEF, CRT, FULLSCREEN, NONE, SERIAL }
  10280.           Selects the file-transfer display format.
  10281.           
  10282.    BRIEF is the new one. This writes one line to the screen per file,
  10283.    showing the file's name, transfer mode, size, the status of the
  10284.    transfer, and when the transfer is successful, the effective data rate
  10285.    in characters per second (CPS). Example:
  10286.    
  10287.   SEND ckcfn3.o (binary) (59216 bytes): OK (0.104 sec, 570206 cps)
  10288.   SEND ckcfns.o (binary) (114436 bytes): OK (0.148 sec, 772006 cps)
  10289.   SEND ckcmai.c (text) (79147 bytes): OK (0.180 sec, 438543 cps)
  10290.   SEND ckcmai.o (binary) (35396 bytes): OK (0.060 sec, 587494 cps)
  10291.   SEND ckcnet.o (binary) (62772 bytes): REFUSED
  10292.   SEND ckcpro.o (binary) (121448 bytes): OK (0.173 sec, 703928 cps)
  10293.   SEND ckcpro.w (text) (63687 bytes): OK (0.141 sec, 453059 cps)
  10294.   SEND makefile (text) (186636 bytes): OK (0.444 sec, 420471 cps)
  10295.   SEND wermit (binary) (1064960 bytes): OK (2.207 sec, 482477 cps)
  10296.  
  10297.    Note that transfer times are now obtained in fractional seconds,
  10298.    rather than whole seconds, so the CPS figures are more accurate (the
  10299.    display shows 3 decimal places, but internally the figure is generally
  10300.    precise to the microsecond).
  10301.      _________________________________________________________________
  10302.    
  10303.   4.17. New Transaction Log Formats
  10304.   
  10305.    The new command:
  10306.    
  10307.   SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF [ separator ] }
  10308.  
  10309.    lets you choose the format of the transaction log. VERBOSE (the
  10310.    default) indicates the traditional format described in the book. BRIEF
  10311.    and FTP are new. This command must be given prior to the LOG
  10312.    TRANSACTION command if a non-VERBOSE type is desired.
  10313.    
  10314.     4.17.1. The BRIEF Format
  10315.     
  10316.    BRIEF chooses a one-line per file format suitable for direct
  10317.    importation into databases like Informix, Oracle, or Sybase, in which:
  10318.    
  10319.      * Each record has 8 fields.
  10320.      * Fields are separated by a non-alphanumeric separator character.
  10321.      * The default separator character is comma (,).
  10322.      * Any field containing the separator character is enclosed in
  10323.        doublequotes.
  10324.      * The final field is enclosed in doublequotes.
  10325.        
  10326.    The fields are:
  10327.    
  10328.     1. Date in yyyymmdd format
  10329.     2. Time in hh:mm:ss format
  10330.     3. Action: SEND or RECV
  10331.     4. The local filename
  10332.     5. The size of the file
  10333.     6. The transfer mode (text, binary, image, labeled)
  10334.     7. The status of the transfer: OK or FAILED
  10335.     8. Additional status-dependent info, in doublequotes.
  10336.        
  10337.    Examples:
  10338.    
  10339.   20000208,12:08:52,RECV,/u/olga/oofa.txt,5246,text,OK,"0.284sec 18443cps"
  10340.   20000208,12:09:31,SEND,/u/olga/oofa.exe,32768,binary,OK,"1.243sec 26362cps"
  10341.   20000208,12:10:02,SEND,"/u/olga/a,b",10130,text,FAILED,"Refused: date"
  10342.  
  10343.    Note how the filename is enclosed in doublequotes in the final
  10344.    example, because it contains a comma.
  10345.    
  10346.    To obtain BRIEF format, you must give the SET TRANSACTION-LOG BRIEF
  10347.    command before the LOG TRANSACTIONS command. (If you give them in the
  10348.    opposite order, a heading is written to the log by the LOG command.)
  10349.      _________________________________________________________________
  10350.    
  10351.     4.17.2. The FTP Format
  10352.     
  10353.    SET TRANSACTION-LOG FTP (available only in UNIX) chooses a format that
  10354.    is compatible with the WU-FTPD (Washington University FTP daemon) log,
  10355.    and so can be processed by any software that processes the WU-FTPD
  10356.    log. It logs only transfers in and out, both successful and failed
  10357.    (but success or failure is not indicated, due to lack of a field in
  10358.    the WU-FTPD log format for this purpose). Non-transfer events are not
  10359.    recorded.
  10360.    
  10361.    Unlike other logs, the FTP-format transaction log is opened in append
  10362.    mode by default. This allows you to easily keep a record of all your
  10363.    kermit transfers, and it also allows the same log to be shared by
  10364.    multiple simultaneous Kermit processes or (permissions permitting)
  10365.    users. You can, of course, force creation of a new logfile by
  10366.    specifying the NEW keyword after the filename, e.g.
  10367.    
  10368.   log transactions oofa.log new
  10369.  
  10370.    All records in the FTP-style log are in a consistent format. The first
  10371.    field is fixed-length and contains spaces; subsequent fields are
  10372.    variable length, contain no spaces, and are separated by one or more
  10373.    spaces. The fields are:
  10374.    
  10375.    Timestamp
  10376.           This is an asctime-style timestamp, example: "Wed Sep 16
  10377.           20:19:05 1999" It is always exactly 24 characters long, and the
  10378.           subfields are always in fixed positions.
  10379.           
  10380.    Elapsed time
  10381.           The whole number of seconds required to transfer the file, as a
  10382.           string of decimal digits, e.g. "24".
  10383.           
  10384.    Connection
  10385.           The name of the network host to which C-Kermit is connected, or
  10386.           the name of the serial device through which it has dialed (or
  10387.           has a direct connection), or "/dev/tty" for transfers in remote
  10388.           mode.
  10389.           
  10390.    Bytes transferred
  10391.           The number of bytes transferred, decimal digits, e.g.
  10392.           "1537904".
  10393.           
  10394.    Filename
  10395.           The name of the file that was transferred, e.g.
  10396.           "/pub/ftp/kermit/a/README.TXT". If the filename contains any
  10397.           spaces or control characters, each such character is replaced
  10398.           by an underscore ('_') character.
  10399.           
  10400.    Mode
  10401.           The letter 'b' if the file was transferred in binary mode, or
  10402.           'a' if it was transferred in text (ASCII) mode.
  10403.           
  10404.    Options
  10405.           This field always contains an underscore ('_') character.
  10406.           
  10407.    Direction
  10408.           The letter 'o' if the file was transferred Out, and 'i' if the
  10409.           file was transferred In.
  10410.           
  10411.    User class
  10412.           The letter 'r' indicates the file was transferred by a Real
  10413.           user.
  10414.           
  10415.    User identification
  10416.           The ID of the user who transferred the file.
  10417.           
  10418.    Server identification
  10419.           The string "kermit". This distinguishes a Kermit transfer log
  10420.           record from a WU-FTPD record, which contains "ftp" in this
  10421.           field.
  10422.           
  10423.    Authentication class
  10424.           The digit '1' if we know the user's ID on the client system,
  10425.           otherwise '0'. Currently, always '0'.
  10426.           
  10427.    Authenticated user
  10428.           If the authentication class is '1', this is the user's ID on
  10429.           the client system. Otherwise it is an asterisk ('*'). Currently
  10430.           it is always an asterisk.
  10431.           
  10432.    Examples:
  10433.    
  10434.   Thu Oct 22 17:42:48 1998 0 * 94 /usr/olga/new.x a _ i r olga kermit 0 *
  10435.   Thu Oct 22 17:51:29 1998 1 * 147899 /usr/olga/test.c a _ o r olga kermit 0 *
  10436.   Thu Oct 22 17:51:44 1998 1 * 235 /usr/olga/test.o b _ i r olga kermit 0 *
  10437.   Fri Oct 23 12:10:25 1998 0 * 235 /usr/olga/x.ksc a _ o r olga kermit 0 *
  10438.  
  10439.    Note that an ftp-format transaction log can also be selected on the
  10440.    Kermit command line as follows:
  10441.    
  10442.   kermit --xferfile:filespec
  10443.  
  10444.    This is equivalent to:
  10445.    
  10446.   SET TRANSACTION-LOG FTP
  10447.   LOG TRANSACTIONS filespec APPEND
  10448.  
  10449.    Conceivably it could be possible to have a system-wide shared Kermit
  10450.    log, except that UNIX lacks any notion of an append-only file; thus
  10451.    any user who could append to the log could also delete it (or alter
  10452.    it). This problem could be worked around using setuid/setgid tricks,
  10453.    but these would most likely interfere with the other setuid/setgid
  10454.    tricks C-Kermit must use for getting at dialout devices and UUCP
  10455.    logfiles.
  10456.      _________________________________________________________________
  10457.    
  10458.   4.18. Unprefixing NUL
  10459.   
  10460.    As of 6.1.193 Alpha.10, C-Kermit can finally send and receive
  10461.    file-transfer packets in which NUL (ASCII 0) is unprefixed (no more
  10462.    NUL-terminated packets!). NUL is, of course, extremely prevalent in
  10463.    binary files such as executables, and this has been a significant
  10464.    source of packet overhead. For example, when transferring itself (the
  10465.    SunOS C-Kermit executable) with minimal prefixing and 9000-byte
  10466.    packets, we see:
  10467.    
  10468.   File size:                       1064960
  10469.   Packet chars with 0 prefixed:    1199629  overhead = 12.65%
  10470.   Packet chars with 0 unprefixed:  1062393  overhead = -0.03%
  10471.  
  10472.    Transfer rates go up accordingly, not only because of the reduced
  10473.    amount of i/o, but also because less computation is required on each
  10474.    end.
  10475.      _________________________________________________________________
  10476.    
  10477.   4.19. Clear-Channel Protocol
  10478.   
  10479.    Now that C-Kermit itself is capable of sending and receiving any byte
  10480.    at all on a clear channel ([518]Section 4.18), it is, for the first
  10481.    time, in a position to negotiate a clear channel with the other
  10482.    Kermit, giving it permission (but not requiring it) to unprefix any
  10483.    and all characters that it knows are safe. In general this means all
  10484.    but the Kermit start-of-packet character (normally Ctrl-A), Carriage
  10485.    Return (not only Kermit's end-of-packet character, but also treated
  10486.    specially on Telnet NVT links), and IAC (255, also special to Telnet).
  10487.    
  10488.    By default, C-Kermit will say it has a clear channel only if it has
  10489.    opened a TCP socket. Since the Kermit program on the far end of a
  10490.    TCP/IP connection generally does not know it has a TCP/IP connection,
  10491.    it will not announce a clear channel unless it has been told to do so.
  10492.    The command is:
  10493.    
  10494.    SET CLEAR-CHANNEL { ON, OFF, AUTO }
  10495.    
  10496.    AUTO is the default, meaning that the clear-channel status is
  10497.    determined automatically from the type of connection. ON means to
  10498.    announce a clear channel, OFF means not to announce it. Use SHOW
  10499.    STREAMING ([519]Section 4.20) to see the current CLEAR-CHANNEL status.
  10500.    Synonym: SET CLEARCHANNEL.
  10501.    
  10502.    CLEAR-CHANNEL is also set if you start C-Kermit with the -I switch
  10503.    (see [520]Section 4.20).
  10504.    
  10505.    Whenever a clear channel is negotiated, the resulting
  10506.    control-character unprefixing is "sticky"; that is, it remains in
  10507.    effect after the transfer so you can use SHOW CONTROL to see what was
  10508.    negotiated.
  10509.    
  10510.    You can also see whether a clear channel was negotiated in the
  10511.    STATISTICS /VERBOSE Display.
  10512.    
  10513.    The advantage of the clear channel feature is that it can make file
  10514.    transfers go faster automatically. The disadvantage would be
  10515.    file-transfer failures if the channel is not truly clear, for example
  10516.    if C-Kermit made a Telnet connection to a terminal server, and then
  10517.    dialed out from there; or if C-Kermit made an Rlogin connection to
  10518.    host and then made a Telnet connection from there to another host. If
  10519.    a file transfer fails on a TCP/IP connection, use SHOW CONTROL to
  10520.    check whether control characters became unprefixed as a result of
  10521.    protocol negotiations, and/or SHOW STREAMING ([521]Section 4.20) to
  10522.    see if "clear-channel" was negotiated. If this happened, use SET
  10523.    CLEAR-CHANNEL OFF and SET PREFIXING CAUTIOUS (or whatever) to prevent
  10524.    it from happening again.
  10525.      _________________________________________________________________
  10526.    
  10527.   4.20. Streaming Protocol
  10528.   
  10529.    A new Kermit protocol option called "streaming" was added in C-Kermit
  10530.    7.0. The idea is that if the two Kermit partners have a reliable
  10531.    transport (such as TCP/IP or X.25) between them, then there is no need
  10532.    to send ACKs for Data packets, or NAKs, since a reliable transport
  10533.    will, by definition, deliver all packets in order and undamaged. On
  10534.    such a connection, streaming cuts down not only on Kermit program
  10535.    overhead (switching back and forth between reading and sending
  10536.    packets), but also tends to make the underlying transport use itself
  10537.    more efficiently (e.g. by defeating the Nagle algorithm and/or Delayed
  10538.    ACK stratagem of the TCP layer). Furthermore, it allows transfers to
  10539.    work smoothly on extremely slow network congestions that would
  10540.    otherwise cause timeouts and retransmissions, and even failure when
  10541.    the retry limit was exceeded.
  10542.    
  10543.    The trick is knowing when we can stream:
  10544.    
  10545.     1. If C-Kermit has opened a TCP socket or X.25 connection, it offers
  10546.        stream.
  10547.     2. If C-Kermit has been started with the -I (uppercase) option, or if
  10548.        it has been told to SET RELIABLE ON, it offers to stream.
  10549.     3. If C-Kermit is in remote mode, and has been told to SET RELIABLE
  10550.        AUTO (or ON), it always offers to stream, and also always agrees
  10551.        to stream, if the other Kermit offers. Unless you take explicit
  10552.        actions to override the defaults, this allows the local Kermit
  10553.        (the one that made the connection, and so knows whether it's
  10554.        reliable) to control streaming.
  10555.        
  10556.    (Note that an offer to stream also results in a Clear-Channel
  10557.    announcement if CLEAR-CHANNEL is set to AUTO; see [522]Section 4.19.)
  10558.    
  10559.    When BOTH Kermits offer to stream, then they stream; otherwise they
  10560.    don't. Thus streaming-capable Kermit programs interoperate
  10561.    automatically and transparently with nonstreaming ones. If the two
  10562.    Kermits do agree to stream, you'll see the word "STREAMING" on the
  10563.    fullscreen file-transfer display in the Window Slots field. You can
  10564.    also find out afterwards with the STATISTICS or SHOW STREAMING
  10565.    commands.
  10566.    
  10567.      WARNING: Automatic choice of streaming is based on the assumption
  10568.      of a "direct" end-to-end network connection; for example, a Telnet
  10569.      or Rlogin connection from host A to host B, and transferring files
  10570.      between A and B. However, if your connection has additional
  10571.      components -- something "in the middle" (B) that you have made a
  10572.      network connection to, which makes a separate connection to the
  10573.      destination host (C), then you don't really have a reliable
  10574.      connection, but C-Kermit has no way of knowing this; transferring
  10575.      files between A and C will probably fail. In such cases, you'll
  10576.      need to tell the *local* C-Kermit to "set reliable off" before
  10577.      transferring files (it does no good to give this command to the
  10578.      remote Kermit since the local one controls the RELIABLE setting).
  10579.      
  10580.    Streaming is like using an infinite window size, with no timeouts and
  10581.    no tolerance for transmission errors (since there shouldn't be any).
  10582.    It relies on the underlying transport for flow control, error
  10583.    correction, timeouts, and retransmission. Thus it is very suitable for
  10584.    use on TCP/IP connections, especially slow or bursty ones, since
  10585.    Kermit's packet timeouts won't interfere with the transfer -- each
  10586.    packet takes as long to reach its destination as it takes TCP to
  10587.    deliver it. If TCP can't deliver the packet within its own timeout
  10588.    period (over which Kermit has no control), it signals a fatal error.
  10589.    Just like FTP.
  10590.    
  10591.    Streaming goes much faster than non-streaming when a relatively small
  10592.    packet length is used, and it tends to go faster than non-streaming
  10593.    with even the longest packet lengths. The Kermit window size is
  10594.    irrelevant to streaming protocol, but still might affect performance
  10595.    in small ways since it can result in different paths through the code.
  10596.    
  10597.    The definition of "reliable transport" does not necessarily demand
  10598.    8-bit and control-character transparency. Streaming can work with
  10599.    parity and/or control-character prefixing just as well (but not as
  10600.    fast) as without them; in such cases you can leave RELIABLE set to ON,
  10601.    but set CLEARCHANNEL and/or PARITY appropriately.
  10602.    
  10603.    Maximum performance -- comparable to and often exceeding FTP -- is
  10604.    achieved on socket-to-socket connections (in which the considerable
  10605.    overhead of the terminal driver and Telnet or Rlogin server is
  10606.    eliminated) with long packets and the new "brief" file-transfer
  10607.    display ([523]Section 4.16).
  10608.      _________________________________________________________________
  10609.    
  10610.     4.20.1. Commands for Streaming
  10611.     
  10612.    SET RELIABLE { ON, OFF, AUTO }
  10613.           SET RELIABLE ON tells Kermit that it has a reliable transport.
  10614.           SET RELIABLE OFF tells Kermit the transport is not reliable.
  10615.           SET RELIABLE AUTO tells Kermit that it should SET RELIABLE ON
  10616.           whenever it makes a reliable connection (e.g. TELNET or SET
  10617.           HOST on a TCP/IP or X.25 network), and when in remote mode it
  10618.           should believe the transport is reliable if the other Kermit
  10619.           says it is during Kermit protocol negotiation.
  10620.           
  10621.    AUTO is the default; the Kermit program that makes the connection
  10622.    knows whether it is reliable, and tells the remote Kermit.
  10623.    
  10624.    The RELIABLE setting has several effects, including:
  10625.    
  10626.      * It can affect the timeouts used during normal ACK/NAK protocol.
  10627.      * It can affect the clear-channel announcement.
  10628.      * It can affect streaming.
  10629.        
  10630.    If you TELNET or SET HOST somewhere, this includes an implicit SET
  10631.    RELIABLE ON command. The -I command-line option is equivalent to SET
  10632.    RELIABLE ON.
  10633.    
  10634.    Since SET RELIABLE ON (and -I) also implies SET CLEAR CHANNEL ON, you
  10635.    might find that in certain cases you need to tell Kermit that even
  10636.    though the connection is reliable, it doesn't have a clear channel
  10637.    after all:
  10638.    
  10639.   SET CLEAR-CHANNEL OFF
  10640.   SET PREFIXING CAUTIOUS ; or whatever...
  10641.  
  10642.    You can control streaming without affecting the other items with:
  10643.    
  10644.   SET STREAMING { ON, OFF, AUTO }
  10645.  
  10646.    AUTO is the default, meaning streaming will occur if Kermit has made a
  10647.    TCP/IP connection or if RELIABLE is ON (or it was started with the -I
  10648.    command line option). OFF means don't stream; ON means offer to stream
  10649.    no matter what.
  10650.      _________________________________________________________________
  10651.    
  10652.     4.20.2. Examples of Streaming
  10653.     
  10654.    Here we look at the use and behavior of streaming on several different
  10655.    kinds of connections, and compare its performance with non-streaming
  10656.    transfers.
  10657.    
  10658.     4.20.2.1. Streaming on Socket-to-Socket Connections
  10659.     
  10660.    Here we get streaming automatically when both Kermit programs are
  10661.    capable of it, since they both make socket connections. For example,
  10662.    on the far end:
  10663.    
  10664.   C-Kermit> set host * 3000
  10665.   C-Kermit> server
  10666.  
  10667.    and on the near end:
  10668.    
  10669.   C-Kermit> set host foo.bar.xyz.com 3000
  10670.   (now give SEND and GET command)
  10671.  
  10672.    All subsequent file transfers use streaming automatically.
  10673.    
  10674.    Here are the results from 84 trials, run on a production network,
  10675.    disk-to-disk, in which a 1-MB binary file (the SunOS C-Kermit Sparc
  10676.    executable) was sent from a Sun Sparc-10 with SunOS 4.1.3 to an IBM
  10677.    Power Server 850 with AIX 4.1, socket-to-socket, over a 10Mbps 10BaseT
  10678.    Ethernet, using minimal control-character unprefixing, window sizes
  10679.    from 10 to 32, and packet sizes from 1450 to 9010:
  10680.    
  10681.                 Streaming    Nonstreaming
  10682.   Max CPS         748955        683354
  10683.   Min CPS         221522        172491
  10684.   Mean CPS        646134        558680
  10685.   Median CPS      678043        595874
  10686.   Std Dev         101424        111493
  10687.  
  10688.    Correlations:
  10689.    
  10690.   CPS and window size:   -0.036
  10691.   CPS and packet length:  0.254
  10692.   CPS and streaming:      0.382
  10693.  
  10694.    Note that the relationship between streaming and throughput is
  10695.    significantly stronger than that between CPS and window size or packet
  10696.    length.
  10697.    
  10698.    Also note that this and all other performance measurements in this
  10699.    section are snapshots in time; the results could be much different at
  10700.    other times when the load on the systems and/or the network is higher
  10701.    or lower.
  10702.    
  10703.    In a similar socket-to-socket trial, but this time over a wide-area
  10704.    TCP/IP connection (from New York City to Logan, Utah, about 2000
  10705.    miles), the following results were obtained:
  10706.    
  10707.                 Streaming    Nonstreaming
  10708.   Max CPS         338226        318203
  10709.   Min CPS         191659        132314
  10710.   Mean CPS        293744        259240
  10711.   Median CPS      300845        273271
  10712.   Std Dev          41914         52351
  10713.  
  10714.    Correlations:
  10715.    
  10716.   CPS and window size:    0.164
  10717.   CPS and packet length:  0.123
  10718.   CPS and streaming:      0.346
  10719.      _________________________________________________________________
  10720.    
  10721.     4.20.2.2. Streaming on Telnet Connections
  10722.     
  10723.    In this case the local copy of Kermit is told to TELNET or SET HOST,
  10724.    and so it knows it has a reliable connection and -- unless it has been
  10725.    told not to -- will offer to stream, and the other Kermit program,
  10726.    since it has STREAMING set to AUTO, agrees.
  10727.    
  10728.    Since we have a reliable connection, we'll also get control-character
  10729.    unprefixing automatically because of the new clear-channel protocol
  10730.    ([524]Section 4.19).
  10731.    
  10732.    Any errors that occur during streaming are fatal to the transfer. The
  10733.    message is "Transmission error on reliable link". Should this happen:
  10734.    
  10735.     1. Check the remote Kermit's flow control setting (SHOW
  10736.        COMMUNICATIONS). If it is NONE, change it to XON/XOFF, or vice
  10737.        versa. If it is XON/XOFF (or you just changed it to XOFF/XOFF),
  10738.        make sure the file sender is prefixing the XON and XOFF
  10739.        characters. In the most drastic case, use "set prefix all" to
  10740.        force prefixing of all control characters.
  10741.     2. The remote Telnet server might chop off the 8th bit. In that case,
  10742.        tell C-Kermit to "set parity space". Or, you might be able to
  10743.        force the Telnet to allow eight-bit data by telling C-Kermit to
  10744.        "set telopt binary request accept" -- that is, request the Telnet
  10745.        server to enter binary mode, and accept binary-mode bids from the
  10746.        server.
  10747.     3. The remote Telnet server might have a buffering limitation. If a
  10748.        and b don't cure the problem, tell the file receiver to "set
  10749.        receive packet-length 1000" (or other number -- use the largest
  10750.        one that works). This too, is no different from the non-streaming
  10751.        case (more about this in [525]Section 4.20.2.3).
  10752.        
  10753.    And remember you can continue interrupted binary-mode transfers where
  10754.    they left off with the RESEND (= SEND /RECOVER) command.
  10755.    
  10756.    Here are the figures for the same 84 trials between the same Sun and
  10757.    IBM hosts as in 4.20.2.1, on the same network, but over a Telnet
  10758.    connection rather than socket-to-socket:
  10759.    
  10760.                   Streaming    Nonstreaming
  10761.   Max CPS         350088        322523
  10762.   Min CPS          95547        173152
  10763.   Mean CPS        321372        281830
  10764.   Median CPS      342604        291469
  10765.   Std Dev          40503         29948
  10766.  
  10767.    Correlations:
  10768.    
  10769.   CPS and window size:    0.001
  10770.   CPS and packet length:  0.152
  10771.   CPS and streaming:      0.128
  10772.  
  10773.    Here the effect is not as emphatic as in the socket-to-socket case,
  10774.    yet on the whole streaming tends to be beneficial.
  10775.    
  10776.    Additional measurements on HP-UX using C-Kermit 7.0 Beta.06:
  10777.    
  10778.                   Windowing     Streaming
  10779.   HP-UX 8->8      not tested       14Kcps
  10780.   HP-UX 8->9      not tested       76Kcps
  10781.   HP-UX 8->10      36Kcps          66Kcps
  10782.   HP-UX 9->9      not tested      190Kcps
  10783.   HP-UX 9->10     160Kcps         378Kcps
  10784.      _________________________________________________________________
  10785.    
  10786.     4.20.2.3. Streaming with Limited Packet Length
  10787.     
  10788.    The IRIX telnet server (at least the ones observed in IRIX 5.3 and
  10789.    6.2) does not allow Kermit to send packets longer than 4096 bytes.
  10790.    Thus when sending from IRIX C-Kermit when it is on the remote end of a
  10791.    Telnet connection, the packet length must be 4K or less. Trials in
  10792.    this case (in which packet lengths range from 1450 to 4000) show a
  10793.    strong advantage for streaming, which would be evident in any other
  10794.    case where the packet length is restricted, and stronger the shorter
  10795.    the maximum packet length.
  10796.    
  10797.                   Streaming    Nonstreaming
  10798.   Max CPS         426187        366870
  10799.   Min CPS         407500        276517
  10800.   Mean CPS        415226        339168
  10801.   Median CPS      414139        343803
  10802.   Std Dev           6094         25851
  10803.  
  10804.    Correlations:
  10805.    
  10806.   CPS and window size:    0.116
  10807.   CPS and packet length:  0.241
  10808.   CPS and streaming:      0.901
  10809.      _________________________________________________________________
  10810.    
  10811.     4.20.2.4. Streaming on Dialup Connections
  10812.     
  10813.    Here "dialup" refers to a "direct" dialup connection, not a SLIP or
  10814.    PPP connection, which is only a particular kind of TCP/IP connection.
  10815.    
  10816.    Attempt this at your own risk, and then only if (a) you have
  10817.    error-correcting modems, and (b) the connections between the modems
  10818.    and computers are also error-free, perfectly flow-controlled, and free
  10819.    of interrupt conflicts. Streaming can be used effectively and to
  10820.    fairly good advantage on such connections, but remember that the
  10821.    transfer is fatal if even one error is detected (also remember that
  10822.    should a binary-mode transfer fail, it can be recovered from the point
  10823.    of failure with RESEND).
  10824.    
  10825.    To use streaming on an unreliable connection, you must tell both
  10826.    Kermits that the connection is reliable:
  10827.    
  10828.   kermit -I
  10829.  
  10830.    or:
  10831.    
  10832.   C-Kermit> set reliable on
  10833.  
  10834.    In this case, it will probably be necessary to prefix some control
  10835.    characters, for example if your connection is through a terminal
  10836.    server that has an escape character. Most Cisco terminal servers, for
  10837.    example, require Ctrl-^ (30, as well as its high-bit equivalent, 158)
  10838.    to be prefixed. To unprefix these, you'll need to defeat the "clear
  10839.    channel" feature:
  10840.    
  10841.   C-Kermit> set reliable on
  10842.   C-Kermit> set clear-channel off
  10843.   C-Kermit> set prefixing none
  10844.   C-Kermit> set control prefix 1 13 30 158 ; and whatever else is necessary
  10845.  
  10846.    Dialup trials were done using fixed large window and packet sizes.
  10847.    They compare uploading and downloading of two common types of files,
  10848.    with and without streaming. Configuration:
  10849.    
  10850.      HP-9000/715/33 -- 57600bps, RTS/CTS -- USR Courier V.34 --
  10851.      V.34+V.42, 31200bps -- USR V.34+ Rackmount -- 57600bps, RTS/CTS --
  10852.      Cisco terminal server -- Solaris 2.5.1. Packet size = 8000, Window
  10853.      Size = 30, Control Character Unprefixing Minimal (but including the
  10854.      Cisco escape character).
  10855.      
  10856.    Since this is not a truly reliable connection, a few trials failed
  10857.    when a bad packet was received (most likely due to UART overruns); the
  10858.    failure was graceful and immediate, and the message was informative.
  10859.    The results of ten successful trials uploading and downloading the two
  10860.    files with and without streaming are:
  10861.    
  10862.             Streaming..
  10863.             Off    On
  10864.    Upload   5194   5565   txt (= C source code, 78K)
  10865.             3135   3406   gz  (= gzip file, compressed, 85K)
  10866.  Download   5194   5565   txt
  10867.             3041   3406   gz
  10868.  
  10869.    Each CPS figure is the mean of 10 results.
  10870.    
  10871.    A brief test was also performed on a LAT-based dialout connection from
  10872.    a VAX 3100 with VMS 5.5 to a USR Courier V.34 connected to a DECserver
  10873.    700 at 19200 bps. The 1-MB Sparc executable downloaded from a Sun to
  10874.    the VAX at 1100cps without streaming and 1900cps with streaming, using
  10875.    8000-byte packets, 30 window slots, and minimal prefixing in both
  10876.    cases.
  10877.      _________________________________________________________________
  10878.    
  10879.     4.20.2.5. Streaming on X.25 Connections
  10880.     
  10881.    We have only limited access to X.25 networks. One trial was performed
  10882.    in which the 1MB Solaris 2.4 Sparc executable was transferred over a
  10883.    SunLink X.25 connection; nothing is known about the actual physical
  10884.    connection. With a packet length of 8000 and a window size of 30, the
  10885.    file transferred at 6400 cps (using a maximum of 6 window slots). With
  10886.    the same packet length, but with streaming, it transferred without
  10887.    mishap at 6710 cps, about 5% faster.
  10888.      _________________________________________________________________
  10889.    
  10890.     4.20.3. Streaming - Preliminary Conclusions
  10891.     
  10892.    The results vary with the particular connection, but are good overall.
  10893.    Although numerous lower-level tricks can be used to improve
  10894.    performance on specific platforms or connection methods, streaming
  10895.    occurs at a high, system-independent level of the Kermit protocol and
  10896.    therefore can apply to all types of platforms and (reliable)
  10897.    connections transparently.
  10898.      _________________________________________________________________
  10899.    
  10900.   4.21. The TRANSMIT Command
  10901.   
  10902.    Prior to C-Kermit 7.0, the TRANSMIT command transmitted in text or
  10903.    binary mode according to SET FILE TYPE { TEXT, BINARY }. But now that
  10904.    binary mode is likely to be the default for protocol transfers, it is
  10905.    evident that this not also an appropriate default for TRANSMIT, since
  10906.    binary-mode TRANSMIT is a rather specialized and tricky operation.
  10907.    Therefore, TRANSMIT defaults to text mode always, regardless of the
  10908.    FILE TYPE setting.
  10909.    
  10910.    C-Kermit 7.0 expands the capabilities of the TRANSMIT command by
  10911.    adding the following switches (see [526]Section 1.5). The new syntax
  10912.    is:
  10913.    
  10914.   TRANSMIT [ switches... ] filename
  10915.  
  10916.    Zero or more switches may be included:
  10917.    
  10918.    /PIPE
  10919.           When /PIPE is included, "filename" is interpreted as a system
  10920.           command or program whose output is to be sent. Synonym:
  10921.           /COMMAND. Example:
  10922.           
  10923.   transmit /pipe finger
  10924.  
  10925.           You may enclose the command in braces, but you don't have to:
  10926.           
  10927.   xmit /pipe {ls -l | sort -r +0.22 -0.32 | head}
  10928.  
  10929.    /BINARY
  10930.           Transmits the file (or pipe output) in binary mode.
  10931.           
  10932.    /TEXT
  10933.           Transmits the file (or pipe output) in line-oriented text mode.
  10934.           Current FILE CHARACTER-SET and TERMINAL CHARACTER-SET
  10935.           selections govern translation. Default.
  10936.           
  10937.    /TRANSPARENT
  10938.           Specifies text mode without character-set translation, no
  10939.           matter what the FILE and TERMINAL CHARACTER-SET selections are.
  10940.           
  10941.    /NOWAIT
  10942.           This is equivalent to SET TRANSMIT PROMPT 0, but for this
  10943.           TRANSMIT command only. Applies only to text mode; it means to
  10944.           not wait for any kind of echo or turnaround character after
  10945.           sending a line before sending the next line. (Normally Kermit
  10946.           waits for a linefeed.)
  10947.           
  10948.    When TRANSMIT ECHO is ON, C-Kermit tries to read back the echo of each
  10949.    character that is sent. Prior to C-Kermit 7.0, 1 second was allowed
  10950.    for each echo to appear; if it didn't show up in a second, the
  10951.    TRANSMIT command would fail. Similarly for the TRANSMIT PROMPT
  10952.    character. However, with today's congested Internet connections, etc,
  10953.    more time is often needed:
  10954.    
  10955.    SET TRANSMIT TIMEOUT number
  10956.    Specifies the number of seconds to wait for an echo or the prompt
  10957.    character when TRANSMIT PROMPT is nonzero; the default wait is 1
  10958.    second. If you specify 0, the wait is indefinite. When a timeout
  10959.    interval of 0 is specified, and a desired echo or prompt does not show
  10960.    up, the TRANSMIT command will not terminate until or unless you
  10961.    interrupt it with Ctrl-C; use SET TRANSMIT TIMEOUT 0 with caution.
  10962.    
  10963.    Note: to blast a file out the communications connection without any
  10964.    kind of synchronization or timeouts or other manner of checking, use:
  10965.    
  10966.   SET TRANSMIT ECHO OFF
  10967.   SET TRANSMIT PROMPT 0 (or include the /NOWAIT switch)
  10968.   SET TRANSMIT PAUSE 0
  10969.   TRANSMIT [ switches ] filename
  10970.  
  10971.    In this case, text-file transmission is not-line oriented and large
  10972.    blocks can be sent, resulting in a significant performance improvement
  10973.    over line-at-at-time transmission. Successful operation depends (even
  10974.    more than usual for the TRANSMIT command!) on a clean connection with
  10975.    effective flow control.
  10976.    
  10977.    For details on TRANSMIT and character sets, see [527]Section 6.6.5.4.
  10978.      _________________________________________________________________
  10979.    
  10980.   4.22. Coping with Faulty Kermit Implementations
  10981.   
  10982.    Kermit protocol has been implemented in quite a few third-party
  10983.    commercial, shareware, and freeware software packages, with varying
  10984.    degrees of success. In most cases operation is satisfactory but slow
  10985.    -- only the bare minimum subset of the protocol is available -- short
  10986.    packets, no sliding windows, no attributes, etc. In other cases, the
  10987.    implementation is incorrect, resulting in failures at the initial
  10988.    negotiation stage or corrupted files.
  10989.    
  10990.    C-Kermit 7.0 and Kermit 95 1.1.19 include some new defense mechanisms
  10991.    to help cope with the most common situations. However, bear in mind
  10992.    there is only so much we can do in such cases -- the responsibility
  10993.    for fixing the problem lies with the maker of the faulty software.
  10994.      _________________________________________________________________
  10995.    
  10996.     4.22.1. Failure to Accept Modern Negotiation Strings
  10997.     
  10998.    The published Kermit protocol specification states that new fields can
  10999.    be added to the parameter negotiation string. These are to be ignored
  11000.    by any Kermit implementation that does not understand them; this is
  11001.    what makes the Kermit protocol extensible. Unfortunately, some Kermit
  11002.    implementations become confused (or worse) when receiving a
  11003.    negotiation string longer than the one they expect. You can try
  11004.    working around such problems by telling Kermit to shorten its
  11005.    negotiation string (and thus disable the corresponding new features):
  11006.    
  11007.   SET SEND NEGOTIATION-STRING-MAX-LENGTH number
  11008.  
  11009.    Try a number like 10. If that doesn't work, try 9, 8, 7, 6, and so on.
  11010.      _________________________________________________________________
  11011.    
  11012.     4.22.2. Failure to Negotiate 8th-bit Prefixing
  11013.     
  11014.    The published Kermit protocol specification states that 8th-bit
  11015.    prefixing (which allows transfer of 8-bit data over a 7-bit
  11016.    connection) occurs if the file sender puts a valid prefix character
  11017.    (normally "&") in the 8th-bit-prefix field of the negotiation string,
  11018.    and the receiver puts either a letter "Y" or the same prefix
  11019.    character. At least one faulty Kermit implementation exists that does
  11020.    not accept the letter "Y". To force C-Kermit / K-95 to reply with the
  11021.    other Kermit's prefix character rather than a "Y", give the following
  11022.    (invisible) command:
  11023.    
  11024.   SET Q8FLAG ON
  11025.  
  11026.    Use SET Q8FLAG OFF to restore the normal behavior.
  11027.      _________________________________________________________________
  11028.    
  11029.     4.22.3. Corrupt Files
  11030.     
  11031.    Refer to [528]Section 4.22.2. Some Kermit implementations mistakenly
  11032.    interpret the "Y" as a prefix character. Then, whenever a letter Y
  11033.    appears in the data, the Y and the character that follows it are
  11034.    replaced by a garbage character. At this writing, we are not sure if
  11035.    there is any solution, but try "set send negotiation-string-max-length
  11036.    6" and/or "set q8flag on".
  11037.    
  11038.    File corruption can also occur when control characters within the file
  11039.    data are sent without prefixing, as at least some are by default in
  11040.    C-Kermit 7.0 and K-95. Some Kermit implementations do not handle
  11041.    incoming "bare" control characters. To work around, "set prefixing
  11042.    all".
  11043.      _________________________________________________________________
  11044.    
  11045.     4.22.4. Spurious Cancellations
  11046.     
  11047.    The Kermit protocol specification states that if an ACK to a Data
  11048.    packet contains X in its data field, the transfer of the current file
  11049.    is canceled, and if it contains a Z, the entire transfer is canceled.
  11050.    At least one overzealous Kermit implementation applies this rule to
  11051.    non-Data packets as well, the typical symptom being that any attempt
  11052.    to transfer a file whose name begins with X or Z results in
  11053.    cancellation. This is because the file receiver typically sends back
  11054.    the name under which it stored the file (which might not be the same
  11055.    as the name it was sent with) in the ACK to the File Header packet.
  11056.    This is information only and should not cause cancellation. To work
  11057.    around the problem, use:
  11058.    
  11059.   SET F-ACK-BUG { ON, OFF }
  11060.  
  11061.    ON tells Kermit not to send back the filename in the ACK to the file
  11062.    header packet as it normally would do (OFF puts Kermit back to normal
  11063.    after using ON).
  11064.    
  11065.    A variation on the this bug occurs in an obscure Kermit program for
  11066.    MUMPS: When this Kermit program sends a file called (say) FOO.BAR, it
  11067.    requires that the ACK to its F packet contain exactly the same name,
  11068.    FOO.BAR. However, C-Kermit likes to send back the full pathname,
  11069.    causing the MUMPS Kermit to fail. SET F-ACK-BUG ON doesn't help here.
  11070.    So a separate command has been added to handle this situation:
  11071.    
  11072.   SET F-ACK-PATH { ON, OFF }
  11073.  
  11074.    Normally it is ON (regardless of the SET SEND PATHNAMES setting). Use
  11075.    SET F-ACK-PATH OFF to instruct Kermit to send back only the filename
  11076.    without the path in the ACK to the F packet.
  11077.      _________________________________________________________________
  11078.    
  11079.     4.22.5. Spurious Refusals
  11080.     
  11081.    Some Kermit implementations, notably PDP-11 Kermit 3.60 and earlier,
  11082.    have bugs in their handling of Attribute packets that can cause
  11083.    unwarranted refusal of incoming files, e.g. based on date or size.
  11084.    This can be worked around by telling one or both of the Kermit
  11085.    partners to:
  11086.    
  11087.   SET ATTRIBUTES OFF
  11088.      _________________________________________________________________
  11089.    
  11090.     4.22.6. Failures during the Data Transfer Phase
  11091.     
  11092.    This can be caused by control-character unprefixing ([529]Section
  11093.    4.22.3 ), and fixed by:
  11094.    
  11095.   SET PREFIXING ALL
  11096.  
  11097.    It can also have numerous other causes, explained in Chapter 10 of
  11098.    [530]Using C-Kermit: the connection is not 8-bit transparent (so use
  11099.    "set parity space" or somesuch), inadequate flow control, etc. Consult
  11100.    the manual.
  11101.      _________________________________________________________________
  11102.    
  11103.     4.22.7. Fractured Filenames
  11104.     
  11105.    At least one well-known PC-based communications package negotiates
  11106.    data compression, which (according to the protocol specification)
  11107.    applies to both the filename and the file data, but then fails to
  11108.    decompress the filename. Example: C-Kermit sends a file called
  11109.    R000101.DAT (where 000101 might be non-Y2K-wise YYMMDD notation), and
  11110.    the package in question stores the files as R~#0101.DAT. Workaround:
  11111.    Tell C-Kermit to SET REPEAT COUNTS OFF.
  11112.      _________________________________________________________________
  11113.    
  11114.     4.22.8. Bad File Dates
  11115.     
  11116.    At least one well-known PC-based communications package negotiates the
  11117.    passing of file timestamps from sender to receiver, but when it is
  11118.    sending files, it always gives them a timestamp of 1 February 1970.
  11119.    Workaround: tell C-Kermit to SET ATTRIBUTE DATE OFF. You don't get the
  11120.    file's real date, but you also don't get 1 Feb 1970; instead the file
  11121.    gets the current date and time.
  11122.      _________________________________________________________________
  11123.    
  11124.   4.23. File Transfer Recovery
  11125.   
  11126.    Prior to C-Kermit 7.0, RESEND (SEND /RECOVER) and REGET (GET /RECOVER)
  11127.    refused to work if FILE TYPE was not BINARY or the /BINARY switch was
  11128.    not included. Now these commands include an implied /BINARY switch,
  11129.    meaning they set the file type to binary for the duration of the
  11130.    command automatically.
  11131.    
  11132.    In the client/server arrangement, this also forces the server into
  11133.    binary mode (if it is C-Kermit 7.0 or greater, or K95 1.1.19 or
  11134.    greater) so the recovery operation proceeds, just as you asked and
  11135.    expected.
  11136.    
  11137.    BUT... Just as before, the results are correct only under the
  11138.    following conditions:
  11139.    
  11140.      * If the prior interrupted transfer was also in binary mode; or:
  11141.      * If the prior transfer was in text mode and the other computer was
  11142.        a "like platform" (e.g. UNIX-to-UNIX, Windows-to-Windows,
  11143.        DOS-to-Windows) AND there was no character-set translation (i.e.
  11144.        TRANSFER CHARACTER-SET was TRANSPARENT).
  11145.        
  11146.    Note that these circumstances are more likely to obtain in C-Kermit
  11147.    7.0, in which:
  11148.    
  11149.      * The default FILE TYPE in C-Kermit 7.0 is BINARY.
  11150.      * The default FILE INCOMPLETE setting is AUTO, which means KEEP if
  11151.        the transfer is in binary mode, DISCARD otherwise.
  11152.      * C-Kermit 7.0, Kermit 95 1.1.17, and MS-DOS Kermit 3.15 and later
  11153.        can recognize "like platforms" and switch into binary mode
  11154.        automatically. Transfers between like platforms are always binary
  11155.        unless character-set translation has been requested, and then is
  11156.        still binary for all files whose names match a binary pattern,
  11157.        unless the automatic mechanisms have been disabled (with a /TEXT
  11158.        switch, or with SET TRANSFER MODE MANUAL).
  11159.      * SEND /BINARY and GET /BINARY always force binary-mode transfers,
  11160.        even when FILE TYPE is TEXT, even when TRANSFER MODE is AUTOMATIC,
  11161.        even when PATTERNS are ON and the file's name matches a text
  11162.        pattern.
  11163.        
  11164.    But also note that the automatic client/server transfer-mode
  11165.    adjustments do not work with versions of C-Kermit prior to 7.0 or K95
  11166.    prior to 1.1.16.
  11167.    
  11168.    If the prior transfer was in text mode:
  11169.    
  11170.      * If text-mode transfers between the two platforms are
  11171.        "length-changing" (as they are between UNIX -- which terminates
  11172.        text lines with LF -- and DOS or Windows -- which terminates text
  11173.        lines with CRLF), the recovered file will be corrupt.
  11174.      * If text-mode transfers between the two platforms are not
  11175.        length-changing, but character-set translation was active in the
  11176.        prior transfer, the result will be a file in which the first part
  11177.        has translated characters and the second part does not.
  11178.        
  11179.    But in C-Kermit 7.0 and K95 1.1.19 and later, incompletely transferred
  11180.    text files are not kept unless you change the default. But if you have
  11181.    done this, and you have an incompletely transferred text file, you'll
  11182.    need to:
  11183.    
  11184.      * Transfer the whole file again in text mode, or:
  11185.      * Use SEND /STARTING-AT: to recover the transfer at the correct
  11186.        point; but you have to find out what that point is, as described
  11187.        in the manual.
  11188.        
  11189.    Kermit has no way of knowing whether the previous transfer was in text
  11190.    or binary mode so it is your responsibility to choose the appropriate
  11191.    recovery method.
  11192.    
  11193.    If you use C-Kermit to maintain parallel directories on different
  11194.    computers, using SET FILE COLLISION to transfer only those files that
  11195.    changed since last time, and the files are big enough (or the
  11196.    connection slow enough) to require SEND /RECOVER to resume interrupted
  11197.    transfers, you should remember that SEND /RECOVER (RESEND) overrides
  11198.    all FILE COLLISION settings. Therefore you should use SEND /RECOVER
  11199.    (RESEND) only on the file that was interrupted, not the file group.
  11200.    For example, if the original transfer was initiated with:
  11201.    
  11202.   SEND *
  11203.  
  11204.    and was interrupted, then after reestablishing your connection and
  11205.    starting the Kermit receiver with SET FILE COLLISION UPDATE on the
  11206.    remote end, use the following sequence at the sender to resume the
  11207.    transfer:
  11208.    
  11209.   SEND /RECOVER name-of-interrupted-file
  11210.  
  11211.    and then:
  11212.    
  11213.   SEND *
  11214.  
  11215.    (In C-Kermit 7.0 and later, \v(filename) contains the name of the file
  11216.    most recently transferred, as long you have not EXITed from Kermit or
  11217.    changed directory, etc.
  11218.      _________________________________________________________________
  11219.    
  11220.   4.24. FILE COLLISION UPDATE Clarification
  11221.   
  11222.    In UNIX, file modification dates are used when comparing the file date
  11223.    with the date in the attribute packet. In VMS, however, the file
  11224.    creation date is used. These two policies reflect the preferences of
  11225.    the two user communities.
  11226.    
  11227.    Also, remember that the file date/time given in the attribute packet
  11228.    is the local time at the file sender. At present, no timezone
  11229.    conversions are defined in or performed by the Kermit protocol. This
  11230.    is primarily because this feature was designed at a time when many of
  11231.    the systems where Kermit runs had no concept of timezone, and
  11232.    therefore would be unable to convert (say, to/from GMT or UTC or Zulu
  11233.    time).
  11234.    
  11235.    As a consequence, some unexpected results might occur when
  11236.    transferring files across timezones; e.g. commands on the target
  11237.    system that are sensitive to file dates might work (UNIX "make",
  11238.    backups, etc).
  11239.    
  11240.    Timezone handling is deferred for a future release.
  11241.      _________________________________________________________________
  11242.    
  11243.   4.25. Autodownload Improvements
  11244.   
  11245.    Refer to pages 164-165 of [531]Using C-Kermit about the hazards of
  11246.    autodownload when C-Kermit is "in the middle". As of C-Kermit 7.0, no
  11247.    more hazards. If C-Kermit has TERMINAL AUTODOWNLOAD ON and it detects
  11248.    a packet of the current protocol type (Kermit or Zmodem), it "erases"
  11249.    the visual aspect of the packet that would be seen by the terminal
  11250.    (or, more to the point, the emulator, such as K95). This way, only
  11251.    C-Kermit goes into RECEIVE mode, and not also the terminal emulator
  11252.    through which C-Kermit is accessed. And therefore, it is no longer
  11253.    necessary to SET TERMINAL AUTODOWNLOAD OFF to prevent multiple Kermits
  11254.    from going into receive mode at once, but of course it is still
  11255.    necessary to ensure that, when you have multiple Kermits in a chain,
  11256.    that the desired one receives the autodownload.
  11257.    
  11258.    The defaults have not been changed; Kermit 95 still has autodownload
  11259.    ON by default, and C-Kermit has it OFF by default.
  11260.      _________________________________________________________________
  11261.    
  11262.   5. CLIENT/SERVER
  11263.   
  11264.   5.0. Hints
  11265.   
  11266.    If you use SET SERVER GET-PATH to set up your server, and the GET-PATH
  11267.    does not include the server's current directory, clients can become
  11268.    quite confused. For example, "remote dir oofa.txt" shows a file named
  11269.    oofa.txt, but "get oofa.txt" fails. In this situation, you should
  11270.    either DISABLE DIR or make your GET-PATH include the current
  11271.    directory.
  11272.      _________________________________________________________________
  11273.    
  11274.   5.1. New Command-Line Options
  11275.   
  11276.    The -G command-line option is like -g (GET), except the incoming file
  11277.    is sent to standard output rather than written to disk.
  11278.    
  11279.    The -I option ("Internet") is used to tell a remote C-Kermit program
  11280.    that you are coming in via Internet Telnet or Rlogin and therefore
  11281.    have a reliable connection. The -I option is equivalent to SET
  11282.    RELIABLE ON and SET FLOW NONE.
  11283.    
  11284.    The -O option ("Only One") tells C-Kermit to enter server mode but
  11285.    then exit after the first client operation.
  11286.    
  11287.    See [532]Section 9.3 for details.
  11288.      _________________________________________________________________
  11289.    
  11290.   5.2. New Client Commands
  11291.   
  11292.    BYE and FINISH no longer try to do anything if a connection is not
  11293.    active. Thus a sequence like "hangup" followed by "bye" or "finish"
  11294.    will no longer get stuck in a long timeout-and-retransmission cycle,
  11295.    nor will it try to open a new connection.
  11296.    
  11297.    REMOTE EXIT
  11298.           Similar to FINISH, except it ensures that the Kermit server
  11299.           program exits back to the operating system or shell prompt.
  11300.           (FINISH would return it to its interactive prompt if it was
  11301.           started in interactive mode, and would cause it to exit if it
  11302.           entered server mode via command-line option.) When C-Kermit is
  11303.           to be the server, you can use { ENABLE, DISABLE } EXIT to
  11304.           control the client's access to this feature.
  11305.           
  11306.    REMOTE MKDIR directory-name
  11307.           Tells the client to ask the server to create a directory with
  11308.           the given name, which can be absolute or relative. The syntax
  11309.           of the directory name depends on the Kermit server (see
  11310.           [533]next section); in all cases, it can be in the syntax of
  11311.           the system where the server is running (UNIX, VMS, DOS, etc)
  11312.           but newer servers also accept UNIX syntax, no matter what the
  11313.           underlying platform. The server will not execute this command
  11314.           if (a) it does not understand it, (b) a DISABLE MKDIR command
  11315.           has been given, or (c) a DISABLE CWD command has been given;
  11316.           otherwise, the command is executed, but will fail if the
  11317.           directory can not be created, in which cases most servers will
  11318.           attempt to return a message giving the reason for failure. The
  11319.           REMOTE MKDIR command succeeds if the remote directory is
  11320.           created, or if it already exists and therefore does not need to
  11321.           be created, and fails otherwise.
  11322.           
  11323.    REMOTE RMDIR directory-name
  11324.           Tells the client to ask the server to remove (delete) a
  11325.           directory with the given name. The same considerations apply as
  11326.           for REMOTE MKDIR.
  11327.           
  11328.    REMOTE SET FILE INCOMPLETE { DISCARD, KEEP, AUTO }
  11329.           Previously this was only available in its earlier form, REMOTE
  11330.           SET INCOMPLETE (no FILE). The earlier form is still available,
  11331.           but invisible. Also, AUTO was added, meaning KEEP if in binary
  11332.           mode, DISCARD otherwise.
  11333.           
  11334.    REMOTE SET TRANSFER MODE { AUTOMATIC, MANUAL }
  11335.           Tells the client to ask the server to set the given
  11336.           file-transfer mode. Automatic means (roughly): if the client
  11337.           and the server are running on the same kind of computer (e.g.
  11338.           both are on UNIX), then use binary mode automatically; if the
  11339.           system types are different, use some other method to
  11340.           automatically determine text or binary mode, such as filename
  11341.           pattern matching. MANUAL means, in this context, obey the
  11342.           client's FILE TYPE setting (TEXT or BINARY). Synonym: REMOTE
  11343.           SET XFER MODE.
  11344.           
  11345.    [ REMOTE ] QUERY KERMIT function(args...)
  11346.           Prior to C-Kermit 7.0, the arguments were not evaluated
  11347.           locally. Thus it was not possible to have the server run the
  11348.           function with client-side variables as arguments. Now:
  11349.           
  11350.   define \%a oofa.*
  11351.   remote query kermit files(\%a)    ; Client's \%a
  11352.   remote query kermit files(\\%a)   ; Server's \%a
  11353.  
  11354.    [ REMOTE ] LOGIN [ user [ password ] ]
  11355.           LOGIN is now a synonym for REMOTE LOGIN.
  11356.           
  11357.    LOGOUT
  11358.           This command, when given in local mode, is equivalent to REMOTE
  11359.           LOGOUT. When given at the IKSD prompt, it logs out the IKSD.
  11360.           When given at the C-Kermit prompt when it has no connection, it
  11361.           does nothing.
  11362.           
  11363.    Note that in C-Kermit 7.0, the REMOTE (or R) prefix is not required
  11364.    for QUERY, since there is no local QUERY command. The new top-level
  11365.    QUERY command does exactly what REMOTE QUERY (RQUERY) does.
  11366.    
  11367.    All REMOTE commands now have single-word shortcuts:
  11368.    
  11369.  Shortcut   Full Form
  11370.   RASG       REMOTE ASSIGN
  11371.   RCD        REMOTE CD
  11372.   RCOPY      REMOTE COPY
  11373.   RDEL       REMOTE DELETE
  11374.   RDIR       REMOTE DIRECTORY
  11375.   REXIT      REMOTE EXIT
  11376.   RHELP      REMOTE HELP
  11377.   RHOST      REMOTE HOST
  11378.   RPWD       REMOTE PWD
  11379.   RSET       REMOTE SET
  11380.   etc.
  11381.  
  11382.    The R prefix is not applied to LOGIN because there is already an
  11383.    RLOGIN command with a different meaning. It is not applied to LOGOUT
  11384.    either, since LOGOUT knows what to do in each case, and for symmetry
  11385.    with LOGIN.
  11386.      _________________________________________________________________
  11387.    
  11388.     5.2.1. Remote Procedure Definitions and Calls
  11389.     
  11390.    This is nothing new, but it might not be obvious... REMOTE ASSIGN and
  11391.    REMOTE QUERY may be used to achieve remote procedure execution. The
  11392.    remote procedure can be defined locally or remotely.
  11393.    
  11394.    A remote procedure call is accomplished as noted in the previous
  11395.    section:
  11396.    
  11397.   [ remote ] query kermit function-name(args...)
  11398.  
  11399.    This invokes any function that is built in to the Kermit server, e.g.:
  11400.    
  11401.   [ remote ] query kermit size(foo.bar)
  11402.  
  11403.    returns the size of the remote file, foo.bar.
  11404.    
  11405.    Now note that C-Kermit includes an \fexecute() function, allowing it
  11406.    to execute any macro as if it were a built-in function. So suppose
  11407.    MYMACRO is the name of a macro defined in the server. You can execute
  11408.    it from the client as follows (the redundant "remote" prefix is
  11409.    omitted in the remaining examples):
  11410.    
  11411.   query kermit execute(mymacro arg1 arg2...)
  11412.  
  11413.    The return value, if any, is the value of the RETURN command that
  11414.    terminated execution of the macro, for example:
  11415.    
  11416.   define addtwonumbers return \feval(\%1+\%2)
  11417.  
  11418.    The client invocation would be:
  11419.    
  11420.   query kermit execute(addtwonumbers 3 4)
  11421.   7
  11422.  
  11423.    The result ("7" in this case) is also assigned to the client's
  11424.    \v(query) variable.
  11425.    
  11426.    To execute a remote system command or command procedure (shell script,
  11427.    etc) use:
  11428.    
  11429.   query kermit command(name args...)
  11430.  
  11431.    Finally, suppose you want the client to send a macro to the server to
  11432.    be executed on the server end. This is done as follows:
  11433.    
  11434.   remote assign macroname definition
  11435.   query kermit execute(macroname arg1 arg2...)
  11436.  
  11437.    Quoting is required if the definition contains formal parameters.
  11438.      _________________________________________________________________
  11439.    
  11440.   5.3. New Server Capabilities
  11441.   
  11442.     5.3.1. Creating and Removing Directories
  11443.     
  11444.    The C-Kermit 7.0 server responds to REMOTE MKDIR and REMOTE RMDIR
  11445.    commands. The directory name may be in either the native format of the
  11446.    server's computer, or in UNIX format. For example, a server running on
  11447.    VMS with a current directory of [IVAN] can accept commands from the
  11448.    client like:
  11449.    
  11450.   remote mkdir olga         ; Makes [IVAN.OLGA] (nonspecific format)
  11451.   remote mkdir .olga        ; Makes [IVAN.OLGA] (VMS format without brackets)
  11452.   remote mkdir olga/        ; Makes [IVAN.OLGA] (UNIX relative format)
  11453.   remote mkdir /ivan/olga   ; Makes [IVAN.OLGA] (UNIX absolute format)
  11454.   remote mkdir [ivan.olga]  ; Makes [IVAN.OLGA] (VMS absolute format)
  11455.   remote mkdir [.olga]      ; Makes [IVAN.OLGA] (VMS relative format)
  11456.  
  11457.     5.3.1.1. Creating Directories
  11458.     
  11459.    If a directory name is given that contains more than one segment that
  11460.    does not exist, the server attempts to create all the segments. For
  11461.    example, if the client says:
  11462.    
  11463.   REMOTE MKDIR letters/angry
  11464.  
  11465.    a "letters" subdirectory is created in the server's current directory
  11466.    if it does not already exist, and then an "angry" subdirectory is
  11467.    created beneath it, if it does not already have one. This can repeated
  11468.    to any reasonable depth:
  11469.    
  11470.   REMOTE MKDIR a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/z/y/z
  11471.  
  11472.     5.3.1.2. Removing Directories
  11473.     
  11474.    When attempting to execute a REMOTE RMDIR, the server can remove only
  11475.    a single directory, not an entire sequence or tree. The system service
  11476.    that is called to remove the directory generally requires not only
  11477.    that the server process has write delete access, but also that the
  11478.    directory contain no files.
  11479.    
  11480.    In the future, a REMOTE RMDIR /RECURSIVE command (and the accompanying
  11481.    protocol) might be added. For now, use the equivalent REMOTE HOST
  11482.    command(s), if any.
  11483.      _________________________________________________________________
  11484.    
  11485.     5.3.2. Directory Listings
  11486.     
  11487.    Directory listings are generated by C-Kermit itself, rather than by
  11488.    running the underlying system's directory command. Some control over
  11489.    the listing format can be obtained with the SET OPTIONS DIRECTORY
  11490.    command ([534]Section 4.5.1). The following options affect listings
  11491.    sent by the server: /[NO]HEADING, /[NO]DOTFILES, and /[NO]BACKUP. In
  11492.    UNIX and VMS, the listing is always sorted by filename. There is, at
  11493.    present, no protocol defined for the client to request listing options
  11494.    of the server; this might be added in the future.
  11495.    
  11496.    The server's directory listings are in the following format:
  11497.    
  11498.    Protection or permissions:
  11499.           In UNIX and OS-9, this is a 10-character field, left adjusted.
  11500.           In VMS it is a 22-character field, left-adjusted. In each case,
  11501.           the protection / permission codes are shown in the server
  11502.           platform's native format. In other operating systems, this
  11503.           field is not shown.
  11504.           
  11505.    Size in bytes:
  11506.           This is always a 10-character field. The file's size is shown
  11507.           as a decimal number, right adjusted in the field. If the file
  11508.           is a directory and its size can not be obtained, the size is
  11509.           shown as "<DIR>". Two blanks follow this field.
  11510.           
  11511.    Date:
  11512.           Always in yyyy-mm-dd hh:mm:ss numeric format, and therefore 19
  11513.           characters long. If the file's date/time can't be obtained,
  11514.           zeros (0) are shown for all the digits. This field is followed
  11515.           by two blanks.
  11516.           
  11517.    Filename:
  11518.           This field extends to the end of the line. Filenames are shown
  11519.           relative to the server's current directory. In UNIX, symbolic
  11520.           links are shown as they are in an "ls -l" listing as "linkname
  11521.           -> filename".
  11522.           
  11523.    In UNIX and VMS, listings are returned by the server in alphabetical
  11524.    order of filename. There are presently no other sort or selection
  11525.    options.
  11526.    
  11527.    However, since these are fixed-field listings, all fields can be used
  11528.    as sort keys by external sort programs. Note, in particular, that the
  11529.    format used for the date allows a normal lexical on that field to
  11530.    achieve the date ordering. For example, let's assume we have a UNIX
  11531.    client and a UNIX server. In this case, the server's listing has the
  11532.    date in columns 22-40, and thus could be sorted by the UNIX sort
  11533.    program using "sort +0.22 -0.40" or in reverse order by "sort +0.22
  11534.    -0.40r".
  11535.    
  11536.    Since the UNIX client can pipe responses to REMOTE commands through
  11537.    filters, any desired sorting can be accomplished this way, for
  11538.    example:
  11539.    
  11540. C-Kermit> remote directory | sort +0.22 -0.40
  11541.  
  11542.    You can also sort by size:
  11543.    
  11544.   C-Kermit> remote directory | sort +0.11 -0.19
  11545.  
  11546.    You can use sort options to select reverse or ascending order. "man
  11547.    sort" (in UNIX) for more information. And of course, you can pipe
  11548.    these listings through any other filter of your choice, such as grep
  11549.    to skip unwanted lines.
  11550.      _________________________________________________________________
  11551.    
  11552.   5.4. Syntax for Remote Filenames with Embedded Spaces
  11553.   
  11554.    C-Kermit and K95, when in server mode, assume that any spaces in the
  11555.    file specification in an incoming GET command are filename separators.
  11556.    Thus if the client gives a command like:
  11557.    
  11558.   get {oofa.txt oofa.bin}
  11559.  
  11560.    or, equivalently:
  11561.    
  11562.   mget oofa.txt oofa.bin
  11563.  
  11564.    the server tries to send the two files, oofa.txt and oofa.bin. But
  11565.    what if you want the server to send you a file named, say:
  11566.    
  11567.   D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL
  11568.  
  11569.    How does the server know this is supposed to be one file and not
  11570.    seven? In this case, you need to the send file name to the server
  11571.    enclosed in either curly braces:
  11572.    
  11573.   {D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}
  11574.  
  11575.    or ASCII doublequotes:
  11576.    
  11577.   "D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"
  11578.  
  11579.    The method for doing this depends on your client. If your client is
  11580.    C-Kermit 7.0, any recent version of Kermit 95, or MS-DOS Kermit 3.16,
  11581.    then you have to enclose the name in braces just so the client can
  11582.    parse it, so to send braces or doublequotes to the server, you must
  11583.    put them inside the first, outside pair of braces. And you also need
  11584.    to double the backslashes to prevent them from being interpreted:
  11585.    
  11586.   get {{D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL}}
  11587.   get {"D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL"}
  11588.  
  11589.    To get around the requirement to double backslashes in literal
  11590.    filenames, of course you can also use:
  11591.    
  11592.   set command quoting off
  11593.   get {{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}}
  11594.   get {"D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"}
  11595.   set command quoting on
  11596.  
  11597.    If you are giving a "kermit" command to the UNIX shell, you have to
  11598.    observe the shell's quoting rules, something like this:
  11599.    
  11600.   kermit -ig "{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}"
  11601.  
  11602.    Here, the quotes go on the outside so UNIX will pass the entire
  11603.    filename, spaces, braces, and all, as a single argument to Kermit, and
  11604.    the backslashes are not doubled because (a) the UNIX shell ignores
  11605.    them since they are in a quoted string, and (b) Kermit ignores them
  11606.    since the interactive command parser is not activated in this case.
  11607.      _________________________________________________________________
  11608.    
  11609.   5.5. Automatic Orientation Messages upon Directory Change
  11610.   
  11611.    C-Kermit 7.0, when acting as a server, can send an orientation message
  11612.    to the client whenever the server directory changes. For example, when
  11613.    the client gives a REMOTE CD command, the server sends the contents of
  11614.    the new directory's "Read Me" file to the client's screen. The
  11615.    following commands govern this feature:
  11616.    
  11617.    SET SERVER CD-MESSAGE FILE name
  11618.           Given to the servr, allows the message-file name to be
  11619.           specified at runtime. A list of names to look for can be given
  11620.           in the following format:
  11621.           
  11622.   {{name1}{name2}{name3}{...}}
  11623.  
  11624.           e.g. SET SERVER CD-MESSAGE FILE
  11625.           {{./.readme}{README.TXT}{READ.ME}}
  11626.           
  11627.    REMOTE SET SERVER CD-MESSAGE { ON, OFF }
  11628.           Given to the client, lets the client control whether the server
  11629.           sends automatic CD messages.
  11630.           
  11631.    SHOW SERVER
  11632.           Given to server, includes CD-Message status.
  11633.           
  11634.    The default CD message file name is system dependent. SHOW CD or SHOW
  11635.    SERVER displays the list. Also see [535]Section 4.5.2.
  11636.      _________________________________________________________________
  11637.    
  11638.   5.6. New Server Controls
  11639.   
  11640.    DISABLE ENABLE
  11641.           Allows the server to configured such that DISABLEd features can
  11642.           not be re-enabled by any means -- e.g. if the client is somehow
  11643.           able to get the server into command mode. Once DISABLEd, ENABLE
  11644.           can not be re-ENABLEd.
  11645.           
  11646.    SET SERVER IDLE-TIMEOUT seconds
  11647.           This was available previously in Kermit 95 only. Now it can be
  11648.           used in C-Kermit also to specify a maximum number of seconds
  11649.           the server is allowed to be idle before exiting server mode. 0
  11650.           seconds means no idle timeout. In C-Kermit (but not K-95), SET
  11651.           SERVER TIMEOUT and SET SERVER IDLE-TIMEOUT are mutually
  11652.           exclusive -- you can have one or the other (or neither), but
  11653.           not both. (Server timeouts are for the benefit of primitive
  11654.           Kermit clients that are not capable of timing out on their own;
  11655.           to our knowledge, no such clients are still in circulation.)
  11656.           
  11657.    SET SERVER KEEPALIVE { ON, OFF }
  11658.           (See next section).
  11659.      _________________________________________________________________
  11660.    
  11661.   5.7. Timeouts during REMOTE HOST Command Execution
  11662.   
  11663.    Prior to C-Kermit 7.0, the C-Kermit server would block waiting for
  11664.    output from a system command invoked via REMOTE HOST from the client.
  11665.    If the system command took a long time to execute, the client would
  11666.    time out and send NAK packets. If the command took too long, the
  11667.    client would reach its retry limit and give up. Even if it didn't, the
  11668.    NAKs would cause unnecessary retransmissions.
  11669.    
  11670.    In version 7.0, the C-Kermit server (VMS and select()-capable UNIX
  11671.    versions only), sends "keepalive packets" (empty data packets) once
  11672.    per second while waiting for the system command to complete. This
  11673.    procedure should be entirely transparent to the Kermit client, and
  11674.    should prevent the unwanted timeouts and NAKs. When C-Kermit 7.0
  11675.    itself (or K95 1.1.19) is the client, it prints dots to show the
  11676.    keepalive packets.
  11677.    
  11678.    The keepalive feature can be turned off and on with:
  11679.    
  11680.   SET SERVER KEEPALIVE { ON, OFF }
  11681.  
  11682.    Normally it should be on. Turn it off it if causes trouble with the
  11683.    client, or if it seems to slow down the server (as it might on some
  11684.    platforms under certain circumstances).
  11685.      _________________________________________________________________
  11686.    
  11687.   6. INTERNATIONAL CHARACTER SETS
  11688.   
  11689.    Support for several new single-byte character sets was added in
  11690.    C-Kermit 7.0. Unicode / ISO 10646 is not yet supported, but is a high
  11691.    priority for forthcoming releases.
  11692.    
  11693.   6.0. ISO 8859-15 Latin Alphabet 9
  11694.   
  11695.    To accommodate the Euro currency symbol, and to correct several other
  11696.    longstanding problems with ISO Latin Alphabet 1, ISO 8859-15 Latin
  11697.    Alphabet 9 was issued in May 1998. It is supported by C-Kermit 7.0 as
  11698.    a transfer character set, a file character set, and a terminal
  11699.    character set. Translations that preserve the new characters are
  11700.    available between Latin-9 and several other sets including:
  11701.    
  11702.   PC Code Page 858         (Western European languages, similar to CP850)
  11703.   Windows Code Page 1252   (Western European languages, similar to Latin-1)
  11704.   Windows Code Page 1250   (Eastern European languages, similar to Latin-2)
  11705.  
  11706.    The Latin-9 transfer character set also allows for the OE digraph
  11707.    character, used primarily in French, to be preserved in transfers
  11708.    involving the DEC MCS or NeXT character sets.
  11709.    
  11710.    The Euro character is also present in the Universal Character Set,
  11711.    described in [536]Section 6.6.
  11712.    
  11713.   6.1. The HP-Roman8 Character Set
  11714.   
  11715.    The HP-Roman8 character set is supported in C-Kermit 6.0 and later but
  11716.    was omitted from Table VII-4 in the 2nd Edition of Using C-Kermit due
  11717.    to lack of space. It is listed in [537]Appendix III.
  11718.    
  11719.   6.2. Greek Character Sets
  11720.   
  11721.    Greek character sets were added in 6.1:
  11722.    
  11723.   SET FILE CHARACTER-SET { CP869, ELOT927, GREEK-ISO }
  11724.   SET TRANSFER CHARACTER-SET { GREEK-ISO }
  11725.  
  11726.    GREEK-ISO is ISO 8859-7, which the same as ELOT 928.
  11727.    
  11728.    The new Greek character sets are listed in [538]Appendix III.
  11729.    
  11730.   6.3. Additional Latin-2 Character Sets
  11731.   
  11732.    The following have been added as FILE and TERMINAL CHARACTER-SETs:
  11733.    
  11734.    MAZOVIA-PC
  11735.           A PC code page used in Poland, equivalent to CP437, but with 18
  11736.           substitutions needed for Polish.
  11737.           
  11738.    CP1250
  11739.           The Windows Latin 2 Code Page. Equivalent to ISO 8859-2, but
  11740.           with different encoding.
  11741.           
  11742.   6.4. Additional Cyrillic Character Sets
  11743.   
  11744.    The following have been added as FILE and TERMINAL CHARACTER-SETs:
  11745.    
  11746.    BULGARIA-PC
  11747.           This is the Cyrillic PC code page used in Bulgaria, where it is
  11748.           called Code Page 856. It is attributed to a company called
  11749.           DATEC, Inc, but CP856 is not a proper designation, since it
  11750.           refers to a Hebrew Code Page (see the IBM Registry).
  11751.           
  11752.    CP855
  11753.           This PC Code Page contains all the Cyrillic letters that are
  11754.           also in ISO 8859-5, and is therefore useful for non-Russian
  11755.           Cyrillic text (Ukrainian, Belorussian, etc), unlike CP866,
  11756.           which has a smaller repertoire of Cyrillic letters.
  11757.           
  11758.    CP1251
  11759.           The Windows Cyrillic Code Page. Equivalent to CP855, but with
  11760.           different encoding.
  11761.           
  11762.    KOI8R
  11763.           An extension to "Old KOI-8" that adds upper and lower case
  11764.           Cyrillic letter Io (looks like Roman E with diaeresis) plus a
  11765.           selection of box-drawing characters to columns 8 through 11,
  11766.           which are vacant in original Old KOI-8. KOI8-R is used for the
  11767.           Russian language. It is specified in [539]RFC 1489.
  11768.           
  11769.    KOI8U
  11770.           A similar extension of Old KOI-8, but for Ukrainian. It is
  11771.           specified in [540]RFC 2319.
  11772.      _________________________________________________________________
  11773.    
  11774.   6.5. Automatic Character-Set Switching
  11775.   
  11776.    Prior to version 7.0, C-Kermit's file character-set always had to be
  11777.    set explicitly. In 7.0 and later, it is set automatically when:
  11778.    
  11779.     1. This feature is enabled (as it is unless you disable it).
  11780.     2. An incoming text-mode transfer includes a transfer-character-set
  11781.        announcer and you have not previously given a SET FILE
  11782.        CHARACTER-SET command. In this case, C-Kermit switches to an
  11783.        appropriate file character set. For example, on an HP-UX
  11784.        workstation, an incoming Latin-1 file automatically selects
  11785.        HP-Roman8 for the local copy of the file; in Data General AOS/VS,
  11786.        it would select DG International.
  11787.     3. You give a SET TRANSFER CHARACTER-SET command without having
  11788.        previously specified a FILE CHARACTER-SET. An appropriate file
  11789.        character-set is chosen automatically.
  11790.        
  11791.    In addition, when you give a SET FILE CHARACTER-SET command, the
  11792.    appropriate transfer character-set is automatically chosen, to be used
  11793.    when you are sending files (but this does not override the one
  11794.    announced by the sender when you are receiving files).
  11795.    
  11796.    You might not agree about what is "appropriate", so of course you can
  11797.    disable or change all of the above actions.
  11798.    
  11799.    You can disable (or re-enable) the new automatic character-set
  11800.    switching feature in each direction separately:
  11801.    
  11802.    SET RECEIVE CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
  11803.           AUTOMATIC is the default, causing the behavior described above
  11804.           when an incoming file arrives. Choose MANUAL to defeat this
  11805.           behavior and force your current FILE CHARACTER-SET setting to
  11806.           be used, no matter what it is. Note that SET RECEIVE
  11807.           CHARACTER-SET MANUAL does not disable recognition of the
  11808.           incoming transfer character-set announcer, and translation from
  11809.           the corresponding character-set to your current file
  11810.           character-set. To disable that, use SET ATTRIBUTE CHARACTER-SET
  11811.           OFF.
  11812.           
  11813.    SET SEND CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
  11814.           Again AUTOMATIC is the default, causing the behavior described
  11815.           above when you give a SET { FILE, TRANSFER } CHARACTER-SET
  11816.           command. Use MANUAL to allow you to specify the transfer and
  11817.           file character-sets independently.
  11818.           
  11819.    SHOW CHARACTER-SETS
  11820.           Tells settings of { SEND, RECEIVE } CHARACTER-SET-SELECTION.
  11821.           
  11822.    Normally, however, it is more convenient to leave automatic switching
  11823.    active, and change any associations that are not appropriate for your
  11824.    application, area, or country. The commands are:
  11825.    
  11826.    SHOW ASSOCIATIONS
  11827.           This command lists all the associations in each direction: for
  11828.           each possible transfer character-set, it lists the associated
  11829.           file character-set, and vice versa. These are two separate and
  11830.           independent lists.
  11831.           
  11832.    ASSOCIATE TRANSFER-CHARACTER-SET name1 [ name2 ]
  11833.           Changes the association for the transfer character-set name1 to
  11834.           be the file character-set name2. If name2 is omitted, automatic
  11835.           switching is disabled for this transfer character-set only.
  11836.           
  11837.    ASSOCIATE FILE-CHARACTER-SET name1 [ name2 ]
  11838.           Changes the association for the file character-set name1 to be
  11839.           the transfer character-set name2. If name2 is omitted,
  11840.           automatic switching is disabled for this file character-set
  11841.           only.
  11842.      _________________________________________________________________
  11843.    
  11844.   6.6. UNICODE
  11845.   
  11846.    C-Kermit 7.0 adds support for Unicode, the Universal Character Set,
  11847.    for:
  11848.    
  11849.      * File Transfer (SEND, RECEIVE, GET, etc)
  11850.      * Terminal connection (CONNECT)
  11851.      * Unguarded file capture (LOG SESSION)
  11852.      * Unguarded file transmission (TRANSMIT)
  11853.      * Local file character-set conversion (TRANSLATE)
  11854.        
  11855.    C-Kermit is not, however, a "Unicode application" in the sense that
  11856.    its commands, messages, or user interface are Unicode. Rather, it is
  11857.    "Unicode aware" in its ability to handle and convert Unicode text in
  11858.    the course of file transfer and terminal connection, and you can also
  11859.    use Kermit to convert local files between Unicode and other character
  11860.    sets. TLA's:
  11861.    
  11862.   BMP - Base Multilingual Plane
  11863.   BOM - Byte Order Mark
  11864.   CJK - Chinese, Japanese, and Korean
  11865.   ISO - International Standards Organization
  11866.   TLA - Three-Letter Acronym
  11867.   UCS - Universal Character Set
  11868.   UTF - UCS Transformation Format
  11869.  
  11870.    Unicode and ISO 10646 are the coordinated and compatible corporate and
  11871.    international standards for the Universal Character Set (UCS). Unlike
  11872.    single-byte and even most multibyte character sets, the UCS can
  11873.    represent all characters in every existing writing system. A flat
  11874.    plain-text file encoded in some form of UCS can contain any mixture of
  11875.    English, Spanish, Italian, German, Hebrew, Arabic, Greek, Russian,
  11876.    Armenian, Georgian, Japanese, Chinese, Korean, Vietnamese, Tibetan,
  11877.    Hindi, Bengali, Tamil, Thai, Ethiopic, and so on, plus scientific and
  11878.    mathematical notation, as well as texts in Runes, Ogham, Glagolitic,
  11879.    and other historic scripts.
  11880.    
  11881.    The UCS already covers these scripts and many more, but it's an
  11882.    evolving standard with efforts underway to accommodate even more
  11883.    languages and writing systems. Support is growing for native UCS use
  11884.    on many platforms and in many applications. The goal of the framers of
  11885.    the UCS is for it to replace ASCII, the ISO Latin Alphabets, ISCII,
  11886.    VISCII, the Chinese, Japanese, and Korean (CJK) multibyte sets, etc,
  11887.    as well as the many private character sets in use today, in other
  11888.    words to become *the* Universal Character Set.
  11889.    
  11890.    Until that time, however, conversions between existing sets and the
  11891.    UCS will be necessary when moving text between platforms and
  11892.    applications. Now Kermit can help.
  11893.      _________________________________________________________________
  11894.    
  11895.     6.6.1. Overview of Unicode
  11896.     
  11897.    For a more complete picture, please visit:
  11898.    
  11899.   [541]http://www.unicode.org/
  11900.  
  11901.    and access the various online introductions, FAQs, technical reports,
  11902.    and other information. For greater depth, order the latest version of
  11903.    the published Unicode Standard. The following overview contains a
  11904.    great many oversimplifications and perhaps an opinion or two.
  11905.    
  11906.    At present, the UCS is a 16-bit (2-byte) character set, but with
  11907.    provisions to grow to a 4-byte set. UCS-2 refers to the two-byte set,
  11908.    also called the Base Multilingual Plane (BMP), in which each character
  11909.    has 16 bits, and therefore there are 2^16 = 65536 possible characters.
  11910.    The first 128 characters are the same as US ASCII (C0 control
  11911.    characters and DEL included), the next 32 are the C1 control
  11912.    characters of ISO 6429, and the next 96 are the Right Half of ISO
  11913.    8859-1 Latin Alphabet 1. The remaining tens of thousands of characters
  11914.    are arranged newly for the UCS, usually (but not always) in sections
  11915.    corresponding to existing standards, such as ISO Latin/Cyrillic, often
  11916.    plus additional characters not appearing in the existing standards due
  11917.    to lack of space (or other reasons).
  11918.    
  11919.    ISO 10646 allows for additional planes, e.g. for Egyptian
  11920.    hieroglyphics or ancient (or other esoteric) CJK characters, but these
  11921.    planes are not yet defined and so we will say nothing more about them
  11922.    here, except that their use will require the 4-byte form of UCS,
  11923.    called UCS-4, in some form (more about "forms" in [542]Section 6.6.2).
  11924.    
  11925.    Unicode and ISO 10646 are constantly under revision, mainly to add new
  11926.    characters. The Unicode revision is denoted by a version number, such
  11927.    as 1.0, 1.1, 2.0, 3.0. The ISO 10646 standard revision is identified
  11928.    by Edition (such as ISO 10646-1 1993), plus reference to any
  11929.    amendments. The first versions of these standards included encodings
  11930.    for Korean Hangul syllables (Jamos); these encodings were changed in
  11931.    version 1.1 of Unicode and by Amendment 5 to ISO 10646-1. The Unicode
  11932.    Technical Committee and the ISO acknowledge that this was a bad thing
  11933.    to do, and promise never change encodings or character names again,
  11934.    since this poses serious problems for conformance and data
  11935.    interchange.
  11936.    
  11937.    A UCS-2 value is customarily written like this:
  11938.    
  11939.   U+xxxx
  11940.  
  11941.    where "xxxx" represents four hexadecimal digits, 0-9 and A-F. For
  11942.    example, U+0041 is "A", U+00C1 is A-acute, U+042F is uppercase
  11943.    Cyrillic "Ya", U+FB4F is Hebrew Ligature Alef Lamed, and U+FFFD is the
  11944.    special character that means "not a character".
  11945.    
  11946.    Most characters from widely-used alphabetic writing systems such as
  11947.    the West European ones, Cyrillic, Greek, Hebrew, Vietnamese, etc, are
  11948.    available in "precomposed" form; for example Uppercase Latin Letter A
  11949.    with Acute Accent is a single character (as it is in Latin-1).
  11950.    However, the UCS also permits composition of a base character with one
  11951.    or more nonspacing diacritics. This means the same character can be
  11952.    represented in more than one way, which can present problems in many
  11953.    application areas, including transfer and character-set conversion of
  11954.    text.
  11955.    
  11956.    Conversion from ASCII or Latin-1 to UCS-2 text is "trivial": simply
  11957.    insert a NUL (0) byte before each ASCII or Latin-1 byte. Converting in
  11958.    the reverse direction (provided the UCS-2 file contains only U+0000 to
  11959.    U+00FF) is equally simple (if we ignore the issue of composition):
  11960.    remove every second (NUL) byte. Conversion of other character sets to
  11961.    and from UCS, however, requires tables or algorithms specific to each
  11962.    set. Nevertheless, the relatively transparent upwards compatibility
  11963.    from ASCII and Latin-1, in which a very large share of the world's
  11964.    textual data is encoded, gives the UCS an entree onto existing
  11965.    platforms.
  11966.    
  11967.    But the 2-byte format and the preponderance of NUL and other control
  11968.    bytes in UCS-2 text pose problems for current applications and
  11969.    transmission methods. And to make matters worse, different hardware
  11970.    platforms store UCS-2 characters in different byte order. Thus a UCS-2
  11971.    file transferred by FTP (or accessed via NFS, etc) between two
  11972.    computers with different architecture might have its bytes in the
  11973.    wrong order (or worse; see [543]Section 6.6.5.1 ).
  11974.      _________________________________________________________________
  11975.    
  11976.     6.6.2. UCS Byte Order
  11977.     
  11978.    Consider the number 1. In an 8-bit byte, this would be represented by
  11979.    the following series of 0- and 1-bits:
  11980.    
  11981.   +-----------------+
  11982.   | 0 0 0 0 0 0 0 1 |
  11983.   +-----------------+
  11984.  
  11985.    Therefore in a 16-bit "word" the representation might be:
  11986.    
  11987.   +-----------------+-----------------+
  11988.   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
  11989.   +-----------------+-----------------+
  11990.  
  11991.    Now consider the number 256, which is 2 to the 8th power. The binary
  11992.    representation is 100000000 (1 followed by 8 zeros). 256 would go into
  11993.    a 16-bit word like this:
  11994.    
  11995.   +-----------------+-----------------+
  11996.   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
  11997.   +-----------------+-----------------+
  11998.  
  11999.    When a computer works this way, it is said to be Big Endian, meaning
  12000.    it puts the most significant (biggest) byte first (on the "left") in a
  12001.    16-bit word, and the least significant byte second (on the right).
  12002.    
  12003.    However, some other computers have the opposite arrangement, called
  12004.    Little Endian, in which 1 is:
  12005.    
  12006.   +-----------------+-----------------+
  12007.   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
  12008.   +-----------------+-----------------+
  12009.  
  12010.    and 256 is:
  12011.    
  12012.   +-----------------+-----------------+
  12013.   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
  12014.   +-----------------+-----------------+
  12015.  
  12016.    Computers such as Sparc, MIPS, PA-RISC, and PowerPC are Big Endian,
  12017.    whereas the PC and the Alpha are Little Endian. Endianness has never
  12018.    been an issue with 7- or 8-bit characters, but it is with UCS
  12019.    characters. It can be a tricky business to share or transfer a UCS-2
  12020.    file between two different kinds of computers.
  12021.    
  12022.    To alleviate (but not entirely solve) the problem, UCS-2 files are
  12023.    supposed to begin with the Unicode character U+FEFF, Zero-Width
  12024.    No-Break Space (ZWNBS). This is a kind of "no-op" (note: any such
  12025.    assertion must normally be qualified with many "but ifs" and "excepts"
  12026.    which are omitted here in the interest of brevity). If the bytes are
  12027.    reversed the ZWNBS becomes U+FFFE, which is not (and never will be) a
  12028.    defined UCS character. U+FEFF at the beginning of a UCS file is
  12029.    therefore called a Byte Order Mark, or BOM.
  12030.    
  12031.    Any application that creates a UCS-2 (or UTF-16, or UCS-4) file should
  12032.    include a BOM, and any application that reads one should test for a
  12033.    BOM, and if one is found, infer the byte order from it. This is a
  12034.    convention, however -- not a standard or a requirement -- and
  12035.    applications vary in their ability to handle BOMs and "backwards"
  12036.    UCS-2 files.
  12037.    
  12038.    Note that a BOM is useful only at the beginning of a file. If you
  12039.    append one UCS-2 file to another, and both have BOMs, the internal BOM
  12040.    is no longer a BOM. And if the byte orders of the two files differ,
  12041.    then either the first part or the second will be backwards. (Various
  12042.    other undesirable effects might also occur, not discussed here.)
  12043.      _________________________________________________________________
  12044.    
  12045.     6.6.2. UCS Transformation Formats
  12046.     
  12047.    UCS textual data can be modified in various ways for transmission or
  12048.    storage. Any officially sanctioned method of doing this is called a
  12049.    UCS Transformation Format, or UTF. One such method, called UTF-16, is
  12050.    essentially identical with UCS-2 except that it designates certain
  12051.    code values as "escape sequences" (called surrogate pairs) to access
  12052.    characters in other planes without having to use full UCS-4. We won't
  12053.    discuss UTF-16 further here, since at the moment there are no other
  12054.    planes. Several other UTF's (such as UTF-1, UTF-2, and UTF-7) have
  12055.    fallen into disuse and are not discussed here. The most important
  12056.    transformation format today is UTF-8.
  12057.    
  12058.    UTF-8, so called because it "serializes" UCS-2 data into a stream of
  12059.    8-bit bytes, is designed to allow the UCS to work with present-day
  12060.    communications gear, computers, and software. The most important
  12061.    properties of UTF-8 are that byte order is constant (no byte swapping)
  12062.    and all (7-bit) ASCII characters represent themselves. Therefore
  12063.    conversion between ASCII and UTF-8 is no conversion at all, and
  12064.    applications or platforms (such as Plan 9 from Bell Labs) that use
  12065.    UTF-8 "for everything" can still run traditional ASCII-only
  12066.    applications and be accessed from them. In particular, unlike UCS-2,
  12067.    ASCII characters are not padded with NUL bytes. But also unlike UCS-2,
  12068.    there is no transparency for Latin-1 or any other non-ASCII character
  12069.    set. Every non-ASCII UCS-2 character is represented by a sequence of 2
  12070.    or 3 UTF-8 bytes. Thus UTF-8 is more compact than UCS-2 for text
  12071.    containing a preponderance of ABC's (or other ASCII characters), about
  12072.    the same as UCS-2 for other alphabetic scripts (Cyrillic, Roman,
  12073.    Greek, etc), and larger than UCS-2 for Chinese, Japanese, and Korean.
  12074.    
  12075.    The UTF-8 uncoding of the UCS has been adopted by the Internet as the
  12076.    preferred character set for new applications, and is gradually being
  12077.    retrofitted into traditional applications like FTP ([544]RFC 2640).
  12078.      _________________________________________________________________
  12079.    
  12080.     6.6.3. Conformance Levels
  12081.     
  12082.    Although the Unicode and ISO 10646 standards both describe the same
  12083.    character set, these standards differ in many ways, including their
  12084.    stated requirements for conformance and their classification of
  12085.    conformance levels.
  12086.    
  12087.    Kermit has always abided by ISO character-set standards, including ISO
  12088.    character-set designation and invocation methods. In adapting Unicode,
  12089.    therefore, we had to choose from among the available ISO designations
  12090.    which, in turn, correspond with ISO 10646 conformance levels. At
  12091.    present, Kermit claims the lowest conformance level, 1, meaning
  12092.    (roughly) that it does not handle combining forms and it does not
  12093.    handle Korean Hangul Jamos (just as, at present, it does not handle
  12094.    Korean in general). Note that ISO 10646 Conformance Levels 1 and 2
  12095.    sidestep the issue of the code changes for Korean Hangul by announcing
  12096.    non-support for Hangul regardless of encoding.
  12097.    
  12098.    ISO 10646 Conformance Level 1 is approximately equivalent to Unicode
  12099.    Normalization Form C (described in Unicode Technical Report 15,
  12100.    incorporated into Unicode 3.0).
  12101.    
  12102.    As noted in [545]Section 6.6.2, Kermit does not claim to support
  12103.    UTF-16 at the present time, hence the UCS-2 nomenclature. Kermit
  12104.    treats surrogates just as if they were any other UCS-2 characters,
  12105.    rather than as escapes to other planes, which means that (except when
  12106.    converting between UCS-2 and UTF-8) they are translated to "error"
  12107.    characters, since (a) no other planes are defined yet (and if they
  12108.    were, no other character sets supported by Kermit would encode their
  12109.    characters), and (b) no valid surrogate character corresponds to any
  12110.    other UCS-2 character.
  12111.    
  12112.    A minor yet significant aspect of Unicode 3.0 and some recent
  12113.    perturbation of ISO 10646-1 (probably Amendment 18, "Symbols and Other
  12114.    Characters") is the addition of the Euro Sign at U+20AC. As noted in
  12115.    [546]Section 6.0, Kermit's "Euro compliance" includes conversion
  12116.    between Latin Alphabet 9 and various PC code pages. Text can also be
  12117.    converted between UCS-2 or UTF-8 and any other Euro-compliant
  12118.    character set (Latin-9, CP858, CP1250, CP1252) without loss of the
  12119.    Euro Sign.
  12120.      _________________________________________________________________
  12121.    
  12122.     6.6.4. Relationship of Unicode with Kermit's Other Character Sets
  12123.     
  12124.    Kermit's character sets are divided into two groups: single-byte sets
  12125.    (such as Roman, Hebrew, Cyrillic, Greek) and multibyte (various
  12126.    Japanese sets). The two groups are distinct since one normally would
  12127.    not expect to convert Kanji ideograms to Roman (or other) letters, or
  12128.    vice versa.
  12129.    
  12130.    Unicode character-set conversion works with both groups, but obviously
  12131.    the result depends on the repertoires of the source and destination
  12132.    character-sets both including the characters in the file. For example,
  12133.    you can translate a Hungarian text file between Latin-2 and Unicode,
  12134.    but not between (say) Unicode and Latin/Greek. By the same token you
  12135.    can convert Japanese text from Shift-JIS or EUC or JIS-7 to Unicode
  12136.    and back, but you can't convert the same file to (say) Latin-1 if it
  12137.    contains Japanese characters.
  12138.    
  12139.      JIS-7 is equivalent to DEC Kanji and ISO-2022-JP except that the
  12140.      latter two do not support halfwidth Katakana. Kermit treats all
  12141.      three of these sets the same way, i.e. as JIS-7.
  12142.      
  12143.    As noted, Kermit presently does not handle combining diacritics, and
  12144.    so will not correctly convert UCS files that use them into a
  12145.    single-byte character set. For example, if a UCS file contains Latin
  12146.    Capital Letter A (U+0041) followed by Combining Acute Accent (U+0301),
  12147.    the result will be a two-character sequence, A followed by another
  12148.    character. This is what is meant by Conformance Level 1. (The
  12149.    situation grows worse with multiple diacritics, since they can occur
  12150.    in any order.)
  12151.    
  12152.    A higher level of conformance is possible, in which "canonical
  12153.    equivalences" are handled via algorithms and databases, at some
  12154.    (perhaps considerable) cost in performance, since a fair amount of
  12155.    additional code must be executed for every character during data
  12156.    transfer (database lookup, sorting of combining sequences into
  12157.    canonical order, etc). This can be added in future releases if there
  12158.    is a need (but in many cases, pre- and postpostprocessing might be a
  12159.    better option).
  12160.    
  12161.    Within these constraints, Kermit converts between the UCS and its
  12162.    other character sets. For example, a mixture of Russian and English
  12163.    (and/or Dutch, or Latin) text can bet converted between the UCS and
  12164.    ISO Latin/Cyrillic or KOI-8. But since Kermit does not presently
  12165.    support Arabic character-set conversion, the new availability of UCS
  12166.    conversion does not mean that Kermit can convert from Arabic UCS text
  12167.    to some other character set, because Kermit does not support any other
  12168.    character set that includes Arabic. Ditto for Thai, Armenian,
  12169.    Georgian, Tibetan, Chinese, Korean, etc. However, Kermit CAN convert
  12170.    Arabic (or any other script) between UCS-2 and UTF-8.
  12171.    
  12172.    Considering Cyrillic more carefully, note that the UCS also contains
  12173.    numerous Cyrillic characters not found in any of the Cyrillic sets
  12174.    (ISO Latin/Cyrillic, KOI8, CP866, etc) that Kermit supports;
  12175.    characters needed for Abkhasian, Yakut, Tatar, Bashkir, Altaic, Old
  12176.    Church Slavonic, etc; UCS text containing any of these historic or
  12177.    "extended" Cyrillic characters can not be converted to any of Kermit's
  12178.    current single-byte Cyrillic sets without loss. The situation is
  12179.    similar for Greek, Hebrew, etc, and even worse for Japanese since
  12180.    Unicode contains thousands of Kanjis that are lacking from the
  12181.    Japanese character sets based on JIS X 0208, such as EUC-JP, JIS-7,
  12182.    and Shift-JIS.
  12183.    
  12184.    In general, when converting from UCS to a single-byte set, there is
  12185.    always the possibility of data loss, just as there is when converting
  12186.    from any larger set to a smaller one. For example, if a UCS file
  12187.    contains Devanagari characters, these characters will be lost when
  12188.    converting to (say) Latin-1, just as Roman vowels with acute accents
  12189.    are lost when converting from Latin-1 (an 8-bit set) to German ISO 646
  12190.    (a 7-bit set).
  12191.      _________________________________________________________________
  12192.    
  12193.     6.6.5. Kermit's Unicode Features
  12194.     
  12195.    C-Kermit can convert between UCS-2 or UTF-8 and any of its other
  12196.    character sets, and also between UCS-2 and UTF-8. When converting
  12197.    between UCS-2 or UTF-8 and a non-Unicode character set (such as
  12198.    Latin-1), the UCS Line Separator (LS, U+2028) and Paragraph Separator
  12199.    (PS, U+2029) characters are converted to the appropriate line
  12200.    terminator (CR, LF, or CRLF). When converting from a non-Unicode set
  12201.    to UCS-2 or UTF-8, however, line terminators are not converted to LS
  12202.    or PS. This is in accordance with the recommendations of Unicode
  12203.    Technical Report #13.
  12204.    
  12205.    When C-Kermit starts, it tests the native byte order of the computer.
  12206.    You can see the result in the SHOW FEATURES or SHOW FILE display. It's
  12207.    also available in the variable \v(byteorder): 0 means Big Endian, 1
  12208.    means Little Endian.
  12209.    
  12210.    When UCS-2 is involved in file transfer or translation, the following
  12211.    commands tell C-Kermit what to do about byte order:
  12212.    
  12213.    SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
  12214.           This is for reading UCS-2 files that don't have a BOM, and also
  12215.           for writing UCS-2 files. If this command is not given, the
  12216.           machine's native byte order is used when writing UCS-2 files,
  12217.           and also when reading UCS-2 files that don't have a BOM.
  12218.           
  12219.    SET FILE UCS BOM { ON, OFF }
  12220.           This setting is used when creating UCS-2 files. A BOM is added
  12221.           at the beginning by default. Use OFF to not add the BOM. This
  12222.           command has no affect when writing files.
  12223.           
  12224.    COPY /SWAP-BYTES sourcefile destinationfile
  12225.           Use this for fixing a UCS-2 file whose bytes are in the wrong
  12226.           order.
  12227.           
  12228.    Use SHOW FILE to display the FILE UCS settings.
  12229.    
  12230.    Please note, again, that C-Kermit's user interface, including its
  12231.    script language, is not internationalized in any way. String
  12232.    comparisons, case conversion, and so on, work only for US ASCII
  12233.    (comparisons for equality work with other sets, but not
  12234.    lexically-greater-or-less-than or caseless comparisons; even
  12235.    comparisons for equality can fail when composed characters or byte
  12236.    order are involved). String functions such as \findex() and
  12237.    \fsubstring() that reference byte positions do just that; they won't
  12238.    work with UTF-8 text that contains any non-ASCII characters, and they
  12239.    will not work with UCS-2 text at all since they use C strings
  12240.    internally, which are NUL-terminated. These are just a few examples to
  12241.    illustrate that neither Unicode nor any other character-set beyond
  12242.    ASCII is supported at the user-interface, command, or scripting level
  12243.    in this version of C-Kermit.
  12244.      _________________________________________________________________
  12245.    
  12246.     6.6.5.1. File Transfer
  12247.     
  12248.    Kermit supports both UCS-2 and UTF-8 as file and transfer character
  12249.    sets in text-mode file transfer.
  12250.    
  12251.    To select UCS-2 or UTF-8 as a file character-set, use:
  12252.    
  12253.   SET FILE CHARACTER-SET { UCS2, UTF8 }
  12254.  
  12255.    If you want to send a UCS-2 text file (or save an incoming file in
  12256.    UCS-2 format), tell Kermit to:
  12257.    
  12258.   SET FILE CHARACTER-SET UCS2
  12259.  
  12260.    and if you want to send a UTF-8 text file (or store an incoming file
  12261.    in UTF-8 format), tell Kermit to:
  12262.    
  12263.   SET FILE CHARACTER-SET UTF8
  12264.  
  12265.    When sending UCS-2 files, Kermit determines the byte order from the
  12266.    BOM, if there is one (and if there is a BOM, it is stripped, i.e. not
  12267.    sent). If there is no BOM, the byte order is the one specified in the
  12268.    most recent SET FILE UCS BYTE-ORDER command, if any, otherwise the
  12269.    computer's native byte order is assumed. When storing incoming files
  12270.    as UCS-2, the byte order is according SET FILE UCS BYTE-ORDER, if
  12271.    given, otherwise the native one; a BOM is written according to SET
  12272.    FILE UCS BOM.
  12273.    
  12274.    A transfer character-set should be chosen that includes all of the
  12275.    characters in the source file. So, for example, if you are sending a
  12276.    UCS-2 file containing only German-language text, your transfer
  12277.    character-set can be Latin-1, Latin-2, Latin-9, UCS-2, or UTF-8. But
  12278.    if you are sending a file that contains a combination of Hebrew and
  12279.    Greek, your transfer character-set must be UCS-2 or UTF-8 if you don't
  12280.    want to lose one script or the other. Furthermore, the transfer
  12281.    character-set must be one that is supported by the receiving Kermit
  12282.    program. Since UCS support is new, it is possible that the other
  12283.    Kermit program (if it supports character sets at all) does not support
  12284.    it, but does support single-byte sets such as Latin-1, Latin/Cyrillic,
  12285.    etc.
  12286.    
  12287.    To select UCS-2 or UTF-8 as a transfer character-set, use:
  12288.    
  12289.   SET TRANSFER CHARACTER-SET { UCS2, UTF8 }
  12290.  
  12291.    It is up to the receiving Kermit program to convert the transfer
  12292.    format to its own local format, if necessary. If it does not
  12293.    understand the UTF-8 or UCS-2 transfer character-set, and your file
  12294.    can not be adequately represented by any single-byte transfer
  12295.    character-set (such as Latin-1 or Latin/Cyrillic) then, if UTF-8
  12296.    format is acceptable on the receiving computer, use UTF-8 as the
  12297.    transfer character-set, with the receiver told to "set unknown-char
  12298.    keep", or with the sender told to "set attribute char off". If you
  12299.    want the file to be stored in UCS-2 format at the receiver, send it it
  12300.    binary mode if the source file is also UCS-2, or else use the
  12301.    TRANSLATE command (next section) to convert it to UCS-2 first, then
  12302.    send it in binary mode. You should not use UCS-2 as a transfer
  12303.    character-set in text-mode transfers to Kermit programs that don't
  12304.    support it, because they are likely to corrupt the result the same way
  12305.    FTP would (see the final paragraph of this section).
  12306.    
  12307.    When UCS-2 is the transfer character set, it always goes into Kermit
  12308.    packets in Big Endian format, with no BOM. As always, the transfer
  12309.    character-set is announced by the sender to the receiver. The
  12310.    announcement for UCS-2 is "I162" (ISO Registration 162 = UCS-2 Level
  12311.    1) and by definition it is Big Endian (the standards say that when
  12312.    UCS-2 is serialized into bytes, the order must be Big Endian). The
  12313.    announcement for UTF-8 is "I190" (UTF-8 Level 1).
  12314.    
  12315.    When receiving a file whose transfer character-set is UCS-2 or UTF-8,
  12316.    you must choose the appropriate file character set for the result.
  12317.    There is no way Kermit can do this for you automatically, since UCS
  12318.    data can be in any script at all, or any combination.
  12319.    
  12320.    In general, UTF-8 or UCS-2 should be chosen as a transfer
  12321.    character-set if the source file is also encoded in some form of UCS
  12322.    and it contains more than one script. But there are other situations
  12323.    where where UTF-8 or UCS-2 offer advantages. For example, suppose the
  12324.    source file is on a NeXTstation and the destination file is on VMS.
  12325.    Both the NeXT and the DEC Multinational character sets include the
  12326.    French OE digraph, but Latin-1 does not. Therefore French words
  12327.    containing this character might not arrive intact when Latin-1 is the
  12328.    transfer character-set, but will with UTF-8 or UCS-2, since the UCS
  12329.    includes the OE digraph (but so does Latin-9).
  12330.    
  12331.    UCS-2 should be chosen as a transfer character-set only for Japanese
  12332.    text files that contain a large preponderance of Kanji, since in this
  12333.    case (and only this case) UCS-2 (two bytes per Kanji) is more
  12334.    efficient than UTF-8 (three bytes per Kanji). The same will be true
  12335.    for Chinese and Korean when they are supported by Kermit. UCS-2 should
  12336.    never be used as a transfer character-set with a transfer partner that
  12337.    does not support UCS-2 since this can cause file corruption (see last
  12338.    paragraph in this section).
  12339.    
  12340.    Note that Kermit's repeat-count compression is 100% ineffective for
  12341.    UCS-2, and is also ineffective for multibyte characters in UTF-8 and
  12342.    EUC-JP; this is because repeat-compression is a transport-level
  12343.    mechanism that operates on a per-byte basis; it has no knowledge of
  12344.    the distinction between a byte and a character.
  12345.    
  12346.    When C-Kermit starts, it sets up associations ([547]Section 6.5) for
  12347.    incoming files whose transfer character sets are UCS-2 or UTF-8
  12348.    appropriately for the platform so that the file character-set for the
  12349.    incoming file is UCS-2 in Windows and UTF-8 elsewhere. Otherwise,
  12350.    C-Kermit does not make any default associations for UCS-2 or UTF-8,
  12351.    but of course you may add or change associations to suit your needs
  12352.    and preferences by including the appropriate ASSOCIATE commands in
  12353.    your Kermit startup file. For example, if you are a PC user and deal
  12354.    only with text written in Greek and English, you can:
  12355.    
  12356.   ASSOCIATE TRANSFER-CHARACTER-SET UTF8 CP869
  12357.   ASSOCIATE TRANSFER-CHARACTER-SET UCS2 CP869
  12358.   ASSOCIATE FILE-CHARACTER-SET CP869 UTF8
  12359.  
  12360.    Note that when file transfer involves conversion between a single-byte
  12361.    character set and UCS-2 or UTF-8, the file-transfer thermometer and
  12362.    estimated time left might be inaccurate, since they are based on the
  12363.    source file size, not the transfer encoding. This is purely a cosmetic
  12364.    issue and does not effect the final result. (And is not, strictly
  12365.    speaking, a bug; Kermit protocol presently includes no method for the
  12366.    sender to furnish an "estimated transfer size" to the receiver, and in
  12367.    any case any such guess could be as far off as the file size, given
  12368.    the many other factors that come into play, such as compression and
  12369.    prefixing).
  12370.    
  12371.    A caution about FTP and UCS-2. As noted previously, if you transfer a
  12372.    UCS-2 file with FTP in binary mode between two computers with opposite
  12373.    Endianness, the result will have its bytes in the wrong order.
  12374.    However, if you use FTP to transfer a UCS-2 file in "ascii" (text)
  12375.    mode to ANY computer, even if it is identical to yours, the result
  12376.    will be corrupted because FTP's line-terminator conversions do not
  12377.    account for UCS-2. The same holds when sending from a UCS-aware Kermit
  12378.    program to an older Kermit program in text mode with a transfer
  12379.    character-set of UCS-2. So use UCS-2 as a transfer character-set ONLY
  12380.    with a UCS-2-aware Kermit partner.
  12381.      _________________________________________________________________
  12382.    
  12383.     6.6.5.2. The TRANSLATE Command
  12384.     
  12385.    In Kermit versions that have Unicode support included, TRANSLATE now
  12386.    always goes through Unicode; that is, the source set is converted to
  12387.    UCS-2 and thence to the target set. This is a major improvement, since
  12388.    in prior releases, C-Kermit had to pick the "most appropriate"
  12389.    transfer character-set as the intermediate set, and this would result
  12390.    in the loss of any characters that the source and target sets had in
  12391.    common but were lacking from the intermediate set (for example the OE
  12392.    digraph when translating from NeXT to DEC MCS through Latin-1). This
  12393.    never happens when Unicode is the intermediate set because Unicode is
  12394.    a superset of all other character sets supported by Kermit. A more
  12395.    dramatic example would be translation between Cyrillic PC code page
  12396.    866 and KOI8-R ([548]Section 6.4); formerly all the line- and
  12397.    box-drawing characters would be lost (since ISO 8859-5 does not have
  12398.    any); now the ones that these two sets have in common are preserved.
  12399.    
  12400.    UCS-2 and UTF-8 are now both supported as source-file and
  12401.    destination-file character sets by C-Kermit's TRANSLATE command, for
  12402.    example:
  12403.    
  12404.   translate oofa.txt ucs2 latin1 oofa-l1.txt
  12405.  
  12406.    translates oofa.txt from UCS-2 to Latin-1, storing the result as
  12407.    oofa-l1.txt. Similarly:
  12408.    
  12409.   translate oofa.txt utf8 latin1 oofa-l1.txt
  12410.   translate oofa.txt latin1 ucs2 oofa-ucs2.txt
  12411.   translate oofa.txt latin1 utf8 oofa-utf8.txt
  12412.   translate oofa.txt ucs2 utf8 oofa-utf8.txt
  12413.   translate oofa.txt utf8 ucs2 oofa-ucs2.txt
  12414.  
  12415.    Treatment of the UCS-2 BOM is exactly the same as for file transfer.
  12416.    Note that if a UCS-2 source file is in the "wrong" byte order and
  12417.    lacks a BOM, and you don't tell Kermit about it with SET FILE UCS
  12418.    BYTE-ORDER, the result of the translation is total gibberish. Recall
  12419.    that you can use COPY /SWAP-BYTES to switch the byte order of an
  12420.    errant UCS-2 file (or any other file for that matter, if you can think
  12421.    of a reason to). Also note that:
  12422.    
  12423.   translate oofa.txt ucs2 ucs2 new.txt
  12424.  
  12425.    Produces a result in the native (or SET FILE UCS) byte-order as long
  12426.    as oofa.txt has a BOM.
  12427.    
  12428.    As a side benefit of the Unicode work, the TRANSLATE command now works
  12429.    for the first time also for all Japanese character sets that Kermit
  12430.    supports. In other words, if you have a Japanese text file in any of
  12431.    the following encodings:
  12432.    
  12433.   EUC-JP
  12434.   Shift-JIS
  12435.   JIS-7
  12436.   UCS-2
  12437.   UTF-8
  12438.  
  12439.    You can use the TRANSLATE command to convert to any other encoding
  12440.    from the same list.
  12441.      _________________________________________________________________
  12442.    
  12443.     6.6.5.3. Terminal Connection
  12444.     
  12445.    The CONNECT command now allows UTF-8 as a local or remote terminal
  12446.    character-set:
  12447.    
  12448.   SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
  12449.   SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
  12450.   SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
  12451.  
  12452.    (Recall that Kermit's terminal character-set has two "ends" -- the set
  12453.    used on the host to which Kermit is connected, and the set used on the
  12454.    local keyboard and screen.)
  12455.    
  12456.    UCS-2 is not supported as a terminal character-set (either end) since
  12457.    (a) it is not used that way anywhere to our knowledge, and (b) the
  12458.    problems of Endianness and the high likelihood of loss of
  12459.    synchronization make it impractical. (Telecommunications is
  12460.    byte-oriented; if one byte, or any odd number of bytes, is lost
  12461.    because of buffer overruns, circuit resets, etc (or likewise if a
  12462.    burst of noise appears that takes the guise of an odd number of
  12463.    bytes), the byte order of the subsequent data stream will be
  12464.    backwards; unlike UTF-8 and traditional byte-based character sets,
  12465.    UCS-2 is not "self synchronizing".)
  12466.    
  12467.    UTF-8 does not have byte-order or synchronization problems and is
  12468.    growing in popularity as a terminal character set as well as in other
  12469.    application areas. It allows a single terminal session to use multiple
  12470.    scripts (Roman, Cyrillic, Greek, etc) without ISO 2022 character-set
  12471.    switching (which terminal emulators like Kermit 95 can handle but few
  12472.    host applications understand or use), and meshes nicely with the
  12473.    Unicode screen fonts that are beginning to appear.
  12474.    
  12475.    UTF-8 was first used in Plan 9 and soon will be available in Linux. It
  12476.    will probably spread from there (Unicode in some form is, of course,
  12477.    also used in Windows NT, but only internally -- not for access from
  12478.    outside).
  12479.    
  12480.    To use UTF-8 or any other character set that uses 8-bit bytes in your
  12481.    terminal session, be sure to tell C-Kermit to:
  12482.    
  12483.   SET TERMINAL BYTESIZE 8
  12484.   SET COMMAND BYTESIZE 8
  12485.   SET PARITY NONE
  12486.  
  12487.    (or use the shortcut command, EIGHTBIT, which does all three at once).
  12488.    
  12489.    In a setup where your local Kermit program uses a single-byte
  12490.    character set such as PC Code Page 850 and the remote host uses UTF-8:
  12491.    
  12492.   SET TERM CHAR UTF8 CP850
  12493.  
  12494.    or:
  12495.    
  12496.   SET TERM REMOTE CHAR UTF8
  12497.   SET TERM LOCAL CHAR CP850
  12498.  
  12499.    all works as expected. UTF-8 text on the remote displays correctly on
  12500.    your screen, and when you type CP850 characters, they are translated
  12501.    to UTF-8 sequences for transmission, and the echo from the host is
  12502.    translated from UTF-8 back to CP850. Telnet negotiations and
  12503.    autodownload take place before any character-set translation and work
  12504.    as before. The session log (if text mode was selected for it) contains
  12505.    only the local terminal character-set. And so on.
  12506.    
  12507.    Kermit merely supplies translations from UTF-8 to your local terminal
  12508.    character-set (this includes treating UTF-8 Line Separator and
  12509.    Paragraph separator as CRLF). However, Kermit does does not, at
  12510.    present, perform "canonicalization" of composed sequences, nor does it
  12511.    automatically execute bidirectionality algorithms for display of
  12512.    mixed-direction text (e.g. Hebrew and English). Such presentation
  12513.    issues, like all others in the terminal-host regime, are left to the
  12514.    host.
  12515.    
  12516.    By the way, C-Kermit also allows UTF-8 to be the local end of the
  12517.    terminal character-set, but so far this code is not tested, since we
  12518.    don't have a UTF-8 console or terminal to work with. However, it can
  12519.    be stated without doubt that C-Kermit's key mapping will not work for
  12520.    UTF-8 values, since (a) the key map is indexed by 8-bit byte values
  12521.    and (b) C-Kermit reads keystrokes a byte at a time (these comments do
  12522.    not apply to K95, which has direct access to the keyboard and can read
  12523.    "wide" keycodes and uses them to index a "wide" keymap).
  12524.    
  12525.    Restrictions: As noted, the CONNECT command does not support UCS-2 as
  12526.    a REMOTE TERMINAL character-set. Neither does it support the Japanese
  12527.    sets EUC-JP, JIS-7, and Shift-JIS. Support for the Japanese sets (and
  12528.    possibly Chinese and Korean too) might be added in a future release.
  12529.    Since the TRANSMIT command (next section) uses the same REMOTE
  12530.    TERMINAL character-sets as the CONNECT command, it has the same
  12531.    restrictions.
  12532.      _________________________________________________________________
  12533.    
  12534.     6.6.5.4. The TRANSMIT Command
  12535.     
  12536.    As described in Chapter 15 of [549]Using C-Kermit and [550]Section
  12537.    4.21 of this document, the TRANSMIT command can be used to upload a
  12538.    file without protocol, more or less as if you were typing it on your
  12539.    keyboard while connected to the host. When TRANSMITting in text mode,
  12540.    the file's character set is converted to the host's unless you have
  12541.    SET TERMINAL CHARACTER-SET TRANSPARENT, or you include the new
  12542.    TRANSMIT switch, /TRANSPARENT.
  12543.    
  12544.    Before C-Kermit 7.0, the file character-set was assumed to be the same
  12545.    as the local end of the terminal character-set, and the TRANSMIT
  12546.    command used the same translations as the CONNECT command, ignoring
  12547.    the file character-set.
  12548.    
  12549.    In C-Kermit 7.0, that assumption (a poor one to begin with) can no
  12550.    longer be made, since UCS-2 can be a file character-set but not a
  12551.    terminal character-set. So now the file's character-set is given by
  12552.    your most recent SET FILE CHARACTER-SET command. The host's character
  12553.    set is the remote end of your most recent SET TERMINAL CHARACTER-SET
  12554.    command:
  12555.    
  12556.   SET TERMINAL CHARACTER-SET remote-set [ local-set ]
  12557.  
  12558.    or:
  12559.    
  12560.   SET TERMINAL REMOTE-CHARACTER-SET remote-set
  12561.  
  12562.    The TRANSMIT command converts each source-file character from the FILE
  12563.    character-set to the REMOTE TERMINAL character-set, and then transmits
  12564.    the translated characters according to your SET TRANSMIT preferences
  12565.    (Chapter 15).
  12566.    
  12567.    If you have SET TRANSMIT ECHO ON, and the host is echoing the
  12568.    transmitted characters, the echos are converted from the remote
  12569.    terminal character-set to the local terminal character-set.
  12570.    
  12571.   [ A picture would help... ]
  12572.  
  12573.    Confused? Let's work through an example. Suppose your local computer
  12574.    is a NeXTstation, on which text files are encoded in the NeXT
  12575.    character set, and that the remote computer is a Data General AViiON,
  12576.    which uses the Data General International character set. Further
  12577.    suppose that you are logged in to the NeXT from a VT220 terminal which
  12578.    uses the DEC Multinational character set.
  12579.    
  12580.    You need to convert the file from NeXT encoding to DG encoding and
  12581.    convert the echoes from DG encoding to DEC encoding. So on the NeXT,
  12582.    tell C-Kermit to:
  12583.    
  12584.   eightbit
  12585.   set file character-set next
  12586.   set term character-set dg-international dec-mcs
  12587.   transmit /text nextdata.txt
  12588.  
  12589.    (This assumes you have some sort of collection process already set up
  12590.    on the Data General, such as a text editor or the venerable "cat >
  12591.    foo". The EIGHTBIT command is equivalent to SET TERMINAL BYTESIZE 8,
  12592.    SET COMMAND BYTESIZE 8, SET PARITY NONE.)
  12593.    
  12594.    To further complicate matters, suppose your local terminal character
  12595.    set is the same as the remote one, so you don't need terminal
  12596.    character-set translation, but you need to TRANSMIT a file that is in
  12597.    a different character set and you want it translated to the host set.
  12598.    In this case, use SET TERM CHARACTER-SET to actually specify the
  12599.    character set used on each end, rather than specifying TRANSPARENT:
  12600.    
  12601.   eightbit
  12602.   set file character-set ucs2
  12603.   set term character-set latin1 latin1
  12604.   transmit /text ucs2data.txt
  12605.  
  12606.    The distinction between:
  12607.    
  12608.   SET TERMINAL CHARACTER-SET xxx yyy
  12609.  
  12610.    (where xxx and yyy are the same set) and:
  12611.    
  12612.   SET TERMINAL CHARACTER-SET TRANSPARENT
  12613.  
  12614.    is new to C-Kermit 7.0, but affects only the TRANSMIT command.
  12615.    
  12616.    The TRANSMIT command currently does nothing special with UCS-2/UTF-8
  12617.    Line and Paragraph Separator characters; more experience is required
  12618.    to find out how these behave in a genuine Unicode terminal-host
  12619.    setting.
  12620.    
  12621.    Restrictions: As noted, the TRANSMIT command translates from the FILE
  12622.    character-set to the REMOTE TERMINAL character-set. This rules out
  12623.    translations to any character set that is not supported as a REMOTE
  12624.    TERMINAL character-set, such as UCS-2, EUC-JP, JIS-7, and Shift-JIS.
  12625.      _________________________________________________________________
  12626.    
  12627.     6.6.5.5. Summary of Kermit Unicode Commands
  12628.     
  12629.    Specifying file character-set and byte order:
  12630.           SET FILE CHARACTER-SET { ..., UCS2, UTF8 }
  12631.           REMOTE SET FILE CHARACTER-SET { ..., UCS2, UTF8 } (See next
  12632.           section)
  12633.           SET FILE UCS BOM { ON, OFF }
  12634.           SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
  12635.           
  12636.    Specifying the transfer character-set:
  12637.           SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
  12638.           REMOTE SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
  12639.           
  12640.    Specifying the terminal character-set:
  12641.           SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
  12642.           SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
  12643.           SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
  12644.           
  12645.    Displaying settings:
  12646.           SHOW FILE
  12647.           SHOW TRANSFER
  12648.           SHOW TERMINAL
  12649.           SHOW CHARACTER-SETS
  12650.           
  12651.    Commands that use these settings include:
  12652.           SEND, RECEIVE, GET, etc.
  12653.           CONNECT
  12654.           TRANSMIT
  12655.           LOG SESSION
  12656.           
  12657.    Converting files:
  12658.           TRANSLATE infile { ..., UCS-2, UTF-8 } { ..., UCS-2, UTF-8 }
  12659.           outfile
  12660.           COPY /SWAP-BYTES infile outfile
  12661.      _________________________________________________________________
  12662.    
  12663.   6.7. Client/Server Character-Set Switching
  12664.   
  12665.    A simple mechanism has been added to allow the client to change the
  12666.    server's FILE CHARACTER-SET:
  12667.    
  12668.    REMOTE SET FILE CHARACTER-SET name
  12669.           The client asks the server to change its file character-set to
  12670.           the one given. The name must match one of the server's file
  12671.           character-set names. For convenience, C-Kermit uses its own
  12672.           file character-set keyword list for parsing this command so you
  12673.           can use ? for help and Tab or Esc for completion. However,
  12674.           since the server might have a different repertoire (or even use
  12675.           different names for the same sets), C-Kermit accepts any string
  12676.           you supply and sends it to the server. The server, if it
  12677.           supports this command (C-Kermit 7.0 and K95 1.1.19 do), sets
  12678.           its file character-set as requested, and also disables
  12679.           automatic character-set switching ([551]Section 6.5). If the
  12680.           server does not support this command or if it does not support
  12681.           the given character set, the REMOTE SET FILE CHARACTER-SET
  12682.           command fails.
  12683.           
  12684.    Here's an example that sends a Japanese text file encoded in Shift-JIS
  12685.    to a server using every combination of Kermit's Japanese-capable file
  12686.    and transfer character sets:
  12687.    
  12688.   dcl \&x[] = euc ucs2 utf8             ; transfer character-sets
  12689.   dcl \&y[] = eu uc ut                  ; 2-letter abbreviations for them
  12690.   dcl \&f[] = shift euc jis7 ucs2 utf8  ; file character-sets
  12691.   dcl \&g[] = sj eu j7 uc ut            ; 2-letter abbreviations
  12692.  
  12693.   set file char shift-jis               ; local file character-set is Shift-JIS
  12694.   for \%i 1 \fdim(&x) 1 {               ; for each transfer character-set...
  12695.       set xfer char \&x[\%i]            ; set it
  12696.       for \%j 1 \fdim(&f) 1 {           ; for each remote file character-set...
  12697.           remote set file char \&f[\%j] ; set it
  12698.           if fail exit 1 SERVER REJECTED CHARSET
  12699.           send /text meibo-sj.html meibo-sj-\&y[\%i]-\&g[\%j].txt ; send the fi
  12700. le
  12701.           if fail exit 1 TRANSFER FAILED
  12702.       }
  12703.   }
  12704.  
  12705.    The Kermit-370 server does not support REMOTE SET FILE CHARACTER-SET,
  12706.    but since it supports REMOTE KERMIT commands, you can get the same
  12707.    effect with REMOTE KERMIT SET FILE CHARACTER-SET name.
  12708.      _________________________________________________________________
  12709.    
  12710.   7. SCRIPT PROGRAMMING
  12711.   
  12712.    (Also see [552]Section 2.8, Scripting Local Programs.)
  12713.    
  12714.   7.0. Bug Fixes
  12715.   
  12716.    The following script programming bugs were fixed in C-Kermit 7.0:
  12717.    
  12718.      * IF EXIST and IF DIRECTORY were fixed to properly strip braces from
  12719.        around their arguments, so "if directory {C:\Program Files}", etc,
  12720.        would work as expected. However, this means that if the file or
  12721.        directory name is actually enclosed in braces, the braces must be
  12722.        doubled.
  12723.      * The READ command did not fail if the READ file wasn't open; now it
  12724.        does.
  12725.      * The READ command refused to read the last or only line of a file
  12726.        if it did not end with a proper line terminator; now it does.
  12727.      * The END command, when given from within a SWITCH statement, did
  12728.        not exit from the current macro or command file; instead it just
  12729.        terminated the SWITCH.
  12730.      _________________________________________________________________
  12731.    
  12732.   7.1. The INPUT Command
  12733.   
  12734.     7.1.1. INPUT Timeouts
  12735.     
  12736.    The description of the INPUT command on page 422 fails to mention the
  12737.    following two points about the timeout (which apply to C-Kermit 6.0
  12738.    and later):
  12739.    
  12740.     1. "INPUT -1 text" (or "INPUT \%x text", where \%x is any variable
  12741.        whose value is -1 or less) means "wait forever". This form of the
  12742.        INPUT command fails only if it is interrupted, since it will never
  12743.        time out.
  12744.     2. INPUT 0 performs a nonblocking read of material that has already
  12745.        arrived but has not yet been read, and succeeds immediately if the
  12746.        target string is found, or fails immediately if it is not found.
  12747.        
  12748.    The same points apply to MINPUT. REINPUT ignores its timeout
  12749.    parameter.
  12750.      _________________________________________________________________
  12751.    
  12752.     7.1.2. New INPUT Controls
  12753.     
  12754.    The following new INPUT controls were added in version 7.0:
  12755.    
  12756.    SET INPUT AUTODOWNLOAD { ON, OFF }
  12757.           Explained in [553]Section 7.7.
  12758.           
  12759.    SET INPUT CANCELLATION { ON, OFF }
  12760.           This governs whether an INPUT command can be canceled by
  12761.           "pressing any key" on the keyboard. Normally it can be, in
  12762.           which case the INPUT command fails immediately and \v(instatus)
  12763.           is set to 2, indicating interruption. SET INPUT CANCELLATION
  12764.           OFF disables keyboard cancellations; thus if the search text is
  12765.           not encountered, the INPUT command will run for its entire
  12766.           timeout interval. SET INPUT CANCELLATION OFF does not disable
  12767.           interruption by Ctrl-C, however; every command needs an
  12768.           emergency exit. (If you really want to disable interruption by
  12769.           Ctrl-C, use SET COMMAND INTERRUPTION OFF.)
  12770.           
  12771.    Also see [554]Section 7.2 for any new variables related to INPUT.
  12772.      _________________________________________________________________
  12773.    
  12774.     7.1.3. INPUT with Pattern Matching
  12775.     
  12776.    C-Kermit 7.0 allows INPUT, MINPUT, and REINPUT targets to be a pattern
  12777.    (explained in [555]Sections 1.19 and [556]4.9). This solves a
  12778.    long-standing problem illustrated by the following scenario: a certain
  12779.    company has a bank of TCP/IP modem servers, with hostnames server1,
  12780.    server2, server3, and so on. Each server's prompt is its name,
  12781.    followed by a colon (:), for example "Server72:". Without INPUT
  12782.    patterns, it would be rather difficult to wait for the prompt. The
  12783.    brute force approach:
  12784.    
  12785.   minput 20 Server1: Server2: Server3: ... (enumerating each one)
  12786.  
  12787.    is subject to failure whenever a new server is added. A more subtle
  12788.    approach:
  12789.    
  12790.   input 20 Server
  12791.   if fail ...
  12792.   input 2 :
  12793.  
  12794.    is liable to false positives, e.g. "Welcome to the XYZ Corp Modem
  12795.    Server. Please read the following message:"...
  12796.    
  12797.    With patterns, you can match the prompt with "Server*:" (which doesn't
  12798.    solve the "false positives" problem, but certainly is more compact
  12799.    than the brute force method), or with more specific patterns such as
  12800.    "Server[1-9]:" and "Server[1-9][0-9]:", or equivalently:
  12801.    
  12802.   Server{[1-9],[1-9][0-9]}:
  12803.  
  12804.    meaning the word "Server" followed by a single digit (1-9) or by two
  12805.    digits representing a number from 1 to 99, followed by a colon.
  12806.    
  12807.    INPUT pattern matching has been added in a way that does not interfere
  12808.    with existing scripts. No new commands or switches are used. The
  12809.    simple rule is: if an INPUT search target is the argument of the (new)
  12810.    \fpattern() function, it is a pattern. Otherwise it is taken
  12811.    literally, as before. For example:
  12812.    
  12813.   input 5 a*b
  12814.  
  12815.    searches for an 'a' followed by an asterisk ('*'), followed by a 'b'.
  12816.    But:
  12817.    
  12818.   input 5 \fpattern(a*b)
  12819.  
  12820.    searches for an 'a' followed by anything at all up to and including
  12821.    the first 'b'. This means that any search target to INPUT, MINPUT, or
  12822.    REINPUT can be a pattern or a literal string, and in particular that
  12823.    MINPUT can accommodate any mixture of patterns and literal strings.
  12824.    
  12825.    In selecting patterns, note that:
  12826.    
  12827.      * A leading '*' is always implied so there is no need to include
  12828.        one.
  12829.      * A trailing '*' is meaningless and ignored.
  12830.      * A '*' by itself matches the first character that arrives.
  12831.        
  12832.    A syntax note: If your pattern is a selection list, meaning a list of
  12833.    alternatives separated by commas and enclosed in braces, then the
  12834.    outer braces will be stripped by various levels of parsers, so you
  12835.    must include three of each:
  12836.    
  12837.   input 10 \fpattern({{{abc,mno,xyz}}})
  12838.  
  12839.    Note that this is equivalent to:
  12840.    
  12841.   minput 10 abc mno xyz
  12842.  
  12843.    except for the setting of the \v(minput) variable.
  12844.    
  12845.    And a caution: INPUT pattern matching has a limitation that you
  12846.    probably never noticed with literal-string matching, namely that there
  12847.    is a limit on the size of the match. For example, if the pattern is
  12848.    "a*b", the match will succeed if the 'a' and 'b' are not separated by
  12849.    more than (say) 8K bytes, but will fail if they are farther apart than
  12850.    that. In such cases, it better to use two INPUTs (e.g. "input 10 a"
  12851.    and then "input 100 b").
  12852.      _________________________________________________________________
  12853.    
  12854.     7.1.4. The INPUT Match Result
  12855.     
  12856.    The result of any INPUT, MINPUT, or REINPUT command, no matter whether
  12857.    the search targets are patterns or literal strings, is available in
  12858.    the new \v(inmatch) variable. For example:
  12859.    
  12860.   minput 10 cat \fpattern([dh]og)
  12861.   if success echo MINPUT matched "\v(inmatch)"
  12862.  
  12863.    This is especially useful when a pattern was matched, since it makes
  12864.    the string that matched the pattern available to Kermit; there would
  12865.    be no way to get it otherwise.
  12866.    
  12867.    After an INPUT command, you can view all the INPUT-related variables
  12868.    by typing "show variables in" (abbreviate as "sho var in"), which
  12869.    shows the values of all built-in variables whose names start with
  12870.    "in".
  12871.      _________________________________________________________________
  12872.    
  12873.   7.2. New or Improved Built-In Variables
  12874.   
  12875.    \v(blockcheck)
  12876.           Current BLOCK-CHECK setting, 1, 2, 3, or 4. 4 is the code for
  12877.           BLANK-FREE-2.
  12878.           
  12879.    \v(byteorder)
  12880.           The machine's byte order: 0 = Big Endian, 1 = Little Endian.
  12881.           
  12882.    \v(cmdbufsize)
  12883.           The length of the command buffer, which is the maximum size for
  12884.           a macro, a command, a variable, or anything else in C-Kermit's
  12885.           script language.
  12886.           
  12887.    \v(ctty)
  12888.           The device name of C-Kermit's controlling (login) terminal.
  12889.           
  12890.    \v(filename)
  12891.           Described in [557]Sections 4.1 and [558]4.2.
  12892.           
  12893.    \v(filenumber)
  12894.           Described in [559]Sections 4.1 and [560]4.2.
  12895.           
  12896.    \v(filespec)
  12897.           As of C-Kermit 7.0, contains fully qualified filenames rather
  12898.           than (usually) relative ones.
  12899.           
  12900.    \v(return)
  12901.           Now holds the END n value of the macro that most recently
  12902.           returned, in case END was used rather than RETURN.
  12903.           
  12904.    \v(editor)
  12905.           Pathname of preferred text editor
  12906.           
  12907.    \v(editopts)
  12908.           Command-line options for editor
  12909.           
  12910.    \v(editfile)
  12911.           File most recently edited
  12912.           
  12913.    \v(browser)
  12914.           Pathname of preferred Web browser
  12915.           
  12916.    \v(browsopts)
  12917.           Command-line options for Web browser
  12918.           
  12919.    \v(browsurl)
  12920.           URL most recently given to Web browser
  12921.           
  12922.    \v(dialtype)
  12923.           Type of call most recently placed (see [561]Section 2.1.11).
  12924.           
  12925.    \v(kbchar)
  12926.           The character, if any, that was typed at the keyboard to to
  12927.           interrupt the most recent PAUSE, SLEEP, WAIT, MSLEEP, or INPUT
  12928.           command; empty if the most recent such command was not
  12929.           interrupted from the keyboard.
  12930.           
  12931.    \v(lockdir)
  12932.           UNIX only - The name of the UUCP lockfile directory, if known,
  12933.           otherwise "(unknown)".
  12934.           
  12935.    \v(lockpid)
  12936.           UNIX only - PID of process that owns the communication port
  12937.           that you tried to open with a SET LINE command that failed
  12938.           because the port was in use, otherwise empty. This variable is
  12939.           set with every SET LINE command.
  12940.           
  12941.    \v(cx_time)
  12942.           If no connection (SET HOST, SET LINE, DIAL, TELNET, etc) is
  12943.           active, this is 0. If a connection is active, this is the
  12944.           number of seconds since the connection was made.
  12945.           
  12946.    \v(hwparity)
  12947.           If hardware parity is in effect, this variable gives its value,
  12948.           such as "even" or "odd" (in which case, the \v(parity) variable
  12949.           will be "none"). Otherwise this variable is empty.
  12950.           
  12951.    \v(serial)
  12952.           Current serial port settings in 8N1 format ([562]Section 2.10).
  12953.           
  12954.    \v(errno)
  12955.           In UNIX, the current value of the C runtime errno variable,
  12956.           which is quite volatile (meaning that often an "interesting"
  12957.           error code can be overwritten by some other library call or
  12958.           system service that sets errno before you have a chance to look
  12959.           at it). In VMS, the error code returned by the system or
  12960.           library call that most recently failed (success codes are not
  12961.           saved). Not available in other operating systems.
  12962.           
  12963.    \v(errstring)
  12964.           The UNIX or VMS system error message that corresponds to
  12965.           \v(errno). Not available in all OS's. Also see
  12966.           [563]\ferrstring().
  12967.           
  12968.    \v(setlinemsg)
  12969.           The error message, if any, from the most recent SET LINE, SET
  12970.           PORT, SET HOST, TELNET, or other connection-making command.
  12971.           This is not necessarily the same as \v(errstring) since these
  12972.           commands might fail without generating a system error code, for
  12973.           example (in UNIX) because a lockfile existed indicating the
  12974.           device was assigned by another user.
  12975.           
  12976.    \v(exitstatus)
  12977.           The exit status C-Kermit would return if it exited now.
  12978.           
  12979.    \v(pexitstat)
  12980.           The exit status of the inferior process most recently invoked
  12981.           by C-Kermit (by RUN, !, REDIRECT, SEND /COMMAND, etc). In VMS,
  12982.           this code can be given to \ferrstring() to get the
  12983.           corresponding error message (in UNIX, program/command return
  12984.           codes are not the same as system error codes). Not available in
  12985.           operating systems other than UNIX and VMS. See [564]Section
  12986.           4.2.5 for details.
  12987.           
  12988.    \v(inmatch)
  12989.           The incoming string of characters, if any, that matched the
  12990.           most recent INPUT, REINPUT, or MINPUT command.
  12991.           
  12992.    \v(intime)
  12993.           The number of milliseconds (thousandths of seconds) it took for
  12994.           the most recent INPUT command to find its match, or -1 if no
  12995.           INPUT command has been given yet. If the INPUT command timed
  12996.           out, the value is approximately equal to 1000 times the INPUT
  12997.           timeout. If INPUT failed for some other reason, the value is
  12998.           undefined (\v(instatus) gives INPUT completion status). If your
  12999.           version of C-Kermit is built without high-precision
  13000.           floating-point timers, this number will always be a multiple of
  13001.           1000.
  13002.           
  13003.    \v(inwait)
  13004.           The number of seconds specified as the timeout in the most
  13005.           recent INPUT command.
  13006.           
  13007.    \v(dialsuffix)
  13008.           Dialing suffix for use during PDIAL sequence; see [565]Section
  13009.           2.1.10.
  13010.           
  13011.    \v(pid)
  13012.           UNIX, VMS, and K95 only. C-Kermit's primary process ID,
  13013.           numeric, decimal. If you want to show it in hex, use
  13014.           \fn2hex(\v(pid)) If you want to show it in octal, use
  13015.           \fn2octal(\v(pid)).
  13016.           
  13017.    \v(printer)
  13018.           Current printer name or SET PRINTER value.
  13019.           
  13020.    \v(p_ctl)
  13021.           Control prefix char \v(p_8bit) 8-bit prefix char (if parity not
  13022.           none)
  13023.           
  13024.    \v(p_rpt)
  13025.           Repeat prefix char (if repeat compression enabled)
  13026.           
  13027.    \v(herald)
  13028.           Kermit's version herald
  13029.           
  13030.    \v(test)
  13031.           Kermit's test version, if any, or 0 if this is not a test
  13032.           version. Typical values for test versions are "Alpha.03" or
  13033.           "Beta.14".
  13034.           
  13035.    \v(sendlist)
  13036.           The number of entries in the SEND-LIST, 0 if none. Note:
  13037.           entries do not necessarily correspond to files, since an entry
  13038.           might contain wildcards. Also note that the value does not go
  13039.           back to 0 after the files in the list are sent. To reset this
  13040.           variable, use CLEAR SEND-LIST. The purpose of this variable is
  13041.           to determine if a SEND command, when given without any
  13042.           filenames, will be legal. Example:
  13043.           
  13044.   xif \v(sendlist) { send } else { send oofa.txt }
  13045.  
  13046.    \v(trigger)
  13047.           If the most recent CONNECT session was terminated automatically
  13048.           by a trigger, this variable contains the trigger value.
  13049.           
  13050.    \v(ty_ln)
  13051.           TYPE line number (during TYPE)
  13052.           
  13053.    \v(ty_lc)
  13054.           TYPE line count (after TYPE)
  13055.           
  13056.    \v(ty_mc)
  13057.           TYPE match count (after TYPE)
  13058.           
  13059.    \v(xferstat)
  13060.           Status of most recent file transfer:
  13061.           
  13062. -1: No transfer yet
  13063.  0: Succeeded
  13064.  1: Failed
  13065.  
  13066.    \v(xfermsg)
  13067.           If the most recent file transfer failed, this is the reason. If
  13068.           it succeeded, \v(xfermsg) is an empty string.
  13069.           
  13070.    \v(tftime)
  13071.           Total elapsed time of most recent file transfer operation, in
  13072.           seconds.
  13073.           
  13074.    \v(textdir)
  13075.           Directory that holds (or is supposed to hold) Kermit text files
  13076.           such as installation instructions, release notes, update notes,
  13077.           read-me files, "beware" files, etc.
  13078.           
  13079.    \v(name)
  13080.           The name with which the Kermit program was invoked, e.g.
  13081.           "kermit", "wermit", "k95", "k2", etc (see [566]Section 9.1).
  13082.           
  13083.    \v(osname)
  13084.           Name of operating system on computer where C-Kermit is running,
  13085.           obtained at runtime (from uname or equivalent).
  13086.           
  13087.    \v(osversion)
  13088.           Version of operating system on computer where C-Kermit is
  13089.           running, obtained at runtime (from uname or equivalent).
  13090.           
  13091.    \v(osrelease)
  13092.           Release of operating system on computer where C-Kermit is
  13093.           running, obtained at runtime (from uname or equivalent).
  13094.           
  13095.    \v(model)
  13096.           The specific hardware model of the computer where C-Kermit is
  13097.           running, if known.
  13098.           
  13099.    \v(math_pi)
  13100.           The value of Pi (see [567]Section 7.23) \v(math_e) The value of
  13101.           e (see [568]Section 7.23) \v(math_precision) How many
  13102.           significant digits in a floating-point number.
  13103.           
  13104.    \v(f_count)
  13105.           Result of the most recent FILE COUNT (FCOUNT) command.
  13106.           
  13107.    \v(f_error)
  13108.           Numeric error code of most recent FILE command.
  13109.           
  13110.    \v(f_max)
  13111.           Maximum number of files open simultaneously.
  13112.           
  13113.    The math constants are given in the precision of underlying computer's
  13114.    floating-point arithmetic.
  13115.    
  13116.    Note the distinction between \v(osname)-\v(osversion) and
  13117.    \v(platform); the latter refers to the platform for which and/or upon
  13118.    which C-Kermit was built, as opposed to the one on which it is
  13119.    actually running. Also note that each operating system can, and
  13120.    probably will, interpret and fill in the os* variables differently, or
  13121.    not at all.
  13122.    
  13123.    The SHOW VARIABLES command now accepts a variable name, prefix, or
  13124.    pattern:
  13125.    
  13126.   show variables         Shows all variables.
  13127.   show variables t       Shows all variables that start with "t".
  13128.   show variables *ver*   Shows all variables whose names contain "ver".
  13129.   show variables *ver    Ditto (an implied "*" is appended).
  13130.      _________________________________________________________________
  13131.    
  13132.   7.3. New or Improved Built-In Functions
  13133.   
  13134.    The following new file-i/o functions are explained in [569]Section
  13135.    1.22.
  13136.    
  13137.   \f_status(channel)           Status of file open on channel
  13138.   \f_pos(channel)              Read/write (byte) pointer of given file
  13139.   \f_line(channel)             Current line of file
  13140.   \f_handle(channel)           Handle of file
  13141.   \f_eof(channel)              Whether given file is at EOF
  13142.   \f_getchar(channel)          Read a char from given file
  13143.   \f_getline(channel)          Read a line from given file
  13144.   \f_getblock(channel,n)       Read a block from given file
  13145.   \f_putchar(channel,c)        Write a char to given file
  13146.   \f_putline(channel,string)   Write a line to given file
  13147.   \f_putblock(channel,string)  Write a block to given file
  13148.  
  13149.    The following new date-time-related functions are explained in
  13150.    [570]Section 1.6:
  13151.    
  13152.   \fday()                Returns day of week of given date
  13153.   \fnday()               Returns numeric day of week of given date
  13154.   \ftime()               Returns time portion of given date-time
  13155.   \fntime()              Converts time to seconds since midnight
  13156.   \fn2time()             Converts seconds since midnight to hh:mm:ss
  13157.   \fcvtdate(date-time)   Converts free-format date to yyyymmdd hh:mm:ss
  13158.   \fdayofyear(date-time) Converts date to yyyyddd (day-of-year) format
  13159.   \fdoy(date-time)       Synonym for \fdayofyear()
  13160.   \fdoy2date(dayofyear)  Converts yyyyddd to yyyymmdd
  13161.   \fmjd(date-time)       Converts free-format date to Modified Julian Date
  13162.   \fmjd2date(mjd)        Converts modified Julian date to yyyymmdd
  13163.  
  13164.    The new floating-point arithmetic functions are explained in
  13165.    [571]Section 7.23. f1 and f2 are floating-point (real) numbers; d is
  13166.    the number of decimal places to show:
  13167.  
  13168.   \ffpabsolute(f1,d)     Absolute value of f1
  13169.   \ffpadd(f1,f2,d)       f1 + f1
  13170.   \ffpcosine(f1,d)       Cosine of f1
  13171.   \ffpdivide(f1,f2,d)    f1 divided by f2
  13172.   \ffpexp(f1,d)          e to the f1 power
  13173.   \ffpint(f1)            Integer part of f1
  13174.   \ffplog10(f1,d)        Log base 10 of f1
  13175.   \ffplogn(f1,d)         Natural log of f1
  13176.   \ffpmaximum(f1,f2,d)   Maximum of f1 and f2
  13177.   \ffpminimum(f1,f2,d)   Minimum of f1 and f2
  13178.   \ffpmodulus(f1,f2,d)   Modulus of f1 and f2
  13179.   \ffpmultiply(f1,f2,d)  Product of f1 and f2
  13180.   \ffpraise(f1,f2,d)     Raise f1 to power f2
  13181.   \ffpround(f1,d)        Round f1 to d places
  13182.   \ffpsine(f1,d)         Sine of f1
  13183.   \ffpsqrt(f1,d)         Square root of f1
  13184.   \ffpsubtract(f1,f2,d)  f2 - f1
  13185.   \ffptangent(f1,d)      Tangent of f1
  13186.  
  13187.    Integer number functions:
  13188.    
  13189.    \fabsolute(n)
  13190.           Absolute value of integer n.
  13191.           
  13192.    \frandom(n)
  13193.           Returns a random integer between 0 and n-1.
  13194.           
  13195.    \fradix(s,n1,n2)
  13196.           If the string s is an integer in radix n1, the result is the
  13197.           same number expressed in radix n2, where n1 and n2 may be any
  13198.           number from 2 through 36, expressed as decimal numbers, or
  13199.           variables (etc) that evaluate to decimal numbers. For the
  13200.           source and result, the digits of any radix, r, are the first r
  13201.           characters in the sequence 0-9,a-z (case doesn't matter for the
  13202.           letters). The string s may have a sign, + or -; if it starts
  13203.           with a minus (-) sign, the result also has a minus sign.
  13204.           
  13205.    The \fradix() function does not work with floating-point numbers. It
  13206.    does not reveal the internal storage format of a number; for example,
  13207.    \fradix(-1,10,16) is -1, not something like FFFFFFFFFF. If all three
  13208.    arguments are not given, or if n1 or n2 are not numbers between 2 and
  13209.    36 inclusive, or s is not a number in radix n1, an error occurs and
  13210.    the empty string is returned. \fradix() also does not offer
  13211.    extended-precision arithmetic; number values are limited to those
  13212.    expressed as a long integer in the architecture of the underlying
  13213.    computer, usually 32 or 64 bits. If you give it an argument whose
  13214.    absolute value is larger than can be held in an unsigned long, the
  13215.    result is -1.
  13216.    
  13217.    The next four are shorthand functions for decimal/hexadecimal and
  13218.    decimal/octal number conversion:
  13219.    
  13220.    \fn2hex(n)
  13221.           Returns the hexadecimal (base 16) representation of the integer
  13222.           n. This is different from \fhexify(s), which treats its
  13223.           argument as a string rather than a number. The result is always
  13224.           left-padded with 0's to make its length even. Examples:
  13225.           
  13226.   \n2hex(0)   = "00"                    \fhexify(0)   = "30"
  13227.   \n2hex(255) = "ff"                    \fhexify(255) = "323535"
  13228.   \n2hex(256) = "0100"                  \fhexify(256) = "323536"
  13229.  
  13230.    \fhex2n(x)
  13231.           Converts hexadecimal number x to decimal equivalent decimal
  13232.           number. This is the inverse of \fn2hex(). Equivalent to
  13233.           \fradix(s,16,10).
  13234.           
  13235.    \fn2octal(n)
  13236.           Returns the octal (base 8) representation of the number n.
  13237.           Examples:
  13238.           
  13239.  
  13240.   \n2octal(0) = "0"
  13241.   \n2oct(255) = "377"
  13242.   \n2oct(256) = "400"
  13243.   Equivalent to \fradix(n,10,8).
  13244.  
  13245.    \foct2n(n)
  13246.           Returns the decimal representation of the given octal number,
  13247.           n. The inverse of \fn2octal(). Equivalent to \fradix(n,8,10).
  13248.           
  13249.    String functions:
  13250.    
  13251.    \s(name[n:m])
  13252.           Equivalent to \fsubstring(\m(name),n,m) ([572]Section 7.25).
  13253.           
  13254.    \:(name[n:m])
  13255.           Equivalent to \fsubstring(name,n,m) (where "name" is any
  13256.           \-quantity) ([573]Section 7.25).
  13257.           
  13258.    \fleft(s,n)
  13259.           The leftmost ncharacters of string s; equivalent to
  13260.           \fsubstring(s,1,n).
  13261.           
  13262.    \fstripx(string,char)
  13263.           Returns the part of the string up to the rightmost occurrence,
  13264.           if any, of the given character. The default character is period
  13265.           (.) Examples:
  13266.           
  13267.  
  13268.   \fstripx(foo/bar,/)                 = "foo"
  13269.   \fstripx(foo/bar/baz,/)             = "foo/bar"
  13270.   \fstripx(autoexec.bat,.)            = "autoexec"
  13271.   \fstripx(autoexec.bat)              = "autoexec"
  13272.   \fstripx(fstripx(foo/bar/baz,/),/)  = "foo"
  13273.  
  13274.    \flop(string,character)
  13275.           Returns the portion of the string starting after the first
  13276.           occurrence of the given character. The default character is
  13277.           period (.) Examples:
  13278.           
  13279.  
  13280.   \flop(autoexec.bat)                 = "bat"
  13281.   \flop(baz.foo/bar)                  = "foo/bar"
  13282.   \flop(baz.foo/bar,/)                = "bar
  13283.  
  13284.    \fstripn(string,n)
  13285.           Returns the string with ncharacters removed from the end.
  13286.           Example:
  13287.           
  13288.  
  13289.   \fstripn(12345678,3)                = "12345"
  13290.  
  13291.           (For more discussion of \fstripx(), \fstripn(), and \flop() see
  13292.           [574]Section 4.2.3).
  13293.           
  13294.    \fb64encode(s)
  13295.           Returns the Base-64 encoding of the string s.
  13296.           
  13297.    \fb64decode(s)
  13298.           Returns the decoding of the Base-64 string s. Fails if s is not
  13299.           a Base-64 string, or if its length is not a multiple of 4. Note
  13300.           that if any of the result bytes are null (0), the result string
  13301.           stops there. There is no way to represent strings that contain
  13302.           null bytes in C-Kermit (the same is true for \funhexify()).
  13303.           
  13304.    \fword(s1,n,s2,s3)
  13305.           Extracts word number nfrom string s1. By default, a "word" is
  13306.           any sequence of ASCII letters or digits; nis 1-based. If nis
  13307.           omitted, "1" is used. Examples:
  13308.           
  13309.   \fword(one two three)    = "one"
  13310.   \fword(one two three,1)  = "one"
  13311.   \fword(one two three,2)  = "two"
  13312.   \fword(one two three,3)  = "three"
  13313.  
  13314.           and:
  13315.           
  13316.     \fword(\v(dialresult),2) = "31200"
  13317.  
  13318.           is "31200" if \v(dialresult) is (e.g.) "CONNECT
  13319.           31200/ARQ/V32/LAPM/V42BIS".
  13320.           
  13321.           If you include s2, this replaces the default break set. For
  13322.           example, suppose you have a string \%a whose value is:
  13323.           
  13324.   $150.00 $300.00 $39.95
  13325.  
  13326.           and you want each dollar amount to be a word; use:
  13327.           
  13328.   \fword(\%a,\%n,{ })
  13329.  
  13330.           This returns dollar amount number \%n, e.g. "$300.00" for \%n =
  13331.           2. "{ }" denotes a space (you must enclose it in braces,
  13332.           otherwise it is squeezed out). Note that ASCII control
  13333.           characters are always included in the break set; you don't have
  13334.           to specify them (and you can't not specify them).
  13335.           
  13336.           The optional s3 argument lists characters (even control
  13337.           characters) that normally would be considered separators that
  13338.           you want included in words. So the dollars-and-cents example
  13339.           could also be handled this way:
  13340.           
  13341.   \fword(\%a,\%n,,$.)
  13342.  
  13343.           in other words, use the default separator list, but remove "$"
  13344.           and "." from it so they will be considered part of a word.
  13345.           
  13346.    \fsplit(s1,&a,s2,s3)
  13347.           This is like \fword(), except instead of extracting and
  13348.           returning a particular word from string s1, it counts the words
  13349.           and optionally assigns them to the array whose identifying
  13350.           letter, a-z, is given after the "&" in the second argument,
  13351.           with the first word going into element 1, the second into
  13352.           element 2, and so on. The rules regarding break and include
  13353.           lists (s2 and s3) are exactly the same as for \fword().
  13354.           \fsplit() returns the number of words that were assigned, which
  13355.           is either the number of words in the string, or the dimension
  13356.           of the array, whichever is less. If the array is not declared,
  13357.           \fsplit() creates it and returns a number which is both the
  13358.           number of words in s1 and the dimension of the new array.
  13359.           Examples:
  13360.           
  13361.   declare \&w[20]        ; (Optional.)
  13362.   ...
  13363.   read \%s               ; \%s is "This is a sentence with seven words."
  13364.   ...
  13365.   echo "\fsplit(\%s)"    ; This would print "7".
  13366.   echo "\fsplit(\%s,&w)" ; Ditto, and also assigns them to array \&w[].
  13367.  
  13368.   echo "\&w[7]"          ; This would print "words".
  13369.  
  13370.           If the line contained fields that were delimited by colon (:),
  13371.           you would use \fsplit(\%s,&w,:). If the fields were delimited
  13372.           by comma, then you would use \fsplit(\%s,&w,{,}); in this case
  13373.           the literal comma must be enclosed in braces to distinguish it
  13374.           from the comma that separates function arguments. To get a word
  13375.           count without loading an array, but still specify break and/or
  13376.           include lists, leave the array argument empty:
  13377.           
  13378.    echo "\fsplit(\%s,,:)" ; Use colon as the separator.
  13379.  
  13380.           WARNINGS:
  13381.           
  13382.          1. If you use the same array repeatedly, \fsplit() leaves any
  13383.             trailing members undisturbed. For example:
  13384.  
  13385.   dcl \&w[10]
  13386.   \fsplit(1 2 3 4 5,&w) ; Sets \&w[1] thru \&w[5].
  13387.   \fsplit(a b c,&w)     ; Sets \&w[1]-[3] leaving [4]-[5] as they were.
  13388.          2. If you allow \fsplit to create the array (by not declaring it
  13389.             first), it is dimensioned to the number of elements it was
  13390.             created with:
  13391.  
  13392.   \fsplit(1 2 3,&x)     ; Creates an array \&x[] with 3 elements.
  13393.   \fsplit(a b c d e,&x) ; This overflows the array.
  13394.  
  13395.           Thus if you want to use \fsplit() repeatedly on the same array,
  13396.           either dimension it in advance to the maximum expected size
  13397.           (and then some -- more efficient), or else destroy it after
  13398.           each use (to allow for unexpectedly large arguments). Example
  13399.           using a dynamic array:
  13400.           
  13401.   fopen /read \%c some-file
  13402.   if fail ...
  13403.   set function error on    ; See [575]Section 7.12
  13404.   while true {
  13405.       dcl \&w[]            ; Destroy \&[w] each time thru the loop
  13406.       fread /line \%c \%a
  13407.       if fail break
  13408.       asg \%x \fsplit(\%a,&w)
  13409.       if fail ...
  13410.       ; (do what you want with \&w[] here...)
  13411.   }
  13412.   fclose \%c
  13413.  
  13414.    \frindex(s1,s2,n)
  13415.           The "n" argument to \frindex() now works consistently (in
  13416.           mirror image) with the corresponding \findex() argument. In
  13417.           each case, the (n-1)-most characters of s2 are ignored in the
  13418.           search; for findex, this means the starting position of the
  13419.           search is n (the default nis 1, and 0 is treated like 1). For
  13420.           \frindex() it means the default starting point is:
  13421.           
  13422.   length(s2) - length(s1) - n (with the same defaults for n).
  13423.  
  13424.    \fsearch(pattern,string[,position])
  13425.           Exactly like \findex(), except with a pattern (see [576]Section
  13426.           7.9) rather than a literal string.
  13427.           
  13428.    \frsearch(pattern,string[,position])
  13429.           Exactly like \frindex(), except with a pattern rather than a
  13430.           literal string.
  13431.           
  13432.           File Functions:
  13433.           
  13434.    \ffiles(), \fnextfile()
  13435.           It is no longer necessary to copy the file list to an array
  13436.           before use, as shown on p.398 of [577]Using C-Kermit 2nd
  13437.           Edition. \ffiles() and friends now make their own safe copies
  13438.           of the file list. Thus constructions like the following are now
  13439.           possible:
  13440.           
  13441.   for \%i 1 \ffiles(*.txt) 1 { send \fnextfile() }
  13442.  
  13443.           The same is true for the new function \frfiles(),
  13444.           \fdirectories(), and \frdirectories(), described in
  13445.           [578]Section 4.11.3.
  13446.           
  13447.           But note that each reference to \fnextfile() still gets you the
  13448.           next file. So "if newer \fnextfile() foo.txt send \fnextfile()"
  13449.           compares one file's age with that of foo.txt, and then sends an
  13450.           entirely different file. If you're going to refer to the same
  13451.           file more than once, assign it to a variable:
  13452.           
  13453.   asg \%f \fnextfile()
  13454.   if newer \%f foo.txt send \%f
  13455.  
  13456.           (note: assign, not define).
  13457.           
  13458.           Also note that \ffiles(), \frfiles(), \fdirectories(), and
  13459.           \frdirectories() all now accept on optional 2nd argument: the
  13460.           name of an array to load with the resulting file or directory
  13461.           list, explained in [579]Section 4.11.3. So you can also load an
  13462.           array with the filelist when you need to refer to the same file
  13463.           more than once:
  13464.           
  13465.   for \%i 1 \ffiles(*,&a) 1 { if newer \&a[\%i] foo.txt send \&a[\%i] }
  13466.  
  13467.    \fpermissions(file)
  13468.           Returns the platform-specific permissions string for the file,
  13469.           such as "-rw-rw-r--" in UNIX or "(RWE,RWE,RE,E)" in VMS.
  13470.           
  13471.    \fdirname(f)
  13472.           Given a file specification f, this function returns the
  13473.           complete pathname of directory the file is in.
  13474.           
  13475.    Array Functions:
  13476.    
  13477.    \fdimension(&a)
  13478.           Returns the dimension declared for the array whose identifying
  13479.           letter, a-z, or special character "_" or "@", is given after
  13480.           the "&" in the argument. If the array is not declared, 0 is
  13481.           returned. Note that when used with the macro argument vector
  13482.           array, \&_[] (see [580]Section 7.5), the value of this function
  13483.           is one less than \v(argc), and when used with the C-Kermit
  13484.           command-line argument vector array, \&@[], it is equal to the
  13485.           \v(args) variable. Examples:
  13486.           
  13487.   echo \fdimension(&a)       ; Not declared.
  13488.   0
  13489.   declare \&a[12]            ; Now it's declared.
  13490.   echo \fdim(&a)
  13491.   12
  13492.  
  13493.    \farraylook(pattern,arrayname)
  13494.           Looks in the given array for the pattern and returns the index
  13495.           of the first element that matches, if any, or -1 if none match.
  13496.           The arrayname can include a range specifier to restrict to
  13497.           search to a segment of the array, e.g.
  13498.           \farraylook(*xyz*,&a[32:63]). For greater detail see
  13499.           [581]Section 7.10.7.
  13500.           
  13501.    \ftablelook(keyword,arrayname[,delimiter])
  13502.           Looks in the given "table", which must be sorted, for the given
  13503.           keyword. Returns the index of the table element that uniquely
  13504.           matches the given keyword, or -1 if none match, or -2 if more
  13505.           than 1 match. For greater detail see [582]Section 7.10.7.
  13506.           
  13507.    Other new functions:
  13508.    
  13509.    \fip2hex(s)
  13510.           Converts a dotted decimal IP address to an 8-digit hexadecimal
  13511.           number. \fip2hex(128.59.39.2) = 803b2702.
  13512.           
  13513.    \fhex2ip(x)
  13514.           Converts an 8-digit hexadecimal IP address to dotted decimal
  13515.           form, e.g. \fhex2ip(803b2702) = 128.59.39.2. The inverse of
  13516.           \fip2hex().
  13517.           
  13518.    \fcommand()
  13519.           
  13520.    \frawcommand()
  13521.           These run an external command and return its output; see
  13522.           [583]Section 4.2.8.4.
  13523.           
  13524.    \fdialconvert(s)
  13525.           s is a phone number in either literal or portable format (not a
  13526.           dialing directory entry name). The function returns the dial
  13527.           string that would actually be used when dialing from the
  13528.           current location (after processing country code, area code, and
  13529.           other SET DIAL values).
  13530.           
  13531.    \ferrstring(n)
  13532.           Returns the system error message associated with the (numeric)
  13533.           error code n. UNIX and VMS only. Use in conjunction with
  13534.           \v(errno) or \v(pexitstat). See [584]Section 4.2.5 for a usage
  13535.           example. Note: This function doesn't work in Windows because
  13536.           there is not a consistent error-code-to-message mapping; error
  13537.           code "x" means something completely different depending on
  13538.           whether it comes from the C runtime library, Winsock, a
  13539.           Windows-32 API, TAPI, etc,
  13540.           
  13541.    \fpattern(s)
  13542.           Used in INPUT, REINPUT, and MINPUT commands to denote search
  13543.           strings that are to be treated as patterns rather than
  13544.           literally.
  13545.           
  13546.    Also see [585]Section 7.8 on built-in help for functions.
  13547.      _________________________________________________________________
  13548.    
  13549.   7.4. New IF Conditions
  13550.   
  13551.    IF AVAILABLE feature command
  13552.           Executes the command if the given feature is available.
  13553.           Presently used only to determine if specific authentication and
  13554.           encryption options are available. Type "if available ?" to see
  13555.           which features may be tested.
  13556.           
  13557.    IF FLOAT f1 command
  13558.           Executes command if f1 is a legal floating point number (which
  13559.           includes integers). Use this to preverify arguments for the
  13560.           \ffp...() floating-point arithmetic functions, e.g. "if float
  13561.           \%1 echo \ffpint(\%1)".
  13562.           
  13563.    IF == n1 n2 command
  13564.           Synonym for "if =" (numeric equality). Note that as of C-Kermit
  13565.           7.0, this and all other numeric comparison operators also work
  13566.           for floating-point numbers.
  13567.           
  13568.    IF != n1 n2 command
  13569.           Executes the command if n1 and n2 are both numbers or variables
  13570.           containing numbers and the value of n1 is not equal to the
  13571.           value of n2. This is equivalent to "if not = n1 n2".
  13572.           
  13573.    IF <= n1 n2 command
  13574.           Executes the command if n1 and n2 are both numbers or variables
  13575.           containing numbers and the value of n1 is less than or equal to
  13576.           the value of n2. This is equivalent to "if not > n1 n2".
  13577.           
  13578.    IF >= n1 n2 command
  13579.           Executes the command if n1 and n2 are both numbers or variables
  13580.           containing numbers and the value of n1 is greater than or equal
  13581.           to the value of n2. Equivalent to "if not < n1 n2".
  13582.           
  13583.    IF COMMAND word command
  13584.           Executes the command if word is a built-in C-Kermit command.
  13585.           Example:
  13586.           
  13587.   if not command copy define { copy run copy \%1 \%2 }".
  13588.  
  13589.           This defines a COPY macro that runs an external COPY command if
  13590.           COPY is not already a built-in command.
  13591.           
  13592.    IF LOCAL command
  13593.           Executes the command if Kermit is in local mode, i.e. if it has
  13594.           a SET LINE, SET PORT, or SET HOST (TELNET, RLOGIN, etc) device
  13595.           or connection open. Does not execute the command if in remote
  13596.           mode.
  13597.           
  13598.    IF MATCH string pattern command
  13599.           Executes the command if the string matches the pattern. For a
  13600.           description of the syntax for the pattern, see [586]Section
  13601.           4.9.1. If you want to test if the string contains pattern, use
  13602.           IF \fsearch(pattern,string).
  13603.           
  13604.    IF OPEN { DEBUG-LOG, SESSION-LOG, TRANSACTION-LOG, ... } command
  13605.           Executes the command if the given file is open, fails if it is
  13606.           not open. Type IF OPEN ? for a complete list of files that can
  13607.           be checked (all the files that can be opened with the OPEN or
  13608.           LOG commands).
  13609.           
  13610.    IF QUIET command
  13611.           Executes the command if SET QUIET is ON, and does not execute
  13612.           it if SET QUIET is OFF. Example: IF NOT QUIET ECHO { This is a
  13613.           message.}.
  13614.           
  13615.    IF READABLE name
  13616.           Succeeds if name is the name of an existing file or directory
  13617.           that is readable.
  13618.           
  13619.    IF WRITEABLE name
  13620.           Succeeds if name is the name of an existing file or directory
  13621.           that is writeable, e.g.:
  13622.           
  13623.  
  13624.   if not writeable \v(lockdir) echo Please read installation instructions!
  13625.  
  13626.    IF FLAG command
  13627.           This tests a user-settable condition, which can mean anything
  13628.           you like. SET FLAG ON causes subsequent IF FLAG commands to
  13629.           succeed; SET FLAG OFF causes them to fail. One way to use it
  13630.           would be for debugging your scripts; precede any debugging
  13631.           statements with IF FLAG. Then SET FLAG on to debug your script,
  13632.           SET FLAG OFF to run it without debugging. Another common use is
  13633.           for causing an inner loop to cause an outer loop to exit.
  13634.           
  13635.    IF C-KERMIT command
  13636.           C-Kermit, but not Kermit 95 or MS-DOS Kermit, executes the
  13637.           command.
  13638.           
  13639.    IF K-95 command
  13640.           Kermit 95, but not C-Kermit or MS-DOS Kermit, executes the
  13641.           command.
  13642.           
  13643.    IF MS-KERMIT command
  13644.           MS-DOS Kermit, but not C-Kermit or Kermit 95, executes the
  13645.           command.
  13646.      _________________________________________________________________
  13647.    
  13648.   7.5. Using More than Ten Macro Arguments
  13649.   
  13650.    The \v(argc) variable now gives the actual number of arguments, even
  13651.    if the number is greater than 9:
  13652.    
  13653.   C-Kermit> define xx echo \v(argc)
  13654.   C-Kermit> xx a b c d e f g h i j k l m n o p q r s t u v w x y z
  13655.   27
  13656.  
  13657.    Remember that \v(argc) includes the name of the macro itself, so it is
  13658.    always at least 1, and is always 1 greater than the actual number of
  13659.    arguments. As in versions 6.0 and earlier, if more than 9 arguments
  13660.    are given, only the first nine are assigned to the variables \%1..\%9.
  13661.    
  13662.    The \&_[] array, discussed on page 353 of [587]Using C-Kermit, 2nd ed,
  13663.    now holds all the arguments, up to some implementation-dependent limit
  13664.    (64 or greater), rather than only the first 9. To illustrate: the
  13665.    following macro tells the number of arguments it was called with and
  13666.    then prints them:
  13667.    
  13668.   define show_all_args {
  13669.       local \%i
  13670.       echo \&_[0] - Number of arguments: \feval(\v(argc)-1)
  13671.       for \%i 1 \v(argc)-1 1 { echo \flpad(\%i,3). "\&_[\%i]" }
  13672.   }
  13673.  
  13674.    Within a macro \&_[0], like \%0, contains the name of the macro.
  13675.    
  13676.    At top level, the \&_[] array is filled as follows:
  13677.    
  13678.      * If the first argument on the C-Kermit command line was a filename,
  13679.        or C-Kermit was invoked from a "Kerbang" script ([588]Section
  13680.        7.19), element 0 contains the filename, and elements 1 through
  13681.        \v(argc)-1 hold the remaining command-line arguments.
  13682.      * Otherwise the program name goes in element 0, and elements 1
  13683.        through \v(argc)-1 hold any arguments that were included after
  13684.        "--" or "="
  13685.        
  13686.    The new \%* variable, when used within a macro, is replaced by the
  13687.    text that followed the macro name in the macro invocation. If no
  13688.    arguments were given, \%* is replaced by the empty string. Examples:
  13689.    
  13690.   C-Kermit> define xx echo [\%*]
  13691.   C-Kermit> define \%a oofa
  13692.   C-Kermit> xx
  13693.   []
  13694.   C-Kermit> xx \%a
  13695.   [oofa]
  13696.   C-Kermit> xx a
  13697.   [a]
  13698.   C-Kermit> xx a b
  13699.   [a b]
  13700.   C-Kermit> xx a b c
  13701.   [a b c]
  13702.   C-Kermit> xx a b c d e f g h i j k l m n o p q r s t u v w x y z
  13703.   [a b c d e f g h i j k l m n o p q r s t u v w x y z]
  13704.  
  13705.    Note that \%* can not be used at top level, since Kermit does not have
  13706.    access to the raw command line (only to its elements separately, after
  13707.    they have been processed by the shell and the C library).
  13708.    
  13709.    C-Kermit 7.0 also adds a SHIFT command:
  13710.    
  13711.    SHIFT [ number ]
  13712.           Shifts the macro arguments (except argument 0) the given number
  13713.           of places to the left and adjusts \v(argc) accordingly. The
  13714.           default number is 1.
  13715.           
  13716.    To illustrate, suppose macro XXX is invoked as follows:
  13717.    
  13718.   xxx arg1 arg2 arg3
  13719.  
  13720.    Then inside XXX, \%1 is "arg1", \%2 is "arg2", and \%3 is "arg3".
  13721.    After a SHIFT command is given inside XXX, then \%1 is "arg2", \%2 is
  13722.    "arg3", and \%3 is empty. \%0 (the name of the macro) remains
  13723.    unchanged.
  13724.    
  13725.    If more than 9 arguments were given, then arguments are shifted into
  13726.    the \%1..9 variables from the argument vector array.
  13727.    
  13728.    At top level, the SHIFT command operates on the \&_[] array and \%1..9
  13729.    variables; the \&@[] array is not affected. See [589]Section 7.16 for
  13730.    details.
  13731.    
  13732.    The \%* variable is not affected by the SHIFT command.
  13733.      _________________________________________________________________
  13734.    
  13735.   7.6. Clarification of Function Call Syntax
  13736.   
  13737.    Spaces are normally stripped from the front and back of each function
  13738.    argument; to prevent this enclose the argument in braces:
  13739.    
  13740.   \fsplit(\%a,&a,{ })
  13741.  
  13742.    However, function calls that contain spaces can make trouble when the
  13743.    function is to be used in a "word" field, since space separates words.
  13744.    For example:
  13745.    
  13746.   for \%i 1 \fsplit(\%a,&a,{ }) 1 {
  13747.     echo \%i. "\&a[\%i]"
  13748.   }
  13749.  
  13750.    In most cases, the trouble can be averted by enclosing the function
  13751.    reference in braces:
  13752.    
  13753.   for \%i 1 {\fsplit(\%a,&a,{ })} 1 {
  13754.     echo \%i. "\&a[\%i]"
  13755.   }
  13756.  
  13757.    or by replacing spaces with \32 (the ASCII code for space):
  13758.    
  13759.   for \%i 1 \fsplit(\%a,&a,\32) 1 {
  13760.     echo \%i. "\&a[\%i]"
  13761.   }
  13762.  
  13763.    Braces are also used in function calls to indicate grouping. For
  13764.    example:
  13765.    
  13766.   \fsubstring(abcd,2,2) = "bc"
  13767.  
  13768.    But suppose "abcd" needed to contain a comma:
  13769.    
  13770.   \fsubstring(ab,cd,2,2)
  13771.  
  13772.    This would cause an error, since "cd" appears to be the second
  13773.    argument, when really you want the first "2" to be the second
  13774.    argument. Braces to the rescue:
  13775.    
  13776.   \fsubstring({ab,cd},2,2) = "b,"
  13777.  
  13778.    Similarly, leading and trailing spaces are stripped from each
  13779.    argument, so:
  13780.    
  13781.   \fsubstring( abcd ,2,2) = "bc"
  13782.  
  13783.    but braces preserve them:
  13784.    
  13785.   \fsubstring({ abcd },2,2) = "ab"
  13786.  
  13787.    Given these special uses for braces, there is no way to pass literal
  13788.    braces to the function itself. For example:
  13789.    
  13790.   \fsubstring(ab{cd,2,2)
  13791.  
  13792.    causes an error.
  13793.    
  13794.    So if you need a function to include braces, define a variable
  13795.    containing the string that has braces. Example:
  13796.    
  13797.   define \%a ab{cd
  13798.   \fsubstring(\%a,2,2) = "b{"
  13799.  
  13800.    If the string is to start with a leading brace and end with a closing
  13801.    brace, then double braces must appear around the string (which itself
  13802.    is enclosed in braces):
  13803.    
  13804.   define \%a {{{foo}}}
  13805.   \fsubstring(\%a) = "{foo}"
  13806.  
  13807.    This also works for any other kind of string:
  13808.    
  13809.   define \%a {{ab{cd}}
  13810.   echo \fsubstring(\%a) = "ab{cd"
  13811.      _________________________________________________________________
  13812.    
  13813.   7.7. Autodownload during INPUT Command Execution
  13814.   
  13815.    As of 6.1 / 1.1.12, C-Kermit can be told to look for incoming Kermit
  13816.    (or Zmodem) packets during execution of an INPUT command. By default
  13817.    (for consistency with earlier releases), this is not done. You can
  13818.    enable this feature with:
  13819.    
  13820.   SET INPUT AUTODOWNLOAD ON
  13821.  
  13822.    (and disable it again with OFF.)
  13823.    
  13824.    One possible use for this feature is as a server mode with a time
  13825.    limit:
  13826.    
  13827.   INPUT 3600 secret-string-to-end-the-INPUT-command
  13828.  
  13829.    In this example, any GET, SEND, or REMOTE commands received within one
  13830.    hour (3600 seconds) of when the INPUT command was issued will be
  13831.    executed. Here's another example, in which we want to stay open until
  13832.    11:30pm, or until interrupted by seven consecutive Ctrl-C (\3)
  13833.    characters:
  13834.    
  13835.   INPUT 23:30:00 \3\3\3\3\3\3\3
  13836.  
  13837.    The INPUT AUTODOWNLOAD setting is displayed by SHOW SCRIPTS or SHOW
  13838.    INPUT.
  13839.      _________________________________________________________________
  13840.    
  13841.   7.8. Built-in Help for Functions.
  13842.   
  13843.    Beginning in C-Kermit 7.0, you may obtain a description of the calling
  13844.    conventions and return values of any built-in function, such as
  13845.    \fsubstring(), with the new HELP FUNCTION command; give the function's
  13846.    name without the leading "\f", e.g. "help func substring". You can use
  13847.    ?, completion, and abbreviation in the normal manner.
  13848.      _________________________________________________________________
  13849.    
  13850.   7.9. Variable Assignments
  13851.   
  13852.     7.9.1. Assignment Operators
  13853.     
  13854.    Programmers accustomed to languages such as C or Fortran might find
  13855.    Kermit's method of assigning values to variables unnatural or awkward.
  13856.    Beginning in C-Kermit 7.0, you can use the following alternative
  13857.    notation:
  13858.    
  13859.  .name = value    is equivalent to   DEFINE name value
  13860.  .name := value   is equivalent to   ASSIGN name value
  13861.  .name ::= value  is equivalent to   ASSIGN name \feval(value)
  13862.  
  13863.    When the command begins with a period (.), this indicates an
  13864.    assignment. The name can be a macro name, a \%{digit,letter} variable,
  13865.    or an array element. There can be space(s) between "." and the name.
  13866.    Examples:
  13867.    
  13868.   .\%a = This is a string  ; Same as "define \%a This is a string"
  13869.   echo \%a
  13870.   This is a string
  13871.  
  13872.   .xxx = \%a               ; Same as "define xxx \%a"
  13873.   echo \m(xxx)
  13874.   \%a
  13875.  
  13876.   .xxx := \%a              ; Same as "assign xxx \%a"
  13877.   echo \m(xxx)
  13878.   This is a string
  13879.  
  13880.   declare \&a[2]           ; Use with arrays...
  13881.   define \%i 2
  13882.   .\&a[1] = first
  13883.   .\&a[\%i] = second
  13884.  
  13885.    The following sequence illustrates the differences among three levels
  13886.    of evaluation:
  13887.    
  13888.   .\%x = 2          ; Define a variable to have a numeric value
  13889.   .\%y = (3 + \%x)  ; Define another variable as an arithmetic expression
  13890.  
  13891.   .xxx = 4 * \%y    ; "=" simply copies the right-hand side.
  13892.   echo \m(xxx)
  13893.   4 * \%y
  13894.  
  13895.   .xxx := 4 * \%y   ; ":=" evaluates the variables first, then copies.
  13896.   echo \m(xxx)
  13897.   4 * (3 + 2)
  13898.  
  13899.   .xxx ::= 4 * \%y  ; "::=" evaluates the expression, then copies.
  13900.   echo \m(xxx)
  13901.   20
  13902.  
  13903.    You can also use this syntax to clear (undefine) a variable:
  13904.    
  13905.   .\%a = oofa       ; Define the variable
  13906.   echo "\%a"
  13907.   "oofa"
  13908.   .\%a              ; Clear the variable
  13909.   echo "\%a"
  13910.   ""
  13911.  
  13912.    Extra credit: Can you guess what happens below when the file "abc"
  13913.    does not exist?
  13914.    
  13915.   fopen /read \%c abc
  13916.   if fail ...
  13917.      _________________________________________________________________
  13918.    
  13919.     7.9.2. New Assignment Commands
  13920.     
  13921.    Recall the DEFINE and ASSIGN commands, and their hidden counterparts,
  13922.    _DEFINE and _ASSIGN. The former take the variable name literally, the
  13923.    latter evaluate the variable-name field to form the variable name
  13924.    dynamically. Examples:
  13925.    
  13926.   DEFINE \%x foo    ; Sets the value of the variable \%x to "foo".
  13927.   DEFINE \%a \%x    ; Sets the value of the variable \%a to "\%x".
  13928.   _DEFINE x_\%a \%x ; Sets the value of the variable x_foo to "\%x".
  13929.   ASSIGN \%a \%x    ; Sets the value of the variable \%a to the "foo".
  13930.   _ASSIGN x_\%a \%x ; Sets the value of the variable x_foo to "foo".
  13931.  
  13932.    This concept has been carried over to the remaining
  13933.    variable-assignment commands: EVALUATE, INCREMENT, and DECREMENT:
  13934.    
  13935.    EVALUATE variablename expression
  13936.           Evaluates the arithmetic expression and assigns its value to
  13937.           the variable whose name is given. Example: "eval \%a 1+1"
  13938.           assigns "2" to \%a.
  13939.           
  13940.    _EVALUATE metaname expression
  13941.           Evaluates the arithmetic expression and assigns its value to
  13942.           the variable whose name is computed from the given metaname.
  13943.           Example: "eval foo<\%a>::\%1 \%2 * (\%3 + \%4)" assigns the
  13944.           value of "\%2 * (\%3 + \%4)" to the variable whose name is
  13945.           computed from "foo<\%a>::\%1".
  13946.           
  13947.    INCREMENT variablename [ expression ]
  13948.           Evaluates the arithmetic expression and adds its value to the
  13949.           value of the variable whose name is given. Example: "increment
  13950.           \%a".
  13951.           
  13952.    _INCREMENT metaname [ expression ]
  13953.           Evaluates the arithmetic expression and adds its value to the
  13954.           value of the variable whose name is computed from the given
  13955.           metaname. Example: "_increment Words::\%1.count[\%2]".
  13956.           
  13957.    DECREMENT variablename [ expression ]
  13958.           Evaluates the arithmetic expression and subtracts its value
  13959.           from the value of the variable whose name is given.
  13960.           
  13961.    _DECREMENT metaname [ expression ]
  13962.           Evaluates the arithmetic expression and subtracts its value
  13963.           from the value of the variable whose name is computed from the
  13964.           given metaname.
  13965.           
  13966.    WARNING: The syntax of the EVALUATE command has changed since C-Kermit
  13967.    6.0 and K95 1.1.17. Previously, it did not include a variable name,
  13968.    only an expression. To restore the old behavior, use SET EVALUATE OLD.
  13969.    To return to the new behavior after restoring the old behavior, use
  13970.    SET EVALUATE NEW.
  13971.    
  13972.    NOTE: There are no analogs to the "_" commands for the operators
  13973.    described in [590]Section 7.9.1; those operators can not be used to
  13974.    assign values to variables whose names must be computed.
  13975.      _________________________________________________________________
  13976.    
  13977.   7.10. Arrays
  13978.   
  13979.    C-Kermit 7.0 adds lots of new array-related features, and groups them
  13980.    together under the NEW ARRAY command:
  13981.    
  13982.    ARRAY { CLEAR, COPY, DECLARE, DESTROY, RESIZE, SHOW, SORT }
  13983.    
  13984.    In each of the ARRAY commands, wherever an array name is expected,
  13985.    "short forms" may be used. For example, all of the following are
  13986.    acceptable:
  13987.    
  13988.   array show \&a[]  (or SHOW ARRAY...)
  13989.   array show &a[]
  13990.   array show a[]
  13991.   array show &a
  13992.   array show a
  13993.  
  13994.    In addition, ranges are accepted in the ARRAY COPY, ARRAY CLEAR, ARRAY
  13995.    SET, ARRAY SHOW, and ARRAY SORT commands:
  13996.    
  13997.   array clear \&a[16]     ; Clears 16 thru end
  13998.   array clear &a[16]      ; Ditto
  13999.   array clear a[16]       ; Ditto
  14000.  
  14001.   array clear \&a[16:32]  ; Clears 16 thru 32
  14002.   array clear &a[16:32]   ; Ditto
  14003.   array clear a[16:32]    ; Ditto
  14004.  
  14005.    When using array names as function arguments, you must omit the "\"
  14006.    and you must include the "&". You may optionally include empty
  14007.    brackets. Examples:
  14008.    
  14009.   \fsplit(\%a,a)          ; Bad
  14010.   \fsplit(\%a,\&a)        ; Bad
  14011.   \fsplit(\%a,&a[3])      ; Bad
  14012.  
  14013.   \fsplit(\%a,&a)         ; Good
  14014.   \fsplit(\%a,&a[])       ; Good
  14015.      _________________________________________________________________
  14016.    
  14017.     7.10.1. Array Initializers
  14018.     
  14019.    Beginning in C-Kermit 7.0, you may initialize an array -- in whole or
  14020.    in part -- in its declaration:
  14021.    
  14022.    [ ARRAY ] DECLARE array-name[size] [ = ] [ value1 [ value2 [...] ] ]
  14023.    
  14024.    For compatibility with versions 5A and 6.0, the ARRAY keyword is
  14025.    optional. DECLARE can also be spelled DCL.
  14026.    
  14027.    Initializers are (a) optional, (b) start with element 1, (c) must be
  14028.    enclosed in braces if they contain spaces, and (d) are evaluated
  14029.    according to normal rules by the DECLARE command prior to assignment.
  14030.    Thus the assignments made here are the same as those made by the
  14031.    ASSIGN command. This allows you to initialize array elements from the
  14032.    values of other variables. If you actually want to initialize an array
  14033.    element to variable's name, as opposed to its value, use double
  14034.    backslashes (as in "\\&a", "\\v(time)", etc).
  14035.    
  14036.    The size (dimension) of the array is optional. If the size is omitted,
  14037.    as in "\&a[]", then the array sizes itself to the number of
  14038.    initializers; if there are no initializers the array is not declared
  14039.    or, if it was declared previously, it is destroyed. If a size is
  14040.    given, any extra elements in the initialization list are discarded and
  14041.    ignored.
  14042.    
  14043.    NOTE: Unlike in C, the list of initializers is NOT enclosed in braces.
  14044.    Instead, braces are used to group multiple words together. So:
  14045.    
  14046.   ARRAY DECLARE \&a[] = { one two three }
  14047.  
  14048.    would create an array with two elements (0 and 1), with element 1
  14049.    having the value " one two three ".
  14050.    
  14051.    Examples:
  14052.    
  14053.    ARRAY DECLARE \&a[16]
  14054.           Declares the array \&a with 17 elements (0 through 16), in
  14055.           which all elements are initially empty. If the array \&a[]
  14056.           existed before, the earlier copy is destroyed.
  14057.           
  14058.    ARRAY DECLARE &a[16]
  14059.           
  14060.    ARRAY DECLARE a[16]
  14061.           
  14062.    ARRAY DCL \&a[16]
  14063.           
  14064.    ARRAY DCL &a[16]
  14065.           
  14066.    ARRAY DCL a[16]
  14067.           
  14068.    DECLARE \&a[16]
  14069.           
  14070.    DECLARE &a[16]
  14071.           
  14072.    DECLARE a[16]
  14073.           
  14074.    DCL \&a[16]
  14075.           
  14076.    DCL &a[16]
  14077.           
  14078.    DCL a[16]
  14079.           All of the above are the same as the first example.
  14080.           
  14081.    ARRAY DECLARE \&a[16] = alpha beta {gamma delta}
  14082.           Declares the array \&a with 17 elements (0 through 16),
  14083.           initializing \&a[1] to "alpha", \&a[2] to "beta", and \&a[3] to
  14084.           "gamma delta". The remaining elements are empty.
  14085.           
  14086.    ARRAY DECLARE \&a[] = alpha beta {gamma delta}
  14087.           Same as the previous example, but the array is automatically
  14088.           dimensioned to 3.
  14089.           
  14090.    ARRAY DECLARE \&a[3] = alpha beta {gamma delta} epsilon zeta
  14091.           Too many initializers; only the first three are kept.
  14092.           
  14093.    ARRAY DECLARE \&a[0]
  14094.           
  14095.    ARRAY DECLARE \&a[]
  14096.           
  14097.    ARRAY DECLARE &a[]
  14098.           
  14099.    ARRAY DECLARE &a
  14100.           
  14101.    ARRAY DECLARE a
  14102.           
  14103.    DECLARE \&[0]
  14104.           
  14105.    DECLARE a
  14106.           
  14107.    DCL a
  14108.           All of these are equivalent. Each destroys \&a[] if it exists.
  14109.           Declaring an array with a dimension of 0 is the same as ARRAY
  14110.           DESTROY arrayname.
  14111.           
  14112.    ARRAY DECLARE \&a[] = \%1 \%2 \%3
  14113.           Declares the array \&a with 3 elements (0 through 3),
  14114.           initializing \&a[1] to the value of \%1, \&a[2] to the value of
  14115.           \%2, and \&a[3] to the value of \%3. In this case, any
  14116.           reference to one of these array elements is replaced by the
  14117.           value of the corresponding \%n variable at the time the
  14118.           declaration was executed (immediate evaluation; the array
  14119.           element's value does not change if the initializer variable's
  14120.           value changes).
  14121.           
  14122.    ARRAY DECLARE \&a[] = \\%1 \\%2 \\%3
  14123.           Declares the array \&a with 3 elements (0 through 3),
  14124.           initializing \&a[1] to the string "\%1", \&a[2] to "\%2", and
  14125.           \&a[3] to "\%3". In this case any reference to one of these
  14126.           array elements is replaced by the CURRENT value of the
  14127.           corresponding \%n variable (deferred evaluation -- the array
  14128.           element's value follows the value of the initializer variable).
  14129.           
  14130.    The equal sign (=) preceding the initializer list is optional, but is
  14131.    recommended for clarity. If you need to initialize element 1 to a
  14132.    literal equal sign, use two of them, separated by a space, as in this
  14133.    example:
  14134.    
  14135.   ARRAY DECLARE \&a[] = = + - * /
  14136.  
  14137.    Remember, element 0 is not initialized by the DECLARE command. To
  14138.    initialize element 0, use a regular DEFINE or ASSIGN command:
  14139.    
  14140.   ARRAY DECLARE \&a[] one two three four five six seven eight nine
  14141.   DEFINE \&a[0] zero
  14142.  
  14143.    Finally, remember that every command level has its own local array,
  14144.    \&_[], containing all the macro arguments (\%0, \%1, ...) for that
  14145.    level. See [591]Section 7.5 for details.
  14146.      _________________________________________________________________
  14147.    
  14148.     7.10.2. Turning a String into an Array of Words
  14149.     
  14150.    The \fsplit(s1,&a,s2,s3) function assigns the words of string s1 to
  14151.    successive elements of the array (beginning with element 1) whose
  14152.    identifying letter, a-z, is given after the "&" in the second
  14153.    argument, using break and include characters given in s2 and s3. See
  14154.    [592]Section 7.3 for details.
  14155.      _________________________________________________________________
  14156.    
  14157.     7.10.3. Arrays of Filenames
  14158.     
  14159.    See [593]Section 4.11.3 for news about how \ffiles() and related
  14160.    functions can assign a list of filenames to an array. To recapitulate
  14161.    briefly here:
  14162.    
  14163.   \ffiles(*,&a)
  14164.  
  14165.    assigns all files that match the first argument to the array denoted
  14166.    by the second argument. If the array has not been declared, it is
  14167.    declared automatically, with exactly the number of elements needed to
  14168.    hold the file list; if it was previously declared, it is destroyed and
  14169.    reused. The filenames are assigned starting at array element 1.
  14170.    Element 0 holds the number of files in the list.
  14171.    
  14172.    The DIRECTORY command ([594]Section 4.5.1) can also create filename
  14173.    arrays if you give it the /ARRAY: switch; this allows selection
  14174.    criteria beyond whether the filename matches the given pattern.
  14175.    
  14176.    All functions and commands that create filename arrays store the
  14177.    number of filenames, n, as element 0 of the array, and the filenames
  14178.    as elements 1 through n.
  14179.      _________________________________________________________________
  14180.    
  14181.     7.10.4. Automatic Arrays
  14182.     
  14183.    In a command file or macro, you can now have local (automatic) arrays.
  14184.    Just give the name followed by empty subscript brackets (no spaces
  14185.    inside the brackets please) in a LOCAL command, and then declare the
  14186.    array:
  14187.    
  14188.   LOCAL \%a \&a[] oofa
  14189.   ARRAY DECLARE \&a[32] = value1 value2 value3 ...
  14190.  
  14191.    This declares the scalar variable \%a, the array \&a[], and the macro
  14192.    name "oofa" to be local, and then declares the new local copy of \&a[]
  14193.    with 32 elements, perhaps assigning some initial values. When C-Kermit
  14194.    exits from the command file or macro containing these command, the
  14195.    previous \&a[] array is restored (and if there was no \&a[] at any
  14196.    higher level, this will still be true). The process can be repeated to
  14197.    any level. Thus it is now safe to write scripts or macros containing
  14198.    arrays without danger of interfering with global arrays of the same
  14199.    name.
  14200.    
  14201.    Just as scalars are inherited by lower command levels, so are arrays.
  14202.    So, for example, if \&a[] is declared at top level, all lower levels
  14203.    will see it unless they include a "local \&a[]" statement, in which
  14204.    case all levels at and beneath the level where the LOCAL statement was
  14205.    executed will see the local copy. This too can be repeated to any
  14206.    level.
  14207.    
  14208.    On the other hand, if you DECLARE an array at a lower command level
  14209.    without also making it LOCAL, this replaces the copy that was declared
  14210.    at the lowest command level above this one.
  14211.      _________________________________________________________________
  14212.    
  14213.     7.10.5. Sorting Arrays
  14214.     
  14215.    Although arrays can be sorted using FOR loops as shown on page 383 of
  14216.    Using C-Kermit, 2nd Ed., this involves quite a bit of repetitive
  14217.    interpretation by the command parser, and so can be slow for large
  14218.    arrays. For this reason, C-Kermit 7.0 adds a built-in SORT command:
  14219.    
  14220.    ARRAY SORT [ switches ] array [ array2 ]
  14221.           Sorts the given array in place. Sorting is strictly lexical
  14222.           (string based). The array name can be given fully, e.g.
  14223.           "\&a[]", or the "\" and/or "&" and/or brackets can be omitted,
  14224.           e.g. "array sort \&a[]", "sort &a", "sort a". Also, a range can
  14225.           be indicated in the brackets as noted in [595]Section 7.10, to
  14226.           restrict the sort to a range of elements (equivalent to the
  14227.           /RANGE switch, described just below), e.g. "array sort
  14228.           &a[20:30]".
  14229.           
  14230.    A second array may be specified. If it is, and if it is at least as
  14231.    big as the first array, it is sorted according to the first array. For
  14232.    a sample application, see [596]Section 7.10.10.
  14233.    
  14234.    See [597]Section 1.5 for an explanation of switches. The optional
  14235.    switches are:
  14236.    
  14237.    /CASE:{ON,OFF}
  14238.           /CASE:ON means that alphabetic case is significant in
  14239.           comparisons; uppercase letters are sorted before lowercase
  14240.           ones. /CASE:OFF means case is ignored, e.g. "A" is the same as
  14241.           "a". If this switch is not given, sorting is according the
  14242.           current SET CASE setting.
  14243.           
  14244.    /KEY:n
  14245.           Comparison begins at position n(1-based) in each string. If no
  14246.           key is given, the entire strings are compared. Only one key can
  14247.           be given. If an array element is shorter than the key value, n,
  14248.           that element is considered empty for comparison purposes, and
  14249.           therefore lexically less than any element at least ncharacters
  14250.           long.
  14251.           
  14252.    /NUMERIC
  14253.           If this switch is included, it means sorting should be numeric,
  14254.           rather than lexical. The sort key is the string starting at the
  14255.           key position, skipping any leading blanks or tabs, and then as
  14256.           much of the string from that point on that fits the definition
  14257.           of "numeric", terminating at the first character that does not
  14258.           qualify. A numeric string has an optional sign (+ or -)
  14259.           followed by one or more digits, and (if your version of Kermit
  14260.           was built with floating-point support; see [598]Section 7.23 )
  14261.           zero or one decimal point (period). If both /CASE and /NUMERIC
  14262.           are given, /NUMERIC takes precedence.
  14263.           
  14264.    /RANGE:n[:m]
  14265.           Sort elements nthrough m of the array. By default, the entire
  14266.           array from element 1 to its dimensioned size is sorted, which
  14267.           might produce surprising results if the array is not full; see
  14268.           example in [599]Section 7.10.7. If ":m" is omitted from the
  14269.           range, the dimensioned size is used. Thus, to sort an entire
  14270.           array, \&a[], including its 0th element, use "sort /range:0
  14271.           &a". You can also sort any desired section of an array, e.g.
  14272.           "sort /range:10:20 &a" or "sort /range:\%i:\%j-1 &b". As noted
  14273.           above, you can also specify a range in the array-name brackets.
  14274.           If you specify a range in the array-name brackets AND with a
  14275.           /RANGE switch, the ones in the brackets take precedence.
  14276.           
  14277.    /REVERSE
  14278.           Sort in reverse order. If this switch is not given, the array
  14279.           is sorted in ascending order.
  14280.           
  14281.    Remember that numeric switch arguments can be numbers, arithmetic
  14282.    expressions, or variables whose values are numbers or expressions, as
  14283.    illustrated in the /RANGE examples above.
  14284.    
  14285.    A typical sorting application might be to list students' test scores
  14286.    in descending order. Suppose you had the following records:
  14287.    
  14288.   olaf      65
  14289.   olga      98
  14290.   ivan      83
  14291.   xena     100
  14292.  
  14293.    (and so on) stored in array \&s[] (e.g. by reading them from a file as
  14294.    illustrated in [600]section 7.10.7). In these records, the student's
  14295.    name is in columns 1-9 and the score in 10-12. So to rearrange the
  14296.    list in descending order of score:
  14297.    
  14298.   sort /key:10 /reverse &s
  14299.  
  14300.    Then to list your top five students:
  14301.    
  14302.   for \%i 1 5 1 { echo \&s[\%i] }
  14303.  
  14304.    Or more simply (see next section):
  14305.    
  14306.   show array a[1:5]
  14307.  
  14308.    To illustrate the difference between a lexical and a numeric sort,
  14309.    suppose you have the following records (the lines that are numbered,
  14310.    starting at column 1) in array \&a[]:
  14311.    
  14312.     Column   1         2
  14313.     12345678901234567890
  14314.  
  14315.    1. Ivan 10.0 2. Olaf 9.95 3. Olga 101.5
  14316.    
  14317.    ARRAY SORT /KEY:10 &a[] would order them 3,1,2, but ARRAY SORT /KEY:10
  14318.    /NUMERIC &a[] would order them 2,1,3.
  14319.      _________________________________________________________________
  14320.    
  14321.     7.10.6. Displaying Arrays
  14322.     
  14323.    The SHOW ARRAY command (or ARRAY SHOW) now accepts an optional
  14324.    array-name argument:
  14325.    
  14326.   SHOW ARRAY \&a[]
  14327.  
  14328.    (you can leave off the \, the \&, and/or the []'s if you like; "show
  14329.    array a" is equivalent to "show array \&a[]"). When an array is
  14330.    specified, its dimension is shown and all defined (non-empty) elements
  14331.    are listed.
  14332.    
  14333.    Example:
  14334.    
  14335.   assign \%n \ffiles(*,&a)  ; Fill an array with filenames ([601]Section 4.11.3
  14336. )
  14337.   show array \&a[]          ; Show the array we just read
  14338.   array show \&a[]          ; Same as previous
  14339.   array sort \&a[]          ; Sort the array
  14340.   array show \&a[]          ; Show it after sorting
  14341.   array show \&a            ; Show it again
  14342.   array show &a             ; Show it again
  14343.   array show a              ; Show it again
  14344.  
  14345.    (The final four commands demonstrate the alternative forms that are
  14346.    accepted for the array name.)
  14347.    
  14348.    If you SHOW ARRAY without giving an array name, all defined arrays are
  14349.    listed by name and dimension, but their contents are not shown.
  14350.    
  14351.    You can also show a piece of an array by including a subscript or
  14352.    range within the array brackets:
  14353.    
  14354.   array show \&a[5]         ; Shows \&a[5]
  14355.   array show &a[3:8]        ; Shows \&a[3] through \&a[8]
  14356.   array show a[:\%n-1]      ; Shows \&a[0] through \&a[\%n-1]
  14357.      _________________________________________________________________
  14358.    
  14359.     7.10.7. Other Array Operations
  14360.     
  14361.    ARRAY DESTROY arrayname
  14362.           Destroys and undeclares the named array. Subscripts or ranges
  14363.           are not accepted in this command.
  14364.           
  14365.    ARRAY COPY array1 array2
  14366.           Copies the first array to the second array. If the target array
  14367.           has not been declared, it is created automatically with the
  14368.           same size as the first. If it has been declared, it will be
  14369.           used as declared; if the source array is larger, only as much
  14370.           of it as will fit is copied to the target array. Syntax for
  14371.           array1 and array2 is as in ARRAY SHOW (SHOW ARRAY). Example:
  14372.           
  14373.   .\%n := \ffiles(*,&a)  ; Create and load array A with a file list.
  14374.   array copy &a &b       ; Copy array A to array B.
  14375.  
  14376.           The ARRAY COPY command also lets you copy pieces of arrays by
  14377.           including range specifiers, as in these examples:
  14378.           
  14379.         ARRAY COPY \&a[4:27] \&b
  14380.                 This copies \&a[] elements 4-27 to \&b[] elements 1-23,
  14381.                 creating \&b[] if necessary or, if \&b[] is already
  14382.                 declared, stopping early if its size is less than 23.
  14383.                 
  14384.         ARRAY COPY \&a[4:27] \&b[12]
  14385.                 This copies \&a[] elements 4-27 to \&b[] elements 12-35,
  14386.                 creating \&b[] if necessary or, if \&b[] is already
  14387.                 declared, stopping early if its size is less than 35.
  14388.                 
  14389.         ARRAY COPY \&a[4:27] \&b[12:14]
  14390.                 This copies \&a[] elements 4-6 to \&b[] elements 12-14,
  14391.                 creating \&b[] if necessary or, if \&b[] is already
  14392.                 declared, stopping early if its size is less than 14.
  14393.                 
  14394.         ARRAY COPY \&a[17] \&b
  14395.                 This copies all the elements of \&a[] starting with 17
  14396.                 until the last to \&b[], creating \&b[] if necessary or,
  14397.                 if \&b[] is already declared, stopping early if \&b[] is
  14398.                 not big enough.
  14399.                 
  14400.    ARRAY CLEAR arrayname
  14401.           Sets all the elements of the array to the empty value. You may
  14402.           also include a range specifier to clear only a selected portion
  14403.           of the array; for example "array clear \&a[37:214]". If the
  14404.           range is out of bounds, only the part of the array that is in
  14405.           bounds is cleared.
  14406.           
  14407.    ARRAY SET arrayname [ value ]
  14408.           Sets all the elements of the array to the given value. If no
  14409.           value is given, the array is cleared. You may also include a
  14410.           range specifier to set only a selected portion of the array;
  14411.           for example "array set \&a[1:9] -1". If the range is out of
  14412.           bounds, only the part of the array that is in bounds is set.
  14413.           
  14414.    ARRAY RESIZE arrayname size
  14415.           Resizes the given array. If the size is greater than the
  14416.           array's current dimension, new empty elements are added to the
  14417.           end. If the size is less than the current dimension, the extra
  14418.           elements are discarded. Note: If you have stored the array size
  14419.           in element 0, ARRAY RESIZE does not change this value.
  14420.           Alternative notation: ARRAY RESIZE arrayname[size]. For a
  14421.           practical example, see [602]Section 7.10.11.
  14422.           
  14423.    \farraylook(pattern,arrayname)
  14424.           This function returns the index of the first element of the
  14425.           given array that matches the given pattern (for details about
  14426.           pattern syntax, see [603]section 4.9). The array name can
  14427.           include a range specification to restrict the search to a given
  14428.           segment of the array. If no elements match the pattern, -1 is
  14429.           returned.
  14430.           
  14431.    \ftablelook(keyword,arrayname[,delimiter])
  14432.           Looks in the given "table", which must be sorted, for the given
  14433.           keyword. The keyword need not be spelled out in full.
  14434.           Pattern-matching characters should not be included as part of
  14435.           the keyword. The function returns the index of the table
  14436.           element that uniquely matches the given keyword, or -1 if none
  14437.           match, or -2 if more than 1 match.
  14438.           
  14439.    A "table" is an array that is sorted in lexical order; each of its
  14440.    elements may contain multiple fields, delimited by the given delimiter
  14441.    character or, if no delimiter is specified, a colon (:).
  14442.    
  14443.    The \farraylook() function does exactly what you tell it. If you give
  14444.    it a pattern that does not include wildcard characters (such as *, ?,
  14445.    etc), it requires an exact match. For example:
  14446.    
  14447.   \farraylook(oofa,&a)
  14448.  
  14449.    searches for the first element of \&a[] whose value is "oofa". But:
  14450.    
  14451.   \farraylook(oofa*,&a)
  14452.  
  14453.    finds the first element whose value starts with "oofa", and;
  14454.    
  14455.   \farraylook(*oofa,&a)
  14456.  
  14457.    finds the first element whose value ends with "oofa", and;
  14458.    
  14459.   \farraylook(*oofa*,&a)
  14460.  
  14461.    finds the first element whose value contains "oofa".
  14462.    
  14463.    Here's a simple demonstration of looking up patterns in arrays:
  14464.    
  14465.   local \&a[] \%x \%n
  14466.   declare \&a[] = zero one two three four five six seven eight nine ten
  14467.   while true {
  14468.       .\%x = 1
  14469.       .\%n = 0
  14470.       ask \%a { Pattern? }
  14471.       if not def \%a exit 0 Done.
  14472.       while <= \%x \fdim(&a) {
  14473.           .\%x := \farraylook(\%a,&a[\%x])
  14474.           if ( < \%x 0 ) break
  14475.           echo \flpad(\%x,3). \&a[\%x]
  14476.           increment \%x
  14477.           increment \%n
  14478.       }
  14479.       if ( < \%n 1 ) echo Pattern not found - "\%a"
  14480.   }
  14481.  
  14482.    The array need not be sorted. When a pattern is given, a search is
  14483.    performed; if there is a match, the matching element's index and the
  14484.    element itself are printed, and the search begins again at the next
  14485.    element. Thus each matching element is printed. If none match, the
  14486.    "Pattern not found" message is printed. The process repeats for as
  14487.    many patterns as the user wants to type, and terminates when the user
  14488.    types an empty pattern.
  14489.    
  14490.    Now let's build a little command parser, consisting of a keyword
  14491.    table, and a loop to look up the user's commands in it with
  14492.    \ftablelook(). In this case the array elements have "fields" separated
  14493.    by colon (:) -- a keyword and a value. Keyword tables must be sorted
  14494.    if \tablelook() is to work right, so after declaring and initializing
  14495.    the table array, we sort it.
  14496.    
  14497.   local \&k[] \%a \%i \%n
  14498.  
  14499.   array declare \&k[] = drive:9 do:8 discuss:7 live:6 spend:5 help:4 quit:0
  14500.  
  14501.   array sort &k                             ; Make sure array is sorted
  14502.   echo Type "help" for help.                ; Print greeting & instructions
  14503.  
  14504.   while true {                              ; Loop to get commands
  14505.       undefine \%a
  14506.       while not defined \%a {               ; Get a command
  14507.           ask \%a { Command? }
  14508.       }
  14509.       .\%n := \ftablelook(\%a,&k)           ; Look up the command
  14510.       switch \%n {                          ; Handle errors
  14511.         :-1, echo Not found - "\%a"         ; Doesn't match
  14512.              continue
  14513.         :-2, echo Ambiguous - "\%a"         ; Matches too many
  14514.              continue
  14515.       }
  14516.       switch \fword(\&k[\%n],2) {           ; Dispatch according to value
  14517.          :9, echo Driving..., break
  14518.          :8, echo Doing..., break
  14519.          :7, echo Discussing..., break
  14520.          :6, echo Living..., break
  14521.          :5, echo Spending..., break
  14522.          :4, echo { Commands (may be abbreviated):}
  14523.              for \%i 1 \fdim(&k) 1 {
  14524.                 echo {  \%i. \fword(\&k[\%i],1) }
  14525.              }
  14526.              break
  14527.          :0, exit 0 Bye!
  14528.          :default, stop 1 Internal error
  14529.       }
  14530.   }
  14531.  
  14532.    In this example, keywords are "drive", "do", "discuss", etc, and their
  14533.    values are unique numbers (values need not be numbers, and there need
  14534.    not be only one value -- there can be 0, 1, 2, or more of them). The
  14535.    user types a command, which can be the whole word (like "help") or any
  14536.    abbreviation (like "hel", "he", or just "h"). If this does not match
  14537.    any keywords, \ftablelook() returns -1; if it matches more than one
  14538.    (as would "d"), it returns -2. Otherwise the array index is returned,
  14539.    1 or higher.
  14540.    
  14541.    Given the array index \%n, we can get the table values as follows:
  14542.    
  14543.   \fword(\&k[\%n],1) is the keyword (first field)
  14544.   \fword(\&k[\%n],2) is the value (second field, in this case a number)
  14545.  
  14546.    In our example, we use the value (number) as the SWITCH variable. As
  14547.    noted, \fablelook() expects the array elements to contain multiple
  14548.    fields separated by colon (:) (or other character that you specify,
  14549.    e.g. \ftablelook(\%a,&a,^)) and when matching the keyword, ignores the
  14550.    first delimiter and everything after it.
  14551.      _________________________________________________________________
  14552.    
  14553.     7.10.8. Hints for Using Arrays
  14554.     
  14555.    C programmers are accustomed to out-of-bounds array references causing
  14556.    core dumps or worse. In C-Kermit:
  14557.    
  14558.      * A reference to an an out-of-bounds array element returns the empty
  14559.        string.
  14560.      * An attempt to set the value of an array element that is out of
  14561.        bounds or that has not been declared simply fails.
  14562.        
  14563.    C programmers expect an array of size nto have elements 0 through n-1.
  14564.    Fortran programmers expect the same array to have elements 1 through
  14565.    n. C-Kermit accommodates both styles; when you declare an array of
  14566.    size n, it has n=1 elements, 0 through n, and you can use the array in
  14567.    your accustomed manner, 0-based or 1-based.
  14568.    
  14569.    However, note that C-Kermit has certain biases towards 1-based arrays:
  14570.    
  14571.      * Assignment of file lists starts with element 1 ([604]Section
  14572.        7.10.3).
  14573.      * Assignment by \fsplit() starts with element 1 ([605]Section 7.3).
  14574.      * Array initialization skips the 0th element. To initialize a
  14575.        0-based array, use something like this:
  14576.  
  14577.   declare \&a[3] = one two three
  14578.   .\&a[0] = zero
  14579.      * The ARRAY SORT command skips the 0th element unless you include
  14580.        /RANGE:0
  14581.      * The SHIFT command ignores element 0 of the \&_[] array.
  14582.        
  14583.    The distinction between an array's dimensioned size and the number of
  14584.    elements in the array is important when sorting. To illustrate:
  14585.    
  14586.   declare \&a[100]                  ; Declare array &a with 100 elements
  14587.   fopen /read \%c oofa.txt          ; Open a file
  14588.   if fail...
  14589.   for \%i 1 \fdim(&a) 1 {           ; Read the file into the array
  14590.       fread \%c \&a[\%i]
  14591.       if fail break
  14592.   }
  14593.   fclose \%c
  14594.   if > \%i \fdim(&a) end 1 File has too many lines for array.
  14595.   .\%n ::= \%i - 1
  14596.   echo File has \%n line(s).
  14597.  
  14598.    Let's say the file had 95 lines. This leaves elements 96-100 of the
  14599.    array empty. Now suppose you sort the array and write out the result:
  14600.    
  14601.   sort &a                           ; Sort the whole array
  14602.   fopen /write \%o oofa.txt.sorted  ; Open an output file
  14603.   if fail ...
  14604.   for \%i 1 \%n 1 {                 ; Write out 95 records
  14605.       fwrite /line \%o \&a[\%i]
  14606.       if fail end 1 Write error
  14607.   }
  14608.   close write
  14609.  
  14610.    You might be surprised at the contents of "oofa.txt.sorted" -- five
  14611.    empty elements, 96-100, floated to the top of the array in the sort,
  14612.    and since your write loop only had 95 iterations, the final 5 lines of
  14613.    the sorted file are lost.
  14614.    
  14615.    Therefore, when dealing with partially filled arrays -- especially
  14616.    when sorting them -- remember to specify the number of elements. A
  14617.    handy way of recording an array's "true" size is to put it in the 0th
  14618.    element. That way, it "travels with the array". To illustrate
  14619.    (continuing the previous example at the "close read" statement):
  14620.    
  14621.   close read
  14622.   if > \%i \fdim(&a) end 1 File has too many lines for array.
  14623.   .\&a[0] ::= \%i - 1     ; Assign number of lines to \&a[0].
  14624.   echo File has \&a[0] line(s).
  14625.   sort /range:1:\&a[0] &a
  14626.   open write oofa.txt.sorted
  14627.   if fail ...
  14628.   for \%i 1 \&a[0] 1 {
  14629.       writeln file \&a[\%j]
  14630.       if fail end 1 Write error
  14631.   }
  14632.   close write
  14633.  
  14634.    Note the SORT switch, /RANGE:1:\&a[0]. This keeps the sort 1-based,
  14635.    and uses element 0 of the array as its size indicator.
  14636.    
  14637.    Finally, note that even though some commands or functions might put a
  14638.    size in array element 0, no built-in functions or commands depend on a
  14639.    size actually being there. Thus you are perfectly free to replace the
  14640.    size with something else and treat the array as 0-based.
  14641.      _________________________________________________________________
  14642.    
  14643.     7.10.9. Do-It-Yourself Arrays
  14644.     
  14645.    Kermit's \&x[] arrays are nice because of the accompanying built-in
  14646.    functionality -- ARRAY commands, built-in functions that load and
  14647.    search arrays, automatic evaluation of arithmetic expressions within
  14648.    the subscript brackets, and so on. Yet they also have certain
  14649.    limitations:
  14650.    
  14651.     1. Except when created by dynamic loading (e.g. by \ffiles()) they
  14652.        must be declared and dimensioned in advance.
  14653.     2. Indices must be numeric, positive, and in range.
  14654.     3. There can be only one dimension. Matrices or other
  14655.        higher-dimensioned arrays are not available.
  14656.        
  14657.    But none of this is to say you can't invent any kind of data structure
  14658.    you like. In [606]Section 7.9.2 you can see some examples. Here's
  14659.    another (courtesy of Dat Thuc Nguyen), in which a pair of matrices is
  14660.    created and then added: no dimensioning necessary.
  14661.    
  14662.   .row = 4
  14663.   .col = 9
  14664.  
  14665.   ; MACRO TO PRINT A MATRIX
  14666.   define PMATRIX {
  14667.       echo Matrix \%1:
  14668.       for \%r 1 \m(row) 1 {
  14669.           for \%c 1 \m(col) 1 {
  14670.               xecho \flpad(\m(\%1[\%r][\%c]),4)
  14671.           }
  14672.           echo
  14673.       }
  14674.       echo
  14675.   }
  14676.   ; CREATE MATRICES A AND B
  14677.   for \%r 1 \m(row) 1 {
  14678.       for \%c 1 \m(col) 1 {
  14679.           _eval A[\%r][\%c] \%r + \%c
  14680.           _eval B[\%r][\%c] \%r * \%c
  14681.       }
  14682.   }
  14683.   ; CREATE MATRIX C = SUM OF MATRIX A AND MATRIX B
  14684.   for \%r 1 \m(row) 1 {
  14685.       for \%c 1 \m(col) 1 {
  14686.           _eval C[\%r][\%c] \m(A[\%r][\%c]) + \m(B[\%r][\%c])
  14687.       }
  14688.   }
  14689.   pmatrix A  ; Print Matrix A
  14690.   pmatrix B  ; Print Matrix B
  14691.   pmatrix C  ; Print Matrix C
  14692.  
  14693.    In the example, we use matrix-like notation to create macros with
  14694.    names like "A[1][1]", "B[3][7]", and so on.
  14695.      _________________________________________________________________
  14696.    
  14697.     7.10.10. Associative Arrays
  14698.     
  14699.    An associative array is a special kind of Do-It-Yourself array. It
  14700.    differs from a regular array in that its indices need not be numbers
  14701.    -- they can be anything at all -- words, filenames, names of months,
  14702.    any character string at all, and that it doesn't have to be (and in
  14703.    fact can't be) declared. An associative array element is simply a
  14704.    macro whose name ends with an index enclosed in angle brackets, for
  14705.    example:
  14706.    
  14707.   file<oofa.txt>
  14708.  
  14709.    More formally:
  14710.    
  14711.   basename<index>
  14712.  
  14713.    An associative array is a collection of all associative array elements
  14714.    that have the same basename. Any number of associative arrays, each
  14715.    with any number of elements, can exist at the same time.
  14716.    
  14717.    An associative array element can be assigned a value, such as "1",
  14718.    just like any other macro:
  14719.    
  14720.   define file<oofa.txt> 1     ; Give "file<oofa.txt>" the value "1".
  14721.  
  14722.    or:
  14723.    
  14724.   assign file<oofa.txt> \%a   ; Give it the value of the variable \%a.
  14725.  
  14726.    However, since an associative array element is a macro, it may not
  14727.    have an empty (null) value, since assigning an empty value to a macro
  14728.    undefines the macro.
  14729.    
  14730.    You can refer to the value of an associative array element using the
  14731.    familiar notation for macro values:
  14732.    
  14733.   echo \m(file<oofa.txt>)     ; Echo the value of "file<oofa.txt>".
  14734.  
  14735.    Associative arrays are most useful, however, when the value of the
  14736.    index is a variable. In that case, you must use the "hidden" forms of
  14737.    the DEFINE or ASSIGN commands that evaluate the macro name before
  14738.    making the assignment (see [607]Using C-Kermit, page 457). Example:
  14739.    
  14740.   define \%f oofa.txt
  14741.   _define file<\%f> 1
  14742.   echo file<\%f> = \m(file<\%f>)
  14743.  
  14744.    prints:
  14745.    
  14746.   file<oofa.txt> = 1
  14747.  
  14748.    and then:
  14749.    
  14750.   _increment file<\%f>
  14751.   echo file<\%f> = \m(file<\%f>)
  14752.  
  14753.    prints:
  14754.    
  14755.   file<oofa.txt> = 2
  14756.  
  14757.    What are associative arrays good for? The classic example is "word
  14758.    counts": finding the number of times each word is used in a text
  14759.    without knowing in advance what the words are. Without associative
  14760.    arrays, your program would have to build a table of some kind, and
  14761.    every time a word was encountered, look it up in the table to find its
  14762.    position and counter, or add it to the table if it wasn't found -- a
  14763.    time-consuming and laborious process. Associative arrays, however, let
  14764.    you use the word itself as the table index and therefore sidestep all
  14765.    the table building and lookups.
  14766.    
  14767.    Let's work through a practical example. Suppose you have a
  14768.    file-transfer log in which each line is composed of a number of
  14769.    blank-separated fields, and the 9th field is a filename (which happens
  14770.    to be the format of certain FTP server logs, as well as of C-Kermit's
  14771.    new FTP-format transaction log, described in [608]Section 4.17.2), for
  14772.    example:
  14773.    
  14774.   Wed Jul 14 09:35:31 1999 22 xx.mit.edu 13412 /pub/ftp/mm/intro.txt ....
  14775.  
  14776.    and you want to find out how many times each file was transferred. The
  14777.    following code builds an associative array, file<>, containing the
  14778.    counts for each file:
  14779.    
  14780.   local name line max \%c \%n          ; Declare local variables
  14781.   fopen /read \%c /var/log/ftpd.log    ; Open the log file ([609]Section 1.22)
  14782.   if fail exit 1 Can't open log        ; Check
  14783.   while true {                         ; Loop for each record
  14784.       fread /line \%c line             ; Read a line
  14785.       if fail break                    ; Check for end of file
  14786.       .name := \fword(\m(line),9,{ })  ; Get 9th field = filename (Sec 7.3)
  14787.       _increment file<\m(name)>        ; Increment its counter (Sec 7.9.2)
  14788.   }
  14789.   fclose \%c                           ; Close file when done.
  14790.  
  14791.    Note that _INCREMENT (and INCREMENT, and [_]DECREMENT) treat an empty
  14792.    (i.e. nonexistent) variable as having a value of 0, and therefore
  14793.    creates the variable with a value of 1.
  14794.    
  14795.    At this point, if you told Kermit to "show macro file<", it would list
  14796.    the associative array. But since you don't necessarily know the names
  14797.    of the files in the array, or even how many elements are in the array,
  14798.    how can you use it in a script program?
  14799.    
  14800.    The idea of creating macro names that include character-string indices
  14801.    enclosed in angle brackets is perfectly arbitrary and doesn't depend
  14802.    on any Kermit features that weren't already there -- we could just as
  14803.    easily have used some other notation, such as "file[index]",
  14804.    "file:index", or "file.index", and the code above would have worked
  14805.    just as well (with the corresponding syntax adjustments). But to be
  14806.    able to use an associative array in a program after the array is
  14807.    built, we need a method of accessing all its elements without knowing
  14808.    in advance what they are. That's where the chosen notation comes in.
  14809.    
  14810.    First of all, any macro name that ends with "<xxx>" (where "xxx" is
  14811.    any string) is case sensitive, unlike all other macro names, which are
  14812.    case independent. To illustrate, "file<oofa.txt>" and "file<OOFA.TXT>"
  14813.    are two distinct macros, whereas "OOFA", "Oofa", and "oofa", when used
  14814.    as macro names, are all the same.
  14815.    
  14816.    Second, the new \faaconvert() function converts an associative array
  14817.    (that is, all macros with names of the form "base<index>" that have
  14818.    the same "base" part) into a pair of regular arrays and returns the
  14819.    number of elements:
  14820.    
  14821.   \faaconvert(name,&a[,&b])
  14822.  
  14823.    "name" is the name of the associative array, without the angle
  14824.    brackets or index ("file" in our example).
  14825.    
  14826.    The second argument is the name of a regular array in which to store
  14827.    the indices of the associative array (filenames in our example); if an
  14828.    array of this name already exists, it is destroyed unless the array is
  14829.    LOCAL. The third argument is the name of another regular array in
  14830.    which to store the values (the counts in our example), with the same
  14831.    rules about array name collisions. If you care only about the indices
  14832.    and not the values, you can omit the third argument to \faaconvert().
  14833.    In any case, the associative array is converted, not copied: its
  14834.    elements are moved to the specified regular arrays, so after
  14835.    conversion the original associative array is gone.
  14836.    
  14837.    As with other array-loading functions, \faaconvert() sets element 0 of
  14838.    each array to the number of elements in the array.
  14839.    
  14840.    To continue our example:
  14841.    
  14842.   .max := 0                                   ; Maximum count
  14843.   .\%n := \faaconvert(file,&a,&b)             ; Convert
  14844.   for \%i 1 \%n 1 {                           ; Loop through values
  14845.       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
  14846.       if ( > \&b[\%i] \m(max) ) {             ; Check for new maximum
  14847.           .name := \&a[\%i]
  14848.           .max  := \&b[\%i]
  14849.       }
  14850.   }
  14851.   echo Most popular file: \m(name), accesses: \m(max)
  14852.  
  14853.    This lists the files and counts and then announces which file has the
  14854.    highest count.
  14855.    
  14856.    Now suppose you want to sort the array pair created from an
  14857.    associative array. In our example, \&a[] contains filenames, and \&b[]
  14858.    contains the associated counts. Here we take advantage of the ARRAY
  14859.    SORT command's ability to sort a second array according to the first
  14860.    one:
  14861.    
  14862.   array sort /reverse /numeric &b &a          ; Descending sort by count
  14863.  
  14864.    Now to see the top five files and their counts:
  14865.    
  14866.   echo The top 5 files are:
  14867.   for \%i 1 5 1 {                             ; Loop through top 5 values
  14868.       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
  14869.   }
  14870.      _________________________________________________________________
  14871.    
  14872.     7.10.11. Transferring Array Contents to Other Computers
  14873.     
  14874.    The SEND /ARRAY:arrayname command ([610]Section 4.7.1) allows you to
  14875.    send the contents of any array, or any contiguous segment of it, in
  14876.    either text or binary mode to another computer, using Kermit protocol.
  14877.    When used in conjunction with C-Kermit's other features (the array
  14878.    features described in this section; the file i/o package from
  14879.    [611]Section 1.22; its decision-making, pattern-matching, and string
  14880.    manipulation capabilities, and so on) the possibilities are endless:
  14881.    extracts of large files, remote database queries, ..., all without
  14882.    recourse to system-dependent mechanisms such UNIX pipes and filters,
  14883.    thus ensuring cross-platform portability of scripts that use these
  14884.    features.
  14885.    
  14886.    When sending an array in text mode, Kermit appends a line terminator
  14887.    to each array element, even empty ones, and it also converts the
  14888.    character set from your current FILE character-set to your current
  14889.    TRANSFER character-set, if any. No conversions are made or line
  14890.    terminations added in binary mode. For example, the following array:
  14891.    
  14892.   dcl \&a[] = One Two Three Four Five Six
  14893.  
  14894.    is sent as six lines, one word per line, in text mode, and as the bare
  14895.    unterminated string "OneTwoThreeFourFiveSix" in binary mode.
  14896.    
  14897.    You should always include a /TEXT or /BINARY switch in any SEND /ARRAY
  14898.    command to force the desired transfer mode, otherwise you're likely to
  14899.    be surprised by the effects described in [612]Section 4.3.
  14900.    
  14901.    Here are some examples:
  14902.    
  14903.    send /text /array:\&a[]
  14904.           Sends the entire contents of the array \&a[] in text mode.
  14905.           Since an as-name is not included, the receiver is told the
  14906.           filename is _array_a_.
  14907.           
  14908.    send /text /array:&a[]
  14909.           
  14910.    send /text /array:a[]
  14911.           
  14912.    send /text /array:&a
  14913.           
  14914.    send /text /array:a
  14915.           These are all equivalent to the previous example.
  14916.           
  14917.    send /text /array:&a /as-name:foo.bar
  14918.           As above, but the array is sent under the name foo.bar.
  14919.           
  14920.    send /text /array:&a[100:199] /as:foo.bar
  14921.           As above, but only the elements from 100 through 199 are sent.
  14922.           
  14923.    In text-mode transfers, character sets are translated according to
  14924.    your current settings, just as for text files. In binary mode, of
  14925.    course, there is no character-set translation or other conversion of
  14926.    any kind. But remember that array elements can not contain the NUL
  14927.    (ASCII 0) character, since they are implemented as NUL-terminated
  14928.    strings.
  14929.    
  14930.    Here's an example that shows how to send all the lines (up to 1000 of
  14931.    them) from a file animals.txt that contain the words "cat", "dog", or
  14932.    "hog" (see [613]Section 4.9 about pattern matching):
  14933.    
  14934.   declare \&a[1000]
  14935.   fopen /read \%c animals.txt
  14936.   if fail exit 1
  14937.   .\%i = 0
  14938.   while true {
  14939.       fread \%c line
  14940.       if fail break
  14941.       if match {\m(line)} {*{cat,[dh]og}*} {
  14942.           increment \%i
  14943.           if ( > \%i \fdim(&a) ) break
  14944.           .\&a[\%i] := \m(line)
  14945.       }
  14946.   }
  14947.   fclose \%c
  14948.   send /array:a[1:\%i] /text
  14949.  
  14950.    Note that we are careful to send only the part of the array that was
  14951.    filled, not the entire array, because there are likely to be lots of
  14952.    unused elements at the end, and these would be sent as blank lines
  14953.    otherwise.
  14954.    
  14955.    This example raises an interesting question: what if we want to send
  14956.    ALL the matching lines, even if there are more than 1000 of them, but
  14957.    we don't know the number in advance? Clearly the problem is limited by
  14958.    Kermit's (and the computer's) memory. If there are a thousand trillion
  14959.    matching lines, they most likely will not fit in memory, and in this
  14960.    case the only solution is to write them first to a temporary file on
  14961.    mass storage and then send the temporary file and delete it
  14962.    afterwards.
  14963.    
  14964.    However, when the selection is likely to fit in memory, the
  14965.    once-familiar technique of initial allocation with extents can be
  14966.    used:
  14967.    
  14968.   if match {\m(line)} {*{cat,[dh]og}*} {
  14969.       increment \%i
  14970.       if ( > \%i \fdim(&a) ) {
  14971.           array resize a \fdim(&a)+100
  14972.           if fail stop 1 MEMORY FULL
  14973.           echo NEW DIMENSION: \fdim(&a)
  14974.       }
  14975.       .\&a[\%i] := \m(line)
  14976.   }
  14977.  
  14978.    This grows the array in chunks of 100 as needed.
  14979.      _________________________________________________________________
  14980.    
  14981.   7.11. OUTPUT Command Improvements
  14982.   
  14983.    LINEOUT [ text ]
  14984.           This command is exactly like OUTPUT, except it supplies a
  14985.           carriage return at the end of the text. "lineout exit" is
  14986.           exactly the same as "output exit\13".
  14987.           
  14988.    SET OUTPUT SPECIAL-ESCAPES { ON, OFF }
  14989.           This command lets you tell C-Kermit whether to process \N, \L,
  14990.           and \B specially in an OUTPUT command, as distinct from other \
  14991.           sequences (such as \%a, \13, \v(time), etc). Normally the
  14992.           special escapes are handled. Use SET OUTPUT SPECIAL-ESCAPES OFF
  14993.           to disable them.
  14994.           
  14995.    Disabling special escapes is necessary in situations when you need to
  14996.    transmit lines of data and you have no control over what is in the
  14997.    lines. For example, a file oofa.txt that contains:
  14998.    
  14999.   This is a file
  15000.   It has \%a variables in it
  15001.   And it has \B in it.
  15002.   And it has \L in it.
  15003.   And it has \N in it.
  15004.   And this is the last line.
  15005.  
  15006.    can be sent like this:
  15007.    
  15008.   local line
  15009.   set output special-escapes off
  15010.   fopen /read \%c oofa.txt
  15011.   if fail stop 1 Can't open oofa.txt
  15012.   while success {
  15013.       fread \%c line
  15014.       if fail break
  15015.       ; Add filtering or processing commands here...
  15016.       output \m(line)\13
  15017.   }
  15018.      _________________________________________________________________
  15019.    
  15020.   7.12. Function and Variable Diagnostics
  15021.   
  15022.    In C-Kermit 6.0 and earlier, the only diagnostic returned by a failing
  15023.    function call was an empty value, which (a) could not be distinguished
  15024.    from an empty value returned by a successful function call; (b) did
  15025.    not give any indication of the cause of failure; and (c) did not cause
  15026.    the enclosing statement to fail. C-Kermit 7.0 corrects these
  15027.    deficiencies.
  15028.    
  15029.    SET FUNCTION DIAGNOSTICS { ON, OFF }
  15030.           when ON, allows built-in functions to return diagnostic
  15031.           messages when improperly referenced, instead of an empty
  15032.           string. FUNCTION DIAGNOSTICS are ON by default. When OFF,
  15033.           improperly referenced functions continue to return an empty
  15034.           string. This command also affects built-in variables; in this
  15035.           case, an error message is returned only if the variable does
  15036.           not exist. When FUNCTION DIAGNOSTICS are ON, the error message
  15037.           is also printed.
  15038.           
  15039.    For variables, the only message is:
  15040.    
  15041.   <ERROR:NO_SUCH_VARIABLE:\v(name)>
  15042.  
  15043.    where "name" is the name of the nonexistent variable.
  15044.    
  15045.    For functions, the diagnostic message is:
  15046.    
  15047.   <ERROR:message:\fname()>
  15048.  
  15049.    where "message" is replaced by a message, and "name" is replaced by
  15050.    the function name, e.g. <ERROR:ARG_NOT_NUMERIC:\fmod()>. Messages
  15051.    include:
  15052.    
  15053.   ARG_BAD_ARRAY       An argument contains a malformed array reference.
  15054.   ARG_BAD_DATE        An argument contains a malformed date and/or time.
  15055.   ARG_BAD_PHONENUM    An argument contains a malformed telephone number.
  15056.   ARG_BAD_VARIABLE    An argument contains a malformed \%x variable.
  15057.   ARG_INCOMPLETE      An argument is incomplete (e.g. a broken Base64 string).
  15058.   ARG_EVAL_FAILURE    An argument could not be evaluated (internal error).
  15059.   ARG_NOT_ARRAY       An argument references an array that is not declared.
  15060.   ARG_NOT_NUMERIC     An argument that must be integer contains non-digits.
  15061.   ARG_NOT_FLOAT       An argument has bad floating-point number format.
  15062.   ARG_NOT_VARIABLE    An argument that must be a variable is not a variable.
  15063.   ARG_OUT_OF_RANGE    An argument's numeric value is too big or too small,
  15064.                       or an argument contains illegal characters (e.g. a hex
  15065.                       or Base-64 string).
  15066.   ARG_TOO_LONG        An argument's value is too long.
  15067.   ARRAY_FAILURE       Failure to create an array.
  15068.   DIVIDE_BY_ZERO      Execution of the function would cause division by zero.
  15069.   FLOATING_POINT_OP   Execution error in a floating-point operation.
  15070.   FILE_NOT_FOUND      Filename argument names a file that can't be found.
  15071.   FILE_NOT_READABLE   Filename argument is not a regular file.
  15072.   FILE_NOT_ACCESSIBLE Filename argument names a file that is read-protected.
  15073.   FILE_ERROR          Other error with filename argument.
  15074.   FILE_NOT_OPEN       A file function was given a channel that is not open.
  15075.   FILE_ERROR_-n       A file function got error -n ([614]Section 1.22).
  15076.   LOOKUP_FAILURE      Error looking up function (shouldn't happen).
  15077.   MALLOC_FAILURE      Failure to allocate needed memory (shouldn't happen).
  15078.   NAME_AMBIGUOUS      The function is not uniquely identified.
  15079.   MISSING_ARG         A required argument is missing.
  15080.   NO_SUCH_FUNCTION    An argument references a function that is not defined.
  15081.   NO_SUCH_MACRO       An argument references a macro that is not defined.
  15082.   RESULT_TOO_LONG     The result of a function is too long.
  15083.   UNKNOWN_FUNCTION    Internal error locating function (shouldn't happen).
  15084.  
  15085.    Examples:
  15086.    
  15087.   assign \%m \fmod()
  15088.   ?<ERROR:MISSING_ARG:\fmod()>
  15089.   echo "\fcontents(\%m)"
  15090.   "<ERROR:MISSING_ARG:\fmod()>"
  15091.   echo \fmod(3,x)
  15092.   ?<ERROR:ARG_NOT_NUMERIC:\fmod()>
  15093.   echo \fmod(3,4-2*2)
  15094.   ?<ERROR:DIVIDE_BY_ZERO:\fmod()>
  15095.  
  15096.    Notice the use of \fcontents() in echoing the value of a variable that
  15097.    contains a returned error message. That's because the error message
  15098.    includes the name of the variable or function that failed, so you must
  15099.    use \fcontents() to prevent it from being evaluated again -- otherwise
  15100.    the same error will occur.
  15101.    
  15102.    The handling of function and variable errors is controlled by:
  15103.    
  15104.    SET FUNCTION ERROR { ON, OFF }
  15105.           Tells whether invalid function calls or variable references
  15106.           should cause command errors. FUNCTION ERROR is ON by default.
  15107.           When ON, and an error is diagnosed in a built-in function or
  15108.           variable, the command that includes the function call or
  15109.           variable reference fails. The failing command can be handled in
  15110.           the normal way with IF FAILURE / IF SUCCESS, SET TAKE ERROR, or
  15111.           SET MACRO ERROR.
  15112.           
  15113.    When FUNCTION DIAGNOSTICS is OFF, there is no error message.
  15114.    
  15115.    SHOW SCRIPTS displays the current FUNCTION DIAGNOSTICS and ERROR
  15116.    settings.
  15117.      _________________________________________________________________
  15118.    
  15119.   7.13. Return Value of Macros
  15120.   
  15121.    In C-Kermit 5A and 6.0, there are two ways to return one level from a
  15122.    macro: RETURN value and END number text. When RETURN is used, the
  15123.    value, which can be a number or a text string, is assigned to
  15124.    \v(return). When END was used, however, \v(return) was not set.
  15125.    SUCCESS/FAILURE was set according to whether the number was zero, and
  15126.    the text was printed, but the actual value of the number was lost.
  15127.    
  15128.    In C-Kermit 7.0, the END number is available in the \v(return)
  15129.    variable.
  15130.      _________________________________________________________________
  15131.    
  15132.   7.14. The ASSERT, FAIL, and SUCCEED Commands.
  15133.   
  15134.    The ASSERT command is just like the IF command, but without a command
  15135.    to execute. It simply succeeds or fails, and this can be tested by a
  15136.    subsequent IF SUCCESS or IF FAILURE command. Example:
  15137.    
  15138.   ASSERT = 1 1
  15139.   IF SUCCESS echo 1 = 1.
  15140.  
  15141.    The FAIL command does nothing, but always fails. The SUCCEED command
  15142.    does nothing, but always succeeds.
  15143.    
  15144.    These commands are handy in debugging scripts when you want to induce
  15145.    a failure (or success) that normally would not occur, e.g. for testing
  15146.    blocks of code that normally are not executed.
  15147.      _________________________________________________________________
  15148.    
  15149.   7.15. Using Alarms
  15150.   
  15151.    Alarms may be set in two ways:
  15152.    
  15153.    SET ALARM number
  15154.           Sets an alarm for the given number of seconds "from now", i.e.
  15155.           in the future, relative to when the SET ALARM command was
  15156.           given. Examples:
  15157.           
  15158.  
  15159.   set alarm 60        ; 60 seconds from now
  15160.   set alarm +60       ; The same as "60"
  15161.   set alarm -60       ; Not legal - you can't set an alarm in the past.
  15162.   set alarm 60*60     ; 60 minutes from now.
  15163.   set alarm \%a+10    ; You can use variables, etc.
  15164.  
  15165.    SET ALARM hh:mm:ss
  15166.           Sets an alarm for the specified time. If the given time is
  15167.           earlier than the current time, the alarm is set for the given
  15168.           time in the next day. You may give the time in various formats:
  15169.           
  15170.  
  15171.   set alarm 15:00:00  ; 3:00:00pm
  15172.   set alarm 3:00:00pm ; 3:00:00pm
  15173.   set alarm 3:00pm    ; 3:00:00pm
  15174.   set alarm 3pm       ; 3:00:00pm
  15175.  
  15176.    SHOW ALARM
  15177.           Displays the current alarm, if any, in standard date-time
  15178.           format (see [615]Section 1.6): yyyymmdd hh:mm:ss.
  15179.           
  15180.    IF ALARM command
  15181.           Executes the command if an alarm has been set and the alarm
  15182.           time has passed.
  15183.           
  15184.    IF ALARM { command-list } [ ELSE { command-list } ]
  15185.           Executes the command-list if an alarm has been set and the
  15186.           alarm time has passed. Otherwise, if an ELSE part is given, its
  15187.           command-list is executed.
  15188.           
  15189.    CLEAR ALARM
  15190.           Clears the alarm.
  15191.           
  15192.    Only one alarm may be set at a time.
  15193.    
  15194.    Example: Suppose you have a script that is always running, and that
  15195.    transfers files periodically, and that keeps a transaction log.
  15196.    Suppose you want to start a new transaction log each day:
  15197.    
  15198.   log transactions \v(date).log
  15199.   set alarm 00:00:00                     ; Set an alarm for midnight
  15200.   while true {                           ; Main script loop
  15201.       xif alarm {                        ; If the alarm time is past...
  15202.           close transactions             ; Close current log
  15203.           log transactions \v(date).log  ; Start new one
  15204.           pause 1                        ; To make sure 00:00:00 is past
  15205.           set alarm 00:00:00             ; Set a new alarm
  15206.       }
  15207.       ; put the rest of the script here...
  15208.   }
  15209.  
  15210.    Note that IF ALARM -- no matter whether it succeeds or fails -- does
  15211.    NOT clear an expired alarm. Thus, once an alarm has expired, every IF
  15212.    ALARM will succeed until the alarm is cleared (with the CLEAR ALARM
  15213.    command) or reset with a new SET ALARM command.
  15214.      _________________________________________________________________
  15215.    
  15216.   7.16. Passing Arguments to Command Files
  15217.   
  15218.    Beginning in version 7.0, C-Kermit accepts arguments on the TAKE
  15219.    command line, for example:
  15220.    
  15221.   C-Kermit> take oofa.ksc one two {this is three} four
  15222.  
  15223.    This automatically sets the variables \%1 through \%9 to the
  15224.    arguments, and \%0 to the name of the file, in this case:
  15225.    
  15226.   \%0 = /usr/olga/oofa.ksc
  15227.   \%1 = one
  15228.   \%2 = two
  15229.   \%3 = this is three
  15230.   \%4 = four
  15231.  
  15232.    and \%5..\%9 are undefined (empty). Arguments past the ninth are
  15233.    available in the \&_[] argument-vector array ( [616]Section 7.5).
  15234.    
  15235.    The variables are those at the current macro level. Thus, if the TAKE
  15236.    command is executed from within a macro, the macro's arguments are
  15237.    replaced by those given on the TAKE command line (but only if at least
  15238.    one argument is given). The command shown above is exactly equivalent
  15239.    to:
  15240.    
  15241.   assign \%0 /usr/olga/oofa.ksc
  15242.   assign \%1 one
  15243.   assign \%2 two
  15244.   assign \%3 this is three
  15245.   assign \%4 four
  15246.   assign \%5
  15247.   assign \%6
  15248.   assign \%7
  15249.   assign \%8
  15250.   assign \%9
  15251.   take oofa.ksc
  15252.  
  15253.    Remember, the variables \%0..\%9 are on the macro call stack, and
  15254.    command files are independent of the macro stack. Thus, if a command
  15255.    file TAKEs another command file and passes arguments to it, the
  15256.    variables are changed from that point on for both files, and so forth
  15257.    for all levels of nested command files without intervening macro
  15258.    invocations.
  15259.    
  15260.    It would have been possible to change C-Kermit to use the overall
  15261.    command stack, rather than the macro stack, for arguments -- this
  15262.    would have made TAKE work exactly like DO, which is "nicer", but it
  15263.    would also have broken countless existing scripts. However, the new
  15264.    SHIFT command ([617]Section 7.5) makes it possible to create an
  15265.    alternative TAKE command that does indeed save and restore the
  15266.    argument variables at its own level around execution of a command
  15267.    file:
  15268.    
  15269.   define mtake {
  15270.      local \%f
  15271.      assign \%f \fcontents(\%1)
  15272.      shift
  15273.      take \%f
  15274.   }
  15275.  
  15276.    C-Kermit 7.0 also supports a new, easier way to pass arguments to
  15277.    scripts from the system command line:
  15278.    
  15279.   kermit filename arg1 arg2 arg3 ...
  15280.  
  15281.    in which arg1, arg2, arg3 (etc) are arguments for the script (whose
  15282.    filename is given), and are assigned to \%1, \%2, ... \%9. The
  15283.    filename is assigned to \%0. This applies equally to "Kerbang" scripts
  15284.    in UNIX ([618]Section 7.19). For example, suppose you have a file
  15285.    called "showargs" containing the following lines:
  15286.    
  15287.   #!/usr/local/bin/kermit +
  15288.   echo Hello from \%0
  15289.   show args
  15290.   exit
  15291.  
  15292.    (except not indented, since the "#!" line must be on the left margin).
  15293.    If you give this file execute permission:
  15294.    
  15295.   chmod +x showargs
  15296.  
  15297.    then you can run it exactly as you would run a UNIX shell script,
  15298.    e.g.:
  15299.    
  15300.   $ showargs one two three
  15301.   Hello from /usr/olga/showargs
  15302.   Top-level arguments (\v(argc) = 4):
  15303.    \&_[0] = /usr/olga/showargs
  15304.    \&_[1] = one
  15305.    \&_[2] = two
  15306.    \&_[3] = three
  15307.  
  15308.    Furthermore, the \&_[] array now contains the filename, if one was
  15309.    given as the first command line argument, or it is a "Kerbang" script,
  15310.    in element 0.
  15311.    
  15312.    Otherwise element 0 is program name, and elements 1 through \v(argc)-1
  15313.    contain the command-line arguments, if any, that appear after "--" or
  15314.    "=", if any. This array is saved and restored around macro calls;
  15315.    recall that inside macros it contains the macro argument vector
  15316.    (allowing you to access arguments programmatically, and to have more
  15317.    than 9 of them).
  15318.    
  15319.    At top level, notice the difference between the \&@[] and \&_[]
  15320.    arrays. The former includes C-Kermit options; the latter omits them.
  15321.      _________________________________________________________________
  15322.    
  15323.   7.17. Dialogs with Timed Responses
  15324.   
  15325.    The ASK, ASKQ, GETOK, and GETC commands (let's call them the
  15326.    "ASK-class commands") let you write scripts that carry on dialogs with
  15327.    the user, asking them for text, a Yes/No answer, or a character,
  15328.    respectively. Prior to C-Kermit 7.0, these questions would always wait
  15329.    forever for an answer. In C-Kermit 7.0, you may specify a time limit
  15330.    for them with the new command:
  15331.    
  15332.    SET ASK-TIMER number
  15333.           Sets a time-limit on ASK-CLASS commands to the given number of
  15334.           seconds. If the number is 0 or less, there is no time limit and
  15335.           these commands wait forever for a response. Any timer that is
  15336.           established by this command remains in effect for all future
  15337.           ASK-class commands until another SET ASK-TIMER command is given
  15338.           (e.g. with a value of 0 to disable ASK timeouts).
  15339.           
  15340.    IF ASKTIMEOUT command
  15341.           An ASK-class command that times out returns a failure status.
  15342.           You can test explicitly for a timeout with:
  15343.      _________________________________________________________________
  15344.    
  15345.   7.18. Increased Flexibility of SWITCH Case Labels
  15346.   
  15347.    Prior to C-Kermit 7.0 / K95 1.1.19, the case labels in SWITCH
  15348.    statements were string constants.
  15349.    
  15350.    Now case labels can be variables, function calls, or any mixture of
  15351.    these with each other and/or with regular characters.
  15352.    
  15353.    Furthermore, after the case label is evaluated, it is treated not as a
  15354.    string constant, but as a pattern against which the SWITCH variable is
  15355.    matched ([619]Section 4.9.1).
  15356.    
  15357.    This introduces a possible incompatibility with previous releases,
  15358.    since the following characters in case labels are no longer taken
  15359.    literally:
  15360.    
  15361.   \ * ? [ {
  15362.  
  15363.    Any scripts that previously included any of these characters in case
  15364.    labels must now quote them with backslash (\).
  15365.      _________________________________________________________________
  15366.    
  15367.   7.19. "Kerbang" Scripts
  15368.   
  15369.    In UNIX only, Kermit scripts can be stored in files and run
  15370.    "directly", without starting Kermit first (as noted on page 467 of the
  15371.    manual), just as a shell script can be "run" as if it were a program.
  15372.    This section amplifies on that idea a bit, and presents some new
  15373.    aspects of version 7.0 that make it easier to write and run Kermit
  15374.    scripts directly.
  15375.    
  15376.      NOTE: On non-UNIX platforms, such as VMS or Windows, Kerbang
  15377.      scripts can be run as "kermit + scriptfilename arg1 arg2 arg3 ...".
  15378.      Windows 95/98/NT file associations do not allow for the passing of
  15379.      parameters. In VMS, however, you can achieve the Kerbang effect by
  15380.      defining a symbol, as in this example:
  15381.      
  15382.   $ autotelnet :== "$SYS$TOOLS:KERMIT.EXE + AUTOTELNET.KSC"
  15383.  
  15384.      and then running the script like any other command:
  15385.      
  15386.   $ autotelnet xyzcorp.com myuserid
  15387.  
  15388.      See [620]Section 9.3 for an explanation of the "+" symbol.
  15389.      
  15390.    UNIX shell scripts can specify which shell should run them by
  15391.    including a "shebang" line at the top, e.g.:
  15392.    
  15393.   #!/bin/sh
  15394.  
  15395.    (but not indented; the shebang line must be on the left margin). The
  15396.    term "shebang" is a contraction of "shell" and "bang". "Bang" is a
  15397.    slang word for the exclamation mark ("!"); "shebang" itself is an
  15398.    American slang word used in in the phrase "the whole shebang".
  15399.    
  15400.    We can run Kermit scripts directly too, by including a "shebang" line
  15401.    that names Kermit as the "shell"; thus we call these "Kerbang"
  15402.    scripts. This mechanism has been considerably simplified in C-Kermit
  15403.    7.0 to facilitate C-Kermit's use a scripting tool just like any of the
  15404.    UNIX shells or scripting languages. The rules are the same as for
  15405.    shell scripts:
  15406.    
  15407.     1. The first line of the Kermit script must begin with "#!"
  15408.        immediately followed by the full pathname of the program that will
  15409.        execute the script (in this case, C-Kermit rather than a UNIX
  15410.        shell), followed by any Kermit command-line options. To suppress
  15411.        execution of the C-Kermit initialization file and to make command
  15412.        line arguments available to the script, the final option should be
  15413.        "+":
  15414.  
  15415.   #!/usr/local/bin/kermit +
  15416.        Some users have reported that in some circumstances a space might
  15417.        be necessary after the plus sign; this depends on your shell -- it
  15418.        has nothing to do with Kermit. In most cases, no space is needed.
  15419.     2. The file must have execute permission (granted via "chmod +x
  15420.        filename").
  15421.        
  15422.    In some cases, the Kerbang script file might need the same owner,
  15423.    group, and permissions as the Kermit program itself in order to access
  15424.    dialout devices. (This is true at least in HP-UX.)
  15425.    
  15426.    When C-Kermit is invoked from a Kerbang script (or from the system
  15427.    prompt with a "+" command-line argument, which amounts to the same
  15428.    thing), the following special rules apply:
  15429.    
  15430.     1. The C-Kermit initialization file is NOT executed automatically. If
  15431.        you want it to be executed, include a TAKE command for it in the
  15432.        script, e.g. "take \v(home).kermrc". (In previous releases, the
  15433.        initialization file was always executed, with no way to prevent it
  15434.        except for the user to include Kermit-specific command line
  15435.        options which had nothing to do with the script). Many scripts
  15436.        have no need for the standard Kermit initialization file, which is
  15437.        quite lengthy and not only delays startup of the script, but also
  15438.        spews forth numerous messages that are most likely unrelated to
  15439.        the script.
  15440.     2. If the initialization file is not executed, neither is your
  15441.        customization file, since the initialization file is the command
  15442.        file from which the customization file is TAKEn. Again, you can
  15443.        include a TAKE command for the initialization file if desired, or
  15444.        for the customization file by itself, or for any other file.
  15445.     3. C-Kermit does not process command-line arguments at all. Instead,
  15446.        it passes all words on the command line after the "+" to the
  15447.        script as \%0 (the script name), \%1..\%9 (the first nine
  15448.        arguments), as well as in the argument vector array \&_[]. The
  15449.        variable \v(argc) is set to the total number of "words" (as passed
  15450.        by the shell to Kermit) including the script name. Quoting and
  15451.        grouping rules are those of the shell.
  15452.     4. At any point where the script terminates, it must include an EXIT
  15453.        command if you want it to exit back to the shell; otherwise
  15454.        C-Kermit enters interactive prompting mode when the script
  15455.        terminates. The EXIT command can include a numeric status to be
  15456.        returned to the shell (0, 1, etc), plus an optional message.
  15457.        
  15458.    Here is a simple Kerbang script that prints its arguments:
  15459.    
  15460.   #/usr/local/bin/kermit +
  15461.   echo Hello from \%0
  15462.   for \%i 0 \v(argc)-1 1 {
  15463.       echo \%i. "\&_[\%i]"
  15464.   }
  15465.   exit 0
  15466.  
  15467.    Save this file as (say) "showargs", then give it execute permission
  15468.    and run it (the \&_[] array is the same as \%0..\%9, but allows you to
  15469.    refer to argument variables programmatically; see [621]Section 7.5).
  15470.    (Yes, you could substitute SHOW ARGUMENTS for the loop.)
  15471.    
  15472.   $ chmod +x showargs
  15473.   $ ./showargs one "this is two" three
  15474.  
  15475.    The script displays its arguments:
  15476.    
  15477.   Hello from /usr/olga/showargs
  15478.   0. "/usr/olga/showargs"
  15479.   1. "one"
  15480.   2. "this is two"
  15481.   3. "three"
  15482.   $
  15483.  
  15484.    Notice that no banners or greetings are printed and that startup is
  15485.    instantaneous, just like a shell script. Also notice that grouping of
  15486.    arguments is determined by *shell* quoting rules, not Kermit ones,
  15487.    since the command line is parsed by the shell before Kermit ever sees
  15488.    it.
  15489.    
  15490.    Of course you can put any commands at all into a Kerbang script. It
  15491.    can read and write files, make connections, transfer files, anything
  15492.    that Kermit can do -- because it *is* Kermit. And of course, Kerbang
  15493.    scripts can also be executed from the Kermit prompt (or from another
  15494.    script) with a TAKE command; the Kerbang line is ignored since it
  15495.    starts with "#", which is a comment introducer to Kermit just as it is
  15496.    to the UNIX shell. In VMS and other non-UNIX platforms, the Kerbang
  15497.    line has no effect and can be omitted.
  15498.    
  15499.    It might be desireable for a script to know whether it has been
  15500.    invoked directly from the shell (as a Kerbang script) or by a TAKE
  15501.    command given to the Kermit prompt or in a Kermit command file or
  15502.    macro. This can be done as in this example:
  15503.    
  15504.   #!/usr/local/bin/kermit +
  15505.   assign \%m \fbasename(\%0)
  15506.   define usage { exit 1 {usage: \%m phonenumber message} }
  15507.   define apage { (definition of APAGE...) } ; (See [622]book pp.454-456)
  15508.   xif equal "\%0" "\v(cmdfil)" {
  15509.       if not def \%1 usage
  15510.       if not def \%2 usage
  15511.       apage {\%1} {\%2}
  15512.       exit \v(status)
  15513.   }
  15514.  
  15515.    In a Kerbang script, \%0 and \v(cmdfile) are the same; both of them
  15516.    are the name of the script. When a script is invoked by a Kermit TAKE
  15517.    command, \%0 is the name of the Kermit program, but \v(cmdfile) is the
  15518.    name of the script. In the example above, a macro called APAGE is
  15519.    defined. If the script was invoked directly, the APAGE macro is also
  15520.    executed. Otherwise, it is available for subsequent and perhaps
  15521.    repeated use later in the Kermit session.
  15522.    
  15523.    An especially handy use for Kerbang scripts is to have the
  15524.    initialization file itself be one. Since the standard initialization
  15525.    file is rather long and time-consuming to execute, it is often
  15526.    overkill if you want to start Kermit just to transfer a file. Of
  15527.    course there are command-line switches to suppress initialization-file
  15528.    execution, etc, but another approach is to "run" the initialization
  15529.    file when you want its features (notably the services directory), and
  15530.    run C-Kermit directly when you don't. A setup like this requires that
  15531.    (a) the C-Kermit initialization file is configured as a Kerbang script
  15532.    (has #!/path.../kermit as first line), has execute permission, and is
  15533.    in your PATH; and (b) that you don't have a .kermrc file in your login
  15534.    directory.
  15535.      _________________________________________________________________
  15536.    
  15537.   7.20. IF and XIF Statement Syntax
  15538.   
  15539.    The IF command has been improved in two significant ways in C-Kermit
  15540.    7.0, described in the following subsections. All changes are backwards
  15541.    compatible.
  15542.    
  15543.     7.20.1. The IF/XIF Distinction
  15544.     
  15545.    The distinction between IF and XIF is no longer important as of
  15546.    C-Kermit 7.0. You should be able to use IF in all cases (and of
  15547.    course, also XIF for backwards compatibility). In the past, IF was
  15548.    used for single-command THEN parts, followed optionally by a separate
  15549.    ELSE command:
  15550.    
  15551.   IF condition command1    ; THEN part
  15552.   ELSE command2            ; ELSE part
  15553.  
  15554.    whereas XIF was required if either part had multiple commands:
  15555.    
  15556.   XIF condition { command, command, ... } ELSE { command, command, ... }
  15557.  
  15558.    The syntactic differences were primarily that IF / ELSE was two
  15559.    commands on two separate lines, whereas XIF was one command on one
  15560.    line, and that XIF allowed (and in fact required) braces around its
  15561.    command lists, whereas IF did not allow them.
  15562.    
  15563.    Furthermore, the chaining or nesting of parts and conditions was
  15564.    inconsistent. For example, the IF command could be used like this:
  15565.    
  15566.   IF condition command
  15567.   ELSE IF condition command
  15568.   ELSE IF condition command
  15569.   ELSE IF condition command
  15570.   ...
  15571.  
  15572.    but XIF could not. C-Kermit 7.0 accepts the old syntax and executes it
  15573.    the same as previous versions, but also accepts a new unified and more
  15574.    convenient syntax:
  15575.    
  15576.    IF condition command-list [ ELSE command-list ]
  15577.    
  15578.    or:
  15579.    
  15580. IF condition command-list
  15581. ELSE command-list
  15582.  
  15583.    in which the ELSE part is optional, and where command-list can be a
  15584.    single command (with or without braces around it) or a list of
  15585.    commands enclosed in braces. Examples:
  15586.    
  15587.    Example 1:
  15588.    
  15589.   IF condition { command1, command2 } ELSE { command3, command4 }
  15590.  
  15591.    Example 2 (same as Example 1):
  15592.    
  15593.   IF condition {
  15594.      command1
  15595.      command2
  15596.   } ELSE {
  15597.      command3
  15598.      command4
  15599.   }
  15600.  
  15601.    Example 3 (same as 1 and 2):
  15602.    
  15603.   IF condition {
  15604.      command1
  15605.      command2
  15606.   }
  15607.   ELSE { command3, command4 }
  15608.  
  15609.    Example 4 (same as 1-3):
  15610.    
  15611.   IF condition {
  15612.      command1
  15613.      command2
  15614.   }
  15615.   ELSE {
  15616.      command3
  15617.      command4
  15618.   }
  15619.  
  15620.    Example 5 (ELSE can be followed by another command):
  15621.    
  15622.   IF condition {
  15623.      command1
  15624.      command2
  15625.   } ELSE IF condition {
  15626.      command3
  15627.      command4
  15628.   } ELSE {
  15629.      command5
  15630.      command6
  15631.   }
  15632.  
  15633.    Example 5 suggests other possibilities:
  15634.    
  15635.   IF condition {
  15636.      command1
  15637.      command2
  15638.   } ELSE FOR variable initial final increment {
  15639.      command3
  15640.      command4
  15641.   }
  15642.  
  15643.    And this too is possible, except for some non-obvious quoting
  15644.    considerations:
  15645.    
  15646.   dcl \&a[6] = one two three four five six
  15647.  
  15648.   IF < \%n 3 {
  15649.       echo \\%n is too small: \%n
  15650.   } ELSE FOR \\%i 1 \\%n 1 {
  15651.       echo \\%i. \\&a[\\%i]
  15652.   }
  15653.  
  15654.    (The loop variable must be quoted in this context to prevent premature
  15655.    evaluation.)
  15656.      _________________________________________________________________
  15657.    
  15658.     7.20.2. Boolean Expressions (The IF/WHILE Condition)
  15659.     
  15660.    Prior to C-Kermit 7.0, the IF and WHILE commands accepted only a
  15661.    single Boolean ("true or false") assertion, e.g. "if > \%m 0 command"
  15662.    or "if exist filename command". There was no way to form Boolean
  15663.    expressions and, in particular, nothing that approached a Boolean OR
  15664.    function (AND could be simulated by concatenating IF statements: "if
  15665.    condition1 if condition2..").
  15666.    
  15667.    C-Kermit 7.0 (and K95 1.1.19) allow grouping of Boolean assertions
  15668.    using parentheses and combining them using AND (or &&) and OR (or ||).
  15669.    Each of these operators -- including the parentheses -- is a field and
  15670.    must be set off by spaces. AND has higher precedence than OR, NOT has
  15671.    higher precedence than AND, but parentheses can be used to force any
  15672.    desired order of evaluation. The old syntax is still accepted.
  15673.    
  15674.    Here are some examples:
  15675.    
  15676.   define \%z 0                          ; Define some variables
  15677.   define \%n 1                          ; for use in the examples.
  15678.  
  15679.   if > \%n \%z echo \%n is greater.     ; Original format - still accepted.
  15680.   if ( > \%n \%z ) echo \%n is greater. ; Parentheses may be used in 7.0.
  15681.   if ( > \%n \%z && not = \%z 0 ) ...   ; Two assertions combined with AND.
  15682.   if ( > \%n \%z and not = \%z 0 ) ...  ; Same as previous ("and" = "&&").
  15683.   if ( > \%n \%z || not = \%z 0 ) ...   ; Two assertions combined with OR.
  15684.   if ( > \%n \%z or not = \%z 0 ) ...   ; Same as previous ("or" = "||").
  15685.   if ( > \%n \%z || != \%z 0 ) ...      ; Ditto ("!=" = "not =").
  15686.   while ( 1 ) { ... }                   ; Just like C.
  15687.  
  15688.    Notice the spaces around all operators including the parentheses --
  15689.    these are required. The following examples show how parentheses can be
  15690.    used to alter the precedence of the AND and OR operators:
  15691.    
  15692.   if ( false || false && false || true ) ,..         ; True
  15693.   if ( false || ( false && false ) || true ) ...     ; Same as previous
  15694.   if ( ( false || false ) && ( false || true ) ) ... ; False
  15695.  
  15696.    Similarly for NOT:
  15697.    
  15698.   if ( not true && false ) ...          ; False (NOT binds to TRUE only)
  15699.   if ( ( not true ) && false ) ...      ; Same as previous
  15700.   if ( not ( true && false ) ) ...      ; True (NOT binds to (TRUE && FALSE))
  15701.  
  15702.    Notes:
  15703.    
  15704.     1. The syntax of the Boolean expression itself has not changed; each
  15705.        expression begins with a keyword or token such as "EXIST", ">", or
  15706.        "=", etc; operators such as "<", "=", and ">" do not go between
  15707.        their operands but precede them as before; this might be called
  15708.        "reverse reverse Polish notation"; it allows deterministic
  15709.        on-the-fly parsing of these expressions at the C-Kermit> prompt as
  15710.        well as in scripts, and allows ?-help to be given for each item
  15711.        when IF or WHILE commands are typed at the prompt.
  15712.     2. Parentheses are required when there is more than one Boolean
  15713.        assertion.
  15714.     3. Parentheses are not required, but are allowed, when there is only
  15715.        one Boolean assertion.
  15716.     4. Evaluation of Boolean assertions occurs left to right, but the
  15717.        resulting Boolean expression is evaluated afterwards according to
  15718.        the rules of precedence. All Boolean assertions are always
  15719.        evaluated; there is no "early stopping" property and therefore no
  15720.        question about when or if side effects will occur -- if any
  15721.        Boolean assertion has side effects, they will always occur.
  15722.        
  15723.    Constructions of arbitrary complexity are possible, within reason.
  15724.    
  15725.    Also see [623]Section 7.4 for new IF / WHILE conditions.
  15726.      _________________________________________________________________
  15727.    
  15728.   7.21. Screen Formatting and Cursor Control
  15729.   
  15730.    C-Kermit 7.0 adds a simple way to create formatted screens, the SCREEN
  15731.    command:
  15732.    
  15733.    SCREEN { CLEAR, CLEOL, MOVE-TO row [ column ] }
  15734.           Performs screen-formatting actions. Correct operation of these
  15735.           commands depends on proper terminal setup on both ends of the
  15736.           connection -- mainly that the host terminal type is set to
  15737.           agree with the kind of terminal or the emulation you are
  15738.           viewing C-Kermit through. The UNIX version uses terminfo or
  15739.           termcap (not curses); the VMS version uses SMG; K-95 uses its
  15740.           built in screen manager.
  15741.           
  15742.    SCREEN CLEAR
  15743.           Moves the cursor to home position and clears the entire screen.
  15744.           Synonyms: CLEAR COMMAND-SCREEN ALL (K-95 only), CLS, CLEAR
  15745.           SCREEN.
  15746.           
  15747.    SCREEN CLEOL
  15748.           Clears from the current cursor position to the end of the line.
  15749.           Synonym: CLEAR COMMAND-SCREEN EOL (K-95 only)
  15750.           
  15751.    SCREEN MOVE-TO row column
  15752.           Moves the cursor to the indicated row and column. The row and
  15753.           column numbers are 1-based, so on a 24x80 screen the home
  15754.           position is 1 1 and the lower right corner is 24 80. If a row
  15755.           or column number is given that too large for what Kermit or the
  15756.           operating system thinks is your screen size, the appropriate
  15757.           number is substituted.
  15758.           
  15759.    These escape sequences used by these commands depends on the platform.
  15760.    In UNIX, your TERM environment variable is used to query the
  15761.    terminfo/termcap database; if the query fails, ANSI/VT100 sequences
  15762.    are used. In VMS, the SMG library is used, which sends sequences based
  15763.    on your VMS terminal type. K95 does its own screen control. On other
  15764.    platforms (such as AOS/VS, VOS, etc), screen formatting is not
  15765.    supported, and the SCREEN command does nothing.
  15766.    
  15767.    The three SCREEN actions can be used in scripts to produce menus,
  15768.    formatted screens, dynamic displays, etc. Related variables include:
  15769.    
  15770.   \v(terminal)     The type terminal C-Kermit thinks you have.
  15771.   \v(rows)         The number of rows C-Kermit thinks your terminal has.
  15772.   \v(columns)      The number of columns C-Kermit thinks your terminal has.
  15773.  
  15774.    And functions:
  15775.    
  15776.   \fscrncurx()     The current X coordinate of the cursor (K-95 only).
  15777.   \fscrncury()     The current Y coordinate of the cursor (K-95 only).
  15778.   \fscrnstr(x,y,n) The string of length nat position (x,y) (K-95 only).
  15779.  
  15780.    And commands:
  15781.    
  15782.   ECHO string      Writes string + CRLF at the current cursor position.
  15783.   XECHO string     Writes string at current cursor position; CRLF not supplied.
  15784.   GETC v prompt    Issues prompt, reads one character into variable v, no echo.
  15785.  
  15786.    And special characters:
  15787.    
  15788.   Ctrl-L           At the C-Kermit> command prompt, or in a C-Kermit command,
  15789.                    works like Return or Enter, but also clears the screen
  15790.  
  15791.    Example 1: A macro that prints a message \%1 at cursor position
  15792.    (\%2,\%3):
  15793.    
  15794.   define MSG {
  15795.       if not def \%3 def \%3 0             ; Default column to 0
  15796.       if > \v(argc) 2 screen move \%2 \%3  ; Move to given row/col (if any)
  15797.       screen cleol                         ; Clear to end of line
  15798.       if def \%1 xecho \fcontents(\%1)     ; Print message (if any)
  15799.   }
  15800.  
  15801.    Example 2: A macro put the cursor on the bottom screen line, left
  15802.    margin:
  15803.    
  15804.   define BOT {
  15805.       screen move \v(rows) 0
  15806.   }
  15807.  
  15808.    Example 3: A macro to center message \%1 on line \%2.
  15809.    
  15810.   define CENTER {
  15811.       if not def \%2 def \%2 1
  15812.       .\%x ::= (\v(cols)-\flen(\%1))/2
  15813.       msg {\%1} {\%2} {\%x}
  15814.   }
  15815.  
  15816.    Example 4: A simple menu (building on Examples 1-3):
  15817.    
  15818.   def \%c 0                             ; Menu choice variable
  15819.   screen clear                          ; Clear the screen
  15820.   center {Welcome to This Menu} 2       ; Display the menu
  15821.   msg {Choices:} 4
  15822.   msg { 1. File} 6
  15823.   msg { 2. Edit} 7
  15824.   msg { 3. Exit} 8
  15825.   while ( != \%c 3 ) {                  ; Read and verify choice
  15826.       while true {                      ; Keep trying till we get a good one
  15827.           screen move 10                ; Move to line 10
  15828.           screen cleol                  ; Clear this line
  15829.           getc \%c {Your choice: }      ; Prompt and get and echo 1 character
  15830.           xecho \%c
  15831.           if ( not numeric \%c ) { msg {Not numeric - "\%c"} 12, continue }
  15832.           if ( >= \%c 1 && <= \%c 3 ) break
  15833.           msg {Out of range - "\%c"} 12
  15834.       }
  15835.       switch \%c {                      ; Valid choice - execute it.
  15836.         :1, msg {Filing... } 12, break
  15837.         :2, msg {Editing...} 12, break
  15838.         :3, msg {Exiting...} 12, break
  15839.       }
  15840.   }
  15841.   echo Bye                              ; Exit chosen - say goodbye.
  15842.   bot                                   ; Leave cursor at screen bottom.
  15843.   exit                                  ; And exit.
  15844.  
  15845.    Similar scripts can work over the communication connection; substitute
  15846.    INPUT and OUTPUT for GETC and ECHO/XECHO.
  15847.      _________________________________________________________________
  15848.    
  15849.   7.22. Evaluating Arithmetic Expressions
  15850.   
  15851.    A new arithmetic operator was added to the list recognized by the
  15852.    EVALUATE command, the \feval() function, and which can also be used
  15853.    anywhere else arithmetic expressions are accepted (numeric command
  15854.    fields, array subscripts, etc):
  15855.    
  15856.    Prefix "!"
  15857.           This operator inverts the "truth value" of the number or
  15858.           arithmetic expression that follows. If the value of the operand
  15859.           is 0, the result is 1. If the value is nonzero, the result is
  15860.           0.
  15861.           
  15862.    Examples:
  15863.    
  15864.   set eval old
  15865.   evaluate 0
  15866.   0
  15867.  
  15868.   evaluate !0
  15869.   1
  15870.  
  15871.   evaluate !3
  15872.   0
  15873.  
  15874.   evaluate !(-3)
  15875.   0
  15876.  
  15877.   .\%a = 1
  15878.   .\%b = 0
  15879.   evaluate !(\%a|\%b)
  15880.   0
  15881.  
  15882.   evaluate !(\%a&\%b)
  15883.   1
  15884.  
  15885.   evaluate !(!(\%a&\%b))
  15886.   0
  15887.  
  15888.    Note the distinction between Prefix ! (invert truth value) and Suffix
  15889.    ! (factorial). Also the distinction between Prefix ! and Prefix ~
  15890.    (which inverts all the bits in its operand). Also note that prefix
  15891.    operators (!, -, and ~) can not be adjacent unless you use parentheses
  15892.    to separate them, as shown in the final example above.
  15893.      _________________________________________________________________
  15894.    
  15895.   7.23. Floating-Point Arithmetic
  15896.   
  15897.    C-Kermit 7.0 adds limited support for floating-point numbers (numbers
  15898.    that have fractional parts, like 3.141592653). This support is
  15899.    provided through a small repertoire of functions and in Boolean
  15900.    expressions that compare numbers, but does not apply to number parsing
  15901.    in general, or to expression evaluation, array subscripts, the
  15902.    INCREMENT and DECREMENT commands, or in any context other than those
  15903.    listed in this section.
  15904.    
  15905.    A floating point number has an optional sign (+ or -), followed by a
  15906.    series of decimal digits containing either zero or one period (.)
  15907.    character, which is the decimal point. The use of comma or any other
  15908.    character besides period as a decimal point is not supported.
  15909.    Scientific notation is not supported either. Examples of legal
  15910.    floating-point numbers:
  15911.    
  15912.   0                Integers can be used
  15913.   1                Ditto
  15914.   2.               A decimal point without decimal digits
  15915.   3.0              A decimal point with decimal digits
  15916.   3.141592653      Ditto
  15917.  -4.0              A negative sign can be included
  15918.  +5.0              A positive sign can be included
  15919.  
  15920.    Examples of notations that are not accepted:
  15921.    
  15922.   1,000,000        Separators can not be used
  15923.   1.000.000        Ditto (or multiple decimal points)
  15924.   6.022137E23      No scientific notation
  15925.   6.62606868e-34   Ditto
  15926.   12.5+6.25        No "bare" expressions
  15927.  
  15928.    You can use IF FLOAT test a string or variable to see if it's in
  15929.    acceptable floating-point format. Example:
  15930.    
  15931.   ask \%f { Type a number: }
  15932.   if not def \%f .\%f = 0.0
  15933.   if not float \%f stop 1 Invalid floating-point number: "\%f"
  15934.  
  15935.    C-Kermit's floating-point support, like its support for whole numbers
  15936.    (integers), relies on the capabilities of the underlying computer.
  15937.    Your computer has only a limited amount of precision for numbers,
  15938.    depending on its architecture. Thus floating-point numbers that have
  15939.    too many digits will not be accurate; adding a very small number to a
  15940.    very large one might have no effect at all; and so on. For details,
  15941.    read a text on numerical analysis. Example:
  15942.    
  15943.   .\%a = 11111111111111111111  ; A long number
  15944.   .\%b = 22222222222222222222  ; Another one
  15945.   echo \ffpadd(\%a,\%b)        ; Add them - the result should be all 3's
  15946.   33333333333333330000.0       ; See the result
  15947.  
  15948.    In this example, the computer has 16 digits of precision; after that,
  15949.    the (low-order) digits are set to 0, since the computer doesn't know
  15950.    what they really are. In fact, the computer returns random digits, but
  15951.    Kermit sets all digits beyond the computer's precision to 0.
  15952.    
  15953.    C-Kermit's floating-point functions have names of the form
  15954.    "\ffpxxx(args)" ("\f" for function, "fp" for floating-point), where
  15955.    "xxx" is replaced by the name of the function, such as "sqrt", and
  15956.    "args" is the argument list, consisting of one or two floating-point
  15957.    numbers (depending on the function), and an optional "d" argument that
  15958.    says now many decimal places should be shown in the result. Example:
  15959.    
  15960.   \ffpdiv(10,3,1) returns "3.3"
  15961.   \ffpdiv(10,3,2) returns "3.33"
  15962.   \ffpdiv(10,3,3) returns "3.333"
  15963.  
  15964.    and so on, up to the precision of the computer. If the decimal-places
  15965.    argument is less than zero, the fractional part of the result is
  15966.    truncated:
  15967.    
  15968.   \ffpdiv(10,3,-1) returns "3".
  15969.  
  15970.    If the decimal-places argument is 0, or is omitted, C-Kermit returns
  15971.    as many decimal places as are meaningful in the computer's
  15972.    floating-point precision, truncating any extraneous trailing 0's:
  15973.    
  15974.   \ffpdiv(10,8) returns "1.25".
  15975.   \ffpdiv(10,4) returns "2.5".
  15976.   \ffpdiv(10,2) returns "5.0".
  15977.   \ffpdiv(10,3) returns "3.333333333333333" (for 16-digit precision).
  15978.  
  15979.    There is no way to request that a floating-point function return a
  15980.    decimal point but no decimal places. However, this is easy enough to
  15981.    accomplish in other ways, for example by supplying it outside the
  15982.    function call:
  15983.    
  15984.   echo \ffpadd(\%a,\%b,-1).
  15985.  
  15986.    Kermit's floating-point functions always round the result for the
  15987.    requested number of decimal places when the "d" argument is given and
  15988.    has a value greater than 0 (see the description of \ffpround() just
  15989.    below).
  15990.    
  15991.    Floating-point arguments can be constants in floating-point format or
  15992.    variables whose values are floating-point numbers. If a floating-point
  15993.    argument is omitted, or is a variable with no value, 0.0 is supplied
  15994.    automatically. Example:
  15995.    
  15996.   def \%x 999.999
  15997.   undef \%y
  15998.   echo \ffpmin(\%x,\%y)
  15999.   0.0
  16000.  
  16001.    Or equivalently:
  16002.    
  16003.   echo \ffpmin(999.999)
  16004.   0.0
  16005.  
  16006.    The floating-point functions are:
  16007.    
  16008.    \ffpround(f1,d)
  16009.           Returns f1 rounded to d decimal places. For this function only,
  16010.           d = 0 (or d omitted) has a special meaning: return the integer
  16011.           part of f1 rounded according to the fractional part. Examples:
  16012.           
  16013.  
  16014.   \ffpround(2.74653,-1) returns "2" (fraction truncated, no rounding).
  16015.   \ffpround(2.74653,0)  returns "3" (integer part is rounded).
  16016.   \ffpround(2.74653)    returns "3" (d omitted same as d = 0).
  16017.   \ffpround(2.74653,1)  returns "2.7".
  16018.   \ffpround(2.74653,2)  returns "2.75".
  16019.   \ffpround(2.74653,3)  returns "2.747".
  16020.   \ffpround(2.74653,4)  returns "2.7465", etc.
  16021.  
  16022.    \ffpadd(f1,f2,d)
  16023.           Returns the sum of f1 and f2.
  16024.           
  16025.    \ffpsubtract(f1,f2,d)
  16026.           Subtracts f2 from f1 and returns the result.
  16027.           
  16028.    \ffpmultiply(f1,f2,d)
  16029.           Returns the product of f1 and f2.
  16030.           
  16031.    \ffpdivide(f1,f2,d)
  16032.           If f2 is not 0, divides f1 by f2 and returns the quotient.
  16033.           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
  16034.           
  16035.    \ffpraise(f1,f2,d)
  16036.           If f1 = 0 and f2 <= 0, or if f1 < 0 and f2 has a fractional
  16037.           part, an ARG_OUT_OF_RANGE error occurs; otherwise f1 raised to
  16038.           the f2 power is returned.
  16039.           
  16040.    \ffpsqrt(f1,d)
  16041.           If f1 >= 0, returns the square root of f1; otherwise
  16042.           ARG_OUT_OF_RANGE.
  16043.           
  16044.    \ffpabsolute(f1,d)
  16045.           Returns the absolute value of f1 (i.e. f1 without a sign). This
  16046.           is the floating-point analog of \fabsolute(n1).
  16047.           
  16048.    \ffpint(f1)
  16049.           Returns the integer part of f1. Equivalent to \ffpround(f1,-1).
  16050.           
  16051.    \ffpexp(f1,d)
  16052.           The base of natural logarithms, e (2.718282...), raised to the
  16053.           f1 power.
  16054.           
  16055.    \ffplogn(f1,d)
  16056.           The natural logarithm of f1 (the power to which e must be
  16057.           raised to obtain f1).
  16058.           
  16059.    \ffplog10(f1,d)
  16060.           The base-10 logarithm of f1 (the power to which 10 must be
  16061.           raised to obtain f1).
  16062.           
  16063.    \ffpmodulus(f1,f2,d)
  16064.           If f2 is not 0, the remainder after dividing f1 by f2.
  16065.           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
  16066.           This is the floating-point analog of \fmod(n1,n2).
  16067.           
  16068.    \ffpmaximum(f1,f2,d)
  16069.           Returns the maximum of f1 and f2. This is the floating-point
  16070.           analog of \fmax(n1,n2).
  16071.           
  16072.    \ffpminimum(f1,f2,d)
  16073.           Returns the minimum of f1 and f2. This is the floating-point
  16074.           analog of \fmin(n1,n2).
  16075.           
  16076.    \ffpsine(f1,d)
  16077.           Returns the sine of f1 radians.
  16078.           
  16079.    \ffpcosine(f1,d)
  16080.           Returns the cosine of f1 radians.
  16081.           
  16082.    \ffptangent(f1,d)
  16083.           Returns the tangent of f1 radians.
  16084.           
  16085.    Note that all of these functions can be used with integer arguments.
  16086.    If you want an integer result, specify d = -1 (to truncate) or feed
  16087.    the result to \ffpround(xxx,0) (to round).
  16088.    
  16089.    Floating-point numbers (or variables or functions that return them)
  16090.    can be used in Boolean expressions (see [624]Section 7.20.2) that
  16091.    compare numbers:
  16092.    
  16093.   = x y
  16094.   != x y
  16095.   < x y
  16096.   > x y
  16097.   <= x y
  16098.   >= x y
  16099.  
  16100.    In these examples, x and y can be either integers or floating-point
  16101.    numbers in any combination. In an arithmetic comparison of an integer
  16102.    and a floating-point number, the integer is converted to
  16103.    floating-point before the comparison is made. Examples:
  16104.    
  16105.   .\%t = 3.000000000
  16106.   .\%f = 3.141592653
  16107.   .\%i = 3
  16108.  
  16109.   if > \%f \%i echo Pi is greater.
  16110.   if = \%t \%i echo "\%i" = "\%t".
  16111.  
  16112.    A floating-point number can also be used in:
  16113.    
  16114.   IF number command
  16115.  
  16116.    where the command is executed if the number is nonzero. If the number
  16117.    is floating-point, the command is not executed if the number is 0.0,
  16118.    and is executed otherwise.
  16119.    
  16120.    Floating-point numbers can be sorted using ARRAY SORT /NUMERIC (see
  16121.    [625]Section 7.10.5 ).
  16122.    
  16123.    Two floating-point constants are provided:
  16124.    
  16125.   \v(math_pi) = Pi (3.141592653...)
  16126.   \v(math_e)  = e, the base of natural logarithms (2.71828...)
  16127.  
  16128.    These are given to the computer's precision, e.g. 16 digits. This
  16129.    number itself is available in a variable:
  16130.    
  16131.    \v(math_precision)
  16132.           How many significant digits in a floating-point number.
  16133.      _________________________________________________________________
  16134.    
  16135.   7.24. Tracing Script Execution
  16136.   
  16137.    The TRACE command is handy for debugging scripts.
  16138.    
  16139.    TRACE [ { /ON, /OFF } ] [ { ASSIGNMENTS, COMMAND-LEVEL, ALL } ]
  16140.           Selects tracing of the given object.
  16141.           
  16142.    Optional switches are /ON and /OFF. If no switch is given, /ON is
  16143.    implied. The trace objects are ASSIGNMENTS, COMMAND-LEVEL, and ALL.
  16144.    The default object is ALL, meaning to select all trace objects
  16145.    (besides ALL). Thus TRACE by itself selects tracing of everything, as
  16146.    does TRACE /ON, and TRACE /OFF turns off all tracing.
  16147.    
  16148.    When tracing of ASSIGNMENTS is on, every time the value of any
  16149.    user-defined variable or macro changes, C-Kermit prints one of the
  16150.    following:
  16151.    
  16152.    >>> name: "value"
  16153.           The name of the variable or macro followed by the new value in
  16154.           quotes. This includes implicit macro-parameter assignments
  16155.           during macro invocation.
  16156.           
  16157.    >>> name: (undef)
  16158.           This indicates that the variable or macro has been undefined.
  16159.           
  16160.    <<< name: "value"
  16161.           For RETURN statements: the name of the macro and the return
  16162.           value.
  16163.           
  16164.    <<< name: (null)
  16165.           For RETURN statements that include no value or an empty value.
  16166.           
  16167.    When tracing of COMMAND-LEVEL is on, C-Kermit prints:
  16168.    
  16169.    [n] +F: "name"
  16170.           Whenever a command file is entered, where "n" is the command
  16171.           level (0 = top); the name of the command file is shown in
  16172.           quotes.
  16173.           
  16174.    [n] +M: "name"
  16175.           Whenever a macro is entered; "n" is the command level. The name
  16176.           of the macro is shown in quotes.
  16177.           
  16178.    [n] -F: "name"
  16179.           Whenever a command file is reentered from below, when a macro
  16180.           or command file that it has invoked has returned.
  16181.           
  16182.    [n] -M: "name"
  16183.           Whenever a macro is reentered from below.
  16184.           
  16185.    For other debugging tools, see SHOW ARGS, SHOW STACK, SET TAKE, SET
  16186.    MACRO, and of course, ECHO.
  16187.      _________________________________________________________________
  16188.    
  16189.   7.25. Compact Substring Notation
  16190.   
  16191.    It is often desirable to extract a substring from a string which is
  16192.    stored in a variable, and for this we have the \fsubstring() function,
  16193.    which is used like this:
  16194.    
  16195.   define \%a 1234567890
  16196.   echo \fsubstring(\%a,3,4) ; substring from 3rd character length 4
  16197.   3456
  16198.  
  16199.    or like this with macro-named variables:
  16200.    
  16201.   define string 1234567890
  16202.   echo \fsubstring(\m(string),3,4)
  16203.   3456
  16204.  
  16205.    C-Kermit 7.0 adds a pair of alternative compact notations:
  16206.    
  16207. \:(variablename[start:length])  <-- Substring of variable's value
  16208. \s(macroname[start:length])     <-- Substring of macro's definition
  16209.  
  16210.    These are exactly equivalent to using \fsubstring(), except more
  16211.    compact to write and also faster since evaluation is in one step
  16212.    instead of two.
  16213.    
  16214.    The "\:()" notation can be used with any Kermit variable, that is,
  16215.    almost anything that starts with a backslash:
  16216.    
  16217.   \:(\%a[2:6])      <-- equivalent to \fsubstring(\%a,2,6)
  16218.   \:(\&x[1][2:6])   <-- equivalent to \fsubstring(\&x[1],2,6)
  16219.   \:(\m(foo)[2:6])  <-- equivalent to \fsubstring(\m(foo),2,6)
  16220.   \:(\v(time)[2:6]) <-- equivalent to \fsubstring(\v(time),2,6)
  16221.   \:(\$(TERM)[2:6]) <-- equivalent to \fsubstring(\$(TERM),2,6)
  16222.   \:(ABCDEFGH[2:6]) <-- equivalent to \fsubstring(ABCDEFGH,2,6)
  16223.  
  16224.    Whatever appears between the left parenthesis and the left bracket is
  16225.    evaluated and then the indicated substring of the result is returned.
  16226.    
  16227.    The "\s()" notation is the same, except after evaluating the variable,
  16228.    the result is treated as a macro name and is looked up in the macro
  16229.    table. Then the indicated substring of the macro definition is
  16230.    returned. Example:
  16231.    
  16232.   define testing abcdefghijklmnopqrstuvwxyz
  16233.   define \%a testing
  16234.  
  16235.   \s(testing[2:6])  -->  bcdefg
  16236.   \:(testing[2:6])  -->  esting
  16237.   \:(\%a[2:6])      -->  esting
  16238.   \s(\%a[2:6])      -->  bcdefg
  16239.  
  16240.    Note that the following two examples are equivalent:
  16241.    
  16242.   \:(\m(foo)[2:6])
  16243.   \s(foo[2:6])
  16244.  
  16245.    The first number in the brackets is the 1-based starting position. If
  16246.    it is omitted, or less than 1, it is treated as 1. If it is greater
  16247.    than the length of the string, an empty string is returned.
  16248.    
  16249.    The second number is the length of the desired substring. If the
  16250.    second number is omitted, is less than 0, or would be past the end of
  16251.    the string, then "through the end of the string" is assumed. If it is
  16252.    0, the empty string is returned.
  16253.    
  16254.    If the brackets are empty or omitted, the original string is returned.
  16255.    
  16256.    The starting position and length need not be literal numbers; they can
  16257.    also be variables, functions, arithmetic expressions, or even other
  16258.    \s() or \:() quantities; anything that evaluates to a number, for
  16259.    example:
  16260.    
  16261.   \s(block[1025:\fhex2n(\s(block[\%b:\%n+4]))/2])
  16262.  
  16263.    Syntactically, \m(name) and \s(name) differ only in that the sequence
  16264.    [*] at the end of the name (where * is any sequence of 0 or more
  16265.    characters) is treated as substring notation in \s(name), but is
  16266.    considered part of the name in \m(name) (to see why, see [626]Section
  16267.    7.10.9).
  16268.      _________________________________________________________________
  16269.    
  16270.   7.26. New WAIT Command Options
  16271.   
  16272.    The WAIT command has been extended to allow waiting for different
  16273.    kinds of things (formerly it only waited for modem signals). Now it
  16274.    also can wait for file events.
  16275.    
  16276.     7.26.1. Waiting for Modem Signals
  16277.     
  16278.    The previous syntax:
  16279.    
  16280.   WAIT time { CD, DSR, RTS, RI, ... }
  16281.  
  16282.    has changed to:
  16283.    
  16284.   WAIT time MODEM-SIGNALS { CD, DSR, RTS, RI, ... }
  16285.  
  16286.    However, the previous syntax is still accepted. The behavior is the
  16287.    same in either case.
  16288.      _________________________________________________________________
  16289.    
  16290.     7.26.2. Waiting for File Events
  16291.     
  16292.    The new WAIT option:
  16293.    
  16294.   WAIT time FILE { CREATION, DELETION, MODIFICATION } filename
  16295.  
  16296.    lets you tell Kermit to wait the given amount of time (or until the
  16297.    given time of day) for a file whose name is filename to be created,
  16298.    deleted, or modified, respectively. The filename may not contain
  16299.    wildcards. If the specified event does not occur within the time
  16300.    limit, or if WAIT CANCELLATION is ON and you interrupt from the
  16301.    keyboard before the time is up, the WAIT command fails. If the event
  16302.    is MODIFICATION and the file does not exist, the command fails.
  16303.    Otherwise, if the given event occurs within the time limit, the
  16304.    command succeeds. Examples:
  16305.    
  16306.    WAIT 600 FILE DELETION oofa.tmp
  16307.           Wait up to 10 minutes for file oofa.tmp to disappear.
  16308.           
  16309.    WAIT 23:59:59 FILE MOD orders.db
  16310.           Wait until just before midnight for the orders.db file to be
  16311.           changed.
  16312.           
  16313.    Example: Suppose you want to have the current copy of /etc/motd on
  16314.    your screen at all times, and you want to hear a bell whenever it
  16315.    changes:
  16316.    
  16317.   def \%f /etc/motd                      ; The file of interest.
  16318.   while 1 {                              ; Loop forever...
  16319.       cls                                ; Clear the screen.
  16320.       echo \%f: \v(date) \v(time)...     ; Print 2-line heading...
  16321.       echo
  16322.       if ( not exist \%f ) {             ; If file doesn't exist,
  16323.           echo \%f does not exist...     ; print message,
  16324.           wait 600 file creat \%f        ; and wait for it to appear.
  16325.           continue
  16326.       }
  16327.       beep                               ; Something new - beep.
  16328.       type /head:\v(rows-2) \%f          ; Display the file
  16329.       if fail exit 1 \%f: \ferrstring()  ; (checking for errors).
  16330.       wait 999 file mod \%f              ; Wait for it to change.
  16331.   }
  16332.  
  16333.    This notices when the file is created, deleted, or modified, and acts
  16334.    only then (or when you interrupt it with); the time shown in the
  16335.    heading is the time of the most recent event (including when the
  16336.    program started).
  16337.    
  16338.    See [627]Section 1.10, where the \v(kbchar) variable is explained.
  16339.    This lets you modify a loop like the one above to also accept
  16340.    single-character commands, which interrupt the WAIT, and dispatch
  16341.    accordingly. For example:
  16342.    
  16343.   wait 999 file mod \%f              ; Wait for the file to change.
  16344.   if defined \v(kbchar) {            ; Interrupted from keyboard?
  16345.       switch \v(kbchar) {            ; Handle the keystroke...
  16346.         :q, exit                     ; Q to Quit
  16347.         :h, echo blah blah, break    ; H for Help
  16348.         :default, beep, continue     ; Anything else beep and ignore
  16349.       }
  16350.   }
  16351.  
  16352.    This lets you write event-driven applications that wait for up to
  16353.    three events at once: a file or modem event, a timeout, and a
  16354.    keystroke.
  16355.      _________________________________________________________________
  16356.    
  16357.   7.27. Relaxed FOR and SWITCH Syntax
  16358.   
  16359.    For consistency with the extended IF and WHILE syntax, the FOR and
  16360.    SWITCH control lists may (but need not be) enclosed in parentheses:
  16361.    
  16362.   FOR ( \%i 1 \%n 1 ) { command-list... }
  16363.   SWITCH ( \%c ) { command-list... }
  16364.  
  16365.    In the FOR command, the increment item can be omitted if the control
  16366.    list is enclosed in parentheses, in which case the increment defaults
  16367.    appropriately to 1 or -1, depending on the values of the first two
  16368.    variables.
  16369.    
  16370.    As with IF, the parentheses around the FOR-command control list must
  16371.    be set off by spaces (in the SWITCH command, the spaces are not
  16372.    required since the SWITCH expression is a single arithmetic
  16373.    expression).
  16374.    
  16375.    Also, outer braces around the command list are supplied automatically
  16376.    if you omit them, e.g.:
  16377.    
  16378.   FOR ( \%i 1 %n 1 ) echo \%i
  16379.      _________________________________________________________________
  16380.    
  16381.   8. USING OTHER FILE TRANSFER PROTOCOLS
  16382.   
  16383.    In C-Kermit 7.0, alternative protocols can be selected using switches.
  16384.    Switches are described in [628]Section 1.5; the use of
  16385.    protocol-selection switches is described in [629]Section 4.7.1.
  16386.    Example:
  16387.    
  16388.   send /binary /protocol:zmodem x.tar.gz
  16389.  
  16390.    Note that file transfer recovery works only with Kermit and Zmodem
  16391.    protocols. With Zmodem, recovery can be initiated only by the sender.
  16392.    
  16393.    Only pre-1988 versions of the publicly-distributed sz/rz programs use
  16394.    Standard I/O; those released later than that do not use Standard I/O
  16395.    and therefore do not work with REDIRECT. However, Omen Technology does
  16396.    offer an up-to-date redirectable version called crzsz, which must be
  16397.    licensed for use:
  16398.    
  16399.      "Unix Crz and Csz support XMODEM, YMODEM, and ZMODEM transfers when
  16400.      called by dial-out programs such as Kermit and certain versions of
  16401.      cu(1). They are clients designed for this use.
  16402.      
  16403.      "Crz and Csz are Copyrighted shareware programs. Use of these
  16404.      programs beyond a brief evaluation period requires registration.
  16405.      Please print the "mailer.rz" file, fill out the form and return
  16406.      same with your registration."
  16407.      
  16408.    To use the crzsz programs as your external XYZMODEM programs in
  16409.    C-Kermit, follow the instructions in the book, but put a "c" before
  16410.    each command, e.g.:
  16411.    
  16412.   set protocol zmodem {csz %s} {csz -a %s} crz crz crz crz
  16413.  
  16414.    To use Zmodem protocol over Telnet or other non-transparent
  16415.    connections, you might need to add the -e (Escape) option:
  16416.    
  16417.   set protocol zmodem {csz -e %s} {csz -e -a %s} crz crz crz crz
  16418.      _________________________________________________________________
  16419.    
  16420.   9. COMMAND-LINE OPTIONS
  16421.   
  16422.   9.0. Extended-Format Command-Line Options
  16423.   
  16424.    Standard UNIX command line options are a single letter. C-Kermit has
  16425.    run out of letters, so new options are in a new extended format:
  16426.    
  16427.  --word[:arg]
  16428.  
  16429.    where a keyword (rather than a single letter) specifies the function,
  16430.    and if an argument is to be included, it is separated by a colon (or
  16431.    equal sign). Most of the new extended-format command-line options are
  16432.    only for use with the Internet Kermit Service Daemon; see the
  16433.    [630]IKSD Administration Guide for details. However, several of them
  16434.    are also general in nature:
  16435.    
  16436.    --nointerrupts
  16437.           Disables keyboard interrupts that are normally enabled, which
  16438.           are usually Ctrl-C (to interrupt a command) and Ctrl-Z (UNIX
  16439.           only, to suspend C-Kermit).
  16440.           
  16441.    --help
  16442.           Lists the extended command-line options that are available in
  16443.           your version of C-Kermit. If any options seem to be missing,
  16444.           that is because your copy of C-Kermit was built with
  16445.           compile-time options to deselect them.
  16446.           
  16447.    --helpfile:filename
  16448.           Specifies the name of a file to be displayed if the user types
  16449.           HELP (not followed by a specific command or topic), in place of
  16450.           the built-in top-level help text. The file need not fit on one
  16451.           screen; more-prompting is used if the file is more than one
  16452.           screen long if COMMAND MORE-PROMPTING is ON, as it is by
  16453.           default.
  16454.           
  16455.    --bannerfile:filename
  16456.           The name of a file containing a message to be printed after the
  16457.           user logs in, in place of the normal message (Copyright notice,
  16458.           "Type HELP or ? for help", "Default transfer mode is...", etc).
  16459.           
  16460.    --cdmessage:{on,off,0,1,2}
  16461.           For use in the Server-Side Server configuration; whenever the
  16462.           client tells the server to change directory, the server sends
  16463.           the contents of a "read me" file to the client's screen. This
  16464.           feature is On by default, and operates only in client/server
  16465.           mode when ON or 1. If set to 2 or higher, it also operates when
  16466.           the CD command is given at the IKSD> prompt. Synonym: --cdmsg.
  16467.           
  16468.    --cdfile:filename
  16469.           When cdmessage is on, this is the name of the "read me" file to
  16470.           be sent. Normally you would specify a relative (not absolute)
  16471.           name, since the file is opened using the literal name you
  16472.           specified, after changing to the new directory. Example:
  16473.           
  16474.   --cdfile:READ.ME
  16475.  
  16476.           You can also give a list of up to 8 filenames by (a) enclosing
  16477.           each filename in braces, and (b) enclosing the entire list in
  16478.           braces. Example:
  16479.           --cdfile:{{./.readme}{READ.ME}{aaareadme.txt}{README}{read-this
  16480.           -first}} When a list is given, it is searched from left to
  16481.           right and the first file found is displayed. The default list
  16482.           for UNIX is:
  16483.           
  16484.   {{./.readme}{README.TXT}{READ.ME}}
  16485.      _________________________________________________________________
  16486.    
  16487.   9.1. Command Line Personalities
  16488.   
  16489.    Beginning in version 7.0, if the C-Kermit binary is renamed to
  16490.    "telnet" (or TELNET.EXE, telnet.pr, etc, depending on the platform),
  16491.    it accepts the Telnet command line:
  16492.    
  16493.   telnet [ host [ port ] ]
  16494.  
  16495.    In Unix, you can achieve the same effect with a symlink:
  16496.    
  16497.   cd /usr/bin
  16498.   mv telnet oldtelnet
  16499.   ln -ls /usr/local/bin/kermit telnet
  16500.  
  16501.    When installed in this manner, C-Kermit always reads its
  16502.    initialization file. If no host (and therefore no port) is given,
  16503.    C-Kermit starts in interactive prompting mode. If a host is given as
  16504.    the first command-line argument, C-Kermit makes a connection to it.
  16505.    The host argument can be an IP host name or address, or the name of a
  16506.    TCP/IP entry in your C-Kermit network directory.
  16507.    
  16508.    If a port is given, it is used. If a port is not given, then if the
  16509.    hostname was found in your network directory and port was also listed
  16510.    there, then that port is used. Otherwise port 23 (the Telnet port) is
  16511.    used.
  16512.    
  16513.    When C-Kermit is called "telnet" and it is invoked with a hostname on
  16514.    the command line, it exits automatically when the connection is
  16515.    closed. While the connection is open, however, you may escape back and
  16516.    forth as many times as you like, transfer files, etc.
  16517.    
  16518.    An rlogin personality is also available, but it is less useful, at
  16519.    least in UNIX and VMS, where the Rlogin TCP port is privileged.
  16520.    
  16521.    The new variable \v(name) indicates the name with which C-Kermit was
  16522.    invoked ("kermit", "wermit", "k95", "telnet", etc).
  16523.      _________________________________________________________________
  16524.    
  16525.   9.2. Built-in Help for Command Line Options
  16526.   
  16527.    "kermit -h", given from the system prompt, lists as many command-line
  16528.    options as will fit on a standard 24x80 screen. For more comprehensive
  16529.    help, use the interactive HELP OPTIONS command that was added in
  16530.    C-Kermit 7.0:
  16531.    
  16532.    HELP OPTIONS
  16533.    Explains how command-line options work, their syntax, etc.
  16534.    
  16535.    HELP OPTIONS ALL
  16536.    Lists all command-line options and gives brief help about each one.
  16537.    
  16538.    HELP OPTION x
  16539.    Gives brief help about option "x".
  16540.    
  16541.    HELP EXTENDED-OPTIONS
  16542.    Lists the available extended-format command-line options.
  16543.    
  16544.    HELP EXTENDED-OPTION xxx
  16545.    Gives help for the specified extended option.
  16546.      _________________________________________________________________
  16547.    
  16548.   9.3. New Command-Line Options
  16549.   
  16550.    Command-line options added since C-Kermit 6.0 are:
  16551.    
  16552.    +
  16553.           (plus sign by itself): The next argument is the name of a
  16554.           script to execute; all subsequent arguments are ignored by
  16555.           C-Kermit itself, but passed to the script as top-level copies
  16556.           of \%1, \%2, etc; the \&_[] is also set accordingly. \%0 and
  16557.           \&_[0] become the name of the script file, rather than the
  16558.           pathname of the C-Kermit program, which is its normal value.
  16559.           Primarily for use in the top line of "Kerbang" scripts in UNIX
  16560.           (see [631]Section 7.19). Example from UNIX command line:
  16561.           
  16562.   $ kermit [ regular kermit args ] + filename
  16563.  
  16564.           Sample first line of Kerbang script:
  16565.           
  16566.   #!/usr/local/bin/kermit +
  16567.  
  16568.    --
  16569.           (two hyphens surrounded by whitespace) Equivalent to "=", for
  16570.           compatibility with UNIX getopt(1,3).
  16571.           
  16572.    -G
  16573.           GET (like -g), but send the incoming file to standard output.
  16574.           Example: "kermit -G oofa.txt | lpr" retrieves a file from your
  16575.           local computer (providing it is running a Kermit program that
  16576.           supports the autodownload feature and has it enabled) and
  16577.           prints it.
  16578.           
  16579.    -O
  16580.           equivalent to -x (start up in server mode), but exits after the
  16581.           first client command has been executed (mnemonic: O = Only
  16582.           One). This one is handy replacing "kermit -x" in the
  16583.           "automatically start Kermit on the other end" string:
  16584.           
  16585.   set protocol kermit {kermit -ir} {kermit -r} {kermit -x}
  16586.  
  16587.           since -x leaves the remote Kermit in server mode after the
  16588.           transfer, which can be confusing, whereas -O makes it go away
  16589.           automatically after the transfer.
  16590.           
  16591.    -L
  16592.           Recursive, when used in combination with -s (mnemonic: L =
  16593.           Levels). In UNIX or other environments where the shell expands
  16594.           wildcards itself, the -s argument, if it contains wildcards,
  16595.           must be quoted to prevent this, e.g.:
  16596.           
  16597.   kermit -L -s "*.c"
  16598.  
  16599.           In UNIX only, "kermit -L -s ." means to send the current
  16600.           directory tree. See [632]Sections 4.10 and [633]4.11 about
  16601.           recursive file transfer.
  16602.           
  16603.    -V
  16604.           Equivalent to SET FILE PATTERNS OFF ([634]Section 4.3) and SET
  16605.           TRANSFER MODE MANUAL. In other words, take the FILE TYPE
  16606.           setting literally. For example, "kermit -VT oofa.bin" means
  16607.           send the file in Text mode, no matter what its name is and no
  16608.           matter whether a kindred spirit is recognized at the other end
  16609.           of the connection.
  16610.           
  16611.    -0
  16612.           (digit zero) means "be 100% transparent in CONNECT mode". This
  16613.           is equivalent to the following series of commands: SET PARITY
  16614.           NONE, SET COMMAND BYTESIZE 8, SET TERMINAL BYTESIZE 8, SET FLOW
  16615.           NONE, SET TERM ESCAPE DISABLED, SET TERM CHAR TRANSPARENT, SET
  16616.           TERM AUTODOWNLOAD OFF, SET TERM APC OFF, SET TELOPT KERMIT
  16617.           REFUSE REFUSE.
  16618.      _________________________________________________________________
  16619.    
  16620.   10. C-KERMIT AND G-KERMIT
  16621.   
  16622.    Every multifunctioned and long-lived software program grows in
  16623.    complexity and size over time to meet the needs and requests of its
  16624.    users and the demands of the underlying technology as it changes.
  16625.    
  16626.    Eventually users begin to notice how big the application has grown,
  16627.    how much disk space it occupies, how long it takes to load, and they
  16628.    start to long for the good old days when it was lean and mean. Not
  16629.    long after that they begin asking for a "light" version that only does
  16630.    the basics with no frills.
  16631.    
  16632.    And so it is with C-Kermit. A "light" version of Kermit was released
  16633.    (for UNIX only) in December 1999 under the GNU General Public License;
  16634.    thus it is called G-Kermit (for GNU Kermit). All it does is send and
  16635.    receive files, period. You can find it at:
  16636.    
  16637.   [635]http://www.columbia.edu/kermit/gkermit.html
  16638.  
  16639.    Where the C-Kermit 7.0 binary might be anywhere from 1 to 3 million
  16640.    bytes in size, the G-Kermit binary ranges from 30K to 100K, depending
  16641.    on the underlying architecture (RISC vs CISC, etc).
  16642.    
  16643.    G-Kermit and C-Kermit may reside side-by-side on the same computer.
  16644.    G-Kermit does not make connections; it does not have a script
  16645.    language; it does not translate character sets. G-Kermit may be used
  16646.    instead of C-Kermit when:
  16647.    
  16648.      * It is on the remote end.
  16649.      * Files are to be transferred in binary mode or in text mode without
  16650.        character-set translation.
  16651.      * File timestamps don't need to be preserved.
  16652.        
  16653.    In such cases G-Kermit might be preferred since it generally starts up
  16654.    faster, and yet transfers files just as fast on most (but not
  16655.    necessarily all) kinds of connections; for example, it supports
  16656.    streaming ([636]Section 4.20).
  16657.    
  16658.    G-Kermit is also handy for bootstrapping. It is easier to load on a
  16659.    new computer than C-Kermit -- it fits on a floppy diskette with plenty
  16660.    of room to spare. Thus if you have (say) an old PC running (say) SCO
  16661.    Xenix and no network connection, you can download the Xenix version of
  16662.    G-Kermit to (say) a DOS or Windows PC, copy it to diskette, read the
  16663.    diskette on Xenix with "dosread", and then use G-Kermit to receive
  16664.    C-Kermit (which does not fit on a diskette). If diskettes aren't an
  16665.    option, other bootstrapping methods are possible too -- see the
  16666.    [637]G-Kermit web page for details.
  16667.      _________________________________________________________________
  16668.    
  16669. III. APPENDICES
  16670.  
  16671.   III.1. Character Set Tables
  16672.   
  16673.     III.1.1. The Hewlett Packard Roman8 Character Set
  16674.     
  16675. dec col/row oct hex  description
  16676. 160  10/00  240  A0  (Undefined)
  16677. 161  10/01  241  A1  A grave
  16678. 162  10/02  242  A2  A circumflex
  16679. 163  10/03  243  A3  E grave
  16680. 164  10/04  244  A4  E circumflex
  16681. 165  10/05  245  A5  E diaeresis
  16682. 166  10/06  246  A6  I circumflex
  16683. 167  10/07  247  A7  I diaeresis
  16684. 168  10/08  250  A8  Acute accent
  16685. 169  10/09  251  A9  Grave accent
  16686. 170  10/10  252  AA  Circumflex accent
  16687. 171  10/11  253  AB  Diaeresis
  16688. 172  10/12  254  AC  Tilde accent
  16689. 173  10/13  255  AD  U grave
  16690. 174  10/14  256  AE  U circumflex
  16691. 175  10/15  257  AF  Lira symbol
  16692. 176  11/00  260  B0  Top bar (macron)
  16693. 177  11/01  261  B1  Y acute
  16694. 178  11/02  262  B2  y acute
  16695. 179  11/03  263  B3  Degree Sign
  16696. 180  11/04  264  B4  C cedilla
  16697. 181  11/05  265  B5  c cedilla
  16698. 182  11/06  266  B6  N tilde
  16699. 183  11/07  267  B7  n tilde
  16700. 184  11/08  270  B8  Inverted exclamation mark
  16701. 185  11/09  271  B9  Inverted question mark
  16702. 186  11/10  272  BA  Currency symbol
  16703. 187  11/11  273  BB  Pound sterling symbol
  16704. 188  11/12  274  BC  Yen symbol
  16705. 189  11/13  275  BD  Paragraph
  16706. 190  11/14  276  BE  Florin (Guilder) symbol
  16707. 191  11/15  277  BF  Cent symbol
  16708. 192  12/00  300  C0  a circumflex
  16709. 193  12/01  301  C1  e circumflex
  16710. 194  12/02  302  C2  o circumflex
  16711. 195  12/03  303  C3  u circumflex
  16712. 196  12/04  304  C4  a acute
  16713. 197  12/05  305  C5  e acute
  16714. 198  12/06  306  C6  o acute
  16715. 199  12/07  307  C7  u acute
  16716. 200  12/08  310  C8  a grave
  16717. 201  12/09  311  C9  e grave
  16718. 202  12/10  312  CA  o grave
  16719. 203  12/11  313  CB  u grave
  16720. 204  12/12  314  CC  a diaeresis
  16721. 205  12/13  315  CD  e diaeresis
  16722. 206  12/14  316  CE  o diaeresis
  16723. 207  12/15  317  CF  u diaeresis
  16724. 208  13/00  320  D0  A ring
  16725. 209  13/01  321  D1  i circumflex
  16726. 210  13/02  322  D2  O with stroke
  16727. 211  13/03  323  D3  AE digraph
  16728. 212  13/04  324  D4  a ring
  16729. 213  13/05  325  D5  i acute
  16730. 214  13/06  326  D6  o with stroke
  16731. 215  13/07  327  D7  ae digraph
  16732. 216  13/08  330  D8  A diaeresis
  16733. 217  13/09  331  D9  i grave
  16734. 218  13/10  332  DA  O diaeresis
  16735. 219  13/11  333  DB  U diaeresis
  16736. 220  13/12  334  DC  E acute
  16737. 221  13/13  335  DD  i diaeresis
  16738. 222  13/14  336  DE  German sharp s
  16739. 223  13/15  337  DF  O circumflex
  16740. 224  14/00  340  E0  A acute
  16741. 225  14/01  341  E1  A tilde
  16742. 226  14/02  342  E2  a tilde
  16743. 227  14/03  343  E3  Icelandic Eth
  16744. 228  14/04  344  E4  Icelandic eth
  16745. 229  14/05  345  E5  I acute
  16746. 230  14/06  346  E6  I grave
  16747. 231  14/07  347  E7  O acute
  16748. 232  14/08  350  E8  O grave
  16749. 233  14/09  351  E9  O tilde
  16750. 234  14/10  352  EA  o tilde
  16751. 235  14/11  353  EB  S caron
  16752. 236  14/12  354  EC  s caron
  16753. 237  14/13  355  ED  U acute
  16754. 238  14/14  356  EE  Y diaeresis
  16755. 239  14/15  357  EF  y diaeresis
  16756. 240  15/00  360  F0  Icelandic Thorn
  16757. 241  15/01  361  F1  Icelandic thorn
  16758. 242  15/02  362  F2  Middle dot
  16759. 243  15/03  363  F3  Greek mu
  16760. 244  15/04  364  F4  Pilcrow sign
  16761. 245  15/05  365  F5  Fraction 3/4
  16762. 246  15/06  366  F6  Long dash, horizontal bar
  16763. 247  15/07  367  F7  Fraction 1/4
  16764. 248  15/08  370  F8  Fraction 1/2
  16765. 249  15/09  371  F9  Feminine ordinal
  16766. 250  15/10  372  FA  Masculine ordinal
  16767. 251  15/11  373  FB  Left guillemot
  16768. 252  15/12  374  FC  Solid box
  16769. 253  15/13  375  FD  Right guillemot
  16770. 254  15/14  376  FE  Plus or minus sign
  16771. 255  15/15  377  FF  (Undefined)
  16772.      _________________________________________________________________
  16773.    
  16774.     III.1.2. Greek Character Sets
  16775.     
  16776.     III.1.2.1. The ISO 8859-7 Latin / Greek Alphabet = ELOT 928
  16777.     
  16778. dec col/row oct hex  description
  16779. 160  10/00  240  A0  No-break space
  16780. 161  10/01  241  A1  Left single quotation mark
  16781. 162  10/02  242  A2  right single quotation mark
  16782. 163  10/03  243  A3  Pound sign
  16783. 164  10/04  244  A4  (UNUSED)
  16784. 165  10/05  245  A5  (UNUSED)
  16785. 166  10/06  246  A6  Broken bar
  16786. 167  10/07  247  A7  Paragraph sign
  16787. 168  10/08  250  A8  Diaeresis (Dialytika)
  16788. 169  10/09  251  A9  Copyright sign
  16789. 170  10/10  252  AA  (UNUSED)
  16790. 171  10/11  253  AB  Left angle quotation
  16791. 172  10/12  254  AC  Not sign
  16792. 173  10/13  255  AD  Soft hyphen
  16793. 174  10/14  256  AE  (UNUSED)
  16794. 175  10/15  257  AF  Horizontal bar (Parenthetiki pavla)
  16795. 176  11/00  260  B0  Degree sign
  16796. 177  11/01  261  B1  Plus-minus sign
  16797. 178  11/02  262  B2  Superscript two
  16798. 179  11/03  263  B3  Superscript three
  16799. 180  11/04  264  B4  Accent (tonos)
  16800. 181  11/05  265  B5  Diaeresis and accent (Dialytika and Tonos)
  16801. 182  11/06  266  B6  Alpha with accent
  16802. 183  11/07  267  B7  Middle dot (Ano Teleia)
  16803. 184  11/08  270  B8  Epsilon with accent
  16804. 185  11/09  271  B9  Eta with accent
  16805. 186  11/10  272  BA  Iota with accent
  16806. 187  11/11  273  BB  Right angle quotation
  16807. 188  11/12  274  BC  Omicron with accent
  16808. 189  11/13  275  BD  One half
  16809. 190  11/14  276  BE  Upsilon with accent
  16810. 191  11/15  277  BF  Omega with accent
  16811. 192  12/00  300  C0  iota with diaeresis and accent
  16812. 193  12/01  301  C1  Alpha
  16813. 194  12/02  302  C2  Beta
  16814. 195  12/03  303  C3  Gamma
  16815. 196  12/04  304  C4  Delta
  16816. 197  12/05  305  C5  Epsilon
  16817. 198  12/06  306  C6  Zeta
  16818. 199  12/07  307  C7  Eta
  16819. 200  12/08  310  C8  Theta
  16820. 201  12/09  311  C9  Iota
  16821. 202  12/10  312  CA  Kappa
  16822. 203  12/11  313  CB  Lamda
  16823. 204  12/12  314  CC  Mu
  16824. 205  12/13  315  CD  Nu
  16825. 206  12/14  316  CE  Ksi
  16826. 207  12/15  317  CF  Omicron
  16827. 208  13/00  320  D0  Pi
  16828. 209  13/01  321  D1  Rho
  16829. 210  13/02  322  D2  (UNUSED)
  16830. 211  13/03  323  D3  Sigma
  16831. 212  13/04  324  D4  Tau
  16832. 213  13/05  325  D5  Upsilon
  16833. 214  13/06  326  D6  Phi
  16834. 215  13/07  327  D7  Khi
  16835. 216  13/08  330  D8  Psi
  16836. 217  13/09  331  D9  Omega
  16837. 218  13/10  332  DA  Iota with diaeresis
  16838. 219  13/11  333  DB  Upsilon with diaeresis
  16839. 220  13/12  334  DC  alpha with accent
  16840. 221  13/13  335  DD  epsilon with accent
  16841. 222  13/14  336  DE  eta with accent
  16842. 223  13/15  337  DF  iota with accent
  16843. 224  14/00  340  E0  upsilon with diaeresis and accent
  16844. 225  14/01  341  E1  alpha
  16845. 226  14/02  342  E2  beta
  16846. 227  14/03  343  E3  gamma
  16847. 228  14/04  344  E4  delta
  16848. 229  14/05  345  E5  epsilon
  16849. 230  14/06  346  E6  zeta
  16850. 231  14/07  347  E7  eta
  16851. 232  14/08  350  E8  theta
  16852. 233  14/09  351  E9  iota
  16853. 234  14/10  352  EA  kappa
  16854. 235  14/11  353  EB  lamda
  16855. 236  14/12  354  EC  mu
  16856. 237  14/13  355  ED  nu
  16857. 238  14/14  356  EE  ksi
  16858. 239  14/15  357  EF  omicron
  16859. 240  15/00  360  F0  pi
  16860. 241  15/01  361  F1  rho
  16861. 242  15/02  362  F2  terminal sigma
  16862. 243  15/03  363  F3  sigma
  16863. 244  15/04  364  F4  tau
  16864. 245  15/05  365  F5  upsilon
  16865. 246  15/06  366  F6  phi
  16866. 247  15/07  367  F7  khi
  16867. 248  15/08  370  F8  psi
  16868. 249  15/09  371  F9  omega
  16869. 250  15/10  372  FA  iota with diaeresis
  16870. 251  15/11  373  FB  upsilon with diaeresis
  16871. 252  15/12  374  FC  omicron with diaeresis
  16872. 253  15/13  375  FD  upsilon with accent
  16873. 254  15/14  376  FE  omega with accent
  16874. 255  15/15  377  FF  (UNUSED)
  16875.      _________________________________________________________________
  16876.    
  16877.     III.1.2.2. The ELOT 927 Character Set
  16878.     
  16879. dec col/row oct hex  description
  16880.  32  02/00   40  20  SPACE
  16881.  33  02/01   41  21  EXCLAMATION MARK
  16882.  34  02/02   42  22  QUOTATION MARK
  16883.  35  02/03   43  23  NUMBER SIGN
  16884.  36  02/04   44  24  DOLLAR SIGN
  16885.  37  02/05   45  25  PERCENT SIGN
  16886.  38  02/06   46  26  AMPERSAND
  16887.  39  02/07   47  27  APOSTROPHE
  16888.  40  02/08   50  28  LEFT PARENTHESIS
  16889.  41  02/09   51  29  RIGHT PARENTHESIS
  16890.  42  02/10   52  2A  ASTERISK
  16891.  43  02/11   53  2B  PLUS SIGN
  16892.  44  02/12   54  2C  COMMA
  16893.  45  02/13   55  2D  HYPHEN, MINUS SIGN
  16894.  46  02/14   56  2E  PERIOD, FULL STOP
  16895.  47  02/15   57  2F  SOLIDUS, SLASH
  16896.  48  03/00   60  30  DIGIT ZERO
  16897.  49  03/01   61  31  DIGIT ONE
  16898.  50  03/02   62  32  DIGIT TWO
  16899.  51  03/03   63  33  DIGIT THREE
  16900.  52  03/04   64  34  DIGIT FOUR
  16901.  53  03/05   65  35  DIGIT FIVE
  16902.  54  03/06   66  36  DIGIT SIX
  16903.  55  03/07   67  37  DIGIT SEVEN
  16904.  56  03/08   70  38  DIGIT EIGHT
  16905.  57  03/09   71  39  DIGIT NINE
  16906.  58  03/10   72  3A  COLON
  16907.  59  03/11   73  3B  SEMICOLON
  16908.  60  03/12   74  3C  LESS-THAN SIGN, LEFT ANGLE BRACKET
  16909.  61  03/13   75  3D  EQUALS SIGN
  16910.  62  03/14   76  3E  GREATER-THAN SIGN, RIGHT ANGLE BRACKET
  16911.  63  03/15   77  3F  QUESTION MARK
  16912.  64  04/00  100  40  COMMERCIAL AT SIGN
  16913.  65  04/01  101  41  CAPITAL LETTER A
  16914.  66  04/02  102  42  CAPITAL LETTER B
  16915.  67  04/03  103  43  CAPITAL LETTER C
  16916.  68  04/04  104  44  CAPITAL LETTER D
  16917.  69  04/05  105  45  CAPITAL LETTER E
  16918.  70  04/06  106  46  CAPITAL LETTER F
  16919.  71  04/07  107  47  CAPITAL LETTER G
  16920.  72  04/08  110  48  CAPITAL LETTER H
  16921.  73  04/09  111  49  CAPITAL LETTER I
  16922.  74  04/10  112  4A  CAPITAL LETTER J
  16923.  75  04/11  113  4B  CAPITAL LETTER K
  16924.  76  04/12  114  4C  CAPITAL LETTER L
  16925.  77  04/13  115  4D  CAPITAL LETTER M
  16926.  78  04/14  116  4E  CAPITAL LETTER N
  16927.  79  04/15  117  4F  CAPITAL LETTER O
  16928.  80  05/00  120  50  CAPITAL LETTER P
  16929.  81  05/01  121  51  CAPITAL LETTER Q
  16930.  82  05/02  122  52  CAPITAL LETTER R
  16931.  83  05/03  123  53  CAPITAL LETTER S
  16932.  84  05/04  124  54  CAPITAL LETTER T
  16933.  85  05/05  125  55  CAPITAL LETTER U
  16934.  86  05/06  126  56  CAPITAL LETTER V
  16935.  87  05/07  127  57  CAPITAL LETTER W
  16936.  88  05/08  130  58  CAPITAL LETTER X
  16937.  89  05/09  131  59  CAPITAL LETTER Y
  16938.  90  05/10  132  5A  CAPITAL LETTER Z
  16939.  91  05/11  133  5B  LEFT SQUARE BRACKET
  16940.  92  05/12  134  5C  REVERSE SOLIDUS, BACKSLASH
  16941.  93  05/13  135  5D  RIGHT SQUARE BRACKET
  16942.  94  05/14  136  5E  CIRCUMFLEX ACCENT
  16943.  95  05/15  137  5F  UNDERSCORE
  16944.  96  06/00  140  60  ACCENT GRAVE
  16945.  97  06/01  141  61  GREEK LETTER ALPHA
  16946.  98  06/02  142  62  GREEK LETTER BETA
  16947.  99  06/03  143  63  GREEK LETTER GAMMA
  16948. 100  06/04  144  64  GREEK LETTER DELTA
  16949. 101  06/05  145  65  GREEK LETTER EPSILON
  16950. 102  06/06  146  66  GREEK LETTER ZETA
  16951. 103  06/07  147  67  GREEK LETTER ETA
  16952. 104  06/08  150  68  GREEK LETTER THETA
  16953. 105  06/09  151  69  GREEK LETTER IOTA
  16954. 106  06/10  152  6A  GREEK LETTER KAPPA
  16955. 107  06/11  153  6B  GREEK LETTER LAMDA
  16956. 108  06/12  154  6C  GREEK LETTER MU
  16957. 109  06/13  155  6D  GREEK LETTER NU
  16958. 110  06/14  156  6E  GREEK LETTER KSI
  16959. 111  06/15  157  6F  GREEK LETTER OMICRON
  16960. 112  07/00  160  70  GREEK LETTER PI
  16961. 113  07/01  161  71  GREEK LETTER RHO
  16962. 114  07/02  162  72  GREEK LETTER SIGMA
  16963. 115  07/03  163  73  GREEK LETTER TAU
  16964. 116  07/04  164  74  GREEK LETTER UPSILON
  16965. 117  07/05  165  75  GREEK LETTER FI
  16966. 118  07/06  166  76  GREEK LETTER XI
  16967. 119  07/07  167  77  GREEK LETTER PSI
  16968. 120  07/08  170  78  GREEK LETTER OMEGA
  16969. 121  07/09  171  79  SPACE
  16970. 122  07/10  172  7A  SPACE
  16971. 123  07/11  173  7B  LEFT CURLY BRACKET, LEFT BRACE
  16972. 124  07/12  174  7C  VERTICAL LINE, VERTICAL BAR
  16973. 125  07/13  175  7D  RIGHT CURLY BRACKET, RIGHT BRACE
  16974. 126  07/14  176  7E  TILDE
  16975. 127  07/15  177  7F  RUBOUT, DELETE
  16976.      _________________________________________________________________
  16977.    
  16978.     III.1.2.3. PC Code Page 869
  16979.     
  16980.    (to be filled in...)
  16981.      _________________________________________________________________
  16982.    
  16983.     III.2. Updated Country Codes
  16984.     
  16985.    Date: Mon, 7 Apr 1997 23:23:49 EDT
  16986.    From: Dave Leibold <dleibold@else.net>
  16987.    Newsgroups: comp.dcom.telecom
  16988.    Subject: Ex-USSR Country Codes Profile
  16989.    Organization: TELECOM Digest
  16990.    
  16991.    Ex-USSR Country Codes Profile
  16992.    4 April 1997
  16993.    
  16994.    Below is a summary of the country codes that have formed in the wake
  16995.    of the USSR dissolution, along with some updated findings and reports.
  16996.    Additional or corrected information on any of these nations would be
  16997.    welcome (c/o dleibold@else.net).
  16998.      * Kyrgyz Republic country code 996 will take effect, at least in
  16999.        Canada, effective 1 May 1997, according to CRTC Telecom Order
  17000.        97-464, based on Stentor Tariff Notice 433. There is no indication
  17001.        whether there will be a permissive dialing period involved or for
  17002.        how long such a permissive operation would remain.
  17003.      * Country code 992 was reported as a recent assignment for
  17004.        Tajikistan, which will be moving from country code 7 at some
  17005.        unknown time.
  17006.      * Uzbekistan has its own country code assignment, but I have no
  17007.        information if this is in service yet or what implementation dates
  17008.        have been set.
  17009.      * Kazakstan does not have a known separate country code assignment
  17010.        at present. It remains in country code 7 for the time being.
  17011.      * Russia seems destined to keep country code 7.
  17012.      * Recent news reports speak of some agreements forming between
  17013.        Russia and Belarus. While there is no outright reunification yet,
  17014.        there is expected to be much closer ties between the two nations.
  17015.        Whether this will lead to a reunification of telephone codes
  17016.        remains to be seen.
  17017.        
  17018.    In the table, "Effective" means the date at which the country code
  17019.    began service (which could vary according to the nation). "Mandatory"
  17020.    means the date at which the country code 7 is invalid for calls to
  17021.    that nation. There are a number of question marks since exact dates
  17022.    have not been collected in all cases.
  17023.    
  17024. CC  Nation            Effective     Mandatory    Notes
  17025.  
  17026. 370 Lithuania         1993?         ???          Announced Jan 1993
  17027. 371 Latvia            1993?         ???
  17028. 372 Estonia           1 Feb 1993?   March 1993?
  17029. 373 Moldova           1993?         ???          Announced Jan 1993
  17030. 374 Armenia           1 May 1995    1 July 1995  Announced Jan 1995 (ITU)
  17031. 375 Belarus           16 Apr 1995   1997?
  17032. 380 Ukraine           16 Apr 1995   Oct 1995?
  17033. 7   Kazakstan         (no known changes)
  17034. 7   Russia            (presumably not changing)
  17035. 992 Tajikistan        ???           ???          Announced 1996-7?
  17036. 993 Turkmenistan      3 Jan 1997    3 Apr 1997   Canada as of 29 Nov 1996
  17037. 994 Azerbaijan        Sept 1994?    ???          Announced 1992
  17038. 995 Georgia           1994?         ???          ref: Telecom Digest Oct 1994
  17039. 996 Kyrgyz Republic   1 May 1997    ???          ref: Stentor Canada/CRTC
  17040. 998 Uzbekistan        ???           ???          Announced 1996? (ITU)
  17041.  
  17042.    Details courtesy Toby Nixon, ITU, Stentor (Canada), CRTC (Canada),
  17043.    TELECOM Digest (including information collected for the country code
  17044.    listings).
  17045.      _________________________________________________________________
  17046.    
  17047. IV. ERRATA & CORRIGENDA
  17048.  
  17049.    The following errors in [638]Using C-Kermit, Second Edition, first
  17050.    printing, have been noted.
  17051.    
  17052.    First, some missing acknowledgements for C-Kermit 6.0: JE Jones of
  17053.    Microware for help with OS-9, Nigel Roles for his help with Plan 9,
  17054.    Lucas Hart for help with VMS and Digital UNIX, Igor Kovalenko for his
  17055.    help with QNX. And later, to Susan Kleinmann for her help with Debian
  17056.    Linux packaging; Patrick Volkerding for his help with Slackware Linux
  17057.    packaging; Jim Knoble for his help with Red Hat Linux packaging; and
  17058.    to dozens of others for sending individual C-Kermit binaries for
  17059.    varied and diverse platforms.
  17060.    
  17061.    Thanks to James Spath for both binaries and reporting many of the
  17062.    typos noted below. Also to Dat Thuc Nguyen for spotting several typos.
  17063.    
  17064. PAGE    REMARKS
  17065. COVER   "COS" is a misprint.  There is no COS.  Pretend it says "SCO" or "VOS".
  17066.         (This is fixed in the second printing.)
  17067.  xxi    Second line: Fred Smith's affiliation should be Computrition.
  17068.  83     Change "commands other" to "commands as other" (1st paragraph)
  17069.  87     Change "The the" to "The" (2nd paragraph)
  17070.  92     "set modem-type user-defined supra" should be "set modem type ..."
  17071.  95     Change "VI" to "vi" (1st paragraph)
  17072.  96     Change "it it" to "it is" (1st paragraph)
  17073.  97     Change "advantage a literal" to "advantage of a literal" (2nd
  17074.         paragraph)
  17075. 102     The call-waiting example would be better as SET DIAL PREFIX *70W
  17076.         (rather than "*70,") because the former will not cause an incorrect
  17077.         call to be placed with pulse dialing.
  17078. 123     Third paragraph from bottom: "..otherwise if a your local username.."
  17079.         should be "..otherwise your local username..".
  17080. 160     Delete the "it" between "and" and "to" (2nd paragraph)
  17081. 185     In "When TRANSFER DISPLAY is OFF, C-Kermit skips the display...",
  17082.         "OFF" should be "NONE".
  17083. 187     The last paragraph says the "A command" is ignored, should be "S".
  17084. 194     Change "it known" to "it is known" (4th paragraph).
  17085. 235     In C-Kermit 7.0, the syntax of the GET command changed.  MGET now
  17086.         must be used to get a list of files and there is no more multiline
  17087.         GET command.
  17088. 268     Last paragraph: "effect" should be "affect".
  17089. 275     In the SET PROTOCOL KERMIT description, the following sentence is
  17090.         incorrect and should be removed: 'If you omit the commands, the
  17091.         default ones are restored: "kermit -ir" and "kermit -r" respectively".
  17092.         The correct information is given at the bottom of page 281.
  17093. 279     9th line.  The decimal value of ST is 156, not 155.
  17094. 295     In the stepping stones, skip ahead to Chapter 17 on p. 327.
  17095. 298     Table 16-2, Portuguese entry.  Column 4/00 should show section sign,
  17096.         not acute accent.
  17097. 316     Other languages written in the Hebrew alphabet include Karaim (a Turkic
  17098.         language spoken in Lithuania and Poland), Judeo-Kurdish, and Judeo-
  17099.         Georgian.
  17100. 332     UNDEFINE definition, change "This just" to "This is just".
  17101. 344     It might be necessary to set the modem's pulse generation rate when
  17102.         sending numeric pages; most Hayes compatible modems use the S11
  17103.         register for this.
  17104. 350     Delete "is" from between "It" and "ceases" (4th paragraph)
  17105. 351     Top - both occurrences of "print \%a" should be "echo \%a".
  17106. 364     \v(input) and \v(query) out of alphabetical order.
  17107. 378     In the MYSEND macro, "if not \m(rc) goto bad" should be:
  17108.         "if \m(rc) goto bad" (remove the "not").
  17109. 382-383 It should be stated that the loop control variable must be of the \%a
  17110.         type, or else an array element; macro names can not be used for this.
  17111. 383     In line 3, "\%f[\%i]" should be "\&f[\%i]".
  17112. 383     In the sort example, it should be stated that the array is 1-based.
  17113. 387     Change "You can list" to "You can get a list" (5th paragraph)
  17114. 393     \Fverify() description.  The 3rd sentence could be stated more clearly
  17115.         as "If all characters in string2 are also in string1, 0 is returned."
  17116. 398     Copying \ffiles() results to an array before is not required as of
  17117.         C-Kermit 7.0 (see [639]Section 7.3).
  17118. 403     In "(\%a + 3) * (\%b  5)", a minus sign is missing between b and 5.
  17119. 407     C-Kermit 7.0 no longer supports multiline GET.  Change
  17120.         "get, \%1, \%2" to "get {\%1} {\%2}" or "get /as:{\%2} {\%1}".
  17121. 409     READ example while loop should be:
  17122.         while success { echo \m(line), read line }
  17123. 409     "WRITE file" should be "WRITE keyword" (you can't put a filename there)
  17124.         (The same applies to WRITE-LINE / WRITELN).
  17125. 414     \Funhexify() missing from Table 18-3.
  17126. 425     MINPUT definition, change 2nd "text2" to "text3".
  17127. 436     Several lines are missing from the UNIXLOGIN macro listing.
  17128.         After the "xif fail" block, insert:
  17129.  
  17130.           out \%1\13                    ; Send username, carriage return
  17131.           inp 5 Password:               ; Wait 5 sec for this prompt
  17132.           if fail end 1 No password prompt
  17133.           pause                         ; Wait a sec
  17134.           out \%2\13                    ; Send password
  17135.  
  17136. 440     Change "set terminal byteszie" to "set terminal bytesize".
  17137.         Change "input Password:" to "input 10 Password".
  17138. 448     Franchise script: "access line" should be "access \m(line)".
  17139. 453     There are two incorrectly coded IF statements in the DELIVER macro
  17140.         definition.  Replace both occurrences of "if > \%1 \%3 {" with
  17141.         "xif > \%i \%3 {" (replace "if" by "xif" and "\%1" with "\%i").
  17142. 453     "the the" (last paragraph) should be "the".
  17143. 454     EOT (last paragraph) is End of Transmission, not End of Text.
  17144. 457     _DEFINE definition: "name constructed" should be "name is constructed".
  17145. 457     "macro for and" (last paragraph) should be "macro and".
  17146. 459     Should explain that \v(user) is a legal abbreviation of \v(userid).
  17147. 480     Figure II-2 is backwards; the least-significant bit is transmitted
  17148.         first, then up to the highest, and the parity bit last.
  17149. 534     The VMS Appendix section on Odd Record Lengths no longer applies;
  17150.         C-Kermit 7.0 handles odd record lengths as well as even ones.
  17151. 559     Table VIII-3, Portuguese entry.  Column 4/00 should show section sign,
  17152.         not acute accent.
  17153. 560-563 HP-Roman8 missing from Table VII-4; there wasn't room to squeeze it in.
  17154.         It is listed in section II(6).
  17155. 565     "d stroke" in Table VII-5 has the wrong appearance; the stem should
  17156.         be upright.  The letter shown in the table is actually a lowercase
  17157.         Icelandic eth, which has a curved stem.
  17158. 601-604 BeBox, BeOS, Plan 9, and probably others not listed in trademarks.
  17159. 604     The words "SCRIBE TEXT FORMATTER" appear at the end of the last
  17160.         sentence of the first paragraph of the Colophon.  They should have
  17161.         been in the Index.
  17162. Index:  Missing entries: SET { SEND, RECEIVE } PATHNAMES, Call waiting, ...
  17163.         \F()            Page 605, add also 413-414
  17164.         \Fbreak         389
  17165.         \Fcapitalize    390
  17166.         \Fchecksum      414
  17167.         \Fcrc16         414
  17168.         \Fexecute       414
  17169.         \Fhexify        390
  17170.         \Fltrim         391
  17171.         \Frepeat        392
  17172.         \Fspawn         392
  17173.         \Ftod2secs      399
  17174.         \v() built_in   Page 606, add also 361-364
  17175.         \v(_line)       354, 361
  17176.         \v(apcactive)   361
  17177.         \v(charset)     362
  17178.         \v(cpu)         362
  17179.         \v(crc16)       357, 362
  17180.         \v(d$xxx)       add page 362
  17181.         \v(dialnumber)  362
  17182.         \v(dialresult)  362
  17183.         \v(errno)       362
  17184.         \v(errstring)   362
  17185.         \v(exedir)      362
  17186.         \v(inidir)      363
  17187.         \v(ipaddress)   363
  17188.         \v(keyboard)    363
  17189.         \v(macro)       363
  17190.         \v(minput)      363
  17191.         \v(m_xxx)       94, 363
  17192.         \v(password)    364
  17193.         \v(query)       364
  17194.         \v(prompt)      364
  17195.         \v(speed)       356, 364
  17196.         \v(startup)     364
  17197.         \v(status)      364
  17198.         \v(sysid)       364
  17199.         \v(system)      364
  17200.         \v(fsize)       at lower half page 606 should read \v(tfsize)
  17201.         \v(xversion)    364
  17202.         BEEP Command    40
  17203.         SET FLOW        62, 212
  17204.  
  17205.    Figure II-5 on page 493. The pin assignments of the Mini Din-8
  17206.    connector are not described anywhere. As noted in the text, these tend
  17207.    to vary from vendor to vendor. One common arrangement is:
  17208.    
  17209.   1. HSKout (Handshake out -- definition depends on software)
  17210.   2. HSKin  (Handshake in or external clock)
  17211.   3. TxD-
  17212.   4. Not used
  17213.   5. RxD-
  17214.   6. TxD+
  17215.   7. Not used
  17216.   8. RxD+
  17217.  
  17218.    Note the "balanced pairs" for Receive Data (RxD) and Transmit Data
  17219.    (TxD), and the utter lack of modem signals. These connectors follow
  17220.    the RS-423 standard, rather than RS-232. In some arrangements, Pin 1
  17221.    is used for DTR and Pin 2 for CD; in others Pin 1 is RTS and Pin 2 is
  17222.    CTS.
  17223.    
  17224.    Please send reports of other errors to the authors, as well as
  17225.    suggestions for improvements, additional index entries, and any other
  17226.    comments:
  17227.    
  17228.    [640]kermit@columbia.edu
  17229.      _________________________________________________________________
  17230.    
  17231. APPENDIX V. ADDITIONAL COPYRIGHT NOTICES
  17232.  
  17233.    The following copyrights cover some of the source code used in the
  17234.    development of C-Kermit, Kermit 95, or Kermit 95 support libraries.
  17235.    
  17236. /*****************************************************************************/
  17237. /*                                                                           */
  17238. /*              Copyright (c) 1995 by Oy Online Solutions Ltd.               */
  17239. /*                                                                           */
  17240. /*   Distribution of this source code is strictly forbbidden. Use of this    */
  17241. /*   source code is granted to the University of Columbia C-Kermit project   */
  17242. /*   to be distributed in binary format only. Please familiarize yourself    */
  17243. /*   with the accompanying LICENSE.P file.                                   */
  17244. /*                                                                           */
  17245. /*****************************************************************************/
  17246.  
  17247.    used for Xmodem, Ymodem, and Zmodem protocol in Kermit 95 (p95.dll,
  17248.    p2.dll)
  17249.      _________________________________________________________________
  17250.    
  17251.    Copyright (c) 1997 Stanford University
  17252.    
  17253.    The use of this software for revenue-generating purposes may require a
  17254.    license from the owners of the underlying intellectual property.
  17255.    Specifically, the SRP-3 protocol may not be used for
  17256.    revenue-generating purposes without a license.
  17257.    
  17258.    Within that constraint, permission to use, copy, modify, and
  17259.    distribute this software and its documentation for any purpose is
  17260.    hereby granted without fee, provided that the above copyright notices
  17261.    and this permission notice appear in all copies of the software and
  17262.    related documentation.
  17263.    
  17264.    THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  17265.    EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  17266.    WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  17267.    
  17268.    IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17269.    INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  17270.    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  17271.    ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  17272.    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  17273.    SOFTWARE.
  17274.    
  17275.    Used for Secure Remote Password (TM) protocol (SRP) in C-Kermit,
  17276.    Kermit 95 (k95.exe, k2.exe, k95crypt.dll, k2crypt.dll)
  17277.      _________________________________________________________________
  17278.    
  17279.    Copyright 1990 by the Massachusetts Institute of Technology. All
  17280.    Rights Reserved.
  17281.    
  17282.    Export of this software from the United States of America may require
  17283.    a specific license from the United States Government. It is the
  17284.    responsibility of any person or organization contemplating export to
  17285.    obtain such a license before exporting.
  17286.    
  17287.    WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
  17288.    distribute this software and its documentation for any purpose and
  17289.    without fee is hereby granted, provided that the above copyright
  17290.    notice appear in all copies and that both that copyright notice and
  17291.    this permission notice appear in supporting documentation, and that
  17292.    the name of M.I.T. not be used in advertising or publicity pertaining
  17293.    to distribution of the software without specific, written prior
  17294.    permission. M.I.T. makes no representations about the suitability of
  17295.    this software for any purpose. It is provided "as is" without express
  17296.    or implied warranty.
  17297.    
  17298.    Used for Telnet Authentication Option, Telnet Encryption Option, and
  17299.    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
  17300.    k95crypt.dll, k2crypt.dll)
  17301.      _________________________________________________________________
  17302.    
  17303.    Copyright (c) 1991, 1993 The Regents of the University of California.
  17304.    All rights reserved.
  17305.    
  17306.    Redistribution and use in source and binary forms, with or without
  17307.    modification, are permitted provided that the following conditions are
  17308.    met:
  17309.     1. Redistributions of source code must retain the above copyright
  17310.        notice, this list of conditions and the following disclaimer.
  17311.     2. Redistributions in binary form must reproduce the above copyright
  17312.        notice, this list of conditions and the following disclaimer in
  17313.        the documentation and/or other materials provided with the
  17314.        distribution.
  17315.     3. All advertising materials mentioning features or use of this
  17316.        software must display the following acknowledgement:
  17317.        
  17318.      This product includes software developed by the University of
  17319.      California, Berkeley and its contributors.
  17320.     4. Neither the name of the University nor the names of its
  17321.        contributors may be used to endorse or promote products derived
  17322.        from this software without specific prior written permission.
  17323.        
  17324.    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
  17325.    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  17326.    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  17327.    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
  17328.    BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  17329.    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  17330.    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  17331.    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  17332.    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  17333.    OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  17334.    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17335.    
  17336.    Used for Telnet Authentication Option, Telnet Encryption Option, and
  17337.    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
  17338.    k95crypt.dll, k2crypt.dll)
  17339.      _________________________________________________________________
  17340.    
  17341.    Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) All rights
  17342.    reserved.
  17343.    
  17344.    This package is an DES implementation written by Eric Young
  17345.    (eay@cryptsoft.com). The implementation was written so as to conform
  17346.    with MIT's libdes.
  17347.    
  17348.    This library is free for commercial and non-commercial use as long as
  17349.    the following conditions are aheared to. The following conditions
  17350.    apply to all code found in this distribution.
  17351.    
  17352.    Copyright remains Eric Young's, and as such any Copyright notices in
  17353.    the code are not to be removed. If this package is used in a product,
  17354.    Eric Young should be given attribution as the author of that the SSL
  17355.    library. This can be in the form of a textual message at program
  17356.    startup or in documentation (online or textual) provided with the
  17357.    package.
  17358.    
  17359.    Redistribution and use in source and binary forms, with or without
  17360.    modification, are permitted provided that the following conditions are
  17361.    met:
  17362.     1. Redistributions of source code must retain the copyright notice,
  17363.        this list of conditions and the following disclaimer.
  17364.     2. Redistributions in binary form must reproduce the above copyright
  17365.        notice, this list of conditions and the following disclaimer in
  17366.        the documentation and/or other materials provided with the
  17367.        distribution.
  17368.     3. All advertising materials mentioning features or use of this
  17369.        software must display the following acknowledgement: This product
  17370.        includes software developed by Eric Young (eay@cryptsoft.com)
  17371.        
  17372.    THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR
  17373.    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17374.    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17375.    DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  17376.    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  17377.    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  17378.    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  17379.    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  17380.    IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  17381.    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  17382.    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17383.    
  17384.    The license and distribution terms for any publically available
  17385.    version or derivative of this code cannot be changed. i.e. this code
  17386.    cannot simply be copied and put under another distrubution license
  17387.    [including the GNU Public License.]
  17388.    
  17389.    The reason behind this being stated in this direct manner is past
  17390.    experience in code simply being copied and the attribution removed
  17391.    from it and then being distributed as part of other packages. This
  17392.    implementation was a non-trivial and unpaid effort.
  17393.    
  17394.    Used DES encryption in Kermit 95 (k95crypt.dll, k2crypt.dll)
  17395.      _________________________________________________________________
  17396.    
  17397.  * This is version 1.1 of CryptoLib
  17398.  *
  17399.  * The authors of this software are Jack Lacy, Don Mitchell and Matt Blaze
  17400.  *              Copyright (c) 1991, 1992, 1993, 1994, 1995 by AT&T.
  17401.  * Permission to use, copy, and modify this software without fee
  17402.  * is hereby granted, provided that this entire notice is included in
  17403.  * all copies of any software which is or includes a copy or
  17404.  * modification of this software and in all copies of the supporting
  17405.  * documentation for such software.
  17406.  *
  17407.  * NOTE:
  17408.  * Some of the algorithms in cryptolib may be covered by patents.
  17409.  * It is the responsibility of the user to ensure that any required
  17410.  * licenses are obtained.
  17411.  *
  17412.  *
  17413.  * SOME PARTS OF CRYPTOLIB MAY BE RESTRICTED UNDER UNITED STATES EXPORT
  17414.  * REGULATIONS.
  17415.  *
  17416.  *
  17417.  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
  17418.  * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
  17419.  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  17420.  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  17421.  
  17422.    Used for Big Number library in Kermit 95 (k95crypt.dll, k2crypt.dll).
  17423.    
  17424.    [ [641]Top ] [ [642]C-Kermit ] [ [643]Kermit Home ]
  17425.      _________________________________________________________________
  17426.    
  17427.    CKERMIT2.HTML / The Kermit Project / Columbia University / 8 Feb 2000
  17428.  
  17429. References
  17430.  
  17431.    1. http://www.columbia.edu/kermit/ckermit70.html#contents
  17432.    2. http://www.columbia.edu/kermit/ckermit.html
  17433.    3. http://www.columbia.edu/kermit/index.html
  17434.    4. http://www.columbia.edu/kermit/ckermit70.html
  17435.    5. mailto:kermit-support@columbia.edu
  17436.    6. http://www.columbia.edu/kermit/
  17437.    7. http://www.kermit-project.org/
  17438.    8. http://www.columbia.nyc.ny.us/kermit/
  17439.    9. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
  17440.   10. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
  17441.   11. http://www.columbia.edu/kermit/ckermit70.html#xv
  17442.   12. http://www.columbia.edu/kermit/ck60manual.html
  17443.   13. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
  17444.   14. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17445.   15. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
  17446.   16. ftp://kermit.columbia.edu/kermit/f/ckermit2.txt
  17447.   17. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17448.   18. ftp://kermit.columbia.edu/kermit/f/ckermit2.txt
  17449.   19. ftp://kermit.columbia.edu/kermit/f/security.txt
  17450.   20. http://www.columbia.edu/kermit/security.html
  17451.   21. ftp://kermit.columbia.edu/kermit/f/iksd.txt
  17452.   22. http://www.columbia.edu/kermit/iksd.html
  17453.   23. http://www.columbia.edu/kermit/cuiksd.html
  17454.   24. ftp://kermit.columbia.edu/kermit/f/telnet.txt
  17455.   25. http://www.columbia.edu/kermit/telnet.html
  17456.   26. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
  17457.   27. http://www.columbia.edu/kermit/k95.html
  17458.   28. http://www.opensource.org/
  17459.   29. http://www.columbia.edu/kermit/ck60manual.html
  17460.   30. http://www.columbia.edu/kermit/ckermit70.html#xi
  17461.   31. http://www.columbia.edu/kermit/ckermit70.html#xii
  17462.   32. http://www.columbia.edu/kermit/ckermit70.html#x0
  17463.   33. http://www.columbia.edu/kermit/ckermit70.html#x1
  17464.   34. http://www.columbia.edu/kermit/ckermit70.html#x1.0
  17465.   35. http://www.columbia.edu/kermit/ckermit70.html#x1.1
  17466.   36. http://www.columbia.edu/kermit/ckermit70.html#x1.2
  17467.   37. http://www.columbia.edu/kermit/ckermit70.html#x1.3
  17468.   38. http://www.columbia.edu/kermit/ckermit70.html#x1.4
  17469.   39. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17470.   40. http://www.columbia.edu/kermit/ckermit70.html#x1.5.1
  17471.   41. http://www.columbia.edu/kermit/ckermit70.html#x1.5.2
  17472.   42. http://www.columbia.edu/kermit/ckermit70.html#x1.5.3
  17473.   43. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17474.   44. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
  17475.   45. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17476.   46. http://www.columbia.edu/kermit/ckermit70.html#x1.7
  17477.   47. http://www.columbia.edu/kermit/ckermit70.html#x1.8
  17478.   48. http://www.columbia.edu/kermit/ckermit70.html#x1.9
  17479.   49. http://www.columbia.edu/kermit/ckermit70.html#x1.10
  17480.   50. http://www.columbia.edu/kermit/ckermit70.html#x1.11
  17481.   51. http://www.columbia.edu/kermit/ckermit70.html#x1.11.1
  17482.   52. http://www.columbia.edu/kermit/ckermit70.html#x1.11.2
  17483.   53. http://www.columbia.edu/kermit/ckermit70.html#x1.11.3
  17484.   54. http://www.columbia.edu/kermit/ckermit70.html#x1.11.4
  17485.   55. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
  17486.   56. http://www.columbia.edu/kermit/ckermit70.html#x1.11.6
  17487.   57. http://www.columbia.edu/kermit/ckermit70.html#x1.11.7
  17488.   58. http://www.columbia.edu/kermit/ckermit70.html#x1.12
  17489.   59. http://www.columbia.edu/kermit/ckermit70.html#x1.13
  17490.   60. http://www.columbia.edu/kermit/ckermit70.html#x1.14
  17491.   61. http://www.columbia.edu/kermit/ckermit70.html#x1.15
  17492.   62. http://www.columbia.edu/kermit/ckermit70.html#x1.16
  17493.   63. http://www.columbia.edu/kermit/ckermit70.html#x1.17
  17494.   64. http://www.columbia.edu/kermit/ckermit70.html#x1.18
  17495.   65. http://www.columbia.edu/kermit/ckermit70.html#x1.19
  17496.   66. http://www.columbia.edu/kermit/ckermit70.html#x1.20
  17497.   67. http://www.columbia.edu/kermit/ckermit70.html#x1.21
  17498.   68. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  17499.   69. http://www.columbia.edu/kermit/ckermit70.html#x1.22.1
  17500.   70. http://www.columbia.edu/kermit/ckermit70.html#x1.22.2
  17501.   71. http://www.columbia.edu/kermit/ckermit70.html#x1.22.3
  17502.   72. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
  17503.   73. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
  17504.   74. http://www.columbia.edu/kermit/ckermit70.html#x1.22.6
  17505.   75. http://www.columbia.edu/kermit/ckermit70.html#x1.22.7
  17506.   76. http://www.columbia.edu/kermit/ckermit70.html#x1.22.8
  17507.   77. http://www.columbia.edu/kermit/ckermit70.html#x1.23
  17508.   78. http://www.columbia.edu/kermit/ckermit70.html#x1.24
  17509.   79. http://www.columbia.edu/kermit/x2
  17510.   80. http://www.columbia.edu/kermit/ckermit70.html#x2.0
  17511.   81. http://www.columbia.edu/kermit/ckermit70.html#x2.1
  17512.   82. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
  17513.   83. http://www.columbia.edu/kermit/ckermit70.html#x2.1.2
  17514.   84. http://www.columbia.edu/kermit/ckermit70.html#x2.1.3
  17515.   85. http://www.columbia.edu/kermit/ckermit70.html#x2.1.4
  17516.   86. http://www.columbia.edu/kermit/ckermit70.html#x2.1.5
  17517.   87. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
  17518.   88. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
  17519.   89. http://www.columbia.edu/kermit/ckermit70.html#x2.1.8
  17520.   90. http://www.columbia.edu/kermit/ckermit70.html#x2.1.9
  17521.   91. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
  17522.   92. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
  17523.   93. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
  17524.   94. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
  17525.   95. http://www.columbia.edu/kermit/ckermit70.html#x2.1.14
  17526.   96. http://www.columbia.edu/kermit/ckermit70.html#x2.1.15
  17527.   97. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
  17528.   98. http://www.columbia.edu/kermit/ckermit70.html#x2.2
  17529.   99. http://www.columbia.edu/kermit/ckermit70.html#x2.2.1
  17530.  100. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
  17531.  101. http://www.columbia.edu/kermit/ckermit70.html#x2.3
  17532.  102. http://www.columbia.edu/kermit/ckermit70.html#x2.3.0
  17533.  103. http://www.columbia.edu/kermit/ckermit70.html#x2.3.1
  17534.  104. http://www.columbia.edu/kermit/ckermit70.html#x2.3.2
  17535.  105. http://www.columbia.edu/kermit/ckermit70.html#x2.3.3
  17536.  106. http://www.columbia.edu/kermit/ckermit70.html#x2.3.4
  17537.  107. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
  17538.  108. http://www.columbia.edu/kermit/ckermit70.html#x2.3.6
  17539.  109. http://www.columbia.edu/kermit/ckermit70.html#x2.4
  17540.  110. http://www.columbia.edu/kermit/ckermit70.html#x2.5
  17541.  111. http://www.columbia.edu/kermit/ckermit70.html#x2.6
  17542.  112. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17543.  113. http://www.columbia.edu/kermit/ckermit70.html#x2.7.0
  17544.  114. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1
  17545.  115. http://www.columbia.edu/kermit/ckermit70.html#x2.7.2
  17546.  116. http://www.columbia.edu/kermit/ckermit70.html#x2.7.3
  17547.  117. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4
  17548.  118. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.1
  17549.  119. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.2
  17550.  120. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.3
  17551.  121. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.4
  17552.  122. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.5
  17553.  123. http://www.columbia.edu/kermit/ckermit70.html#x2.8
  17554.  124. http://www.columbia.edu/kermit/ckermit70.html#x2.9
  17555.  125. http://www.columbia.edu/kermit/ckermit70.html#x2.9.1
  17556.  126. http://www.columbia.edu/kermit/ckermit70.html#x2.9.2
  17557.  127. http://www.columbia.edu/kermit/ckermit70.html#x2.10
  17558.  128. http://www.columbia.edu/kermit/ckermit70.html#x2.11
  17559.  129. http://www.columbia.edu/kermit/ckermit70.html#x2.12
  17560.  130. http://www.columbia.edu/kermit/ckermit70.html#x2.13
  17561.  131. http://www.columbia.edu/kermit/ckermit70.html#x2.14
  17562.  132. http://www.columbia.edu/kermit/ckermit70.html#x2.15
  17563.  133. http://www.columbia.edu/kermit/ckermit70.html#x3
  17564.  134. http://www.columbia.edu/kermit/ckermit70.html#x3.1
  17565.  135. http://www.columbia.edu/kermit/ckermit70.html#x3.2
  17566.  136. http://www.columbia.edu/kermit/ckermit70.html#x3.3
  17567.  137. http://www.columbia.edu/kermit/ckermit70.html#x3.4
  17568.  138. http://www.columbia.edu/kermit/ckermit70.html#x4
  17569.  139. http://www.columbia.edu/kermit/ckermit70.html#x4.0
  17570.  140. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17571.  141. http://www.columbia.edu/kermit/ckermit70.html#x4.1.1
  17572.  142. http://www.columbia.edu/kermit/ckermit70.html#x4.1.2
  17573.  143. http://www.columbia.edu/kermit/ckermit70.html#x4.1.3
  17574.  144. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17575.  145. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1
  17576.  146. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.1
  17577.  147. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.2
  17578.  148. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
  17579.  149. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17580.  150. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.1
  17581.  151. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.2
  17582.  152. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
  17583.  153. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.1
  17584.  154. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.2
  17585.  155. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
  17586.  156. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
  17587.  157. http://www.columbia.edu/kermit/ckermit70.html#x4.2.6
  17588.  158. http://www.columbia.edu/kermit/ckermit70.html#x4.2.7
  17589.  159. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8
  17590.  160. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
  17591.  161. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
  17592.  162. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.3
  17593.  163. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
  17594.  164. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17595.  165. http://www.columbia.edu/kermit/ckermit70.html#x4.3.1
  17596.  166. http://www.columbia.edu/kermit/ckermit70.html#x4.3.2
  17597.  167. http://www.columbia.edu/kermit/ckermit70.html#x4.3.3
  17598.  168. http://www.columbia.edu/kermit/ckermit70.html#x4.3.4
  17599.  169. http://www.columbia.edu/kermit/ckermit70.html#x4.4
  17600.  170. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1
  17601.  171. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.1
  17602.  172. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.2
  17603.  173. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2
  17604.  174. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1
  17605.  175. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.1
  17606.  176. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.2
  17607.  177. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.2
  17608.  178. http://www.columbia.edu/kermit/ckermit70.html#x4.5
  17609.  179. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17610.  180. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
  17611.  181. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.1
  17612.  182. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.2
  17613.  183. http://www.columbia.edu/kermit/ckermit70.html#x4.5.3
  17614.  184. http://www.columbia.edu/kermit/ckermit70.html#x4.5.4
  17615.  185. http://www.columbia.edu/kermit/ckermit70.html#x4.6
  17616.  186. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  17617.  187. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17618.  188. http://www.columbia.edu/kermit/ckermit70.html#x4.7.2
  17619.  189. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
  17620.  190. http://www.columbia.edu/kermit/ckermit70.html#x4.8
  17621.  191. http://www.columbia.edu/kermit/ckermit70.html#x4.8.1
  17622.  192. http://www.columbia.edu/kermit/ckermit70.html#x4.8.2
  17623.  193. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17624.  194. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17625.  195. http://www.columbia.edu/kermit/ckermit70.html#x4.9.2
  17626.  196. http://www.columbia.edu/kermit/ckermit70.html#x4.9.3
  17627.  197. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17628.  198. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17629.  199. http://www.columbia.edu/kermit/ckermit70.html#x4.11.1
  17630.  200. http://www.columbia.edu/kermit/ckermit70.html#x4.11.2
  17631.  201. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  17632.  202. http://www.columbia.edu/kermit/ckermit70.html#x4.11.4
  17633.  203. http://www.columbia.edu/kermit/ckermit70.html#x4.11.5
  17634.  204. http://www.columbia.edu/kermit/ckermit70.html#x4.11.6
  17635.  205. http://www.columbia.edu/kermit/ckermit70.html#x4.12
  17636.  206. http://www.columbia.edu/kermit/ckermit70.html#x4.13
  17637.  207. http://www.columbia.edu/kermit/ckermit70.html#x4.14
  17638.  208. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17639.  209. http://www.columbia.edu/kermit/ckermit70.html#x4.16
  17640.  210. http://www.columbia.edu/kermit/ckermit70.html#x4.17
  17641.  211. http://www.columbia.edu/kermit/ckermit70.html#x4.17.1
  17642.  212. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
  17643.  213. http://www.columbia.edu/kermit/ckermit70.html#x4.18
  17644.  214. http://www.columbia.edu/kermit/ckermit70.html#x4.19
  17645.  215. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17646.  216. http://www.columbia.edu/kermit/ckermit70.html#x4.20.1
  17647.  217. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2
  17648.  218. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.1
  17649.  219. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.2
  17650.  220. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
  17651.  221. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.4
  17652.  222. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.5
  17653.  223. http://www.columbia.edu/kermit/ckermit70.html#x4.20.3
  17654.  224. http://www.columbia.edu/kermit/ckermit70.html#x4.21
  17655.  225. http://www.columbia.edu/kermit/ckermit70.html#x4.22
  17656.  226. http://www.columbia.edu/kermit/ckermit70.html#x4.22.1
  17657.  227. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
  17658.  228. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
  17659.  229. http://www.columbia.edu/kermit/ckermit70.html#x4.22.4
  17660.  230. http://www.columbia.edu/kermit/ckermit70.html#x4.22.5
  17661.  231. http://www.columbia.edu/kermit/ckermit70.html#x4.22.6
  17662.  232. http://www.columbia.edu/kermit/ckermit70.html#x4.22.7
  17663.  233. http://www.columbia.edu/kermit/ckermit70.html#x4.22.8
  17664.  234. http://www.columbia.edu/kermit/ckermit70.html#x4.23
  17665.  235. http://www.columbia.edu/kermit/ckermit70.html#x4.24
  17666.  236. http://www.columbia.edu/kermit/ckermit70.html#x4.25
  17667.  237. http://www.columbia.edu/kermit/ckermit70.html#x5
  17668.  238. http://www.columbia.edu/kermit/ckermit70.html#x5.0
  17669.  239. http://www.columbia.edu/kermit/ckermit70.html#x5.1
  17670.  240. http://www.columbia.edu/kermit/ckermit70.html#x5.2
  17671.  241. http://www.columbia.edu/kermit/ckermit70.html#x5.3
  17672.  242. http://www.columbia.edu/kermit/ckermit70.html#x5.3.1
  17673.  243. http://www.columbia.edu/kermit/ckermit70.html#x5.3.2
  17674.  244. http://www.columbia.edu/kermit/ckermit70.html#x5.4
  17675.  245. http://www.columbia.edu/kermit/ckermit70.html#x5.5
  17676.  246. http://www.columbia.edu/kermit/ckermit70.html#x5.6
  17677.  247. http://www.columbia.edu/kermit/ckermit70.html#x5.7
  17678.  248. http://www.columbia.edu/kermit/ckermit70.html#x6
  17679.  249. http://www.columbia.edu/kermit/ckermit70.html#x6.0
  17680.  250. http://www.columbia.edu/kermit/ckermit70.html#x6.1
  17681.  251. http://www.columbia.edu/kermit/ckermit70.html#x6.2
  17682.  252. http://www.columbia.edu/kermit/ckermit70.html#x6.3
  17683.  253. http://www.columbia.edu/kermit/ckermit70.html#x6.4
  17684.  254. http://www.columbia.edu/kermit/ckermit70.html#x6.5
  17685.  255. http://www.columbia.edu/kermit/ckermit70.html#x6.6
  17686.  256. http://www.columbia.edu/kermit/ckermit70.html#x6.6.1
  17687.  257. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17688.  258. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17689.  259. http://www.columbia.edu/kermit/ckermit70.html#x6.6.3
  17690.  260. http://www.columbia.edu/kermit/ckermit70.html#x6.6.4
  17691.  261. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
  17692.  262. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
  17693.  263. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.2
  17694.  264. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.3
  17695.  265. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
  17696.  266. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.5
  17697.  267. http://www.columbia.edu/kermit/ckermit70.html#x6.7
  17698.  268. http://www.columbia.edu/kermit/ckermit70.html#x7
  17699.  269. http://www.columbia.edu/kermit/ckermit70.html#x7.0
  17700.  270. http://www.columbia.edu/kermit/ckermit70.html#x7.1
  17701.  271. http://www.columbia.edu/kermit/ckermit70.html#x7.1.1
  17702.  272. http://www.columbia.edu/kermit/ckermit70.html#x7.1.2
  17703.  273. http://www.columbia.edu/kermit/ckermit70.html#x7.1.3
  17704.  274. http://www.columbia.edu/kermit/ckermit70.html#x7.1.4
  17705.  275. http://www.columbia.edu/kermit/ckermit70.html#x7.2
  17706.  276. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  17707.  277. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  17708.  278. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17709.  279. http://www.columbia.edu/kermit/ckermit70.html#x7.6
  17710.  280. http://www.columbia.edu/kermit/ckermit70.html#x7.7
  17711.  281. http://www.columbia.edu/kermit/ckermit70.html#x7.8
  17712.  282. http://www.columbia.edu/kermit/ckermit70.html#x7.9
  17713.  283. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
  17714.  284. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
  17715.  285. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  17716.  286. http://www.columbia.edu/kermit/ckermit70.html#x7.10.1
  17717.  287. http://www.columbia.edu/kermit/ckermit70.html#x7.10.2
  17718.  288. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
  17719.  289. http://www.columbia.edu/kermit/ckermit70.html#x7.10.4
  17720.  290. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  17721.  291. http://www.columbia.edu/kermit/ckermit70.html#x7.10.6
  17722.  292. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  17723.  293. http://www.columbia.edu/kermit/ckermit70.html#x7.10.8
  17724.  294. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
  17725.  295. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
  17726.  296. http://www.columbia.edu/kermit/ckermit70.html#x7.11
  17727.  297. http://www.columbia.edu/kermit/ckermit70.html#x7.12
  17728.  298. http://www.columbia.edu/kermit/ckermit70.html#x7.13
  17729.  299. http://www.columbia.edu/kermit/ckermit70.html#x7.14
  17730.  300. http://www.columbia.edu/kermit/ckermit70.html#x7.15
  17731.  301. http://www.columbia.edu/kermit/ckermit70.html#x7.16
  17732.  302. http://www.columbia.edu/kermit/ckermit70.html#x7.17
  17733.  303. http://www.columbia.edu/kermit/ckermit70.html#x7.18
  17734.  304. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  17735.  305. http://www.columbia.edu/kermit/ckermit70.html#x7.20
  17736.  306. http://www.columbia.edu/kermit/ckermit70.html#x7.20.1
  17737.  307. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
  17738.  308. http://www.columbia.edu/kermit/ckermit70.html#x7.21
  17739.  309. http://www.columbia.edu/kermit/ckermit70.html#x7.22
  17740.  310. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  17741.  311. http://www.columbia.edu/kermit/ckermit70.html#x7.24
  17742.  312. http://www.columbia.edu/kermit/ckermit70.html#x7.25
  17743.  313. http://www.columbia.edu/kermit/ckermit70.html#x7.26
  17744.  314. http://www.columbia.edu/kermit/ckermit70.html#x7.26.1
  17745.  315. http://www.columbia.edu/kermit/ckermit70.html#x7.26.2
  17746.  316. http://www.columbia.edu/kermit/ckermit70.html#x7.27
  17747.  317. http://www.columbia.edu/kermit/ckermit70.html#x8
  17748.  318. http://www.columbia.edu/kermit/ckermit70.html#x9
  17749.  319. http://www.columbia.edu/kermit/ckermit70.html#x9.0
  17750.  320. http://www.columbia.edu/kermit/ckermit70.html#x9.1
  17751.  321. http://www.columbia.edu/kermit/ckermit70.html#x9.2
  17752.  322. http://www.columbia.edu/kermit/ckermit70.html#x9.3
  17753.  323. http://www.columbia.edu/kermit/ckermit70.html#x10
  17754.  324. http://www.columbia.edu/kermit/ckermit70.html#xiii
  17755.  325. http://www.columbia.edu/kermit/ckermit70.html#aiii.1
  17756.  326. http://www.columbia.edu/kermit/ckermit70.html#aiii.1.1
  17757.  327. http://www.columbia.edu/kermit/ckermit70.html#aiii.1.2
  17758.  328. http://www.columbia.edu/kermit/ckermit70.html#aiii.1.2.1
  17759.  329. http://www.columbia.edu/kermit/ckermit70.html#aiii.1.2.2
  17760.  330. http://www.columbia.edu/kermit/ckermit70.html#aiii.1.2.3
  17761.  331. http://www.columbia.edu/kermit/ckermit70.html#aiii.2
  17762.  332. http://www.columbia.edu/kermit/ckermit70.html#axiv
  17763.  333. http://www.columbia.edu/kermit/ckermit70.html#axv
  17764.  334. http://www.columbia.edu/kermit/ck60manual.html
  17765.  335. http://www.columbia.edu/kermit/ckbreviews.html
  17766.  336. http://www.bhusa.com/
  17767.  337. http://www.columbia.edu/kermit/manuals.html#ckde
  17768.  338. http://www.columbia.edu/kermit/manuals.html#ktb
  17769.  339. http://www.columbia.edu/kermit/news.html
  17770.  340. news:comp.protocols.kermit.announce
  17771.  341. news:comp.protocols.kermit.misc
  17772.  342. http://www.columbia.edu/kermit/ck60manual.html
  17773.  343. http://www.columbia.edu/kermit/ckermit70.html#x4
  17774.  344. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17775.  345. http://www.columbia.edu/kermit/ckermit70.html#x4.23
  17776.  346. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17777.  347. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17778.  348. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17779.  349. http://www.columbia.edu/kermit/ckermit70.html#x4.9.
  17780.  350. http://www.columbia.edu/kermit/ck60manual.html
  17781.  351. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
  17782.  352. http://www.columbia.edu/kermit/ckermit70.html#x2.15
  17783.  353. http://www.columbia.edu/kermit/ckermit70.html#x9.1
  17784.  354. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17785.  355. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  17786.  356. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17787.  357. http://www.columbia.edu/kermit/ckermit70.html#mjd
  17788.  358. http://www.columbia.edu/kermit/ckermit70.html#mjd
  17789.  359. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17790.  360. http://www.columbia.edu/kermit/ck60manual.html
  17791.  361. http://www.columbia.edu/kermit/ck60manual.html
  17792.  362. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17793.  363. http://www.columbia.edu/kermit/ckermit70.html#x2.12
  17794.  364. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17795.  365. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17796.  366. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
  17797.  367. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17798.  368. http://www.columbia.edu/kermit/ckermit70.html#x7.18
  17799.  369. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  17800.  370. http://www.columbia.edu/kermit/ckermit70.html#x1.15
  17801.  371. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17802.  372. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  17803.  373. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  17804.  374. http://www.columbia.edu/kermit/ckermit70.html#x7.1
  17805.  375. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17806.  376. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  17807.  377. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  17808.  378. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
  17809.  379. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
  17810.  380. http://www.columbia.edu/kermit/ck60manual.html
  17811.  381. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
  17812.  382. http://www.columbia.edu/kermit/ckermit70.html#x7.12
  17813.  383. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
  17814.  384. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17815.  385. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
  17816.  386. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17817.  387. http://www.telefonica.es/cambiodenumeracion/
  17818.  388. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17819.  389. http://www.columbia.edu/kermit/ck60manual.html
  17820.  390. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
  17821.  391. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
  17822.  392. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
  17823.  393. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
  17824.  394. http://www.columbia.edu/kermit/ck60manual.html
  17825.  395. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
  17826.  396. http://www.columbia.edu/kermit/ck60manual.html
  17827.  397. http://www.columbia.edu/kermit/ck60manual.html
  17828.  398. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
  17829.  399. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
  17830.  400. http://www.columbia.edu/kermit/ck60manual.html
  17831.  401. ftp://kermit.columbia.edu/kermit/f/telnet.txt
  17832.  402. http://www.columbia.edu/kermit/telnet.html
  17833.  403. ftp://kermit.columbia.edu/kermit/f/telnet.txt
  17834.  404. http://www.columbia.edu/kermit/telnet.html
  17835.  405. ftp://ftp.isi.edu/in-notes/rfc1572.txt
  17836.  406. ftp://ftp.isi.edu/in-notes/rfc779.txt
  17837.  407. http://www.columbia.edu/kermit/ck60manual.html
  17838.  408. http://www.columbia.edu/kermit/ckermit70.html#x2.10
  17839.  409. http://www.columbia.edu/kermit/ckermit70.html#x2.8
  17840.  410. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17841.  411. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17842.  412. http://www.psy.uq.oz.au/~ftp/Crypto/
  17843.  413. http://www.columbia.edu/kermit/security.html
  17844.  414. http://srp.stanford.edu/srp/
  17845.  415. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1,
  17846.  416. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  17847.  417. http://www.columbia.edu/kermit/security.html
  17848.  418. http://www.columbia.edu/kermit/ck60manual.html
  17849.  419. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17850.  420. http://www.columbia.edu/kermit/ckermit70.html#x2.0
  17851.  421. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
  17852.  422. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17853.  423. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
  17854.  424. http://www.columbia.edu/kermit/iksd.html#x4.2
  17855.  425. http://www.columbia.edu/kermit/iksd.html
  17856.  426. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
  17857.  427. ftp://ftp.isi.edu/in-notes/rfc1945.txt
  17858.  428. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17859.  429. http://www.columbia.edu/kermit/ckermit70.html#x3.2
  17860.  430. http://www.columbia.edu/kermit/ckermit70.html#x3.2
  17861.  431. http://www.columbia.edu/kermit/ck60manual.html
  17862.  432. http://www.columbia.edu/kermit/ck60manual.html
  17863.  433. http://www.columbia.edu/kermit/ckermit70.html#x5.4
  17864.  434. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17865.  435. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17866.  436. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17867.  437. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
  17868.  438. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17869.  439. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17870.  440. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17871.  441. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17872.  442. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
  17873.  443. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  17874.  444. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
  17875.  445. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
  17876.  446. http://www.columbia.edu/kermit/ck60manual.html
  17877.  447. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17878.  448. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17879.  449. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
  17880.  450. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17881.  451. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17882.  452. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17883.  453. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17884.  454. http://www.telstra.com.au/docs/PGP/
  17885.  455. http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
  17886.  456. http://www.columbia.edu/kermit/security.html
  17887.  457. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17888.  458. http://www.columbia.edu/kermit/ck60manual.html
  17889.  459. http://www.columbia.edu/kermit/ckermit70.html#x2.14
  17890.  460. http://www.columbia.edu/kermit/ckermit70.html#x1.23
  17891.  461. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  17892.  462. http://www.columbia.edu/kermit/ck60manual.html
  17893.  463. http://www.columbia.edu/kermit/ck60manual.html
  17894.  464. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17895.  465. http://www.columbia.edu/kermit/ck60manual.html
  17896.  466. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17897.  467. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17898.  468. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
  17899.  469. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17900.  470. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17901.  471. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17902.  472. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17903.  473. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17904.  474. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
  17905.  475. http://www.columbia.edu/kermit/ck60manual.html
  17906.  476. http://www.columbia.edu/kermit/ck60manual.html
  17907.  477. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17908.  478. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17909.  479. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  17910.  480. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
  17911.  481. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17912.  482. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17913.  483. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17914.  484. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17915.  485. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17916.  486. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
  17917.  487. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17918.  488. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17919.  489. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17920.  490. http://www.columbia.edu/kermit/ck60manual.html
  17921.  491. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17922.  492. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17923.  493. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17924.  494. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17925.  495. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17926.  496. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17927.  497. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17928.  498. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17929.  499. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17930.  500. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
  17931.  501. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
  17932.  502. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17933.  503. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17934.  504. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  17935.  505. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17936.  506. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17937.  507. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17938.  508. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  17939.  509. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  17940.  510. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
  17941.  511. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  17942.  512. http://www.columbia.edu/kermit/ck60manual.html
  17943.  513. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17944.  514. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17945.  515. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17946.  516. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17947.  517. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17948.  518. http://www.columbia.edu/kermit/ckermit70.html#x4.18
  17949.  519. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17950.  520. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17951.  521. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17952.  522. http://www.columbia.edu/kermit/ckermit70.html#x4.19
  17953.  523. http://www.columbia.edu/kermit/ckermit70.html#x4.16
  17954.  524. http://www.columbia.edu/kermit/ckermit70.html#x4.19
  17955.  525. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
  17956.  526. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17957.  527. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
  17958.  528. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
  17959.  529. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
  17960.  530. http://www.columbia.edu/kermit/ck60manual.html
  17961.  531. http://www.columbia.edu/kermit/ck60manual.html
  17962.  532. http://www.columbia.edu/kermit/ckermit70.html#x9.3
  17963.  533. http://www.columbia.edu/kermit/ckermit70.html#x5.2.1
  17964.  534. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17965.  535. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
  17966.  536. http://www.columbia.edu/kermit/ckermit70.html#x6.6
  17967.  537. http://www.columbia.edu/kermit/ckermit70.html#xiii
  17968.  538. http://www.columbia.edu/kermit/ckermit70.html#xiii
  17969.  539. ftp://ftp.isi.edu/in-notes/rfc1489.txt
  17970.  540. ftp://ftp.isi.edu/in-notes/rfc2319.txt
  17971.  541. http://www.unicode.org/
  17972.  542. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17973.  543. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
  17974.  544. ftp://ftp.isi.edu/in-notes/rfc2640.txt
  17975.  545. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17976.  546. http://www.columbia.edu/kermit/ckermit70.html#x6.0
  17977.  547. http://www.columbia.edu/kermit/ckermit70.html#x6.5
  17978.  548. http://www.columbia.edu/kermit/ckermit70.html#x6.4
  17979.  549. http://www.columbia.edu/kermit/ck60manual.html
  17980.  550. http://www.columbia.edu/kermit/ckermit70.html#x4.21
  17981.  551. http://www.columbia.edu/kermit/ckermit70.html#x6.5
  17982.  552. http://www.columbia.edu/kermit/ckermit70.html#x2.8
  17983.  553. http://www.columbia.edu/kermit/ckermit70.html#x7.7
  17984.  554. http://www.columbia.edu/kermit/ckermit70.html#x7.2
  17985.  555. http://www.columbia.edu/kermit/ckermit70.html#x1.19
  17986.  556. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17987.  557. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17988.  558. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17989.  559. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17990.  560. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17991.  561. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
  17992.  562. http://www.columbia.edu/kermit/ckermit70.html#x2.10
  17993.  563. http://www.columbia.edu/kermit/ckermit70.html#ferrstring
  17994.  564. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
  17995.  565. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
  17996.  566. http://www.columbia.edu/kermit/ckermit70.html#x9.1
  17997.  567. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  17998.  568. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  17999.  569. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  18000.  570. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  18001.  571. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  18002.  572. http://www.columbia.edu/kermit/ckermit70.html#x7.25
  18003.  573. http://www.columbia.edu/kermit/ckermit70.html#x7.25
  18004.  574. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
  18005.  575. http://www.columbia.edu/kermit/ckermit70.html#x7.12
  18006.  576. http://www.columbia.edu/kermit/ckermit70.html#x7.9
  18007.  577. http://www.columbia.edu/kermit/ck60manual.html
  18008.  578. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  18009.  579. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  18010.  580. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18011.  581. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  18012.  582. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  18013.  583. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
  18014.  584. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
  18015.  585. http://www.columbia.edu/kermit/ckermit70.html#x7.8
  18016.  586. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  18017.  587. http://www.columbia.edu/kermit/ck60manual.html
  18018.  588. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  18019.  589. http://www.columbia.edu/kermit/ckermit70.html#x7.16
  18020.  590. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
  18021.  591. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18022.  592. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  18023.  593. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  18024.  594. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  18025.  595. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  18026.  596. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
  18027.  597. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  18028.  598. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  18029.  599. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  18030.  600. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  18031.  601. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  18032.  602. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
  18033.  603. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  18034.  604. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
  18035.  605. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  18036.  606. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
  18037.  607. http://www.columbia.edu/kermit/ck60manual.html
  18038.  608. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
  18039.  609. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  18040.  610. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  18041.  611. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  18042.  612. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  18043.  613. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  18044.  614. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  18045.  615. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  18046.  616. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18047.  617. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18048.  618. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  18049.  619. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  18050.  620. http://www.columbia.edu/kermit/ckermit70.html#x9.3
  18051.  621. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18052.  622. http://www.columbia.edu/kermit/ck60manual.html
  18053.  623. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  18054.  624. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
  18055.  625. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  18056.  626. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
  18057.  627. http://www.columbia.edu/kermit/ckermit70.html#x1.10
  18058.  628. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  18059.  629. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  18060.  630. http://www.columbia.edu/kermit/iksd.html
  18061.  631. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  18062.  632. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  18063.  633. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  18064.  634. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  18065.  635. http://www.columbia.edu/kermit/gkermit.html
  18066.  636. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  18067.  637. http://www.columbia.edu/kermit/gkermit.html
  18068.  638. http://www.columbia.edu/kermit/ck60manual.html
  18069.  639. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  18070.  640. mailto:kermit@columbia.edu
  18071.  641. http://www.columbia.edu/kermit/ckermit70.html#top
  18072.  642. http://www.columbia.edu/kermit/ckermit.html
  18073.  643. http://www.columbia.edu/kermit/index.html
  18074.