home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / cku206.zip / ckermit70.txt < prev    next >
Text File  |  2002-10-30  |  818KB  |  18,054 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. As of C-Kermit version:  7.0.196
  9. This file last updated:  8 February 2000
  10.  
  11. Authors: Frank da Cruz and Christine M. Gianone
  12. Address: The Kermit Project
  13.          Columbia University
  14.          612 West 115th Street
  15.          New York NY 10025-7799
  16.          USA
  17. Fax:     +1 (212) 662-6442
  18. E-Mail:  [4]kermit-support@columbia.edu
  19. Web:     [5]http://www.columbia.edu/kermit/
  20. Or:      [6]http://www.kermit-project.org/
  21. Or:      [7]http://www.columbia.nyc.ny.us/kermit/
  22.      _________________________________________________________________
  23.    
  24.   NOTICES
  25.   
  26.    This document:
  27.           Copyright ⌐ 1997, 2000, Frank da Cruz and Christine M. Gianone.
  28.           All rights reserved.
  29.           
  30.    Kermit 95:
  31.           Copyright ⌐ 1995, 2000, Trustees of Columbia University in the
  32.           City of New York. All rights reserved.
  33.           
  34.    C-Kermit:
  35.           Copyright ⌐ 1985, 2000,
  36.           Trustees of Columbia University in the City of New York. All
  37.           rights reserved. See the C-Kermit [8]COPYING.TXT file or the
  38.           copyright text in the [9]ckcmai.c module for disclaimer and
  39.           permissions.
  40.           
  41.    When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or SSL
  42.           protocol are included:
  43.           Portions Copyright ⌐ 1990, Massachusetts Institute of
  44.           Technology.
  45.           Portions Copyright ⌐ 1991, 1993 Regents of the University of
  46.           California.
  47.           Portions Copyright ⌐ 1991, 1992, 1993, 1994, 1995 by AT&T.
  48.           Portions Copyright ⌐ 1997, Stanford University.
  49.           Portions Copyright ⌐ 1995-1997, Eric Young
  50.           <eay@cryptosoft.com>.
  51.           
  52.    For the full text of the third-party copyright notices, see
  53.    [10]Appendix V.
  54.      _________________________________________________________________
  55.    
  56.   WHAT IS IN THIS FILE
  57.   
  58.    This file lists changes made to C-Kermit since the second edition of
  59.    the book [11]Using C-Kermit was published and C-Kermit 6.0 was
  60.    released in November 1996. Use this file as a supplement to the second
  61.    edition of Using C-Kermit until the third edition is published some
  62.    time in 2000. If the "most recent update" shown above is long ago,
  63.    contact Columbia University to see if there is a newer release.
  64.    
  65.    For further information, also see the [12]CKCBWR.TXT ("C-Kermit
  66.    beware") file for hints, tips, tricks, restrictions, frequently asked
  67.    questions, etc, plus the system-specific "beware file", e.g.
  68.    [13]CKUBWR.TXT for UNIX, [14]CKVBWR.TXT for VMS, etc, and also any
  69.    system-specific update files such as KERMIT95.HTM for Kermit 95 (in
  70.    the DOCS\MANUAL\ subdirectory of your K95 directory).
  71.    
  72.      This Web-based copy of the C-Kermit 7.0 update notes supersedes the
  73.      plain-text CKERMIT2.TXT file. All changes after 19 January 2000
  74.      appear only here in the Web version. If you need an up-to-date
  75.      plain-text copy, use your Web browser to save this page as plain
  76.      text. 
  77.      _________________________________________________________________
  78.    
  79.   ABOUT FILENAMES
  80.   
  81.    In this document, filenames are generally shown in uppercase, but on
  82.    file systems with case-sensitive names such as UNIX, OS-9, and AOS/VS,
  83.    lowercase names are used: [15]ckubwr.txt, [16]ckermit70.txt, etc.
  84.      _________________________________________________________________
  85.    
  86.   ADDITIONAL FILES
  87.   
  88.    Several other files accompany this new Kermit release:
  89.    
  90.    SECURITY.TXT
  91.           Discussion of Kermit's new authentication and encryption
  92.           features:
  93.           
  94.           + [17]Plain-text version
  95.           + [18]HTML (hypertext) version
  96.             
  97.    IKSD.TXT
  98.           How to install and manage an Internet Kermit Service Daemon.
  99.           
  100.           + [19]Plain-text version
  101.           + [20]HTML (hypertext) version
  102.             
  103.           Also see [21]cuiksd.htm for instructions for use.
  104.           
  105.    TELNET.TXT
  106.           A thorough presentation of Kermit's new advanced Telnet
  107.           features and controls.
  108.           
  109.           + [22]Plain-text version
  110.           + [23]HTML (hypertext) version
  111.      _________________________________________________________________
  112.    
  113.   THE NEW C-KERMIT LICENSE
  114.   
  115.    The C-Kermit license was rewritten for version 7.0 to grant automatic
  116.    permission to packagers of free operating-system distributions to
  117.    include C-Kermit 7.0. Examples include Linux (GNU/Linux), FreeBSD,
  118.    NetBSD, etc. The new license is in the [24]COPYING.TXT file, and is
  119.    also displayed by C-Kermit itself when you give the VERSION or
  120.    COPYRIGHT command. The new C-Kermit license does not apply to
  121.    [25]Kermit 95.
  122.      _________________________________________________________________
  123.    
  124.   ACKNOWLEDGMENTS
  125.   
  126.    Thanks to Jeff Altman, who joined the Kermit Project in 1995, for much
  127.    of what you see in C-Kermit 7.0, especially in the networking and
  128.    security areas, and his key role in designing and implementing the
  129.    Internet Kermit Service Daemon. And special thanks to Lucas Hart for
  130.    lots of help with the VMS version; to Peter Eichhorn for continuous
  131.    testing on the full range of HP-UX versions and for a consolidated set
  132.    of HP-UX makefile targets; and to Colin Allen, Mark Allen, Roger
  133.    Allen, Ric Anderson, William Bader, Mitch Baker, Mitchell Bass, Nelson
  134.    Beebe, Gerry Belanger, Jeff Bernsten, Mark Berryman, John Bigg, Volker
  135.    Borchert, Jonathan Boswell, Tim Boyer, Frederick Bruckman, Kenneth
  136.    Cochran, Jared Crapo, Bill Delaney, Igor Sobrado Delgado, Clarence
  137.    Dold, Joe Doupnik, John Dunlap, Max Evarts, Patrick French, Carl
  138.    Friedberg, Carl Friend, Hirofumi Fujii, Andrew Gabriel, Gabe Garza,
  139.    Boyd Gerber, David Gerber, George Gilmer, Hunter Goatley, DJ Hagberg,
  140.    Kevin Handy, Andy Harper, Randolph Herber, Sven Holstr÷m, Michal
  141.    Jaegermann, Graham Jenkins, Dick Jones, Terry Kennedy, Robert D Keys,
  142.    Nick Kisseberth, Igor Kovalenko, David Lane, Adam Laurie, Jeff
  143.    Liebermann, Eric Lonvick, Hoi Wan Louis, Arthur Marsh, Gregorie
  144.    Martin, Peter Mauzey, Dragan Milicic, Todd Miller, Christian Mondrup,
  145.    Daniel Morato, Dat Nguyen, Herb Peyerl, Jean-Pierre Radley, Steve
  146.    Rance, Stephen Riehm, Nigel Roles, Larry Rosenman, Jay S Rouman, David
  147.    Sanderson, John Santos, Michael Schmitz, Steven Schultz, Bob Shair,
  148.    Richard Shuford, Fred Smith, Michael Sokolov, Jim Spath, Peter Szell,
  149.    Ted T'so, Brian Tillman, Linus Torvalds, Patrick Volkerding, Martin
  150.    VorlΣnder, Steve Walton, Ken Weaverling, John Weekley, Martin
  151.    Whitaker, Jim Whitby, Matt Willman, Joellen Windsor, Farrell Woods,
  152.    and many others for binaries, hosting, reviews, suggestions, advice,
  153.    bug reports, and all the rest over the 3+ year C-Kermit 7.0
  154.    development cycle. Thanks to Russ Nelson and the board of the Open
  155.    Software Initiative ([26]http://www.opensource.org) for their
  156.    cooperation in developing the new C-Kermit license and to the
  157.    proprietors of those free UNIX distributions that have incorporated
  158.    C-Kermit 7.0 for their cooperation and support, especially FreeBSD's
  159.    J÷rg Wunsch.
  160.      _________________________________________________________________
  161.    
  162.   NOTE TO KERMIT 95 USERS
  163.   
  164.    Kermit 95 and C-Kermit share the same command and scripting language,
  165.    the same Kermit file-transfer protocol implementation, and much else
  166.    besides.
  167.    
  168.    Like the book [27]Using C-Kermit, this file concentrates on the
  169.    aspects of C-Kermit that are common to all versions: UNIX, VMS,
  170.    Windows, OS/2, VOS, AOS/VS, etc. Please refer to your Kermit 95
  171.    documentation for information that is specific to Kermit 95.
  172.    
  173.    C-Kermit 7.0 corresponds to Kermit 95 1.1.19.
  174.      _________________________________________________________________
  175.    
  176.   C-KERMIT VERSIONS AND VERSION NUMBERS
  177.   
  178.    "C-Kermit" refers to all the many programs that are compiled in whole
  179.    or in part from common C-language source code, comprising:
  180.    
  181.      * A Kermit file transfer protocol module
  182.      * A command parser and script execution module
  183.      * A modem-dialing module
  184.      * A network support module
  185.      * A character-set translation module.
  186.        
  187.    and several others. These "system-independent" modules are combined
  188.    with system-dependent modules for each platform to provide the
  189.    required input/output functions, and also in some cases overlaid with
  190.    an alternative user interface, such as Macintosh Kermit's
  191.    point-and-click interface, and in some cases also a terminal emulator,
  192.    as Kermit 95.
  193.    
  194.    The C-Kermit version number started as 1.0, ... 3.0, 4.0, 4.1 and then
  195.    (because of confusion at the time with Berkeley UNIX 4.2), 4B, 4C, and
  196.    so on, with the specific edit number in parentheses, for example
  197.    4E(072) or 5A(188). This scheme was used through 5A(191), but now we
  198.    have gone back to the traditional numbering scheme with decimal
  199.    points: major.minor.edit; for example 7.0.196. Internal version
  200.    numbers (the \v(version) variable), however, are compatible in
  201.    C-Kermit 5A upwards.
  202.    
  203.    Meanwhile, C-Kermit derivatives for some platforms (Windows,
  204.    Macintosh) might go through several releases while C-Kermit itself
  205.    remains the same. These versions have their own platform-specific
  206.    version numbers, such as Kermit 95 1.1.1, 1.1.2, and so on.
  207.    
  208.    C-Kermit Version History:
  209.    
  210.   1.0       1981-1982         Command-line only, 4.2 BSD UNIX only
  211.   2.0       (*)               (who remembers...)
  212.   3.0       May 1984          Command-line only, supports several platforms
  213.   4.0-4.1   Feb-Apr 1985 (*)  First interactive and modular version
  214.   4C(050)   May 1985
  215.   4D(060)   April 1986
  216.   4E(066)   August 1987       Long packets
  217.   4E(068)   January 1988
  218.   4E(072)   January 1989
  219.   4F(095)   August 1989 (*)   Attribute packets
  220.   5A(188)   November 1992     Scripting, TCP/IP, sliding windows (1)
  221.   5A(189)   September 1993    Control-char unprefixing
  222.   5A(190)   October 1994      Recovery
  223.   5A(191)   April 1995        OS/2 only
  224.   6.0.192   September 1996    Intelligent dialing, autodownload, lots more (2)
  225.   6.1.193   1997-98 (*)       Development only
  226.   6.1.194   June 1998         K95 only - switches, directory recursion, more
  227.   7.0.195   August 1999       IKSD + more (CU only as K95 1.1.18-CU)
  228.   7.0.196   1 January 2000    Unicode, lots more
  229.  
  230.    (*) Never formally released (4.0 was a total rewrite)
  231.    (1) Using C-Kermit, 1st Edition
  232.    (2) Using C-Kermit, 2nd Edition
  233.      _________________________________________________________________
  234.    
  235. CONTENTS
  236.  
  237.  I.  [28]C-KERMIT DOCUMENTATION
  238.  
  239.  II. [29]NEW FEATURES
  240.  
  241.      (0) [30]INCOMPATIBILITIES WITH PREVIOUS RELEASES
  242.      (1) [31]PROGRAM AND FILE MANAGEMENT AND COMMANDS
  243.          1.0.  [32]Bug fixes
  244.          1.1.  [33]Command Continuation
  245.          1.2.  [34]Editor Interface
  246.          1.3.  [35]Web Browser and FTP Interface
  247.          1.4.  [36]Command Editing
  248.          1.5.  [37]Command Switches
  249.                1.5.1. [38]General Switch Syntax
  250.                1.5.2. [39]Order and Effect of Switches
  251.                1.5.3. [40]Distinguishing Switches from Other Fields
  252.                1.5.4. [41]Standard File Selection Switches
  253.                1.5.5. [42]Setting Preferences for Different Commands
  254.          1.6.  [43]Dates and Times
  255.          1.7.  [44]Partial Completion of Keywords
  256.          1.8.  [45]Command Recall
  257.          1.9.  [46]EXIT Messages
  258.          1.10. [47]Managing Keyboard Interruptions
  259.          1.11. [48]Taming the Wild Backslash -- Part Deux
  260.                1.11.1. [49]Background
  261.                1.11.2. [50]Kermit's Quoting Rules
  262.                1.11.3. [51]Passing DOS Filenames from Kermit to Shell Commands
  263.                1.11.4. [52]Using Variables to Hold DOS Filenames
  264.                1.11.5. [53]Passing DOS Filenames as Parameters to Macros
  265.                1.11.6. [54]Passing DOS File Names from Macro Parameters to the
  266. DOS Shell
  267.                1.11.7. [55]Passing DOS Filenames to Kermit from the Shell
  268.          1.12. [56]Debugging
  269.          1.13. [57]Logs
  270.          1.14. [58]Automatic File-Transfer Packet Recognition at the Command Pr
  271. ompt
  272.          1.15. [59]The TYPE Command
  273.          1.16. [60]The RESET Command
  274.          1.17. [61]The COPY and RENAME Commands
  275.          1.18. [62]The MANUAL Command
  276.          1.19. [63]String and Filename Matching Patterns
  277.          1.20. [64]Multiple Commands on One Line
  278.          1.21. [65]What Do I Have?
  279.          1.22. [66]Generalized File Input and Output
  280.                1.22.1. [67]Why Another I/O System?
  281.                1.22.2. [68]The FILE Command
  282.                1.22.3. [69]FILE Command Examples
  283.                1.22.4. [70]Channel Numbers
  284.                1.22.5. [71]FILE Command Error Codes
  285.                1.22.6. [72]File I/O Variables
  286.                1.22.7. [73]File I/O Functions
  287.                1.22.8. [74]File I/O Function Examples
  288.          1.23. [75]The EXEC Command
  289.          1.24. [76]Getting Keyword Lists with '?'
  290.      (2) [77]MAKING AND USING CONNECTIONS
  291.          2.0. [78]SET LINE and SET HOST Command Switches
  292.          2.1. [79]Dialing
  293.               2.1.1. [80]The Dial Result Message
  294.               2.1.2. [81]Long-Distance Dialing Changes
  295.               2.1.3. [82]Forcing Long-Distance Dialing
  296.               2.1.4. [83]Exchange-Specific Dialing Decisions
  297.               2.1.5. [84]Cautions about Cheapest-First Dialing
  298.               2.1.6. [85]Blind Dialing (Dialing with No Dialtone)
  299.               2.1.7. [86]Trimming the Dialing Dialog
  300.               2.1.8. [87]Controlling the Dialing Speed
  301.               2.1.9. [88]Pretesting Phone Number Conversions
  302.               2.1.10. [89]Greater Control over Partial Dialing
  303.               2.1.11. [90]New DIAL-related Variables and Functions
  304.               2.1.12. [91]Increased Flexibility of PBX Dialing
  305.               2.1.13. [92]The DIAL macro - Last-Minute Phone Number Conversions
  306.               2.1.14. [93]Automatic Tone/Pulse Dialing Selection
  307.               2.1.15. [94]Dial-Modifier Variables
  308.               2.1.16. [95]Giving Multiple Numbers to the DIAL Command
  309.          2.2. [96]Modems
  310.               2.2.1. [97]New Modem Types
  311.               2.2.2. [98]New Modem Controls
  312.          2.3. [99]TELNET and RLOGIN
  313.               2.3.0. [100]Bug Fixes
  314.               2.3.1. [101]Telnet Binary Mode Bug Adjustments
  315.               2.3.2. [102]VMS UCX Telnet Port Bug Adjustment
  316.               2.3.3. [103]Telnet New Environment Option
  317.               2.3.4. [104]Telnet Location Option
  318.               2.3.5. [105]Connecting to Raw TCP Sockets
  319.               2.3.6. [106]Incoming TCP Connections
  320.          2.4. [107]The EIGHTBIT Command
  321.          2.5. [108]The Services Directory
  322.          2.6. [109]Closing Connections
  323.          2.7. [110]Using C-Kermit with External Communication Programs
  324.               2.7.0. [111]C-Kermit over tn3270 and tn5250
  325.               2.7.1. [112]C-Kermit over Telnet
  326.               2.7.2. [113]C-Kermit over Rlogin
  327.               2.7.3. [114]C-Kermit over Serial Communication Programs
  328.               2.7.4. [115]C-Kermit over Secure Network Clients
  329.               2.7.4.1. [116]SSH
  330.               2.7.4.2. [117]SSL
  331.               2.7.4.3. [118]SRP
  332.               2.7.4.4. [119]SOCKS
  333.               2.7.4.5. [120]Kerberos and SRP
  334.          2.8. [121]Scripting Local Programs
  335.          2.9. [122]X.25 Networking
  336.               2.9.1. [123]IBM AIXLink/X.25 Network Provider Interface for AIX
  337.               2.9.2. [124]HP-UX X.25
  338.          2.10. [125]Additional Serial Port Controls
  339.          2.11. [126]Getting Access to the Dialout Device
  340.          2.12. [127]The Connection Log
  341.          2.13. [128]Automatic Connection-Specific Flow Control Selection
  342.          2.14. [129]Trapping Connection Establishment and Loss
  343.          2.15. [130]Contacting Web Servers with the HTTP Command
  344.      (3) [131]TERMINAL CONNECTION
  345.          3.1. [132]CONNECT Command Switches
  346.          3.2. [133]Triggers
  347.          3.3. [134]Transparent Printing
  348.          3.4. [135]Binary and Text Session Logs
  349.      (4) [136]FILE TRANSFER AND MANAGEMENT
  350.          4.0. [137]Bug Fixes, Minor Changes, and Clarifications
  351.          4.1. [138]File-Transfer Filename Templates
  352.          4.1.1. [139]Templates in the As-Name
  353.          4.1.2. [140]Templates on the Command Line
  354.          4.1.3. [141]Post-Transfer Renaming
  355.          4.2. [142]File-Transfer Pipes and Filters
  356.          4.2.1. [143]Introduction
  357.          4.2.1.1. [144]Terminology
  358.          4.2.1.2. [145]Notation
  359.          4.2.1.3. [146]Security
  360.          4.2.2. [147]Commands for Transferring from and to Pipes
  361.          4.2.2.1. [148]Sending from a Command
  362.          4.2.2.2. [149]Receiving to a Command
  363.          4.2.3. [150]Using File-Transfer Filters
  364.          4.2.3.1. [151]The SEND Filter
  365.          4.2.3.2. [152]The RECEIVE Filter
  366.          4.2.4. [153]Implicit Use of Pipes
  367.          4.2.5. [154]Success and Failure of Piped Commands
  368.          4.2.6. [155]Cautions about Using Pipes to Transfer Directory Trees
  369.          4.2.7. [156]Pipes and Encryption
  370.          4.2.8. [157]Commands and Functions Related to Pipes
  371.          4.2.8.1. [158]The OPEN !READ and OPEN !WRITE Commands
  372.          4.2.8.2. [159]The REDIRECT Command
  373.          4.2.8.3. [160]Receiving Mail and Print Jobs
  374.          4.2.8.4. [161]Pipe-Related Functions
  375.          4.3. [162]Automatic Per-File Text/Binary Mode Switching
  376.          4.3.1. [163]Exceptions
  377.          4.3.2. [164]Overview
  378.          4.3.3. [165]Commands
  379.          4.3.4. [166]Examples
  380.          4.4. [167]File Permissions
  381.          4.4.1. [168]When ATTRIBUTES PROTECTION is OFF
  382.          4.4.1.1. [169]Unix
  383.          4.4.1.2. [170]VMS
  384.          4.4.2. [171]When ATTRIBUTES PROTECTION is ON
  385.          4.4.2.1. [172]System-Specific Permissions
  386.          4.4.2.1.1. [173]UNIX
  387.          4.4.2.1.2. [174]VMS
  388.          4.4.2.2. [175]System-Independent Permissions
  389.          4.5. [176]File Management Commands
  390.          4.5.1. [177]The DIRECTORY Command
  391.          4.5.2. [178]The CD and BACK Commands
  392.          4.5.2.1. [179]Parsing Improvements
  393.          4.5.2.2. [180]The CDPATH
  394.          4.5.3. [181]Creating and Removing Directories
  395.          4.5.4. [182]The DELETE and PURGE Commands
  396.          4.6. [183]Starting the Remote Kermit Server Automatically
  397.          4.7. [184]File-Transfer Command Switches
  398.          4.7.1. [185]SEND Command Switches
  399.          4.7.2. [186]GET Command Switches
  400.          4.7.3. [187]RECEIVE Command Switches
  401.          4.8. [188]Minor Kermit Protocol Improvements
  402.          4.8.1. [189]Multiple Attribute Packets
  403.          4.8.2. [190]Very Short Packets
  404.          4.9. [191]Wildcard / File Group Expansion
  405.          4.9.1. [192]In UNIX C-Kermit
  406.          4.9.2. [193]In Kermit 95
  407.          4.9.3. [194]In VMS, AOS/VS, OS-9, VOS, etc.
  408.          4.10. [195]Additional Pathname Controls
  409.          4.11. [196]Recursive SEND and GET: Transferring Directory Trees
  410.          4.11.1. [197]Command-Line Options
  411.          4.11.2. [198]The SEND /RECURSIVE Command
  412.          4.11.3. [199]The GET /RECURSIVE Command
  413.          4.11.4. [200]New and Changed File Functions
  414.          4.11.5. [201]Moving Directory Trees Between Like Systems
  415.          4.11.6. [202]Moving Directory Trees Between Unlike Systems
  416.          4.12. [203]Where Did My File Go?
  417.          4.13. [204]File Output Buffer Control
  418.          4.14. [205]Improved Responsiveness
  419.          4.15. [206]Doubling and Ignoring Characters for Transparency
  420.          4.16. [207]New File-Transfer Display Formats
  421.          4.17. [208]New Transaction Log Formats
  422.          4.17.1. [209]The BRIEF Format
  423.          4.17.2. [210]The FTP Format
  424.          4.18. [211]Unprefixing NUL
  425.          4.19. [212]Clear-Channel Protocol
  426.          4.20. [213]Streaming Protocol
  427.          4.20.1. [214]Commands for Streaming
  428.          4.20.2. [215]Examples of Streaming
  429.          4.20.2.1. [216]Streaming on Socket-to-Socket Connections
  430.          4.20.2.2. [217]Streaming on Telnet Connections
  431.          4.20.2.3. [218]Streaming with Limited Packet Length
  432.          4.20.2.4. [219]Streaming on Dialup Connections
  433.          4.20.2.5. [220]Streaming on X.25 Connections
  434.          4.20.3. [221]Streaming - Preliminary Conclusions
  435.          4.21. [222]The TRANSMIT Command
  436.          4.22. [223]Coping with Faulty Kermit Implementations
  437.          4.22.1. [224]Failure to Accept Modern Negotiation Strings
  438.          4.22.2. [225]Failure to Negotiate 8th-bit Prefixing
  439.          4.22.3. [226]Corrupt Files
  440.          4.22.4. [227]Spurious Cancellations
  441.          4.22.5. [228]Spurious Refusals
  442.          4.22.6. [229]Failures during the Data Transfer Phase
  443.          4.22.7. [230]Fractured Filenames
  444.          4.22.8. [231]Bad File Dates
  445.          4.23. [232]File Transfer Recovery
  446.          4.24. [233]FILE COLLISION UPDATE Clarification
  447.          4.25. [234]Autodownload Improvements
  448.      (5) [235]CLIENT/SERVER
  449.          5.0. [236]Hints
  450.          5.1. [237]New Command-Line Options
  451.          5.2. [238]New Client Commands
  452.          5.3. [239]New Server Capabilities
  453.          5.3.1. [240]Creating and Removing Directories
  454.          5.3.2. [241]Directory Listings
  455.          5.4. [242]Syntax for Remote Filenames with Embedded Spaces
  456.          5.5. [243]Automatic Orientation Messages upon Directory Change
  457.          5.6. [244]New Server Controls
  458.          5.7. [245]Timeouts during REMOTE HOST Command Execution
  459.      (6) [246]INTERNATIONAL CHARACTER SETS
  460.          6.0. [247]ISO 8859-15 Latin Alphabet 9
  461.          6.1. [248]The HP-Roman8 Character Set
  462.          6.2. [249]Greek Character Sets
  463.          6.3. [250]Additional Latin-2 Character Sets
  464.          6.4. [251]Additional Cyrillic Character Sets
  465.          6.5. [252]Automatic Character-Set Switching
  466.          6.6. [253]Unicode
  467.          6.6.1. [254]Overview of Unicode
  468.          6.6.2. [255]UCS Byte Order
  469.          6.6.2. [256]UCS Transformation Formats
  470.          6.6.3. [257]Conformance Levels
  471.          6.6.4. [258]Relationship of Unicode with Kermit's Other Character Sets
  472.          6.6.5. [259]Kermit's Unicode Features
  473.          6.6.5.1. [260]File Transfer
  474.          6.6.5.2. [261]The TRANSLATE Command
  475.          6.6.5.3. [262]Terminal Connection
  476.          6.6.5.4. [263]The TRANSMIT Command
  477.          6.6.5.5. [264]Summary of Kermit Unicode Commands
  478.          6.7. [265]Client/Server Character-Set Switching
  479.      (7) [266]SCRIPT PROGRAMMING
  480.          7.0. [267]Bug Fixes
  481.          7.1. [268]The INPUT Command
  482.          7.1.1. [269]INPUT Timeouts
  483.          7.1.2. [270]New INPUT Controls
  484.          7.1.3. [271]INPUT with Pattern Matching
  485.          7.1.4. [272]The INPUT Match Result
  486.          7.2. [273]New or Improved Built-In Variables
  487.          7.3. [274]New or Improved Built-In Functions
  488.          7.4. [275]New IF Conditions
  489.          7.5. [276]Using More than Ten Macro Arguments
  490.          7.6. [277]Clarification of Function Call Syntax
  491.          7.7. [278]Autodownload during INPUT Command Execution
  492.          7.8. [279]Built-in Help for Functions.
  493.          7.9. [280]Variable Assignments
  494.          7.9.1. [281]Assignment Operators
  495.          7.9.2. [282]New Assignment Commands
  496.          7.10. [283]Arrays
  497.          7.10.1. [284]Array Initializers
  498.          7.10.2. [285]Turning a String into an Array of Words
  499.          7.10.3. [286]Arrays of Filenames
  500.          7.10.4. [287]Automatic Arrays
  501.          7.10.5. [288]Sorting Arrays
  502.          7.10.6. [289]Displaying Arrays
  503.          7.10.7. [290]Other Array Operations
  504.          7.10.8. [291]Hints for Using Arrays
  505.          7.10.9. [292]Do-It-Yourself Arrays
  506.          7.10.10. [293]Associative Arrays
  507.          7.11. [294]OUTPUT Command Improvements
  508.          7.12. [295]Function and Variable Diagnostics
  509.          7.13. [296]Return Value of Macros
  510.          7.14. [297]The ASSERT, FAIL, and SUCCEED Commands.
  511.          7.15. [298]Using Alarms
  512.          7.16. [299]Passing Arguments to Command Files
  513.          7.17. [300]Dialogs with Timed Responses
  514.          7.18. [301]Increased Flexibility of SWITCH Case Labels
  515.          7.19. "[302]Kerbang" Scripts
  516.          7.20. [303]IF and XIF Statement Syntax
  517.          7.20.1. [304]The IF/XIF Distinction
  518.          7.20.2. [305]Boolean Expressions (The IF/WHILE Condition)
  519.          7.21. [306]Screen Formatting and Cursor Control
  520.          7.22. [307]Evaluating Arithmetic Expressions
  521.          7.23. [308]Floating-Point Arithmetic
  522.          7.24. [309]Tracing Script Execution
  523.          7.25. [310]Compact Substring Notation
  524.          7.26. [311]New WAIT Command Options
  525.          7.26.1. [312]Waiting for Modem Signals
  526.          7.26.2. [313]Waiting for File Events
  527.          7.27. [314]Relaxed FOR and SWITCH Syntax
  528.      (8) [315]USING OTHER FILE TRANSFER PROTOCOLS
  529.      (9) [316]COMMAND-LINE OPTIONS
  530.          9.0. [317]Extended-Format Command-Line Options
  531.          9.1. [318]Command Line Personalities
  532.          9.2. [319]Built-in Help for Command Line Options
  533.          9.3. [320]New Command-Line Options
  534.     (10) [321]C-KERMIT AND G-KERMIT
  535.  
  536. III. [322]APPENDICES
  537.  
  538. III.1. [323]Character Set Tables
  539. III.1.1. [324]The Hewlett Packard Roman8 Character Set
  540. III.1.2. [325]Greek Character Sets
  541. III.1.2.1. [326]The ISO 8859-7 Latin / Greek Alphabet
  542. III.1.2.2. [327]The ELOT 927 Character Set
  543. III.1.2.3. [328]PC Code Page 869
  544. III.2. [329]Updated Country Codes
  545.  
  546. IV. [330]ERRATA & CORRIGENDA: Corrections to "Using C-Kermit" 2nd Edition.
  547. V. [331]ADDITIONAL COPYRIGHT NOTICES
  548.      _________________________________________________________________
  549.    
  550. I. C-KERMIT DOCUMENTATION
  551.  
  552.    The user manual for C-Kermit is:
  553.    
  554.      Frank da Cruz and Christine M. Gianone, [332]Using C-Kermit, Second
  555.      Edition, Digital Press / Butterworth-Heinemann, Woburn, MA, 1997,
  556.      622 pages, ISBN 1-55558-164-1.
  557.      
  558.    [333]CLICK HERE for reviews.
  559.    
  560.    The present document is a supplement to Using C-Kermit 2nd Ed, not a
  561.    replacement for it.
  562.    
  563.    US single-copy price: $49.95; quantity discounts available. Available
  564.    in bookstores or directly from Columbia University:
  565.    
  566.   The Kermit Project
  567.   Columbia University
  568.   612 West 115th Street
  569.   New York NY  10025-7799
  570.   USA
  571.   Telephone: +1 (212) 854-3703
  572.   Fax:       +1 (212) 663-8202
  573.  
  574.    Domestic and overseas orders accepted. Price: US $44.95 (US, Canada,
  575.    and Mexico). Shipping: $4.00 within the USA; $15.00 to all other
  576.    countries. Orders may be paid by MasterCard or Visa, or prepaid by
  577.    check in US dollars. Add $65 bank fee for checks not drawn on a US
  578.    bank. Do not include sales tax. Inquire about quantity discounts.
  579.    
  580.    You can also order by phone from the publisher, Digital Press /
  581.    [334]Butterworth-Heinemann, with MasterCard, Visa, or American
  582.    Express:
  583.    
  584.   +1 800 366-2665   (Woburn, Massachusetts office for USA & Canada)
  585.   +44 1865 314627   (Oxford, England distribution centre for UK & Europe)
  586.   +61 03 9245 7111  (Melbourne, Vic, office for Australia & NZ)
  587.   +65 356-1968      (Singapore office for Asia)
  588.   +27 (31) 2683111  (Durban office for South Africa)
  589.  
  590.    A [335]German-language edition of the First Edition is also available:
  591.    
  592.      Frank da Cruz and Christine M. Gianone, C-Kermit - Einfⁿhrung und
  593.      Referenz, Verlag Heinz Heise, Hannover, Germany (1994). ISBN
  594.      3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 88,00.
  595.      Verlag Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625
  596.      Hannover. Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 52-1 29.
  597.      
  598.    The [336]Kermit file transfer protocol is specified in:
  599.    
  600.      Frank da Cruz, Kermit, A File Transfer Protocol, Digital Press,
  601.      Bedford, MA, 1987, 379 pages, ISBN 0-932376-88-6. US single-copy
  602.      price: $39.95. Availability as above.
  603.      
  604.    News and articles about Kermit software and protocol are published
  605.    periodically in the journal, [337]Kermit News. Subscriptions are free;
  606.    contact Columbia University at the address above.
  607.    
  608.    Online news about Kermit is published in the
  609.    [338]comp.protocols.kermit.announce and
  610.    [339]comp.protocols.kermit.misc newsgroups.
  611.      _________________________________________________________________
  612.    
  613. II. NEW FEATURES
  614.  
  615.    Support for the Bell Labs Plan 9 operating system was added to version
  616.    6.0 too late to be mentioned in the book (although it does appear on
  617.    the cover).
  618.    
  619.    Specific changes and additions are grouped together by major topic,
  620.    roughly corresponding to the chapters of [340]Using C-Kermit.
  621.      _________________________________________________________________
  622.    
  623.   0. INCOMPATIBILITIES WITH PREVIOUS RELEASES
  624.   
  625.     1. C-Kermit 7.0 uses FAST Kermit protocol settings by default. This
  626.        includes "unprefixing" of certain control characters. Because of
  627.        this, file transfers that worked with previous releases might not
  628.        work in the new release (but it is more likely that they will
  629.        work, and much faster). If a transfer fails, you'll get a
  630.        context-sensitive hint suggesting possible causes and cures.
  631.        Usually SET PREFIXING ALL does the trick.
  632.     2. C-Kermit 7.0 transfers files in BINARY mode by default. To restore
  633.        the previous behavior, put SET FILE TYPE TEXT in your C-Kermit
  634.        initialization file.
  635.     3. No matter whether FILE TYPE is BINARY or TEXT by default, C-Kermit
  636.        7.0 now switches between text and binary mode automatically on a
  637.        per-file basis according to various criteria, including (a) which
  638.        kind of platform is on the other end of the connection (if known),
  639.        (b) the version of Kermit on the other end, and (c) the file's
  640.        name (see [341]Section 4, especially [342]4.3). To disable this
  641.        automatic switching and restore the earlier behavior, put SET
  642.        TRANSFER MODE MANUAL in your C-Kermit initialization file. To
  643.        disable automatic switching for a particular transfer, include a
  644.        /TEXT or /BINARY switch with your SEND or GET command.
  645.     4. The RESEND and REGET commands automatically switch to binary mode;
  646.        previously if RESEND or REGET were attempted when FILE TYPE was
  647.        TEXT, these commands would fail immediately, with a message
  648.        telling you they work only when the FILE TYPE is BINARY. Now they
  649.        simply do this for you. See [343]Section 4.23 for additional
  650.        (important) information.
  651.     5. SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10
  652.        and 138) in case rlogin, ssh, or cu are "in the middle", since
  653.        otherwise <LF>~ might appear in Kermit packets, and this would
  654.        cause rlogin, ssh, or cu to disconnect, suspend,escape back, or
  655.        otherwise wreck the file transfer. Xon and Xoff are now always
  656.        prefixed too, even when Xon/Xoff flow control is not in effect,
  657.        since unprefixing them has proven dangerous on TCP/IP connections.
  658.     6. In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built
  659.        into C-Kermit itself rather than implemented by running an
  660.        external command or program. The built-in command might not behave
  661.        the way the platform-specific external one did, but many options
  662.        are available for customization. Of course the underlying
  663.        platform-specific command can still be accessed with "!", "@", or
  664.        "RUN" wherever the installation does not forbid. In UNIX, the "ls"
  665.        command can be accessed directly as "ls" in C-Kermit. See
  666.        [344]Section 4.5.1 for details.
  667.     7. SEND ? prints a list of switches rather than a list of filenames.
  668.        If you want to see a list of filenames, use a (system-dependent)
  669.        construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND
  670.        []? (VMS), etc. See [345]Sections 1.5 and [346]4.7.1.
  671.     8. In UNIX, OS-9, and Kermit 95, the wildcard characters in previous
  672.        versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and
  673.        }, with dash used inside []'s to denote ranges and comma used
  674.        inside {} to separate list elements. If you need to include any of
  675.        these characters literally in a filename, precede each one with
  676.        backslash (\). See [347]Section 4.9.
  677.     9. SET QUIET { ON, OFF } is now on the command stack, just like SET
  678.        INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458
  679.        of [348]Using C-Kermit, 2nd Edition. This allows any macro or
  680.        command file to SET QUIET ON or OFF without worrying about saving
  681.        and restoring the global QUIET value. For example, this lets you
  682.        write a script that tries SET LINE on lots of devices until it
  683.        finds one free without spewing out loads of error messages, and
  684.        also without disturbing the global QUIET setting, whatever it was.
  685.    10. Because of the new "." operator (which introduces assignments),
  686.        macros whose names begin with "." can not be invoked "by name".
  687.        However, they still can be invoked with DO.
  688.    11. The syntax of the EVALUATE command has changed. See [349]Section
  689.        7.9.2. To restore the previous syntax, use SET EVALUATE OLD.
  690.    12. The \v(directory) variable now includes the trailing directory
  691.        separator; in previous releases it did not. This is to allow
  692.        constructions such as:
  693.  
  694.   cd \v(dir)data.tmp
  695.        to work across platforms that might have different directory
  696.        notation, such as UNIX, Windows, and VMS.
  697.    13. Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and
  698.        sticky. In C-Kermit 7.0, there is an array of default flow-control
  699.        values for each kind of connection, that are applied automatically
  700.        at SET LINE/PORT/HOST time. Thus a SET FLOW command given before
  701.        SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can
  702.        be guaranteed to have the desired effect only if given after the
  703.        SET LINE/PORT/HOST command.
  704.    14. Character-set translation works differently in the TRANSMIT
  705.        command when (a) the file character-set is not the same as the
  706.        local end of the terminal character-set, or (b) when the terminal
  707.        character-set is TRANSPARENT.
  708.      _________________________________________________________________
  709.    
  710.   1. PROGRAM AND FILE MANAGEMENT AND COMMANDS
  711.   
  712.   1.0. Bug Fixes
  713.   
  714.    The following patches were issued to correct bugs in C-Kermit 6.0.
  715.    These are described in detail in the 6.0 PATCHES file. All of these
  716.    fixes have been incorporated in C-Kermit 6.1 (never released except as
  717.    K95 1.1.16-17) and 7.0.
  718.    
  719.  0001   All UNIX         C-Kermit mishandles timestamps on files before 1970
  720.  0002   Solaris 2.5++    Compilation error on Solaris 2.5 with Pro C
  721.  0003   All VMS          CKERMIT.INI Fix for VMS
  722.  0004   VMS/VAX/UCX 2.0  C-Kermit 6.0 can't TELNET on VAX/VMS with UCX 2.0
  723.  0005   All              C-Kermit Might Send Packets Outside Window
  724.  0006   All              MOVE from SEND-LIST does not delete original files
  725.  0007   Solaris 2.5++    Higher serial speeds on Solaris 2.5
  726.  0008   All              C-Kermit application file name can't contain spaces
  727.  0009   AT&T 7300 UNIXPC setuid and hardware flow-control problems
  728.  0010   Linux on Alpha   Patch to make ckutio.c compile on Linux/Alpha
  729.  0011   OS-9/68000 2.4   Patch to make ck9con.c compile on OS-9/68000 2.4
  730.  0012   MW Coherent 4.2  Patches for successful build on Coherent 4.2
  731.  0013   SINIX-Y 5.43     "delay" variable conflicts with <sys/clock.h>
  732.  0014   VMS/VAX/CMU-IP   Subject: Patches for VAX/VMS 5.x + CMU-IP
  733.  0015   All              XECHO doesn't flush its output
  734.  0016   VMS              CD and other directory operations might not work
  735.  0017   Linux 1.2.x++    Use standard POSIX interface for high serial speeds
  736.  0018   UNIX             SET WILDCARD-EXPANSION SHELL dumps core
  737.  0019   All              Hayes V.34 modem init string problem
  738.  0020   All              READ command does not fail if file not open
  739.  0021   All              Problems with long function arguments
  740.  0022   All              Certain \function()s can misbehave
  741.  0023   All              X MOD 0 crashes program
  742.  0024   All              Internal bulletproofing for lower() function
  743.  0025   OpenBSD          Real OpenBSD support for C-Kermit 6.0
  744.  0026   All              Incorrect checks for macro/command-file nesting depth
  745.  0027   All              ANSWER doesn't automatically CONNECT
  746.  0028   All              Overzealous EXIT warning
  747.  0029   All              OUTPUT doesn't echo when DUPLEX is HALF
  748.  0030   All              Minor problems with REMOTE DIRECTORY/DELETE/etc
  749.  0031   All              CHECK command broken
  750.  0032   All              Problem with SET TRANSMIT ECHO
  751.  0033   UNIX, VMS, etc   HELP SET SERVER says too much
  752.  0034   All              READ and !READ too picky about line terminators
  753.  0035   All              END from inside SWITCH doesn't work
  754.  0036   All              Problem telnetting to multihomed hosts
  755.  0037   All              Redirection failures in REMOTE xxx > file
  756.  
  757.    REDIRECT was missing in many UNIX C-Kermit implementations; in version
  758.    7.0, it should be available in all of them.
  759.      _________________________________________________________________
  760.    
  761.   1.1. Command Continuation
  762.   
  763.    Comments that start with ";" or "#" can no longer be continued. In:
  764.    
  765.   ; this is a comment -
  766.   echo blah
  767.  
  768.    the ECHO command will execute, rather than being taken as a
  769.    continuation of the preceding comment line. This allows easy
  770.    "commenting out" of commands from macro definitions.
  771.    
  772.    However, the text of the COMMENT command can still be continued onto
  773.    subsequent lines:
  774.    
  775.   comment this is a comment -
  776.   echo blah
  777.  
  778.    As of version 6.0, backslash is no longer a valid continuation
  779.    character. Only hyphen should be used for command continuation. This
  780.    is to make it possible to issue commands like "cd a:\" on DOS-like
  781.    systems.
  782.    
  783.    As of version 7.0:
  784.    
  785.      * You can quote a final dash to prevent it from being a continuation
  786.        character:
  787.  
  788.   echo foo\-
  789.        This prints "foo-". The command is not continued.
  790.      * You can enter commands such as:
  791.  
  792.   echo foo - ; this is a comment
  793.        interactively and they are properly treated as continued commands.
  794.        Previously this worked only in command files.
  795.      _________________________________________________________________
  796.    
  797.   1.2. Editor Interface
  798.   
  799.    SET EDITOR name [ options ]
  800.           Lets you specify a text-editing program. The name can be a
  801.           fully specified pathname like /usr/local/bin/emacs19/emacs, or
  802.           it can be the name of any program in your PATH, e.g. "set
  803.           editor emacs". In VMS, it must be a DCL command like "edit",
  804.           "edit/tpu", "emacs", etc. If an environment variable EDITOR is
  805.           defined when Kermit starts, its value is the default editor.
  806.           You can also specify options to be included on the editor
  807.           command line. Returns to Kermit when the editor exits.
  808.           
  809.    EDIT [ filename ]
  810.           If the EDIT command is given without a filename, then if a
  811.           previous filename had been given to an EDIT command, it is
  812.           used; if not, the editor is started without a file. If a
  813.           filename is given, the editor is started on that file, and the
  814.           filename is remembered for subsequent EDIT commands.
  815.           
  816.    SHOW EDITOR
  817.           Displays the full pathname of your text editor, if any, along
  818.           with any command line options, and the file most recently
  819.           edited (and therefore the default filename for your next EDIT
  820.           command).
  821.           
  822.    Related variables: \v(editor), \v(editopts), \v(editfile).
  823.      _________________________________________________________________
  824.    
  825.   1.3. Web Browser and FTP Interface
  826.   
  827.    C-Kermit includes an FTP command, which simply runs the FTP program;
  828.    C-Kermit does not include any built-in support for Internet File
  829.    Transfer Protocol, nor any method for interacting directly with an FTP
  830.    server. In version 7.0, however, C-Kermit lets you specify your FTP
  831.    client:
  832.    
  833.    SET FTP-CLIENT [ name [ options ] ]
  834.           The name is the name of the FTP executable. In UNIX, Windows,
  835.           or OS/2, it can be the filename of any executable program in
  836.           your PATH (e.g. "ftp.exe" in Windows, "ftp" in UNIX); elsewhere
  837.           (or if you do not have a PATH definition), it must be the fully
  838.           specified pathname of the FTP program. If the name contains any
  839.           spaces, enclose it braces. Include any options after the
  840.           filename; these depend the particular ftp client.
  841.           
  842.    The Web browser interface is covered in the following subsections.
  843.      _________________________________________________________________
  844.    
  845.     1.3.1. Invoking your Browser from C-Kermit
  846.     
  847.    BROWSE [ url ]
  848.           Starts your preferred Web browser on the URL, if one is given,
  849.           otherwise on the most recently given URL, if any. Returns to
  850.           Kermit when the browser exits.
  851.           
  852.    SET BROWSER [ name [ options ] ]
  853.           Use this command to specify the name of your Web browser
  854.           program, for example: "set browser lynx". The name must be in
  855.           your PATH, or else it must be a fully specified filename; in
  856.           VMS it must be a DCL command.
  857.           
  858.    SHOW BROWSER
  859.           Displays the current browser, options, and most recent URL.
  860.           
  861.    Related variables: \v(browser), \v(browsopts), \v(browsurl).
  862.    
  863.    Also see [350]Section 2.15: Contacting Web Servers with the HTTP
  864.    Command.
  865.      _________________________________________________________________
  866.    
  867.     1.3.2. Invoking C-Kermit from your Browser
  868.     
  869.    The method for doing this depends, of course, on your browser. Here
  870.    are some examples:
  871.    
  872.    Netscape on UNIX (X-based)
  873.           In the Options->Applications section, set your Telnet
  874.           application to:
  875.           
  876.   xterm -e /usr/local/bin/kermit/kermit -J %h %p
  877.  
  878.           (replace "/usr/local/bin/kermit/kermit" by C-Kermit's actual
  879.           pathname). -J is C-Kermit's command-line option to "be like
  880.           Telnet"; %h and %p are Netscape placeholders for hostname and
  881.           port.
  882.           
  883.    Lynx on UNIX
  884.           As far as we know, this can be done only at compile time. Add
  885.           the following line to the Lynx userdefs.h file before building
  886.           the Lynx binary:
  887.           
  888.   #define TELNET_COMMAND "/opt/bin/kermit -J"
  889.  
  890.           And then add lines like the following to the Lynx.cfg file:
  891.           
  892.   DOWNLOADER:Kermit binary download:/opt/bin/kermit -i -V -s %s -a %s:TRUE
  893.   DOWNLOADER:Kermit text download:/opt/bin/kermit -s %s -a %s:TRUE
  894.  
  895.   UPLOADER:Kermit binary upload:/opt/bin/kermit -i -r -a %s:TRUE
  896.   UPLOADER:Kermit text upload:/opt/bin/kermit -r -a %s:TRUE
  897.   UPLOADER:Kermit text get:/opt/bin/kermit -g %s:TRUE
  898.   UPLOADER:Kermit binary get:/opt/bin/kermit -ig %s:TRUE
  899.  
  900.    But none of the above is necessary if you make C-Kermit your default
  901.    Telnet client, which you can do by making a symlink called 'telnet' to
  902.    the C-Kermit 7.0 binary. See [351]Section 9.1 for details.
  903.      _________________________________________________________________
  904.    
  905.   1.4. Command Editing
  906.   
  907.    Ctrl-W ("Word delete") was changed in 7.0 to delete back to the
  908.    previous non-alphanumeric, rather than all the way back to the
  909.    previous space.
  910.      _________________________________________________________________
  911.    
  912.   1.5. Command Switches
  913.   
  914.    As of version 7.0, C-Kermit's command parser supports a new type of
  915.    field, called a "switch". This is an optional command modifier.
  916.    
  917.     1.5.1. General Switch Syntax
  918.     
  919.    A switch is a keyword beginning with a slash (/). If it takes a value,
  920.    then the value is appended to it (with no intervening spaces),
  921.    separated by a colon (:) or equal sign (=). Depending on the switch,
  922.    the value may be a number, a keyword, a filename, a date/time, etc.
  923.    Examples:
  924.    
  925.   send oofa.txt                              ; No switches
  926.   send /binary oofa.zip                      ; A switch without a value
  927.   send /protocol:zmodem oofa.zip             ; A switch with a value (:)
  928.   send /protocol=zmodem oofa.zip             ; A switch with a value (=)
  929.   send /text /delete /as-name:x.x oofa.txt   ; Several switches
  930.  
  931.    Like other command fields, switches are separated from other fields,
  932.    and from each other, by whitespace, as shown in the examples just
  933.    above. You can not put them together like so:
  934.    
  935.   send/text/delete/as-name:x.x oofa.txt
  936.  
  937.    (as you might do in VMS or DOS, or as we might once have done in
  938.    TOPS-10 or TOPS0-20, or PIP). This is primarily due to ambiguity
  939.    between "/" as switch introducer versus "/" as UNIX directory
  940.    separator; e.g. in:
  941.    
  942.   send /delete/as-name:foo/text oofa.txt
  943.  
  944.    Does "foo/text" mean the filename is "foo" and the transfer is to be
  945.    in text mode, or does it mean the filename is "foo/text"? Therefore we
  946.    require whitespace between switches to resolve the ambiguity. (That's
  947.    only one of several possible ambiguities -- it is also conceivable
  948.    that a file called "text" exists in the path "/delete/as-name:foo/").
  949.    
  950.    In general, if a switch can take a value, but you omit it, then either
  951.    a reasonable default value is supplied, or an error message is
  952.    printed:
  953.    
  954.   send /print:-Plaserwriter oofa.txt         ; Value included = print options
  955.   send /print oofa.txt                       ; Value omitted, OK
  956.   send /mail:kermit@columbia.edu oofa.txt    ; Value included = address
  957.   send /mail oofa.txt                        ; Not OK - address required
  958.   ?Address required
  959.  
  960.    Context-sensitive help (?) and completion (Esc or Tab) are available
  961.    in the normal manner:
  962.    
  963.   C-Kermit> send /pr? Switch, one of the following:
  964.     /print /protocol
  965.   C-Kermit> send /pro<ESC>tocol:?  File-transfer protocol,
  966.    one of the following:
  967.     kermit   xmodem   ymodem   ymodem-g   zmodem
  968.   C-Kermit> send /protocol:k<TAB>ermit
  969.  
  970.    If a switch takes a value and you use completion on it, a colon (:) is
  971.    printed at the end of its name to indicate this. If it does not take a
  972.    value, a space is printed.
  973.    
  974.    Also, if you type ? in a switch field, switches that take values are
  975.    shown with a trailing colon; those that don't take values are shown
  976.    without one.
  977.      _________________________________________________________________
  978.    
  979.     1.5.2. Order and Effect of Switches
  980.     
  981.    The order of switches should not matter, except that they are
  982.    evaluated from left to right, so if you give two switches with
  983.    opposite effects, the rightmost one is used:
  984.    
  985.   send /text /binary oofa.zip                ; Sends oofa.zip in binary mode.
  986.  
  987.    Like other command fields, switches have no effect whatsoever until
  988.    the command is entered (by pressing the Return or Enter key). Even
  989.    then, switches affect only the command with which they are included;
  990.    they do not have global effect or side effects.
  991.      _________________________________________________________________
  992.    
  993.     1.5.3. Distinguishing Switches from Other Fields
  994.     
  995.    All switches are optional. A command that uses switches lets you give
  996.    any number of them, including none at all. Example:
  997.    
  998.   send /binary oofa.zip
  999.   send /bin /delete oofa.zip
  1000.   send /bin /as-name:mupeen.zip oofa.zip
  1001.   send oofa.zip
  1002.  
  1003.    But how does Kermit know when the first "non-switch" is given? It has
  1004.    been told to look for both a switch and for something else, the data
  1005.    type of the next field (filename, number, etc). In most cases, this
  1006.    works well. But conflicts are not impossible. Suppose, for example, in
  1007.    UNIX there was a file named "text" in the top-level directory. The
  1008.    command to send it would be:
  1009.    
  1010.   send /text
  1011.  
  1012.    But C-Kermit would think this was the "/text" switch. To resolve the
  1013.    conflict, use braces:
  1014.    
  1015.   send {/text}
  1016.  
  1017.    or other circumlocutions such as "send //text", "send /./text", etc.
  1018.    
  1019.    The opposite problem can occur if you give an illegal switch that
  1020.    happens to match a directory name. For example:
  1021.    
  1022.   send /f oofa.txt
  1023.  
  1024.    There is no "/f" switch (there are several switches that begin with
  1025.    "/f", so "/f" is ambiguous). Now suppose there is an "f" directory in
  1026.    the root directory; then this command would be interpreted as:
  1027.    
  1028.      Send all the files in the "/f" directory, giving each one an
  1029.      as-name of "oofa.txt".
  1030.      
  1031.    This could be a mistake, or it could be exactly what you intended;
  1032.    C-Kermit has no way of telling the difference. To avoid situations
  1033.    like this, spell switches out in full until you are comfortable enough
  1034.    with them to know the minimum abbreviation for each one. Hint: use ?
  1035.    and completion while typing switches to obtain the necessary feedback.
  1036.      _________________________________________________________________
  1037.    
  1038.     1.5.4. Standard File Selection Switches
  1039.     
  1040.    The following switches are used on different file-oriented commands
  1041.    (such as SEND, DIRECTORY, DELETE, PURGE) to refine the selection of
  1042.    files that match the given specification.
  1043.    
  1044.    /AFTER:date-time
  1045.           Select only those files having a date-time later than the one
  1046.           given. See [352]Section 1.6 for date-time formats. Synonym:
  1047.           /SINCE.
  1048.           
  1049.    /NOT-AFTER:date-time
  1050.           Select only those files having a date-time not later than (i.e.
  1051.           earlier or equal to) the one given. Synonym: /NOT-SINCE.
  1052.           
  1053.    /BEFORE:date-time
  1054.           Select only those files having a date-time earlier than the one
  1055.           given.
  1056.           
  1057.    /NOT-BEFORE:date-time
  1058.           Select only those files having a date-time not earlier than
  1059.           (i.e. later or equal to) the one given.
  1060.           
  1061.    /DOTFILES
  1062.           UNIX and OS-9 only: The filespec is allowed to match files
  1063.           whose names start with (dot) period. Normally these files are
  1064.           not shown.
  1065.           
  1066.    /NODOTFILES
  1067.           (UNIX and OS-9 only) Don't show files whose names start with
  1068.           dot (period). This is the opposite of /DOTFILES, and is the
  1069.           default. Note that when a directory name starts with a period,
  1070.           the directory and (in recursive operations) all its
  1071.           subdirectories are skipped.
  1072.           
  1073.    /LARGER-THAN:number
  1074.           Only select files larger than the given number of bytes.
  1075.           
  1076.    /SMALLER-THAN:number
  1077.           Only select files smaller than the given number of bytes.
  1078.           
  1079.    /EXCEPT:pattern
  1080.           Specifies that any files whose names match the pattern, which
  1081.           can be a regular filename, or may contain "*" and/or "?"
  1082.           metacharacters (wildcards), are not to be selected. Example:
  1083.           
  1084.   send /except:*.log *.*
  1085.  
  1086.           sends all files in the current directory except those with a
  1087.           filetype of ".log". Another:
  1088.           
  1089.   send /except:*.~*~ *.*
  1090.  
  1091.           sends all files except the ones that look like Kermit or EMACS
  1092.           backup files (such as "oofa.txt.~17~") (of course you can also
  1093.           use the /NOBACKUP switch for this).
  1094.           
  1095.           The pattern matcher is the same one used by IF MATCH string
  1096.           pattern ([353]Section 7.4), so you can test your patterns using
  1097.           IF MATCH. If you need to match a literal * or ? (etc), precede
  1098.           it by a backslash (\). If the pattern contains any spaces, it
  1099.           must be enclosed in braces:
  1100.           
  1101.   send /except:{Foo bar} *.*
  1102.  
  1103.           The pattern can also be a list of up to 8 patterns. In this
  1104.           case, the entire pattern must be enclosed in braces, and each
  1105.           sub-pattern must also be enclosed in braces; this eliminates
  1106.           the need for designating a separator character, which is likely
  1107.           to also be a legal filename character on some platform or
  1108.           other, and therefore a source of confusion. You may include
  1109.           spaces between the subpatterns but they are not necessary. The
  1110.           following two commands are equivalent:
  1111.           
  1112.   send /except:{{ck*.o} {ck*.c}} ck*.?
  1113.   send /except:{{ck*.o}{ck*.c}} ck*.?
  1114.  
  1115.           If a pattern is to include a literal brace character, precede
  1116.           it with "\". Also note the apparent conflict of this list
  1117.           format and the string-list format described in [354]Section
  1118.           4.9.1. In case you want to include a wildcard string-list with
  1119.           braces on its outer ends as an /EXCEPT: argument, do it like
  1120.           this:
  1121.           
  1122.   send /except:{{{ckuusr.c,ckuus2.c,ckuus6.c}}} ckuus*.c
  1123.      _________________________________________________________________
  1124.    
  1125.     1.5.5. Setting Preferences for Different Commands
  1126.     
  1127.    Certain oft-used commands offer lots of switches because different
  1128.    people have different requirements or preferences. For example, some
  1129.    people want to be able to delete files without having to watch a list
  1130.    of the deleted files scroll past, while others want to be prompted for
  1131.    permission to delete each file. Different people prefer different
  1132.    directory-listing styles. And so on. Such commands can be tailored
  1133.    with the SET OPTIONS command:
  1134.    
  1135.    SET OPTIONS command [ switch [ switch [ ... ] ] ]
  1136.           Sets each switch as the default for the given command,
  1137.           replacing the "factory default". Of course you can also
  1138.           override any defaults established by the SET OPTIONS command by
  1139.           including the relevant switches in the affected command any
  1140.           time you issue it.
  1141.           
  1142.    SHOW OPTIONS
  1143.           Lists the commands that allows option-setting, and the options
  1144.           currently in effect, if any, for each. Switches that have
  1145.           synonyms are shown under their primary name; for example. /LOG
  1146.           and /VERBOSE are shown as /LIST.
  1147.           
  1148.    Commands for which options may be set include DIRECTORY, DELETE,
  1149.    PURGE, and TYPE. Examples:
  1150.    
  1151.   SET OPTIONS DIRECTORY /PAGE /NOBACKUP /HEADING /SORT:DATE /REVERSE
  1152.   SET OPTIONS DELETE /LIST /NOHEADING /NOPAGE /NOASK /NODOTFILES
  1153.   SET OPTIONS TYPE /PAGE
  1154.  
  1155.    Not necessarily all of a command's switches can be set as options. For
  1156.    example, file selection switches, since these would normally be
  1157.    different for each command.
  1158.    
  1159.    Put the desired SET OPTIONS commands in your C-Kermit customization
  1160.    file for each command whose default switches you want to change every
  1161.    time you run C-Kermit.
  1162.      _________________________________________________________________
  1163.    
  1164.   1.6. Dates and Times
  1165.   
  1166.    Some commands and switches take date-time values, such as:
  1167.    
  1168.   send /after:{8-Feb-2000 10:28:01}
  1169.  
  1170.    Various date-time formats are acceptable. The rules for the date are:
  1171.    
  1172.      * The year must have 4 digits.
  1173.      * If the year comes first, the second field is the month.
  1174.      * The day, month, and year may be separated by spaces, /, -, or
  1175.        underscore.
  1176.      * The month may be numeric (1 = January) or spelled out or
  1177.        abbreviated in English.
  1178.        
  1179.    If the date-time string contains any spaces, it must be enclosed in
  1180.    braces. Examples of legal dates:
  1181.    
  1182.                            Interpretation:
  1183.   2000-Feb-8                8 February 2000
  1184.   {2000 Feb 8}              8 February 2000
  1185.   2000/Feb/8                8 February 2000
  1186.   2000_Feb_8                8 February 2000
  1187.   2000-2-8                  8 February 2000
  1188.   2000-02-08                8 February 2000
  1189.   8-Feb-2000                8 February 2000
  1190.   08-Feb-2000               8 February 2000
  1191.   12/25/2000                25 December 2000
  1192.   25/12/2000                25 December 2000
  1193.  
  1194.    The last two examples show that when the year comes last, and the
  1195.    month is given numerically, the order of the day and month doesn't
  1196.    matter as long as the day is 13 or greater (mm/dd/yyyy is commonly
  1197.    used in the USA, whereas dd/mm/yyyy is the norm in Europe). However:
  1198.    
  1199.   08/02/2000                Is ambiguous and therefore not accepted.
  1200.  
  1201.    If a date is given, the time is optional and defaults to 00:00:00. If
  1202.    the time is given with a date, it must follow the date, separated by
  1203.    space, /, -, or underscore, and with hours, minutes, and seconds
  1204.    separated by colon (:). Example:
  1205.    
  1206.   2000-Feb-8 10:28:01       Represents 8 February 2000, 10:28:01am
  1207.  
  1208.    If a date is not given, the current date is used and a time is
  1209.    required.
  1210.    
  1211.    Time format is hh:mm:ss or hh:mm or hh in 24-hour format, or followed
  1212.    by "am" or "pm" (or "AM" or "PM") to indicate morning or afternoon.
  1213.    Examples of times that are acceptable:
  1214.    
  1215.                            Interpretation:
  1216.   3:23:56                    3:23:56am
  1217.   3:23:56am                  3:23:56am
  1218.   3:23:56pm                  3:23:56pm = 15:23:56
  1219.  15:23:56                    3:23:56pm = 15:23:56
  1220.   3:23pm                     3:23:00pm = 15:23:00
  1221.   3:23PM                     3:23:00pm = 15:23:00
  1222.   3pm                        3:00:00pm = 15:00:00
  1223.  
  1224.    Examples of legal date-times:
  1225.    
  1226.   send /after:{8 Feb 2000 10:28:01}
  1227.   send /after:8_Feb_2000_10:28:01
  1228.   send /after:8-Feb-2000/10:28:01
  1229.   send /after:2000/02/08/10:28:01
  1230.   send /after:2000/02/08_10:28:01
  1231.   send /after:2000/02/08_10:28:01am
  1232.   send /after:2000/02/08_10:28:01pm
  1233.   send /after:2000/02/08_10:28pm
  1234.   send /after:2000/02/08_10pm
  1235.   send /after:10:00:00pm
  1236.   send /after:10:00pm
  1237.   send /after:10pm
  1238.   send /after:22
  1239.  
  1240.    Finally, there is a special all-numeric format you can use:
  1241.    
  1242.   yyyymmdd hh:mm:ss
  1243.  
  1244.    For example:
  1245.    
  1246.   20000208 10:28:01
  1247.  
  1248.    This is Kermit's standard date-time format (based on ISO 8601), and is
  1249.    accepted (among other formats) by any command or switch that requires
  1250.    a date-time, and is output by any function whose result is a calendar
  1251.    date-time.
  1252.    
  1253.    There are no optional parts to this format and it must be exactly 17
  1254.    characters long, punctuated as shown (except you can substitute
  1255.    underscore for space in contexts where a single "word" is required).
  1256.    The time is in 24-hour format (23:00:00 is 11:00pm). This is the
  1257.    format returned by \fdate(filename), so you can also use constructions
  1258.    like this:
  1259.    
  1260.   send /after:\fdate(oofa.txt)
  1261.  
  1262.    which means "all files newer than oofa.txt".
  1263.    
  1264.    Besides explicit dates, you can also use the any of the following
  1265.    shortcuts:
  1266.    
  1267.    TODAY
  1268.           Stands for the current date at 00:00:00.
  1269.           
  1270.    TODAY 12:34:56
  1271.           Stands for the current date at the given time.
  1272.           
  1273.    YESTERDAY
  1274.           Stands for yesterday's date at 00:00:00. A time may also be
  1275.           given.
  1276.           
  1277.    TOMORROW
  1278.           Stands for tomorrow's date at 00:00:00. A time may also be
  1279.           given.
  1280.           
  1281.    + number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
  1282.           Is replaced by the future date indicated, relative to the
  1283.           current date. If the time is omitted, 00:00:00 is used.
  1284.           Examples: +3days, +2weeks, +1year, +37months.
  1285.           
  1286.    - number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
  1287.           
  1288.           Is replaced by the past date indicated, relative to the current
  1289.           date. If the time is omitted, 00:00:00 is used.
  1290.           
  1291.    The time can be separated from the date shortcut by any of the same
  1292.    separators that are allowed for explicit date-times: space, hyphen,
  1293.    slash, period, or underscore. In switches and other space-delimited
  1294.    fields, use non-spaces to separate date/time fields, or enclose the
  1295.    date-time in braces, e.g.:
  1296.    
  1297.   purge /before:-4days_12:00:00
  1298.   purge /before:{- 4 days 12:00:00}
  1299.  
  1300.    Of course you can also use variables:
  1301.    
  1302.   define \%n 43
  1303.   purge /before:-\%ndays_12:00:00
  1304.  
  1305.    Shortcut names can be abbreviated to any length that still
  1306.    distinguishes them from any other name that can appear in the same
  1307.    context, e.g. "TOD" for today, "Y" for yesterday. Also, the special
  1308.    abbreviation "wks" is accepted for WEEKS, and "yrs" for "YEARS".
  1309.    
  1310.    (To see how to specify dates relative to a specific date, rather than
  1311.    the current one, see the [355]\fmjd() function description below.)
  1312.    
  1313.    You can check date formats with the DATE command. DATE by itself
  1314.    prints the current date and time in standard format: yyyymmdd
  1315.    hh:mm:ss. DATE followed by a date and/or time (including shortcuts)
  1316.    converts it to standard format if it can understand it, otherwise it
  1317.    prints an error message.
  1318.    
  1319.    The following variables and functions deal with dates and times; any
  1320.    function argument designated as "date-time" can be in any of the
  1321.    formats described above.
  1322.    
  1323.    \v(day)
  1324.           The first three letters of the English word for the current day
  1325.           of the week, e.g. "Wed".
  1326.           
  1327.    \fday(date-time)
  1328.           The first three letters of the English word for day of the week
  1329.           of the given date. If a time is included, it is ignored.
  1330.           Example: \fday(8 Feb 1988) = "Mon".
  1331.           
  1332.    \v(nday)
  1333.           The numeric day of the week: 0 = Sunday, 1 = Monday, ..., 6 =
  1334.           Saturday.
  1335.           
  1336.    \fnday(date-time)
  1337.           The numeric day of the week for the given date. If a time is
  1338.           included, it is ignored. Example: \fnday(8 Feb 1988) = "1".
  1339.           
  1340.    \v(date)
  1341.           The current date as dd mmm yyyy, e.g. "08 Feb 2000" (as in this
  1342.           example, a leading zero is supplied for day-of-month less than
  1343.           10).
  1344.           
  1345.    \v(ndate)
  1346.           The current date in numeric format: yyyymmdd, e.g. "20000208".
  1347.           
  1348.    \v(time)
  1349.           The current time as hh:mm:ss, e.g. "15:27:14".
  1350.           
  1351.    \ftime(time)
  1352.           The given free-format date and/or time (e.g. "3pm") returns the
  1353.           time (without the date) converted to hh:mm:ss 24-hour format,
  1354.           e.g. "15:00:00" (the date, if given, is ignored).
  1355.           
  1356.    \v(ntime)
  1357.           The current time as seconds since midnight, e.g. "55634".
  1358.           
  1359.    \v(tftime)
  1360.           The elapsed time of the most recent file-transfer operation in
  1361.           seconds.
  1362.           
  1363.    \v(intime)
  1364.           The elapsed time for the most recent INPUT command to complete,
  1365.           in milliseconds.
  1366.           
  1367.    \fntime(time)
  1368.           The given free-format date and/or time is converted to seconds
  1369.           since midnight (the date, if given, is ignored). This function
  1370.           replaces \ftod2secs(), which is now a synonym for \fntime().
  1371.           Unlike \ftod2secs(), \fntime() allows a date to be included,
  1372.           and it allows the time to be in free format (like 3pm), and it
  1373.           allows the amount of time to be more than 24 hours. E.g.
  1374.           \fntime(48:00:00) = 172800. Example of use:
  1375.           
  1376.  
  1377.   set alarm \fntime(48:00:00) ; set alarm 48 hours from now.
  1378.  
  1379.    \fn2time(seconds)
  1380.           The given number of seconds is converted to hh:mm:ss format.
  1381.           
  1382.    \fdate(filename)
  1383.           Returns the modification date-time of the given file in
  1384.           standard format: yyyymmdd hh:mm:ss.
  1385.           
  1386.    \fcvtdate(date-time)
  1387.           Converts a free-format date and/or time to Kermit standard
  1388.           format: yyyymmdd hh:mm:ss. If no argument is given, returns the
  1389.           current date-time in standard format. If a date is given but no
  1390.           time, the converted date is returned without a time. If a time
  1391.           is given with no date, the current date is supplied. Examples:
  1392.           
  1393.  
  1394.   \fcvtdate(4 Jul 2000 2:21:17pm) = 20000704 14:21:17
  1395.   \fcvtdate() = 20000704 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
  1396.   \fcvtd(4 Jul 2000) = 20000704
  1397.   \fcvtd(6pm) = 20000704 18:00:00 (on 4 Jul 2000 at 6:00pm).
  1398.  
  1399.    \fdayofyear(date-time)
  1400.           
  1401.    \fdoy(date-time)
  1402.           Converts a free-format date and/or time to yyyyddd, where ddd
  1403.           is the 3-digit day of the year, and 1 January is Day 1. If a
  1404.           time is included with the date, it is returned in standard
  1405.           format. If a date is included but no time, the date is returned
  1406.           without a time. If a time is given with no date, the time is
  1407.           converted and the current date is supplied. If no argument is
  1408.           given, the current date-time is returned. Synonym: \fdoy().
  1409.           Examples:
  1410.           
  1411.   \fddayofyear(4 Jul 2000 2:21:17pm) = 2000185 14:21:17
  1412.   \fdoy() = 2000185 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
  1413.   \fdoy(4 Jul 2000) = 2000185
  1414.   \fdoy(6pm) = 2000185 18:00:00 (on 4 Jul 2000 at 6:00pm).
  1415.  
  1416.    Note: The yyyyddd day-of-year format is often erroneously referred to
  1417.    as a Julian date. However, a true Julian date is a simple counting
  1418.    number, the number of days since a certain fixed day in the past.
  1419.    [356]See \fmjd() below.
  1420.    
  1421.    \fdoy2date(date-time)
  1422.           Converts a date or date-time in day-of-year format to a
  1423.           standard format date. A yyyyddd-format date must be supplied;
  1424.           time is optional. The given date is converted to yyyymmdd
  1425.           format. If a time is given, it is converted to 24-hour format.
  1426.           Examples:
  1427.           
  1428.   \fdoy2date(2000185) = 20000704
  1429.   \fdoy2(2000185 3pm) = 20000704 15:00:00
  1430.  
  1431.    \fmjd(date-time)
  1432.           Converts free-format date and/or time to a Modified Julian Date
  1433.           (MJD), the number of days since 17 Nov 1858 00:00:00. If a time
  1434.           is given, it is ignored. Examples:
  1435.           
  1436.   \fmjd(4 Jul 2000) = 50998
  1437.   \fmjd(17 Nov 1858) = 0
  1438.   \fmjd(16 Nov 1858) = -1
  1439.  
  1440.    \fmjd2date(mjd)
  1441.           Converts an MJD (integer) to standard date format, yyyymmdd:
  1442.           
  1443.   \fmjd2(50998) = 4 Jul 1998
  1444.   \fmjd2(0) = 17 Nov 1858
  1445.   \fmjd2(-1) = 16 Nov 1858
  1446.   \fmjd2(-365) = 17 Nov 1857
  1447.  
  1448.    MJDs are normal integers and, unlike DOYs, may be added, subtracted,
  1449.    etc, with each other or with other integers, to obtain meaningful
  1450.    results. For example, to find out the date 212 days ago:
  1451.    
  1452.   echo \fmjd2date(\fmjd()-212)
  1453.  
  1454.    Constructions such as this can be used in any command where a
  1455.    date-time is required, e.g.:
  1456.    
  1457.   send /after:\fmjd2date(\fmjd()-212)
  1458.  
  1459.    to send all files that are not older than 212 days (this is equivalent
  1460.    to "send /after:-212days").
  1461.    
  1462.    MJDs also have other regularities not exhibited by other date formats.
  1463.    For example, \fmodulus(\fmjd(any-date),7) gives the day of the week
  1464.    for any date (where 4=Sun, 5=Mon, ..., 3=Sat). (However, it is easier
  1465.    to use \fnday() for this purpose, and it gives the more conventional
  1466.    result of 0=Sun, 1=Mon, ..., 6=Sat).
  1467.    
  1468.    Note that if MJDs are to be compared, they must be compared
  1469.    numerically (IF <, =, >) and not lexically (IF LLT, EQUAL, LGT),
  1470.    whereas DOYs must be compared lexically if they include a time (which
  1471.    contains ":" characters); however, if DOYs do not include a time, they
  1472.    may also be compared numerically.
  1473.    
  1474.    In any case, lexical comparison of DOYs always produces the
  1475.    appropriate result, as does numeric comparison of MJDs.
  1476.    
  1477.    The same comments apply to sorting. Also note that DOYs are fixed
  1478.    length, but MJDs can vary in length. However, all MJDs between 3 April
  1479.    1886 and 30 Aug 2132 are 5 decimal digits long. (MJDs become 6 digits
  1480.    long on 31 Aug 2132, and 7 digits long on 13 Oct 4596).
  1481.      _________________________________________________________________
  1482.    
  1483.   1.7. Partial Completion of Keywords
  1484.   
  1485.    Partial completion of keywords was added in C-Kermit 7.0. In prior
  1486.    versions, if completion was attempted (by pressing the Esc or Tab key)
  1487.    on a string that matched different keywords, you'd just get a beep.
  1488.    Now Kermit completes up to the first character where the possibly
  1489.    matching keywords differ and then beeps. For example:
  1490.    
  1491.   C-Kermit> send /n<Tab>
  1492.  
  1493.    which matches /NOT-BEFORE and /NOT-AFTER, now completes up to the
  1494.    dash:
  1495.    
  1496.   C-Kermit> send /n<Tab>ot-<Beep>
  1497.  
  1498.    Partial completion works for filenames too (as it has for some years).
  1499.      _________________________________________________________________
  1500.    
  1501.   1.8. Command Recall
  1502.   
  1503.    C-Kermit has had a command history buffer for some time, which could
  1504.    be scrolled interactively using control characters or (in Kermit 95
  1505.    only) arrow keys. Version 7.0 adds a REDO command that allows the most
  1506.    recent command matching a given pattern to be re-executed:
  1507.    
  1508.    { REDO, RR, ^ } [ pattern ]
  1509.           Search the command history list for the most recent command
  1510.           that matches the given pattern, and if one is found, execute it
  1511.           again.
  1512.           
  1513.    The pattern can be a simple string (like "send"), in which case the
  1514.    last SEND command is re-executed. Or it can contain wildcard
  1515.    characters "*" and/or "?", which match any string and any single
  1516.    character, respectively (note that "?" must be preceded by backslash
  1517.    to override its normal function of giving help), and in most C-Kermit
  1518.    versions may also include [] character lists and {} string lists (see
  1519.    [357]Section 4.9).
  1520.    
  1521.    The match works by appending "*" to the end of the given pattern (if
  1522.    you didn't put one there yourself). Thus "redo *oofa" becomes "redo
  1523.    *oofa*" and therefore matches the most recent command that contains
  1524.    "oofa" anywhere within the command. If you want to inhibit the
  1525.    application of the trailing "*", e.g. to force matching a string at
  1526.    the end of a command, enclose the pattern in braces:
  1527.    
  1528.   redo {*oofa}
  1529.  
  1530.    matches the most recent command that ends with "oofa".
  1531.    
  1532.    REDO commands themselves are not entered into the command history
  1533.    list. If no pattern is given, the previous (non-REDO) command is
  1534.    re-executed. The REDOne command is reinserted at the end of the
  1535.    command history buffer, so the command scrollback character (Ctrl-P,
  1536.    Ctrl-B, or Uparrow) can retrieve it.
  1537.    
  1538.    Examples:
  1539.    
  1540.   C-Kermit> echo foo
  1541.   foo
  1542.   C-Kermit> show alarm
  1543.   (no alarm set)
  1544.   C-Kermit> echo blah
  1545.   blah
  1546.   C-Kermit> redo          ; Most recent command
  1547.   blah
  1548.   C-Kermit> redo s        ; Most recent command starting with "s"
  1549.   (no alarm set)
  1550.   C-Kermit> redo echo f   ; Most recent command starting with "echo f"
  1551.   foo
  1552.   C-Kermit> redo *foo     ; Most recent command that has "foo" in it
  1553.   foo
  1554.   C-Kermit> <Ctrl-P>      ; Scroll back
  1555.   C-Kermit> echo foo      ; The REDOne command is there
  1556.   C-Kermit> redo {*foo}   ; Most recent command that ends with "foo"
  1557.   foo
  1558.   C-Kermit>
  1559.  
  1560.    Since REDO, REDIAL, and REDIRECT all start the same way, and RED is
  1561.    the designated non-unique abbreviation for REDIAL, REDO must be
  1562.    spelled out in full. For convenience, RR is included as an invisible
  1563.    easy-to-type synonym for REDO. You can also use the "^" character for
  1564.    this:
  1565.    
  1566.   C-Kermit> ^             ; Most recent command
  1567.   C-Kermit> ^ s           ; Most recent command starting with "s"
  1568.   C-Kermit> ^s            ; Ditto (space not required after "^").
  1569.   C-Kermit> ^*foo         ; Most recent command that has "foo" in it.
  1570.   C-Kermit> ^{*foo}       ; Most recent command ends with "foo".
  1571.  
  1572.    Unlike the manual command-history-scrolling keys, the REDO command can
  1573.    be used in a script, but it's not recommended (since the command to be
  1574.    REDOne might not be found, so if the REDO command fails, you can't
  1575.    tell whether it was because REDO failed to find the requested command,
  1576.    or because the command was found but it failed).
  1577.      _________________________________________________________________
  1578.    
  1579.   1.9. EXIT Messages
  1580.   
  1581.    The EXIT and QUIT commands now accept an optional message to be
  1582.    printed. This makes the syntax of EXIT and QUIT just like END and
  1583.    STOP:
  1584.    
  1585.    { EXIT, QUIT, END, STOP } [ status-code [ message ] ]
  1586.    
  1587.    where status-code is a number (0 indicating success, nonzero
  1588.    indicating failure). This is handy in scripts that are never supposed
  1589.    to enter interactive mode:
  1590.    
  1591.   dial 7654321
  1592.   if fail exit 1 Can't make connection - try again later.
  1593.  
  1594.    Previously this could only be done in two steps:
  1595.    
  1596.   dial 7654321
  1597.   xif fail { echo Can't make connection - try again later, exit 1 }
  1598.  
  1599.    A status code must be included in order to specify a message. In the
  1600.    case of EXIT and QUIT, the default status code is contained in the
  1601.    variable \v(exitstatus), and is set automatically by various events
  1602.    (file transfer failures, etc; it can also be set explicitly with the
  1603.    SET EXIT STATUS command). If you want to give an EXIT or QUIT command
  1604.    with a message, but without changing the exit status from what it
  1605.    normally would have been, use the \v(exitstatus) variable, e.g.:
  1606.    
  1607.    exit \v(existatus) Goodbye from \v(cmdfile).
  1608.  
  1609.    The EXIT status is returned to the system shell or whatever other
  1610.    process invoked C-Kermit, e.g. in UNIX:
  1611.    
  1612.   C-Kermit> exit 97 bye bye
  1613.   bye bye
  1614.   $ echo $?
  1615.   97
  1616.   $
  1617.      _________________________________________________________________
  1618.    
  1619.   1.10. Managing Keyboard Interruptions
  1620.   
  1621.    When C-Kermit is in command or file-transfer mode (as opposed to
  1622.    CONNECT mode), it can be interrupted with Ctrl-C. Version 7.0 adds the
  1623.    ability to disarm the Ctrl-C interrupt:
  1624.    
  1625.    SET COMMAND INTERRUPT { ON, OFF }
  1626.           COMMAND INTERRUPT is ON by default, meaning the Ctrl-C can be
  1627.           used to interrupt a command or a file transfer in progress. Use
  1628.           OFF to disable these interruptions, and use it with great
  1629.           caution for obvious reasons.
  1630.           
  1631.    SET TRANSFER INTERRUPT { ON, OFF }
  1632.           This can be used to disable keyboard interruption of file
  1633.           transfer when C-Kermit is in local mode, or to re-enable it
  1634.           after it has been disabled. This applies to the X, Z, E, and
  1635.           similar keys as well as to the system interrupt character,
  1636.           usually Ctrl-C. This is distinct from SET TRANSFER
  1637.           CANCELLATION, which tells whether packet mode can be exited by
  1638.           sending a special sequence of characters.
  1639.           
  1640.    Several other commands can be interrupted by pressing any key while
  1641.    they are active. Version 7.0 adds the ability to disable this form of
  1642.    interruption also:
  1643.    
  1644.    SET INPUT CANCELLATION { ON, OFF }
  1645.           Whether an INPUT command in progress can be interrupted by
  1646.           pressing a key. Normally ON. Setting INPUT CANCELLATION OFF
  1647.           makes INPUT commands uninterruptible except by Ctrl-C (unless
  1648.           COMMAND INTERRUPTION is also OFF).
  1649.           
  1650.    SET SLEEP CANCELLATION { ON, OFF }
  1651.           Whether a SLEEP, PAUSE, or WAIT command in progress can be
  1652.           interrupted by pressing a key. Normally ON. Setting SLEEP
  1653.           CANCELLATION OFF makes these commands uninterruptible except by
  1654.           Ctrl-C (unless COMMAND INTERRUPTION is also OFF). Synonyms: SET
  1655.           PAUSE CANCELLATION, SET WAIT CANCELLATION.
  1656.           
  1657.    So to make certain a script is not interruptible by the user, include
  1658.    these commands:
  1659.    
  1660.   SET TRANSFER INTERRUPT OFF
  1661.   SET SLEEP CANCELLATION OFF
  1662.   SET INPUT CANCELLATION OFF
  1663.   SET COMMAND INTERRUPTION OFF
  1664.  
  1665.    Make sure to turn them back on afterwards if interruption is to be
  1666.    re-enabled.
  1667.    
  1668.    When a PAUSE, SLEEP, WAIT, or INPUT command is interrupted from the
  1669.    keyboard, the new variable \v(kbchar) contains a copy of the (first)
  1670.    character that was typed and caused the interruption, provided it was
  1671.    not the command interrupt character (usually Ctrl-C). If these
  1672.    commands complete successfully or time out without a keyboard
  1673.    interruption, the \v(kbchar) variable is empty.
  1674.    
  1675.    The \v(kbchar) variable (like any other variable) can be tested with:
  1676.    
  1677.   if defined \v(kbchar) command
  1678.  
  1679.    The command is executed if the variable is not empty.
  1680.    
  1681.    The \v(kbchar) variable can be reset with WAIT 0 (PAUSE 0, SLEEP 0,
  1682.    etc).
  1683.      _________________________________________________________________
  1684.    
  1685.   1.11. Taming The Wild Backslash -- Part Deux
  1686.   
  1687.    [358]Using C-Kermit, 2nd Edition, contains a brief section, "Taming
  1688.    the Wild Backslash", on page 48, which subsequent experience has shown
  1689.    to be inadequate for Kermit users intent on writing scripts that deal
  1690.    with Windows, DOS, and OS/2 filenames, in which backslash (\) is used
  1691.    as the directory separator. This section fills in the blanks.
  1692.    
  1693.     1.11.1. Background
  1694.     
  1695.    The Kermit command language shares a certain unavoidable but annoying
  1696.    characteristic with most other command languages that are capable of
  1697.    string replacement, namely the necessity to "quote" certain characters
  1698.    when you want them to be taken literally. This is a consequence of the
  1699.    facts that:
  1700.    
  1701.     1. One or more characters must be set aside to denote replacement,
  1702.        rather than acting as literal text.
  1703.     2. We have only 96 printable characters to work with in ASCII, which
  1704.        is still the only universally portable character set.
  1705.     3. There is no single printable character that is unused everywhere.
  1706.     4. Variables are not restricted to certain contexts, as they are in
  1707.        formal programming languages like C and Fortran, but can appear
  1708.        anywhere at all within a command, and therefore require special
  1709.        syntax.
  1710.        
  1711.    Thus there can be conflicts. To illustrate, the standard UNIX shell
  1712.    uses dollar sign ($) to introduce variables. So the shell command:
  1713.    
  1714.   echo $TERM
  1715.  
  1716.    displays the value of the TERM variable, e.g. vt320. But suppose you
  1717.    want to display a real dollar sign:
  1718.    
  1719.   echo The price is $10.20
  1720.  
  1721.    This causes the shell to evaluate the variable "$1", which might or
  1722.    might not exist, and substitute its value, e.g.:
  1723.    
  1724.   The price is 0.20
  1725.  
  1726.    (in this case the $1 variable had no value.) This is probably not what
  1727.    you wanted. To force the dollar sign to be taken literally, you must
  1728.    apply a "quoting rule", such as "precede a character by backslash (\)
  1729.    to force the shell to take the character literally":
  1730.    
  1731.   echo The price is \$10.20
  1732.   The price is $10.20
  1733.  
  1734.    But now suppose you want the backslash AND the dollar sign to be taken
  1735.    literally:
  1736.    
  1737.   echo The price is \\$10.20
  1738.  
  1739.    This doesn't work, since the first backslash quotes the second one,
  1740.    thereby leaving the dollar sign unquoted again:
  1741.    
  1742.   The price is \0.20
  1743.  
  1744.    Quoting the dollar sign requires addition of a third backslash:
  1745.    
  1746.   echo The price is \\\$10.20
  1747.   The price is \$10.20
  1748.  
  1749.    The first backslash quotes the second one, and the third backslash
  1750.    quotes the dollar sign.
  1751.    
  1752.    Every command language -- all UNIX shells, VMS DCL, DOS Batch, AOS/VS
  1753.    CLI, etc etc -- has similar rules. UNIX shell rules are probably the
  1754.    most complicated, since many printable characters -- not just one --
  1755.    are special there: dollar sign, single quote, double quote, backslash,
  1756.    asterisk, accent grave, number sign, ampersand, question mark,
  1757.    parentheses, brackets, braces, etc -- practically every
  1758.    non-alphanumeric character needs some form of quoting if it is to be
  1759.    taken literally. And to add to the confusion, the UNIX shell offers
  1760.    many forms of quoting, and many alternative UNIX shells are available,
  1761.    each using slightly different syntax.
  1762.      _________________________________________________________________
  1763.    
  1764.     1.11.2. Kermit's Quoting Rules
  1765.     
  1766.    Kermit's basic quoting rules are simple by comparison (there are, of
  1767.    course, additional syntax requirements for macro definitions, command
  1768.    blocks, function calls, etc, but they are not relevant here).
  1769.    
  1770.    The following characters are special in Kermit commands:
  1771.    
  1772.    Backslash (\)
  1773.           Introduces a variable, or the numeric representation of a
  1774.           special character, or a function, or other item for
  1775.           substitution. If the backslash is followed by a digit or by any
  1776.           of the following characters:
  1777.           
  1778.   x, o, d, m, s, f, v, $, %, &, :, {
  1779.  
  1780.           this indicates a special substitution item; otherwise the
  1781.           following character is to be taken literally (exceptions: \ at
  1782.           end of line is taken literally; \n, \b, and \n are special
  1783.           items in the OUTPUT command only).
  1784.           
  1785.    Semicolon (;)
  1786.           (Only when at the beginning of a line or preceded by at least
  1787.           one space or tab) Introduces a comment.
  1788.           
  1789.    Number sign (#)
  1790.           (Only when at the beginning of a line or preceded by at least
  1791.           one space or tab) Just like semicolon; introduces a comment.
  1792.           
  1793.    Question mark (?)
  1794.           (Only at the command prompt - not in command files or macros)
  1795.           Requests context-sensitive help.
  1796.           
  1797.    To force Kermit to take any of these characters literally, simply
  1798.    precede it by a backslash (\).
  1799.    
  1800.    Sounds easy! And it is, except when backslash also has a special
  1801.    meaning to the underlying operating system, as it does in DOS,
  1802.    Windows, and OS/2, where it serves as the directory separator in
  1803.    filenames such as:
  1804.    
  1805.   D:\K95\KEYMAPS\READ.ME
  1806.  
  1807.    Using our rule, we would need to refer to this file in Kermit commands
  1808.    as follows:
  1809.    
  1810.   D:\\K95\\KEYMAPS\\READ.ME
  1811.  
  1812.    But this would not be obvious to new users of Kermit software on DOS,
  1813.    Windows, or OS/2, and it would be annoying to seasoned ones. Thus
  1814.    MS-DOS Kermit and Kermit 95 go to rather extreme lengths to allow the
  1815.    more natural notation, as in:
  1816.    
  1817.   send d:\k95\keymaps\read.me
  1818.  
  1819.    The reason this is tricky is that we also need to allow for variables
  1820.    and other expressions introduced by backslash in the same command. For
  1821.    example, suppose \%a is a variable whose value is "oofa" (without the
  1822.    quotes). What does the following command do?
  1823.    
  1824.   send d:\%a
  1825.  
  1826.    Does it send the file named "oofa" in the current directory of the D:
  1827.    disk, or does it send a file named "%a" in the root directory of the
  1828.    D: disk? This is the kind of trouble we get into when we attempt to
  1829.    bend the rules in the interest of user friendliness. (The answer is:
  1830.    if the variable \%a has definition that is the name of an existing
  1831.    file, that file is sent; if a file d:\%a exists, it is sent; otherwise
  1832.    if both conditions are true, the variable takes precedence, and the
  1833.    literal filename can be forced by quoting: \\%a.)
  1834.    
  1835.    In Kermit 95 (but not MS-DOS Kermit), we also bend the rules another
  1836.    way by allowing you to use forward slash (/) rather than backslash (\)
  1837.    as the directory separator:
  1838.    
  1839.   send d:/k95/keymaps/read.me
  1840.  
  1841.    This looks more natural to UNIX users, and in fact is perfectly
  1842.    acceptable to the Windows 95/98/NT and OS/2 operating systems on the
  1843.    API level. BUT (there is always a "but") the Microsoft shell,
  1844.    COMMAND.COM, for Windows 95/98 and NT does not allow this notation,
  1845.    and therefore it can not be used in any Kermit command -- such as RUN
  1846.    -- that invokes the Windows command shell AND your command shell is
  1847.    COMMAND.COM or any other shell that does not allow forward slash as
  1848.    directory separator (some alternative shells do allow this).
  1849.    
  1850.      NOTE: There exists a wide variety of alternative shells from third
  1851.      parties that do not have this restriction. If you are using a shell
  1852.      that accepts forward slash as a directory separator, you can stop
  1853.      reading right now -- UNLESS (there is always an "unless") you want
  1854.      your scripts to be portable to systems that have other shells. Also
  1855.      note that some Windows shells might actually REQUIRE forward
  1856.      slashes (instead of backslashes) as directory separators; we do not
  1857.      treat this situation below, but the treatment is obvious -- use
  1858.      slash rather backslash as the directory separator.
  1859.      _________________________________________________________________
  1860.    
  1861.     1.11.3. Passing DOS Filenames from Kermit to Shell Commands
  1862.     
  1863.    The following Kermit commands invoke the system command shell:
  1864.    
  1865.   RUN (and its synonyms ! and @)
  1866.   REDIRECT
  1867.   PIPE
  1868.  
  1869.    Each of these commands takes a shell command as an operand. These
  1870.    shell commands are not, and can not be, parsed by Kermit since Kermit
  1871.    does not know the syntax of shell commands, and so can't tell the
  1872.    difference between a keyword, a filename, a variable, a switch, or
  1873.    other item. Therefore the rules can not be bent since Kermit doesn't
  1874.    know where or how to bend them. To illustrate (using the regular
  1875.    Windows shell):
  1876.    
  1877.   run c:\\windows\\command\\chkdsk.exe
  1878.  
  1879.    works OK, but:
  1880.    
  1881.   run c:/windows/command/chkdsk.exe
  1882.  
  1883.    is not accepted by COMMAND.COM. But:
  1884.    
  1885.   run c:\windows\command\chkdsk.exe
  1886.  
  1887.    results in Kermit applying its quoting rules before sending the text
  1888.    to the shell. Since "w" and "c" are not in the list of backslash-item
  1889.    codes, the backslash means "take the following character literally".
  1890.    Thus, by the time this filename gets to the Windows shell, it has
  1891.    become:
  1892.    
  1893.   c:windowscommandchkdsk.exe
  1894.  
  1895.    which is probably not what you wanted. (If "w" and "c" were in the
  1896.    list, the results could be even stranger.) Even more confusing is the
  1897.    case where a directory or filename starts with one or more digits:
  1898.    
  1899.   run c:\123\lotus.exe
  1900.  
  1901.    in which "\123" is the Kermit notation for ASCII character 123, which
  1902.    happens to be left brace ({), resulting in "c:{lotus.exe".
  1903.    
  1904.    So when passing filenames to a Windows shell, always use double
  1905.    backslashes as directory separators, to ensure that the shell gets
  1906.    single backslashes:
  1907.    
  1908.   run c:\\windows\\command\\chkdsk.exe
  1909.   run c:\\123\\lotus.exe
  1910.  
  1911.    Similar problems might occur with the built-in EDIT, BROWSE, and FTP
  1912.    commands. These commands result in Kermit building a shell command
  1913.    internally to invoke the associated helper program; the form of this
  1914.    command might conflict with the form demanded by certain alternative
  1915.    shells.
  1916.      _________________________________________________________________
  1917.    
  1918.     1.11.4. Using Variables to Hold DOS Filenames
  1919.     
  1920.    Now to the next level. Suppose you want to write a script in which
  1921.    filenames are parameters, and therefore are stored in variables.
  1922.    Example:
  1923.    
  1924.   define \%f c:\windows\command\chkdsk.exe
  1925.   ...
  1926.   run \%f
  1927.  
  1928.    Obviously this won't work for the reasons just noted; the RUN command
  1929.    requires directory separators be coded as double backslashes:
  1930.    
  1931.   define \%f c:\\windows\\command\\chkdsk.exe
  1932.   ...
  1933.   run \%f
  1934.  
  1935.    This will work; no surprises here. However, if you had used ASSIGN
  1936.    rather than DEFINE, you might have been surprised after all; review
  1937.    pages 348-349 of [359]Using C-Kermit (2nd Ed) for the difference
  1938.    between DEFINE and ASSIGN.
  1939.    
  1940.    We have said that any Kermit 95 or MS-DOS Kermit command that parses
  1941.    filenames itself -- SEND, for example -- does not require double
  1942.    backslashes since it knows it is parsing a filename. So since the
  1943.    following works:
  1944.    
  1945.   send c:\windows\command\chkdsk.exe
  1946.  
  1947.    Should the following also work?
  1948.    
  1949.   define \%f c:\windows\command\chkdsk.exe
  1950.   ...
  1951.   send \%f
  1952.  
  1953.    Answer: No. Why? Because \%f is evaluated "recursively", to allow for
  1954.    the possibility that its definition contains further variable
  1955.    references. This is true of all "backslash-percent-letter" (or -digit)
  1956.    variables, and also for array references. So \%f becomes
  1957.    c:\windows\command\chkdsk.exe, which becomes
  1958.    c:windowscommandchkdsk.exe.
  1959.    
  1960.    The trick here is to use the "other" kind of variable, that is
  1961.    evaluated only "one level deep" rather than recursively:
  1962.    
  1963.   define filename c:\windows\command\chkdsk.exe
  1964.   ...
  1965.   send \m(filename)
  1966.  
  1967.    Similarly if you want to prompt the user for a filename:
  1968.    
  1969.   ask filename { Please type a filename: }
  1970.    Please type a filename: c:\windows\command\chkdsk.exe
  1971.   send \m(filename)
  1972.      _________________________________________________________________
  1973.    
  1974.     1.11.5. Passing DOS Filenames as Parameters to Macros
  1975.     
  1976.    Suppose you want to pass a DOS filename containing backslashes as a
  1977.    parameter to a Kermit macro. This raises two issues:
  1978.    
  1979.     1. Parameters to macros are "just text" and so are fully evaluated
  1980.        before they are passed to the macro.
  1981.     2. Once inside the macro, the formal parameters \%1, \%2, ... \%9 are
  1982.        the type of variable that is evaluated recursively.
  1983.        
  1984.    Thus a DOS filename is ruined once in the act of parsing the macro
  1985.    invocation, and again when referring to it from within the macro. To
  1986.    illustrate, suppose "test" is a macro. Then in the invocation:
  1987.    
  1988.   test c:\mydir\blah.txt
  1989.  
  1990.    "c:mydirblah.txt" is assigned to \%1. However, if we double the
  1991.    backslashes:
  1992.    
  1993.   test c:\\mydir\\blah.txt
  1994.  
  1995.    "c:\mydir\blah.txt" is assigned to \%1. But then when you refer to \%1
  1996.    in the macro, it is evaluated recursively, resulting in
  1997.    "c:mydirblah.txt". To illustrate:
  1998.    
  1999.   define test echo \%1
  2000.   test c:\mydir\blah.txt
  2001.   c:mydirblah.txt
  2002.   test c:\\mydir\\blah.txt
  2003.   c:mydirblah.txt
  2004.   test c:\\\\mydir\\\\blah.txt
  2005.   c:\mydir\blah.txt
  2006.  
  2007.    Let's address each part of the problem separately. First, inside the
  2008.    macro. You can use the \fcontents() function to force a
  2009.    backslash-percent variable (such as a macro argument) to be evaluated
  2010.    one level deep instead of recursively, for example:
  2011.    
  2012.   define test echo { The filename is "\fcontents(\%1)"}
  2013.  
  2014.   test c:\mydir\blah.txt               ; We don't expect this to work
  2015.    The filename is "c:mydirblah.txt"   ; and it doesn't.
  2016.   test c:\\mydir\\blah.txt             ; But this does...
  2017.    The filename is "c:\mydir\blah.txt"
  2018.  
  2019.    Thus if the filename arrives inside the macro with single backslashes,
  2020.    the backslashes are preserved if you always refer to the parameter
  2021.    through the \fcontents() function.
  2022.    
  2023.    Now how to ensure that backslashes are not stripped or misinterpreted
  2024.    when passing a filename to a macro? This brings us back to what we
  2025.    learned in earlier sections:
  2026.    
  2027.     1. If it is a literal filename, either double the backslashes, or (if
  2028.        the filename is to be used only within Kermit itself and not
  2029.        passed to a DOS shell, or it is to be passed to an alternative
  2030.        shell that accepts forward slash as a directory separator), use
  2031.        forward slash instead of backslash as the directory separator.
  2032.     2. If it is a variable that contains a filename, make sure you use a
  2033.        macro-style variable name, rather than a
  2034.        backslash-percent-character name.
  2035.        
  2036.    Examples:
  2037.    
  2038.   define test echo \fcontents(\%1)
  2039.   define filename c:\mydir\blah.txt
  2040.  
  2041.   test c:\\mydir\\blah.txt  ; Literal filename with double backslashes
  2042.   c:\mydir\blah.txt
  2043.  
  2044.   test c:/mydir/blah.txt    ; Literal filename with forward slashes
  2045.   c:/mydir/blah.txt
  2046.  
  2047.   test \m(filename)         ; Variable
  2048.   c:\mydir\blah.txt
  2049.  
  2050.    But what if you don't like these rules and you still want to pass a
  2051.    literal filename containing single backslashes to a macro? This is
  2052.    possible too, but a bit tricky: turn command quoting off before
  2053.    invoking the macro, and then turn it back on inside the macro.
  2054.    Example:
  2055.    
  2056.   define test set command quoting on, echo \fcontents(\%1)
  2057.  
  2058.   set command quoting off
  2059.   test c:\mydir\blah.txt
  2060.   c:\mydir\blah.txt
  2061.  
  2062.    Upon return from the macro, command quoting is back on (since the
  2063.    macro turned it on).
  2064.    
  2065.    Obviously this trick can not be used if the filename is stored in a
  2066.    variable, since it prevents the variable from being evaluated.
  2067.      _________________________________________________________________
  2068.    
  2069.     1.11.6. Passing DOS File Names from Macro Parameters to the DOS Shell
  2070.     
  2071.    Now suppose you need to pass a DOS filename to a macro, and the macro
  2072.    needs to pass it, in turn, to the Windows shell via (say) Kermit's RUN
  2073.    command. This works too:
  2074.    
  2075.   define xrun run \fcontents(\%1)
  2076.   xrun c:\\windows\\command\\chkdsk.exe
  2077.  
  2078.    (or you can use the SET COMMAND QUOTING OFF / ON technique described
  2079.    above to avoid the double backslashes.) But..
  2080.    
  2081.   xrun c:/windows/command/chkdsk.exe
  2082.  
  2083.    does not work if the Windows shell does not recognize "/" as a
  2084.    directory separator. If there is a chance that a filename might be
  2085.    passed to the macro in this form, the macro will need to convert it to
  2086.    a form acceptable to the shell:
  2087.    
  2088.   define xrun run \freplace(\fcontents(\%1),/,\\)
  2089.  
  2090.    Here we replace all occurrences (if any) of "/" in the argument with
  2091.    "\" prior to issuing the RUN command. Of course, in order to specify
  2092.    "\" as a literal character in the \freplace() argument list, we have
  2093.    to double it.
  2094.      _________________________________________________________________
  2095.    
  2096.     1.11.7. Passing DOS Filenames to Kermit from the Shell
  2097.     
  2098.    As noted in the manual, the \&@[] array contains Kermit's command-line
  2099.    arguments. Suppose one of these arguments, say \&@[3], is a DOS
  2100.    filename such as C:\FOO\BAR\BAZ\OOFA.TXT. (Note: In C-Kermit 7.0 and
  2101.    K95 1.1.18 and later, command-line arguments after "=" or "--" are
  2102.    also available in the top-level \%1..9 variables; see [360]Section
  2103.    7.5.)
  2104.    
  2105.    Of course you can eliminate any problems by using forward slashes
  2106.    rather than backslashes in the filename, but sometimes this is not
  2107.    possible, as when the Kermit command line is being generated by
  2108.    another program than can only generate "native" format DOS filenames.
  2109.    
  2110.    As noted in the manual, "\%x" variables and \&x[] arrays are always
  2111.    evaluated "all the way" (recursively). If the contents of one of these
  2112.    variables contains backslashes, this causes another level of
  2113.    evaluation.
  2114.    
  2115.    There is another kind of variable, which is evaluated only "one level
  2116.    deep". You can use this to prevent interpretation of the backslashes
  2117.    in the filenames. Example:
  2118.    
  2119.   assign filename \fcontents(\&@[3])  ; Transfer contents
  2120.   ...
  2121.   send \m(filename)
  2122.  
  2123.    Or, more simply:
  2124.    
  2125.   send \fcontents(\&@[3])
  2126.      _________________________________________________________________
  2127.    
  2128.   1.12. Debugging
  2129.   
  2130.    The debug log is produced when you give a "log debug" command. This is
  2131.    normally done at the request of the Kermit help desk, for forwarding
  2132.    to the Kermit developers for analysis as a last resort in
  2133.    troubleshooting problems. (Last resort because it can grow quite huge
  2134.    in a very short time.) In cases where timing information is critical
  2135.    to understanding a problem, you can tell C-Kermit to put a timestamp
  2136.    on each debug log line by giving the command:
  2137.    
  2138.   SET DEBUG TIMESTAMP ON
  2139.  
  2140.    At any time before or after activating the debug log (SET DEBUG
  2141.    TIMESTAMP OFF turns off timestamping). Timestamps can be turned off
  2142.    and on as desired while logging. Obviously, they increase the size and
  2143.    growth rate of the log significantly, and so should be used sparingly.
  2144.    Timestamps are of the form hh:mm:ss.xxx, where .xxx is thousands of a
  2145.    second (but is included only on platforms that include this feature).
  2146.      _________________________________________________________________
  2147.    
  2148.   1.13. Logs
  2149.   
  2150.    In UNIX C-Kermit and in K-95, you can now direct any log to a pipe.
  2151.    This not only lets you send your logs to places other than disk files,
  2152.    but also lets you customize them to any desired degree.
  2153.    
  2154.    LOG { DEBUG, PACKETS, SESSION, TRANSACTION, CONNECTION } { file, pipe
  2155.           } ...
  2156.           A "pipe" is the name of a command, preceded by a vertical bar.
  2157.           If the pipe contains any spaces, it must be enclosed in braces.
  2158.           
  2159.    Here are some examples for UNIX (always remember the importance of
  2160.    getting the UNIX shell quoting rules right):
  2161.    
  2162.    LOG TRANSACTIONS |lpr
  2163.           This sends the transaction log to the default UNIX printer,
  2164.           rather than to a file (use "lp" rather than "lpr" if
  2165.           necessary).
  2166.           
  2167.    LOG TRANSACTIONS {| myfilter > t.log}
  2168.           For those who don't like the format of the transaction log, or
  2169.           want to extract certain information from it; write your own
  2170.           output filter.
  2171.           
  2172.    LOG SESSION {| lpr -Plaserwriter}
  2173.           This sends the session log to a specific UNIX printer, rather
  2174.           than to a file. Note the braces around the pipeline. These are
  2175.           required because it contains spaces.
  2176.           
  2177.    LOG DEBUG {| tail -100 > debug.log}
  2178.           This causes the debug log file to contain only the final 100
  2179.           lines. Suppose C-Kermit crashes under some unpredictable
  2180.           circumstances, and you need a debug log to catch it in the act.
  2181.           But the debug log can grow to huge proportions very quickly,
  2182.           possibly filling up the disk. Piping the debug log through
  2183.           "tail" results in keeping only the last 100 lines (or other
  2184.           number of your choice).
  2185.           
  2186.    LOG DEBUG {| grep "^TELNET" > debug.log}
  2187.           This one shows how to log only Telnet negotiations. Piping the
  2188.           debug log through grep or egrep lets you log only specific
  2189.           information, rather than everything. "man grep" for further
  2190.           info.
  2191.           
  2192.    LOG DEBUG {| gzip -c > debug.log.gz}
  2193.           Creates a full debug log, but compressed by gzip to save space.
  2194.           
  2195.    LOG PACKETS {| tr "\\01" "X" | cut -c9- > packet.log}
  2196.           This one writes the regular packet log, but translates the
  2197.           Ctrl-A that starts each packet to the letter "X" and removes
  2198.           the s-nn-nn- notation from the beginning of each line. Note the
  2199.           double backslash (normal Kermit quoting rules). "man tr" and
  2200.           "man cut" for further info.
  2201.           
  2202.    See [361]Section 2.12 for information about the new connection log.
  2203.      _________________________________________________________________
  2204.    
  2205.   1.14. Automatic File-Transfer Packet Recognition at the Command Prompt
  2206.   
  2207.    Beginning in version 7.0, C-Kermit can recognize Kermit (and in some
  2208.    cases also Zmodem) file-transfer packets while at its command prompt.
  2209.    This is convenient (for example), if you escaped back from a remote
  2210.    Kermit program and told the local Kermit program to send a file, but
  2211.    forgot to tell the remote Kermit program to receive it (and the local
  2212.    Kermit did not have the "send a Kermit receive command" feature
  2213.    available). This feature is controlled by the following command:
  2214.    
  2215.    SET COMMAND AUTODOWNLOAD { ON, OFF }
  2216.           When ON, which is the default, the command parser recognizes
  2217.           Kermit packets when Kermit is in remote mode. An S packet makes
  2218.           it go into receive mode, an I packet makes it go into server
  2219.           mode. When OFF, packet recognition is disabled and the behavior
  2220.           when a packet is received at the command prompt is as it was in
  2221.           C-Kermit 6.1 and earlier (namely to print an error message).
  2222.           
  2223.    COMMAND AUTODOWNLOAD is the command-mode equivalent of TERMINAL
  2224.    AUTODOWNLOAD, which is effective during CONNECT mode.
  2225.      _________________________________________________________________
  2226.    
  2227.   1.15. The TYPE Command
  2228.   
  2229.    The TYPE command now accepts a selection of optional switches
  2230.    ([362]Section 1.5), and also sets several variables.
  2231.    
  2232.    Syntax: TYPE [ switches... ] filename
  2233.    
  2234.    Variables:
  2235.    
  2236.    \v(ty_ln)
  2237.           Line number of current line (during TYPE command; see /PREFIX)
  2238.           
  2239.    \v(ty_lc)
  2240.           Line count of file most recently TYPEd.
  2241.           
  2242.    \v(ty_mc)
  2243.           Match count of file most recently TYPEd (see /MATCH).
  2244.           
  2245.    Switches:
  2246.    
  2247.    /PAGE
  2248.           If /PAGE is included, Kermit pauses at the end of each
  2249.           screenful and issues a "more?" prompt. You may press the space
  2250.           bar to view the next page (screenful), or press "q" or "n" to
  2251.           return to the C-Kermit prompt. If this switch is given, it
  2252.           overrides the COMMAND MORE-PROMPTING setting for this command
  2253.           only. If it is not given, paging is according to COMMAND
  2254.           MORE-PROMPTING.
  2255.           
  2256.    /NOPAGE
  2257.           Do not pause at the end of each screenful; show the whole file
  2258.           (or all selected lines) at once. If this switch is given, it
  2259.           overrides the COMMAND MORE-PROMPTING setting for this command
  2260.           only. If it is not given, paging is according to COMMAND
  2261.           MORE-PROMPTING.
  2262.           
  2263.    /HEAD[:n]
  2264.           Only show the first n lines of the file (where n is a number).
  2265.           If n is omitted, 10 is used.
  2266.           
  2267.    /TAIL[:n]
  2268.           Only show the last n lines of the file (where n is a number).
  2269.           If nis omitted, 10 is used. Note: /HEAD and /TAIL can't be
  2270.           combined; if you give both switches, only the most recent one
  2271.           is used.
  2272.           
  2273.    /MATCH:pattern
  2274.           Only type lines from the file that match the given pattern (see
  2275.           [363]Section 4.9.1 for pattern notation). UNIX users familiar
  2276.           with grep should note a significant difference: there is no
  2277.           implied "*" at the beginning and end of the pattern. Thus:
  2278.           
  2279.   TYPE /MATCH:foo    Lists lines whose entire contents are "foo".
  2280.   TYPE /MATCH:foo*   Lists lines that start with "foo".
  2281.   TYPE /MATCH:*foo   Lists lines that end with "foo".
  2282.   TYPE /MATCH:*foo*  Lists lines that have "foo" anywhere in them.
  2283.  
  2284.           /HEAD and /TAIL apply after /MATCH, so "type /tail:20
  2285.           /match:x*" shows the last 20 lines in the file that start with
  2286.           "x".
  2287.           
  2288.    /PREFIX:string
  2289.           Print the given string at the beginning of each line. The
  2290.           string may be a constant, a variable, or a quoted variable. If
  2291.           it's an unquoted variable, its value at the time the TYPE
  2292.           command was given is used as a constant. If it is a quoted
  2293.           variable, it is re-evaluated for each line; a useful variable
  2294.           for this context is \v(ty_ln) (the line number of the current
  2295.           line being typed). If the prefix is to include spaces, it must
  2296.           be enclosed in braces. Examples:
  2297.           
  2298.         type /prefix:{oofa.txt: } /match:*thing* oofa.txt
  2299.                 Prints all lines in oofa.txt that contain "thing" with
  2300.                 the filename itself as the prefix (similar to UNIX grep).
  2301.                 
  2302.         type /prefix:{\v(time). } oofa.txt
  2303.                 Prefixes each line of oofa.txt with the time at which the
  2304.                 TYPE command was given (one backslash)
  2305.                 
  2306.         type /prefix:{\\v(time). } oofa.txt
  2307.                 Prefixes each line of oofa.txt with the time at which
  2308.                 that line is being typed (two backslashes).
  2309.                 
  2310.         type /prefix:{\\v(ty_ln). } oofa.txt
  2311.                 Prefixes each line of oofa.txt with its line number.
  2312.                 
  2313.         type /prefix:{\\flpad(\\v(ty_ln),4). } oofa.txt
  2314.                 Same as the previous example, except the line number is
  2315.                 right-adjusted in a 4-column field.
  2316.                 
  2317.    /WIDTH[:n]
  2318.           Truncates each line at column n (which must be a number) prior
  2319.           to printing it. This option can be used for long lines when you
  2320.           don't want them to wrap. If nis omitted, your current screen
  2321.           width is used.
  2322.           
  2323.    /COUNT
  2324.           Counts lines and -- if /MATCH was included, matches -- but does
  2325.           not print any lines from the file. The line and match count is
  2326.           shown at the end, and the variables \v(ty_lc) and \v(ty_lm) are
  2327.           set accordingly.
  2328.           
  2329.    SET OPTIONS TYPE { /PAGE, /NOPAGE, /WIDTH:n }
  2330.           Sets the paging default for TYPE commands, which can be
  2331.           overridden in any particular TYPE command by including the
  2332.           desired switch.
  2333.           
  2334.    If a TYPE command is given with no switch, and no SET OPTIONS TYPE
  2335.    selection is in effect, paging is according to your COMMAND
  2336.    MORE-PROMPTING setting (SHOW COMMAND).
  2337.      _________________________________________________________________
  2338.    
  2339.   1.16. The RESET Command
  2340.   
  2341.    The RESET command, added in 7.0, closes all open files and logs, but
  2342.    does not affect the open connection (if any).
  2343.      _________________________________________________________________
  2344.    
  2345.   1.17. The COPY and RENAME Commands
  2346.   
  2347.    As of C-Kermit 7.0, in the UNIX version only, the COPY and RENAME
  2348.    commands are built in and do not call the underlying platform's COPY
  2349.    or RENAME command. This allows them to work in "NOPUSH" versions and
  2350.    other circumstances where it can't access system commands, and it
  2351.    allows file copying and renaming to be done portably in scripts. The
  2352.    characteristics of the built-in COPY or RENAME include:
  2353.      * It fails if the source file is a directory or is wild or lacks
  2354.        read access.
  2355.      * It fails if the source file is the destination file.
  2356.      * It allows the destination file to be a directory, in which case
  2357.        the source file is copied (or renamed) into it with the same name.
  2358.      * It overwrites an existing destination file if its permission
  2359.        allows.
  2360.      * It sets the new file's permission according to umask but also
  2361.        carries forward the source file's execute permission bits if the
  2362.        destination file did not already exist.
  2363.      * It fails if interrupted by Ctrl-C.
  2364.      * Upon error, it prints an appropriate message.
  2365.      * It returns standardized error codes that can be tested by IF
  2366.        SUCCESS / FAIL.
  2367.        
  2368.    These commands now also accept the following switches:
  2369.    
  2370.   /LIST (/LOG, /VERBOSE)    = Print "file1 => file2 (OK)" (or error message).
  2371.   /NOLIST (/NOLOG, /QUIET)  = Don't print anything (except error messages).
  2372.  
  2373.    /NOLIST is the default.
  2374.    
  2375.    The same built-in code is used by the UNIX C-Kermit server to execute
  2376.    REMOTE COPY commands (except in this case no switches are available).
  2377.    
  2378.    The COPY command also accepts the following additional switches. When
  2379.    any of these are given (and they can be used in any combination except
  2380.    /SWAP and /APPEND), some of the checks listed above are relaxed, and
  2381.    thus it might be possible to get into trouble in certain cases, e.g.
  2382.    when the source and target files are the same file:
  2383.    
  2384.   /APPEND                   = Append source file to destination file.
  2385.   /SWAP-BYTES               = Swap bytes (see [364]Section 6.6.5).
  2386.   /FROMB64                  = Decode the source file from Base64 encoding.
  2387.   /TOB64                    = Encode the target file in Base64.
  2388.  
  2389.    Base64 is the encoding commonly used for enclosures in Internet email.
  2390.      _________________________________________________________________
  2391.    
  2392.   1.18. The MANUAL Command
  2393.   
  2394.    The MANUAL command can be used to access the appropriate Kermit manual
  2395.    or other manual. The general syntax is:
  2396.    
  2397.    MANUAL [ string ]
  2398.           If the string is omitted, C-Kermit asks the underlying system
  2399.           to access the C-Kermit manual using whatever method is
  2400.           appropriate for the system.
  2401.           
  2402.    The specific action depends on the system. In UNIX, a "man" command is
  2403.    issued; "kermit" is the default argument but other manual topics may
  2404.    be specified. If the "man" command allows index or string searching,
  2405.    the appropriate syntax may be included.
  2406.    
  2407.    In Kermit 95, the MANUAL command brings up the HTML online K95 manual.
  2408.    
  2409.    In VMS and elsewhere, "man" is simply translated to "help", with a
  2410.    default argument of "kermit"; other and/or additional arguments may be
  2411.    included according to the definition of the system's "help" command.
  2412.    
  2413.    Correct operation of the "man" command in C-Kermit depends on the
  2414.    appropriate man page or help topic having been installed in the right
  2415.    place with the right permissions and format.
  2416.      _________________________________________________________________
  2417.    
  2418.   1.19. String and Filename Matching Patterns
  2419.   
  2420.    A pattern is a string that includes special notation for matching
  2421.    classes or sequences of characters. C-Kermit 7.0 / K95 1.1.19 supports
  2422.    patterns in several places:
  2423.    
  2424.      * Filenames ([365]Section 4.9)
  2425.      * SWITCH case labels ([366]Section 7.18)
  2426.      * The new IF MATCH statement ([367]Section 7.4)
  2427.      * TYPE /MATCH ([368]Section 1.15)
  2428.      * SET FILE TEXT-PATTERNS and BINARY-PATTERNS ([369]Section 4.3)
  2429.      * The \fsearch() and \farraylook() functions ([370]Sections 7.3 and
  2430.        [371]7.10.7)
  2431.      * The \fpattern() function used with [M,RE]INPUT ([372]Section 7.1)
  2432.        
  2433.    Patterns are also called wildcards, especially when used for filename
  2434.    matching. C-Kermit's pattern syntax is explained in [373]Section
  2435.    4.9.1, and also by the HELP WILDCARDS command.
  2436.      _________________________________________________________________
  2437.    
  2438.   1.20. Multiple Commands on One Line
  2439.   
  2440.    As of C-Kermit 7.0, commands can be grouped together on one line by
  2441.    separating the commands with commas and enclosing the list in braces.
  2442.    For example:
  2443.    
  2444.   C-Kermit> { echo One, echo Two, echo Three }
  2445.   C-Kermit> do { echo One, echo Two, echo Three }
  2446.  
  2447.    Command lists can be nested:
  2448.    
  2449.   [ do ] { echo One, echo Two, if true { echo A, echo B}, echo Three }
  2450.  
  2451.    and the END command works as it does in macros:
  2452.    
  2453.   [ do ] { echo One, echo Two, if true end, echo Three }
  2454.  
  2455.    The "one line" stricture is, of course, pliant to line-continuation
  2456.    conventions, namely that lines ending in hyphen (-) or left brace ({)
  2457.    are to be continued. Thus the first example can also be rendered:
  2458.    
  2459.   [ do ] {
  2460.       echo One
  2461.       echo Two
  2462.       echo Three
  2463.   }
  2464.  
  2465.    (the "do" is optional).
  2466.      _________________________________________________________________
  2467.    
  2468.   1.21. What Do I Have?
  2469.   
  2470.    C-Kermit can be built for hundreds of different platforms with
  2471.    practically countless configuration options. Certain commands might
  2472.    not be available in certain configurations, etc. Even on the same
  2473.    platform, different builds are possible: "maximum functionality",
  2474.    "minimum size", "maximum performance", and so on. You can find out a
  2475.    lot about the configuration of your C-Kermit program with the SHOW
  2476.    FEATURES command. Of course, a lot of what it says, especially in the
  2477.    bottom part, might seem like gibberish, but can be deciphered with a
  2478.    Rosetta Stone (such as the C-Kermit source or the [374]ckccfg.txt
  2479.    file). In any case, the output from SHOW FEATURES might easily explain
  2480.    why some expected feature is missing, or some buffer is smaller than
  2481.    expected. Here's a sample of the bottom section for the SunOS version:
  2482.    
  2483. C-Kermit 7.0.196, 1 Jan 2000
  2484.  
  2485. Major optional features included:
  2486.  Network support (type SHOW NET for further info)
  2487.  Telnet Kermit Option
  2488.  Hardware flow control
  2489.  External XYZMODEM protocol support
  2490.  Latin-1 (West European) character-set translation
  2491.  Latin-2 (East European) character-set translation
  2492.  Cyrillic (Russian, Ukrainian, etc) character-set translation
  2493.  Greek character-set translation
  2494.  Hebrew character-set translation
  2495.  Japanese character-set translation
  2496.  Unicode character-set translation
  2497.  Pseudoterminal control
  2498.  REDIRECT command
  2499.  RESEND command
  2500.  Fullscreen file transfer display
  2501.  Control-character unprefixing
  2502.  Streaming
  2503.  Autodownload
  2504.  
  2505. Major optional features not included:
  2506.  No Kerberos(TM) authentication
  2507.  No SRP(TM) (Secure Remote Password) protocol
  2508.  No Secure Sockets Layer (SSL) protocol
  2509.  No Transport Layer Security (TLS) protocol
  2510.  No encryption
  2511.  No X Windows forwarding
  2512.  
  2513. Host info:
  2514.  Machine:    sun4m
  2515.  Model:      (unknown)
  2516.  OS:         SunOS
  2517.  OS Release: 4.1.3_U1
  2518.  OS Version: 4
  2519.  
  2520. Target: sunos41gsc
  2521. GCC version: 2.7.2
  2522. Compiled Dec 31 1999 10:38:54, options:
  2523.  __GNUC__ __STDC__ _POSIX_JOB_CONTROL _SC_JOB_CONTROL ARRAYREFLEN=1024 BIGBUFOK
  2524.  BROWSER BSD4 CK_ANSIC CK_APC CK_AUTODL CK_CURSES CK_DNS_SRV CK_ENVIRONMENT
  2525.  CK_FAST CK_LOGIN CK_MKDIR CK_NAWS CK_PCT_BAR CK_PERMS CK_RECALL CK_RTSCTS
  2526.  CK_SPEED CK_TIMERS CK_TMPDIR CK_TTGWSIZ CK_TTYFD CK_WREFRESH CKEXEC
  2527.  CKFLOAT=double CKGHNLHOST ckmaxfiles=64 CKMAXOPEN=64 CKMAXPATH=1023 CKREALPATH
  2528.  CKREGEX CKSYSLOG CKTUNING CMDBL=32763 CMDDEP=64 CONGSPD DCMDBUF DIRENT DYNAMIC
  2529.  FNFLOAT FORDEPTH=32 GFTIMER HADDRLIST HDBUUCP IFDEBUG IKS_OPTION IKSDB
  2530.  IKSDCONF INBUFSIZE=32768 INPBUFSIZ=4096 MAC_MAX=16384 MACLEVEL=128 MAXDDIR=32
  2531.  MAXDNUMS=4095 MAXGETPATH=128 MAXTAKE=54 MAXWLD=102400 MSENDMAX=1024 NETCMD
  2532.  NETCONN NETPTY NOKVERBS NOSETBUF OBUFSIZE=32768 PARSENSE PATTERNS PIPESEND
  2533.  RENAME RLOGCODE SAVEDUID SELECT SIG_V SOL_SOCKET sparc STREAMING sun SUNOS4
  2534.  SYSTIMEH TCPSOCKET TIMEH TLOG TNCODE TTLEBUF TTSPDLIST UIDBUFLEN=256 UNIX
  2535.  UNPREFIXZERO USE_LSTAT USE_MEMCPY VNAML=4096 WHATAMI XFRCAN Z_MAXCHAN=46
  2536.  z_maxchan=46 ZXREWIND
  2537.  
  2538.  byte order: big endian
  2539.  
  2540.  sizeofs: int=4 long=4 short=2 char=1 char*=4 float=4 double=8
  2541.  
  2542.  floating-point: precision=16 rounding=1
  2543.  
  2544.    Without going into detail about what all the notation means, notice a
  2545.    couple things:
  2546.    
  2547.      * The Options section shows symbols ("macros") in effect during
  2548.        compilation, together with their values (for those that have
  2549.        values). The options are listed in alphabetical order to make any
  2550.        particular option easier to find.
  2551.      * MAXWLD is the maximum number of files that a wildcard can expand
  2552.        to.
  2553.      * Anything starting with "NO" is a feature (or something other than
  2554.        a feature) that has been deliberately "compiled out", or omitted.
  2555.      * Important items for script writers include: CMDBL=32763 (the size
  2556.        of the command buffer and therefore the maximum length for a macro
  2557.        or variable definition; CMDDEP=64 (the limit on recursion depth);
  2558.        FORDEPTH=32 (the nesting limit on FOR loops); INBUFSIZE=32768 (the
  2559.        size of the INPUT command circular buffer); MAC_MAX=16384 (the
  2560.        maximum number of macros), etc.
  2561.        
  2562.    See the [375]ckccfg.txt file for details.
  2563.      _________________________________________________________________
  2564.    
  2565.   1.22. Generalized File Input and Output
  2566.   
  2567.    C-Kermit 7.0 adds a new generalized I/O system for stream files,
  2568.    augmenting (and to some extent, overlapping with) the older OPEN,
  2569.    READ, WRITE, and CLOSE commands. In the new file i/o system, which can
  2570.    be used simultaneously with the old one, all commands are grouped
  2571.    together under the new FILE keyword, and some related functions and
  2572.    variables are added.
  2573.    
  2574.     1.22.1. Why Another I/O System?
  2575.     
  2576.    The well-known LOG, OPEN, READ, WRITE, and CLOSE commands have the
  2577.    following restrictions:
  2578.    
  2579.     1. Only one READ file and one WRITE file can be open at a time.
  2580.     2. The READ and WRITE commands are strictly line oriented.
  2581.     3. These commands can not be used with binary files.
  2582.     4. They do not support read/write access or random access.
  2583.     5. The syntax is a bit counterintuitive for programmers.
  2584.        
  2585.    The new file i/o system allows multiple files to be open at once, in
  2586.    any desired combination of modes (read/write/append) supported by the
  2587.    operating system, for line, block (record), or character i/o, for
  2588.    sequential or random access, using consistent syntax and conventions.
  2589.    
  2590.    The new system, however, does not replace the old one, since the old
  2591.    system still must be used for:
  2592.    
  2593.     1. The session, packet, debug, transaction, and connection logs.
  2594.     2. Reading and writing commands rather than files.
  2595.     3. Existing scripts.
  2596.        
  2597.    The new system works only with regular files, not with commands or
  2598.    pipes or mailboxes or pseudoterminals. No special provisions are made
  2599.    in the FILE commands for handling devices or network connections, nor
  2600.    for preventing you from trying to open them; if the underlying
  2601.    operating system treats them like regular stream disk files, the FILE
  2602.    commands (except, of course SEEK, REWIND, and COUNT) might work with
  2603.    them. (In C programming terms, the FILE commands are, at present,
  2604.    nothing more than a front end to fopen() / fread() / fwrite() /
  2605.    fclose() and friends, which are a portable API to sequential files,
  2606.    but this might change in the future for platforms like VMS and VOS
  2607.    that have more complicated file systems.)
  2608.    
  2609.    Definitions:
  2610.    
  2611.    Channel
  2612.           A number assigned to a file when it is opened, by which it must
  2613.           be referred to in all input/output operations.
  2614.           
  2615.    Read/Write Pointer
  2616.           The current position in an open file, expressed as the 0-based
  2617.           byte count from the beginning.
  2618.      _________________________________________________________________
  2619.    
  2620.     1.22.2. The FILE Command
  2621.     
  2622.    FILE keyword [ switches ] channel [ data ]
  2623.           The keyword specifies the function: FILE OPEN, FILE READ, FILE
  2624.           WRITE, FILE CLOSE, etc. For convenience (and for familiarity to
  2625.           C programmers), the two-word FILE commands can be shortened to
  2626.           the single words FOPEN, FREAD, FWRITE, FCLOSE, and so on.
  2627.           Switches are optional, and modify or amplify the requested file
  2628.           function.
  2629.           
  2630.    As in C, Fortran, and other programming languages, open files are
  2631.    referred to by "channels", integers such as 0, 1, 2, 3, and so on. A
  2632.    channel number is assigned when you open a file. The number of
  2633.    available channels depends on the underlying operating system, and can
  2634.    be seen in the variable:
  2635.    
  2636.   \v(f_max)
  2637.  
  2638.    or by giving the FILE LIST (FLIST) command. Channels are discussed in
  2639.    greater detail in [376]Section 1.22.4.
  2640.    
  2641.    FILE command errors can be caught with IF FAIL after the FILE command.
  2642.    In addition, the \v(f_error) variable is set to the completion code of
  2643.    the command: 0 if no error, or a negative number if there was an
  2644.    error. The error codes are listed in [377]Section 1.22.5.
  2645.    
  2646.    The command to open a file is:
  2647.    
  2648.    FILE OPEN [ switches ] variable filename
  2649.           Opens a file for the type of access specified by the switches,
  2650.           or for read-only access if no switches are given. Upon success,
  2651.           a channel number is assigned to this file and stored in the
  2652.           given variable so you can refer to the open file in subsequent
  2653.           i/o commands. If the file can not be opened, the FILE OPEN
  2654.           command fails. Synonym: FOPEN.
  2655.           
  2656.    The FILE OPEN switches are:
  2657.    
  2658.    /READ
  2659.           Open the file for read access. If no switches are given, /READ
  2660.           is assumed. If the file does not exist or can't be opened for
  2661.           read access, the FILE OPEN command fails.
  2662.           
  2663.    /WRITE
  2664.           Allow writing. If a file of the same name already exists, it is
  2665.           overwritten unless /READ or /APPEND is also included. If a file
  2666.           of the given name does not exist, it is created.
  2667.           
  2668.    /APPEND
  2669.           Equivalent to /WRITE, except that if the file exists, it is not
  2670.           destroyed. The read/write pointer is set to the end of the
  2671.           file, so unless you change it with FILE SEEK or REWIND (see
  2672.           below), the first FILE WRITE command adds to the end of the
  2673.           file, preserving what was there already. If /WRITE is also
  2674.           given, it is ignored.
  2675.           
  2676.    /BINARY
  2677.           Open the file in "binary" mode, rather than text mode. This
  2678.           switch is meaningless (but still can be used) in UNIX. In VMS,
  2679.           Windows, and OS/2, it inhibits end-of-line processing and
  2680.           conversion, and so should be used for binary files and/or files
  2681.           that are to be accessed in record or character mode rather than
  2682.           line by line.
  2683.           
  2684.    The variable for the channel number can be any kind of variable: the
  2685.    \%x kind, a macro name, or an array element. But it must be a
  2686.    variable, not a number -- C-Kermit assigns the channel number; you
  2687.    can't tell it what number to use.
  2688.    
  2689.    Example:
  2690.    
  2691.   FILE OPEN \%c oofa.txt                  ; Open oofa.txt for reading.
  2692.   IF FAIL exit 1 Can't open oofa.txt      ; Always check to see if it worked.
  2693.   ECHO oofa.txt: channel = \%c
  2694.  
  2695.    If the file oofa.txt is opened successfully, a channel number is
  2696.    assigned to the variable \%c. Here's another example using a macro
  2697.    name for the channel number:
  2698.    
  2699.   FILE OPEN channel oofa.txt              ; Open oofa.txt for reading.
  2700.   IF SUCCESS ECHO oofa.txt: channel = \m(channel)
  2701.  
  2702.    Switches can be combined when it makes sense and the underlying
  2703.    operating system allows it. For example, to open a file in binary mode
  2704.    for reading and writing (sometimes called "update"):
  2705.    
  2706.   FILE OPEN /READ /WRITE /BINARY \%c budget.db
  2707.  
  2708.    Some combinations might be allowed, others not. For example /READ
  2709.    /APPEND will usually not be allowed. /WRITE /APPEND is treated as
  2710.    /APPEND.
  2711.    
  2712.    A major advantage of the new system over the older one is that you can
  2713.    have multiple files open at once. Suppose, for example, that you want
  2714.    to open all the files in a certain directory at once:
  2715.    
  2716.   .\%n := \ffiles(/usr/olga*,&f)          ; Get file list into array.
  2717.   if ( > \%n \v(f_max) ) {                ; Make sure there aren't too many.
  2718.       exit 1 {\v(dir): \%n = Too many files}
  2719.   }
  2720.   declare \&c[\%n]                        ; Make array for channel numbers.
  2721.   for \%i 1 \%n 1 {                       ; Loop to open every file...
  2722.       file open \&c[\%i] \&f[\%i]         ; Try to open this one
  2723.       if fail exit 1 Open error: \&f[\%i] ; Check for failure
  2724.   }
  2725.  
  2726.    If this loop completes successfully, the \&c[] array will contain \%n
  2727.    channel numbers of open files in elements 1 through \%n.
  2728.    
  2729.    Any file that you open with FILE OPEN stays open until you close it.
  2730.    The command to close a file is:
  2731.    
  2732.    FILE CLOSE { ALL, channel }
  2733.           If a channel number is given and the channel refers to an open
  2734.           file, the file is closed and the channel is freed for reuse; if
  2735.           the channel does not refer to an open file, an error message is
  2736.           printed and the command fails. If ALL is specified instead of a
  2737.           specific channel, all files opened with FILE OPEN are closed
  2738.           and if all open files were closed successfully (even if no
  2739.           files were open), the command succeeds; if any open file could
  2740.           not be closed, the command fails; however, all open files that
  2741.           could be closed are still closed. Synonym: FCLOSE.
  2742.           
  2743.    FILE CLOSE might fail because, for example, the disk filled up or a
  2744.    quota was exceeded. Example:
  2745.    
  2746.   fopen /write \%c new.txt                ; Open new.txt for writing.
  2747.   if fail exit 1                          ; Check for error.
  2748.   fclose \%c                              ; Close the file we just opened.
  2749.  
  2750.    This creates a 0-length file called new.txt.
  2751.    
  2752.    Note that FILE OPEN /WRITE (without /READ or /APPEND) always creates a
  2753.    new file, and therefore destroys any file with the same name that
  2754.    might already exist (assuming you have permission to delete it). To
  2755.    avoid overwriting existing files, simply check first:
  2756.    
  2757.   if exist new.txt exit 1 {Fatal - new.txt already exists}
  2758.   fopen /write \%c new.txt
  2759.   if fail ...
  2760.  
  2761.    The next two commands give information about open files:
  2762.    
  2763.    FILE STATUS channel
  2764.           Tells the name of the file, if any, open on the given channel
  2765.           and the switches it was opened with. The read/write pointer is
  2766.           also shown; this is where the next read or write will occur;
  2767.           "[EOF]" is shown if the current position in the open file is
  2768.           the end -- i.e. the next read will fail if the file was opened
  2769.           in /READ mode; the next write will add material to the end. The
  2770.           current line number (0-based) is also shown if known. The FILE
  2771.           STATUS command succeeds if the channel is open, and fails if
  2772.           there is no open file on the given channel, or if the channel
  2773.           number is invalid or out of range. Synonym: FSTATUS.
  2774.           
  2775.    FILE LIST
  2776.           Lists the channel number and name of each open file, along with
  2777.           its OPEN modes (R, W, A, B, RW, etc) and its current read/write
  2778.           pointer or "[EOF]" if it is at the end. Also tells the number
  2779.           of files currently opened with FILE OPEN, plus the maximum
  2780.           number of open files allowed by the system and the maximum
  2781.           number allowed for FILE OPEN. Synonym: FLIST.
  2782.           
  2783.    Next come the commands for reading and writing files:
  2784.    
  2785.    FILE READ [ switches ] channel [ variable ]
  2786.           Reads data from the file on the given channel number into the
  2787.           variable, if one was given; if no variable was given, the
  2788.           result is printed on the screen. IMPORTANT: The variable should
  2789.           normally be a macro name rather than a \%x or \&x[] variable if
  2790.           you want backslash characters in the file to be taken literally
  2791.           (see pp.408-412 of [378]Using C-Kermit for an explanation; you
  2792.           can also read into a \%x or \&x[] variable, but then you must
  2793.           remember to protect future references to by \fcontents() if you
  2794.           don't want C-Kermit to process any backslashes it might
  2795.           contain). The desired amount of data (according to the
  2796.           switches) is read from the file at the current read/write
  2797.           pointer, and upon completion the read/write position is updated
  2798.           to first byte after the data that was read, no matter what
  2799.           switches were given. Synonym: FREAD.
  2800.           
  2801.    FILE WRITE [ switches ] channel text
  2802.           Writes the given text to the file on the given channel number.
  2803.           The text, of course, can be literal text or a variable, or any
  2804.           combination. If the text might contain leading or trailing
  2805.           spaces, it must be enclosed in braces if you want to preserve
  2806.           them. Synonym: FWRITE.
  2807.           
  2808.    Before proceeding, a caution about the NUL character. C-Kermit is so
  2809.    named because it is a Kermit program written in the C language. In C,
  2810.    character strings are represented as a sequence of non-NUL bytes
  2811.    terminated by a NUL byte (a byte in which all bits are 0). Thus a C
  2812.    string can not contain NUL bytes; it always ends with the first NUL
  2813.    byte. C-Kermit variables are implemented as C strings and therefore
  2814.    can't contain NUL bytes either, so the FILE READ and FILE WRITE
  2815.    commands do not handle files or strings that contain NUL bytes, except
  2816.    when the /CHARACTER switch is included with the FILE READ or WRITE
  2817.    command, or when /LPAD:0 or /RPAD:0 is given with the FILE WRITE
  2818.    command; these switches are explained below.
  2819.    
  2820.    Also note that Kermit can not be used read or write binary numbers in
  2821.    the machine's internal format (integer or floating-point); in general,
  2822.    numbers can be processed only when represented as numeric or
  2823.    floating-point strings.
  2824.    
  2825.    FILE READ switches are:
  2826.    
  2827.    /LINE
  2828.           Specifies that a line of text is to be read. A line is defined
  2829.           according to the underlying operating system's text-file
  2830.           format. For example, in UNIX a line is a sequence of characters
  2831.           up to and including a linefeed, or the end of the file, which
  2832.           ever comes first. The line terminator (if any) is removed
  2833.           before assigning the text to the variable. If no switches are
  2834.           included with the FILE READ command, /LINE is assumed. Normally
  2835.           this switch should not be used with files opened in /BINARY
  2836.           mode (but nothing prevents it either).
  2837.           
  2838.    /SIZE:number
  2839.           Specifies that the given number of bytes (characters) is to be
  2840.           read. The actual number of bytes returned will be less if the
  2841.           end of file is reached (or a NUL byte is encountered). For
  2842.           example, if a file is 514 bytes long, FILE READ /SIZE:512
  2843.           returns 512 bytes the first time and 2 bytes the second time.
  2844.           FILE READ /SIZE provides a kind of "record i/o" for files that
  2845.           do not necessarily contain lines. The resulting block of
  2846.           characters is assigned to the variable without any editing.
  2847.           Synonym: /BLOCK.
  2848.           
  2849.    /CHARACTER
  2850.           Equivalent to /SIZE:1. If FILE READ /CHAR succeeds but the
  2851.           variable is empty, this indicates a NUL byte was read. Synonym:
  2852.           BYTE.
  2853.           
  2854.    FILE WRITE switches are:
  2855.    
  2856.    /LINE
  2857.           Specifies that an appropriate line terminator is to be added to
  2858.           the end of the text. If no switches are included, /LINE is
  2859.           assumed.
  2860.           
  2861.    /SIZE:number
  2862.           Specifies that the given number of bytes (characters) is to be
  2863.           written. If the given text is longer than the requested size,
  2864.           it is truncated; if is shorter, it is padded according /LPAD
  2865.           and /RPAD switches. Synonym: /BLOCK.
  2866.           
  2867.    /LPAD[:value]
  2868.           If /SIZE was given, but the text is shorter than the requested
  2869.           size, the text is padded on the left with sufficient copies of
  2870.           the character whose ASCII value is given to write the given
  2871.           length. If no value is specified, 32 (the code for Space) is
  2872.           used. The value can also be 0 to write the indicated number of
  2873.           NUL bytes. If /SIZE was not given, this switch is ignored.
  2874.           
  2875.    /RPAD[:value]
  2876.           Like LPAD, but pads on the right.
  2877.           
  2878.    /CHARACTER
  2879.           Specifies that one character should be written. If the text is
  2880.           empty or not given, a NUL character is written; otherwise the
  2881.           first character of text is given. Synonym: /BYTE.
  2882.           
  2883.    /STRING
  2884.           Specifies that the text is to be written as-is, with no
  2885.           terminator added.
  2886.           
  2887.    Here's an example in which we copy a text file line by line:
  2888.    
  2889.   file open /read \%c oofa.txt            ; Open input file
  2890.   if fail exit 1 Can't open input file    ; Check that it's open
  2891.   file open /write \%d new.txt            ; Open output file
  2892.   if fail exit 1 Can't open output file   ; Check
  2893.   while true {                            ; Loop to copy lines
  2894.       file read /line \%c line            ; Read a line
  2895.       if fail break                       ; Assume failure = end of file
  2896.       file write /line \%d {\m(line)}     ; Write the line to output file
  2897.       if fail exit 1 Write failure        ; Failure here is fatal
  2898.   }
  2899.   file close \%c                          ; Close the two files
  2900.   file close \%d
  2901.  
  2902.    Note that since /LINE is the default for both FILE READ and FILE
  2903.    WRITE, it can be omitted as in the following example, where we also
  2904.    use the short names for the FILE commands.
  2905.    
  2906.   fopen /read \%c oofa.txt                ; Open input file
  2907.   if fail exit 1 Can't open input file    ; Check that it's open
  2908.   fopen /write \%d new.txt                ; Open output file
  2909.   if fail exit 1 Can't open output file   ; Check
  2910.   while true {                            ; Loop to copy lines
  2911.       fread \%c line                      ; Read a line
  2912.       if fail break                       ; Assume failure = end of file
  2913.       fwrite \%d {\m(line)}               ; Write the line to output file
  2914.       if fail exit 1 Write failure        ; Failure here is fatal
  2915.   }
  2916.   fclose \%c                              ; Close the two files
  2917.   fclose \%d
  2918.  
  2919.    Here's the same example using "record i/o" (the open and close
  2920.    sequences are are omitted since they are the same as above). The
  2921.    result is the same, but execution is much faster:
  2922.    
  2923.   while true {                            ; Loop to copy blocks
  2924.       fread /size:512 \%c block           ; Read a block into \%a
  2925.       if fail break                       ; Assume failure = end of file
  2926.       fwrite /string \%d {\m(block)}      ; Write the block to output file
  2927.       if fail exit 1 Write failure        ; Failure here is fatal
  2928.   }
  2929.  
  2930.    Although record i/o is faster, it should not be used in line-oriented
  2931.    applications, since it returns arbitrary chunks of the file to your
  2932.    script, rather than lines. In this example, FWRITE /STRING is used
  2933.    rather than FWRITE /SIZE:512 to avoid the last output block being
  2934.    padded beyond the original file's length.
  2935.    
  2936.    A file can also be copied character by character, but this is much
  2937.    slower than line i/o and VERY much slower than block i/o:
  2938.    
  2939.   while true {                            ; Loop to copy blocks
  2940.       fread /char \%c c                   ; Read a character into c
  2941.       if fail break                       ; Assume failure = end of file
  2942.       fwrite /char \%d {\m(c)}            ; Write character to output file
  2943.       if fail exit 1 Write failure        ; Failure is fatal
  2944.   }
  2945.  
  2946.    Although character i/o is slow, it is the only way to process files
  2947.    that contain NUL characters (i.e. bytes composed of only zero bits).
  2948.    In the example above, when "fread /char \%c c" returns a NUL, the c
  2949.    variable is empty. But since the FREAD /CHAR command did not fail, we
  2950.    know the result was really a NUL. FWRITE /CHAR, when given an empty
  2951.    variable (or no variable at all) writes a NUL. Thus the loop above
  2952.    will copy any file at all (very slowly). In non-copying applications,
  2953.    NULs are detected like this:
  2954.    
  2955.   fread /char \%c c
  2956.   if fail (do something)
  2957.   if not def c (a NUL byte was read)
  2958.  
  2959.    Finally some advanced file operations:
  2960.    
  2961.    FILE FLUSH channel
  2962.           For output files only: commits all previous writes to disk, in
  2963.           case the computer was buffering them. Synonym: FFLUSH.
  2964.           
  2965.    FILE COUNT [ { /BYTES, /LINES, /LIST, /NOLIST } ] channel
  2966.           By default, or if the /BYTES switch is given, counts the bytes
  2967.           in the file, if any, open on the given channel. If the /LINES
  2968.           switch is given, counts lines in the file. If the /LIST switch
  2969.           is given, the result is printed. If the /NOLIST switch is
  2970.           given, the result is not printed. /QUIET is a synonym for
  2971.           /NOLIST. If neither /LIST nor /NOLIST is given, the result is
  2972.           printed if the command is given at top level, i.e. not from a
  2973.           command file or macro. In all cases, the result of the most
  2974.           recent FILE COUNT command is stored in the variable
  2975.           \v(f_count). Note that FILE COUNT /LINE works (and can only
  2976.           work) by reading the entire file; expect it to take some time
  2977.           if the file is large. Synonym: FCOUNT.
  2978.           
  2979.    FILE REWIND channel
  2980.           Moves the read/write pointer to the beginning of the file.
  2981.           Equivalent to FILE SEEK channel 0. Synonym: FREWIND.
  2982.           
  2983.    FILE SEEK [ switches ] channel { [{+,-}]number, LAST, EOF }
  2984.           Moves the read/write pointer for the file on this channel to
  2985.           the given position, which may be a byte (character) number or a
  2986.           line number, expressed in either absolute or relative terms.
  2987.           Switches:
  2988.           
  2989.         /BYTE
  2990.                 The number given is a byte number. Synonym: /CHARACTER.
  2991.                 
  2992.         /LINE
  2993.                 The number given is a line number.
  2994.                 
  2995.         /ABSOLUTE
  2996.                 The number given is absolute.
  2997.                 
  2998.         /RELATIVE
  2999.                 The number given is relative to the current position.
  3000.                 
  3001.           By default, or if the /BYTE switch is given, the number is a
  3002.           byte number (0 = first byte). If /LINE is given, the number is
  3003.           a line number (0 = first line). EOF means to move to the end of
  3004.           the file. LAST means to move to the last line or character of
  3005.           the file, depending on whether it's a line or character seek.
  3006.           
  3007.           If neither the /RELATIVE nor the /ABSOLUTE switch is given,
  3008.           then if a signed number is given, the motion is relative to the
  3009.           current position. An expression that evaluates to a negative
  3010.           number is not considered signed for this purpose; that is, a
  3011.           sign (+ or -) must be included as the first character of the
  3012.           number in the command itself to force a relative seek (in the
  3013.           absence of /RELATIVE or /ABSOLUTE).
  3014.           
  3015.           If the number has no sign, or if the /ABSOLUTE switch is given,
  3016.           the number represents an absolute position (relative to the
  3017.           beginning of the file). Subsequent FILE READs or WRITEs will
  3018.           take place at the new position.
  3019.           
  3020.           If the read/write pointer is placed after the end of the file,
  3021.           a subsequent FILE READ will fail, but a FILE WRITE will succeed
  3022.           (possibly creating a file with "holes"). If a FILE SEEK /BYTE
  3023.           command is given, the current line becomes unknown (unless the
  3024.           position is 0) and subsequent FILE SEEK /RELATIVE /LINE
  3025.           commands will fail until the next non-relative FILE SEEK /LINE
  3026.           command is given. Synonym: FSEEK.
  3027.           
  3028.    An absolute FILE SEEK to a negative position fails silently, as does a
  3029.    relative seek to a position before the beginning of the file.
  3030.    
  3031.    A caution about relative SEEKs: remember that the number is relative
  3032.    to the current position. Whenever you read or write, this changes the
  3033.    position. In each of the following examples, assume the file open on
  3034.    channel \%c is positioned at line n (the FREAD target variable is
  3035.    omitted for lack of space):
  3036.    
  3037.   { FREAD \%c, FSEEK /LINE \%c -1, FREAD \%c }  <-- Reads line n twice
  3038.   { FREAD \%c, FSEEK /LINE \%c +0, FREAD \%c }  <-- Reads lines n and n+1
  3039.   { FREAD \%c, FSEEK /LINE \%c +1, FREAD \%c }  <-- Reads lines n and n+2
  3040.   { FREAD \%c, FSEEK /LINE \%c -2, FREAD \%c }  <-- Reads lines n and n-1
  3041.   { FREAD \%c, FSEEK /LINE \%c -3, FREAD \%c }  <-- Reads lines n and n-2
  3042.  
  3043.    Another caution: Using FSEEK and FREAD /SIZE to repeatedly read the
  3044.    same disk block (e.g. when sampling a database record that is
  3045.    frequently updated) might not give you updated disk blocks due to the
  3046.    internal buffering and caching of the C library (this probably varies
  3047.    from one platform/compiler combination to another). If necessary you
  3048.    can force a fresh disk read with a close/open sequence:
  3049.    
  3050.   FCLOS \%c
  3051.   FOPEN \%c samefilename
  3052.   FSEEK \%c samespot
  3053.   FREAD /SIZE:howmanybytes \%c variable
  3054.      _________________________________________________________________
  3055.    
  3056.     1.22.3. FILE Command Examples
  3057.     
  3058.    To read the last 10 lines of a text file into an array:
  3059.    
  3060.   fopen /read \%c oofa.txt                ; Open the file
  3061.   if fail exit 1 Can't open oofa.txt      ; Always check for failure
  3062.   dcl \&a[10]                             ; Declare a 10-element array
  3063.   fcount /line \%c                        ; Count lines in the file
  3064.   fseek /line \%c \v(f_count)-10          ; Seek to 10 lines from the end
  3065.   if fail exit 1 Can't seek               ; Check for failure
  3066.   for \%i 1 10 1 { fread \%c \&a[\%i] }   ; Read the last 10 lines
  3067.   fclose \%c                              ; Close the file
  3068.  
  3069.    Note that blank lines show up as empty (undefined) array elements, for
  3070.    example if you give a "show array a" command at this point. This is
  3071.    normal. You can still use these elements; e.g.:
  3072.    
  3073.   for \%i 1 10 1 { echo \%i. \&a[\%i] }   ; Display the 10 lines
  3074.  
  3075.    Here is how to read the last line of a file (already open on channel
  3076.    \%c):
  3077.    
  3078.   fseek /line \%c last                    ; Seek directly to last line
  3079.  
  3080.    Alternatively:
  3081.    
  3082.   fseek /line \%c eof                     ; Seek to end of file
  3083.   fseek /line \%c -1                      ; Seek to beginning of last line
  3084.  
  3085.    Alternatively:
  3086.    
  3087.   fcount /line \%c                        ; Count the file's lines
  3088.   fseek /line \%c \v(f_count)-1           ; Seek to last line
  3089.   fread \%c                               ; Read it
  3090.  
  3091.    To read every other line from the file (using relative SEEK), skipping
  3092.    the first line:
  3093.    
  3094.   fopen /read \%c oofa.txt                ; Open the file
  3095.   while ( success ) {                     ; Loop through lines
  3096.       fseek /line \%c +1                  ; Skip a line
  3097.       if success fread \%c                ; Read & display a line
  3098.   }
  3099.   fclose \%c                              ; Close the file
  3100.  
  3101.    Here is how to read the lines of a file in reverse order:
  3102.    
  3103.   fopen /read \%c oofa.txt                ; Open
  3104.   if fail exit 1                          ; Check
  3105.   fseek /line \%c last                    ; Seek to last line
  3106.   while success {                         ; Loop
  3107.       fread \%c                           ; Read line
  3108.       fseek /line \%c -2                  ; Seek backwards two lines
  3109.   }
  3110.   fclose \%c                              ; Close the file
  3111.  
  3112.    The loop works because a relative SEEK outside the file fails.
  3113.    
  3114.    It is also possible to use block i/o to manage random-access files
  3115.    with fixed-length records (as long as they don't contain NUL
  3116.    characters). Suppose, for example, you have a file of "card image"
  3117.    records with fixed-field information about customers, such as:
  3118.    
  3119.   Name:     Columns  1-32  (column numbers are 1-based)
  3120.   Address:  Columns 33-72
  3121.   Balance:  Columns 73-80
  3122.  
  3123.    The records are indexed by customer number, starting with 0. There are
  3124.    no line terminators separating them. Therefore the record for customer
  3125.    number n starts at position nx 80 (\%n*80).
  3126.    
  3127.    Now suppose we received a payment from customer number 173 and want to
  3128.    update the balance:
  3129.    
  3130.   .\%n = 173                               ; Customer (record) number
  3131.   .\%a = 12.72                             ; Amount
  3132.   fopen /read /write \%c customer.db       ; Open the file
  3133.   if fail stop 1 OPEN FAILED: \f_errmsg()  ; Check
  3134.   fseek /byte \%c 80*\%n                   ; Seek to record
  3135.   fread /size:80 \%c r                     ; Read the record
  3136.   if fail stop 1 READ FAILED: \f_errmsg()  ; Check (IMPORTANT)
  3137.   .\%b := \fright(\m(r),8)                 ; Extract the balance
  3138.   .\%b := \ffpadd(\%b,\%a,2)               ; Add the new payment
  3139.   if fail stop 1 ARITHMETIC ERROR: \%b/\%a ; Catch bad records
  3140.   .r := {\fleft(\m(r),72)\flpad(\%b,8)}    ; Update the record
  3141.   fseek /byte \%c 80*\%n                   ; Reposition to same spot
  3142.   fwrite /size:80 \%c {\m(r)}              ; Replace the record
  3143.   if fail stop 1 WRITE FAILED: \f_errmsg() ; Check
  3144.   fclose \%c                               ; Close the file
  3145.  
  3146.    REMEMBER: Using FILE SEEK to move beyond the end of file can result in
  3147.    a file with holes when writing; when reading, an end-of-file error
  3148.    will occur -- be sure to check for it.
  3149.      _________________________________________________________________
  3150.    
  3151.     1.22.4. Channel Numbers
  3152.     
  3153.    C-Kermit's channel numbers are integers from 0 to some
  3154.    platform-dependent limit, such as 46 or 1985 (the value of \v(f_max)).
  3155.    This is the limit placed by the operating system on the number of
  3156.    files that may be opened by one process or user or job, minus the
  3157.    standard input, output, and error files, and minus the number of files
  3158.    reserved by C-Kermit for logs, OPEN READ and WRITE, and file transfer
  3159.    (and maybe some command files -- the \v(f_max) number can't be exact).
  3160.    
  3161.    Although you must include a variable in the FILE OPEN command, to
  3162.    which the channel number is assigned, you don't have to use a variable
  3163.    in the other FILE commands if you know what the number is -- you can
  3164.    just put the number. This saves you a few keystrokes when typing
  3165.    commands at the prompt:
  3166.    
  3167.   fopen \%c oofa.txt
  3168.   flist
  3169.   0. /usr/olga.oofa.txt (R) 0
  3170.  
  3171.    This tells the channel number is 0 (the number on the left is the
  3172.    channel file's channel number). Of course you can also find it by
  3173.    echoing the variable:
  3174.    
  3175.   echo \%c
  3176.   0
  3177.  
  3178.    Or with "fstatus \%c". Now you can type commands like:
  3179.    
  3180.   fread 0
  3181.  
  3182.    to read a line from the file. Obviously, however, using digits rather
  3183.    than a variable for the channel number would be poor practice in a
  3184.    script.
  3185.    
  3186.    If in commands like:
  3187.    
  3188.   fread \%c \%a
  3189.  
  3190.    you have trouble remembering which variable is which, note that the
  3191.    channel number is, indeed, a number. Anywhere C-Kermit accepts a
  3192.    number it can also accept an expression, so you can put parentheses
  3193.    around the channel number to remind you it's the channel number and
  3194.    not the variable into which data is to be read:
  3195.    
  3196.   fread (\%c) \%a
  3197.  
  3198.    Normally channel numbers are assigned sequentially as 0, 1, 2, ... up
  3199.    to the limit. However, once you start closing files, there can be
  3200.    holes in the sequence. New channels are assigned to fill in the holes.
  3201.    Thus you can't depend on channel numbers being in any particular
  3202.    sequence.
  3203.      _________________________________________________________________
  3204.    
  3205.     1.22.5. FILE Command Errors
  3206.     
  3207.    Each FILE command sets the variable \v(f_error) to one of the
  3208.    following values:
  3209.    
  3210.     0 = No error
  3211.    -1 = System error
  3212.    -2 = Attempt to read after end of file
  3213.    -3 = Channel not open
  3214.    -4 = Channel number out of range (negative or too large)
  3215.    -5 = Numeric argument (size, ...) out of range
  3216.    -6 = File not found
  3217.    -7 = Bad or missing filename
  3218.    -8 = Too many files are already open (FILE OPEN only)
  3219.    -9 = Forbidden operation (e.g. write to a read-only file)
  3220.   -10 = Access denied
  3221.   -11 = Illegal combination of OPEN modes (FILE OPEN only)
  3222.   -12 = Buffer overflow
  3223.   -13 = Current line number unknown (for relative line seeks)
  3224.   -14 through -98: Reserved.
  3225.   -99 = Requested operation not implemented in this version of C-Kermit
  3226.  -999 = Unknown error
  3227.  
  3228.    When \v(f_error) is -1, this means the FILE command failed because
  3229.    because of a system error, in which case you can examine the following
  3230.    variables:
  3231.    
  3232.   \v(errno)     = System error number.
  3233.   \v(errstring) = Error message corresponding to \v(errno).
  3234.  
  3235.    A special function is available for translating the \v(f_error) code
  3236.    to an error message string:
  3237.    
  3238. \f_errmsg([code])
  3239.   If the code is -1, returns error message of the most recent system
  3240.   error; otherwise if the code is a valid \v(f_error) value, the associated
  3241.   message is returned.  If the code is omitted, the status message
  3242.   corresponding to the current \v(f_error) value is returned.
  3243.  
  3244.    A FILE command that fails prints the appropriate error message
  3245.    automatically, except when the command is READ or SEEK and the error
  3246.    is -2 (end of file); in that case, the command still fails, but does
  3247.    not print a message. This allows constructions such as:
  3248.    
  3249.   fopen \%c oofa.txt
  3250.   while success { fread \%c }
  3251.   fclose \%c
  3252.  
  3253.    to work as expected, i.e. without an annoying message when the end of
  3254.    file is reached.
  3255.      _________________________________________________________________
  3256.    
  3257.     1.22.6. File I/O Variables
  3258.     
  3259.    The variables associated with the file i/o package are:
  3260.    
  3261.    \v(f_count)
  3262.           Result of the most recent FILE COUNT (FCOUNT) command.
  3263.           
  3264.    \v(f_error)
  3265.           Numeric error code of most recent FILE command (0 = no error).
  3266.           
  3267.    \v(f_max)
  3268.           Maximum number of files open simultaneously.
  3269.      _________________________________________________________________
  3270.    
  3271.     1.22.7. File I/O Functions
  3272.     
  3273.    Some of the FILE commands can also be issued as function calls, which
  3274.    makes script writing a bit more convenient, especially for C
  3275.    programmers. Also, several functions are provided that do not have
  3276.    command equivalents. Each of these functions takes a channel number as
  3277.    the first argument. These functions do not work for OPEN { READ,
  3278.    !READ, WRITE, !WRITE, and APPEND } files.
  3279.    
  3280.    \f_status(channel)
  3281.           Returns 0 if the channel is not open, otherwise a number
  3282.           between 1 and 15 which is the sum of the OPEN modes:
  3283.           
  3284.   1 = /READ
  3285.   2 = /WRITE
  3286.   4 = /APPEND
  3287.   8 = /BINARY
  3288.  
  3289.    The remaining functions work only for open channels. Each of these
  3290.    functions can fail for the applicable reasons listed in [379]Section
  3291.    1.22.5. For instructions on handling function errors, see [380]Section
  3292.    7.12.
  3293.    
  3294.    \f_pos(channel)
  3295.           Returns the file's current read/write pointer (0-based). There
  3296.           is no FILE command equivalent.
  3297.           
  3298.    \f_line(channel)
  3299.           Returns the file's current line number (0-based), if known,
  3300.           otherwise -1. There is no FILE command equivalent. The line
  3301.           number is known as long as no character or block i/o has been
  3302.           done on the channel.
  3303.           
  3304.    \f_handle(channel)
  3305.           Returns the "file handle" of the file. That is, it translates
  3306.           the portable C-Kermit channel number into a system-specific
  3307.           file handle or number that can be passed to other programs on
  3308.           the same platform. In UNIX this is a file descriptor. There is
  3309.           no FILE command equivalent.
  3310.           
  3311.    \f_eof(channel)
  3312.           Returns 1 if the read/write pointer of the file on the given
  3313.           channel is at the end of the file, 0 otherwise. Convenient in
  3314.           WHILE statements, e.g.:
  3315.           
  3316.     while not \f_eof(\%c) { fread \%c }
  3317.  
  3318.    \f_getchar(channel)
  3319.           Equivalent to FREAD /CHAR. Returns the character actually read.
  3320.           If \f_getchar() does not fail but the return value is empty,
  3321.           this means a NULL character was read.
  3322.           
  3323.    \f_getline(channel)
  3324.           Equivalent to FREAD /LINE. Returns the line actually read, but
  3325.           with the line terminator stripped. If \f_getline() does not
  3326.           fail but the return value is empty, this normally means an
  3327.           empty line was read.
  3328.           
  3329.    \f_getblock(channel,n)
  3330.           Equivalent to FREAD /SIZE:n. Returns the block of characters
  3331.           actually read. If the returned block is smaller than n, it
  3332.           indicates either that the end of file was reached or a NUL
  3333.           character is in the block.
  3334.           
  3335.    \f_putchar(channel,c)
  3336.           Equivalent to FWRITE /CHARACTER. Writes the character c. If c
  3337.           contains more than one character, only the first is written. If
  3338.           c is empty a NUL is written. Returns the number of characters
  3339.           written on success, or a negative error code upon failure.
  3340.           
  3341.    \f_putline(channel,string)
  3342.           Equivalent to FWRITE /LINE. Writes the string and adds the
  3343.           appropriate line termination character or sequence. If the
  3344.           string is empty or omitted, an empty line is written. Returns
  3345.           the number of characters written on success, or a negative
  3346.           error code upon failure.
  3347.           
  3348.    \f_putblock(channel,string)
  3349.           Equivalent to FWRITE /STRING. Writes the string as given. If
  3350.           the string is empty or omitted, nothing is written. Returns the
  3351.           number of characters written on success, or a negative error
  3352.           code upon failure.
  3353.      _________________________________________________________________
  3354.    
  3355.     1.22.8. File I/O Function Examples
  3356.     
  3357.   fopen /read \%c oofa.txt            ; Open our favorite file for reading
  3358.   if failure exit 1                   ; Check that it's open
  3359.   while not \f_eof(\%c) {             ; Loop until EOF
  3360.       .line := \f_getline(\%c)        ; Get a line
  3361.       if success echo {\m(line)}      ; Echo it
  3362.   }
  3363.   if not \f_eof(\%c) {                ; Check reason for loop exit
  3364.       exit 1 File Error: \f_errmsg()  ; If not EOF say so.
  3365.   }
  3366.  
  3367.   frewind \%c                         ; Rewind the file
  3368.   while not \f_eof(\%c) {             ; Same thing but with block i/o
  3369.       .block := \f_getblock(\%c,256)  ; (much faster than line i/o)
  3370.       if success xecho {\m(block)}
  3371.   }
  3372.  
  3373.   frewind \%c                         ; Rewind again
  3374.   while not \f_eof(\%c) {             ; Same deal but with character i/o
  3375.       .c := \f_getchar(\%c)           ; (much slower than line i/o)
  3376.       if success xecho {\m(c)}
  3377.   }
  3378.   close \%c
  3379.  
  3380.    To close all open files (equivalent to FCLOSE ALL):
  3381.    
  3382.   for \%i 0 \v(f_max)-1 1 {
  3383.       if \f_status(\%i) fclose \%i
  3384.   }
  3385.      _________________________________________________________________
  3386.    
  3387.   1.23. The EXEC Command
  3388.   
  3389.    The EXEC command is available only in UNIX.
  3390.    
  3391.    EXEC [ /REDIRECT ] command [ arg1 [ arg2 [ ... ] ]
  3392.           Runs the given command with the arguments in such a way that
  3393.           the command replaces C-Kermit in memory, and C-Kermit ceases to
  3394.           execute. EXEC is like RUN, except instead of returning to
  3395.           C-Kermit when finished, the command returns to whatever process
  3396.           invoked Kermit.
  3397.           
  3398.    In the normal case, no files are closed, so the EXEC'd command
  3399.    inherits the open files, read/write pointers, working directory,
  3400.    process ID, user ID (unless command is SUID), group ID (unless command
  3401.    is SGID), groups, etc. (In UNIX, the EXEC command is simply a front
  3402.    end for execvp().)
  3403.    
  3404.    If the /REDIRECT switch is included, then if a connection is open (SET
  3405.    LINE or SET HOST), it becomes the standard input and output of the
  3406.    EXEC'd program. If no connection is open, the /REDIRECT switch has no
  3407.    effect. For example to use C-Kermit for PPP dialing in Linux:
  3408.    
  3409.   set modem type usr          ; Specify the kind of modem you have
  3410.   set line /dev/ttyS1         ; Specify the device it's connected to
  3411.   set speed 57600             ; and the speed
  3412.   set flow rts/cts            ; and flow control.
  3413.   set dial retries 100        ; Try the dial sequence up to 100 times.
  3414.   dial {{9-212-555-1212}{9-212-555-1213}{9-212-555-1214}{9-212-555-1215}}
  3415.   if fail exit 1
  3416.   for \%i 1 16 1 {            ; Try up to 16 times to get login prompt
  3417.       input 10 Login:         ; Wait 10 sec for it to appear
  3418.       if success break        ; Got it - proceed...
  3419.       output \13              ; Send a carriage return and try again
  3420.   }
  3421.   if ( > \%i 16 ) stop 1 NO LOGIN PROMPT
  3422.   lineout \(myuserid)         ; Send user ID
  3423.   input 30 assword:           ; Wait for Password prompt
  3424.   if fail stop 1 NO PASSWORD PROMPT
  3425.   lineout \m(mypassword)      ; Send the password.
  3426.   exec /redirect pppd         ; Replace ourselves with pppd.
  3427.  
  3428.    In this example we assume that the script has already set up the
  3429.    myuserid and mypassword variables -- normally the password should be
  3430.    prompted for, rather than stored on disk. Notice the advantages over
  3431.    the well-known "chat script":
  3432.      * You don't have to control the modem itself with AT commands;
  3433.        Kermit's DIAL command does this for you.
  3434.      * You can have Kermit automatically redial as many times as you want
  3435.        until it gets a connection (if this is legal in your country).
  3436.      * You can have Kermit fetch the number or numbers from a dialing
  3437.        directory.
  3438.      * You can have Kermit cycle through a list of phone numbers (this is
  3439.        new in C-Kermit 7.0; see [381]Section 2.1.16) without having to
  3440.        enter the numbers in a dialing directory.
  3441.      * Dialing is location-independent; you can use the same script to
  3442.        dial from different areas or countries.
  3443.      * Once the connection is made, the full power of Kermit's script
  3444.        language is available to manage the dialog with the terminal
  3445.        server or other device that answers the phone call.
  3446.        
  3447.    NOTE: PPP and SLIP dialing are not available in Windows 95/98/NT/2000,
  3448.    whose APIs do not provide a method for an application to hand over a
  3449.    connection to the PPP or SLIP driver.
  3450.      _________________________________________________________________
  3451.    
  3452.   1.24. Getting Keyword Lists with '?'
  3453.   
  3454.    Suppose you type "te" at the C-Kermit> 6.0 prompt and then Esc or Tab
  3455.    to request keyword completion. Kermit beeps, indicating that more than
  3456.    one command starts with "te". But if you type '?' to see what they
  3457.    are, Kermit shows only "telnet". So why the beep? Because of invisible
  3458.    keywords like "telopt", "terminal", and "text". Lots of keywords are
  3459.    invisible because they are either synonyms for other keywords or else
  3460.    esoteric options to be used only in special circumstances, so we don't
  3461.    want them cluttering up the menus.
  3462.    
  3463.    But then there is no way for you to discover them. So in C-Kermit 7.0,
  3464.    if you type '?' AFTER the beginning of a keyword field, then invisible
  3465.    keywords are shown too:
  3466.    
  3467.   C-Kermit> te<Esc><BEEP>
  3468.   C-Kermit> te? Command, one of the following:
  3469.    telnet    telopt    terminal  text
  3470.   C-Kermit>te
  3471.  
  3472.    But if '?' is typed at the beginning of a field, only visible keywords
  3473.    are shown, as before (so, in this example, if '?' is typed at the
  3474.    C-Kermit> prompt, "telnet" is the only command shown that starts with
  3475.    "te").
  3476.      _________________________________________________________________
  3477.    
  3478.   2. MAKING AND USING CONNECTIONS The SET LINE, SET HOST, and SET PORT (a
  3479.   synonym for SET LINE) commands have new synonyms, in which the word SET is
  3480.   replaced by the word OPEN: OPEN LINE, etc. There is no new functionality
  3481.   here, but OPEN is a better verb, since SET generally takes no action, whereas
  3482.   these commands actually try to open a connection. Furthermore, there is the
  3483.   symmetry with CLOSE.
  3484.     ________________________________________________________________________
  3485.   
  3486.   2.0. SET LINE and SET HOST Command SwitchesThe SET LINE (SET PORT) and SET
  3487.   HOST commands now allow switches before the device or host name, in most
  3488.   cases, and under certain circumstances, also at the end. The new syntax is
  3489.   backwards compatible with the previous syntax; thus SET LINE, SET PORT, and
  3490.   SET HOST commands in command files written for C-Kermit 6.0 or earlier still
  3491.   work. The expanded syntax is:
  3492.   
  3493.   { OPEN, SET } { LINE, PORT, HOST } [ switches ] device-or-address [ switches
  3494.   ]
  3495.   
  3496.   The first group of switches is:
  3497.   
  3498.    /NETWORK-TYPE:{TCP/IP,X.25,PIPE,PTY...}
  3499.           When more than one network type is available, this lets you
  3500.           specify the type of network to use for this connection without
  3501.           affecting your global SET NETWORK TYPE. See [382]Section 2.7
  3502.           about pipes and ptys.
  3503.           
  3504.    /USERID:[string]
  3505.           This switch is equivalent to SET LOGIN USERID. If a string is
  3506.           given, it sent to host during Telnet negotiations; if this
  3507.           switch is given but the string is omitted, no user ID is sent
  3508.           to the host. If this switch is not given, your current LOGIN
  3509.           USERID (\v(userid) value), if any, is sent. Unlike most other
  3510.           switches, this one is "sticky", since the value must persist
  3511.           throughout the session in case the server requests the ID
  3512.           string at a later time.
  3513.           
  3514.    /CONNECT
  3515.           Enter CONNECT mode immediately and automatically after the
  3516.           device or connection is open. On serial devices, however, when
  3517.           CARRIER-WATCH is not OFF, wait up to 1 second for the Carrier
  3518.           Detect signal to appear before trying to connect, to give the
  3519.           device time to react DTR, which might have been off prior to
  3520.           opening the device.
  3521.           
  3522.    /SERVER
  3523.           Enter server mode immediately and automatically after the
  3524.           device or connection is open. Treatment of carrier is the same
  3525.           as for /CONNECT.
  3526.           
  3527.    /WAIT
  3528.           
  3529.    /NOWAIT
  3530.           For Telnet connections only: Like SET TELNET WAIT { ON, OFF },
  3531.           but applies only to this connection, and in fact applies only
  3532.           when OPENing this connection (which is usually the only place
  3533.           it matters). Typically you would use TELNET /NOWAIT to make a
  3534.           connection to a misbehaving Telnet server that does not reply
  3535.           to negotiations as required by the Telnet protocol definition.
  3536.           
  3537.    Note: /CONNECT and /SERVER switches are not available in the RLOGIN
  3538.    and TELNET commands, since these commands already include an implicit
  3539.    /CONNECT and preclude automatic entry into server mode.
  3540.    
  3541.    The /CONNECT and /SERVER switches are especially useful with "set host
  3542.    *" connections. For example, suppose you want to start a Kermit server
  3543.    on socket 3000 of your TCP host. Normally you would have to give the
  3544.    command:
  3545.    
  3546.   set host * 3000
  3547.  
  3548.    and then wait for a connection to come in, and only then could you
  3549.    give the SERVER command (or else define a macro to do this, and then
  3550.    execute the macro). Now you can do it in one step:
  3551.    
  3552.   set host /server * 3000
  3553.  
  3554.    This tells C-Kermit to wait for the connection and then enter server
  3555.    mode once it comes in, no matter how long it takes. Similarly, "set
  3556.    host /conn *" can be used to wait for a "chat" connection to come in.
  3557.    
  3558.    Another set of switches is available in VMS only, for use only with
  3559.    SET LINE:
  3560.    
  3561.    /SHARE
  3562.           Allows the SET LINE device to be opened in shared mode.
  3563.           Normally it makes no sense to open a serial device in shared
  3564.           mode, but it's necessary when C-Kermit is running in an
  3565.           environment such as DECIntact, that opens your job's
  3566.           controlling terminal in such a way that C-Kermit can't open it
  3567.           too, unless it enables SHARE privilege. Note: SHARE privilege
  3568.           is required.
  3569.           
  3570.    /NOSHARE
  3571.           Requires that the SET LINE device not be in use by any other
  3572.           process in order for it to be successfully opened by C-Kermit.
  3573.           If neither /SHARE nor /NOSHARE is specified, /NOSHARE is used.
  3574.           
  3575.    The second group of switches is:
  3576.    
  3577.    /NO-TELNET-INIT
  3578.           Do not send initial Telnet negotiations even if this is a
  3579.           Telnet port.
  3580.           
  3581.    /RAW-SOCKET
  3582.           This is a connection to a raw TCP socket ([383]Section 2.3.5).
  3583.           
  3584.    /RLOGIN
  3585.           Use Rlogin protocol even if this is not an Rlogin port.
  3586.           
  3587.    /TELNET
  3588.           Send initial Telnet negotiations even if this is not a Telnet
  3589.           port.
  3590.           
  3591.    As of C-Kermit 7.0 and K95 1.1.19, the TELNET command includes an
  3592.    implicit /TELNET switch. So if you TELNET to a non-TELNET port, Kermit
  3593.    sends initial Telnet negotiations. This makes sense, since that's what
  3594.    "telnet" means.
  3595.    
  3596.    If you want to make a connection to a non-Telnet port without sending
  3597.    initial Telnet negotiations, use:
  3598.    
  3599.   set host [ /connect ] name-or-address port
  3600.  
  3601.    or:
  3602.    
  3603.   telnet name-or-address port /no-telnet-init
  3604.  
  3605.    Additional switches might be added in the future; type "set host ?" or
  3606.    "set line ?" to see a current list.
  3607.      _________________________________________________________________
  3608.    
  3609.   2.1. Dialing
  3610.   
  3611.    Automatic redialing is illegal or restricted in many countries, so
  3612.    until C-Kermit 7.0, it was disabled by default, i.e. until a SET DIAL
  3613.    RETRIES command was given. In C-Kermit 7.0, if no SET DIAL RETRIES
  3614.    command has been given, a default is picked dynamically at DIAL time
  3615.    based on the calling country code, if known. At this writing, the only
  3616.    country code known to have no restrictions on automatic redialing is
  3617.    1. So in this case a limit of 10 is chosen; otherwise 1. If you have
  3618.    not given an explicit SET DIAL RETRIES command, SHOW DIAL shows the
  3619.    value as "(auto)", and then the value actually used is shown when you
  3620.    give the DIAL command.
  3621.    
  3622.    As of C-Kermit 7.0, automatic redialing is automatically canceled if
  3623.    the call could not be placed because no dialtone was detected.
  3624.      _________________________________________________________________
  3625.    
  3626.     2.1.1. The Dial Result Message
  3627.     
  3628.    If DIAL DISPLAY is not ON, the "Call complete" message now shows the
  3629.    modem's call result message, for example:
  3630.    
  3631.   Dialing: ...
  3632.   Call complete: "CONNECT 31200/ARQ/V32/LAPM/V42BIS"
  3633.  
  3634.    The exact format and contents of this message, of course, depends on
  3635.    the make, model, and configuration of your modem, so use your modem
  3636.    manual to interpret it. The call result message is also available in
  3637.    C-Kermit's \v(dialresult) variable.
  3638.    
  3639.   C-Kermit> echo \v(dialresult)
  3640.   CONNECT 31200/ARQ/V32/LAPM/V42BIS
  3641.   C-Kermit> echo Speed = \fword(\v(dialresult),2)
  3642.   Speed = 31200
  3643.   C-Kermit>
  3644.  
  3645.    Suppose your modem reports the modulation speed as shown above and you
  3646.    want to ensure your call is completed at (say) 24000 bps or more. You
  3647.    can use a little macro to do the job:
  3648.    
  3649. define HSDIAL {                ; High Speed DIAL
  3650.     local \%s
  3651.     if < \v(argc) 1 if not def \v(dialnumber) end 1 Usage: \%0 number
  3652.     set dial retries 100
  3653.     set dial interval 1
  3654.     while true {
  3655.         dial \%*
  3656.         if fail end 1 DIAL failed.
  3657.         asg \%s \fword(\v(dialresult),2)
  3658.         if def \%s if numeric \%s if not < \%s 24000 break
  3659.     }
  3660. }
  3661.  
  3662.    (See [384]Section 7.5 about the \%* variable.)
  3663.      _________________________________________________________________
  3664.    
  3665.     2.1.2. Long-Distance Dialing Changes
  3666.     
  3667.    Due to the glut of cell phones, pagers, fax machines, ISPs, etc, area
  3668.    codes and dialing rules are changing all the time. In the North
  3669.    American Numbering Plan (NANP) countries (USA, Canada, etc), area
  3670.    codes are split or overlayed with increasing frequency, and 10- and
  3671.    11-digit dialing is gradually becoming the norm for local calls.
  3672.    Changes are occurring In Europe, too, partly for these reasons and
  3673.    partly because of some new EC rules.
  3674.    
  3675.    In France, effective 18 October 1996, all calls, even local ones, must
  3676.    be dialed with an area code. French area codes are presently 1-digit
  3677.    numbers, 1-6, and the long-distance dialing prefix is 0. All calls
  3678.    within France are considered long distance and begin with 01, 02, ...,
  3679.    06.
  3680.    
  3681.    Effective 1 May 1997, all calls within the US state of Maryland, even
  3682.    local ones, must be dialed with an area code but without the
  3683.    long-distance prefix -- this is the now widely-known North American
  3684.    phenomenon of "ten digit dialing". The same is happening elsewhere --
  3685.    many cities in Florida adopted 10-digit dialing in 1998.
  3686.    
  3687.    In Italy beginning 19 June 1998, all calls to fixed (as opposed to
  3688.    mobile) numbers must be prefixed by 0. When calling into Italy from
  3689.    outside, the 0 must follow the country code (39). Calls to cell
  3690.    phones, however, must be placed without the 0. Then on 29 December
  3691.    2000, the 0 will become a 4 (for calling fixed numbers) and a prefix
  3692.    of 3 must used for calling mobile phones. More info at:
  3693.    http://www.telecomitalia.it/npnn/.
  3694.    
  3695.    In Spain, effective 4 April 1998, with hard cutover on 18 July 1998,
  3696.    all calls within the country must be dialed with 9 digits, and all
  3697.    calls from outside Spain must also be dialed with 9 digits (after the
  3698.    country code, 34). The new 9-digit numbers all begin with "9". More
  3699.    info at: [385]http://www.telefonica.es/cambiodenumeracion/
  3700.    
  3701.    Several new dialing features and commands have been added in version
  3702.    6.1 and 7.0 to address these changes.
  3703.    
  3704.    C-Kermit 6.0 and Kermit 95 1.1.11 and earlier handle the French
  3705.    situation via a reasonable subterfuge (setting the local area code to
  3706.    a nonexistent one), but did not handle "ten-digit dialing" well at
  3707.    all; the recommended technique was to change the long-distance dialing
  3708.    prefix to nothing, but this defeated Kermit's "list numbers for one
  3709.    name" feature when the numbers were in different locations. For
  3710.    example:
  3711.    
  3712.   set dial ld-prefix
  3713.   dial onlineservice
  3714.  
  3715.    where "onlineservice" is a dialing directory entry name corresponding
  3716.    to entries that are in (say) Maryland as well as other states, would
  3717.    not correctly dial the numbers not in Maryland.
  3718.    
  3719.    A new command lets you specify a list of area codes to be considered
  3720.    local, except that the area code must be dialed:
  3721.    
  3722.    SET DIAL LC-AREA-CODES [ areacode [ areacode [ areacode [ ... ] ] ] ]
  3723.           The list may include up to 32 area codes. If a number is called
  3724.           whose area code is in this list, it is dialed WITHOUT the
  3725.           long-distance prefix, but WITH the area code.
  3726.           
  3727.    So in Maryland, which (last time we looked) has two area codes, 410
  3728.    and 301, the setup would be:
  3729.    
  3730.   SET DIAL LC-AREA-CODES 410 301
  3731.  
  3732.    Example:
  3733.    
  3734.   SET DIAL LD-PREFIX 1
  3735.   SET DIAL AREA-CODE 301
  3736.   SET DIAL LC-AREA-CODES 410 301 <-- Area codes in 10-digit dialing region
  3737.   DIAL +1 (301) 765-4321         <-- Dials 3017654321  (local with area code)
  3738.   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
  3739.   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
  3740.  
  3741.    The SET DIAL LC-AREA-CODES command does not replace the SET DIAL
  3742.    AREA-CODE command. The latter specifies the area code you are dialing
  3743.    from. If the called number is in the same area code, then the area
  3744.    code is dialed if it is also in the LC-AREA-CODES list, and it is not
  3745.    dialed otherwise. So if "301" had not appeared in the LC-AREA-CODES
  3746.    list in the previous example:
  3747.    
  3748.   SET DIAL LD-PREFIX 1
  3749.   SET DIAL AREA-CODE 301
  3750.   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
  3751.   DIAL +1 (301) 765-4321         <-- Dials 7654321     (local)
  3752.   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
  3753.   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
  3754.  
  3755.    The new Kermit versions also add a Local Call Prefix and Local Call
  3756.    Suffix, in case you have any need for it. These are added to the
  3757.    beginning and of local phone numbers (i.e. numbers that are not
  3758.    long-distance or international). Examples:
  3759.    
  3760.   SET DIAL LD-PREFIX 1
  3761.   SET DIAL LC-PREFIX 9
  3762.   SET DIAL LC-SUFFIX *
  3763.   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
  3764.   SET DIAL AREA-CODE 301
  3765.   DIAL +1 (301) 765-4321         <-- Dials 97654321*     (local)
  3766.   DIAL +1 (410) 765-4321         <-- Dials 94107654321*  (local with area code)
  3767.   DIAL +1 (212) 765-4321         <-- Dials 12127654321   (long distance)
  3768.      _________________________________________________________________
  3769.    
  3770.     2.1.3. Forcing Long-Distance Dialing
  3771.     
  3772.    Suppose a number is in your country and area, but for some reason you
  3773.    need to dial it long-distance anyway (as is always the case in
  3774.    France). There have always been various ways to handle this:
  3775.    
  3776.     1. Temporarily set your area code to a different (or nonexistent or
  3777.        impossible) one (but this required knowledge of which area codes
  3778.        were nonexistent or impossible in each country).
  3779.     2. Dial the number literally instead of using the portable format,
  3780.        but this defeats the purpose of the portable dialing directory.
  3781.        
  3782.    Now there is also a new command that, very simply, can force
  3783.    long-distance dialing:
  3784.    
  3785.    SET DIAL FORCE-LONG-DISTANCE { ON, OFF }
  3786.           If a call is placed to a portable phone number within the same
  3787.           country code as the calling number, it is dialed with the
  3788.           long-distance prefix and the area code if FORCE-LONG-DISTANCE
  3789.           is ON. If OFF, the regular rules and procedures apply.
  3790.           
  3791.    Example (France):
  3792.    
  3793.   SET DIAL COUNTRY-CODE 33
  3794.   SET DIAL AREA-CODE 6
  3795.   SET DIAL FORCE-LONG-DISTANCE ON
  3796.  
  3797.    (In fact, SET DIAL COUNTRY-CODE 33 automatically sets DIAL
  3798.    FORCE-LONG-DISTANCE ON...)
  3799.    
  3800.    Example (USA, for a certain type of reverse-charge calling in which
  3801.    the called number must always be fully specified):
  3802.    
  3803.   SET DIAL PREFIX 18002666328$     ; 1-800-COLLECT
  3804.   SET DIAL COUNTRY-CODE 1
  3805.   SET DIAL AREA-CODE 212
  3806.   SET DIAL FORCE-LONG-DISTANCE ON
  3807.  
  3808.    Example (Toronto, where calls to exchange 976 within area code 416
  3809.    must be dialed as long distance, even when you are dialing from area
  3810.    code 416):
  3811.    
  3812.   SET DIAL COUNTRY-CODE 1
  3813.   SET DIAL AREA-CODE 416
  3814.   SET DIAL FORCE-LONG-DISTANCE ON
  3815.   DIAL +1 (416) 976-xxxx
  3816.  
  3817.    If dialing methods were consistent and sensible, of course it would be
  3818.    possible to always dial every domestic call as if it were long
  3819.    distance. But in many locations this doesn't work or if it does, it
  3820.    costs extra. The following macro can be used for dialing any given
  3821.    number with forced long-distance format:
  3822.    
  3823.   define LDIAL {
  3824.       local \%x
  3825.       set dial force-long-distance on
  3826.       dial \%*
  3827.       asg \%x \v(success)
  3828.       set dial force-long-distance off
  3829.       end \%x
  3830.   }
  3831.  
  3832.    (See [386]Section 7.5 about the \%* variable.)
  3833.      _________________________________________________________________
  3834.    
  3835.     2.1.4. Exchange-Specific Dialing Decisions
  3836.     
  3837.    This applies mainly to the North American Numbering Plan (NANP). Refer
  3838.    to the section "Alternative notations" in [387]Using C-Kermit 2nd
  3839.    Edition, pages 106-107, and the story about Toronto on page 110. Using
  3840.    the new LC-AREA-CODES list, we can address the problem by treating the
  3841.    exchange as part of the area code:
  3842.    
  3843.   SET DIAL LD-PREFIX 1
  3844.   SET DIAL AREA-CODE 416
  3845.   SET DIAL LC-AREA-CODES 905276
  3846.   DIAL +1 416 765 4321               <-- 7654321      (local)
  3847.   DIAL +1 905 276 4321               <-- 9052764321   (local with area code)
  3848.   DIAL +1 905 528 4321               <-- 19055284321  (long distance)
  3849.  
  3850.    The same technique can be used in Massachusetts (story at top of page
  3851.    111) and in any other place where dialing to some exchanges within a
  3852.    particular area code is local, but to others in the same area code is
  3853.    long distance.
  3854.      _________________________________________________________________
  3855.    
  3856.     2.1.5. Cautions about Cheapest-First Dialing
  3857.     
  3858.    Kermit does not maintain a knowledge base of telephony information; it
  3859.    only provides the tools to let you enter a phone number in a standard
  3860.    format and dial it correctly from any location in most cases.
  3861.    
  3862.    In particular, Kermit does not differentiate the charging method from
  3863.    the dialing method. If a call that is DIALED as long-distance (e.g.
  3864.    from 212 to 718 in country code 1) is not CHARGED as long distance, we
  3865.    have no way of knowing that without keeping a matrix of charging
  3866.    information for every area-code combination within every country, and
  3867.    any such matrix would be obsolete five minutes after it was
  3868.    constructed. Thus, "cheapest-first" sorting is only as reliable as our
  3869.    assumption that the charging method follows the dialing method. A good
  3870.    illustration would be certain online services that have toll-free
  3871.    dialup numbers which they charge you a premium (in your online service
  3872.    bill) for using.
  3873.      _________________________________________________________________
  3874.    
  3875.     2.1.6. Blind Dialing (Dialing with No Dialtone)
  3876.     
  3877.    C-Kermit's init string for Hayes-like modems generally includes an X4
  3878.    command to enable as many result codes as possible, so that Kermit can
  3879.    react appropriately to different failure reasons. One of the result
  3880.    codes that X4 enables is "NO DIALTONE". A perhaps not obvious side
  3881.    effect of enabling this result code that the modem must hear dialtone
  3882.    before it will dial.
  3883.    
  3884.    It is becoming increasingly necessary to force a modem to dial even
  3885.    though it does not hear a dialtone on the phone line; for example,
  3886.    with PBXs that have strange dialtones, or with phone systems in
  3887.    different countries, or with ISDN phones, etc. This is called "blind
  3888.    dialing".
  3889.    
  3890.    C-Kermit 7.0 has two new commands to cope with this situation:
  3891.    
  3892.    SET DIAL IGNORE-DIALTONE { ON, OFF }
  3893.           OFF (the default) means to tell the modem to wait for dialtone
  3894.           before dialing. ON means to enable "blind dialing", i.e. tell
  3895.           the modem NOT to wait for dialtone before dialing. Generally
  3896.           this is accomplished by sending ATX3 to the modem just prior to
  3897.           dialing. SET MODEM TYPE xxx and then SHOW MODEM displays
  3898.           Kermit's built-in "ignore dialtone" command.
  3899.           
  3900.    SET DIAL COMMAND IGNORE-DIALTONE text
  3901.           This lets you change the built-in ignore-dialtone command (such
  3902.           as ATX3) to whatever you choose, in case the built-in one does
  3903.           not work, or another command works better.
  3904.           
  3905.    Notes:
  3906.     1. The ignore-dialtone command is not sent unless SET DIAL
  3907.        IGNORE-DIALTONE is ON.
  3908.     2. The ATX3 command generally disables not only NO DIALTONE, but also
  3909.        BUSY. So this will prevent Kermit from detecting when the line is
  3910.        busy. This is a property of the modem, not of Kermit.
  3911.      _________________________________________________________________
  3912.    
  3913.     2.1.7. Trimming the Dialing Dialog
  3914.     
  3915.    The command:
  3916.    
  3917.   SET MODEM COMMAND action [ command ]
  3918.  
  3919.    is used to override Kermit's built-in modem commands for each action,
  3920.    for each kind of modem in its internal database. If you include a
  3921.    command, this is used instead of the built-in one. If you omit the
  3922.    command, this restores the original built-in command.
  3923.    
  3924.    If you want to omit the command altogether, so Kermit doesn't send the
  3925.    command at all, or wait for a response, use:
  3926.    
  3927.   SET MODEM COMMAND action {}
  3928.  
  3929.    That is, specify a pair of empty braces as the command, for example:
  3930.    
  3931.   SET MODEM COMMAND ERROR-CORRECTION ON {}
  3932.      _________________________________________________________________
  3933.    
  3934.     2.1.8. Controlling the Dialing Speed
  3935.     
  3936.    The rate at which characters are sent to the modem during dialing is
  3937.    normally controlled by the built-in modem database. You might want to
  3938.    override this if Kermit seems to be dialing too slowly, or it is
  3939.    sending characters to the modem faster than the modem handle them. A
  3940.    new command was added for this in C-Kermit 7.0:
  3941.    
  3942.    SET DIAL PACING number
  3943.           Specifies the number of milliseconds (thousandths of seconds)
  3944.           to pause between each character when sending commands to the
  3945.           modem during DIAL or ANSWER command execution. 0 means no pause
  3946.           at all, -1 (the default) or any other negative number means to
  3947.           use the value from the database. Any number greater than 0 is
  3948.           the number of milliseconds to pause.
  3949.           
  3950.    HINT: You might also need to control the rate at which the modem
  3951.    generates Touch Tones during dialing, for example when sending a
  3952.    numeric page. There are two ways to do this. One way is to insert
  3953.    pause characters into the dialing string. For modems that use the AT
  3954.    command set, the pause character is comma (,) and causes a 2-second
  3955.    pause. On most modems, you can use the S8 register to change the pause
  3956.    interval caused by comma in the dialing string. The other way is to
  3957.    set your modem's tone generation interval, if it has a command for
  3958.    that. Most AT-command-set modems use S11 for this; the value is in
  3959.    milliseconds. For example on USR modems:
  3960.    
  3961.   ATS11=200
  3962.  
  3963.    selects an interval of 200 milliseconds to separate each dialing tone.
  3964.    
  3965.    Hint: To add S-Register settings or other commands to your dialing
  3966.    procedure, use the new SET MODEM COMMAND PREDIAL-INIT command
  3967.    ([388]Section 2.2.2).
  3968.      _________________________________________________________________
  3969.    
  3970.     2.1.9. Pretesting Phone Number Conversions
  3971.     
  3972.    The LOOKUP command now accepts telephone numbers as well as
  3973.    directory-entry names, for example:
  3974.    
  3975.   LOOKUP +1 (212) 7654321
  3976.  
  3977.    When given a phone number, LOOKUP prints the result of converting the
  3978.    phone number for dialing under the current dialing rules. For example,
  3979.    if my country code is 1 and my area code is 212, and I am dialing out
  3980.    from a PBX whose outside-line prefix is "93,":
  3981.    
  3982.   C-Kermit> lookup +1 (212) 7654321
  3983.   +1 (212) 7654321 => 93,7654321
  3984.   C-Kermit>
  3985.  
  3986.    You can also use the \fdialconvert(phone-number) function
  3987.    ([389]Section 2.1.11) to do this programmatically:
  3988.    
  3989.   C-Kermit> echo "\fdialconvert(+1 (212) 7654321)"
  3990.   "93,7654321"
  3991.   C-Kermit>
  3992.  
  3993.    So the new LOOKUP behaves as follows:
  3994.    
  3995.    LOOKUP portable-format-phone-number
  3996.           Displays how the number would actually be dialed Sets FAILURE
  3997.           if there was a conversion error, otherwise SUCCESS.
  3998.           
  3999.    LOOKUP literal-format-phone-number
  4000.           Displays the same literal-format-phone-number Always sets
  4001.           SUCCESS.
  4002.           
  4003.    LOOKUP dialing-directory-name
  4004.           Displays all matching entries and converts portable phone
  4005.           numbers. Sets SUCCESS if at least one entry was found,
  4006.           otherwise FAILURE.
  4007.           
  4008.    LOOKUP =anything
  4009.           Displays "=anything" and sets SUCCESS.
  4010.           
  4011.    There is, at present, no programmatic way to fetch numbers from the
  4012.    dialing directory. This will be considered for a future release.
  4013.      _________________________________________________________________
  4014.    
  4015.     2.1.10. Greater Control over Partial Dialing
  4016.     
  4017.    The following rules now apply to partial dialing:
  4018.    
  4019.      * Phone number transformations based on country and area code,
  4020.        application of prefixes, etc, are performed only on the first
  4021.        PDIAL.
  4022.      * Each PDIAL argument is looked up in the dialing directory, so it
  4023.        is possible have directory entries for pieces of phone numbers or
  4024.        other information.
  4025.      * Suffixes are not applied automatically, since there is no way for
  4026.        C-Kermit to know in which PDIAL segment you want them to be
  4027.        applied.
  4028.        
  4029.    However, the suffix that *would* have been applied, based on the
  4030.    dialing rules that were invoked when processing the first PDIAL
  4031.    command, is stored in the variable:
  4032.    
  4033.   \v(dialsuffix)
  4034.  
  4035.    which you can include in any subsequent PDIAL or DIAL commands.
  4036.    
  4037.    Example:
  4038.    
  4039.   pdial {\m(my_long_distance_pager_number_part_1)}
  4040.   pdial {\m(my_long_distance_pager_number_part_2)}
  4041.   pdial {\v(dialsuffix)}
  4042.   pdial {\m(my_long_distance_pager_number_part_3)}
  4043.   pdial {@\m(numeric_pager_code)#}
  4044.      _________________________________________________________________
  4045.    
  4046.     2.1.11. New DIAL-related Variables and Functions
  4047.     
  4048.    \fdialconvert(s)
  4049.           s is a phone number in either literal or portable format (not a
  4050.           dialing directory entry name). The function returns the dial
  4051.           string that would actually be used by the DIAL command when
  4052.           dialing from the current location, after processing country
  4053.           code, area code, and other SET DIAL values, and should be the
  4054.           same as the result of LOOKUP when given a telephone number.
  4055.           
  4056.    \v(dialsuffix)
  4057.           Contains the suffix, if any, that was applied in the most
  4058.           recent DIAL command, or the suffix that would have been applied
  4059.           in the most recent PDIAL command. Use this variable to send the
  4060.           dial suffix at any desired point in a PDIAL sequence.
  4061.           
  4062.    \v(dialtype)
  4063.           A number indicating the type of call that was most recently
  4064.           placed. Can be used after a normal DIAL command, or after the
  4065.           first PDIAL command in a PDIAL sequence. Values are:
  4066.           
  4067.   -2: Unknown because TAPI handled the phone number translation.
  4068.   -1: Unknown because some kind of error occured.
  4069.    0: Internal within PBX.
  4070.    1: Toll-free.
  4071.    2: Local within calling area.
  4072.    3: Unknown (e.g. because a literal-format phone number was given).
  4073.    4: Long distance within country.
  4074.    5: International
  4075.  
  4076.    \v(dialcount)
  4077.           The current value of the DIAL retry counter, for use in a DIAL
  4078.           macro ([390]Section 2.1.13).
  4079.           
  4080.    \v(d$px)
  4081.           PBX Exchange (see [391]Section 2.1.12).
  4082.           
  4083.    Other dial-related variables, already documented in [392]Using
  4084.    C-Kermit (or other sections of this document, e.g. [393]Section
  4085.    2.1.1), include \v(dialnumber), \v(dialstatus), etc. A convenient way
  4086.    to display all of them is:
  4087.    
  4088.   show variable dial  ; hint: abbreviate "sho var dial"
  4089.  
  4090.    This shows the values of all the variables whose names start with
  4091.    "dial". Also "show variable d$" (to show the \v(d$...) variables).
  4092.      _________________________________________________________________
  4093.    
  4094.     2.1.12. Increased Flexibility of PBX Dialing
  4095.     
  4096.    Refer to [394]Using C-Kermit, 2nd Edition, pages 107-108. Recall that
  4097.    three commands are needed to configure C-Kermit for dialing from a
  4098.    PBX:
  4099.    
  4100.   SET DIAL PBX-EXCHANGE number
  4101.   SET DIAL PBX-INSIDE-PREFIX number
  4102.   SET DIAL PBX-OUTSIDE-PREFIX number
  4103.  
  4104.    Unfortunately, this model does not accommodate PBXs that have more
  4105.    than one exchange. For example our PBX at Columbia University (which
  4106.    must handle more than 10,000 phones) has 853-xxxx and 854-xxxx
  4107.    exchanges.
  4108.    
  4109.    Beginning in C-Kermit 7.0, the SET DIAL PBX-EXCHANGE command accepts a
  4110.    list of exchanges, e.g.:
  4111.    
  4112.   SET DIAL PBX-EXCHANGE 853 854
  4113.  
  4114.    (multiple exchanges are separated by spaces, not commas).
  4115.    
  4116.    So now when dialing a portable-format number that has the same country
  4117.    and area codes as those of your dialing location, C-Kermit compares
  4118.    the exchange of the dialed number with each number in the PBX Exchange
  4119.    list (rather than with a single PBX Exchange number, as it did
  4120.    formerly) to determine whether this is an internal PBX number or an
  4121.    external call. If it is an external call, then the PBX Outside Prefix
  4122.    is applied, and then the normal dialing rules for local or
  4123.    long-distance calls.
  4124.    
  4125.    If it is an inside call, the exchange is replaced by the PBX Inside
  4126.    Prefix. But if the PBX has more than one exchange, a single fixed PBX
  4127.    Inside Prefix is probably not sufficient. For example, at Columbia
  4128.    University, we must dial 3-xxxx for an internal call to 853-xxxx, but
  4129.    4-xxxx for a call to 854-xxxx. That is, the inside prefix is the final
  4130.    digit of the exchange we are dialing. For this reason, C-Kermit 7.0
  4131.    provides a method to determine the inside prefix dynamically at
  4132.    dialing time, consisting of a new variable and new syntax for the SET
  4133.    DIAL PBX-INSIDE-PREFIX command:
  4134.    
  4135.    \v(d$px)
  4136.           This variable contains the exchange that was matched when a PBX
  4137.           internal call was detected. For example, if the PBX exchange
  4138.           list is "853 854" and a call is placed to +1 (212) 854-9999,
  4139.           \v(d$px) is set to 854.
  4140.           
  4141.    SET DIAL PBX-INSIDE-PREFIX \fxxx(...)
  4142.           If the PBX Inside Prefix is defined to be a function, its
  4143.           evaluation is deferred until dialing time. Normally, this would
  4144.           be a string function having \v(d$px) as an operand. Of course,
  4145.           you can still specify a constant string, as before.
  4146.           
  4147.    So given the following setup:
  4148.    
  4149.   SET DIAL COUNTRY-CODE 1
  4150.   SET DIAL AREA-CODE 212
  4151.   SET DIAL PBX-OUTSIDE-PREFIX 93,
  4152.   SET DIAL PBX-EXCHANGE 853 854
  4153.   SET DIAL PBX-INSIDE-PREFIX \fright(\v(d$px),1)
  4154.  
  4155.    The following numbers give the results indicated:
  4156.    
  4157.  Number                   Result
  4158.   +1 (212) 854-9876        4-9876
  4159.   +1 (212) 853-1234        3-1234
  4160.   +1 (212) 765-4321        93,765-4321
  4161.   +1 (333) 765-4321        93,1333765-4321
  4162.  
  4163.    Furthermore, the K_PBX_XCH environment variable may now be set to a
  4164.    list of exchanges to automatically initialize C-Kermit's PBX exchange
  4165.    list, for example (in UNIX ksh or bash):
  4166.    
  4167.   export K_PBX_XCH="853 854"
  4168.  
  4169.    (Quotes required because of the space.) Of course, this variable can
  4170.    also be set to a single exchange, as before:
  4171.    
  4172.   export K_PBX_XCH=853
  4173.      _________________________________________________________________
  4174.    
  4175.     2.1.13. The DIAL macro - Last-Minute Phone Number Conversions
  4176.     
  4177.    After a DIAL or LOOKUP command is given, a list of phone numbers is
  4178.    assembled from the dialing directory (if any), with all
  4179.    location-dependent conversion rules applied as described in Chapter 5
  4180.    of [395]Using C-Kermit.
  4181.    
  4182.    However, additional conversions might still be required at the last
  4183.    minute based on local or ephemeral conditions. So that you can have
  4184.    the final word on the exact format of the dial string, C-Kermit 7.0
  4185.    lets you pass the converted string through a macro of your own design
  4186.    for final processing before dialing. The relevant command is:
  4187.    
  4188.    SET DIAL MACRO [ name ]
  4189.           Specifies the name of a macro to be run on each phone number
  4190.           after all built-in conversions have been applied, just before
  4191.           the number is dialed. If no name is given, no macro is run. The
  4192.           phone number, as it would have been dialed if there were no
  4193.           dial macro, is passed to the macro.
  4194.           
  4195.    The dial macro can do anything at all (except start a file transfer).
  4196.    However, the normal use for the macro would be to modify the phone
  4197.    number. For this reason the phone number is passed to the macro as
  4198.    argument number 1 (\%1). To cause a modified number to be dialed, the
  4199.    macro should terminate with a RETURN statement specifying a return
  4200.    value. To leave the number alone, the macro should simply end.
  4201.    Example:
  4202.    
  4203.   define xxx return 10108889999$\%1
  4204.   set dial macro xxx
  4205.   dial xyzcorp
  4206.  
  4207.    This defines a DIAL MACRO called xxx, which puts an access code on the
  4208.    front of the number. Another example might be:
  4209.    
  4210.   def xxx if equal "\v(modem)" "hayes-1200" return \freplace(\%1,$,{,,,,,})
  4211.   set dial macro xxx
  4212.   dial xyzcorp
  4213.  
  4214.    which replaces any dollar-sign in the dial string by a series of five
  4215.    commas, e.g. because this particular modem does not support the "wait
  4216.    for bong" feature (remember that commas that are to be included
  4217.    literally in function arguments must be enclosed in braces to
  4218.    distinguish them from the commas that separate the arguments) and when
  4219.    the IF condition is not satisfied, the macro does not return a value,
  4220.    and so the number is not modified. Then when a DIAL command is given
  4221.    referencing a dialing directory entry, "xyzcorp". The macro is
  4222.    automatically applied to each matching number.
  4223.    
  4224.    Numerous dial-, modem-, communications-, and time-related variables
  4225.    are available for decision making your dial macro. Type SHOW VARIABLES
  4226.    for a list. Of particular interest is the \v(dialcount) variable,
  4227.    which tells how many times the DIAL command gone through its retry
  4228.    loop: 1 on the first try, 2 on the second, 3 on the third, and so on,
  4229.    and the \v(dialresult) and \v(dialstatus) variables.
  4230.    
  4231.    Here are some other applications for the DIAL MACRO (from users):
  4232.    
  4233.      * Phone numbers in the dialing directory are formatted with '-' for
  4234.        readability, but some modems don't like the hyphens, so the DIAL
  4235.        macro is used to remove them before dialing; e.g
  4236.        0090-123-456-78-99 becomes 00901234567899: "def xxx return
  4237.        \freplace(\%1,-)".
  4238.      * To set some specific modem (or other) options depending on the
  4239.        called customer or telephone number.
  4240.      * Choosing the most appropriate provider based on (e.g.) time of
  4241.        day, or cycling through a list of providers in case some providers
  4242.        might be busy.
  4243.        
  4244.    To illustrate the final item, suppose you have a choice among many
  4245.    phone service providers; the provider is chosen by dialing an access
  4246.    code before the number. Different providers might be better (e.g.
  4247.    cheaper) for certain times of day or days of the week, or for dialing
  4248.    certain locations; you can use the DIAL macro to add the access for
  4249.    the most desirable provider.
  4250.    
  4251.    Similarly, when the same number might be reached through multiple
  4252.    providers, it's possible that one provider might not be able to
  4253.    complete the call, but another one can. In that case, you can use the
  4254.    DIAL macro to switch providers each time through the DIAL loop --
  4255.    that's where the \v(dialcount) variable comes in handy.
  4256.    
  4257.    The following command can be used to debug the DIAL macro:
  4258.    
  4259.    SET DIAL TEST { ON, OFF }
  4260.           Normally OFF, so the DIAL command actually dials. When ON, the
  4261.           DIAL command performs all lookups and number conversions, and
  4262.           then goes through the number list and retry loop, but instead
  4263.           of actually dialing, lists the numbers it would have called if
  4264.           none of the DIAL attempts succeeded (or more precisely, every
  4265.           number was always busy).
  4266.      _________________________________________________________________
  4267.    
  4268.     2.1.14. Automatic Tone/Pulse Dialing Selection
  4269.     
  4270.    SET DIAL METHOD { AUTO, DEFAULT, PULSE, TONE }
  4271.           Chooses the dialing method for subsequent calls.
  4272.           
  4273.    Prior to version 7.0, C-Kermit's DIAL METHOD was DEFAULT by default,
  4274.    meaning it does not specify a dialing method to the modem, but relies
  4275.    on the modem to have an appropriate default dialing method set. So,
  4276.    for example, when using Hayes compatible modems, the dial string would
  4277.    be something like ATD7654321, rather than ATDT7654321 or ATDP7654321.
  4278.    
  4279.    In C-Kermit 7.0 and K95 1.1.19, the dial method can be set from the
  4280.    environment variable:
  4281.    
  4282.   K_DIAL_METHOD
  4283.  
  4284.    when Kermit starts. The values can be TONE, PULSE, or DEFAULT, e.g.
  4285.    (UNIX):
  4286.    
  4287.   set K_DIAL_METHOD=TONE; export K_DIAL_METHOD
  4288.  
  4289.    In the absence of a K_DIAL_METHOD definition, the new default SET DIAL
  4290.    METHOD is AUTO rather than DEFAULT. When DIAL METHOD is AUTO and the
  4291.    local country code is known, then if tone dialing is universally
  4292.    available in the corresponding area, tone dialing is used; if dialing
  4293.    from a location where pulse dialing is mandatory, pulse dialing is
  4294.    used.
  4295.    
  4296.    The "tone country" and "pulse country" lists are preloaded according
  4297.    to our knowledge at the time of release. You can see their contents in
  4298.    the SHOW DIAL listing. You can change the lists with:
  4299.    
  4300.    SET DIAL TONE-COUNTRIES [ cc [ cc [ ... ] ] ]
  4301.           Replaces the current TONE-COUNTRIES list with the one given.
  4302.           Each cc is a country code; separate them with spaces (not
  4303.           commas). Example:
  4304.           
  4305.   set dial tone-countries 1 358 44 46 49
  4306.  
  4307.           If no country codes are given, the current list, if any, is
  4308.           removed, in which case SET DIAL METHOD AUTO is equivalent to
  4309.           SET DIAL METHOD DEFAULT.
  4310.           
  4311.    SET DIAL PULSE-COUNTRIES [ cc [ cc [ ... ] ] ]
  4312.           Replaces the current PULSE-COUNTRIES list with the one give.
  4313.           Syntax and operation is like SET DIAL TONE-COUNTRIES.
  4314.           
  4315.    If the same country code appears in both lists, Pulse takes
  4316.    precedence.
  4317.    
  4318.    The SET DIAL TONE- and PULSE-COUNTRIES commands perform no
  4319.    verification whatsoever on the cc's, since almost any syntax might be
  4320.    legal in some settings. Furthermore, there is no facility to edit the
  4321.    lists; you can only replace the whole list. However, since the only
  4322.    purpose of these lists is to establish a basis for picking tone or
  4323.    pulse dialing automatically, all you need to override the effect of
  4324.    the list is to set a specific dialing method with SET DIAL METHOD TONE
  4325.    or SET DIAL METHOD PULSE.
  4326.      _________________________________________________________________
  4327.    
  4328.     2.1.15. Dial-Modifier Variables
  4329.     
  4330.    As of C-Kermit 7.0, dial modifiers are available in the following
  4331.    variables:
  4332.    
  4333.  \v(dm_lp) Long pause
  4334.  \v(dm_sp) Short pause
  4335.  \v(dm_pd) Pulse dial
  4336.  \v(dm_td) Tone dial
  4337.  \v(dm_wa) Wait for answer
  4338.  \v(dm_wd) Wait for dialtone
  4339.  \v(dm_rc) Return to command mode
  4340.  
  4341.    You can use these in your dial strings in place of hardwired modifiers
  4342.    like "@", ",", etc, for increased portability of scripts. Example:
  4343.    
  4344.   C-Kermit>set modem type usrobotics
  4345.   C-Kermit>sho variables dm
  4346.    \v(dm_lp) = ,
  4347.    \v(dm_sp) = /
  4348.    \v(dm_pd) = P
  4349.    \v(dm_td) = T
  4350.    \v(dm_wa) = @
  4351.    \v(dm_wd) = W
  4352.    \v(dm_rc) = ;
  4353.   C-Kermit>exit
  4354.      _________________________________________________________________
  4355.    
  4356.     2.1.16. Giving Multiple Numbers to the DIAL Command
  4357.     
  4358.    Prior to C-Kermit 7.0, the only way to give a DIAL command a list of
  4359.    phone numbers to try until one answers was to create a dialing
  4360.    directory that had multiple entries under the same name, and then use
  4361.    that entry name in the DIAL command. Now a list of numbers can be
  4362.    given to the DIAL command directly in the following format:
  4363.    
  4364.   dial {{number1}{number2}{number3}...}
  4365.  
  4366.    This is the same list format used by SEND /EXCEPT: and other commands
  4367.    that allow a list where normally a single item is given. Restrictions
  4368.    on this form of the DIAL command are:
  4369.    
  4370.      * The first two braces must be adjacent; spacing is optional
  4371.        thereafter.
  4372.      * Each number must be an actual number to dial, not a dialing
  4373.        directory entry.
  4374.      * Dialing directory entries may not contain number lists in this
  4375.        format.
  4376.        
  4377.    In all other respects, the numbers are treated as if they had been
  4378.    fetched from the dialing directory; they can be in literal or portable
  4379.    format, etc. Example:
  4380.    
  4381.   dial {{7654321} {+1 (212) 5551212} { 1-212-5556789 }}
  4382.  
  4383.    The list can be any length at all, within reason.
  4384.    
  4385.    This feature is especially handy for use with the K95 Dialer, allowing
  4386.    a list of phone numbers to be specified in the Telephone Number box
  4387.    without having to set up or reference a separate dialing directory.
  4388.    
  4389.    You can also use it to add commonly-dialed sequences as variables in
  4390.    your C-Kermit customization file, e.g.:
  4391.    
  4392.   define work {{7654321}{7654322}{7654323}}
  4393.  
  4394.    and then:
  4395.    
  4396.   dial {\m(work)}
  4397.  
  4398.    (the variable name must be enclosed in braces).
  4399.    
  4400.    Or more simply:
  4401.    
  4402.   define work dial {{7654321}{7654322}{7654323}}
  4403.  
  4404.    and then:
  4405.    
  4406.   work
  4407.      _________________________________________________________________
  4408.    
  4409.   2.2. Modems
  4410.   
  4411.     2.2.1. New Modem Types
  4412.     
  4413.    Since C-Kermit 6.0:
  4414.    
  4415.   atlas-newcom-33600ifxC Atlas/Newcom 33600
  4416.   att-keepintouch        AT&T KeepinTouch PCMCIA V.32bis Card Modem
  4417.   att-1900-stu-iii       AT&T Secure Data STU-III Model 1900
  4418.   att-1910-stu-iii       AT&T Secure Data STU-III Model 1910
  4419.   bestdata               Best Data
  4420.   cardinal               Cardinal V.34 MVP288X series.
  4421.   compaq                 Compaq Data+Fax (e.g. in Presario)
  4422.   fujitsu                Fujitsu Fax/Modem Adapter
  4423.   generic-high-speed     Any modern error-correcting data-compressing modem
  4424.   itu-t-v25ter/v250      ITU-T (CCITT) V.25ter (V.250) standard command set
  4425.   megahertz-att-v34      Megahertz AT&T V.34
  4426.   megahertz-xjack        Megahertz X-Jack
  4427.   motorola-codex         Motorola Codex 326X Series
  4428.   motorola-montana       Motorola Montana
  4429.   mt5634zpx              Multitech MT5634ZPX
  4430.   rockwell-v90           Rockwell V.90 56K
  4431.   rolm-244pc             Siemens/Rolm 244PC (AT command set)
  4432.   rolm-600-series        Siemens/Rolm 600 Series (AT command set)
  4433.   spirit-ii              QuickComm Spirit II
  4434.   suprasonic             SupraSonic V288+
  4435.   supra-express-v90      Supra Express V.90
  4436.  
  4437.    One of the new types, "generic-high-speed" needs a bit of explanation.
  4438.    This type was added to easily handle other types that are not
  4439.    explicitly covered, without going through the bother of adding a
  4440.    complete user-defined modem type. This one works for modern modems
  4441.    that use the AT command set, on the assumption that all the default
  4442.    ("factory") settings of the modem (a) are appropriate for Kermit, (b)
  4443.    include error correction, data compression, and speed buffering; and
  4444.    (c) are recallable with the command AT&F.
  4445.    
  4446.    If the command to recall your modem's profile is not AT&F, use the SET
  4447.    MODEM COMMAND INIT-STRING command to specify the appropriate modem
  4448.    command. The default init-string is AT&F\13 (that is, AT, ampersand,
  4449.    F, and then carriage return); a survey of about 20 modern modem types
  4450.    shows they all support this, but they might mean different things by
  4451.    it. For example, the USR Sportster or Courier needs AT&F1 (not AT&F,
  4452.    which is equivalent to AT&F0, which recalls an inappropriate profile),
  4453.    so for USR modems:
  4454.    
  4455.   set modem type generic-high-speed
  4456.   set modem command init AT&F1\13
  4457.  
  4458.    Of course, USR modems already have their own built-in modem type. But
  4459.    if you use this one instead, it will dial faster because it has fewer
  4460.    commands to give to the modem; in that sense "&F1" is like a macro
  4461.    that bundles numerous commands into a single one. See your modem
  4462.    manual for details about factory profiles and commands to recall them.
  4463.    
  4464.    WARNING: Do not use the generic-high-speed modem type in operating
  4465.    systems like VMS where hardware flow control is not available, at
  4466.    least not unless you change the init string from AT&F\13 to something
  4467.    else that enables local Xon/Xoff or other appropriate type of flow
  4468.    control.
  4469.    
  4470.    Also see [396]Section 2.1.7 for additional hints about making dialing
  4471.    go faster.
  4472.      _________________________________________________________________
  4473.    
  4474.     2.2.2. New Modem Controls
  4475.     
  4476.    SET MODEM CAPABILITIES list
  4477.           In C-Kermit 7.0, this command automatically turns MODEM
  4478.           SPEED-MATCHING OFF if SB (Speed Buffering) is in the list, and
  4479.           turns it ON if SB is absent.
  4480.           
  4481.    SET MODEM COMMAND PREDIAL-INIT [ text ]
  4482.           Commands to be sent to the modem just prior to dialing.
  4483.           Normally none.
  4484.           
  4485.    SET MODEM SPEAKER { ON, OFF }
  4486.           Determines whether modem speaker is on or off while call is
  4487.           being placed. ON by default. Note: This command does not
  4488.           provide fine-grained control over when the speaker is on or
  4489.           off. Normally, ON means while the call is being placed, until
  4490.           the point at which carrier is successfully established. If your
  4491.           modem has a different speaker option that you want to choose,
  4492.           then use the SET MODEM COMMAND SPEAKER ON text command to
  4493.           specify this option.
  4494.           
  4495.    SET MODEM COMMAND SPEAKER { ON, OFF } [ text ]
  4496.           Specify or override the commands to turn your modem's speaker
  4497.           on and off.
  4498.           
  4499.    SET MODEM VOLUME { LOW, MEDIUM, HIGH }
  4500.           When MODEM SPEAKER is on, select volume. Note: In some modems,
  4501.           especially internal ones, these commands have no effect; this
  4502.           is a limitation of the particular modem, not of Kermit.
  4503.           
  4504.    SET MODEM COMMAND VOLUME { LOW, MEDIUM, HIGH } [ text ]
  4505.           Specify or override the commands to set your modem's speaker
  4506.           volume.
  4507.           
  4508.    SET MODEM COMMAND IGNORE-DIALTONE [ text ]
  4509.           The command to enable blind dialing ([397]Section 2.1.6).
  4510.           
  4511.    SET MODEM ESCAPE-CHARACTER code
  4512.           Has been augmented to allow codes of 0 or less: < 0 means the
  4513.           escape mechanism is disabled. = 0 means to use (restore) the
  4514.           default value from the modem database. > 0 and < 128 is a
  4515.           literal value to be used instead of the default one. > 127
  4516.           means the escape mechanism is disabled. This affects "modem
  4517.           hangup". When the escape mechanism is disabled, but SET MODEM
  4518.           HANGUP-METHOD is MODEM-COMMAND, it sends the hangup command
  4519.           immediately, without the <pause>+++<pause> business first. This
  4520.           is useful (for example) when sending lots of numeric pages, a
  4521.           process in which never we go online, and so never need to
  4522.           escape back. Eliminating the unnecessary pauses and escape
  4523.           sequence allows a lot more pages to be sent per unit time.
  4524.           
  4525.    Recall that C-Kermit can dial modems to which it is connected via
  4526.    TCP/IP (Telnet or Rlogin) as described on page 126 of [398]Using
  4527.    C-Kermit, 2nd Ed. In this case the MODEM HANGUP-METHOD should be
  4528.    MODEM-COMMAND, since RS-232 signals don't work over TCP/IP
  4529.    connections. As noted in the manual, such connections are set up by
  4530.    the following sequence:
  4531.    
  4532.   set host host [ port ]
  4533.   set modem type name
  4534.   dial number
  4535.  
  4536.    But this can cause complications when you use Kermit to switch between
  4537.    serial and TCP/IP connections. In the following sequence:
  4538.    
  4539.   set host name
  4540.   set modem type name
  4541.   set port name
  4542.  
  4543.    the first two commands obey the rules for dialing out over Telnet.
  4544.    However, the SET PORT command requires that Kermit close its current
  4545.    (Telnet) connection before it can open the serial port (since Kermit
  4546.    can only have one connection open at a time). But since a modem type
  4547.    was set after the "set host" command was given, Kermit assumes it is a
  4548.    Telnet dialout connection and so sends the modem's hangup sequence is
  4549.    sent to the Telnet host. To avoid this, close the network connection
  4550.    explicitly before opening the serial one:
  4551.    
  4552.   set host name
  4553.   close
  4554.   set modem type name
  4555.   set port name
  4556.      _________________________________________________________________
  4557.    
  4558.   2.3. TELNET and RLOGIN
  4559.   
  4560.    For additional background, please also read the [399]TELNET.TXT file,
  4561.    also available on the Web in [400]HTML format.
  4562.    
  4563.    Cautions:
  4564.    
  4565.      * If making a Telnet connection with C-Kermit takes a very long
  4566.        time, like over a minute, whereas the system Telnet program makes
  4567.        the same connection immediately, try including the /NOWAIT switch:
  4568.  
  4569.   C-Kermit> telnet /nowait hostname
  4570.        See [401]TELNET.TXT or [402]TELNET.HTM for details. If it also
  4571.        takes a very long time to make a Telnet connection with system
  4572.        Telnet, then the delay is most likely caused by reverse DNS
  4573.        lookups when your host is not properly registered in DNS.
  4574.      * When supplying numeric IP addresses to C-Kermit or to any other
  4575.        application (regular Telnet, Rlogin, etc), do not include leading
  4576.        0's in any fields unless you intend for those fields to be
  4577.        interpreted as octal (or hex) numbers. The description of the
  4578.        Internet address interpreter (the sockets library inet_addr()
  4579.        routine) includes these words:
  4580.        
  4581.      All numbers supplied as "parts" in a "." notation may be decimal,
  4582.      octal, or hexadecimal, as specified in the C language (that is, a
  4583.      leading 0x or 0X implies hexadecimal; otherwise, a leading 0
  4584.      implies octal; otherwise, the number is interpreted as decimal).
  4585.        To illustrate, 128.59.39.2 and 128.059.039.002 are not the same
  4586.        host! Even though most of the fields contain non-octal digits.
  4587.        Using system Telnet (not Kermit):
  4588.  
  4589.   $ telnet 128.059.039.002
  4590.   Trying 128.49.33.2 ...
  4591.        Of course the same thing happens with Kermit because it uses (as
  4592.        it must) the same system service for resolving network addresses
  4593.        that Telnet, FTP, and all other TCP/IP applications use.
  4594.      * The RLOGIN section on page 123 does not make it clear that you can
  4595.        use the SET TELNET TERMINAL-TYPE command to govern the terminal
  4596.        type that is reported by C-Kermit to the RLOGIN server.
  4597.      * Note that the SET TCP commands described on pages 122-123 might be
  4598.        absent; some platforms that support TCP/IP do not support these
  4599.        particular controls.
  4600.        
  4601.    New commands:
  4602.    
  4603.    TELOPT { AO, AYT, BREAK, CANCEL, EC, EL, EOF, EOR, GA, IP, DMARK,
  4604.           DO, DONT, NOP, SB, SE, SUSP, WILL, WONT }
  4605.           This command was available previously, but supported only DO,
  4606.           DONT, WILL, and WONT. Now it lets you send all the Telnet
  4607.           protocol commands. Note that certain commands do not require a
  4608.           response, and therefore can be used as nondestructive "probes"
  4609.           to see if the Telnet session is still open; e.g.:
  4610.           
  4611.   set host xyzcorp.com
  4612.   ...
  4613.   telopt nop
  4614.   if fail stop 1 Connection lost
  4615.  
  4616.    SET TCP ADDRESS [ ip-address ]
  4617.           Specifies the IP address of the computer that C-Kermit is
  4618.           running on. Normally this is not necessary. The exception would
  4619.           be if your machine has multiple network adapters (physical or
  4620.           virtual) with a different address for each adapter AND you want
  4621.           C-Kermit to use a specific address when making outgoing
  4622.           connections or accepting incoming connections.
  4623.           
  4624.    SET TCP DNS-SERVICE-RECORDS { ON, OFF }
  4625.           Tells C-Kermit whether to try to use DNS SRV records to
  4626.           determine the host and port number upon which to find an
  4627.           advertised service. For example, if a host wants regular Telnet
  4628.           connections redirected to some port other than 23, this feature
  4629.           allows C-Kermit to ask the host which port it should use. Since
  4630.           not all domain servers are set up to answer such requests, this
  4631.           feature is OFF by default.
  4632.           
  4633.    SET TCP REVERSE-DNS-LOOKUP { ON, OFF, AUTO }
  4634.           Tells Kermit whether to perform a reverse DNS lookup on TCP/IP
  4635.           connections. This allows Kermit to determine the actual
  4636.           hostname of the host it is connected to, which is useful for
  4637.           connections to host pools, and is required for Kerberos
  4638.           connections to host pools and for incoming connections. If the
  4639.           other host does not have a DNS entry, the reverse lookup could
  4640.           take a long time (minutes) to fail, but the connection will
  4641.           still be made. Turn this option OFF for speedier connections if
  4642.           you do not need to know exactly which host you are connected to
  4643.           and you are not using Kerberos. AUTO, the default, means the
  4644.           lookup is done on hostnames, but not on numeric IP addresses.
  4645.           
  4646.    SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF }
  4647.           Each Telnet option must be fully negotiated either On or Off
  4648.           before the session can continue. This is especially true with
  4649.           options that require sub-negotiations such as Authentication,
  4650.           Encryption, and Kermit; for proper support of these options
  4651.           Kermit must wait for the negotiations to complete. Of course,
  4652.           Kermit has no way of knowing whether a reply is delayed or not
  4653.           coming at all, and so will wait a minute or more for required
  4654.           replies before continuing the session. If you know that
  4655.           Kermit's Telnet partner will not be sending the required
  4656.           replies, you can set this option of OFF to avoid the long
  4657.           timeouts. Or you can instruct Kermit to REFUSE specific options
  4658.           with the SET TELOPT command.
  4659.           
  4660.    SET TELOPT [ { /CLIENT, /SERVER } ] option
  4661.           { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  4662.           [ { ACCEPTED, REFUSED, REQUESTED, REQUIRED } ]
  4663.           SET TELOPT lets you specify policy requirements for Kermit's
  4664.           handling of Telnet option negotiations. Setting an option is
  4665.           REQUIRED causes Kermit to offer the option to the peer and
  4666.           disconnect if the option is refused. REQUESTED causes Kermit to
  4667.           offer an option to the peer. ACCEPTED results in no offer but
  4668.           Kermit will attempt to negotiate the option if it is requested.
  4669.           REFUSED instructs Kermit to refuse the option if it is
  4670.           requested by the peer.
  4671.           
  4672.           Some options are negotiated in two directions and accept
  4673.           separate policies for each direction; the first keyword applies
  4674.           to Kermit itself, the second applies to Kermit's Telnet
  4675.           partner; if the second keyword is omitted, an appropriate
  4676.           (option-specific) default is applied. You can also include a
  4677.           /CLIENT or /SERVER switch to indicate whether the given
  4678.           policies apply when Kermit is the Telnet client or the Telnet
  4679.           server; if no switch is given, the command applies to the
  4680.           client.
  4681.           
  4682.           Note that some of Kermit's Telnet partners fail to refuse
  4683.           options that they do not recognize and instead do not respond
  4684.           at all. In this case it is possible to use SET TELOPT to
  4685.           instruct Kermit to REFUSE the option before connecting to the
  4686.           problem host, thus skipping the problematic negotiation.
  4687.           
  4688.           Use SHOW TELOPT to view current Telnet Option negotiation
  4689.           settings. SHOW TELNET displays current Telnet settings.
  4690.      _________________________________________________________________
  4691.    
  4692.     2.3.0. Bug Fixes
  4693.     
  4694.    If "set host nonexistent-host" was given (and it properly failed),
  4695.    followed by certain commands like SEND, the original line and modem
  4696.    type were not restored and C-Kermit thought that it still had a
  4697.    network hostname; fixed in 7.0.
  4698.    
  4699.     2.3.1. Telnet Binary Mode Bug Adjustments
  4700.     
  4701.    SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF } was added to edit 192
  4702.    after the book was printed. Also SET TELNET BUG BINARY-U-MEANS-ME-TOO.
  4703.    The default for both is OFF. ON should be used when communicating with
  4704.    a Telnet partner (client or server) that mistakenly believes that
  4705.    telling C-Kermit to enter Telnet binary mode also means that it, too,
  4706.    is in binary mode, contrary to the Telnet specification, which says
  4707.    that binary mode must be negotiated in each direction separately.
  4708.    
  4709.     2.3.2. VMS UCX Telnet Port Bug Adjustment
  4710.     
  4711.    A new command, SET TCP UCX-PORT-BUG, was added for VMS versions with
  4712.    UCX (DEC TCP/IP), applying only to early versions of UCX, like 2.2 or
  4713.    earlier. If you try to use VMS C-Kermit to make a Telnet connection
  4714.    using a port name (like "telnet", which is used by default), the
  4715.    underlying UCX getservbyname() function might return the service
  4716.    number with its bytes swapped and the connection will fail. If "telnet
  4717.    hostname 23" works, then your version of UCX has this bug and you can
  4718.    put "set tcp ucx-port-bug on" in your CKERMIT.INI file to get around
  4719.    it.
  4720.    
  4721.     2.3.3. Telnet New Environment Option
  4722.     
  4723.    The TELNET NEW-ENVIRONMENT option ([403]RFC 1572) is supported as 7.0.
  4724.    This option allows the C-Kermit Telnet client to send certain
  4725.    well-known variables to the Telnet server, including USER, PRINTER,
  4726.    DISPLAY, and several others. This feature is enabled by default in
  4727.    Windows and OS/2, disabled by default elsewhere. The command to enable
  4728.    and disable it is:
  4729.    
  4730.   SET TELNET ENVIRONMENT { ON, OFF }
  4731.  
  4732.    When ON, and you Telnet to another computer, you might (or might not)
  4733.    notice that the "login:" or "Username:" prompt does not appear --
  4734.    that's because your username was sent ahead, in which case the remote
  4735.    system might prompt you only for your password (similar to Rlogin).
  4736.    Use "set telnet environment off" to defeat this feature, particularly
  4737.    in scripts where the dialog must be predictable. You can also use this
  4738.    command to specify or override specific well-known environment
  4739.    variable values:
  4740.    
  4741.  SET TELNET ENVIRONMENT { ACCT,DISPLAY,JOB,PRINTER,SYSTEMTYPE,USER } [ text ]
  4742.  
  4743.     2.3.4. Telnet Location Option
  4744.     
  4745.    The TELNET LOCATION option ([404]RFC 779) is supported in 7.0. This
  4746.    option allows the C-Kermit Telnet client to send a location string to
  4747.    the server if the server indicates its willingness to accept one. If
  4748.    an environment variable named LOCATION exists at the time C-Kermit
  4749.    starts, its value is used as the location string. If you want to
  4750.    change it, use:
  4751.    
  4752.   SET TELNET LOCATION text
  4753.  
  4754.    If you omit the text from this command, the Telnet location feature is
  4755.    disabled.
  4756.    
  4757.    SET TELNET ENVIRONMENT DISPLAY is used to set the DISPLAY variable
  4758.    that is sent to the host, as well as the the XDISPLAY location.
  4759.    
  4760.     2.3.5. Connecting to Raw TCP Sockets
  4761.     
  4762.    The SET HOST and TELNET commands now accept an optional switch,
  4763.    /RAW-SOCKET, at the end, only if you first give a host and a port.
  4764.    Example:
  4765.    
  4766.   set host xyzcorp.com 23 /raw-socket
  4767.   set host 128.49.39.2:2000 /raw-socket
  4768.   telnet xyzcorp.com 3000 /raw
  4769.  
  4770.    Without this switch, C-Kermit behaves as a Telnet client when (a) the
  4771.    port is 23 or 1649, or (b) the port is not 513 and the server sent
  4772.    what appeared to be Telnet negotiations -- that is, messages starting
  4773.    with 0xFF (IAC). With this switch, Kermit should treat all incoming
  4774.    bytes as raw data, and will not engage in any Telnet negotiations or
  4775.    NVT CRLF manipulations. This allows transparent operation through
  4776.    (e.g.) raw TCP ports on Cisco terminal servers, through the 'modemd'
  4777.    modem server, etc.
  4778.    
  4779.     2.3.6. Incoming TCP Connections
  4780.     
  4781.    Accomplished via SET HOST * port, were introduced in C-Kermit 6.0, but
  4782.    for UNIX only. In Version 7.0, they are also available for VMS.
  4783.      _________________________________________________________________
  4784.    
  4785.   2.4. The EIGHTBIT Command
  4786.   
  4787.    EIGHTBIT is simply a shorthand for: SET PARITY NONE, SET TERMINAL
  4788.    BYTESIZE 8, SET COMMAND BYTESIZE 8; that is, a way to set up an 8-bit
  4789.    clean connection in a single command.
  4790.      _________________________________________________________________
  4791.    
  4792.   2.5. The Services Directory
  4793.   
  4794.    Chapter 7 of [405]Using C-Kermit does not mention the ULOGIN macro,
  4795.    which is used by our sample services directory, CKERMIT.KND. Unlike
  4796.    UNIXLOGIN, VMSLOGIN, etc, this one is for use with systems that
  4797.    require a user ID but no password. Therefore it doesn't prompt for a
  4798.    password or wait for a password prompt from the remote service.
  4799.    
  4800.    In version 7.0, the CALL macro was changed to not execute a SET MODEM
  4801.    TYPE command if the given modem type was the same as the current one;
  4802.    otherwise the new SET MODEM TYPE command would overwrite any
  4803.    customizations that the user had made to the modem settings. Ditto for
  4804.    SET LINE / SET PORT and SET SPEED.
  4805.      _________________________________________________________________
  4806.    
  4807.   2.6. Closing Connections
  4808.   
  4809.    Until version 7.0, there was never an obvious and general way to close
  4810.    a connection. If a serial connection was open, it could be closed by
  4811.    "set line" or "set port" (giving no device name); if a network
  4812.    connection was open, it could be closed by "set host" (no host name).
  4813.    
  4814.    In version 7.0, a new command closes the connection in an obvious and
  4815.    straightforward way, no matter what the connection type:
  4816.    
  4817.   CLOSE [ CONNECTION ]
  4818.  
  4819.    The CLOSE command was already present, and required an operand such as
  4820.    DEBUG-LOG, WRITE-FILE, etc, and so could never be given by itself. The
  4821.    new CONNECTION operand is now the default operand for CLOSE, so CLOSE
  4822.    by itself closes the connection, if one is open, just as you would
  4823.    expect, especially if you are a Telnet or Ftp user.
  4824.    
  4825.    Also see the description of the new SET CLOSE-ON-DISCONNECT command in
  4826.    [406]Section 2.10.
  4827.      _________________________________________________________________
  4828.    
  4829.   2.7. Using C-Kermit with External Communication Programs
  4830.   
  4831.    C-Kermit 7.0 includes a new ability to create and conduct sessions
  4832.    through other communications programs. Two methods are available:
  4833.    
  4834.     1. Pty (pseudoterminal): The external program is run on a
  4835.        "pseudoterminal", which is controlled by Kermit. This method works
  4836.        with practically any external program, but it is not portable. At
  4837.        this writing, it works only on some (not all) UNIX versions, and
  4838.        not on any non-UNIX platforms.
  4839.     2. Pipe: The external program's standard input and output are
  4840.        redirected through a "pipe" controlled by Kermit. This method is
  4841.        relatively portable -- it should work across all UNIX versions,
  4842.        and it also works in Windows and OS/2 -- but it is effective only
  4843.        when the external program actually uses standard i/o (and many
  4844.        don't).
  4845.        
  4846.    The two methods are started differently but are used the same way
  4847.    thereafter.
  4848.    
  4849.    The purpose of this feature is to let you use C-Kermit services like
  4850.    file transfer, character-set translation, scripting, automatic
  4851.    dialing, etc, on connections that Kermit can't otherwise make itself.
  4852.    
  4853.    This feature is the opposite of the REDIRECT feature, in which
  4854.    C-Kermit makes the connection, and redirects an external (local)
  4855.    command or program over this connection. In a pty or pipe connection,
  4856.    C-Kermit runs and controls a local command or program, which makes the
  4857.    connection. (The same method can be used to simply to control a local
  4858.    program without making a connection; see [407]Section 2.8.)
  4859.    
  4860.    To find out if your version of Kermit includes PTY support, type "show
  4861.    features" and look for NETPTY in the alphabetical list of options. For
  4862.    pipes, look for NETCMD.
  4863.    
  4864.    The commands are:
  4865.    
  4866.    SET NETWORK TYPE PTY or SET NETWORK TYPE PIPE
  4867.           
  4868.    SET HOST command
  4869.           where command is any interactive command. If the command does
  4870.           not use standard i/o, you must use SET NETWORK TYPE PTY.
  4871.           
  4872.    Notes:
  4873.    
  4874.      * COMMAND is an invisible synonym for PIPE.
  4875.      * The command and its arguments are case-sensitive in UNIX.
  4876.        
  4877.    The SET NETWORK TYPE, SET HOST sequence sets the given network type
  4878.    for all subsequent SET HOST commands until another SET NETWORK TYPE
  4879.    command is given to change it.
  4880.    
  4881.    You can also use the new /NETWORK-TYPE:PTY or /NETWORK-TYPE:PIPE (or
  4882.    simply /PIPE or /PTY) switches on the SET HOST command itself:
  4883.    
  4884.   SET HOST /NETWORK-TYPE:PIPE command  ; These two are the same
  4885.   SET HOST /PIPE command
  4886.  
  4887.   SET HOST /NETWORK-TYPE:PTY command   ; Ditto
  4888.   SET HOST /PTY command
  4889.  
  4890.    These are like SET NETWORK TYPE followed by SET HOST, except they
  4891.    apply only to the connection being made and do not change the global
  4892.    network type setting (see [408]Section 1.5 about the difference
  4893.    between switches and SET commands).
  4894.    
  4895.    Include any command-line options with the command that might be
  4896.    needed, as in this example where C-Kermit uses another copy of itself
  4897.    as the communications program:
  4898.    
  4899.   SET HOST /PIPE /CONNECT kermit -YQJ xyzcorp.com
  4900.  
  4901.    As usual, if you include the /CONNECT switch, SET HOST enters CONNECT
  4902.    mode immediately upon successful execution of the given command.
  4903.    Therefore new commands are available as a shorthand for SET HOST
  4904.    /CONNECT /PTY and /PIPE:
  4905.    
  4906.    PTY [ command ]
  4907.           
  4908.    PIPE [ command ]
  4909.           The PTY and PIPE commands work like the TELNET and RLOGIN
  4910.           commands: they set up the connection (in this case, using the
  4911.           given command) and then enter CONNECT mode automatically (if
  4912.           the PIPE or PTY command is given without a command, it
  4913.           continues the current session if one is active; otherwise it
  4914.           gives an error message).
  4915.           
  4916.    The PIPE command is named after the mechanism by which C-Kermit
  4917.    communicates with the command: UNIX pipes. C-Kermit's i/o is "piped"
  4918.    through the given command. Here is a typical example:
  4919.    
  4920.   PIPE rlogin -8 xyzcorp.com
  4921.  
  4922.    This is equivalent to:
  4923.    
  4924.   SET HOST /PIPE rlogin -8 xyzcorp.com
  4925.   CONNECT
  4926.  
  4927.    and to:
  4928.    
  4929.   SET HOST /PIPE /CONNECT rlogin -8 xyzcorp.com
  4930.  
  4931.    IMPORTANT:
  4932.           If you are writing a script, do not use the PIPE, PTY, TELNET,
  4933.           or RLOGIN command unless you really want C-Kermit to enter
  4934.           CONNECT mode at that point. Normally SET HOST is used in
  4935.           scripts to allow the login and other dialogs to be controlled
  4936.           by the script itself, rather than by an actively participating
  4937.           human at the keyboard.
  4938.           
  4939.    Throughput of pty and pipe connections is limited by the performance
  4940.    of the chosen command or program and by the interprocess communication
  4941.    (IPC) method used and/or buffering capacity of the pipe or pty, which
  4942.    in turn depends on the underlying operating system.
  4943.    
  4944.    In one trial (on SunOS 4.1.3), we observed file transfer rates over an
  4945.    rlogin connection proceeding at 200Kcps for downloads, but only 10Kcps
  4946.    for uploads on the same connection with the same settings (similar
  4947.    disparities were noted in HP-UX). Examination of the logs revealed
  4948.    that a write to the pipe could take as long as 5 seconds, whereas
  4949.    reads were practically instantaneous. On the other hand, using Telnet
  4950.    as the external program rather than rlogin, downloads and uploads were
  4951.    better matched at about 177K each.
  4952.    
  4953.    Most external communication programs, like C-Kermit itself, have
  4954.    escape characters or sequences. Normally these begin with (or consist
  4955.    entirely of) a control character. You must be sure that this control
  4956.    character is not "unprefixed" when uploading files, otherwise the
  4957.    external program will "escape back" to its prompt, or close the
  4958.    connection, or take some other unwanted action. When in CONNECT mode,
  4959.    observe the program's normal interaction rules. Of course C-Kermit's
  4960.    own escape character (normally Ctrl-\) is active too, unless you have
  4961.    taken some action to disable it.
  4962.    
  4963.    On PTY connections, the underlying PTY driver is not guaranteed to be
  4964.    transparent to control characters -- for example, it might expand
  4965.    tabs, translate carriage returns, generate signals if it sees an
  4966.    interrupt character, and so on. Similar things might happen on a PIPE
  4967.    connection. For this reason, if you plan to transfer files over a PTY
  4968.    or PIPE connection, tell the file sender to:
  4969.    
  4970.    SET PREFIXING ALL
  4971.           This causes all control characters to be prefixed and
  4972.           transmitted as printable ASCII characters.
  4973.           
  4974.    If the external connection program is not 8-bit clean, you should
  4975.    also:
  4976.    
  4977.    SET PARITY SPACE
  4978.           This causes 8-bit data to be encoded in 7 bits using single
  4979.           and/or locking shifts.
  4980.           
  4981.    And if it does not make a reliable connection (such as those made by
  4982.    Telnet, Rlogin, Ssh, etc), you should:
  4983.    
  4984.    SET STREAMING OFF
  4985.           This forces C-Kermit to treat the connection as unreliable and
  4986.           to engage in its normal ACK/NAK protocol for error detection
  4987.           and correction, rather than "streaming" its packets, as it
  4988.           normally does on a network connection ([409]Section 4.20).
  4989.           
  4990.    In some cases, buffer sizes might be restricted, so you might also
  4991.    need to reduce the Kermit packet length to fit; this is a
  4992.    trial-and-error affair. For example, if transfers always fail with
  4993.    4000-byte packets, try 2000. If that fails too, try 1000, and so on.
  4994.    The commands are:
  4995.    
  4996.    SET RECEIVE PACKET-LENGTH number
  4997.           This tells the file receiver to tell the file sender the
  4998.           longest packet length it can accept.
  4999.           
  5000.    SET SEND PACKET-LENGTH number
  5001.           This tells the file sender not to send packets longer than the
  5002.           given length, even if the receiver says longer ones are OK. Of
  5003.           course, if the receiver's length is shorter, the shorter length
  5004.           is used.
  5005.           
  5006.    If none of this seems to help, try falling back to the bare minimum,
  5007.    lowest-common-denominator protocol settings:
  5008.    
  5009.    ROBUST
  5010.           No sliding windows, no streaming, no control-character
  5011.           unprefixing, packet length 90.
  5012.           
  5013.    And then work your way back up by trial and error to get greater
  5014.    throughput.
  5015.    
  5016.    Note that when starting a PIPE connection, and the connection program
  5017.    (such as telnet or rlogin) prints some greeting or information
  5018.    messages before starting the connection, these are quite likely to be
  5019.    printed with a stairstep effect (linefeed without carriage return).
  5020.    This is because the program is not connected with the UNIX terminal
  5021.    driver; there's not much Kermit can do about it. Once the connection
  5022.    is made, everything should go back to normal. This shouldn't happen on
  5023.    a PTY connection because a PTY is, indeed, a terminal.
  5024.    
  5025.    On a similar note, some connection programs (like Solaris 2.5 rlogin)
  5026.    might print lots of error messages like "ioctl TIOCGETP: invalid
  5027.    argument" when used through a pipe. They are annoying but usually
  5028.    harmless. If you want to avoid these messages, and your shell allows
  5029.    redirection of stderr, you can redirect stderr in your pipe command,
  5030.    as in this example where the user's shell is bash:
  5031.    
  5032.   PIPE rlogin xyzcorp.com 2> /dev/null
  5033.  
  5034.    Or use PTY rather than PIPE, since PTY is available on Solaris.
  5035.      _________________________________________________________________
  5036.    
  5037.     2.7.0. C-Kermit over tn3270 and tn5250
  5038.     
  5039.    Now you can make a connection from C-Kermit "directly" to an IBM
  5040.    mainframe and transfer files with it, assuming it has Kermit-370
  5041.    installed. Because tn3270 is neither 8-bit clean nor transparent to
  5042.    control characters, you must give these commands:
  5043.    
  5044.   SET PREFIXING ALL   ; Prefix all control characters
  5045.   SET PARITY SPACE    ; Telnet connections are usually not 8-bit clean
  5046.  
  5047.    and then:
  5048.    
  5049.   SET HOST /PTY /CONNECT tn3270 abccorp.com
  5050.  
  5051.    or simply:
  5052.    
  5053.   pty tn3270 abccorp.com
  5054.  
  5055.    SET HOST /PIPE does not work in this case, at least not for file
  5056.    transfer. File transfer does work, however, with SET HOST /PTY,
  5057.    provided you use the default packet length of 90 bytes; anything
  5058.    longer seems to kill the session.
  5059.    
  5060.    You can also make connections to IBM AS/400 computers if you have a
  5061.    tn5250 program installed:
  5062.    
  5063.   pty tn5250 hostname
  5064.  
  5065.    In this case, however, file transfer is probably not in the cards
  5066.    since nobody has ever succeeded in writing a Kermit program for the
  5067.    AS/400. Hint:
  5068.    
  5069.   define tn3270 {
  5070.       check pty
  5071.       if fail end 1 Sorry - no PTY support...
  5072.       pty tn3270 \%*
  5073.   }
  5074.  
  5075.    Similarly for tn5250. Note that CHECK PTY and CHECK PIPE can be used
  5076.    in macros and scripts to test whether PTY or PIPE support is
  5077.    available.
  5078.      _________________________________________________________________
  5079.    
  5080.     2.7.1. C-Kermit over Telnet
  5081.     
  5082.    Although C-Kermit includes its own Telnet implementation, you might
  5083.    need to use an external Telnet program to make certain connections;
  5084.    perhaps because it has access or security features not available in
  5085.    C-Kermit itself. As noted above, the only precautions necessary are
  5086.    usually:
  5087.    
  5088.   SET PREFIXING ALL   ; Prefix all control characters
  5089.   SET PARITY SPACE    ; Telnet connections might not be 8-bit clean
  5090.  
  5091.    and then:
  5092.    
  5093.   SET HOST /PTY (or /PIPE) /CONNECT telnet abccorp.com
  5094.  
  5095.    or, equivalently:
  5096.    
  5097.   PTY (or PIPE) telnet abccorp.com
  5098.      _________________________________________________________________
  5099.    
  5100.     2.7.2. C-Kermit over Rlogin
  5101.     
  5102.    C-Kermit includes its own Rlogin client, but this can normally be used
  5103.    only if you are root, since the rlogin TCP port is privileged. But
  5104.    ptys and pipes let you make rlogin connections with C-Kermit through
  5105.    your computer's external rlogin program, which is normally installed
  5106.    as a privileged program:
  5107.    
  5108.   SET PREFIXING ALL
  5109.  
  5110.    and then:
  5111.    
  5112.   SET HOST /PTY (or /PIPE) /CONNECT rlogin -8 abccorp.com
  5113.  
  5114.    or, equivalently:
  5115.    
  5116.   PTY (or PIPE) rlogin -8 abccorp.com
  5117.  
  5118.    The "-8" option to rlogin enables transmission of 8-bit data. If this
  5119.    is not available, then include SET PARITY SPACE if you intend to
  5120.    transfer files.
  5121.    
  5122.    Note that the normal escape sequence for rlogin is Carriage Return
  5123.    followed by Tilde (~), but only when the tilde is followed by certain
  5124.    other characters; the exact behavior depends on your rlogin client, so
  5125.    read its documentation.
  5126.      _________________________________________________________________
  5127.    
  5128.     2.7.3. C-Kermit over Serial Communication Programs
  5129.     
  5130.    Ptys and pipes also let you use programs that make serial connections,
  5131.    such as cu or tip. For example, C-Kermit can be used through cu to
  5132.    make connections that otherwise might not be allowed, e.g. because
  5133.    C-Kermit is not installed with the required write permissions to the
  5134.    dialout device and the UUCP lockfile directory.
  5135.    
  5136.    Suppose your UUCP Devices file contains an entry for a serial device
  5137.    tty04 to be used for direct connections, but this device is protected
  5138.    against you (and Kermit when you run it). In this case you can:
  5139.    
  5140.   SET CONTROL PREFIX ALL
  5141.   PTY (or PIPE) cu -l tty04
  5142.  
  5143.    (Similarly for dialout devices, except then you also need to include
  5144.    the phone number in the "cu" command.)
  5145.    
  5146.    As with other communication programs, watch out for cu's escape
  5147.    sequence, which is the same as the rlogin program's: Carriage Return
  5148.    followed by Tilde (followed by another character to specify an action,
  5149.    like "." for closing the connection and exiting from cu).
  5150.      _________________________________________________________________
  5151.    
  5152.     2.7.4. C-Kermit over Secure Network Clients
  5153.     
  5154.      DISCLAIMER: There are laws in the USA and other countries regarding
  5155.      use, import, and/or export of encryption and/or decryption or other
  5156.      forms of security software, algorithms, technology, and
  5157.      intellectual property. The Kermit Project attempts to follow all
  5158.      known statutes, and neither intends nor suggests that Kermit
  5159.      software can or should be used in any way, in any location, that
  5160.      circumvents any regulations, laws, treaties, covenants, or other
  5161.      legitimate canons or instruments of law, international relations,
  5162.      trade, ethics, or propriety.
  5163.      
  5164.    For secure connections or connections through firewalls, C-Kermit 7.0
  5165.    can be a Kerberos, SRP, and/or SOCKS client when built with the
  5166.    appropriate options and libraries. But other application-level
  5167.    security acronyms and methods -- SSH, SSL, SRP, TLS -- pop up at an
  5168.    alarming rate and are (a) impossible to keep up with, (b) usually
  5169.    mutually incompatible, and (c) have restrictions on export or
  5170.    redistribution and so cannot be included in C-Kermit itself.
  5171.    
  5172.    However, if you have a secure text-based Telnet (or other) client that
  5173.    employs one of these security methods, you can use C-Kermit "through"
  5174.    it via a pty or pipe.
  5175.      _________________________________________________________________
  5176.    
  5177.     2.7.4.1. SSH
  5178.     
  5179.    C-Kermit does not and can not incorporate SSH due to licensing,
  5180.    patent, and USA export law restrictions.
  5181.    
  5182.    The UNIX SSH client does not use standard input/output, and therefore
  5183.    can be used only by Kermit's PTY interface, if one is present. The
  5184.    cautions about file transfer, etc, are the same as for Rlogin.
  5185.    Example:
  5186.    
  5187.   SET PREFIXING ALL
  5188.   PTY ssh XYZCORP.COM
  5189.  
  5190.    Or, for a scripted session:
  5191.    
  5192.   SET PREFIXING ALL
  5193.   SET HOST /PTY ssh XYZCORP.COM
  5194.  
  5195.    Hint:
  5196.    
  5197.   define ssh {
  5198.       check pty
  5199.       if fail end 1 Sorry - no PTY support...
  5200.       pty ssh \%*
  5201.   }
  5202.      _________________________________________________________________
  5203.    
  5204.     2.7.4.2. SSL
  5205.     
  5206.    Secure Sockets Layer (SSL) is another TCP/IP security overlay, this
  5207.    one designed by and for Netscape. An SSL Telnet client is available
  5208.    for UNIX from the University of Queensland. More info at:
  5209.    
  5210.   [410]http://www.psy.uq.oz.au/~ftp/Crypto/
  5211.  
  5212.    Interoperability with C-Kermit is unknown. C-Kermit also includes its
  5213.    own built-in SSL/TLS support, but it is not exportable; [411]CLICK
  5214.    HERE file for details.
  5215.      _________________________________________________________________
  5216.    
  5217.     2.7.4.3. SRP
  5218.     
  5219.    SRP(TM) is Stanford University's Secure Remote Password protocol. An
  5220.    SRP Telnet client is available from Stanford:
  5221.    
  5222.   [412]http://srp.stanford.edu/srp/
  5223.  
  5224.    Stanford's SRP Telnet client for UNIX has been tested on SunOS and
  5225.    works fine with C-Kermit, as described in [413]Section 2.7.1, e.g.
  5226.    
  5227.   SET PREFIX ALL
  5228.   PTY (or PIPE) srp-telnet xenon.stanford.edu
  5229.  
  5230.    C-Kermit itself can be built as an SRP Telnet client on systems that
  5231.    have libsrp.a installed; the C-Kermit support code, however, may not
  5232.    be exported outside the USA or Canada.
  5233.      _________________________________________________________________
  5234.    
  5235.     2.7.4.4. SOCKS
  5236.     
  5237.    C-Kermit can be built as a SOCKS-aware client on systems that have a
  5238.    SOCKS library. See section 8.1.1 of the [414]ckccfg.txt file.
  5239.    
  5240.    C-Kermit 7.0 can also be run over SOCKSified Telnet or rlogin clients
  5241.    with SET NETWORK TYPE COMMAND. Suppose the Telnet program on your
  5242.    system is SOCKS enabled but C-Kermit is not. Make Kermit connections
  5243.    like this:
  5244.    
  5245.   SET PREFIX ALL
  5246.   PTY (or PIPE) telnet zzz.com
  5247.      _________________________________________________________________
  5248.    
  5249.     2.7.4.5. Kerberos
  5250.     
  5251.    UNIX C-Kermit can be built with MIT Kerberos IV or V authentication
  5252.    and encryption. Instructions are available in a [415]separate
  5253.    document. Additional modules are required that can not be exported
  5254.    from the USA to any country except Canada, by US law.
  5255.    
  5256.    If you have Kerberos installed but you don't have a Kerberized version
  5257.    of C-Kermit, you can use ktelnet as C-Kermit's external communications
  5258.    program to make secure connections without giving up C-Kermit's
  5259.    services:
  5260.    
  5261.   SET PREFIX ALL
  5262.   PTY (or PIPE) ktelnet cia.gov
  5263.      _________________________________________________________________
  5264.    
  5265.   2.8. Scripting Local Programs
  5266.   
  5267.    If your version of Kermit has PTY support built in, then any
  5268.    text-based program can be invoked with SET HOST /PTY or equivalent
  5269.    command and controlled using the normal sequence of OUTPUT, INPUT, IF
  5270.    SUCCESS commands (this is the same service that is provided by the
  5271.    'expect' program, but controlled by the Kermit script language rather
  5272.    than Tcl).
  5273.    
  5274.    When PTY service is not available, then any program that uses standard
  5275.    input and output can be invoked with SET HOST /PIPE.
  5276.    
  5277.    Here's an example in which we start an external Kermit program, wait
  5278.    for its prompt, give it a VERSION command, and then extract the
  5279.    numeric version number from its response:
  5280.    
  5281.   set host /pty kermit -Y
  5282.   if fail stop 1 {Can't start external command}
  5283.   input 10 C-Kermit>
  5284.   if fail stop 1 {No C-Kermit> prompt}
  5285.   output version\13
  5286.   input 10 {Numeric: }
  5287.   if fail stop 1 {No match for "Numeric:"}
  5288.   clear input
  5289.   input 10 \10
  5290.   echo VERSION = "\fsubstr(\v(input),1,6)"
  5291.   output exit\13
  5292.  
  5293.    This technique could be used to control any other interactive program,
  5294.    even those that do screen formatting (like Emacs or Vi), if you can
  5295.    figure out the sequence of events. If your Kermit program doesn't have
  5296.    PTY support, then the commands are restricted to those using standard
  5297.    i/o, including certain shells, interactive text-mode "hardcopy"
  5298.    editors like ex, and so on.
  5299.    
  5300.    If you are using the PTY interface, you should be aware that it runs
  5301.    the given program or command directly on the pty, without any
  5302.    intervening shell to interpret metacharacters, redirectors, etc. If
  5303.    you need this sort of thing, include the appropriate shell invocation
  5304.    as part of your command; for example:
  5305.    
  5306.   pty echo *
  5307.  
  5308.    just echoes "*"; whereas:
  5309.    
  5310.   pty ksh -c "echo *"
  5311.  
  5312.    echoes all the filenames that ksh finds matching "*".
  5313.    
  5314.    Similarly for redirection:
  5315.    
  5316.   set host /pty ksh -c "cat > foo"  ; Note: use shell quoting rules here
  5317.   set transmit eof \4
  5318.   transmit bar
  5319.  
  5320.    And for that matter, for built-in shell commands:
  5321.    
  5322.   set host /pty ksh -c "for i in *; do echo $i; done"
  5323.  
  5324.    The PIPE interface, on the other hand, invokes the shell
  5325.    automatically, so:
  5326.    
  5327.   pipe echo *
  5328.  
  5329.    prints filenames, not "*".
  5330.      _________________________________________________________________
  5331.    
  5332.   2.9. X.25 Networking
  5333.   
  5334.    X.25 networking is documented in [416]Using C-Kermit, 2nd Edition.
  5335.    When the book was published, X.25 was available only in SunOS,
  5336.    Solaris, and Stratus VOS. Unlike TCP/IP, X.25 APIs are not
  5337.    standardized; each vendor's X.25 libraries and services (if they have
  5338.    them at all) are unique.
  5339.    
  5340.    This section describes new additions.
  5341.      _________________________________________________________________
  5342.    
  5343.     2.9.1. IBM AIXLink/X.25 Network Provider Interface for AIX
  5344.     
  5345.    Support for X.25 was added via IBM's Network Provider Interface (NPI),
  5346.    AIXLink/X.25 1.1, to the AIX 4.x version of C-Kermit 7.0.
  5347.    Unfortunately, AIXLink/X.25 is a rather bare-bones facility, lacking
  5348.    in particular any form of PAD support (X.3, X.28, X.29). Thus, the AIX
  5349.    version of C-Kermit, when built to include X.25 networking, has
  5350.    neither a PAD command, nor a SET PAD command. The same is true for the
  5351.    underlying AIX system: no PAD support. Thus it is not possible to have
  5352.    an interactive shell session over an X.25 connection into an AIX
  5353.    system (as far as we know), even from X.25-capable Kermit versions
  5354.    (such as Solaris or VOS) that do include PAD support.
  5355.    
  5356.    Thus the X.25 capabilities in AIX C-Kermit are limited to peer-to-peer
  5357.    connections, e.g. from a C-Kermit client to a C-Kermit server. Unlike
  5358.    the Solaris, SunOS, and VOS versions, the AIX version can accept
  5359.    incoming X.25 connections:
  5360.    
  5361.   set network type x.25
  5362.   if fail stop 1 Sorry - no X.25 support
  5363.   ; Put any desired DISABLE or ENABLE or SET commands here.
  5364.   set host /server *
  5365.   if fail stop 1 X.25 "set host *" failed
  5366.  
  5367.    And then access it from the client as follows:
  5368.    
  5369.   set network type x.25
  5370.   if fail stop 1 Sorry - no X.25 support
  5371.   set host xxxxxxx ; Specify the X.25/X.121 address
  5372.   if fail stop 1 Can't open connection
  5373.  
  5374.    And at this point the client can use the full range of client
  5375.    commands: SEND, GET, REMOTE xxx, FINISH, BYE.
  5376.    
  5377.    The AIX version also adds two new variables:
  5378.    
  5379.    \v(x25local_nua)
  5380.           The local X.25 address.
  5381.           
  5382.    \v(x25remote_nua)
  5383.           The X.25 address of the host on the other end of the
  5384.           connection.
  5385.           
  5386.    C-Kermit's AIX X.25 client has not been tested against anything other
  5387.    than a C-Kermit X.25 server on AIX. It is not known if it will
  5388.    interoperate with C-Kermit servers on Solaris, SunOS, or VOS.
  5389.    
  5390.    To make an X.25 connection from AIX C-Kermit, you must:
  5391.    
  5392.   set x25 call-user-data xxxx
  5393.  
  5394.    where xxxx can be any even-length string of hexadecimal digits, e.g.
  5395.    123ABC.
  5396.      _________________________________________________________________
  5397.    
  5398.     2.9.2. HP-UX X.25
  5399.     
  5400.    Although C-Kermit presently does not include built-in support for
  5401.    HP-UX X.25, it can still be used to make X.25 connections as follows:
  5402.    start Kermit and tell it to:
  5403.    
  5404.   set prefixing all
  5405.   set parity space
  5406.   pty padem address
  5407.  
  5408.    This should work in HP-UX 9.00 and later (see [417]Section 2.7). If
  5409.    you have an earlier HP-UX version, or the PTY interface doesn't work
  5410.    or isn't available, try:
  5411.    
  5412.   set prefixing all
  5413.   set parity space
  5414.   pipe padem address
  5415.  
  5416.    Failing that, use Kermit to telnet to localhost and then after logging
  5417.    back in, start padem as you would normally do to connect over X.25.
  5418.      _________________________________________________________________
  5419.    
  5420.   2.10. Additional Serial Port Controls
  5421.   
  5422.    C-Kermit 7.0 adds the following commands for greater control over
  5423.    serial ports. These commands are available only in C-Kermit versions
  5424.    whose underlying operating systems provide the corresponding services
  5425.    (such as POSIX and UNIX System V), and even then their successful
  5426.    operation depends on the capabilities of the specific device and
  5427.    driver.
  5428.    
  5429.    SET DISCONNECT { ON, OFF }
  5430.           On a SET LINE or SET PORT connection with SET CARRIER ON or
  5431.           AUTO, if the carrier signal drops during the connection,
  5432.           indicating that the connection has been lost, and C-Kermit
  5433.           notices it, this setting governs what happens next. With SET
  5434.           DISCONNECT OFF, which is consistent with previous behavior, and
  5435.           therefore the default, C-Kermit continues to keep the device
  5436.           open and allocated. With SET DISCONNECT ON, C-Kermit
  5437.           automatically closes and releases the device when it senses a
  5438.           carrier on-to-off transition, thus allowing others to use it.
  5439.           However, it remains the default device for i/o (DIAL, REDIAL,
  5440.           INPUT, SEND, CONNECT, etc), so if a subsequent i/o command is
  5441.           given, the device is reopened if it is still available. When it
  5442.           has been automatically closed in this manner, SHOW
  5443.           COMMUNICATIONS puts "(closed)" after its name, and in UNIX, the
  5444.           lockfile disappears -- both from SHOW COMM and from the
  5445.           lockfile directory itself. Synonym: SET CLOSE-ON-DISCONNECT.
  5446.           
  5447.    SET EXIT ON-DISCONNECT { ON, OFF }
  5448.           Like DISCONNECT, but makes the program exit if a connection
  5449.           drops.
  5450.           
  5451.    Note that SET CLOSE-ON-DISCONNECT and SET EXIT ON-DISCONNECT apply
  5452.    only to connections that drop; they do not apply to connections that
  5453.    can't be made in the first place. For example, they have no effect
  5454.    when a SET LINE, SET HOST, TELNET, or DIAL command fails.
  5455.    
  5456.    HANGUP
  5457.           If [CLOSE-ON-]DISCONNECT is ON, and the HANGUP command is given
  5458.           on a serial device, and the carrier signal is no longer present
  5459.           after the HANGUP command, the device is closed and released.
  5460.           
  5461.    SET PARITY HARDWARE { EVEN, ODD }
  5462.           Unlike SET PARITY { EVEN, ODD, MARK, SPACE }, which selects 7
  5463.           data bits plus the indicated kind of parity (to be done in
  5464.           software by Kermit itself), SET PARITY HARDWARE selects 8 data
  5465.           bits plus even or odd parity, to be done by the underlying
  5466.           hardware, operating system, or device driver. This command is
  5467.           effective only with a SET LINE or SET PORT device. That is, it
  5468.           has no effect in remote mode, nor on network connections. There
  5469.           is presently no method for selecting 8 data bits plus mark or
  5470.           space parity. If hardware parity is in effect, the variable
  5471.           \v(hwparity) is set to "even" or "odd". Note: some platforms
  5472.           might also support settings of SPACE, MARK, or NONE.
  5473.           
  5474.    SET STOP-BITS { 1, 2 }
  5475.           This tells the number of 1-bits to insert after an outbound
  5476.           character's data and parity bits, to separate it from the next
  5477.           character. Normally 1. Choosing 2 stop bits should do no harm,
  5478.           but will slow down serial transmission by approximately 10
  5479.           percent. Historically, 2 stop bits were used with Teletypes (at
  5480.           110 bps or below) for print-head recovery time. There is
  5481.           presently no method for choosing any number of stop bits
  5482.           besides 1 and 2.
  5483.           
  5484.    SET SERIAL [ dps ]
  5485.           dps stands for Data-bits, Parity, Stop-bits. This is the
  5486.           notation familiar to many people for serial port configuration:
  5487.           7E1, 8N1, 7O2, etc. The data bits number also becomes the
  5488.           TERMINAL BYTESIZE setting. The second character is E for Even,
  5489.           O for Odd, M for Mark, S for Space, or N for None. The list of
  5490.           available options depends on the capabilities of the specific
  5491.           platform. If dps is omitted, 8N1 is used. Type "set serial ?"
  5492.           for a list of available choices. Examples:
  5493.           
  5494.         SET SERIAL 7E1
  5495.                 Equivalent to SET PARITY EVEN, SET STOP-BITS 1, SET TERM
  5496.                 BYTE 7.
  5497.                 
  5498.         SET SERIAL 8N1
  5499.                 Equivalent to SET PARITY NONE, SET STOP-BITS 1, SET TERM
  5500.                 BYTE 8.
  5501.                 
  5502.         SET SERIAL 7E2
  5503.                 Equivalent to SET PARITY EVEN and SET STOP-BITS 2, SET
  5504.                 TERM BYTE 7.
  5505.                 
  5506.         SET SERIAL 8E2
  5507.                 Same as SET PARITY HARDWARE EVEN, SET STOP-BITS 2, SET
  5508.                 TERM BYTE 8.
  5509.                 
  5510.         SET SERIAL
  5511.                 Same as SET PARITY NONE and SET STOP-BITS 1, SET TERM
  5512.                 BYTE 8.
  5513.                 
  5514.    Notes:
  5515.    
  5516.      * The SET SERIAL xx2 options are available only in Kermit versions
  5517.        where the SET PARITY HARDWARE command is also available. (SHOW
  5518.        FEATURES includes "HWPARITY" in its options list.)
  5519.      * The SET SERIAL 7xx and 8N1 options affect the software parity
  5520.        setting, even for network connections.
  5521.      * As noted in the manual, selecting 8 data bits does not give you
  5522.        8-bit terminal sessions in CONNECT mode unless you also SET
  5523.        TERMINAL BYTESIZE 8. The default terminal bytesize remains 7, to
  5524.        protect against the situation where the remote host is generating
  5525.        parity but you don't know about it. If the terminal bytesize was 8
  5526.        by default and you CONNECTed to such a host, you would see only
  5527.        garbage on your screen.
  5528.      * If you do not give a SET STOP-BITS or SET SET SERIAL command,
  5529.        C-Kermit does not attempt to set the device's stop bits; instead,
  5530.        it uses whatever setting the device uses when not given explicit
  5531.        instructions about stop bits.
  5532.        
  5533.    SHOW COMMUNICATIONS displays the current settings. Stop bits and
  5534.    hardware parity are shown only for SET PORT / SET LINE (serial)
  5535.    devices, since they do not apply to network connections or to remote
  5536.    mode. STOP-BITS is shown as "(default)" if you have not given an
  5537.    explicit SET STOP-BITS or SET SERIAL command.
  5538.    
  5539.    The \v(serial) variable shows the SET SERIAL setting (8N1, 7E1, etc).
  5540.      _________________________________________________________________
  5541.    
  5542.   2.11. Getting Access to the Dialout Device
  5543.   
  5544.      This section is for UNIX only; note the special words about QNX at
  5545.      the end. Also see [418]Section 2.0 for SET LINE switches,
  5546.      particularly the /SHARE switch for VMS only.
  5547.      
  5548.    C-Kermit does its best to obey the UUCP lockfile conventions of each
  5549.    platform (machine, operating system, OS version) where it runs, if
  5550.    that platform uses UUCP.
  5551.    
  5552.    But simply obeying the conventions is often not good enough, due to
  5553.    the increasing likelihood that a particular serial device might have
  5554.    more than one name (e.g. /dev/tty00 and /dev/term/00 are the same
  5555.    device in Unixware 7; /dev/cua and /dev/cufa are the same device in
  5556.    NeXTSTEP), plus the increasingly widespread use of symlinks for device
  5557.    names, such as /dev/modem.
  5558.    
  5559.    C-Kermit 7.0 goes to greater lengths than previous versions to
  5560.    successfully interlock with other communications program (and other
  5561.    instances of Kermit itself); for example, by:
  5562.    
  5563.      * Creation of dual lockfiles whenever a symlink is used; one for the
  5564.        link name and one for the real name.
  5565.      * Creation of dual lockfiles in HP-UX according to HP rules.
  5566.      * Creation of dual uppercase/lowercase lockfile names in SCO
  5567.        UNIX/ODT/OSR5.
  5568.      * The use of ttylock() in versions of AIX where it works.
  5569.      * The use, wherever possible, of lockfile names based on
  5570.        inode/major/minor device number rather than device name.
  5571.        
  5572.    See the [419]ckuins.txt and [420]ckubwr.txt files for details.
  5573.    
  5574.    QNX is almost unique among UNIX varieties in having no UUCP programs
  5575.    nor UUCP-oriented dialout-device locking conventions. QNX does,
  5576.    however, allow a program to get the device open count. This can not be
  5577.    a reliable form of locking unless all applications do it (and they
  5578.    don't), so by default, Kermit uses this information only for printing
  5579.    a warning message such as:
  5580.    
  5581.   C-Kermit>set line /dev/ser1
  5582.   WARNING - "/dev/ser1" looks busy...
  5583.  
  5584.    However, if you want to use it as a lock, you can do so with:
  5585.    
  5586.   SET QNX-PORT-LOCK { ON, OFF }
  5587.  
  5588.    QNX-PORT-LOCK is OFF by default; if you set in ON, C-Kermit fails to
  5589.    open any dialout device when its open count indicates that another
  5590.    process has it open. SHOW COMM (in QNX only) displays the setting, and
  5591.    if you have a port open, it also shows the current open count (with
  5592.    C-Kermit's own access always counting as 1).
  5593.      _________________________________________________________________
  5594.    
  5595.   2.12. The Connection Log
  5596.   
  5597.    C-Kermit 7.0 adds the ability to log connections, so you can see where
  5598.    you've been and have a record of calls you've made. A connection is
  5599.    defined as any communications session that is begun by SET LINE, SET
  5600.    PORT, DIAL, SET HOST, TELNET, or RLOGIN. Connections are not logged
  5601.    unless you request it; the command is:
  5602.    
  5603.    LOG CX [ filename [ { NEW, APPEND } ] ]
  5604.           Enables logging of connections in the given file. If the
  5605.           trailing { NEW, APPEND } keyword is omitted, the file is opened
  5606.           for appending; i.e. new records are written to the end. If NEW
  5607.           is specified, a new file is created; if a file of the same name
  5608.           already existed, it is overwritten. If the filename is omitted,
  5609.           CX.LOG in your home (login) directory is used (note:
  5610.           uppercase). To accept all defaults, just use "log connections"
  5611.           (or "l c" for short). Synonym: LOG CONNECTIONS.
  5612.           
  5613.    CLOSE CX-LOG
  5614.           This closes the connection log if it was open. (Note, the CLOSE
  5615.           CONNECTION command closes the connection itself).
  5616.           
  5617.    SHOW CX
  5618.           This shows your current connection, if any, including the
  5619.           elapsed time (since you opened it). Synonym: SHOW CONNECTION.
  5620.           
  5621.    \v(cx_time)
  5622.           This variable shows the elapsed time of your current
  5623.           connection, or if there is no current connection, of your most
  5624.           recent connection, of if there have been no connections, 0.
  5625.           
  5626.    The connection contains one line per connection, of the form:
  5627.    
  5628.   yyyymmdd hh:mm:ss username pid p=v [ p=v [ ... ] ]
  5629.  
  5630.    where the timestamp (in columns 1-18) shows when the connection was
  5631.    made; username is the login identity of the person who made the
  5632.    connection; pid is Kermit's process ID when it made the connection.
  5633.    The p's are parameters that depend on the type of connection, and the
  5634.    v's are their values:
  5635.    
  5636.   T = Connection Type (TCP, SERIAL, DIAL, DECNET, etc).
  5637.   H = The name of the Host from which the connection was made.
  5638.   N = Destination phone Number or Network host name or address.
  5639.   D = Serial connections only: Device name.
  5640.   O = Dialed calls only: Originating country code & area code if known.
  5641.   E = Elapsed time in hh:mm:ss format (or hhh:mm:ss, etc).
  5642.  
  5643.    If you always want to keep a connection log, simply add:
  5644.    
  5645.   log connections
  5646.  
  5647.    to your C-Kermit customization file. Note, however, that if you make a
  5648.    lot of connections, your CX.LOG will grow and grow. You can handle
  5649.    this by adding a "logrotate" procedure like the following to your
  5650.    customization file, before the "log connections" command:
  5651.    
  5652.   define LOGROTATE {                    ; Define LOGROTATE macro
  5653.       local \%i \%m \%d \%n \%f MAX
  5654.       def MAX 4                         ; How many months to keep
  5655.       if not def \%1 -                  ; No argument given
  5656.         end 1 \%0: No filename given
  5657.       if not = 1 \ffiles(\%1) -         ; Exactly 1 file must match
  5658.         end 1 \%0: \%1 - File not found
  5659.       .\%d := \fsubstr(\fdate(\%1),1,6) ; Arg OK - get file year & month
  5660.       if = \%d -                        ; Compare file year & month
  5661.         \fsubstr(\v(ndate),1,6) -       ; with current year & month
  5662.           end 0                         ; Same year & month - done
  5663.       rename \%1 \%1.\%d                ; Different - rename file
  5664.       .\%n := \ffiles(\%1.*)            ; How many old files
  5665.       if < \%n \m(MAX) end 0            ; Not enough to rotate
  5666.       .\%m := \%1.999999                ; Initial compare string
  5667.       for \%i 1 \%n 1 {                 ; Loop thru old logs
  5668.          .\%f := \fnextfile()           ; Get next file name
  5669.          if llt \%f \%m .\%m := \%f     ; If this one older remember it
  5670.       }
  5671.       delete \%m                        ; Delete the oldest one
  5672.   }
  5673.   log connections                       ; Now open the (possibly new) log
  5674.   logrotate \v(home)CX.LOG              ; Run the LOGROTATE macro
  5675.  
  5676.    As you can see, this compares the yyyymm portion of the modification
  5677.    date (\fdate()) of the given file (\%1) with the current yyyymm. If
  5678.    they differ, the current file has the yyyymm suffix (from its most
  5679.    recent modification date) appended to its name. Then we search through
  5680.    all other such files, find the oldest one, and delete it. Thus the
  5681.    current log, plus the logs from the most recent four months, are kept.
  5682.    This is all done automatically every time you start C-Kermit.
  5683.    
  5684.    On multiuser systems, it is possible to keep a single, shared,
  5685.    system-wide connection log, but this is not recommended since (a) it
  5686.    requires you keep a publicly write-accessible logfile (a glaring
  5687.    target for mischief), and (b) it would require each user to log to
  5688.    that file and not disable logging. A better method for logging
  5689.    connections, in UNIX at least, is syslogging (see [421]ckuins.txt
  5690.    Section 15 and [422]Section 4.2 of the [423]IKSD Administration Guide
  5691.    for details).
  5692.      _________________________________________________________________
  5693.    
  5694.   2.13. Automatic Connection-Specific Flow Control Selection
  5695.   
  5696.    Beginning in C-Kermit 7.0, the appropriate flow-control method for
  5697.    each connection type is kept in a table, for example:
  5698.    
  5699.   Remote:           NONE
  5700.   Modem:            RTS/CTS
  5701.   Direct-Serial:    NONE
  5702.   TCPIP:            NONE
  5703.  
  5704.    The size of the table and values for each connection type can vary
  5705.    from platform to platform. Type "set flow ?" for a list of available
  5706.    flow-control types.
  5707.    
  5708.    The table is used to automatically select the appropriate kind of flow
  5709.    control whenever you make a connection. You can display the table
  5710.    with:
  5711.    
  5712.   SHOW FLOW-CONTROL
  5713.  
  5714.    The defaults are as follows:
  5715.    
  5716.    Remote:
  5717.           NONE or XON/XOFF. This is because C-Kermit is not allowed to
  5718.           find out what type of connection the incoming user has (*). No
  5719.           kind of flow control will work on every kind of connection,
  5720.           including (unexpectedly) KEEP, which we would have liked to
  5721.           use, but not turning off flow control at the remote end during
  5722.           file transfer on TCP/IP connections is fatal to the transfer
  5723.           (except in VMS and HP-UX, where it must be set to Xon/Xoff!)
  5724.           Therefore if you are dialing in to a serial port on a server
  5725.           (UNIX or VMS) where C-Kermit is running, you will need to tell
  5726.           C-Kermit to "set flow keep" before transferring files (assuming
  5727.           the modem and port are configured correctly by the system
  5728.           administrator; otherwise you'll need to give a specific kind of
  5729.           flow control, e.g. "set flow xon/xoff"), so in this case
  5730.           C-Kermit will not disable flow control, as it must do when you
  5731.           are coming via Telnet (directly or through a terminal server,
  5732.           except on VMS and HP-UX).
  5733.           
  5734.    Modem:
  5735.           This applies when you dial out with a modem. In this case, the
  5736.           MODEM FLOW-CONTROL setting takes affect after the SET FLOW
  5737.           setting, so it can pick the most appropriate flow control for
  5738.           the combination of the particular modem and the
  5739.           computer/port/driver that is dialing.
  5740.           
  5741.    Direct-Serial:
  5742.           The default here is NONE because C-Kermit has no way of knowing
  5743.           what kind of flow control, if any, is or can be done by the
  5744.           device at the other end of the connection. RTS/CTS would be a
  5745.           bad choice here, because if the CTS signal is not asserted, the
  5746.           connection will hang. And since direct connections are often
  5747.           made with 3-wire cables, there is a good chance the CTS signal
  5748.           will not be received.
  5749.           
  5750.    TCPIP:
  5751.           NONE, since TCP and IP provide their own flow control
  5752.           transparently to the application, except in VMS, where Xon/Xoff
  5753.           is the default due to the requirements of the VMS TCP/IP
  5754.           products.
  5755.           
  5756.    Other networks:
  5757.           NONE, since networks should provide their flow control
  5758.           transparently to the application.
  5759.           
  5760.    (*) This is possibly the worst feature of UNIX, VMS, and other
  5761.    platforms where C-Kermit runs. If C-Kermit was able to ask the
  5762.    operating system what kind of connection it had to the user, it could
  5763.    set up many things for you automatically.
  5764.    
  5765.    You can modify the default-flow-control table with:
  5766.    
  5767.   SET FLOW-CONTROL /xxx { NONE, KEEP, RTS/CTS, XON/XOFF, ... }
  5768.  
  5769.    where "xxx" is the connection type, e.g.
  5770.    
  5771.   SET FLOW /REMOTE NONE
  5772.   SET FLOW /DIRECT RTS/CTS
  5773.  
  5774.    If you leave out the switch, SET FLOW works as before, choosing the
  5775.    flow control method to be used on the current connection:
  5776.    
  5777.   SET FLOW XON/XOFF
  5778.  
  5779.    Thus, whenever you make a connection with SET PORT, SET LINE, DIAL,
  5780.    SET HOST, TELNET, RLOGIN, etc, an appropriate form of flow control is
  5781.    selected automatically. You can override the automatic selection with
  5782.    a subsequent SET FLOW command, such as SET FLOW NONE (no switch
  5783.    included).
  5784.    
  5785.    The flow control is changed automatically too when you give a SET
  5786.    MODEM TYPE command. For example, suppose your operating system (say
  5787.    Linux) supports hardware flow control (RTS/CTS). Now suppose you give
  5788.    the following commands:
  5789.    
  5790.   set line /dev/ttyS2    ; Automatically sets flow to NONE
  5791.   set modem type usr     ; Automatically sets flow to RTS/CTS
  5792.   set modem type rolm    ; Doesn't support RTS/CTS so now flow is XON/XOFF
  5793.  
  5794.    IMPORTANT: This new feature tends to make the order of SET LINE/HOST
  5795.    and SET FLOW commands matter, where it didn't before. For example, in
  5796.    VMS:
  5797.    
  5798.   SET FLOW KEEP
  5799.   SET LINE TTA0:
  5800.  
  5801.    the SET LINE undoes the SET FLOW KEEP command; the sequence now must
  5802.    be:
  5803.    
  5804.   SET FLOW /DIRECT KEEP
  5805.   SET LINE TTA0:
  5806.  
  5807.    or:
  5808.    
  5809.   SET LINE TTA0:
  5810.   SET FLOW KEEP
  5811.      _________________________________________________________________
  5812.    
  5813.   2.14. Trapping Connection Establishment and Loss
  5814.   
  5815.    If you define a macro called ON_OPEN, it is executed any time that a
  5816.    SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or similar command
  5817.    succeeds in opening a connection. The argument is the host or device
  5818.    name (as shown by SHOW COMMUNICATIONS, and the same as \v(line)). This
  5819.    macro can be used for all sorts of things, like automatically setting
  5820.    connection- or host-specific parameters when the connection is opened.
  5821.    Example:
  5822.    
  5823.   def ON_OPEN {
  5824.       switch \%1 {
  5825.         :abccorp.com, set reliable off, break
  5826.         :xyzcorp.com, set receive packet-length 1000, break
  5827.         etc etc...
  5828.       }
  5829.   }
  5830.  
  5831.    If you define a macro called ON_CLOSE, it will be executed any time
  5832.    that a SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or any other kind
  5833.    of connection that C-Kermit has made is closed, either by the remote
  5834.    or by a local CLOSE, HANGUP, or EXIT command or other local action,
  5835.    such as when a new connection is opened before an old one was
  5836.    explicitly closed.
  5837.    
  5838.    As soon as C-Kermit notices the connection has been closed, the
  5839.    ON_CLOSE macro is invoked at (a) the top of the command parsing loop,
  5840.    or (b) when a connection is closed implicitly by a command such as SET
  5841.    LINE that closes any open connection prior to making a new connection,
  5842.    or (c) when C-Kermit closes an open connection in the act of exiting.
  5843.    
  5844.    The ON_CLOSE macro was inspired by the neverending quest to unite
  5845.    Kermit and SSH. In this case using the "tunnel" mechanism:
  5846.    
  5847.   def TUNNEL {                                ; \%1 = host to tunnel to
  5848.       local \%p
  5849.       if not def \%1 stop 1
  5850.       assign tunnelhost \%1                   ; Make global copy
  5851.       undef on_close
  5852.       set macro error off
  5853.       close connection                        ; Ignore any error
  5854.       open !read tunnel start \%1
  5855.       read \%p                                ; Get port number
  5856.       if fail stop 1 Tunnel failure: \%1
  5857.       close read
  5858.       if fail stop 1 Tunnel failure: \%1      ; See [424]Section 4.2.8.1
  5859.       assign on_close {                       ; Set up close handler
  5860.           echo Closing tunnel: \m(tunnelhost)
  5861.           !tunnel stop \m(tunnelhost)
  5862.           undef on_close
  5863.       }
  5864.       set host localhost:\%p /telnet
  5865.       if success end 0
  5866.       undef on_close
  5867.       stop 1 Connection failure: \%1
  5868.   }
  5869.  
  5870.    In this case, when the connection stops, we also need to shut down the
  5871.    tunnel, even if it is at a later time after TUNNEL has finished
  5872.    executing. This way we can escape back, reconnect, transfer files, and
  5873.    so on until the connection is broken by logging out from the remote,
  5874.    or by explicitly closing it, or by EXITing from C-Kermit, at which
  5875.    time the tunnel is shut down.
  5876.    
  5877.    When the connection is closed, no matter how, the ON_CLOSE macro
  5878.    executes and then undefines (destroys) itself, since we don't want to
  5879.    be closing tunnels in the future when we close subsequent connections.
  5880.    
  5881.    Other such tricks can be imagined, including ending ON_CLOSE with a
  5882.    STOP command to force the command stack to be peeled all the way back
  5883.    to the top, for example in a deeply nested script that depends on the
  5884.    connection being open:
  5885.    
  5886.   def on_close { stop 1 CONNECTION LOST }
  5887.  
  5888.    When C-Kermit invokes the ON_CLOSE macro, it supplies one argument
  5889.    (\%1): the reason the connection was closed as a number, one of the
  5890.    following:
  5891.    
  5892.   2 - Fatal failure to negotiate a required item on a network connection.
  5893.   1 - Closed by C-Kermit command.
  5894.   0 - All others (normally closed by remote).
  5895.  
  5896.    which may be used for any purpose; for example, to add a comment to
  5897.    the connection log:
  5898.    
  5899.   def on_close {
  5900.       local \%m
  5901.       if not open cx end 0
  5902.       switch \%1 {
  5903.         :0, .\%m = Closed by remote, break
  5904.         :1, .\%m = Closed by me, break
  5905.         :2, .\%m = Network protocol negotiation failure, break
  5906.       }
  5907.       if def \%m writeln cx {# \%m}
  5908.   }
  5909.      _________________________________________________________________
  5910.    
  5911.   2.15. Contacting Web Servers with the HTTP Command
  5912.   
  5913.    C-Kermit 7.0 (at this writing, the UNIX version only) supports direct
  5914.    contact and interaction with Web servers via HTTP 1.0 protocol. To
  5915.    make a connection, use Kermit's normal method for making a TCP/IP
  5916.    connection, but specify the HTTP port:
  5917.    
  5918.   SET HOST host http [ switches ]
  5919.  
  5920.    where host is the IP hostname or address, and http is the name of the
  5921.    TCP port for the Web server. Relevant switches include:
  5922.    
  5923.    /RAW
  5924.           Treat the connection as a transparent binary pipe. This switch
  5925.           may be required if a port other than 'http' is used.
  5926.           
  5927.    /SSL
  5928.           Make an secure private connection with SSL (only if SSL support
  5929.           is included in your version of Kermit). In this case the port
  5930.           name might need to be https rather than http, e.g. "set host
  5931.           secureserver.xyxcorp.com https /ssl".
  5932.           
  5933.    /TLS
  5934.           Make an secure private connection with TLS (only if TLS support
  5935.           is included in your version of Kermit). In this case the port
  5936.           name would be https rather than http.
  5937.           
  5938.    Then you can issue an HTTP command. In most cases, the server closes
  5939.    the connection when the command is complete. Example:
  5940.    
  5941.   SET HOST www.columbia.edu http
  5942.   IF FAIL EXIT 1 Can't contact server
  5943.   HTTP GET kermit/index.html
  5944.  
  5945.    At this point the connection is closed, since that's how HTTP 1.0
  5946.    works. If you want to perform additional operations, you must
  5947.    establish a new connection with another SET HOST command.
  5948.    
  5949.    The HTTP command acts as a client to the Web server, except instead of
  5950.    displaying the results like a Web browser would, it stores them. Any
  5951.    HTTP command can (but need not) include any or all of the following
  5952.    switches:
  5953.    
  5954.    /AGENT:user-agent
  5955.           Identifies the client to the server; "C-Kermit" or "Kermit-95"
  5956.           by default.
  5957.           
  5958.    /HEADER:header-line
  5959.           Used for specifying any optional headers. A list of headers is
  5960.           provided using braces for grouping:
  5961.           
  5962.   /HEADER:{{tag:value}{tag:value}...}
  5963.  
  5964.           For a listing of valid tag value and value formats see [425]RFC
  5965.           1945: Hypertext Transfer Protocol -- HTTP/1.0. A maximum of
  5966.           eight headers may be specified.
  5967.           
  5968.    /USER:name
  5969.           In case a page requires a username for access.
  5970.           
  5971.    /PASSWORD:password
  5972.           In case a page requires a password for access.
  5973.           
  5974.    /ARRAY:arrayname
  5975.           Tells Kermit to store the response headers in the given array,
  5976.           one line per element. The array need not be declared in
  5977.           advance. Example:
  5978.           
  5979.   C-Kermit? http /array:c get kermit/index.html
  5980.   C-Kermit? show array c
  5981.   Dimension = 9
  5982.   1. Date: Fri, 26 Nov 1999 23:12:22 GMT
  5983.   2. Server: Apache/1.3.4 (Unix)
  5984.   3. Last-Modified: Mon, 06 Sep 1999 22:35:58 GMT
  5985.   4. ETag: "bc049-f72-37d441ce"
  5986.   5. Accept-Ranges: bytes
  5987.   6. Content-Length: 3954
  5988.   7. Connection: close
  5989.   8. Content-Type: text/html
  5990.  
  5991.    As you can see, the header lines are like MIME e-mail header lines:
  5992.    identifier, colon, value. The /ARRAY switch is the only method
  5993.    available to a script to process the server responses for a POST or
  5994.    PUT command.
  5995.    
  5996.    The HTTP commands are:
  5997.    
  5998.    HTTP [ switches ] GET remote-filename [ local-filename ]
  5999.           Retrieves the named file. If a local-filename is given, the
  6000.           file is stored locally under that name; otherwise it is stored
  6001.           with its own name.
  6002.           
  6003.    HTTP [ switches ] HEAD remote-filename local-filename
  6004.           Like GET except without actually getting the file; instead it
  6005.           gets only the headers, storing them into the given file, whose
  6006.           name must be given, one line per header item, as shown above in
  6007.           the /ARRAY: switch description.
  6008.           
  6009.    HTTP [ switches ] INDEX remote-directory [ local-filename ]
  6010.           Retrieves the file listing for the given server directory.
  6011.           NOTE: This command is not supported by most Web servers.
  6012.           
  6013.    HTTP [ switches ] POST [ /MIME-TYPE:type ] local-file remote-file
  6014.           Used to send a response as if it were sent from a form. The
  6015.           data to be posted must be read from a file.
  6016.           
  6017.    HTTP [ switches ] PUT [ /MIME-TYPE:type ] local-file remote-file
  6018.           Uploads a local file to a server file.
  6019.           
  6020.    HTTP [ switches ] DELETE remote-filename
  6021.           Instructs the server to delete the specified filename.
  6022.      _________________________________________________________________
  6023.    
  6024.   3. TERMINAL CONNECTION
  6025.   
  6026.   3.1. CONNECT Command Switches
  6027.   
  6028.    The following switches (see [426]Section 1.5) were added to the
  6029.    CONNECT command in 7.0:
  6030.    
  6031.    /QUIETLY
  6032.           Don't print the "Connecting to..." or "Back at..." messages. CQ
  6033.           is an invisible command synonym for CONNECT /QUIETLY.
  6034.           
  6035.    /TRIGGER:string
  6036.           Specify a trigger or triggers ([427]Section 3.2) effective for
  6037.           this CONNECT command only, temporarily overriding any current
  6038.           SET TERMINAL TRIGGER values ([428]Section 3.2).
  6039.           
  6040.    Note: Other switches might also be available; type "connect ?" for a
  6041.    list, "help connect" for a description of each.
  6042.      _________________________________________________________________
  6043.    
  6044.   3.2. Triggers
  6045.   
  6046.    Triggers were added for UNIX, VMS, AOS/VS, and K95 in C-Kermit 7.0.
  6047.    
  6048.    SET TERMINAL TRIGGER string
  6049.           Tells C-Kermit to look for the given string during all
  6050.           subsequent CONNECT sessions, and if seen, to return to command
  6051.           mode automatically, as if you had escaped back manually. If the
  6052.           string includes any spaces, you must enclose it in braces.
  6053.           Example:
  6054.           
  6055.   set terminal trigger {NO CARRIER}
  6056.  
  6057.    Comparisons are made after character-set translation.
  6058.    
  6059.    If a string is to include a literal brace character, precede it with a
  6060.    backslash:
  6061.    
  6062.   ; My modem always makes this noise when the connection is lost:
  6063.   set terminal trigger |||ppp\{\{\{\{UUUUUUU
  6064.  
  6065.    If you want Kermit to look for more than one string simultaneously,
  6066.    use the following syntax:
  6067.    
  6068.   set terminal trigger {{string1}{string2}...{stringn}}
  6069.  
  6070.    In this case, C-Kermit will return to command mode automatically if
  6071.    any of the given strings is encountered. Up to 8 strings may be
  6072.    specified.
  6073.    
  6074.    If the most recent return to command mode was caused by a trigger, the
  6075.    new variable, \v(trigger), shows the trigger value; otherwise
  6076.    \v(trigger) is empty.
  6077.    
  6078.    The SHOW TRIGGER command displays the SET TERMINAL TRIGGER values as
  6079.    well as the \v(trigger) value.
  6080.      _________________________________________________________________
  6081.    
  6082.   3.3. Transparent Printing
  6083.   
  6084.    As noted in the manual, C-Kermit's CONNECT command on UNIX is not a
  6085.    terminal emulator, but rather a "semitransparent pipe" between the
  6086.    terminal or emulator you are using to access C-Kermit, and the remote
  6087.    host to which C-Kermit is connected. The "semitransparent" qualifier
  6088.    is because of character-set translation as well as several actions
  6089.    taken by the emulator in response to the characters or strings that
  6090.    pass through it, such as APCs, Kermit packets (autodownload),
  6091.    triggers, etc.
  6092.    
  6093.    The UNIX version of C-Kermit 7.0 adds another such action: Transparent
  6094.    printing, also called Controller printing (as distinct from Autoprint
  6095.    or line or screen print). It is intended mainly for use on UNIX
  6096.    workstation consoles (as opposed to remote logins), but with some care
  6097.    can also be used when accessing C-Kermit remotely.
  6098.    
  6099.    Transparent printing is related to APC by sharing C-Kermit's built-in
  6100.    ANSI escape-sequence parser to detect "printer on" and "printer off"
  6101.    sequences from the host. When the printer-on sequence is received, all
  6102.    subsequent arriving characters -- including NUL, control characters,
  6103.    and escape sequences -- are sent to the SET PRINTER device instead of
  6104.    to your screen until the printer-off sequence is received, or you
  6105.    escape back, whichever happens first. These bytes are not translated
  6106.    or modified or filtered in any way by Kermit (except for possibly
  6107.    stripping of the 8th bit, as noted below), but if filtering or
  6108.    translation is desired, this can be accomplished by your SET PRINTER
  6109.    selection (e.g. by choosing a pipeline of filters).
  6110.    
  6111.    By default, your SET PRINTER device is your default UNIX printer, but
  6112.    it can also be a file, a command, or the null device (which causes all
  6113.    printer material to be discarded). See [429]Using C-Kermit, 2nd Ed.,
  6114.    p.41 for details.
  6115.    
  6116.    Transparent printing is controlled by the command:
  6117.    
  6118.    SET TERMINAL PRINT { ON, OFF }
  6119.           When ON, transparent-print sequences are obeyed, and printing
  6120.           occurs on the system where C-Kermit is running. When OFF,
  6121.           transparent print sequences are ignored and passed through to
  6122.           your actual terminal or emulator, along with the data they
  6123.           enclose. OFF is the default, for compatibility with earlier
  6124.           C-Kermit releases. As noted in the manual, when the current SET
  6125.           PRINTER device is a file, transparent-print material is
  6126.           appended to it; the file is not overwritten.
  6127.           
  6128.    SET TERMINAL BYTESIZE { 7, 8 }
  6129.           
  6130.    SET PARITY { EVEN, ODD, MARK, SPACE, NONE }
  6131.           If the terminal bytesize is 7, or PARITY is not NONE, the 8th
  6132.           bit of each byte is stripped prior to printing.
  6133.           
  6134.    The transparent-print escape sequences are:
  6135.    
  6136.    <ESC>[5i
  6137.           Printer On. Send all subsequent incoming bytes to the printer
  6138.           without any kind of filtering, translation, or alteration.
  6139.           Note: <ESC> stands for ASCII character number 27 (decimal),
  6140.           Escape.
  6141.           
  6142.    <ESC>[4i
  6143.           Printer Off. Resume displaying incoming bytes on the screen.
  6144.           
  6145.    These are the same sequences used by DEC VT100 and higher terminals
  6146.    and other ANSI X3.64 and ISO 6429 compatible terminals. There is no
  6147.    provision for selecting other printer-control sequences.
  6148.    
  6149.    Restrictions:
  6150.    
  6151.     1. You must SET TERM TRANSPARENT-PRINT ON before you can use this
  6152.        feature.
  6153.     2. Only the 7-bit forms of the escape sequences are supported. The
  6154.        8-bit CSI C1 control is not recognized.
  6155.     3. Autoprint is not supported, since this requires a full-fledged
  6156.        terminal emulator with direct access to the screen.
  6157.     4. The start-print and stop-print sequences pass through to the
  6158.        screen (there is no way to avoid this without causing unacceptable
  6159.        delays or deadlocks in CONNECT mode). Thus if your terminal or
  6160.        emulator also supports transparent printing via these same
  6161.        sequences, an empty file will be sent to its printer. Normally
  6162.        this has no effect.
  6163.        
  6164.    Point (4) is similar to the situation with autodownload and APC --
  6165.    when you have several Kermit clients in a chain, you should take care
  6166.    that these features are enabled in only one of them.
  6167.    
  6168.    Example 1:
  6169.    
  6170.   set printer {|lpr -Plaser}  ; Specify the printer (if not default).
  6171.   set term print on           ; Enable transparent printing.
  6172.   set term byte 8             ; Enable 8-bit characters.
  6173.   connect                     ; Enter CONNECT mode.
  6174.  
  6175.    Example 2:
  6176.    
  6177.   set printer /home/users/olga/printer.log  ; Send printer material to a file.
  6178.  
  6179.    Example 3:
  6180.    
  6181.   set printer {| grep -v ^Received | lpr}   ; Filter out some lines
  6182.  
  6183.    Then use "pcprint" or "vtprint" commands on the host to initiate
  6184.    transparent print operations. See [430]Using C-Kermit, 2nd Ed., p.406
  6185.    for details.
  6186.    
  6187.    Here is a sample "pcprint" shell script for UNIX:
  6188.    
  6189.   #!/bin/sh
  6190.   echo -n '<ESC>[5i'
  6191.   if [ $# -eq 0 ]; then
  6192.     cat
  6193.   else
  6194.     cat $*
  6195.   fi
  6196.   echo -n '<FF><ESC>[4i'
  6197.   # (end)
  6198.  
  6199.    (Replace "<ESC>" by the actual ASCII Escape character and "<FF>" by
  6200.    the ASCII Formfeed character).
  6201.    
  6202.    If you always want transparent printing enabled, put "set term print
  6203.    on" in your C-Kermit customization file (~/.mykermrc in UNIX). The
  6204.    "set term bytesize" selection, however, is a property of each separate
  6205.    connection.
  6206.      _________________________________________________________________
  6207.    
  6208.   3.4. Binary and Text Session Logs
  6209.   
  6210.    C-Kermit 7.0 corrects an oversight in earlier releases, in which
  6211.    binary session logs (SET SESSION-LOG BINARY) translated character sets
  6212.    and performed various formatting transformations (e.g. "newline mode")
  6213.    before writing characters to the session log. In C-Kermit 7.0,
  6214.    binary-mode session logging writes characters as they come in, before
  6215.    anything (other that parity-bit stripping) is done to them. Text-mode
  6216.    session logging records the characters after processing.
  6217.      _________________________________________________________________
  6218.    
  6219.   4. FILE TRANSFER
  6220.   
  6221.    Every file is transferred either in text mode (which implies
  6222.    record-format and character-set translation) or binary mode (in which
  6223.    each byte is sent literally without any kind of conversion). The mode
  6224.    in which a file is transferred is controlled by (a) the default mode,
  6225.    in the absence of any other indications; (b) the SET FILE TYPE
  6226.    command; (c) various automatic mechanisms based on client/server
  6227.    negotiations, directory information or filename patterns, etc.
  6228.    
  6229.    The default FILE TYPE was changed from TEXT to BINARY in C-Kermit 7.0
  6230.    because:
  6231.    
  6232.      * Transferring a text file in binary mode does less damage than
  6233.        transferring a binary file in text mode.
  6234.      * Only binary-mode transfers can be recovered from the point of
  6235.        failure.
  6236.      * The automatic transfer-mode mechanisms switch to text mode on a
  6237.        per-file basis anyway, so only those files that are not covered by
  6238.        the automatic mechanisms are affected.
  6239.      * All file transfers on the Web are done in binary mode, so people
  6240.        are accustomed to it and expect it.
  6241.      _________________________________________________________________
  6242.    
  6243.   4.0. BUG FIXES, MINOR CHANGES, AND CLARIFICATIONS
  6244.   
  6245.     4.0.0. Filenames with Spaces
  6246.     
  6247.    Filenames that contain spaces are a major nuisance to a program like
  6248.    Kermit, whose command language is line- and word-oriented, in which
  6249.    words are separated by spaces and a filename is assumed to be a
  6250.    "word". In general (unless noted otherwise in the description of a
  6251.    particular command), there is only one way to refer to such files in
  6252.    Kermit commands, and that is to enclose the name in braces:
  6253.    
  6254.   send {this file}
  6255.  
  6256.    Tells Kermit to send the file whose name is "this file" (two words, no
  6257.    quotes). Of course, various circumlocutions are also possible, such
  6258.    as:
  6259.    
  6260.   define \%a this file
  6261.   send \%a
  6262.  
  6263.    BUT, perhaps contrary to expectation, you can't use "\32" to represent
  6264.    the space:
  6265.    
  6266.   send this\32file
  6267.  
  6268.    does not work. Why? Because the Kermit parser, which must work on many
  6269.    operating systems including Windows, has no way of knowing what you
  6270.    mean by "this\32file". Do you mean a file whose name is "this file" in
  6271.    the current directory? Or do you mean a file whose name is "32file" in
  6272.    the "this" subdirectory of the current directory? Guessing won't do
  6273.    here; Kermit must behave consistently and deterministically in all
  6274.    cases on all platforms.
  6275.    
  6276.    Note that you can't use Esc or Tab within {...} for filename
  6277.    completion, or question mark to get a filename list. However, you can
  6278.    include wildcards; for example:
  6279.    
  6280.   send {* *}
  6281.  
  6282.    sends all files whose name contains a space.
  6283.    
  6284.    All things considered, it is best to avoid spaces in file and
  6285.    directory names if you can. Also see [431]Section 5.4 on this topic.
  6286.      _________________________________________________________________
  6287.    
  6288.     4.0.1. Packet out of Window
  6289.     
  6290.    C-Kermit 6.0 could send packets "out of window" if the window size was
  6291.    greater than 1 and ACKs had arrived out of order. Fixed in 6.1.
  6292.      _________________________________________________________________
  6293.    
  6294.     4.0.2. MOVE after ADD SEND-LIST
  6295.     
  6296.    ADD SEND-LIST followed by MOVE did not delete original files; fixed in
  6297.    6.1. Carrier loss was not detected during transfer; in 7.0 C-Kermit
  6298.    checks for this (but results can not be guaranteed). In any case, the
  6299.    protocol will eventually time out if the connection is lost.
  6300.      _________________________________________________________________
  6301.    
  6302.     4.0.3. GET and RECEIVE As-Names
  6303.     
  6304.    In 5A(190) through 6.0.192, the GET and RECEIVE as-name did not
  6305.    properly override the RECEIVE PATHNAMES setting. In 7.0 it does.
  6306.      _________________________________________________________________
  6307.    
  6308.     4.0.4. New Brief Statistics Listing
  6309.     
  6310.    Version 7.0 adds a /BRIEF switch to the STATISTICS command, to display
  6311.    a short file-transfer statistics report. /BRIEF is now the default.
  6312.    Use /VERBOSE to see the full display, which is about 25 lines long.
  6313.      _________________________________________________________________
  6314.    
  6315.     4.0.5. Improved FAST Command
  6316.     
  6317.    The preinstalled definition of the FAST macro did not take enough
  6318.    factors into account. Now it sets packet lengths and window sizes
  6319.    appropriate to the configuration. Furthermore, in IRIX only, it might
  6320.    restrict the SEND packet length to 4000, to work around a bug in the
  6321.    IRIX Telnet server, depending on the IRIX version (see
  6322.    [432]ckubwr.txt, IRIX section). To see the built-in definition of the
  6323.    FAST macro, type "show macro fast". To change it, simply define it to
  6324.    be whatever you want -- it's just a macro, like any other.
  6325.      _________________________________________________________________
  6326.    
  6327.     4.0.6. The SET SEND BACKUP Command
  6328.     
  6329.    Version 7.0 adds SET SEND BACKUP { ON, OFF }. This tells whether
  6330.    backup files should be sent. Backup files are the ones created by
  6331.    Kermit (and EMACS, and possibly other applications) to preserve old
  6332.    copies of files when creating new ones with the same name. Kermit does
  6333.    this when receiving a file and its FILE COLLISION setting is BACKUP
  6334.    (or RENAME, in which case it the new file gets the backup name). On
  6335.    most platforms, the backup name is formed by adding:
  6336.    
  6337.   .~n~
  6338.  
  6339.    to the end of the filename, where "n" is a number. For example, if the
  6340.    original file is oofa.txt, a backup file might be called:
  6341.    
  6342.   oofa.txt.~1~
  6343.  
  6344.    (or oofa.txt.~2~, etc). If you SET SEND BACKUP OFF, this tells Kermit
  6345.    not to send files that have backup names. Normally, SET SEND BACKUP is
  6346.    ON (as shown by SHOW PROTOCOL), and backup files are sent if their
  6347.    names match the SEND file specification.
  6348.    
  6349.    Also see PURGE, SET FILE COLLISION, SEND /NOBACKUP, DIRECTORY
  6350.    /[NO]BACKUP.
  6351.      _________________________________________________________________
  6352.    
  6353.     4.0.7. The SET { SEND, RECEIVE } VERSION-NUMBERS Command
  6354.     
  6355.    VMS Only. Normally when sending files, VMS C-Kermit strips the version
  6356.    number. For example, if the file is FOO.BAR;34, the name is sent as
  6357.    FOO.BAR (without the ";34"). If you want to keep version numbers on
  6358.    when sending files, use SET SEND VERSION-NUMBERS ON. The effect
  6359.    depends on the receiver.
  6360.    
  6361.    Normally when receiving files, and an incoming filename includes a
  6362.    VMS-style version number (such as FOO.BAR;34) VMS C-Kermit strips it
  6363.    before trying to create the new file; this way the new file receives
  6364.    the next highest version number in the customary manner for VMS. If
  6365.    you want version numbers on incoming filenames to be used in creating
  6366.    the new files, use SET RECEIVE VERSION-NUMBERS ON.
  6367.    
  6368.    Normally these commands would be effective only when VMS C-Kermit is
  6369.    exchanging files with a non-VMS Kermit program, since VMS-to-VMS
  6370.    transfers use labeled mode unless you have gone out of your way to
  6371.    defeat it.
  6372.    
  6373.    Example: You want to send all versions of all files in the current
  6374.    directory from a VMS C-Kermit client to a UNIX C-Kermit server. Use:
  6375.    
  6376.   set send version-numbers on
  6377.   send *.*;*
  6378.  
  6379.    The resulting Unix files will have VMS-style version numbers as part
  6380.    of their name, for example "foo.bar;1", "foo.bar;2", etc.
  6381.    
  6382.    Now suppose you want to send these files from Unix to another VMS
  6383.    system and preserve the version numbers. Again we have a Unix C-Kermit
  6384.    server and VMS C-Kermit client. Give these commands to the client:
  6385.    
  6386.   set receive version-numbers on
  6387.   get *
  6388.      _________________________________________________________________
  6389.    
  6390.     4.0.8. The SET { SEND, RECEIVE } { MOVE-TO, RENAME-TO } Commands
  6391.     
  6392.    These commands are persistent global versions of the /MOVE-TO: and
  6393.    /RENAME-TO: switches of the SEND, GET, and RECEIVE commands. They
  6394.    should normally be used only when setting up a dedicated
  6395.    transaction-processing application, in which each file is to be moved
  6396.    or renamed immediately after, and only if, it is transferred
  6397.    successfully, so that (for example) an independent, concurrent process
  6398.    can notice when new files appear and process them immediately without
  6399.    having to guess whether they are complete.
  6400.      _________________________________________________________________
  6401.    
  6402.     4.0.9. SET FILE INCOMPLETE AUTO
  6403.     
  6404.    SET FILE INCOMPLETE { KEEP, DISCARD }, which tells whether to keep or
  6405.    discard incompletely received files, has a new option, AUTO, which is
  6406.    also the default. It means KEEP the incomplete file if the transfer is
  6407.    in binary mode, otherwise DISCARD it. This reduces the chances that a
  6408.    subsequent recovery operation (RESEND, REGET, etc) could produce a
  6409.    corrupt file, since recovery works only for binary-mode transfers.
  6410.      _________________________________________________________________
  6411.    
  6412.   4.1. FILE-TRANSFER FILENAME TEMPLATES
  6413.   
  6414.    File-transfer filename templates allow files to be renamed
  6415.    automatically by the file sender, the receiver, or both, during
  6416.    transfer of groups of files.
  6417.    
  6418.     4.1.1. Templates in the As-Name
  6419.     
  6420.    Prior to C-Kermit 6.1 and Kermit 95 1.1.12 the only options that could
  6421.    be used to affect the names of files being transferred were SET
  6422.    FILENAMES { LITERAL, CONVERTED } and SET { SEND, RECEIVE } PATHNAMES {
  6423.    ON, OFF }, plus the "as-name" feature of the SEND (MOVE, etc) and
  6424.    RECEIVE commands.
  6425.    
  6426.    Previously, the as-name could be used only for a single file. For
  6427.    example:
  6428.    
  6429.   SEND FOO BAR
  6430.  
  6431.    would send the file FOO under the name BAR, but:
  6432.    
  6433.   SEND *.TXT anything
  6434.  
  6435.    was not allowed, since it would give the same name to each file that
  6436.    was sent. When receiving:
  6437.    
  6438.   RECEIVE FOO
  6439.  
  6440.    would rename the first incoming file to FOO before storing it on the
  6441.    disk, but subsequent files would not be renamed to FOO, since this
  6442.    would result in overwriting the same file repeatedly. Instead, they
  6443.    were stored under the names they arrived with.
  6444.    
  6445.    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to
  6446.    specify as-names in SEND, RECEIVE, and related commands even for file
  6447.    groups. This is accomplished by using replacement variables in the
  6448.    as-name, along with optional material such character-string functions
  6449.    and/or constant strings. An as-name containing replacement variables
  6450.    is called a filename template.
  6451.    
  6452.    The key to filename templates is the new variable:
  6453.    
  6454.   \v(filename)
  6455.  
  6456.    During file transfer it is replaced by the name of each file currently
  6457.    being transferred (after transfer, it is the name of the last file
  6458.    transferred).
  6459.    
  6460.    So, for example:
  6461.    
  6462.   send *.txt \v(filename).new
  6463.  
  6464.    sends each file with its own name, but with ".new" appended to it. Of
  6465.    course if the name already contains periods, this could confuse the
  6466.    file receiver, so you can also achieve fancier effects with
  6467.    constructions like:
  6468.    
  6469.   send *.txt \freplace(\v(filename),.,_).new
  6470.  
  6471.    which replaces all periods in the original filename by underscores,
  6472.    and then appends ".new" to the result. So, for example, oofa.txt would
  6473.    be sent as oofa_txt.new.
  6474.    
  6475.    Another new variable that is useful in this regard is \v(filenumber),
  6476.    which is the ordinal number of the current file in the file group, so
  6477.    you can also:
  6478.    
  6479.   send *.txt FILE\flpad(\v(filenum),2,0)
  6480.  
  6481.    resulting in a series of files called FILE00, FILE01, FILE02, etc. (At
  6482.    the end of the transfer, \v(filenum) tells the number of files that
  6483.    were transferred).
  6484.    
  6485.    If you specify a constant as-name when sending a file group:
  6486.    
  6487.   send *.txt thisnameonly
  6488.  
  6489.    Kermit complains and asks you to include replacement variables in the
  6490.    as-name. You should generally use \v(filename) or \v(filenumber) for
  6491.    this purpose, since other variables (with the possible exception of
  6492.    date/time related variables) do not change from one file to the next.
  6493.    But Kermit accepts any as-name at all that contains any kind of
  6494.    variables for file group, even if the variable will not change. So:
  6495.    
  6496.   send *.txt \%a
  6497.  
  6498.    is accepted, but all files are sent with the same name (the value of
  6499.    \%a, if it has one and it is constant). If the variable has no value
  6500.    at all, the files are sent under their own names.
  6501.    
  6502.    Of course, the value of \%a in the previous example need not be
  6503.    constant:
  6504.    
  6505.   define \%a FILE\flpad(\v(filenum),2,0)_at_\v(time)
  6506.   send *.txt \%a
  6507.  
  6508.    The RECEIVE command, when given without an as-name, behaves as always,
  6509.    storing all incoming files under the names they arrive with, subject
  6510.    to SET FILE NAME and SET RECEIVE PATHNAMES modifications ([433]Section
  6511.    4.10).
  6512.    
  6513.    However, when an as-name is given in the RECEIVE command, it is
  6514.    applied to all incoming files rather than to just the first. If it
  6515.    does not contain replacement variables, then the current FILE
  6516.    COLLISION setting governs the result. For example:
  6517.    
  6518.   receive foo
  6519.  
  6520.    will result in incoming files named foo, foo.~1~, foo.~2~, and so on,
  6521.    with the default FILE COLLISION setting of BACKUP. If it does contain
  6522.    replacement variables, of course they are used.
  6523.    
  6524.    When receiving files, the \v(filename) variable refers to the name
  6525.    that was received in the incoming file-header packet, BEFORE any
  6526.    processing by SET FILE NAMES or SET RECEIVE PATHNAMES. Since the
  6527.    filenames in file-header packets are usually in uppercase, you would
  6528.    need to convert them explicitly if you want them in lowercase, e.g.:
  6529.    
  6530.   receive \flower(\v(filename)).new
  6531.      _________________________________________________________________
  6532.    
  6533.     4.1.2. Templates on the Command Line
  6534.     
  6535.    On the command-line, use templates as shown above as the -a option
  6536.    argument, bearing in mind the propensity of UNIX and perhaps other
  6537.    shells to treat backslash as a shell escape character. So in UNIX (for
  6538.    example):
  6539.    
  6540.   kermit -s oofa.* -a x.\\v(filenum)
  6541.  
  6542.    By the way, this represents a change from 6.0 and earlier releases in
  6543.    which the as-name (-a argument or otherwise) was not evaluated by the
  6544.    command parser. Thus, for example, in VMS (where the shell does not
  6545.    care about backslashes), it was possible to:
  6546.    
  6547.   kermit -s oofa.txt -a c:\tmp\oofa.txt
  6548.  
  6549.    Now backslashes in the as-name must be quoted not only for the shell
  6550.    (if necessary) but also for Kermit itself:
  6551.    
  6552.   kermit -s oofa.txt -a c:\\tmp\\oofa.txt      ; Kermit only
  6553.   kermit -s oofa.txt -a c:\\\\tmp\\\\oofa.txt  ; Shell and Kermit
  6554.  
  6555.    You can also use the \fliteral() function for this:
  6556.    
  6557.   kermit -s oofa.txt -a \fliteral(c:\tmp\oofa.txt)      ; Kermit only
  6558.   kermit -s oofa.txt -a \\fliteral(c:\\tmp\\oofa.txt)   ; Shell and Kermit
  6559.      _________________________________________________________________
  6560.    
  6561.     4.1.3. Post-Transfer Renaming
  6562.     
  6563.    Filename templates are now also useful in SET { SEND, RECEIVE }
  6564.    RENAME-TO and in the /RENAME-TO: switch, that can be given to the
  6565.    SEND, GET, or RECEIVE commands; this is similar to an as-name, but is
  6566.    effective on a per-file basis if and only if the file was transferred
  6567.    successfully.
  6568.    
  6569.    MOVE-TO and RENAME-TO address a requirement commonly stated for
  6570.    transaction processing and similar systems. Suppose, for example, a
  6571.    central system "X" accepts connections from multiple clients
  6572.    simultaneously; a process on X waits for a file to appear and then
  6573.    processes the file. This process must have a way of knowing when the
  6574.    file has been completely and successfully transferred before it starts
  6575.    to process it. This can be accomplished easily using C-Kermit's SET {
  6576.    SEND, RECEIVE } { MOVE-TO, RENAME-TO } command or /MOVE-TO: or
  6577.    /RENAME-TO: switches, described in [434]Sections 4.7.1 through
  6578.    [435]4.7.3.
  6579.    
  6580.    Here's an example for the client side, in which files to be sent are
  6581.    placed in a certain directory (/usr/olga/tosend in this example) by
  6582.    another process when they are ready to go. This might be in a hospital
  6583.    or big doctor's office, where medical insurance claims are entered at
  6584.    a number of workstations, and then deposited in the "tosend"
  6585.    directory, from which they are sent to a claims clearinghouse. We
  6586.    assume the connection is already made and a Kermit server is on the
  6587.    other end.
  6588.    
  6589.   local srcdir findir              ; Declare local (automatic) variables
  6590.   assign srcdir /usr/olga/tosend   ; Local source directory (files to send)
  6591.   assign findir /usr/olga/sent     ; Where to move files after they are sent
  6592.   log transactions                 ; Keep a log of transfers
  6593.   cd \m(srcdir)                    ; Change to the source directory
  6594.   while true {                     ; Loop forever...
  6595.       send /move-to:\m(findir) *   ; Send all files
  6596.       sleep 60                     ; Sleep a minute
  6597.   }                                ; Go back and do it again
  6598.  
  6599.    Note how simple this is. Once each file is sent, it is moved so it
  6600.    won't be sent again (you could also use SEND /RENAME-TO: or even SEND
  6601.    /DELETE). If a transfer fails, the file is not moved and so we try
  6602.    again to send it next time around. If there are no files to send, the
  6603.    SEND command does nothing but a message is printed; you can avoid the
  6604.    message by checking first to see if any files are in the directory:
  6605.    
  6606.   while true {                     ; Loop forever...
  6607.       if > \ffiles(*) 0 -          ; If there are any files
  6608.         send /move-to:\m(findir) * ; send them.
  6609.       sleep 60                     ; Sleep a minute.
  6610.   }                                ; Go back and do it again.
  6611.  
  6612.    It's even simpler on the server side (here again we assume the
  6613.    connection is already in place):
  6614.    
  6615.   local rcvdir findir              ; Declare local (automatic) variables
  6616.   assign rcvdir /usr/ivan/tmp      ; Temporary receiving directory
  6617.   assign findir /usr/ivan/new      ; Where to move files after reception
  6618.   log transactions                 ; Keep a log of transfers
  6619.   cd \m(rcvdir)                    ; Change to the source directory
  6620.   set receive move-to \m(findir)   ; Declare move-to directory.
  6621.   server                           ; Enter server mode.
  6622.  
  6623.    A separate process (e.g. the medical claim-form decoder) can look for
  6624.    files appearing in the /usr/ivan/new directory and process them with
  6625.    every confidence that they have been completely received.
  6626.    
  6627.    Note that the use of MOVE-TO can result in moved files overwriting one
  6628.    another (the application would normally avoid this by assigning each
  6629.    transaction a unique, e.g. based on customer number and claim number).
  6630.    But if filename collisions are a possibility in your application,
  6631.    RENAME-TO might be a better choice; you can use any variables you like
  6632.    in the template to ensure uniqueness of the RENAME-TO filename; for
  6633.    example:
  6634.    
  6635.   SET RECEIVE RENAME-TO \v(filename)_\v(ndate)_\v(ntime)_\v(userid)_\v(pid)
  6636.      _________________________________________________________________
  6637.    
  6638.   4.2. FILE-TRANSFER PIPES AND FILTERS
  6639.   
  6640.     4.2.1. INTRODUCTION
  6641.     
  6642.    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to send
  6643.    from a command, or "pipe", as well as from a file, and to receive to a
  6644.    pipe or command. In a typical example, we might want to transfer an
  6645.    entire directory tree from one UNIX system to another (but without
  6646.    using the methods described in [436]Sections 4.3 , [437]4.10,
  6647.    [438]4.11, and [439]4.15). We could do this in multiple steps as
  6648.    follows:
  6649.    
  6650.   1. Create a tar archive of the desired directory tree
  6651.   2. Compress the tar archive
  6652.   3. Transfer it in binary mode to the other computer
  6653.   4. Decompress it
  6654.   5. Extract the directory tree from the tar archive
  6655.  
  6656.    But this is inconvenient and it requires a temporary file, which might
  6657.    be larger than we have room for.
  6658.    
  6659.    The new pipe-transfer feature lets you do such things in a single
  6660.    step, and without intermediate files.
  6661.    
  6662.    Additional new features, also discussed here, let you specify pre- and
  6663.    post- processing filters for outbound and incoming files, and give you
  6664.    a way to insert the output from shell or system commands into C-Kermit
  6665.    commands.
  6666.    
  6667.    The file-transfer related features are available only with Kermit
  6668.    protocol, not with any external protocols, nor with K95's built-in
  6669.    XYZMODEM protocols (because XYZMODEM recovers from transmission errors
  6670.    by rewinding the source file, and you can't rewind a pipe).
  6671.    
  6672.    This section begins by discussing the simple and straightforward use
  6673.    of these features in UNIX, in which pipes and input/output redirection
  6674.    are a fundamental component and therefore "just work", and then goes
  6675.    on to discuss their operation in Windows and OS/2, where matters are
  6676.    much more complicated.
  6677.      _________________________________________________________________
  6678.    
  6679.     4.2.1.1. TERMINOLOGY
  6680.     
  6681.    Standard Input
  6682.           This is a precise technical term denoting the normal source of
  6683.           input for a command or program, which is the keyboard of your
  6684.           terminal by default, but which can be redirected to a file or
  6685.           pipe.
  6686.           
  6687.    Stdin
  6688.           Abbreviation for Standard Input.
  6689.           
  6690.    Standard Output
  6691.           A precise technical term denoting the normal destination for
  6692.           output from a command or program, which is your terminal screen
  6693.           by default, but which can be redirected to a file.
  6694.           
  6695.    Stdout
  6696.           Abbreviation for Standard Output.
  6697.           
  6698.    Stdio
  6699.           Abbreviation for Standard Input / Standard Output.
  6700.           
  6701.    I/O
  6702.           Abbreviation for Input / Output.
  6703.           
  6704.    Shell
  6705.           Text-based system command processor, such as the UNIX shell,
  6706.           DOS COMMAND.COM, etc.
  6707.           
  6708.    Pipe
  6709.           A mechanism by which the standard output of one program is sent
  6710.           to the standard input of another.
  6711.           
  6712.    Pipeline
  6713.           A series of programs connected by pipes.
  6714.      _________________________________________________________________
  6715.    
  6716.     4.2.1.2. NOTATION
  6717.     
  6718.    In command descriptions, "command" is replaced by a shell or system
  6719.    command or pipeline. The command names specified in these commands are
  6720.    interpreted by your shell, just as if you were typing them at the
  6721.    shell prompt, and so if they are in your PATH, they will be found in
  6722.    the expected manner. Therefore you don't have to specify complete
  6723.    pathnames for commands that are programs (but it shouldn't hurt if you
  6724.    do).
  6725.    
  6726.    The normal notation for I/O redirection is as follows:
  6727.    
  6728.   <  Read Stdin from the given file.
  6729.   >  Send Stdout to the given file.
  6730.   |  Send Stdout from the command on the left to the command on the right.
  6731.  
  6732.    Examples:
  6733.    
  6734.    sort < foo > bar
  6735.           Sorts the lines in file "foo" and writes the results to file
  6736.           "bar"
  6737.           
  6738.    grep -c "some text" *.txt | grep -v ":0" | sort | pr -3 | lpr
  6739.           This is a command pipeline composed of 5 commands:
  6740.           
  6741.    grep -c "some text" *.txt
  6742.           Looks in all files whose names end with ".txt" for the string
  6743.           "some text" and writes to Stdout the names of each file
  6744.           followed by a colon and the number of occurrences in each.
  6745.           
  6746.    grep -v ":0"
  6747.           Prints to Stdout the lines from Stdin that do NOT contain the
  6748.           string ":0", in this case, it removes the names of files that
  6749.           do not contain "some text".
  6750.           
  6751.    sort
  6752.           Sorts the lines from Stdin alphabetically to Stdout.
  6753.           
  6754.    pr -3
  6755.           Arranges the lines from Stdin in three columns.
  6756.           
  6757.    lpr
  6758.           Prints its Stdin on the default printer.
  6759.           
  6760.    Note that the Kermit features described here work only with commands
  6761.    that use Stdio. If you attempt to use them with commands whose input
  6762.    and output can not be redirected, Kermit will most likely get stuck.
  6763.    Kermit has no way of telling how an external command works, nor what
  6764.    the syntax of the shell is, so it's up to you to make sure you use
  6765.    these features only with redirectable commands.
  6766.    
  6767.    The quoting rules of your shell apply to the command. Thus in UNIX,
  6768.    where C-Kermit tries to use your preferred shell for running commands,
  6769.    shell "metacharacters" within commands must be escaped if they are to
  6770.    be taken literally, using the methods normal for your shell. For
  6771.    example, the UNIX tr (translate) command must have its arguments in
  6772.    quotes:
  6773.    
  6774.   tr "[a-z]" "[A-Z]"
  6775.  
  6776.    otherwise the shell is likely to replace them by all filenames that
  6777.    match, which is probably not what you want. This is also true when
  6778.    using your shell directly, and has nothing to do with Kermit.
  6779.      _________________________________________________________________
  6780.    
  6781.     4.2.1.3. SECURITY
  6782.     
  6783.    Some sites might not wish to allow access to system commands or
  6784.    external programs from within Kermit. Such access, including all the
  6785.    features described here, can be disabled in various ways:
  6786.    
  6787.     1. When building from source code, include -DNOPUSH among the CFLAGS.
  6788.     2. At runtime, give the NOPUSH command.
  6789.     3. For server mode, give the DISABLE HOST command.
  6790.     4. Implicit use of pipes can be disabled as described in [440]Section
  6791.        4.2.4.
  6792.        
  6793.    Note: 3 and 4 are not necessary if you have done 1 or 2.
  6794.      _________________________________________________________________
  6795.    
  6796.     4.2.2. Commands for Transferring from and to Pipes
  6797.     
  6798.    SEND /COMMAND sends data from a command or command pipeline, and
  6799.    RECEIVE /COMMENT writes data to a command or pipeline. The GET
  6800.    /COMMAND command asks a server to send material, and then writes the
  6801.    incoming material to a command or pipeline. These features, along with
  6802.    switches (like "/COMMAND", described in [441]Section 4.7) are new to
  6803.    C-Kermit 6.1. The following synonyms are also provided:
  6804.    
  6805.   CSEND    = SEND /COMMAND
  6806.   CRECEIVE = RECEIVE /COMMAND
  6807.   CGET     = GET /COMMAND
  6808.  
  6809.    None of these commands can be used if a SEND or RECEIVE FILTER
  6810.    (respectively, [442]Section 4.2.3) is in effect, or if a NOPUSH
  6811.    command ([443]Section 4.2.1.3) has been given, or if the current
  6812.    protocol is not Kermit.
  6813.      _________________________________________________________________
  6814.    
  6815.     4.2.2.1. Sending from a Command
  6816.     
  6817.    SEND /COMMAND command [ as-name ]
  6818.           
  6819.    SEND /AS-NAME:as-name /COMMAND command
  6820.           
  6821.    CSEND command [ as-name ]
  6822.           These three forms are the same. They work like the SEND
  6823.           command, but instead of sending a file, it sends the standard
  6824.           output of the given command, either under the command's own
  6825.           name, or else with the given as-name. If the command contains
  6826.           spaces, it must be enclosed in braces. Braces should also be
  6827.           used for the as-name if it contains spaces. If braces are
  6828.           included around either the command or the as-name, they are
  6829.           removed after parsing but before use. As with SEND, the
  6830.           transfer is in text or binary mode according the current FILE
  6831.           TYPE setting, unless you override the global transfer mode by
  6832.           including a /TEXT or /BINARY switch. The command must require
  6833.           no input.
  6834.           
  6835.    When sending from a command or pipeline, C-Kermit has no way of
  6836.    knowing in advance how much data will be sent, and so it can not send
  6837.    the size to the other Kermit in the Attribute packet, and so the
  6838.    receiving Kermit has no way of displaying "percent done" or a progress
  6839.    bar (thermometer).
  6840.    
  6841.    Examples that make sense in text mode (illustrated by common UNIX
  6842.    commands):
  6843.    
  6844.    SEND /COMMAND finger
  6845.           
  6846.    CSEND finger
  6847.           sends the current "finger" listing (who's logged in) under the
  6848.           name "finger". The two forms "send /command" and "csend" are
  6849.           equivalent; we won't bother showing them both in the rest of
  6850.           the examples.
  6851.           
  6852.    SEND /COMMAND:{finger}
  6853.           
  6854.    CSEND {finger}
  6855.           Same as previous example (braces are removed from "{finger}").
  6856.           
  6857.    SEND /COMMAND:{ finger }
  6858.           
  6859.    CSEND { finger }
  6860.           Same as previous example, but note that the spaces are kept.
  6861.           This does not prevent the shell from running the "finger"
  6862.           program, but its output is sent under the name " finger " (with
  6863.           a leading and trailing space).
  6864.           
  6865.    SEND /COMMAND:finger /AS-NAME:userlist
  6866.           
  6867.    CSEND finger userlist
  6868.           sends the current finger listing under the name "userlist".
  6869.           
  6870.    SEND /COMMAND:{finger | sort -r} /AS-NAME:userlist
  6871.           
  6872.    CSEND {finger | sort -r} userlist
  6873.           sends the current finger listing, sorted in reverse order,
  6874.           under the name "userlist". The braces are needed to distinguish
  6875.           the command from the as-name.
  6876.           
  6877.    SEND /COMMAND:{finger | sort -r} /AS-NAME:{userlist}
  6878.           
  6879.    CSEND {finger | sort -r} {userlist}
  6880.           Same as previous example (braces are removed from
  6881.           "{userlist}").
  6882.           
  6883.    SEND /COMMAND:{finger | sort -r}
  6884.           /AS-NAME:{\freplace(\v(filename),\32,_)}
  6885.           
  6886.    CSEND {finger | sort -r} {\freplace(\v(filename),\32,_)}
  6887.           Like the previous example, but sends the output of the command
  6888.           under the name of the command, but with all spaces (\32)
  6889.           replaced by underscores, so the as-name is "finger_|_sort_-r".
  6890.           
  6891.    Examples that make sense in binary mode (three equivalent forms are
  6892.    shown):
  6893.    
  6894.    SEND /COMMAND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
  6895.           
  6896.    SEND /COMMAND /BINARY /AS-NAME:mydir.tar.gz {tar cf - . | gzip -c}
  6897.           
  6898.    CSEND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
  6899.           Makes a tar archive of the current directory, compresses it
  6900.           with the GNU gzip program, and sends it as "mydir.tar.gz". The
  6901.           other Kermit can, of course, just store it as a file, or it can
  6902.           use CRECEIVE to uncompress and dearchive it as part of the
  6903.           transfer process.
  6904.           
  6905.    When using a "pipeline" of commands in the command field, obviously,
  6906.    the first command must not require any input, and the last command
  6907.    should produce some output, and all intermediate commands should get
  6908.    some input and produce some output.
  6909.      _________________________________________________________________
  6910.    
  6911.     4.2.2.2. Receiving to a Command
  6912.     
  6913.    RECEIVE /COMMAND command
  6914.           
  6915.    CRECEIVE command
  6916.           This is like RECEIVE, except incoming material is written to
  6917.           the standard input of the given command, in text or binary mode
  6918.           according to the normal rules for file reception. Be sure to
  6919.           include a redirector to a file (if the command normally writes
  6920.           to standard output), or the output of the command won't go
  6921.           anywhere. The command may contain spaces; braces are not
  6922.           needed, but they are removed if used.
  6923.           
  6924.    WARNING: C-Kermit has no way of knowing anything about the command, or
  6925.    even whether it is a command. Thus this command will always cause
  6926.    C-Kermit to enter protocol mode, as long as some text is specified in
  6927.    the command field. However, if the text does not correspond to a
  6928.    command, the transfer will eventually fail with a message such as
  6929.    "Error writing data" or "Failure to close file".
  6930.    
  6931.    Examples for text mode (in UNIX):
  6932.    
  6933.    RECEIVE /COMMAND sort -r > reverse.txt
  6934.           
  6935.    CRECEIVE sort -r > reverse.txt
  6936.           The text that is received is sorted in reverse order and stored
  6937.           in the file "reverse.txt". The two forms shown are equivalent.
  6938.           
  6939.    RECEIVE /COMMAND {sort -r > reverse.txt}
  6940.           
  6941.    CRECEIVE {sort -r > reverse.txt}
  6942.           The same as the previous example; if braces are included, they
  6943.           are simply removed.
  6944.           
  6945.    RECEIVE /COMMAND {sort -r > \flower(\v(filename)).reverse}
  6946.           
  6947.    CRECEIVE {sort -r > \flower(\v(filename)).reverse}
  6948.           Same but stores result under the incoming filename, lowercased,
  6949.           and with ".reverse" appended to it.
  6950.           
  6951.    RECEIVE /COMMAND sort
  6952.           
  6953.    CRECEIVE sort
  6954.           Does nothing useful, since the output of sort has nowhere to
  6955.           go.
  6956.           
  6957.    RECEIVE /COMMAND sort -r | pr -3 | lpr -Plaserjet
  6958.           
  6959.    CRECEIVE sort -r | pr -3 | lpr -Plaserjet
  6960.           The text that is received is sorted in reverse order, arranged
  6961.           into three columns, and sent to the "laserjet" printer.
  6962.           
  6963.    Examples for binary mode:
  6964.    
  6965.    RECEIVE /COMMAND:{gunzip -c | tar xf -}
  6966.           
  6967.    CRECEIVE {gunzip -c | tar xf -}
  6968.           Assuming the data that is received is a compressed tar archive,
  6969.           uncompresses the archive and passes it to tar for extraction.
  6970.           In this case the braces are needed because otherwise the final
  6971.           "-" would be taken as a command continuation character (see
  6972.           [444]Using C-Kermit, 2nd Edition, p.33).
  6973.           
  6974.    GET /COMMAND remote-file command
  6975.           
  6976.    GET /COMMAND /AS-NAME:command remote-file
  6977.           
  6978.    CGET remote-file command
  6979.           This command tells the Kermit client to send a GET request for
  6980.           the given remote file to a Kermit server. Unlike GET, however,
  6981.           the incoming material is written to a command, rather than to a
  6982.           file. If the remote-file or the command contain spaces, they
  6983.           must be enclosed in braces. The same cautions about the command
  6984.           apply as for CRECEIVE.
  6985.           
  6986.    Examples (for UNIX):
  6987.    
  6988.    GET /COMMAND oofa.txt sort -r > oofa.new
  6989.           
  6990.    GET /COMMAND {oofa.txt} {sort -r > oofa.new}
  6991.           
  6992.    CGET oofa.txt sort -r > oofa.new
  6993.           
  6994.    CGET {oofa.txt} {sort -r > oofa.new}
  6995.           These four are equivalent. Each of them requests the server to
  6996.           send its "oofa.txt" file, and as it arrives, it is sorted in
  6997.           reverse order and written to "oofa.new".
  6998.           
  6999.    GET /COMMAND {profile exec a} lpr
  7000.           
  7001.    GET /COMMAND {profile exec a} {lpr}
  7002.           
  7003.    GET /COMMAND /AS-NAME:lpr {profile exec a}
  7004.           
  7005.    GET /COMMAND /AS-NAME:{lpr} {profile exec a}
  7006.           
  7007.    GET /COMMAND /AS:lpr {profile exec a}
  7008.           
  7009.    CGET {profile exec a} lpr
  7010.           
  7011.    CGET {profile exec a} {lpr}
  7012.           Here the remote filename contains spaces so it MUST be enclosed
  7013.           in braces. As it arrives it is sent to the lpr program for
  7014.           printing. Braces are optional around "lpr" since it contains no
  7015.           spaces.
  7016.           
  7017.    GET /COMMAND *.txt {cat >> new.txt}
  7018.           
  7019.    GET /AS-NAME:{cat >> new.txt} /COMMAND *.txt
  7020.           
  7021.    CGET *.txt {cat >> new.txt}
  7022.           This gets all the ".txt" files from the server and concatenates
  7023.           them all into a single "new.txt" file on the client.
  7024.           
  7025.    GET /COMMAND *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
  7026.           
  7027.    CGET *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
  7028.           As above, but inserts each file's name before its contents.
  7029.      _________________________________________________________________
  7030.    
  7031.     4.2.3. Using File-Transfer Filters
  7032.     
  7033.    The commands described in [445]Section 4.2.2 let you send the output
  7034.    of a command, or receive data into a command. But what if you want to
  7035.    specify preprocessing for files that you send, or postprocessing of
  7036.    files that you receive, even when multiple files are involved? For
  7037.    this you need a way to specify send and receive filters. The commands
  7038.    are SET SEND FILTER and SET RECEIVE FILTER; SHOW PROTOCOL displays the
  7039.    current settings.
  7040.    
  7041.     4.2.3.1. The SEND Filter
  7042.     
  7043.    SET SEND FILTER [ command ]
  7044.           This command specifies a command to be run on any file that you
  7045.           SEND (or MOVE, MSEND, etc). It also applies to files sent when
  7046.           in server mode, in response to GET commands, but not to the
  7047.           results of REMOTE commands like REMOTE DIRECTORY, REMOTE TYPE,
  7048.           REMOTE HOST, etc. The command may be, but need not be, enclosed
  7049.           in braces; if it is, the braces are stripped before use. The
  7050.           output of this command is sent, rather than the file itself.
  7051.           The current FILE TYPE setting (TEXT or BINARY) applies to the
  7052.           output of the command. The command must contain at least one
  7053.           instance of \v(filename), for which the name of the actual file
  7054.           is substituted. If the command is omitted, the send filter is
  7055.           removed and files are sent in the normal manner.
  7056.           
  7057.    The SET SEND FILTER sets up a "global" filter -- that is, one that
  7058.    applies to all subsequent file-sending commands until you change or
  7059.    remove it. You can also specify a "local" filter to be used in a
  7060.    specific file-sending command by using the /FILTER switch (see
  7061.    [446]Section 1.5); for example:
  7062.    
  7063.   SEND /FILTER:command [ other-switches ] filename
  7064.  
  7065.    Besides \v(filename), you can include any other script programming
  7066.    notation in the send filter: variable names, array references, calls
  7067.    to built-in string or other functions, and so on. These are evaluated
  7068.    during file transfer, NOT during parsing, and they are evaluated
  7069.    separately for each file.
  7070.    
  7071.    When the SEND or MOVE (SEND /DELETE) command is used with a send
  7072.    filter, the output from the filter is sent under the file's original
  7073.    name unless you specify an "as-name" or template. The Attribute packet
  7074.    (if any) contains the original file's attributes (size, creation date,
  7075.    etc). So (for example) if the filter changes the file's size, the
  7076.    progress thermometer might be wrong. (We can't send the size of the
  7077.    output from the filter, because it is not known until the transfer is
  7078.    finished.) If you prefer that the size not be sent, use "set
  7079.    attributes size off".
  7080.    
  7081.    You can not use send filters with RESEND (SEND /RECOVER) or PSEND
  7082.    (SEND /START).
  7083.    
  7084.    Examples for text mode:
  7085.    
  7086.    SET SEND FILTER sort -r \v(filename) ; Braces may be omitted
  7087.           
  7088.    SET SEND FILTER {sort -r \v(filename)} ; Braces may be included
  7089.           
  7090.    SEND *.txt
  7091.           This sends every file in the current directory whose name ends
  7092.           with ".txt" under its own name, but with its lines sorted in
  7093.           reverse order.
  7094.           
  7095.    SEND /FILTER:{sort -r \v(filename)} *.txt
  7096.           Same as above, but the filter applies only to this SEND
  7097.           command. Braces are required in this case.
  7098.           
  7099.    SET SEND FILTER {sort -r \v(filename)}
  7100.           
  7101.    SEND oofa.txt reverse.txt
  7102.           Sends the oofa.txt file with its lines sorted in reverse order
  7103.           under the name "reverse.txt".
  7104.           
  7105.    SET SEND FILTER {sort -r \v(filename)}
  7106.           
  7107.    SEND oofa.* \v(filename).reverse
  7108.           Sends all the oofa.* files with their lines sorted in reverse
  7109.           order; each file is sent under its own name but with ".reverse"
  7110.           appended to it.
  7111.           
  7112.    SET SEND FILTER {tr "[a-z]" "[A-Z]" < \v(filename)}
  7113.           
  7114.    SEND *.txt
  7115.           Sends all ".txt" files under their own names, but uppercasing
  7116.           their contents.
  7117.           
  7118.    Note that the SEND FILTER applies not only to files that are sent with
  7119.    SEND, MOVE, MSEND, etc, but also to files sent by the C-Kermit server
  7120.    in response to GET requests.
  7121.    
  7122.    Examples for binary mode:
  7123.    
  7124.    SET SEND FILTER {gzip -c \v(filename)}
  7125.           
  7126.    SEND /BINARY oofa.txt oofa.txt.gz
  7127.           Sends the oofa.txt file, compressed by gzip, as oofa.txt.gz.
  7128.           
  7129.    SEND /BINARY /FILTER:{gzip -c \v(filename)} oofa.txt oofa.txt.gz
  7130.           As above, but the filter applies only to this SEND command.
  7131.           
  7132.    SET SEND FILTER {gzip -c \v(filename)}
  7133.           
  7134.    SEND /BINARY oofa.* \fupper(\replace(\v(filename),.,_)).GZ
  7135.           Sends all the oofa.* files, compressed by gzip, each under its
  7136.           own name, but with the name uppercased, all periods within the
  7137.           name converted to underscores, and ".GZ" appended to it. So,
  7138.           for example, "oofa.txt" is sent as "OOFA_TXT.GZ".
  7139.           
  7140.    In the gzip examples, note that the amount of data that is sent is
  7141.    normally less than the original file size because gzip compresses the
  7142.    file. But Kermit sends the original file size ahead in the attribute
  7143.    packet anyway (unless you tell it not too). Thus the transfer will
  7144.    probably appear to terminate early, e.g. when the receiver's
  7145.    file-transfer display thermometer is only at 40%. If this annoys you,
  7146.    tell Kermit to "set attribute length off". On the other hand, you can
  7147.    use the final position of the thermometer as a measure of the
  7148.    effectiveness of compression.
  7149.      _________________________________________________________________
  7150.    
  7151.     4.2.3.2. The RECEIVE Filter
  7152.     
  7153.    SET RECEIVE FILTER [ command ]
  7154.           This command specifies that the given command will be run on
  7155.           any file that is received before it is written to disk. The
  7156.           command may be, but need not be, enclosed in braces; if it is
  7157.           the braces are stripped before use. The following two commands
  7158.           are equivalent:
  7159.           
  7160.   SET RECEIVE FILTER sort -r > \v(filename)
  7161.   SET RECEIVE FILTER {sort -r > \v(filename)}
  7162.  
  7163.    The RECEIVE filter command may contain a "\v(filename)" sequence to be
  7164.    replaced by the incoming filename from the file header packet, but it
  7165.    is not required. However you must use it whenever your filter would
  7166.    normally write to Stdout, otherwise its output will be lost.
  7167.    
  7168.    The RECEIVE filter command may contain one or more "\v(filename)"
  7169.    sequence to be replaced by the incoming filename from the file header
  7170.    packet, but it is not required. However you must use it whenever your
  7171.    filter would normally write to Stdout, otherwise its output will be
  7172.    lost.
  7173.    
  7174.    RECEIVE /FILTER:command and GET /FILTER:command can also be used to
  7175.    specify a filter to be used for only one file-transfer operation.
  7176.    
  7177.    UNIX examples for text mode:
  7178.    
  7179.    SET RECEIVE FILTER lpr
  7180.           
  7181.    RECEIVE
  7182.           All the files that are received are sent to the default UNIX
  7183.           print spooler.
  7184.           
  7185.    RECEIVE /FILTER:lpr
  7186.           Same as above, except the lpr filter is used only with this
  7187.           RECEIVE command.
  7188.           
  7189.    RECEIVE lpr
  7190.           This is probably not what you want; it creates a file called
  7191.           lpr.
  7192.           
  7193.    SET RECEIVE FILTER {sort -r > \v(filename)}
  7194.           
  7195.    RECEIVE
  7196.           Stores each incoming file with its lines sorted in reverse
  7197.           order, under its own name.
  7198.           
  7199.    RECEIVE /FILTER:{sort -r > \v(filename)}
  7200.           As above, but the filter is used only for this RECEIVE command.
  7201.           
  7202.    SET RECEIVE FILTER sort -r > \v(filename)
  7203.           
  7204.    RECEIVE reverse.txt
  7205.           Stores each incoming file with its lines sorted in reverse
  7206.           order, under the name "reverse.txt". The actual result depends
  7207.           on the FILE COLLISION setting. If it is OVERWRITE and multiple
  7208.           files arrive, then each incoming file destroys the previous
  7209.           one. If it is BACKUP (the default), filename conflicts are
  7210.           resolve by adding "version numbers" to the filenames:
  7211.           reverse.txt, reverse.txt.~1~, reverse.txt.~2~, etc.
  7212.           
  7213.    SET RECEIVE FILTER sort -r > \v(filename)
  7214.           
  7215.    RECEIVE \v(filename).reverse
  7216.           Stores each incoming file with its lines sorted in reverse
  7217.           order, under the name it arrived with, but with ".reverse"
  7218.           appended to it.
  7219.           
  7220.    SET RECEIVE FILTER sort -r > \v(filename)
  7221.           
  7222.    RECEIVE \flower(\v(filename)).reverse
  7223.           Like the previous example, but ensures that the filename is
  7224.           lowercase.
  7225.           
  7226.           Examples for binary mode:
  7227.           
  7228.    SET RECEIVE FILTER gunzip -c > \v(filename)
  7229.           
  7230.    RECEIVE
  7231.           This receives one or more presumably compressed file and
  7232.           uncompresses each one into a file having the same name it was
  7233.           sent with. For example, if the file is sent with the name
  7234.           OOFA.TXT.GZ, it is stored with that name, even after
  7235.           decompression.
  7236.           
  7237.    SET RECEIVE FILTER gunzip -c > \v(filename)
  7238.           
  7239.    RECEIVE \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
  7240.           Like the previous example, but the resulting filename has its
  7241.           rightmost three characters removed from it and the remainder is
  7242.           lowercased. So if the incoming filename is OOFA.TXT.GZ, it is
  7243.           stored as oofa.txt after decompression.
  7244.           
  7245.    Of course you don't want to type such long hideous commands, so we
  7246.    have also introduced several new functions:
  7247.    
  7248.    \fstripx(string[,character])
  7249.           This function removes the rightmost segment of the string that
  7250.           starts with the given character. If no character is given,
  7251.           period (.) is used. Thus it is most conveniently used for
  7252.           stripping the extension from a filename (or the decimal portion
  7253.           from a floating-point number written in US/UK style). Examples:
  7254.           
  7255.    \fstripx(OOFA.TXT.GZ)             => OOFA.TXT
  7256.    \fstripx(OOFA.TXT.GZ,.)           => OOFA.TXT
  7257.    \fstripx(OOFA.TXT.GZ,X)           => OOFA.T
  7258.    \fstripx(\fstripx(OOFA.TXT.GZ))   => OOFA
  7259.    \fstripx($100.00)                 => $100
  7260.  
  7261.    \fstripn(string,number)
  7262.           Removes the rightmost number characters from the string.
  7263.           Examples:
  7264.           
  7265.    \fstripn(OOFA.TXT.GZ)             => OOFA.TXT.GZ
  7266.    \fstripn(OOFA.TXT.GZ,3)           => OOFA.TXT
  7267.    \fstripn(OOFA.TXT.GZ,7)           => OOFA
  7268.  
  7269.    \fstripb(string[,c1[,c2]])
  7270.           Strips enclosing matching braces, brackets, parentheses, or
  7271.           quotes from the string. The second argument, c1, specifies
  7272.           which kind of enclosure to look for; if not specified, any
  7273.           enclosing (), [], <>, {}, "", '', or `' are removed. If c1 is
  7274.           specified and c2 is not, then if c1 is an opening brace,
  7275.           bracket, or parenthesis, the matching closing one is supplied
  7276.           automatically as c2. If both c1 and c2 are specified, then to
  7277.           be stripped the string must begin with c1 and end with c2. If
  7278.           the string is not enclosed in the indicated manner, the result
  7279.           is the original string. Examples:
  7280.           
  7281.    \fstripb("abc")                   => abc
  7282.    \fstripb([abc])                   => abc
  7283.    \fstripb([abc)                    => [abc
  7284.    \fstripb(<abc>)                   => abc
  7285.    \fstripb(<abc>,[)                 => <abc>
  7286.    \fstripb((abc))                   => abc
  7287.    \fstripb((abc),[)                 => (abc)
  7288.    \fstripb((abc),{(})               => abc
  7289.    \fstripb(+abc+)                   => +abc+
  7290.    \fstripb(+abc+,+)                 => abc
  7291.    \fstripb(+abc+,+,^)               => +abc+
  7292.    \fstripb(+abc^,+,^)               => abc
  7293.    \fstripb('abc')                   => abc
  7294.    \fstripb(`abc')                   => abc
  7295.    \fstripb(``abc'')                 => `abc'
  7296.    \fstripb(\fstripb(``abc''))       => abc
  7297.  
  7298.           Notice the special syntax required for including a literal
  7299.           parenthesis in the argument list. As the last two examples
  7300.           illustrate, \fstripb() strips only one level at at a time;
  7301.           nesting can be used to strip a small fixed number of levels;
  7302.           loops can be used to strip larger or indeterminate numbers of
  7303.           levels.
  7304.           
  7305.    \flop(string[,char])
  7306.           Removes the leftmost segment of the string that ends with the
  7307.           given character. If no character is given, period (.) is used.
  7308.           Examples:
  7309.           
  7310.   \flop(OOFA.TXT.GZ)               => TXT.GZ
  7311.   \flop(OOFA.TXT.GZ,.)             => TXT.GZ
  7312.   \flop(OOFA.TXT.GZ,X)             => T.GZ
  7313.  
  7314.           To remove the leftmost number characters, just use
  7315.           \fsubstring(s,number+1). To return the rightmost number
  7316.           characters, use \fright(s,number).
  7317.           
  7318.    So the hideous example:
  7319.    
  7320.   receive \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
  7321.  
  7322.    can now be written as:
  7323.    
  7324.   receive \flower(\fstripx(\v(filename)))
  7325.  
  7326.    That is, the filename stripped of its extension and then lowercased.
  7327.    This is not only shorter and less hideous, but also does not depend on
  7328.    the length of the extension being 3.
  7329.    
  7330.    Note that when a receive filter is in effect, this overrides your FILE
  7331.    COLLISION setting, since Kermit has no way of knowing what the final
  7332.    destination filename will be (because it does not know, and can not be
  7333.    expected to know, the syntax of every version of every command shell
  7334.    on every platform on the planet).
  7335.      _________________________________________________________________
  7336.    
  7337.     4.2.4. Implicit Use of Pipes
  7338.     
  7339.    If you wish, C-Kermit can also examine incoming filenames to see if
  7340.    they start with "!", and if so, the subsequent text is treated as a
  7341.    command to read from or write to. For example, if a Kermit client is
  7342.    given the following command:
  7343.    
  7344.   get {!finger | sort}
  7345.  
  7346.    the server on the other end, if it supports this feature, will run the
  7347.    "finger" program, pipe its standard output to the "sort" program, and
  7348.    send sort's standard output back to you. Similarly, if you:
  7349.    
  7350.   send oofa.txt !sort -r > oofa.new
  7351.  
  7352.    or, equivalently:
  7353.    
  7354.   send oofa.txt {!sort -r > oofa.new}
  7355.  
  7356.    or:
  7357.    
  7358.   send /as-name:{!sort -r > oofa.new} oofa.txt
  7359.  
  7360.    this has the receiver send the contents of the incoming oofa.txt file
  7361.    to the sort program, which sorts the text in reverse order and stores
  7362.    the result in oofa.new.
  7363.    
  7364.    This use of the exclamation mark should be familiar to UNIX users as
  7365.    the "bang" feature that lets you run an external application or
  7366.    command from within another application.
  7367.    
  7368.    Kermit's "bang" feature is disabled by default, since it is not
  7369.    unheard for filenames to actually begin with "!". So if you want to
  7370.    use this feature, you must enable it with the following command:
  7371.    
  7372.    SET TRANSFER PIPES { ON, OFF }
  7373.           ON enables the recognition of "!" notation in incoming
  7374.           filenames during file transfer as an indicator that the
  7375.           remaining text is the name of a command. OFF, the default,
  7376.           disables this feature and uses the text as a filename in the
  7377.           normal fashion. This command does NOT affect SEND /COMMAND, GET
  7378.           /COMMAND, CSEND, etc.
  7379.           
  7380.    So using a combination of CSEND (SEND /COMMAND) and the "bang"
  7381.    feature, you can transfer a directory tree all in one command
  7382.    (assuming the remote Kermit supports pipe transfers and has them
  7383.    enabled):
  7384.    
  7385.   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
  7386.  
  7387.    or:
  7388.    
  7389.   SEND /COMMAND:{tar cf - . | gzip -c} /as:{!gunzip -c | tar xf -}
  7390.  
  7391.    Pay close attention to the syntax. Braces are needed around the
  7392.    command because it contains spaces; braces are needed around the
  7393.    as-name because it ends with "-". The as-name must begin with "!" or
  7394.    receiving Kermit will not recognize it as a command. The CSEND command
  7395.    must NOT begin with "!" unless you are running a command whose name
  7396.    really does start that character.
  7397.    
  7398.    Similarly, you have a Kermit server send a directory tree to be
  7399.    unpacked on the client end:
  7400.    
  7401.   CGET {!tar cf - . | gzip -c} {gunzip -c | tar xf -}
  7402.  
  7403.    or:
  7404.    
  7405.   GET /COMMAND {!tar cf - . | gzip -c} /as:{gunzip -c | tar xf -}
  7406.  
  7407.    Notice how, in this case, the bang is required in the remote command,
  7408.    to distinguish it from a filename, but not in the local command, since
  7409.    by definition of CGET (or GET /COMMAND), it is known to be a command.
  7410.    
  7411.    SEND and RECEIVE FILTERs supersede the bang feature. For example, if a
  7412.    file arrives under the name "!gunzip -c | tar xf -", but the receiving
  7413.    Kermit also has been given a command like:
  7414.    
  7415.   set receive filter sort -r > \v(filename)
  7416.  
  7417.    then the incoming data will be sorted rather than gunzipped.
  7418.    
  7419.    Finally, if SET TRANSFER PIPES is ON (and in this case, this must be
  7420.    done in your C-Kermit initialization file), you can send from a pipe
  7421.    on the C-Kermit command line:
  7422.    
  7423.   kermit -s "!finger | sort -r" -a userlist
  7424.  
  7425.    In this case the "filename" contains spaces and so must be quoting
  7426.    using your shell's quoting rules.
  7427.      _________________________________________________________________
  7428.    
  7429.     4.2.5. Success and Failure of Piped Commands
  7430.     
  7431.    Commands or programs started by Kermit as a result of CSEND or
  7432.    CRECEIVE commands, CGET, SEND /COMMAND, REDIRECT commands (see
  7433.    [447]Section 4.2.8.2), implicit use of pipes, RUN commands, and so
  7434.    forth, should return their exit status codes to the Kermit command
  7435.    that caused them to be run, and therefore IF SUCCESS and IF FAILURE
  7436.    tests after these commands should work as expected. For example:
  7437.    
  7438.   CSEND blah < filename
  7439.  
  7440.    should fail if there is no command called "blah" or if there is no
  7441.    file called "filename". However, this is not foolproof and sometimes
  7442.    C-Kermit might think a command succeeded when it failed, or vice
  7443.    versa. This is most likely to happen when the highly system-dependent
  7444.    methods that Kermit must use to determine a command's exit status code
  7445.    do not supply the right information.
  7446.    
  7447.    It can also happen because some commands might define success and
  7448.    failure differently from what you expect, or because you are using a
  7449.    pipeline composed of many commands, and one of them fails to pass
  7450.    failing exit status codes up the chain. The most likely culprit is the
  7451.    shell itself, which in most cases must be interposed between Kermit
  7452.    and any external program to be run.
  7453.    
  7454.    In any case, you can examine the following variable to find out the
  7455.    exit status code returned to Kermit by the process most recently run
  7456.    by any command that runs external commands or programs, including
  7457.    CSEND, CRECEIVE, REDIRECT, RUN, etc:
  7458.    
  7459.   \v(pexitstat)
  7460.  
  7461.    In UNIX, Windows and OS/2, the value should be -2 if no command has
  7462.    been run yet, 0 if the most recent command succeeded, -1, -3, or -4 if
  7463.    there was an internal error, and a positive number returned by the
  7464.    command itself if the command failed. If the number is in the range
  7465.    1-127, this is the program's exit status code. If it is 128 or
  7466.    greater, this is supposed to indicate that the command or program was
  7467.    interrupted or terminated from outside itself.
  7468.    
  7469.    In Windows 95 and 98, the return values of the default shell are
  7470.    unreliable; various third-party shells can be used to work around this
  7471.    deficiency.
  7472.    
  7473.    In VMS, it is the actual exit status code of the command that was run.
  7474.    This is an odd number if the command succeeded, and an even number if
  7475.    it failed. You can see the associated message as follows:
  7476.    
  7477.   run write sys$output f$message(\v(pexitstat))
  7478.  
  7479.    Or, more conveniently, use the new Kermit function:
  7480.    
  7481.   echo \ferrstring(\v(pexitstat))
  7482.  
  7483.    which converts a system error code (number) to the corresponding
  7484.    message.
  7485.      _________________________________________________________________
  7486.    
  7487.     4.2.6. Cautions about Using Pipes to Transfer Directory Trees
  7488.     
  7489.    Although utilities such as tar and zip/unzip might be available on
  7490.    different platforms (such as UNIX and Windows), this does not
  7491.    necessarily mean you can use them successfully to transfer directory
  7492.    trees between unlike platforms. For example:
  7493.    
  7494.   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
  7495.  
  7496.    when used from UNIX to Windows will have satisfactory results for
  7497.    binary files, but not for text files. UNIX text files have lines
  7498.    ending with Linefeed (LF) only, whereas Windows text files have lines
  7499.    ending in Carriage Return and Linefeed (CRLF). Thus any text files
  7500.    that were in the archive formed by the first tar command will be
  7501.    unpacked by the second tar command in their original form, and will
  7502.    display and print incorrectly in Windows (except in applications that
  7503.    have been explicitly coded to handle UNIX-format text files). On the
  7504.    other hand if you told gzip to use "text mode" to do record format
  7505.    conversion (assuming there was a way to tell it, as there is with most
  7506.    "zip" programs), this would destroy any binary files in the archive.
  7507.    
  7508.    Furthermore, if the archive contains text files that are written in
  7509.    languages other than English, the "special" (accented and/or
  7510.    non-Roman) characters are NOT translated, and are therefore likely
  7511.    show up as gibberish on the target system. For example, West European
  7512.    languages are usually encoded in ISO Latin Alphabet 1 in UNIX, but in
  7513.    PC code page 850 on the PC. Capital A with acute accent is code point
  7514.    193 (decimal) Latin-1, but 181 in CP850. So A-acute in the UNIX file
  7515.    becomes Middle Box Bottom on the PC, and similarly for all the other
  7516.    special characters, and for all other languages -- Greek, Russian,
  7517.    Hebrew, Japanese, etc.
  7518.    
  7519.    So when transferring text files between unlike platforms, you should
  7520.    use direct Kermit file transfers so Kermit can apply the needed
  7521.    record-format and character-set transformations. Use pipelines
  7522.    containing archivers like tar or zip only if all the files are binary
  7523.    or the two systems use the same record format and character set for
  7524.    text files.
  7525.    
  7526.    Also see [448]Sections 4.3, [449]4.10, [450]4.11, and [451]4.15 for
  7527.    how to transfer directory trees between both like and unlike systems
  7528.    directly with Kermit.
  7529.      _________________________________________________________________
  7530.    
  7531.     4.2.7. Pipes and Encryption
  7532.     
  7533.    Of course pipelines could be used for encrypted file transfers,
  7534.    assuming proper precautions could be taken concerning the transmission
  7535.    of the key. But there is rarely a good way to do this. To illustrate
  7536.    using UNIX crypt:
  7537.    
  7538.   csend {crypt key < filename} {!crypt key > filename}
  7539.  
  7540.    Or, more ambitiously:
  7541.    
  7542.   csend {tar cf - . | gzip -c | crypt key} {!crypt key | gunzip -c | tar xf -}
  7543.  
  7544.    transmits the key in the file header packet as part of the
  7545.    (clear-text) remote command, defeating the entire purpose of
  7546.    encrypting the file data.
  7547.    
  7548.    But if you are connected in terminal mode to the remote computer and
  7549.    type:
  7550.    
  7551.   creceive {crypt key > filename}
  7552.  
  7553.    at the remote Kermit prompt, you have also transmitted the key in
  7554.    clear text over the communications link.
  7555.    
  7556.    At present, the only secure way to use CSEND and CRECEIVE with an
  7557.    encryption filter is to have a human operator at both ends, so the key
  7558.    does not have to be transmitted.
  7559.    
  7560.    Theoretically it would be possible to use PGP software (Pretty Good
  7561.    Privacy, by Phil Zimmerman, Phil's Pretty Good Software) to avoid key
  7562.    transmission (since PGP uses separate public and private key and "lets
  7563.    you communicate securely with people you've never met, with no secure
  7564.    channels needed for prior exchange of keys"), but the specific method
  7565.    has yet to be worked out.
  7566.    
  7567.      HINT: See the PGP User's Guide, e.g. at:
  7568.      [452]http://www.telstra.com.au/docs/PGP/
  7569.      Especially the topic "Using PGP as a UNIX-Style Filter":
  7570.      [453]http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
  7571.      
  7572.    In any case, better and more convenient security options are now
  7573.    available: Kerberos authentication and encryption ([454]CLICK HERE for
  7574.    details) and the new ability to run C-Kermit "though" other
  7575.    communication programs, described in [455]Section 2.7.
  7576.      _________________________________________________________________
  7577.    
  7578.     4.2.8. Commands and Functions Related to Pipes
  7579.     
  7580.     4.2.8.1. The OPEN !READ and OPEN !WRITE Commands
  7581.     
  7582.    These are described in [456]Using C-Kermit, and are generally useful
  7583.    with reading output from commands that produce more than one line on
  7584.    their standard output, or writing multiple lines into commands that
  7585.    accept them on their standard input.
  7586.    
  7587.    In C-Kermit 7.0 CLOSE !READ is accepted as a synonym for CLOSE READ,
  7588.    and CLOSE !WRITE for CLOSE WRITE.
  7589.    
  7590.    Testing the success and failure of these commands, however, can be a
  7591.    bit tricky. Consider:
  7592.    
  7593.   open !read lalaskjfsldkfjsldkfj
  7594.  
  7595.    (where "lalaskjfsldkfjsldkfj" is neither a valid command nor the name
  7596.    of a program or script that can be run). OPEN !READ, in UNIX at least,
  7597.    translates this into execl(shellpath,shellname,"-c",command). This
  7598.    means it starts your preferred shell (e.g. from the SHELL environment
  7599.    variable) and asks it to execute the given command. It must be this
  7600.    way, because your command can be a either an internal shell command
  7601.    (which only your shell can execute) or an external command, which only
  7602.    your shell knows how to find (it knows your PATH and interprets, etc).
  7603.    Therefore unless OPEN !READ can't start your shell, it always
  7604.    succeeds.
  7605.    
  7606.    Continuing with the nonexistent-command example:
  7607.    
  7608.   C-Kermit> open !read lalaskjfsldkfjsldkfj
  7609.   C-Kermit> status
  7610.    SUCCESS
  7611.   C-Kermit> read line
  7612.   C-Kermit> status
  7613.    SUCCESS
  7614.   C-Kermit> echo "\m(line)"
  7615.   "bash: lalaskjfsldkfjsldkfj: command not found"
  7616.   C-Kermit> close read
  7617.   C-Kermit> status
  7618.    FAILURE
  7619.   C-Kermit>
  7620.  
  7621.    In other words, the failure can not be detected on OPEN, since the
  7622.    OPEN command succeeds if it can start your shell. It can't be detected
  7623.    on READ, since all this does is read output from the shell, which in
  7624.    this case happens to be an error message. However, failure IS detected
  7625.    upon close, since this is the occasion upon which the shell gives
  7626.    Kermit its exit status code.
  7627.    
  7628.    For an illustration of this situation, see [457]Section 2.14.
  7629.      _________________________________________________________________
  7630.    
  7631.     4.2.8.2. The REDIRECT Command
  7632.     
  7633.    A second method of I/O redirection is offered by the REDIRECT command.
  7634.    This is a rather advanced and tricky feature that is presently
  7635.    supported only in UNIX C-Kermit, in OS-9 C-Kermit, and in Kermit 95.
  7636.    Syntax:
  7637.    
  7638.    REDIRECT command
  7639.           Runs the given command, sending its standard output to the
  7640.           current communications channel (SET LINE, SET PORT, or SET HOST
  7641.           connection), and reading its standard input from the same
  7642.           connection. Works only in local mode -- i.e. a connection is
  7643.           required -- and then only if the given command uses Standard
  7644.           I/O.
  7645.           
  7646.    Example:
  7647.    
  7648.   redirect finger
  7649.  
  7650.    runs the local "finger" command and sends its output over the
  7651.    connection as plain text, where presumably there is a process set up
  7652.    to read it. Another example:
  7653.    
  7654.   redirect finger | sort -r
  7655.  
  7656.    shows the use of a pipeline.
  7657.    
  7658.    Note: REDIRECT differs from CSEND/CRECEIVE in two important ways: (1)
  7659.    it does not use the Kermit protocol, and (2) it uses a bidirectional
  7660.    pipe rather than a one-way pipe.
  7661.    
  7662.    The primary use of the REDIRECT command is to run external protocols,
  7663.    such as sz/rz in UNIX for ZMODEM, when they work over Standard I/O(*).
  7664.    Example:
  7665.    
  7666.   set host xyzcorp.com
  7667.   (login, etc)
  7668.   redirect sz oofa.zip
  7669.  
  7670.    lets you make a Telnet connection with C-Kermit and then do a ZMODEM
  7671.    transfer over it. ZMODEM protocol messages go both ways over the same
  7672.    connection simultaneously.
  7673.    
  7674.    It is possible to use C-Kermit on UNIX as your PPP dialer and then to
  7675.    REDIRECT the connection to the PPP software, but C-Kermit 7.0 offers a
  7676.    better approach to PPP dialing in its new EXEC command ([458]Section
  7677.    1.23).
  7678.    
  7679.    In theory, you can also redirect an interactive process. For example,
  7680.    suppose you tell Kermit 95 to wait for an incoming TCP/IP connection:
  7681.    
  7682.   set host * 3000
  7683.  
  7684.    and then tell C-Kermit on UNIX to:
  7685.    
  7686.   set host kermit95hostname 3000
  7687.   redirect ksh
  7688.  
  7689.    and then tell Kermit 95 to CONNECT: now you are talking to the UNIX
  7690.    K-shell; you can give commands (pwd, ls, etc) and see the results. In
  7691.    practice, the K-shell's terminal modes are messed up because (a) it is
  7692.    not going through the Unix terminal driver, and (b) it is "smart" and
  7693.    knows it is being redirected, and so acts in a decidedly inhospitable
  7694.    manner (other applications like EMACS, vi, etc, simply refuse to run
  7695.    if their standard i/o has been redirected).
  7696.    
  7697.      (*) The publicly-distributed sz/rz programs do not work as clients.
  7698.      However, Omen Technology does offer an up-to-date redirectable
  7699.      client XYZMODEM program called crzsz.
  7700.      _________________________________________________________________
  7701.    
  7702.     4.2.8.3. Receiving Mail and Print Jobs
  7703.     
  7704.    As of 7.0, and in UNIX only, files that are sent to C-Kermit as mail
  7705.    (when the other Kermit uses a MAIL or SEND /MAIL command) or to be
  7706.    printed (via REMOTE PRINT or SEND /PRINT) are now piped directly to
  7707.    the mail or print program, rather than written to temporary files and
  7708.    then mailed or printed and then deleted. This has the advantages of
  7709.    (a) not requiring a temporary file, and (b) allowing mail to have a
  7710.    proper subject in place of the filename. Temporary files were bad not
  7711.    only because they required (a) space, and (b) writeability of the
  7712.    current directory, but also because using them could result in wiping
  7713.    out an existing file. See [459]Section 4.7 for more about SEND /MAIL
  7714.    and SEND /PRINT.
  7715.      _________________________________________________________________
  7716.    
  7717.     4.2.8.4. Pipe-Related Functions
  7718.     
  7719.    The \fcommand(command) function runs the given shell or system command
  7720.    and returns the command's standard output as its value (with any
  7721.    newline characters stripped from the end), unless the result is too
  7722.    long, in which case it returns the empty string. The maximum length
  7723.    for the result is at least 1022 bytes, and it might be longer on some
  7724.    platforms. Examples (UNIX):
  7725.    
  7726.   C-Kermit> echo "\fcommand(date)"
  7727.   "Fri Apr 18 13:31:42 1997"
  7728.   C-Kermit> echo "\fcommand(finger | wc -l)" ; how many users logged in?
  7729.   "      83"
  7730.   C-Kermit> evaluate \fcommand(finger | wc -l) * 2
  7731.   166
  7732.   C-Kermit> echo Welcome to \fcommand(tty) on \fcommand(date)
  7733.   Welcome to /dev/ttyre on Fri Apr 18 13:31:42 1997
  7734.   C-Kermit> echo "\fcommand(ls oofa.*)"
  7735.   "oofa.c
  7736.   oofa.h
  7737.   oofa.o"
  7738.   C-Kermit> cd /directory-with-thousands-of-files
  7739.   C-Kermit> echo "\fcommand(ls -l)" ; This would be too long
  7740.   ""
  7741.   C-Kermit>
  7742.  
  7743.    If a command's output would be too long, you can use the other, more
  7744.    laborious method of reading from a command: OPEN !READ command, READ
  7745.    each line, CLOSE !READ.
  7746.    
  7747.    The \frawcommand(command) function is identical to \fcommand(command),
  7748.    except it does not remove trailing newline characters:
  7749.    
  7750.   C-Kermit> echo "\frawcommand(date)"
  7751.   "Fri Apr 18 13:31:42 1997
  7752.   "
  7753.   C-Kermit> echo "\frawcommand(ls oofa.*)"
  7754.   "oofa.c
  7755.   oofa.h
  7756.   oofa.o
  7757.   "
  7758.   C-Kermit>
  7759.  
  7760.    Use \frawcommand() if you want to retain the final line terminators,
  7761.    or if the command's output is "binary". But remember that if the
  7762.    result of this (or any other) function contains any NUL (ASCII code 0)
  7763.    characters, the first NUL will terminate the result string because
  7764.    this is how C strings work (it's "C-Kermit", remember?).
  7765.    
  7766.    These functions are useful not only locally, but also in the
  7767.    client/server arena. If you need to get the results from a system
  7768.    command on the server end into a variable on the client end, just do:
  7769.    
  7770.   [ remote ] query kermit command(date)
  7771.  
  7772.    The result is in the local \v(query) variable; see [460]Using
  7773.    C-Kermit, 2nd Ed., pp.359-360 for details.
  7774.      _________________________________________________________________
  7775.    
  7776.   4.3. Automatic Per-File Text/Binary Mode Switching
  7777.   
  7778.    When transferring files between like systems (e.g. UNIX-to-UNIX),
  7779.    binary mode can be used for all files unless character-set translation
  7780.    is needed, and in fact Kermit programs of recent vintage recognize
  7781.    each others' platforms and switch to binary mode automatically when it
  7782.    is appropriate (e.g. DOS to OS/2, or UNIX to UNIX). (Exception:
  7783.    LABELED mode is chosen for VMS-to-VMS and OS/2-to-OS/2 transfers so
  7784.    complex file formats can be preserved.)
  7785.    
  7786.    On a client/server connection between like systems, the transfer mode
  7787.    is currently determined by the file sender, rather than always by the
  7788.    client. If the client is sending, it controls the transfer mode. If a
  7789.    GET command is sent to the server, the server sends all files in
  7790.    binary mode if its TRANSFER CHARACTER-SET is TRANSPARENT; otherwise it
  7791.    uses text mode for text files (according to its text-pattern list) and
  7792.    binary mode for binary files. Of course, the client can control the
  7793.    server's transfer character-set with the REMOTE SET TRANSFER
  7794.    CHARACTER-SET command.
  7795.    
  7796.    When transferring files between unlike systems, however, (e.g.
  7797.    UNIX-to-DOS), some files (such as executable program images) must be
  7798.    transferred in binary mode but others (such as plain-text files) must
  7799.    be transferred in text mode so their record format and character sets
  7800.    can be appropriately converted. If a binary file is transferred in
  7801.    text mode, it is ruined. If a text file is transferred in binary mode,
  7802.    then at the very least, its format can be incorrect; at worst it is
  7803.    also corrupted because its character set was not converted (in extreme
  7804.    cases the corruption is total, e.g. because one system is ASCII-based
  7805.    and the other EBCDIC).
  7806.      _________________________________________________________________
  7807.    
  7808.     4.3.1. Exceptions
  7809.     
  7810.    VMS C-Kermit, when sending files to a non-VMS system, switches to text
  7811.    or binary mode automatically for each file, based on the record format
  7812.    in the file's directory entry; thus the mechanisms described in this
  7813.    section do not apply to VMS C-Kermit, yet the effect is the same:
  7814.    automatic text/binary mode switching when VMS C-Kermit is sending
  7815.    files. See the VMS Appendix of [461]Using C-Kermit for details.
  7816.    
  7817.    Kermit versions that support LABELED or IMAGE transfer mode are
  7818.    likewise not affected by this feature when one of those modes is
  7819.    selected (normally used only when transferring between like systems).
  7820.    
  7821.    Kermit versions that support file-transfer pipes and filters are not
  7822.    affected by this feature when pipes or filters are used, since the
  7823.    output of a pipe or filter (such as gzip) is likely to require
  7824.    transfer in a different mode than the original file.
  7825.    
  7826.    Finally, SEND /TEXT or SEND /BINARY will force files to be sent in the
  7827.    indicated mode, overriding all automatic transfer-mode-choosing
  7828.    mechanisms.
  7829.      _________________________________________________________________
  7830.    
  7831.     4.3.2. Overview
  7832.     
  7833.    Suppose you give C-Kermit a command like:
  7834.    
  7835.   SEND *.*
  7836.  
  7837.    And suppose the pattern *.* matches a mixture of text files (such as
  7838.    program source code) and binary files (such os object modules or
  7839.    executable programs).
  7840.    
  7841.    C-Kermit 6.0 and earlier (except on VMS) send all files in the same
  7842.    mode: whatever you said in your most recent SET FILE TYPE command, or
  7843.    else whatever mode was chosen automatically according to the rules on
  7844.    page 236 of Using C-Kermit, 2nd Ed.
  7845.    
  7846.    But when text and binary files are mixed in the same group, and the
  7847.    files are being transferred to an unlike system (e.g. UNIX to IBM
  7848.    Mainframe), this results in corruption of either all the text files or
  7849.    all the binary files.
  7850.    
  7851.    Stream-oriented file systems such as in UNIX and DOS do not record any
  7852.    information about the file to tell us whether the file should be
  7853.    transferred in binary or text mode, making it impossible to select the
  7854.    transfer mode for each file in a group automatically with any
  7855.    certainty.
  7856.    
  7857.    However, we can use some fairly-well established file naming
  7858.    conventions for this purpose. C-Kermit 7.0 lets you provide lists of
  7859.    filename patterns that are used to separately determine the file type
  7860.    for each individual file being transfered. A pattern is a string,
  7861.    possibly containing the special characters "*" (asterisk, which
  7862.    matches any string of zero of more characters) and/or "?" (question
  7863.    mark, which matches any single character). For example "a*b" matches
  7864.    all files whose names start with "a" and end with "b", such as "ab",
  7865.    "arb", "ababababab", etc, but not "abba". And "a?b" matches any file
  7866.    whose name starts with "a", ends with "b", and is exactly 3 characters
  7867.    long.
  7868.    
  7869.      NOTE: When typing commands at the C-Kermit prompt, you must prefix
  7870.      "?" with \ to override its normal function of giving help.
  7871.      
  7872.    (Also see [462]Section 4.9 for additional pattern-matching notations
  7873.    that might be available in your version of C-Kermit.)
  7874.    
  7875.    When you have specified filename recognition patterns, C-Kermit can
  7876.    transfer the ones whose names match any of the binary-mode patterns in
  7877.    binary mode, and those with names that match any of the text-mode
  7878.    patterns in text mode, and those whose names match neither in the
  7879.    prevailing mode you have chosen, or that was chosen automatically via
  7880.    peer recognition.
  7881.      _________________________________________________________________
  7882.    
  7883.     4.3.3. Commands
  7884.     
  7885.    SET FILE PATTERNS { ON, OFF, AUTO }
  7886.           This tells Kermit whether to do per-file filename
  7887.           pattern-matching to determine text or binary mode. The normal
  7888.           and default setting is AUTO, which means to use pattern lists
  7889.           to switch transfer mode only when it is certain that the other
  7890.           Kermit program supports automatic notification of transfer mode
  7891.           (via Attribute packets) on a per-file basis (this information
  7892.           is obtained automatically during protocol startup negotiation).
  7893.           ON means to always determine the transfer mode from the
  7894.           filename and pattern list when sending files. Use OFF to
  7895.           disable this feature (without resetting your pattern lists).
  7896.           Also note that if you have selected LABELED file transfer (SET
  7897.           FILE TYPE LABELED), this takes precedence over
  7898.           filename-matching patterns and all files are sent in labeled
  7899.           mode.
  7900.           
  7901.    SET TRANSFER MODE MANUAL
  7902.           Disables the use of filename patterns, no matter what the FILE
  7903.           PATTERNS setting.
  7904.           
  7905.    REMOTE SET TRANSFER MODE MANUAL
  7906.           Client command to disable automatic transfer mode, and
  7907.           therefore also filename patterns, in the server. Synonym:
  7908.           REMOTE SET XFER MODE MANUAL.
  7909.           
  7910.    { GET, SEND, etc } { /BINARY, /TEXT }
  7911.           Including a /BINARY or /TEXT (or, where supported, /IMAGE or
  7912.           /LABELED) switch with a file-transfer command changes the
  7913.           transfer mode to manual for that command only, and therefore
  7914.           disables patterns that that command.
  7915.           
  7916.    SET FILE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7917.           A list of zero or more patterns, separated by spaces (not
  7918.           commas). Letters in a pattern are case-sensitive if the
  7919.           underlying filenames are case sensitive (as in UNIX), and
  7920.           case-insensitive otherwise (as in Windows). If a file's name is
  7921.           matched by any pattern in the list and SET FILE PATTERNS is ON,
  7922.           the file is sent in binary mode. Examples:
  7923.           
  7924.   SET FILE BINARY-PATTERNS *.gz *.Z *.tar *.zip *.o *.so *.a *.out ; UNIX
  7925.   SET FILE BINARY-PATTERNS *.EXE *.ZIP *.OBJ *.COM ; DOS or OS/2 or Windows
  7926.  
  7927.           If a pattern contains spaces, enclose it in braces.
  7928.           
  7929.    SET FILE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7930.           Like SET FILE BINARY-PATTERNS, but the patterns choose text
  7931.           files rather than binary ones. Examples:
  7932.           
  7933.   SET FILE TEXT-PATTERNS *.TXT *.KSC *.HTM* *.BAT ; DOS, Windows, OS/2
  7934.  
  7935.    ADD BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7936.           Adds one or more patterns to the BINARY-PATTERN list.
  7937.           
  7938.    ADD TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7939.           Adds one or more patterns to the TEXT-PATTERN list.
  7940.           
  7941.    REMOVE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7942.           Removes one or more patterns from the BINARY-PATTERN list. The
  7943.           given patterns are matched with the ones in the BINARY-PATTERNS
  7944.           list with case sensitivity if the underlying file system has
  7945.           case-sensitive names (as do UNIX and OS-9), otherwise with case
  7946.           independence.
  7947.           
  7948.    REMOVE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
  7949.           Removes one or more patterns from the TEXT-PATTERN list.
  7950.           
  7951.    SHOW PATTERNS
  7952.           Displays the current pattern selections.
  7953.           
  7954.    Whenever you give a SET FILE BINARY-PATTERNS or SET FILE TEXT-PATTERNS
  7955.    command, the previous list is replaced. If you give one of these
  7956.    commands without a pattern list, the previous list is removed.
  7957.    
  7958.    When patterns are active and files are being sent, text patterns (if
  7959.    any) are applied first (but only if not RESENDing and not sending in
  7960.    LABELED mode), then binary patterns, so if the same pattern appears in
  7961.    both lists, binary mode is chosen.
  7962.      _________________________________________________________________
  7963.    
  7964.     4.3.4. Examples
  7965.     
  7966.    Here's an example that might be used when sending files from UNIX:
  7967.    
  7968.   set file type binary
  7969.   set file text-patterns *.c *.h *.w *.txt makefile
  7970.   set file binary-patterns *.o
  7971.   msend makefile wermit wart ck*.[cwho] ck*.txt
  7972.  
  7973.    Note that "wermit" and "wart" do not match any patterns so they are
  7974.    sent in the prevailing mode, which is binary. Also note the use of
  7975.    "makefile" as a pattern that does not contain any wildcard characters
  7976.    (there is no other convention to distinguish among "wermit" and
  7977.    "wart", which are binary executables, and "makefile", which is a text
  7978.    file, purely by their names).
  7979.    
  7980.    Most C-Kermit implementations have a default pattern list built in,
  7981.    which includes patterns that are almost certain to succeed in picking
  7982.    the right transfer mode. Others are omitted due to ambiguity. For
  7983.    example ".hlp", and ".ini" are generally binary types in Windows but
  7984.    text types everywhere else.
  7985.    
  7986.      NOTE: ".doc", used for decades to denote plain-text documentation
  7987.      files, now more often than not denotes a Microsoft Word Document,
  7988.      so ".doc" is now considered a binary type since it does less harm
  7989.      to transfer a plain-text document in binary mode than it does to
  7990.      transfer an MS Word file in text mode (except when IBM mainframes
  7991.      are involved!)
  7992.      
  7993.      ANOTHER NOTE: ".com" files are binary in DOS-like operating
  7994.      systems, but they are text (DCL command procedures) in VMS. VMS
  7995.      C-Kermit sends .COM files in text mode; K95 sends them in binary
  7996.      mode. If you download a .COM file from VMS to DOS or Windows, and
  7997.      then upload it to another VMS system, be sure to use SEND /TEXT to
  7998.      preserve its textness.
  7999.      
  8000.    You can see the default pattern list by starting C-Kermit without its
  8001.    initialization file (e.g. "kermit -Y") and using the SHOW PATTERNS
  8002.    command. If you will be depending on this feature, be sure to examine
  8003.    the list carefully in conjunction with the applications that you use.
  8004.    
  8005.    The default pattern list does not take "backup files" into account
  8006.    because (a) people usually don't want to transfer them; and (b) it
  8007.    would make the pattern lists more than twice as long. For example, we
  8008.    would need to include both *.txt and *.txt.~[0-9]*~ for ".txt" files,
  8009.    and similarly for all the others. Instead, you can use SEND /NOBACKUP
  8010.    (or SET SEND BACKUP OFF) to skip over all backup files.
  8011.    
  8012.    Put your most commonly-used safe pattern declarations in your C-Kermit
  8013.    customization file (ckermod.ini, .mykermrc, k95custom.ini, etc).
  8014.    
  8015.    As noted, SET FILE PATTERNS is ON by default. Sometimes, however, it
  8016.    is desirable, or necessary, to force files to be sent in a particular
  8017.    mode, and often this must be done from the command line (e.g. when
  8018.    using Kermit as a download helper in a Web browser like Lynx). The -V
  8019.    command-line options is equivalent to SET FILE PATTERNS OFF and SET
  8020.    TRANSFER MODE MANUAL. Example:
  8021.    
  8022.   kermit -Vis oofa.txt
  8023.  
  8024.    forces oofa.txt to be sent in binary mode, even though ".txt" might
  8025.    match a text pattern.
  8026.      _________________________________________________________________
  8027.    
  8028.   4.4. File Permissions
  8029.   
  8030.    "Permissions" refers to a code associated with a file that specifies
  8031.    who is allowed to access it, and in what manner. For example, the
  8032.    owner, the members of one or more groups, the system administrator,
  8033.    and everybody else, might be allowed various combinations of Read,
  8034.    Write, Append, Execute, or Listing access.
  8035.    
  8036.    The permission code goes by different names on different platforms. In
  8037.    UNIX, it might be called the filemode. In VMS, it is called the file
  8038.    protection (or protection mask).
  8039.    
  8040.    The comments in this section presently apply only to the UNIX and VMS
  8041.    versions of C-Kermit, to which these features were added in version
  8042.    7.0; the DOS, Windows, and OS/2 file systems embody no notions of
  8043.    protection, and so MS-DOS Kermit and Kermit 95 do not send file
  8044.    permissions, and ignore them when received.
  8045.    
  8046.    The permissions for a received file are determined by a combination of
  8047.    the file transfer mode (VMS-to-VMS transfers only), whether a file of
  8048.    the same name exists already, whether permissions of the file are
  8049.    received in the file attribute packet, and the setting of ATTRIBUTES
  8050.    PROTECTION.
  8051.    
  8052.    The default for ATTRIBUTES PROTECTION is ON. If no attributes are
  8053.    received, the effect is the same as if attributes PROTECTION were OFF.
  8054.    
  8055.    For VMS-to-VMS transfers, the default LABELED mode simply copies the
  8056.    protection code from source to destination.
  8057.      _________________________________________________________________
  8058.    
  8059.     4.4.1. When ATTRIBUTES PROTECTION is OFF
  8060.     
  8061.    If no file of the same name exists, system defaults determine the
  8062.    permissions of the new file. Otherwise, the actions taken depend on
  8063.    the current FILE COLLISION setting: BACKUP, OVERWRITE, RENAME, etc, as
  8064.    documented in [463]Using C-Kermit. But now the new file (if it is
  8065.    created at all) automatically inherits the permissions (mode bits) of
  8066.    the existing file in a way that is appropriate for the platform.
  8067.    
  8068.     4.4.1.1. Unix
  8069.     
  8070.    All mode bits are inherited except the directory bit, since the
  8071.    incoming file can not possibly be a directory. (In any case, it is not
  8072.    possible to receive a file that has the same name as an existing
  8073.    directory unless FILE COLLISION is set to RENAME).
  8074.    
  8075.     4.4.1.2. VMS
  8076.     
  8077.    Files with the same name as an existing file, transferred in modes
  8078.    other than LABELED between VMS systems, inherit the protection of the
  8079.    prior version.
  8080.      _________________________________________________________________
  8081.    
  8082.     4.4.2 When ATTRIBUTES PROTECTION is ON
  8083.     
  8084.    File permissions can be conveyed as part of the file transfer process,
  8085.    in accordance with the Kermit protocol definition. If the file sender
  8086.    puts system-dependent and/or system-independent versions of the file
  8087.    protection (permissions) into the Attribute (A) packet, the file
  8088.    receiver can set the new file's permissions from them. Otherwise, the
  8089.    permissions are set the same as for ATTRIBUTES PROTECTION OFF.
  8090.    
  8091.    When the incoming A packet contains system-dependent permissions, the
  8092.    file receiver checks to see if the sender has the same system ID (e.g.
  8093.    both the sending and receiving systems are UNIX, or both are VMS); if
  8094.    so, it decodes and uses the system-dependent permissions; otherwise it
  8095.    uses the generic ones (if any) and applies them to the owner field,
  8096.    setting the other fields appropriately as described in the following
  8097.    sections.
  8098.    
  8099.    Setting the incoming file's protection from the A packet is controlled
  8100.    by SET ATTRIBUTES PROTECTION (or PERMISSION), which is ON by default,
  8101.    and its status is displayed by SHOW ATTRIBUTES.
  8102.    
  8103.    The main benefit of this feature is to not have to "chmod +x" an
  8104.    executable file after transfer from UNIX to UNIX. Its cross-platform
  8105.    benefits are less evident, perhaps to retain the status of the Unix
  8106.    'x' bit on a VMS system, for subsequent transfer back to a Unix
  8107.    system.
  8108.      _________________________________________________________________
  8109.    
  8110.     4.4.2.1. System-Specific Permissions
  8111.     
  8112.    System-specific file permissions are used when the two Kermit programs
  8113.    recognize each other as running on the same type of system. For
  8114.    example, both are running under some form of UNIX (it doesn't matter
  8115.    which UNIX variation -- HP-UX, Solaris, AIX, etc -- all use the same
  8116.    scheme for file permissions); or both are running under VMS (even if
  8117.    one is on an Alpha and the other on a VAX, and/or one is old and the
  8118.    other is new).
  8119.    
  8120.     4.4.2.1.1. UNIX
  8121.     
  8122.    UNIX supports three categories of users, File Owner, Group, and World,
  8123.    and three types of file access permission: Read, Write, and Execute.
  8124.    Thus, a UNIX file's permissions are expressed in 9 bits.
  8125.    
  8126.    The system-dependent permission string for UNIX is a 3-digit octal
  8127.    string, the low-order 9 bits of the st_mode member of the stat struct;
  8128.    we deliberately chop off the "file format" bits because they are not
  8129.    permissions, nor do we convey the setuid/setgid bits, lock bit, sticky
  8130.    bit, etc.
  8131.    
  8132.     4.4.2.1.2. VMS
  8133.     
  8134.    VMS supports four categories of users, System, File Owner, Group, and
  8135.    World, and four types of file access permission: Read, Write, Execute,
  8136.    and Delete. Thus, a VMS file's permissions are expressed in 16 bits.
  8137.    
  8138.    The system-dependent protection string for VMS is a 4-digit
  8139.    hexadecimal string, corresponding to the internal-format protection
  8140.    word of the file (RWED for each of World,Group,Owner,System). A new
  8141.    file normally gets all 16 protection bits from the original file of
  8142.    the same name.
  8143.    
  8144.    Note: VMS-to-VMS transfers take place in LABELED mode when the two
  8145.    C-Kermits recognize each other's platform as VMS (unless you have
  8146.    disabled LABELED-mode transfers). In this case, all of a file's
  8147.    attributes are preserved in the transfer and the protection mask (and
  8148.    other information) is taken from the file's internal information, and
  8149.    this takes precedence over any information in the Attribute packets.
  8150.    You can defeat the automatic switching into LABELED mode (if you want
  8151.    to) with SET TRANSFER MODE MANUAL.
  8152.      _________________________________________________________________
  8153.    
  8154.     4.4.2.2. System-Independent Permissions
  8155.     
  8156.    The system-independent ("generic") protection is used when the system
  8157.    IDs of the two Kermit programs do not agree (e.g. one is UNIX, the
  8158.    other is VMS). The generic protection attribute includes the following
  8159.    permissions (not all are applicable to every file system): Read,
  8160.    Write, Append, Execute, Delete, Search. The generic permissions are
  8161.    derived from the owner permissions of the source file, thus, a Unix
  8162.    'w' permission becomes VMS Write,Delete.
  8163.    
  8164.    The Owner field of the new file's permissions is set from the incoming
  8165.    generic protection attribute.
  8166.    
  8167.    In UNIX, the Group and World permissions are set according to your
  8168.    umask, except that execute permission is NOT set in these fields if it
  8169.    was not also set in the generic protection (and consequently, is set
  8170.    in the Owner field).
  8171.    
  8172.    In VMS, the System, Group, and World permissions are set according to
  8173.    the process default file permission (as shown in VMS by SHOW
  8174.    PROTECTION), except that no permissions are allowed in these fields
  8175.    that are not included in the generic permissions.
  8176.    
  8177.    Note that the VMS and UNIX interpretations of Execute permission are
  8178.    not identical. In UNIX, a file (binary executable, shell script, etc)
  8179.    may not be executed unless it has Execute permission, and normally
  8180.    files that are not intended for execution do not have Execute
  8181.    permission. In VMS, Read permission implicitly supplies Execute
  8182.    capability. Generally files that have Read permission also have
  8183.    explicit Execute permission, but files (binary executables, DCL
  8184.    command procedures) that have Read permission and not Execute
  8185.    permission can still be executed.
  8186.      _________________________________________________________________
  8187.    
  8188.   4.5. File Management Commands
  8189.   
  8190.     4.5.1. The DIRECTORY Command
  8191.     
  8192.    Prior to C-Kermit 7.0, the DIRECTORY command always ran an external
  8193.    system command (such as "ls" on UNIX) or program to product the
  8194.    directory listing. This had certain advantages, mostly that you could
  8195.    include system-dependent options for customized listings, e.g. on
  8196.    UNIX:
  8197.    
  8198.   dir -lt c* | more
  8199.  
  8200.    or in VMS:
  8201.    
  8202.   directory /size/date/protection/except=*.obj oofa.*;0
  8203.  
  8204.    This approach, however, carries some disadvantages: C-Kermit can't
  8205.    return SUCCESS or FAILURE status for (e.g.) "dir foo" according to
  8206.    whether the file "foo" exists; and it runs an inferior process, which
  8207.    might be a problem in some environments for resource and/or security
  8208.    reasons, and won't work at all in a "nopush" environment (e.g. one in
  8209.    which C-Kermit is configured to forbid access to exterior commands and
  8210.    programs, e.g. in a VMS "captive account").
  8211.    
  8212.    In C-Kermit 7.0 on VMS and UNIX, and in K95 1.1.19 and later, the
  8213.    DIRECTORY command is internal to Kermit. It can be run in a "nopush"
  8214.    environment and returns SUCCESS or FAILURE status appropriately. In
  8215.    UNIX it prints all dates and times in a consistent way (unlike ls). In
  8216.    VMS it prints precise file sizes, rather than "blocks". It offers
  8217.    several formatting and other options, but it is not necessarily more
  8218.    flexible than the corresponding external commands or programs (the
  8219.    UNIX "ls" program, the VMS "directory" command). The syntax is:
  8220.    
  8221.    DIRECTORY [ switch [ switch [ ... ] ] ] [ filespec ]
  8222.    
  8223.    If no filespec is given, all files in the current directory are
  8224.    listed.
  8225.    
  8226.    Optional switches include all the standard file-selection switches
  8227.    presented in [464]Section 1.5.4, plus:
  8228.    
  8229.    /ALL
  8230.           Show both regular files and directories; this is the default.
  8231.           
  8232.    /ARRAY:x
  8233.           Instead of displaying a directory listing, put the files that
  8234.           would have been shown (based on the filespec and other
  8235.           selection switches) in the given array. The array need not (and
  8236.           should not) be predeclared; if the array already exists, it is
  8237.           destroyed and reused. The array name can be a single letter,
  8238.           like "a", or any fuller form, such as "&a", "\&a", "\&a[]",
  8239.           etc. If the /ARRAY switch is included, the following other
  8240.           switches are ignored: /BRIEF, /VERBOSE, /HEADING, /PAGE,
  8241.           /ENGLISHDATE, /ISODATE, /XFERMODE, /MESSAGE, /SORT, /REVERSE,
  8242.           /ASCENDING. In other words, only file selection switches are
  8243.           meaningful with /ARRAY: /FILES, /DIRECTORIES, /ALL, /DOTFILES,
  8244.           /NOBACKUP, /RECURSIVE, /SMALLER, /LARGER, /AFTER, /BEFORE,
  8245.           /EXCEPT, etc. The resulting array has the number of files (n)
  8246.           as its 0th element, and the filenames in elements 1 through n
  8247.           Example:
  8248.           
  8249.   dir /array:&a /files /nobackup /after:19990101 /larger:10000 [ab]*
  8250.   show array &a
  8251.  
  8252.    /FILES
  8253.           Only show regular files.
  8254.           
  8255.    /DIRECTORIES
  8256.           Only show directories.
  8257.           
  8258.    /BACKUP
  8259.           In UNIX, OS-9, K-95, and other versions that support SET FILE
  8260.           COLLISION BACKUP and create backup files by appending .~n~ to
  8261.           the filename (where "n" is a number), /BACKUP means to include
  8262.           these files in directory listings. This is the default.
  8263.           
  8264.    /NOBACKUP
  8265.           This is the opposite of /BACKUP: that is, do not include backup
  8266.           files in the listing.
  8267.           
  8268.    /BRIEF
  8269.           List filenames only; use a compact format, as many filenames as
  8270.           will fit across the screen (based on the longest name). A brief
  8271.           listing is always sorted alphabetically.
  8272.           
  8273.    /VERBOSE
  8274.           List one file per line, and include date, size, and (in UNIX
  8275.           only) permissions of each file. This is the opposite of /BRIEF,
  8276.           and is the default.
  8277.           
  8278.    /PAGE
  8279.           Pause at the end of each screenful and give a "more?" prompt,
  8280.           even if SET COMMAND MORE-PROMPTING is OFF.
  8281.           
  8282.    /NOPAGE
  8283.           Don't pause at the end of each screenful and give a "more?"
  8284.           prompt, even if SET COMMAND MORE-PROMPTING is ON. If neither
  8285.           /PAGE or /NOPAGE is given, paging is according to the
  8286.           prevailing COMMAND MORE-PROMPTING setting (which can be
  8287.           displayed with SHOW COMMAND).
  8288.           
  8289.    /ENGLISHDATE
  8290.           Show dates in dd-mmm-yyyy format; mmm is the first three
  8291.           letters of the English month name.
  8292.           
  8293.    /ISODATE
  8294.           Show dates in yyyy-mm-dd format; mm is the month number, 1-12.
  8295.           This is the opposite of /ENGLISHDATE, and is the default.
  8296.           
  8297.    /HEADINGS
  8298.           Print a heading before the listing and a summary at the end.
  8299.           
  8300.    /NOHEADINGS
  8301.           Don't print a heading before the listing or a summary at the
  8302.           end. This is the opposite of /HEADINGS, and is the default.
  8303.           
  8304.    /XFERMODE
  8305.           Only in Kermit programs that support SET FILE PATTERNS. If this
  8306.           switch is included, and the filename matches any FILE
  8307.           BINARY-PATTERN ([465]Section 4.3), "(B)" is printed after the
  8308.           filename; otherwise, if it matches a FILE TEXT-PATTERN, "(T)"
  8309.           is printed.
  8310.           
  8311.    /NOXFERMODE
  8312.           Don't display transfer-mode indicators. This is the opposite of
  8313.           /XFERMODE and is the default.
  8314.           
  8315.    /RECURSIVE
  8316.           Show files not only in the given directory, but also in its
  8317.           subdirectories (if any), their subdirectories, etc.
  8318.           
  8319.    /NORECURSIVE
  8320.           Don't show files in subdirectories. This is the opposite of
  8321.           /RECURSIVE, and is the default.
  8322.           
  8323.    /MESSAGE:text
  8324.           This lets you specify a short text string to be appended to the
  8325.           end of each directory listing line (a space is supplied
  8326.           automatically). If the text contains any spaces, enclose it in
  8327.           braces, e.g. /MESSAGE:{two words}.
  8328.           
  8329.    /NOMESSAGE
  8330.           Don't append any message to the end of each directory listing
  8331.           line (default).
  8332.           
  8333.    /SORT:[{NAME,SIZE,DATE}]
  8334.           Sort the listing by name, size, or date. If the /SORT switch is
  8335.           given but the "sort-by" keyword is omitted, the listing is
  8336.           sorted by name. /SORT:NAME /ASCENDING (alphabetic sort by name)
  8337.           is the default.
  8338.           
  8339.    /NOSORT
  8340.           Don't sort the listing. Files are listed in whatever order they
  8341.           are supplied by the operating system, e.g. inode order in UNIX.
  8342.           
  8343.    /REVERSE
  8344.           If the /SORT switch is given, reverse the order of the sort.
  8345.           Synonym: /DESCENDING.
  8346.           
  8347.    /ASCENDING
  8348.           If the /SORT switch is given, sort the listing in normal order.
  8349.           This is the opposite of /REVERSE and is the default.
  8350.           
  8351.    Note that most of the DIRECTORY-specific switches come in pairs, in
  8352.    which one member of a pair (e.g. /NOHEADINGS) is the opposite of the
  8353.    other (e.g. /HEADINGS).
  8354.    
  8355.    If you always want to use certain options, you can set them with the
  8356.    SET OPTIONS DIRECTORY command ([466]Section 1.5.5). Use SHOW OPTIONS
  8357.    to list the options currently in effect. To make the desired options
  8358.    apply every time you run C-Kermit, put a SET OPTIONS DIRECTORY command
  8359.    in your C-Kermit customization file, specifying the desired options.
  8360.    Options set in this manner apply to every subsequent DIRECTORY
  8361.    command. Of course, if you include switches in a DIRECTORY command,
  8362.    these override any defaults, built-in or custom. Example:
  8363.    
  8364.   DIRECTORY            ; Use "factory defaults"
  8365.   SET OPTIONS DIRECTORY /SORT:SIZE /REVERSE /HEADINGS  ; Customize defaults
  8366.   DIRECTORY            ; Use customized defaults
  8367.   DIR /SORT:NAME       ; Override customized default SORT key
  8368.   SET OPT DIR /RECURS  ; Add /RECURSIVE to customized defaults
  8369.   DIR /ASCEND          ; Override customized default SORT order
  8370.  
  8371.    Notes:
  8372.    
  8373.      * Only a single sort key is supported; there is presently no way to
  8374.        have multiple sort keys.
  8375.      * If the /BRIEF switch is given, all other switches (except
  8376.        /[NO]RECURSIVE, /[NO]DOTFILES, /DIRECTORIES, /FILES, and /ALL) are
  8377.        ignored.
  8378.      * /SORT:anything gives incorrect results if any files have lengths
  8379.        greater than 10 digits (i.e. that are more than 9999999999 bytes
  8380.        long, i.e. if they are 10GB or more in size) because the overlong
  8381.        length field causes the date and name fields to be misaligned.
  8382.      * /SORT:NAME is redundant in VMS since VMS returns filenames in
  8383.        alphabetic order anyway.
  8384.      * /SORT:NAME ignores alphabetic case on platforms where case does
  8385.        not matter in filenames, but this works only for unaccented Roman
  8386.        letters A-Z.
  8387.      * /SORT:NAME is currently based on code values, and so works fine
  8388.        for ASCII, but will probably produce unexpected results for files
  8389.        with non-ASCII or 8-bit characters in their names. (Locale-based
  8390.        sorting raises rather significant issues of portability, size,
  8391.        performance, etc.)
  8392.      * /SORT:DATE works right only for ISO-format dates, not English
  8393.        ones.
  8394.      * /SORT:SIZE sorts the size field lexically. On some platforms (e.g.
  8395.        Windows), the size of a directory file is listed as "<DIR>" rather
  8396.        than as a number; in this case, the "<DIR>" files are gathered at
  8397.        the end (or beginning, depending on the sort order) of the
  8398.        listing.
  8399.      * /RECURSIVE is accepted but ignored in AOS/VS. Use the normal
  8400.        system-specific filespec notation, e.g. "dir #.txt".
  8401.      * /RECURSIVE has no affect when a full, absolute pathname is given;
  8402.        e.g. "dir /recursive /tmp/foo" (where "foo" is a regular file)
  8403.        only shows the "/tmp/foo" file. If you want to see all "foo" files
  8404.        in the /tmp tree, do "cd /tmp" and then "dir /recursive foo".
  8405.      * If a file size of -1 is shown, or date-time of 0000-00-00
  8406.        00:00:00, this means the file was located, but access to
  8407.        information about the file was denied to C-Kermit.
  8408.      * In VMS, if FOO.DIR;1 is a directory within your current directory,
  8409.        "directory foo" and "directory [.foo]" list the files in the
  8410.        [.FOO] subdirectory, but "directory foo.dir" lists the directory
  8411.        file itself; similarly for "*.dir" versus "[.*]", etc.
  8412.      * In UNIX, if "foo" is a directory within your current directory,
  8413.        "directory foo" lists the files in the foo directory. If you want
  8414.        to list the foo directory file itself, put an asterisk at the end:
  8415.        "dir foo*".
  8416.        
  8417.    Hint: How to find the biggest files in a directory tree:
  8418.    
  8419.   cd xxx ; (root of tree)
  8420.   directory /sort:size /recursive /reverse /dotfiles /page
  8421.  
  8422.    Another hint: If you often use several different directory-listing
  8423.    formats, define macro shortcuts for them:
  8424.    
  8425.   DEFINE WD DIRECTORY /SORT:DATE /REVERSE \%*  ; Reverse chronological order
  8426.   DEFINE SD DIRECTORY /SORT:SIZE /REVERSE \%*  ; Reverse order of size
  8427.   DEFINE ND DIRECTORY /SORT:NAME /ASCEND \%*   ; Alphabetical by name
  8428.   DEFINE DL DIR /DIR /SORT:NAME /ASCEND \%*    ; Alphabetical directory list
  8429.  
  8430.    Put these definitions in your C-Kermit customization file. Note that
  8431.    "\%*" ([467]Section 7.5) in these definitions lets you include other
  8432.    switches in your macro invocations, e.g.:
  8433.    
  8434.   wd /headings *.txt
  8435.  
  8436.    Of course you can still access your external directory listing program
  8437.    by using RUN or "!", e.g. in VMS:
  8438.    
  8439.   run directory /size/date/protection/except=*.obj oofa.*;0
  8440.  
  8441.    or:
  8442.    
  8443.   !dir /size/date/prot/exc=*.obj oofa.*;0
  8444.  
  8445.    In UNIX, use "!ls" or just "ls" (which is a special synonym for
  8446.    "!ls").
  8447.      _________________________________________________________________
  8448.    
  8449.     4.5.2. The CD and BACK Commands
  8450.     
  8451.    In C-Kermit 7.0, the CD command has a new friend, the BACK command.
  8452.    BACK means "CD to my previous current directory". A second BACK brings
  8453.    you back to where you were before the first one; thus successive BACK
  8454.    commands switch back and forth between two directories.
  8455.    
  8456.     4.5.2.1. Parsing Improvements
  8457.     
  8458.    The CD command, as well as other commands that parse a directory name,
  8459.    were changed in 7.0 to provide all the expected functions: completion
  8460.    on Tab or Esc, directory-name lists on ?, etc. Other affected commands
  8461.    include SET SERVER GET-PATH, SET TEMP-DIRECTORY, SET FILE
  8462.    DOWNLOAD-DIRECTORY, and SPACE. CD and REMOTE CD also now work with
  8463.    logical names.
  8464.    
  8465.    In VMS, the situation is a bit complicated since a directory name can
  8466.    look like "DEV:", "[FOO.BAR]", "DEV:[FOO.BAR]", "[FOO]BAR.DIR;1", etc.
  8467.    Completion and ?-help might not always work, but they do in many
  8468.    cases. Examples:
  8469.    
  8470.   cd ?           Lists all subdirectories of the current directory
  8471.   cd []?         Ditto
  8472.   cd k?          Ditto, but only those starting with K
  8473.   cd [foo]?      Lists all subdirectories of the [FOO] directory
  8474.   cd [-]?        Lists all subdirectories of the superior directory
  8475.   cd [--]?       Lists all subdirectories of the directory 2 levels up
  8476.   cd [...]?      Lists all directories below the current one
  8477.   cd [foo.?      Does not work.
  8478.  
  8479.    C-Kermit allows all of the following in VMS:
  8480.    
  8481.   cd bar         CD to subdirectory BAR of the current directory
  8482.   cd .bar        Ditto
  8483.   cd [.bar]      Ditto
  8484.   cd bar.dir     etc...
  8485.   cd bar.dir;
  8486.   cd bar.dir;1
  8487.   cd [foo.bar]
  8488.   cd bar.baz     This can go more than 1 level deep...
  8489.   cd dir:        (where logical name DIR is defined as [FOO.BAR])
  8490.  
  8491.    As well as the following:
  8492.    
  8493.   cd ..          Go up one level as in UNIX
  8494.   cd .           The current directory
  8495.   cd             My login directory
  8496.  
  8497.    Note that "cd -" (go up one level) does not work as expected, because
  8498.    "-" is Kermit's command continuation character. However, "cd [-]", and
  8499.    "
  8500.    cd {-}" have the desired effect (and so does "cd ..", which is easier
  8501.    to type).
  8502.      _________________________________________________________________
  8503.    
  8504.     4.5.2.2. The CDPATH
  8505.     
  8506.    The CD command in the UNIX, Windows, OS/2, and VMS versions of
  8507.    C-Kermit, as of version 6.1 / 1.1.12, searches the CDPATH for the
  8508.    given directory, if it is not absolute and if a CDPATH environment
  8509.    variable is defined. Example (in UNIX ksh or bash):
  8510.    
  8511.   $ export CDPATH=$HOME:$HOME/kermit:/tmp
  8512.  
  8513.    Now if you give a "cd xxx" command, no matter what your current
  8514.    directory is, if the "xxx" directory is not a subdirectory of your
  8515.    current directory, then the xxx subdirectory of your home directory is
  8516.    used or if that does not exist, then the xxx subdirectory of the
  8517.    kermit subdirectory of your home directory is used or if that does not
  8518.    exist, then /tmp/xxx is used. This is how the ksh "cd" command works,
  8519.    and now the C-Kermit CD command works the same way.
  8520.    
  8521.    In VMS, you can define CDPATH to be a list of directories that contain
  8522.    actual directory delimiters, and/or logical names representing
  8523.    directories, using commas to separate them, e.g.:
  8524.    
  8525.   $ define cdpath [HOME],[SOMEOTHERDIR],[HOME.MISC]
  8526.   $ define cdpath SYS$LOGIN:,DISK1:[HOME],DISK2:[SCRATCH.IVAN]
  8527.  
  8528.    Example:
  8529.    
  8530.   $ define cdpath SYS$LOGIN:,[IVAN],[OLAF],[OLGA.MISC]
  8531.   $ kermit
  8532.   DISK1:[OLGA] C-Kermit> cd blah
  8533.  
  8534.    tries the BLAH subdirectory of the user's login directory, then
  8535.    [OLGA.BLAH], [IVAN.BLAH], [OLAF.BLAH], and [OLGA.MISC.BLAH], in that
  8536.    order, using the first one it finds, failing if it finds none.
  8537.    
  8538.    In C-Kermit 7.0, you may also set the CDPATH from the Kermit prompt:
  8539.    
  8540.    SET CD PATH path
  8541.           Allows the CD PATH to be set from within C-Kermit.
  8542.           
  8543.    SHOW CD shows the CD path and all other information relevant to the CD
  8544.    command.
  8545.      _________________________________________________________________
  8546.    
  8547.     4.5.2.3. CD Messages
  8548.     
  8549.    Whenever you change directory, you can have C-Kermit display a "Read
  8550.    Me" file from the new directory automatically. The commands are:
  8551.    
  8552.    SET CD MESSAGE { ON, OFF, FILE list }
  8553.           ON enables this feature; OFF (the default) disables it. File
  8554.           lets you specify the name of the "Read Me" file. A list of
  8555.           names to look for can be given in the following format:
  8556.           
  8557.   {{name1}{name2}{name3}{...}}
  8558.  
  8559.           e.g.:
  8560.           
  8561.   SET SERVER CD-MESSAGE FILE {{./.readme}{README.TXT}{READ.ME}}
  8562.  
  8563.           The default list of CD-message files is system dependent.
  8564.           
  8565.    SHOW CD shows your current directory, previous directory, CD path, and
  8566.    CD message info.
  8567.      _________________________________________________________________
  8568.    
  8569.     4.5.3. Creating and Removing Directories
  8570.     
  8571.    The MKDIR command now allows you to create multiple directories at
  8572.    once:
  8573.    
  8574.   C-Kermit> mkdir a/b/c/d
  8575.  
  8576.    creates the directory a in the current directory (if it doesn't exist
  8577.    already), and then creates subdirectory b in the a directory (if it
  8578.    didn't exist already), and so on.
  8579.    
  8580.    If you use MKDIR to try to create a directory that already exists,
  8581.    C-Kermit will print a warning ("?Directory already exists"), but the
  8582.    MKDIR command will still succeed. If you want to avoid the warning
  8583.    message, use IF DIRECTORY first to check if the directory already
  8584.    exists.
  8585.    
  8586.    The RMDIR command, however, will not remove more than one directory,
  8587.    nor will it remove a directory that contains any files. (There is, as
  8588.    yet, no RMDIR /RECURSIVE command, although one might be added later.)
  8589.    
  8590.    In VMS, these commands (like CD) are more forgiving of your syntax
  8591.    than is the DCL command shell; "mkdir oofa" is equivalent to "mkdir
  8592.    [.oofa]" and so on. Also in VMS, you'll find that C-Kermit's RMDIR
  8593.    command is easier than deleting a directory in DCL, since it
  8594.    automatically first gives it owner delete permission if you are the
  8595.    owner.
  8596.      _________________________________________________________________
  8597.    
  8598.     4.5.4. The DELETE and PURGE Commands
  8599.     
  8600.    The DELETE command now offers a selection of switches, and has a new
  8601.    companion, the PURGE command. First, DELETE:
  8602.    
  8603.    DELETE [ switches... ] filespec
  8604.           Deletes the file or files that match the filespec, which may
  8605.           contain wildcards ([468]Section 4.9).
  8606.           
  8607.    Optional switches include the standard file-selection switches
  8608.    presented in [469]Section 1.5.4, plus:
  8609.    
  8610.    /ASK
  8611.           Before deleting each file, ask permission interactively.
  8612.           Answers are Yes or OK (delete the file), No (don't delete it),
  8613.           or Quit (stop executing the DELETE command).
  8614.           
  8615.    /NOASK
  8616.           Don't ask permission to delete each file.
  8617.           
  8618.    /LIST
  8619.           List each file and show whether it was deleted. Synonyms: /LOG,
  8620.           /VERBOSE.
  8621.           
  8622.    /NOLIST
  8623.           Don't list files while deleting them. Synonyms: /NOLOG, /QUIET.
  8624.           
  8625.    /HEADING
  8626.           Print a heading and summary line.
  8627.           
  8628.    /NOHEADING
  8629.           Don't print a heading and summary line.
  8630.           
  8631.    /PAGE
  8632.           When listing, pause at the end of each screenful and give the
  8633.           "More?" prompt. If you reply "n" (no), the DELETE command
  8634.           terminates.
  8635.           
  8636.    /SIMULATE
  8637.           Do everything implied by the given switches and filespec,
  8638.           except do not actually delete any files. This lets you preview
  8639.           which files would be deleted; implies /LIST.
  8640.           
  8641.    Now the PURGE command:
  8642.    
  8643.    PURGE [ switches... ] [ filespec ]
  8644.           (VMS only) Runs the DCL PURGE command. Switches and filespec,
  8645.           if any, are passed directly to DCL without parsing or
  8646.           verification. Deletes excess versions of the given (or all)
  8647.           files. The rest of this section does not apply to VMS.
  8648.           
  8649.    PURGE [ switches... ] [ filespec ]
  8650.           (UNIX only) Deletes "backup files" that match the filespec,
  8651.           which may contain wildcards ([470]Section 4.9). If no filespec
  8652.           is given, all backup files in the current directory are
  8653.           selected (subject to modification by any switches). Do not
  8654.           include backup notation in the filespec.
  8655.           
  8656.    Explanation:
  8657.    
  8658.    To avoid destroying preexisting files when a new file arrives that has
  8659.    the same name, C-Kermit backs up the old file by appending a "backup
  8660.    number" to its name. In UNIX, the backup suffix consists of a period,
  8661.    a tilde, a number, and another tilde. For example, if a file called
  8662.    oofa.txt exists and a new oofa.txt file arrives, the original is
  8663.    renamed to oofa.txt.~1~. If another oofa.txt file arrives, the
  8664.    existing one is renamed to oofa.txt.~2~. And so on. This system is
  8665.    compatible with the one used by EMACS. Thus over time, if you receive
  8666.    a lot of files with C-Kermit or edit them with EMACS, backup files can
  8667.    build up. The new PURGE command lets you clean out accumulated backup
  8668.    files:
  8669.    
  8670.    Optional switches include the standard file-selection switches
  8671.    presented in [471]Section 1.5.4, plus all the switches listed above
  8672.    for the DELETE command, plus:
  8673.    
  8674.    /KEEP:n
  8675.           Retains the n most recent (highest-numbered) backup files for
  8676.           each file. For example, if oofa.txt, oofa.txt.~1~,
  8677.           oofa.txt.~2~, oofa.txt.~10~, oofa.txt.~12~, and oofa.txt.~100~
  8678.           exist, "purge /keep:2 oofa.txt" deletes oofa.txt.~1~,
  8679.           oofa.txt.~2~, and oofa.txt.~10~, and keeps oofa.txt,
  8680.           oofa.txt.~12~, and oofa.txt.~100~. If /KEEP is given without a
  8681.           number, one (the highest numbered) backup file is kept.
  8682.           
  8683.    CAUTION: The PURGE command should be used only when *.~*~ files truly
  8684.    are backup files. This is the case for EMACS, and it is the DEFAULT
  8685.    for C-Kermit. However, if C-Kermit's FILE COLLISION has been set to
  8686.    RENAME, newly received files will look like backup files. In that
  8687.    case, don't use the PURGE command or you'll be removing new files
  8688.    rather than old ones. (Use SHOW FILE to find the FILE COLLISION
  8689.    setting.)
  8690.    
  8691.    The PURGE command is presently available only in UNIX. The command
  8692.    succeeds if it deleted any files, or if it deleted no files but there
  8693.    were no errors. It fails if it deleted no files and there were errors
  8694.    (i.e. deletion was attempted but failed). In VMS, backup file versions
  8695.    are handled automatically by the OS, and a PURGE command can be used
  8696.    at the VMS prompt to clean them up.
  8697.    
  8698.    If you want certain switches to be supplied automatically with each
  8699.    DELETE or PURGE command, you can set them with SET OPTIONS
  8700.    ([472]Section 1.5.5) and you can display any such settings with SHOW
  8701.    OPTIONS. Of course you can override them on a per-command basis by
  8702.    including switches in your PURGE or DELETE command.
  8703.    
  8704.    Also see SET FILE COLLISION, SHOW FILE, SEND /NOBACKUP, SET SEND
  8705.    BACKUP, and DIRECTORY /[NO]BACKUP.
  8706.      _________________________________________________________________
  8707.    
  8708.   4.6. Starting the Remote Kermit Server Automatically
  8709.   
  8710.    As noted on pages 275-276 of [473]Using C-Kermit 2nd edition, you can
  8711.    have Kermit send "kermit receive" commands automatically when it is in
  8712.    local mode and you give a SEND or similar command, to start the remote
  8713.    Kermit receiver in case it is not already started. The "kermit
  8714.    receive" commands are specified by:
  8715.    
  8716.   SET PROTOCOL KERMIT binary-receive-command text-receive-command
  8717.  
  8718.    As of version 7.0, a Kermit protocol option has been added to send a
  8719.    string to the host in advance of any Kermit packets when you give a
  8720.    GET-class or REMOTE command. This will switch the remote C-Kermit into
  8721.    the appropriate mode or, if the remote system is at a system command
  8722.    (shell) prompt, execute the string on the remote system. The new
  8723.    syntax of the SET PROTOCOL KERMIT command is:
  8724.    
  8725.   SET PROTOCOL KERMIT [ s1 [ s2 [ s3 ] ] ]
  8726.  
  8727.    where:
  8728.    
  8729.        Default         Meaning
  8730.   s1  {kermit -ir}     Remote "kermit receive in binary mode" command.
  8731.   s2  {kermit -r}      Remote "kermit receive in text mode" command.
  8732.   s3  {kermit -x}      Remote "start kermit server" command.
  8733.  
  8734.    NOTE: If the remote Kermit is 6.0, the following are recommended for
  8735.    fast startup and high-performance file transfer (see Appendix I in
  8736.    [474]Using C-Kermit, second Edition, for command-line options):
  8737.    
  8738.   s1   kermit -YQir   (Kermit receive binary, skip init file, fast.)
  8739.   s2   kermit -YQTr   (Kermit receive text, skip init file, fast.)
  8740.   s3   kermit -YQx    (Kermit server, skip init file, fast.)
  8741.  
  8742.    If the remote is C-Kermit 7.0 or later, change the -x option (enter
  8743.    server mode) to -O (uppercase letter O), which means "enter server
  8744.    mode for One transaction only); this way, it is not stuck in server
  8745.    after the transfer. Also note that the Q is redundant in version 7.0,
  8746.    since fast Kermit protocol settings are now the default.
  8747.    
  8748.    Note that in case the C-Kermit executable is called "wermit" or
  8749.    "ckermit" you can change "kermit" in the strings above to "wermit" or
  8750.    "ckermit" and C-Kermit 7.0 or later will recognize these as synonyms
  8751.    for "kermit", in case it is at its command prompt when one of these
  8752.    strings is sent to it.
  8753.      _________________________________________________________________
  8754.    
  8755.   4.7. File-Transfer Command Switches
  8756.   
  8757.    Over the years, various new methods of transferring a file have
  8758.    accumulated, until we had, in addition to the SEND command, also MOVE
  8759.    (send and then delete), MAIL (send as email), REMOTE PRINT (send to be
  8760.    printed), CSEND (send the output of a command), PSEND (send a part of
  8761.    a file), BSEND (send in binary mode), RESEND (resume an interrupted
  8762.    SEND), etc etc. Similarly: GET, REGET, CGET, RETRIEVE, and so on.
  8763.    
  8764.    Not only is it confusing to have different names for these commands,
  8765.    many of which are not real words, but this also does not allow all
  8766.    combinations, like "send a file as mail, then delete it".
  8767.    
  8768.    In C-Kermit 7.0, the SEND, GET, and RECEIVE commands were restructured
  8769.    to accept modifier switches (switches are explained in [475]Section
  8770.    1.5).
  8771.      _________________________________________________________________
  8772.    
  8773.     4.7.1. SEND Command Switches
  8774.     
  8775.    Without switches, the SEND command still works exactly as before:
  8776.    
  8777.   send oofa.txt      ; send a single file
  8778.   send oofa.*        ; send multiple files
  8779.   send oofa.txt x.x  ; send oofa.txt as x.x (tell receiver its name is x.x)
  8780.   send               ; send from SEND-LIST
  8781.  
  8782.    But now the following modifier switches may be included between "send"
  8783.    and the filename. Zero, one, two, or more switches may be included in
  8784.    any combination that makes sense. Switch names (such as /BINARY) can
  8785.    be abbreviated, just like any other keywords. Most of these switches
  8786.    work only when using Kermit protocol (/TEXT and /BINARY are the
  8787.    exceptions).
  8788.    
  8789.    /AFTER:date-time
  8790.           Specifies that only those files modified (or, in VMS, created)
  8791.           after the given date-time (see [476]Section 1.6) are to be
  8792.           sent. Examples:
  8793.           
  8794.   send /text /after:{2-Feb-1997 10:28:30} *.txt
  8795.   send /text /after:\fdate(oofa.txt) *.txt
  8796.  
  8797.           Synonym: /SINCE.
  8798.           
  8799.    /ARRAY:arrayname
  8800.           Specifies that instead of sending a file, C-Kermit is to send
  8801.           the contents of the given array. Since an array does not have a
  8802.           filename, you should include an /AS-NAME switch to specify the
  8803.           name under which the array is to be sent (if you do not, the
  8804.           name "_array_x_" is used, where 'x' is replaced by the array
  8805.           designator). See [477]section 7.10 for array-name syntax. As
  8806.           noted in that section, you can also include a range to have a
  8807.           segment of the array sent, rather than the whole thing; for
  8808.           example: "send /array:&a[100:199]". It is strongly recommended
  8809.           that you accompany the /ARRAY switch with a /TEXT or /BINARY
  8810.           switch to force the desired transfer mode, since otherwise the
  8811.           various automatic mechanisms might switch to binary mode when
  8812.           you really wanted text, or vice versa. In text mode a line
  8813.           terminator is added to the end of each array element, but not
  8814.           in binary mode. For details and examples see [478]Section
  8815.           7.10.11.
  8816.           
  8817.    /AS-NAME:text
  8818.           Specifies "text" as the name to send the file under. You can
  8819.           also still specify the as-name as the second filename on the
  8820.           SEND command line. The following two commands are equivalent:
  8821.           
  8822.   send oofa.txt oofa.new
  8823.   send /as:oofa.new oofa.txt
  8824.  
  8825.    /BEFORE:date-time
  8826.           Specifies that only those files modified (or, in VMS, created)
  8827.           before the given date-time ([479]Section 1.6) are to be sent.
  8828.           
  8829.    /BINARY
  8830.           Performs this transfer in binary mode without affecting the
  8831.           global transfer mode, overriding not only the FILE TYPE and
  8832.           TRANSFER MODE settings, but also the FILE PATTERN setting, but
  8833.           for this SEND command only. In other words, SEND /BINARY means
  8834.           what it says: send the file in binary mode, regardless of any
  8835.           other settings. Example:
  8836.           
  8837.   set file type text      ; Set global transfer mode to text
  8838.   send /binary oofa.zip   ; Send a file in binary
  8839.   send oofa.txt           ; This one is sent in text mode
  8840.  
  8841.    /COMMAND
  8842.           SEND /COMMAND is equivalent to CSEND ([480]Section 4.2.2) -- it
  8843.           says to send the output from a command, rather than the
  8844.           contents of a file. The first "filename" on the SEND command
  8845.           line is interpreted as the name of a command; the second (if
  8846.           any) is the as-name. Examples:
  8847.           
  8848.   send /command {grep Sunday oofa.txt} sunday.txt
  8849.   send /as-name:sunday.txt /command {grep Sunday oofa.txt}
  8850.   send /bin /command {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
  8851.  
  8852.    /DELETE
  8853.           Deletes the file (or each file in the group) after it has been
  8854.           sent successfully (but does not delete it if it was not sent
  8855.           successfully). SEND /DELETE is equivalent to MOVE. Has no
  8856.           effect when used with /COMMAND. Example:
  8857.           
  8858.   send /delete *.log
  8859.  
  8860.    /DOTFILES
  8861.           (UNIX and OS-9 only) Normally files whose names begin with "."
  8862.           are skipped when matching wildcards that do not also beging
  8863.           with ".". Include /DOTFILES to force these files to be included
  8864.           too.
  8865.           
  8866.    /RECURSIVE
  8867.           Descend the through the directory tree when locating files to
  8868.           send. Automatically sets /PATHNAMES:RELATIVE. Explained in
  8869.           [481]Section 4.11 .
  8870.           
  8871.    /EXCEPT:pattern
  8872.           See [482]Section 1.5.4.
  8873.           
  8874.    /NOBACKUP
  8875.           This means to skip backup files when sending, even if they
  8876.           match the SEND file specification. This is equivalent to using
  8877.           SEND /EXCEPT and including *.~[0-9]*~ in the exception list (or
  8878.           *.~*~ if Kermit was built without pattern-matching support; see
  8879.           [483]Section 4.9.1). Including this switch is equivalent to
  8880.           giving SET SEND BACKUP OFF ([484]Section 4.0.6) prior to SEND,
  8881.           except its effect is local to the SEND command with which it
  8882.           was given.
  8883.           
  8884.    /NODOTFILES
  8885.           The opposite of /DOTFILES (q.v.)
  8886.           
  8887.    /FILENAMES:{CONVERTED,LITERAL}
  8888.           Use this switch to override the current global SET FILE NAMES
  8889.           setting for this transfer only.
  8890.           
  8891.    /FILTER:command
  8892.           This specifies a filter to pass the file through before sending
  8893.           it. See the [485]section on file-transfer pipes and filters.
  8894.           The /FILTER switch applies only to the file-transfer command it
  8895.           is given with; it does not affect the global SEND FILTER
  8896.           setting, if any.
  8897.           
  8898.    /IMAGE
  8899.           VMS: Sends in image mode. Non-VMS: same as /BINARY.
  8900.           
  8901.    /LABELED
  8902.           VMS and OS/2 only: Sends in labeled mode.
  8903.           
  8904.    /LARGER-THAN:number
  8905.           Specifies that only those files that are longer than the given
  8906.           number of bytes are to be sent.
  8907.           
  8908.    /LISTFILE:filename
  8909.           Specifies that the files to be sent are listed in a file with
  8910.           the given filename. The file contains one filename per line.
  8911.           These filenames are not checked in any way; each filename is
  8912.           taken and does not use or depend on any Kermit-specific syntax.
  8913.           In particular, backslashes are not treated specially, leading
  8914.           and trailing spaces are not stripped, etc. However, if a
  8915.           filename contains wildcards, they are expanded. Example: If a
  8916.           file named files.txt contains the following lines:
  8917.           
  8918.   blah.txt
  8919.   oofa*
  8920.   x.x
  8921.  
  8922.           (but without leading or trailing spaces), then the C-Kermit
  8923.           command "send /listfile:files.txt" will send the files
  8924.           blah.txt, x.x, and all files whose names start with "oofa",
  8925.           assuming the files exist and are readable. The /LISTFILE
  8926.           switch, can, of course, be used with other switches when it
  8927.           makes sense, for example, /EXCEPT, /BINARY, /AFTER, /SMALLER,
  8928.           /MOVE-TO, /DELETE, /AS-NAME with a template, etc.
  8929.           
  8930.    /MAIL:address
  8931.           Sends the file as e-mail to the given address or addresses.
  8932.           "send /mail:address filename" is equivalent to "mail filename
  8933.           address". You can include multiple addresses separated by
  8934.           commas. Examples:
  8935.           
  8936.   send /mail:kermit-support@columbia.edu packet.log
  8937.   send /mail:cmg,fdc,jrd oofa.txt
  8938.  
  8939.           As with any switch argument, if the address or address list
  8940.           contains any spaces, you must enclose it in braces. The format
  8941.           of the addresses must agree with that understood by the
  8942.           mail-sending program on the receiver's computer.
  8943.           
  8944.    /MOVE-TO:directory-name
  8945.           Specifies that after each (or the only) source file is sent
  8946.           successfully, and ONLY if it is sent successfully, it should be
  8947.           moved to the named directory. If the directory name contains
  8948.           spaces, enclose it in braces. If the directory does not exist,
  8949.           it is created if possible; if it can't be created, the command
  8950.           fails and an error message is printed. Example:
  8951.           
  8952.   send /text /move-to:/users/olga/backup/ *.txt
  8953.  
  8954.    /NOT-AFTER:date-time
  8955.           Specifies that only those files modified at or before the given
  8956.           date and time are to be sent.
  8957.           
  8958.    /NOT-BEFORE:date-time
  8959.           Specifies that only those files modified at or after the given
  8960.           date and time are to be sent.
  8961.           
  8962.    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE}
  8963.           Use this switch to override the current global SET SEND
  8964.           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE
  8965.           or RELATIVE also sets /FILENAMES:LITERAL (also for this
  8966.           transfer only) since pathnames are not sent otherwise.
  8967.           
  8968.    /RENAME-TO:text
  8969.           Specifies that after the (or each) source file is sent
  8970.           successfully, and ONLY if it is sent successfully, it should be
  8971.           renamed to the name given. If the name contains spaces, enclose
  8972.           it in braces. If a file group is being sent, then the "text"
  8973.           must contain a variable reference such as \v(filename) (see
  8974.           [486]Section 4.1). Example:
  8975.           
  8976.   send /rename-to:ok_\v(filename) *.*
  8977.  
  8978.           This sends each file in the current directory and if it was
  8979.           sent successfully, changes its name to begin with "ok_".
  8980.           
  8981.    /SMALLER-THAN:number
  8982.           Specifies that only those files that are smaller than the given
  8983.           number of bytes are to be sent.
  8984.           
  8985.    /SUBJECT:text
  8986.           Subject for email. Actually, this is just a synonym for
  8987.           /AS-NAME. If the text includes spaces, you must enclose it in
  8988.           braces. If you don't specify a subject (or as-name), the name
  8989.           of the file is used as the subject. Example:
  8990.           
  8991.   send /mail:kermit-support@columbia.edu /subj:{As requested} packet.log
  8992.  
  8993.    /PRINT:options
  8994.           Sends the file to be printed, optionally specifying options for
  8995.           the printer. Equivalent to REMOTE PRINT filename options.
  8996.           Examples:
  8997.           
  8998.   send /print oofa.txt              ; No options.
  8999.   send /print:/copies=3 oofa.txt    ; "/copies=3" is a VMS PRINT switch.
  9000.   send /print:-#3 oofa.txt          ; "-#3" is a UNIX lpr switch.
  9001.  
  9002.    /PROTOCOL:name
  9003.           Uses the given protocol to send the file (Kermit, Zmodem, etc)
  9004.           for this transfer without changing global protocol. Only
  9005.           available in Kermit 95, UNIX, and OS-9. Example:
  9006.           
  9007.   set protocol kermit               ; Set global protocol
  9008.   send /proto:zmodem /bin oofa.zip  ; Send just this file with Zmodem
  9009.   send oofa.txt                     ; This file is sent with Kermit
  9010.  
  9011.    /QUIET
  9012.           When sending in local mode, this suppresses the file-transfer
  9013.           display.
  9014.           
  9015.    /RECOVER
  9016.           Used to recover from a previously interrupted transfer; SEND
  9017.           /RECOVER is equivalent to RESEND. Recovery only works in binary
  9018.           mode; SEND /RECOVER and RESEND include an implied /BINARY
  9019.           switch. Even then, recovery will successful only if (a) the
  9020.           original (interrupted) transfer was also in binary mode, or (b)
  9021.           if it was in text mode, the two Kermit programs run on
  9022.           platforms where text-mode transfers are not length-changing.
  9023.           
  9024.    /STARTING:number
  9025.           Starts sending the file from the given byte position. SEND
  9026.           /STARTING:n filename is equivalent to PSEND filename n.
  9027.           
  9028.    /TEXT
  9029.           Performs this transfer in text mode without affecting the
  9030.           global transfer mode, overriding not only the FILE TYPE and
  9031.           TRANSFER MODE settings, but also the FILE PATTERN setting, for
  9032.           this SEND command only. In other words, SEND /TEXT really send
  9033.           the file in text mode, regardless of any other settings or
  9034.           negotiations.
  9035.           
  9036.    About mail... Refer to [487]Section 4.7.1. The same rules apply as for
  9037.    file transfer. If you are mailing multiple files, you can't use an
  9038.    as-name (in this case, a subject) unless it contains replacement
  9039.    variables like \v(filenum). For example, if you:
  9040.    
  9041.   send /mail:somebody@xyz.com *.txt
  9042.  
  9043.    Then each file will arrive as a separate email message with its name
  9044.    as the subject. But if you:
  9045.    
  9046.   send /mail:somebody@xyz.com /subject:{Here is a file} *.txt
  9047.  
  9048.    Then each file message will have the same subject, which is probably
  9049.    not what you want. You can get around this with constructions like:
  9050.    
  9051.   send /mail:somebody@xyz.com /subject:{Here is \v(filename)} *.txt
  9052.  
  9053.    which embed the filename in the subject.
  9054.    
  9055.    The MOVE, CSEND, MAIL, and RESEND commands now also accept the same
  9056.    switches. And the switches are also operative when sending from a
  9057.    SEND-LIST (see [488]Using C-Kermit, 2nd Ed, pp.191-192), so, for
  9058.    example, it is now possible to SEND /PRINT or SEND /MAIL from a
  9059.    SEND-LIST.
  9060.    
  9061.    The MSEND and MMOVE commands also take switches, but not all of them.
  9062.    With these commands, which take an arbitrary list of filespecs, you
  9063.    can use /BINARY, /DELETE, /MAIL, /PRINT, /PROTOCOL, /QUIET, /RECOVER,
  9064.    and /TEXT (and /IMAGE or /LABELED, depending on the platform). MMOVE
  9065.    is equivalent to MSEND /DELETE. (If you want to send a group of files,
  9066.    but in mixed transfer modes with per-file as-names, use ADD SEND-LIST
  9067.    and then SEND.)
  9068.    
  9069.    The MSEND/MMOVE switches come before the filenames, and apply to all
  9070.    of them:
  9071.    
  9072.   msend /print /text *.log oofa.txt /etc/motd
  9073.  
  9074.    If you type any of these commands (SEND, CSEND, MSEND, etc) followed
  9075.    by a question mark (?), you will see a list of the switches you can
  9076.    use. If you want to see a list of filenames, you'll need to type
  9077.    something like "send ./?" (UNIX, OS/2, Windows, etc), or "send []?"
  9078.    (VMS), etc. Of course, you can also type pieces of a filename
  9079.    (anything that does not start with "/") and then "?" to get a list of
  9080.    filenames that start that way; e.g. "send x.?" still works as before.
  9081.    
  9082.    In UNIX, where "/" is also the directory separator, there is usually
  9083.    no ambiguity between a fully-specified pathname and a switch, except
  9084.    when a file in the root directory has the same name as a switch (as
  9085.    noted in [489]Section 1.5):
  9086.    
  9087.   send /etc/motd                        ; Works as expected
  9088.   send /command                         ; ???
  9089.  
  9090.    The second example interprets "/command" as a switch, not a filename.
  9091.    To send a file actually called "command" in the root directory, use:
  9092.    
  9093.   send {/command}
  9094.  
  9095.    or other system-dependent forms such as //command, /./command,
  9096.    c:/command, etc, or cd to / and then "send command".
  9097.      _________________________________________________________________
  9098.    
  9099.     4.7.2. GET Command Switches
  9100.     
  9101.    Without switches, the GET command still works about the same as
  9102.    before:
  9103.    
  9104.   get oofa.txt                          ; GET a single file
  9105.   get oofa.*                            ; GET multiple files
  9106.  
  9107.    However, the mechanism for including an "as-name" has changed.
  9108.    Previously, in order to include an as-name, you were required to use
  9109.    the "multiline" form of GET:
  9110.    
  9111.   get
  9112.   remote-filespec
  9113.   local-name
  9114.  
  9115.    This was because the remote filespec might contain spaces, and so
  9116.    there would be no good way of telling where it ended and where the
  9117.    local name began, e.g:
  9118.    
  9119.   get profile exec a foo
  9120.  
  9121.    But now since we can use {braces} for grouping, we don't need the
  9122.    multiline GET form any more, and in fact, support for it has been
  9123.    removed. If you give a GET command by itself on a line, it fails and
  9124.    an error message is printed. The new form is:
  9125.    
  9126.    GET [ switches... ] remote-name [ local-name ]
  9127.           Ask the server to send the file whose name is remote-name. If
  9128.           the optional local-name is given, store it locally under this
  9129.           name. If the remote-name or local-name contains spaces, they
  9130.           must be enclosed in braces:
  9131.           
  9132.   get {profile exec a} foo
  9133.   get oofa.txt {~/My Files/Oofa text}
  9134.  
  9135.    If you want to give a list of remote file specifications, use the MGET
  9136.    command:
  9137.    
  9138.    MGET [ switches... ] remote-name [ remote-name [ remote-name ... ] ]
  9139.           Ask the server to send the files whose names are given.
  9140.           
  9141.    Now you can also include modifier switches between GET or MGET and the
  9142.    remote-name; most of the same switches as SEND:
  9143.    
  9144.    /AS-NAME:text
  9145.           Specifies "text" as the name to store the incoming file under.
  9146.           (This switch is not available for MGET.) You can also still
  9147.           specify the as-name as the second filename on the GET command
  9148.           line. The following two commands are equivalent:
  9149.           
  9150.   get oofa.txt oofa.new
  9151.   get /as:oofa.new oofa.txt
  9152.  
  9153.    /BINARY
  9154.           Tells the server to send the given file(s) in binary mode
  9155.           without affecting the global transfer mode. Example:
  9156.           
  9157.   set file type text      ; Set global transfer mode to text
  9158.   get /binary oofa.zip    ; get a file in binary mode
  9159.   get oofa.txt            ; This one is transferred in text mode
  9160.  
  9161.           Or, perhaps more to the point:
  9162.           
  9163.   get /binary foo.txt     ; where "*.txt" is a text-pattern
  9164.  
  9165.           This has the expected effect only if the server is C-Kermit 7.0
  9166.           or later or K95 1.1.19 or later.
  9167.           
  9168.    /COMMAND
  9169.           GET /COMMAND is equivalent to CGET ([490]Section 4.2.2) -- it
  9170.           says to receive the file into the standard input of a command,
  9171.           rather than saving it on disk. The /AS-NAME or the second
  9172.           "filename" on the GET command line is interpreted as the name
  9173.           of a command. Examples:
  9174.           
  9175.   get /command sunday.txt {grep Sunday oofa.txt}
  9176.   get /command /as-name:{grep Sunday oofa.txt} sunday.txt
  9177.   get /bin /command {!gunzip -c | tar xf -} {tar cf - . | gzip -c}
  9178.  
  9179.    /DELETE
  9180.           Asks the Kermit server to delete the file (or each file in the
  9181.           group) after it has been transferred successfully (but not to
  9182.           delete it if it was not sent successfully). GET /DELETE is
  9183.           equivalent to RETRIEVE. Example:
  9184.           
  9185.   get /delete *.log
  9186.  
  9187.    /EXCEPT:pattern
  9188.           Specifies that any files whose names match the pattern, which
  9189.           can be a regular filename, or may contain "*" and/or "?"
  9190.           metacharacters, are to be refused upon arrival. To specify
  9191.           multiple patterns (up to 8), use outer braces around the group,
  9192.           and inner braces around each pattern:
  9193.           
  9194.   /EXCEPT:{{pattern1}{pattern2}...}
  9195.  
  9196.           See the description of SEND /EXCEPT in [491]Section 4.7.1 for
  9197.           examples, etc. Refusal is accomplished using the Attribute
  9198.           Rejection mechanism (reason "name"), which works only when
  9199.           Attribute packets have been successfully negotiated.
  9200.           
  9201.    /FILENAMES:{CONVERTED,LITERAL}
  9202.           Use this switch to override the current global SET FILE NAMES
  9203.           setting for this transfer only.
  9204.           
  9205.    /FILTER:command
  9206.           This specifies a filter to pass the incoming file through
  9207.           before writing to disk. See the [492]section on file-transfer
  9208.           pipes and filters. The /FILTER switch applies only to the
  9209.           file-transfer command it is given with; it does not affect the
  9210.           global RECEIVE FILTER setting, if any.
  9211.           
  9212.    /IMAGE
  9213.           VMS: Transfer in image mode. Non-VMS: same as /BINARY.
  9214.           
  9215.    /LABELED
  9216.           VMS and OS/2 only: Specifies labeled transfer mode.
  9217.           
  9218.    /MOVE-TO:directory
  9219.           This tells C-Kermit to move each file that is successfully
  9220.           received to the given directory. Files that are not
  9221.           successfully received are not moved. By default, files are not
  9222.           moved.
  9223.           
  9224.    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE,AUTO}
  9225.           Use this switch to override the current global SET RECEIVE
  9226.           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE
  9227.           or RELATIVE also sets /FILENAMES:LITERAL (also for this
  9228.           transfer only) since incoming pathnames would not be treated as
  9229.           pathnames otherwise. See [493]Section 4.10.
  9230.           
  9231.    /QUIET
  9232.           When sending in local mode, this suppresses the file-transfer
  9233.           display.
  9234.           
  9235.    /RECOVER
  9236.           Used to recover from a previously interrupted transfer; GET
  9237.           /RECOVER is equivalent to REGET. Recovery only works in binary
  9238.           mode; SEND /RECOVER and RESEND include an implied /BINARY
  9239.           switch. Even then, recovery will successful only if (a) the
  9240.           original (interrupted) transfer was also in binary mode, or (b)
  9241.           if it was in text mode, the two Kermit programs run on
  9242.           platforms where text-mode transfers are not length-changing.
  9243.           
  9244.    /RECURSIVE
  9245.           Tells the server that the GET file specification applies
  9246.           recursively. This switch also automatically sets
  9247.           /PATHNAMES:RELATIVE in both the server AND the client. When
  9248.           used in conjunction with /DELETE, this "moves" a directory tree
  9249.           from the server's computer to the client's computer (except
  9250.           that only regular files are deleted from the server's computer,
  9251.           not directories; thus the original directories will be left,
  9252.           but will contain no files). Note that all servers that support
  9253.           /RECURSIVE do not necessarily do so in combination with other
  9254.           switches, such as /RECOVER. (Servers that do include C-Kermit
  9255.           7.0 and later, K95 1.1.19 and later.)
  9256.           
  9257.    /RENAME-TO:string
  9258.           This tells C-Kermit to rename each file that is successfully
  9259.           received to the given string. Files that are not successfully
  9260.           received are not renamed. By default, files are not renamed.
  9261.           The string can be a literal string, which is appropriate when
  9262.           only one file is being received, or it can contain one or more
  9263.           variables that are to be evaluated at the time each file is
  9264.           received, such as \v(filename), \v(filenumber), \v(ntime),
  9265.           \v(pid), \v(user), etc. WARNING: if you give a literal string
  9266.           and more than one file arrives, each incoming file will be
  9267.           given the same name (but SET FILE COLLISION BACKUP or RENAME
  9268.           can be used to keep the incoming files from overwriting each
  9269.           other).
  9270.           
  9271.    /TEXT
  9272.           Tells the server to perform this transfer in text mode without
  9273.           affecting its global transfer mode. See /BINARY for additional
  9274.           info.
  9275.           
  9276.    The /MAIL and /PRINT options are not available (as they are for SEND),
  9277.    but you can use /COMMAND to achieve the same effect, as in these UNIX
  9278.    examples:
  9279.    
  9280.   get /command oofa.txt {mail kermit@columbia.edu}
  9281.   get /command oofa.txt lpr
  9282.  
  9283.    In OS/2 or Windows, you can GET and print like this:
  9284.    
  9285.   get oofa.txt prn
  9286.  
  9287.    The CGET, REGET, RETRIEVE commands also accept the same switches as
  9288.    GET. CGET automatically sets /COMMAND; REGET automatically sets
  9289.    /RECOVER and /BINARY, and RETRIEVE automatically sets /DELETE.
  9290.      _________________________________________________________________
  9291.    
  9292.     4.7.3. RECEIVE Command Switches
  9293.     
  9294.    Without switches, the RECEIVE command still works as before:
  9295.    
  9296.   receive            ; Receives files under their own names
  9297.   receive /tmp       ; Ditto, but into the /tmp directory
  9298.   r                  ; Same as "receive"
  9299.   receive foo.txt    ; Receives a file and renames to foo.txt
  9300.  
  9301.    Now you can also include modifier switches may be included between
  9302.    "receive" and the as-name; most of the same switches as GET:
  9303.    
  9304.    /AS-NAME:text
  9305.           Specifies "text" as the name to store the incoming file under.
  9306.           You can also still specify the as-name as a filename on the
  9307.           command line. The following two commands are equivalent:
  9308.           
  9309.   r oofa.new
  9310.   r /as:oofa.new
  9311.  
  9312.    /BINARY
  9313.           Performs this transfer in binary mode without affecting the
  9314.           global transfer mode. NOTE: This does not override the incoming
  9315.           filetype (as it does with GET), so this switch is useful only
  9316.           if ATTRIBUTE TYPE is OFF, or if the other Kermit does not send
  9317.           a TYPE (text or binary) attribute. In any case, it has no
  9318.           affect whatsoever on the file sender.
  9319.           
  9320.    /COMMAND
  9321.           RECEIVE /COMMAND is equivalent to CRECEIVE ([494]Section 4.2.2)
  9322.           -- it says to receive the file into the standard input of a
  9323.           command, rather than saving it on disk. The /AS-NAME or the
  9324.           "filename" on the RECEIVE command line is interpreted as the
  9325.           name of a command.
  9326.           
  9327.   r /command {grep Sunday oofa.txt}
  9328.   r /command /as-name:{grep Sunday oofa.txt}
  9329.   r /bin /command {tar cf - . | gzip -c}
  9330.  
  9331.    /EXCEPT:pattern
  9332.           Specifies that any files whose names match the pattern, which
  9333.           can be a regular filename, or may contain "*" and/or "?"
  9334.           metacharacters, are to be refused upon arrival. To specify
  9335.           multiple patterns (up to 8), use outer braces around the group,
  9336.           and inner braces around each pattern:
  9337.           
  9338.   /EXCEPT:{{pattern1}{pattern2}...}
  9339.  
  9340.           See the description of SEND /EXCEPT in [495]Section 4.7.1 for
  9341.           examples, etc. Refusal is accomplished using the Attribute
  9342.           Rejection mechanism (reason "name"), which works only when
  9343.           Attribute packets have been successfully negotiated.
  9344.           
  9345.    /FILENAMES:{CONVERTED,LITERAL}
  9346.           Use this switch to override the current global SET FILE NAMES
  9347.           setting for this transfer only.
  9348.           
  9349.    /FILTER:command
  9350.           This specifies a filter to pass the incoming file through
  9351.           before writing to disk. See the [496]section on file-transfer
  9352.           pipes and filters. The /FILTER switch applies only to the
  9353.           file-transfer command it is given with; it does not affect the
  9354.           global RECEIVE FILTER setting, if any.
  9355.           
  9356.    /IMAGE
  9357.           VMS: Transfer in image mode. Non-VMS: same as /BINARY. See
  9358.           comments under RECEIVE /BINARY.
  9359.           
  9360.    /LABELED
  9361.           VMS and OS/2 only: Specifies labeled transfer mode. See
  9362.           comments under RECEIVE /BINARY.
  9363.           
  9364.    /MOVE-TO:directory
  9365.           This tells C-Kermit to move each file that is successfully
  9366.           received to the given directory. Files that are not
  9367.           successfully received are not moved. By default, files are not
  9368.           moved.
  9369.           
  9370.    /PATHNAMES:{ABSOLUTE,RELATIVE,OFF,AUTO}
  9371.           Use this switch to override the current global SET RECEIVE
  9372.           PATHNAMES setting for this transfer only. See [497]Section
  9373.           4.10.
  9374.           
  9375.    /RECURSIVE
  9376.           When used with the RECEIVE command, /RECURSIVE is simply a
  9377.           synonym for /PATHNAMES:RELATIVE.
  9378.           
  9379.    /RENAME-TO:string
  9380.           This tells C-Kermit to rename each file that is successfully
  9381.           received to the given string. Files that are not successfully
  9382.           received are not renamed. By default, files are not renamed.
  9383.           The string can be a literal string, which is appropriate when
  9384.           only one file is being received, or it can contain one or more
  9385.           variables that are to be evaluated at the time each file is
  9386.           received, such as \v(filename), \v(filenumber), \v(ntime),
  9387.           \v(pid), \v(user), etc. WARNING: if you give a literal string
  9388.           and more than one file arrives, each incoming file will be
  9389.           given the same name (but SET FILE COLLISION BACKUP or RENAME
  9390.           can be used to keep the incoming files from overwriting each
  9391.           other).
  9392.           
  9393.    /QUIET
  9394.           When receiving in local mode, this suppresses the file-transfer
  9395.           display.
  9396.           
  9397.    /TEXT
  9398.           Receives in text mode without affecting the global transfer
  9399.           mode. See comments under RECEIVE /BINARY.
  9400.           
  9401.    The /MAIL and /PRINT options are not available, but you can use
  9402.    /COMMAND to achieve the same effect, as in these UNIX examples:
  9403.    
  9404.   r /command {mail kermit@columbia.edu}
  9405.   r /command lpr
  9406.  
  9407.    In OS/2 or Windows, you can RECEIVE and print like this:
  9408.    
  9409.   receive prn
  9410.  
  9411.    The CRECEIVE command now also accepts the same switches.
  9412.      _________________________________________________________________
  9413.    
  9414.   4.8. Minor Kermit Protocol Improvements
  9415.   
  9416.     4.8.1. Multiple Attribute Packets
  9417.     
  9418.    C-Kermit 7.0 now sends more than one Attribute packet if a file's
  9419.    attributes do not fit into a single packet of the negotiated length.
  9420.    If a particular attribute (such as file creation date-time) does not
  9421.    fit within the negotiated length (which will only happen when the
  9422.    negotiated length is around 20 or less), that attribute is not sent at
  9423.    all.
  9424.    
  9425.     4.8.2. Very Short Packets
  9426.     
  9427.    There are certain situations where extremely short packets must be
  9428.    used; 20 or 30 bytes at most. This can happen when one or more devices
  9429.    along the communication path have very small buffers and lack an
  9430.    effective means of flow control. Examples are sometimes cited
  9431.    involving radio modems.
  9432.    
  9433.    When the maximum packet length is shorter than certain packets that
  9434.    would be sent, those packets are either truncated or else broken up
  9435.    into multiple packets. Specifically:
  9436.    
  9437.     1. Parameter negotiation packets (I, S, and their ACKs) are truncated
  9438.        to the negotiated length. Any parameters that do not fit are reset
  9439.        to their default values. There is no provision in the Kermit
  9440.        protocol for fragmentation and reassembly of parameter strings.
  9441.     2. File header packets (containing the filename) are simply
  9442.        truncated. There is no provision in the Kermit protocol for
  9443.        fragmentation and reassembly of filenames.
  9444.     3. Attribute packets are fragmented and reassembled as described in
  9445.        4.8.1 without loss of data, except in case a field will not fit at
  9446.        all in the negotiated length (the longest attribute is usually the
  9447.        date and time of file creation/modification) because of the rule
  9448.        that attributes may not be broken across packets.
  9449.     4. Data packets and other packets are unaffected -- they can be as
  9450.        short as they need to be, within reason.
  9451.      _________________________________________________________________
  9452.    
  9453.   4.9. Wildcard / File Group Expansion
  9454.   
  9455.    "Wildcard" refers to the notation used in filenames to specify a group
  9456.    of files by pattern matching.
  9457.    
  9458.     4.9.1. In UNIX C-Kermit
  9459.     
  9460.    Prior to C-Kermit 7.0, C-Kermit was capable of expanding wildcard
  9461.    strings containing only the "metacharacters" '*' and '?':
  9462.    
  9463.    *
  9464.           Matches any sequence of zero or more characters. For example:
  9465.           "ck*.c" matches all files whose names start with "ck" and end
  9466.           with ".c", including "ck.c".
  9467.           
  9468.    ?
  9469.           Matches any single character. For example, "ck?.c" matches all
  9470.           files whose names are exactly 5 characters long and start with
  9471.           "ck" and end with ".c". When typing commands at the prompt, you
  9472.           must precede any question mark to be used for matching by a
  9473.           backslash (\) to override the normal function of question mark,
  9474.           which is providing menus and file lists.
  9475.           
  9476.    C-Kermit 7.0 adds the additional features that users of ksh, csh, and
  9477.    bash are accustomed to:
  9478.    
  9479.    [abc]
  9480.           Square brackets enclosing a list of characters matches any
  9481.           single character in the list. Example: ckuusr.[ch] matches
  9482.           ckuusr.c and ckuusr.h.
  9483.           
  9484.    [a-z]
  9485.           Square brackets enclosing a range of characters; the hyphen
  9486.           separates the low and high elements of the range. For example,
  9487.           [a-z] matches any character from a to z.
  9488.           
  9489.    [acdm-z]
  9490.           Lists and ranges may be combined. This example matches a, c, d,
  9491.           or m through z.
  9492.           
  9493.    {string1,string2,...}
  9494.           Braces enclose a list of strings to be matched. For example:
  9495.           ck{ufio,vcon,cmai}.c matches ckufio.c, ckvcon.c, or ckcmai.c.
  9496.           The strings may themselves contain metacharacters, bracket
  9497.           lists, or indeed, other lists of strings, but (when matching
  9498.           filenames) they may not contain directory separators.
  9499.           
  9500.           Thus, the metacharacters in filenames (and in any other field
  9501.           that can be a pattern, such as the IF MATCH pattern, SEND or
  9502.           GET exception lists, etc) are:
  9503.           
  9504.  * ? [ {
  9505.  
  9506.           And within braces only, comma (,) is a metacharacter.
  9507.           
  9508.    To include a metacharacter in a pattern literally, precede it with a
  9509.    backslash '\' (or two if you are passing the pattern to a macro).
  9510.    Examples:
  9511.    
  9512.   send a*b      ; Send all files whose names start with 'a' and end with 'b'.
  9513.   send a?b      ; Ditto, but the name must be exactly three characters long.
  9514.   send a[a-z]b  ; Ditto, but the second character must be a lowercase letter.
  9515.   send a[x\-z]b ; Ditto, except the second character must be 'x', '-', or 'y'.
  9516.   send a[ghi]b  ; Ditto, except the second character must be 'g', 'h', or 'i'.
  9517.   send a[?*]b   ; Ditto, except the second character must be '?' or '*'.
  9518.   send a[\?\*]b ; Same as previous.
  9519.   send *?[a-z]* ; All files with names containing at least one character
  9520.                 ; that is followed by a lowercase letter.
  9521.  
  9522.    Or, more practically:
  9523.    
  9524.   send ck[cuw]*.[cwh]  ; Send the UNIX C-Kermit source files.
  9525.  
  9526.    To refer to the C-Kermit sources files and makefile all in one
  9527.    filespec:
  9528.    
  9529.   {{makefile,ck[cuw]*.[cwh]}}
  9530.  
  9531.    (NOTE: if the entire pattern is a {stringlist}, you must enclose it it
  9532.    TWO pairs of braces, since the SEND command strips the outer brace
  9533.    pair, because of the "enclose in braces if the filename contains
  9534.    spaces" rule).
  9535.    
  9536.    If the makefile is called ckuker.mak:
  9537.    
  9538.   ck[cuw]*.{[cwh],mak}
  9539.  
  9540.    (NOTE: double braces are not needed here since the pattern does not
  9541.    both begin and end with a brace.)
  9542.    
  9543.    To add in all the C-Kermit text files:
  9544.    
  9545.   ck[cuw]*.{[cwh],mak,txt}
  9546.  
  9547.    All of these features can be used anywhere you would type a filename
  9548.    that is allowed to contain wildcards.
  9549.    
  9550.    When you are typing at the command prompt, an extra level of quoting
  9551.    is required for the '?' character to defeat its regular function of
  9552.    producing a list of files that match what you have typed so far, for
  9553.    example:
  9554.    
  9555.   send ck[cu]?
  9556.  
  9557.    lists all the files whose names start with ckc and cku. If you quote
  9558.    the question mark, it is used as a pattern-matching character, for
  9559.    example:
  9560.    
  9561.   send ck\?[ft]io.c
  9562.  
  9563.    sends all the file and communications i/o modules for all the
  9564.    platforms: ckufio.c, ckutio.c, ckvfio.c, ckvtio.c, etc.
  9565.    
  9566.    If, however, a filename actually contains a question mark and you need
  9567.    to refer to it on the command line, you must use three (3)
  9568.    backslashes. For example, if the file is actually called ck?fio.c, you
  9569.    would use:
  9570.    
  9571.   send ck\\\?fio.c
  9572.  
  9573.    Further notes on quoting:
  9574.    
  9575.      * A single backslash is sufficient for quoting a special character
  9576.        at the command prompt or in a command file. However, when passing
  9577.        patterns to macros you'll need double backslashes, and when
  9578.        referring to these patterns within the macro, you'll need to use
  9579.        \fcontents(\%1) (see [498]Section 1.11.5). You should enclose
  9580.        macro argument references in braces in case grouped arguments were
  9581.        passed. Example:
  9582.  
  9583.  define ismatch {
  9584.      if match {\fcont(\%1)} {\fcont(\%2)} {
  9585.          end 0 MATCH
  9586.      } else {
  9587.          end 1 NO MATCH
  9588.      }
  9589.  }
  9590.  ismatch ab*yz a*\\**z           ; Backslash must be doubled
  9591.  ismatch {abc def xyz} *b*e*y*   ; Braces must be used for grouping
  9592.      * Watch out for possible conflicts between {} in filename patterns
  9593.        and {} used for grouping multiple words into a single field, when
  9594.        the pattern has outer braces. For example, in:
  9595.  
  9596.      if match {abc xyz} {a* *z} echo THEY MATCH
  9597.        braces must be used to group "abc xyz" into a single string.
  9598.        Kermit strips off the braces before comparing the string with the
  9599.        pattern. Therefore:
  9600.  
  9601.  if match makefile {makefile,Makefile} echo THEY MATCH
  9602.        does not work, but:
  9603.  
  9604.  if match makefile {{makefile,Makefile}} echo THEY MATCH
  9605.        does.
  9606.      * If you use a pattern that has outer braces, like {*.txt,*.doc}, in
  9607.        a field that accepts a pattern list (like SEND /EXCEPT:xxx),
  9608.        you'll need to add two extra sets of outer braces:
  9609.  
  9610.  send /except:{{{*.txt,*.doc}}} *.*
  9611.  
  9612.    C-Kermit's new pattern matching capabilities are also used when
  9613.    C-Kermit is in server mode, so now you can send requests such as:
  9614.    
  9615.   get ck[cuw]*.[cwh]
  9616.  
  9617.    to a C-Kermit server without having to tell it to SET WILD SHELL
  9618.    first. Previously this would have required:
  9619.    
  9620.   mget ckc*.c ckc*.w ckc*.h cku*.c cku*.w cku*.h ckw*.c ckw*.w ckw*.h
  9621.  
  9622.    The new pattern matching features make SET WILD SHELL redundant, and
  9623.    barring any objections, it will eventually be phased out. (One
  9624.    possible reason for retaining it would be as an escape mechanism when
  9625.    Kermit does not understand the underlying file system.)
  9626.    
  9627.    By the way, patterns such as these are sometimes referred to as
  9628.    "regular expressions", but they are not quite the same. In a true
  9629.    regular expression (for example), "*" means "zero or more repetitions
  9630.    of the previous item", so (for example), "([0-9]*)" would match zero
  9631.    or more digits in parentheses. In Kermit (and in most shells), this
  9632.    matches one digit followed by zero or more characters, within
  9633.    parentheses. Here are some hints:
  9634.    
  9635.      * Although you can't match any sequence of digits (or letters, etc),
  9636.        you can match (say) 1, 2, or 3 of them in row. For example, the
  9637.        following pattern matches Kermit backup files (with backup numbers
  9638.        from 1 to 999):
  9639.  
  9640.  *.~{[1-9],[1-9][0-9],[1-9][0-9][0-9]}~
  9641.      * There is presently no NOT operator, so no way to match any
  9642.        character or string EXCEPT the one(s) shown.
  9643.        
  9644.    In other wildcarding news...
  9645.    
  9646.      * You may now "send xxx" where "xxx" is a directory name, and this
  9647.        will send all the files from the directory xxx, as if you had
  9648.        typed "send xxx/*". You can also use the special shorthand "send
  9649.        ." to send all the files from the current directory.
  9650.      * To easily skip over backup files (the ones whose names end like
  9651.        .~22~) when sending, you can use SEND /NOBACKUP (see [499]Section
  9652.        4.0.6 for details).
  9653.      * When choosing Kermit to expand wildcards, rather than the shell,
  9654.        you can choose whether "dot files" -- files whose names begin with
  9655.        ".", which are normally "invisible" -- should be matched:
  9656.  
  9657.  SET WILD KERMIT /NO-MATCH-DOT-FILES (this is the default)
  9658.  SET WILD KERMIT /MATCH-DOT-FILES    (this allows matching of "." files)
  9659.        or include the /DOTFILES or /NODOTFILES switch on the command you
  9660.        are using, such as SEND or DIRECTORY.
  9661.      * Commands such as DIRECTORY and SEND allow recursive directory
  9662.        traversal. There are also new functions for this to use in
  9663.        scripts. See [500]Section 4.11 for details.
  9664.        
  9665.    When building file lists in UNIX, C-Kermit follows symbolic links.
  9666.    Because of this, you might encounter any or all of the following
  9667.    phenomena:
  9668.    
  9669.      * Multiple copies of the same file; e.g. one from its real directory
  9670.        and others from links to its real directory, if both the real
  9671.        directory and the links to it are in the wildcard expansion list.
  9672.      * A command might unexpectedly "hang" for a long time because an NFS
  9673.        link might not be responding, or the directory you are looking at
  9674.        contains a link to a huge directory tree (example: "directory
  9675.        /recursive /etc" when /etc/spool is a symlink to /var/spool, which
  9676.        is a large organization's incoming email directory, containing
  9677.        tens of thousands of subdirectories).
  9678.        
  9679.    The size of the file list that Kermit can build is limited in most
  9680.    C-Kermit implementations. The limit, if any, depends on the
  9681.    implementation. Use the SHOW FEATURES command and look in the
  9682.    alphabetized options list for MAXWLD to see the value.
  9683.    
  9684.     4.9.2. In Kermit 95
  9685.     
  9686.    Kermit 95 1.1.19 and later uses the same pattern matching syntax as in
  9687.    UNIX, but (as always) you will encounter numerous difficulties if you
  9688.    use backslash (\) as the directory separator. In any command where K95
  9689.    parses filenames itself (that is, practically any file-oriented
  9690.    command except RUN), you can use forward slash (/) as the directory
  9691.    separator to avoid all the nasty conflicts.
  9692.    
  9693.     4.9.3. In VMS, AOS/VS, OS-9, VOS, etc.
  9694.     
  9695.    Platforms other than UNIX, Windows 95/98/NT, and OS/2 have their own
  9696.    filename matching capabilities that are, in general, different from
  9697.    Kermit's built-in ones and in any case might conflict with them. For
  9698.    example, [] encloses directory names in VMS.
  9699.    
  9700.    Nevertheless you can still use all the pattern-matching capabilities
  9701.    described in [501]Section 4.9.1 by loading a file list into an array
  9702.    (e.g. with \ffiles(*,&a), see [502]Section 4.11.3) and then using IF
  9703.    MATCH on the members.
  9704.      _________________________________________________________________
  9705.    
  9706.   4.10. Additional Pathname Controls
  9707.   
  9708.    In version 6.0 and earlier, C-Kermit's SET { SEND, RECEIVE } PATHNAMES
  9709.    command had only ON and OFF as options. In version 7.0, there are more
  9710.    choices:
  9711.    
  9712.    SET SEND PATHNAMES OFF
  9713.           When sending a file, strip all disk/directory information from
  9714.           the name. Example: "send /usr/olga/letters/oofa.txt" sends the
  9715.           file as "oofa.txt". This applies to actual filenames, not to
  9716.           any as-name you might specify.
  9717.           
  9718.    SET SEND PATHNAMES RELATIVE
  9719.           When sending a file, leave the pathname on as given. For
  9720.           example, if your current directory is /usr/olga, "send
  9721.           letters/oofa.txt" sends the file as "letters/oofa.txt", not
  9722.           "/usr/olga/letters/oofa.txt" or "letters.txt".
  9723.           
  9724.    SET SEND PATHNAMES ABSOLUTE
  9725.           When sending a file, convert its name to the full, absolute
  9726.           local pathname. For example, if your current directory is
  9727.           /usr/olga, "send letters/oofa.txt" sends the file as
  9728.           "/usr/olga/letters/oofa.txt". NOTE: Even with this setting,
  9729.           device and/or node names are not included. For example, in VMS,
  9730.           any node or device name is stripped; in Windows or OS/2, any
  9731.           disk letter is stripped.
  9732.           
  9733.    SET RECEIVE PATHNAMES OFF
  9734.           When receiving a file, strip all disk/directory information
  9735.           from the name before attempting to store it. This applies to
  9736.           incoming filename, not to any as-name you might specify.
  9737.           Example: If a file arrives under the name
  9738.           "/usr/olga/letters/oofa.txt" it is stored simply as "oofa.txt"
  9739.           in your download directory or, if no download directory has
  9740.           been specified, in your current directory.
  9741.           
  9742.    SET RECEIVE PATHNAMES RELATIVE
  9743.           When receiving a file, leave the pathname on as it appears in
  9744.           the incoming name, but if the incoming name appears to be
  9745.           absolute, make it relative to your current or download
  9746.           directory. Examples:
  9747.           
  9748.           + "oofa.txt" is stored as "oofa.txt".
  9749.           + "letters/oofa.txt" is stored as "letters/oofa.txt"; the
  9750.             "letters" subdirectory is created if it does not already
  9751.             exist.
  9752.           + "/usr/olga/letters/oofa.txt" is stored as
  9753.             "usr/olga/letters/oofa.txt" in your current or download
  9754.             directory, and the "usr", "usr/olga", etc, directories are
  9755.             created if they do not exist.
  9756.             
  9757.    SET RECEIVE PATHNAMES ABSOLUTE
  9758.           The incoming filename is used as given. Thus it cannot be
  9759.           stored unless the given path (if any) already exists or can be
  9760.           created. In this case, node, device, or disk designations are
  9761.           NOT stripped, since they most likely were given explicitly by
  9762.           the user as an as-name, meant to be used as given.
  9763.           
  9764.    SET RECEIVE PATHNAMES AUTO
  9765.           This is the default, and means RELATIVE if the sender tells me
  9766.           it is a recursive transfer, OFF otherwise.
  9767.           
  9768.    Set FILE NAMES CONVERTED now also affects pathnames too. When
  9769.    PATHNAMES are RELATIVE or ABSOLUTE and FILE NAMES are CONVERTED, the
  9770.    file sender converts its native directory-name format to UNIX format,
  9771.    and the file receiver converts from UNIX format to its native one;
  9772.    thus UNIX format is the common intermediate representation for
  9773.    directory hierarchies, as it is in the ZIP/UNZIP programs (which is
  9774.    why ZIP archives are transportable among, UNIX, DOS, and VMS).
  9775.    
  9776.    Here's an example in which a file is sent from Windows to UNIX with
  9777.    relative pathnames and FILE NAMES CONVERTED:
  9778.    
  9779.   Source name                Intermediate name      Destination Name
  9780.   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       k95/tmp/oofa.txt
  9781.  
  9782.    In a more complicated example, we send the same file from Windows to
  9783.    VMS:
  9784.    
  9785.   Source name                Intermediate name      Destination Name
  9786.   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       [.K95.TMP]OOFA.TXT
  9787.  
  9788.    (Note that disk letters and device designations are always stripped
  9789.    when pathnames are relative).
  9790.    
  9791.    As you can imagine, as more and more directory formats are considered,
  9792.    this approach keeps matters simple: on each platform, Kermit must know
  9793.    only its own local format and the common intermediate one. In most
  9794.    cases, the receiver can detect which format is used automatically.
  9795.      _________________________________________________________________
  9796.    
  9797.   4.11. Recursive SEND and GET: Transferring Directory Trees
  9798.   
  9799.    C-Kermit 7.0 in selected versions (UNIX, VMS, VOS, AOS/VS, Windows,
  9800.    and OS/2 at this writing) now permits the SEND command to traverse
  9801.    directories "recursively" if you ask it to; that is, to send files
  9802.    from the current or specified directory and all of its subdirectories
  9803.    too, and their subdirectories, etc. (Some other commands can do this
  9804.    too, including DIRECTORY.)
  9805.    
  9806.    This feature is new to UNIX, Windows, VOS, and OS/2. VMS and AOS/VS
  9807.    have always included "wildcard" or "template" characters that allow
  9808.    this, and in this case, recursive directory traversal could happen
  9809.    behind Kermit's back, i.e. Kermit does not have to do it itself (in
  9810.    VMS, the notation is "[...]" or "[directory...]"; in AOS/VS is "#").
  9811.    In C-Kermit 7.0, however, SEND /RECURSIVE is supported by C-Kermit
  9812.    itself for VMS.
  9813.      _________________________________________________________________
  9814.    
  9815.     4.11.1. Command-Line Options
  9816.     
  9817.    To descend a directory tree when sending files, use the -L
  9818.    command-line option to indicate that the send operation is to be
  9819.    recursive, and include a name or pattern to be sent. When giving a
  9820.    pattern, you should enclose it in quotes to prevent the shell from
  9821.    expanding it. Examples:
  9822.    
  9823.   $ kermit -Ls "/usr/olga/*" # send all of Olga's files in all her directories
  9824.   $ kermit -Ls foo.txt       # send all foo.txt files in this directory tree
  9825.   $ kermit -Ls "*.txt"       # send all .txt files in this directory tree
  9826.   $ kermit -Ls "letters/*"   # send all files in the letters directory tree
  9827.   $ kermit -Ls letters       # send all files in the letters directory tree
  9828.   $ kermit -Ls "*"           # send all files in this directory tree
  9829.   $ kermit -Ls .             # UNIX only: send all files in this directory tree
  9830.   $ kermit -s .              # UNIX only: a filename of . implies -L
  9831.  
  9832.    If you let the shell expand wildcards, Kermit only sends files whose
  9833.    names match files in the current or given directory, because the shell
  9834.    replaces an unquoted wildcard expression with the list of matching
  9835.    files -- and the shell does not build recursive lists. Note that the
  9836.    "." notation for the tree rooted at the current directory is allowed
  9837.    only in UNIX, since in Windows and OS/2, it means "*.*"
  9838.    (nonrecursive).
  9839.      _________________________________________________________________
  9840.    
  9841.     4.11.2. The SEND /RECURSIVE Command
  9842.     
  9843.    If you include the /RECURSIVE switch in a SEND (or MOVE, or similar)
  9844.    command, it means to descend the current or specified directory tree
  9845.    searching for files whose names match the given name or pattern. Since
  9846.    this is not terribly useful unless you also include pathnames with the
  9847.    outbound files, the /RECURSIVE switch also includes an implicit
  9848.    /PATHNAMES:RELATIVE switch (which you can undo by including an
  9849.    explicit /PATHNAMES switch after the /RECURSIVE switch).
  9850.    
  9851.    Examples:
  9852.    
  9853.    SEND /RECURSIVE *
  9854.           Sends all of the files in the current directory and all the
  9855.           files in all of its subdirectories, and all of their
  9856.           subdirectories, etc, including their relative pathnames. Empty
  9857.           directories are not sent.
  9858.           
  9859.    SEND /RECURSIVE /PATHNAMES:ABSOLUTE *
  9860.           Sends all of the files in the current directory and all the
  9861.           files in all of its subdirectories, and all of their
  9862.           subdirectories, etc, including their absolute pathnames.
  9863.           
  9864.    SEND /RECURSIVE /PATHNAMES:OFF *
  9865.           Sends all of the files in the current directory and all the
  9866.           files in all of its subdirectories, and all of their
  9867.           subdirectories, etc, without pathnames.
  9868.           
  9869.    SEND /RECURSIVE /usr/olga/*
  9870.           Sends all of the files in the /usr/olga directory and all the
  9871.           files in all of its subdirectories, and all of their
  9872.           subdirectories, etc.
  9873.           
  9874.    SEND /RECURSIVE /usr/olga (or /usr/olga/)
  9875.           Same as above. If the name is a directory name (with or without
  9876.           a trailing slash), its files are sent, and those of its
  9877.           subdirectories, and their subdirectories, etc (see [503]Section
  9878.           4.9).
  9879.           
  9880.    SEND /RECURSIVE /TEXT /usr/olga/*.txt
  9881.           As above, but only files whose names end with ".txt" are sent,
  9882.           and they are sent in text mode (as they would be by default
  9883.           anyway if SET FILE PATTERNS is ON or AUTO).
  9884.           
  9885.    SEND .
  9886.           UNIX only: Send all the files in the current directory.
  9887.           
  9888.    SEND /RECURSIVE .
  9889.           UNIX only: Sends all of the files in the current directory and
  9890.           all of its subdirectories, etc ([504]Section 4.9).
  9891.           
  9892.    The /RECURSIVE switch is different from most other switches in that
  9893.    its effect is immediate (but still local to the command in which it is
  9894.    given), because it determines how filenames are to be parsed. For
  9895.    example, "send *.txt" fails with a parse error ("No files match") if
  9896.    there are no *.txt files in the current directory, but "send
  9897.    /recursive *.txt" succeeds if there are ".txt" files anywhere in the
  9898.    tree rooted at the current directory.
  9899.    
  9900.    The /RECURSIVE switch also affects the file lists displayed if you
  9901.    type "?" in a filename field. "send ./?" lists the regular files in
  9902.    the current directory, but "send /recursive ./?" lists the entire
  9903.    directory tree rooted at the current directory.
  9904.      _________________________________________________________________
  9905.    
  9906.     4.11.3. The GET /RECURSIVE Command
  9907.     
  9908.    In a client/server setting, the client can also request a recursive
  9909.    transfer with:
  9910.    
  9911.    GET /RECURSIVE [ other switches ] remote-filespec [ local-spec ]
  9912.    
  9913.    In which remote file specification can be a directory name, a
  9914.    filename, a wildcard, or any combination. If the local-spec is not
  9915.    given (and PATHNAMES are RELATIVE), incoming files and directories go
  9916.    into the current local directory. If local-spec is given and is a
  9917.    directory, it becomes the root of the tree into which the incoming
  9918.    files and directories are placed. If local-spec has the syntax of a
  9919.    directory name (e.g. in UNIX it ends with /), C-Kermit creates the
  9920.    directory and then places the incoming files into it. If local-spec is
  9921.    a filename (not recommended), then all incoming files are stored with
  9922.    that name with collisions handled according to the FILE COLLISION
  9923.    setting.
  9924.    
  9925.    Again, the normal method for transferring directory trees uses
  9926.    relative pathnames, and this is the default when the sender has been
  9927.    given the /RECURSIVE switch. The action at the receiver depends on its
  9928.    RECEIVE PATHNAMES setting. The default is AUTO, meaning that if the
  9929.    sender tells it to expect a recursive transfer, then it should
  9930.    automatically switch to relative pathnames for this transfer only;
  9931.    otherwise it obeys the RECEIVE PATHNAMES setting of OFF, ABSOLUTE, or
  9932.    RELATIVE.
  9933.    
  9934.    What happens if a file arrives that has an absolute pathname, when the
  9935.    receiver has been told to use only relative pathnames? As a security
  9936.    precaution, in this case the receiver treats the name as if it was
  9937.    relative. For example, if a file arrives as:
  9938.    
  9939.   /usr/olga/oofa.txt
  9940.  
  9941.    The receiver creates a "usr" subdirectory in its current directory,
  9942.    and then an "olga" subdirectory under the "usr" subdirectory in which
  9943.    to store the incoming file.
  9944.    
  9945.    Suppose, however there is a sequence of directories:
  9946.    
  9947.   /usr/olga/a/b/c/d/
  9948.  
  9949.    in which "a" contains nothing but a subdirectory "b", which in turn
  9950.    contains nothing but a subdirectory "c", which in turn contains
  9951.    nothing but a subdirectory "d", which contains nothing at all. Thus
  9952.    there are no files in the "/usr/olga/a/" tree, and so it is not sent,
  9953.    and therefore it is not reproduced on the target computer.
  9954.      _________________________________________________________________
  9955.    
  9956.     4.11.4. New and Changed File Functions
  9957.     
  9958.    C-Kermit 7.0 adds the following functions:
  9959.    
  9960.    \ffiles(pattern[,&a])
  9961.           This function has been changed to match only regular files in
  9962.           the current or given directory, and to take an optional array
  9963.           name as a second argument (explained below).
  9964.           
  9965.    \fdirectories(pattern[,&a])
  9966.           Returns the number of directories that match the given pattern.
  9967.           If the pattern does not include a directory, then the search is
  9968.           performed in the current directory.
  9969.           
  9970.    \frfiles(pattern[,&a])
  9971.           Returns the number of files in the current or given directory
  9972.           and all of its subdirectories, and their subdirectories, etc,
  9973.           that match the given pattern. Warning -- this one can take
  9974.           quite some time if performed at the root of a large directory
  9975.           tree.
  9976.           
  9977.    \frdirectories(pattern[,&a])
  9978.           Returns the number of directories in the current or given
  9979.           directory and all of its subdirectories, and their
  9980.           subdirectories, etc, that match the given pattern.
  9981.           
  9982.    Each of these functions builds up a list of files to be returned by
  9983.    the \fnextfile() function, just as \ffiles() always has done. (This
  9984.    can also be done with the /ARRAY switch of the DIRECTORY command; see
  9985.    [505]Sections 4.5.1 and [506]7.10).
  9986.    
  9987.    Each of these functions can be given an array name as an optional
  9988.    second argument. If an array name is supplied, the array will contain
  9989.    the number of files as its 0th element, and the filenames in elements
  9990.    1 through last. If the array already existed, its previous contents
  9991.    are lost. For example, if the current directory contains two files,
  9992.    oofa.txt and foo.bar, then "\ffiles(*,&a)" creates an array \&a[] with
  9993.    a dimension of 2, containing the following elements:
  9994.    
  9995.  \&a[0] = 2
  9996.  \&a[1] = oofa.txt
  9997.  \&a[2] = foo.bar
  9998.  
  9999.    If no files match the specification given in the first argument, the
  10000.    array gets a dimension of 0, which is the same as undeclaring the
  10001.    array.
  10002.    
  10003.    Note that the order in which the array is filled (and in which
  10004.    \fnextfile() returns filenames) is indeterminate (but see [507]Section
  10005.    7.10.5).
  10006.    
  10007.    Here's an example that builds and prints a list of all the file whose
  10008.    names end in .txt in the current directory and all its descendents:
  10009.    
  10010.   asg \%n \frfiles(*.txt)
  10011.   declare \&a[\%n]
  10012.   for \%i 1 \%n 1 {
  10013.       asg \&a[\%i] \fnextfile()
  10014.       echo \flpad(\%i,4). "\&a[\%i]"
  10015.   }
  10016.  
  10017.    Alternatively, using the array method, and then printing the filenames
  10018.    in alphabetic order (see [508]Section 7.10.3 and [509]7.10.5):
  10019.    
  10020.   asg \%n \frfiles(*.txt,&a)
  10021.   sort &a
  10022.   for \%i 1 \%n 1 {
  10023.       echo \flpad(\%i,4). "\&a[\%i]"
  10024.   }
  10025.  
  10026.    Or even more simply:
  10027.    
  10028.   asg \%n \frfiles(*.txt,&a)
  10029.   sort &a
  10030.   show array &a
  10031.  
  10032.    As noted elsewhere, the file lists built by \ffiles(), \frfiles(),
  10033.    etc, are now "safe" in the sense that SEND and other file-related
  10034.    commands can reference \fnextfile() without resetting the list:
  10035.    
  10036.   set send pathnames relative
  10037.   for \%i 1 \frfiles(*.txt) 1 {
  10038.       asg \%a \fnextfile()
  10039.       echo Sending \%a...
  10040.       send \%a
  10041.       if fail break
  10042.   }
  10043.  
  10044.    Copying to an array (as shown on p.398 of [510]Using C-Kermit 2nd Ed)
  10045.    is no longer necessary.
  10046.      _________________________________________________________________
  10047.    
  10048.     4.11.5. Moving Directory Trees Between Like Systems
  10049.     
  10050.     4.11.5.1. UNIX to UNIX
  10051.     
  10052.    Transferring a directory tree from one computer to another replicates
  10053.    the file sender's arrangement of files and directories on the file
  10054.    receiver's computer. Normally this is done using relative pathnames,
  10055.    since the user IDs might not be identical on the two computers. Let's
  10056.    say both computers are UNIX based, running C-Kermit 7.0 or later. On
  10057.    the sending computer (leaving out the connection details, etc):
  10058.    
  10059.   C-Kermit> cd /usr/olga
  10060.   C-Kermit> send /recursive .
  10061.  
  10062.    The /RECURSIVE switch tells C-Kermit to descend through the directory
  10063.    tree and to include relative pathnames on outbound filenames.
  10064.    
  10065.    On the receiving computer:
  10066.    
  10067.   C-Kermit> mkdir olgas-files           ; Make a new directory.
  10068.   C-Kermit> cd olgas-files              ; CD to it.
  10069.   C-Kermit> receive /recursive          ; = /PATHNAMES:RELATIVE
  10070.  
  10071.    Each Kermit program recognizes that the other is running under UNIX
  10072.    and switches to binary mode and literal filenames automatically.
  10073.    Directories are automatically created on the receiving system as
  10074.    needed. File dates and permissions are automatically reproduced from
  10075.    source to destination.
  10076.    
  10077.     4.11.5.2. VMS to VMS
  10078.     
  10079.    To send recursively from VMS, simply include the /RECURSIVE switch,
  10080.    for example at the sender:
  10081.    
  10082.   $ kermit
  10083.   C-Kermit> cd [olga]
  10084.   C-Kermit> send /recursive *.*;0
  10085.  
  10086.    And at the receiver:
  10087.    
  10088.   C-Kermit> cd [.olga]
  10089.   C-Kermit> receive /recursive
  10090.  
  10091.    The notation "..." within directory brackets in VMS means "this
  10092.    directory and all directories below it"; the /RECURSIVE switch, when
  10093.    given to the sender, implies the use of "..." in the file
  10094.    specification so you don't have to include "..."; but it makes no
  10095.    difference if you do:
  10096.    
  10097.   $ kermit
  10098.   C-Kermit> send /recursive [olga...]*.*;0
  10099.  
  10100.    And at the receiver:
  10101.    
  10102.   C-Kermit> cd [.olga]
  10103.   C-Kermit> receive /recursive
  10104.  
  10105.    In either case, since both systems recognize each other as VMS, they
  10106.    switch into LABELED transfer mode automatically.
  10107.      _________________________________________________________________
  10108.    
  10109.     4.11.6. Moving Directory Trees Between Unlike Systems
  10110.     
  10111.    There are several difficulties with recursive transfers between unlike
  10112.    systems:
  10113.    
  10114.      * File formats can be different, especially text files character
  10115.        sets and record formats. This can now be handled by using SET FILE
  10116.        PATTERN, SET FILE TEXT-PATTERNS, and SET FILE BINARY-PATTERNS
  10117.        ([511]Section 4.3).
  10118.      * File naming conventions are different. For example, one system
  10119.        might allow (and use) longer filenames than the other. You can
  10120.        tell Kermit how to handle file names with the normal "set file
  10121.        names" and "set file collision" mechanisms. Most modern Kermits
  10122.        are fairly tolerant of illegal filenames and should not fail
  10123.        simply because of an incoming filename; rather, it will do its
  10124.        best to convert it to a recognizable and unique legal filename.
  10125.      * Directory notations can be different, e.g. backslashes instead of
  10126.        slashes, brackets, parentheses, spaces, etc. But this is now
  10127.        handled by converting pathnames to a standard format during
  10128.        transfer ([512]Section 4.10).
  10129.        
  10130.    So now, for the first time, it is possible to send directory trees
  10131.    among any combination of UNIX, DOS, Windows, OS/2, VMS, AOS/VS, etc.
  10132.    Here's an example sending files from an HP-UX system (where text files
  10133.    are encoded in the HP Roman8 character set) to a PC with K95 (where
  10134.    text files are encoded in CP850):
  10135.    
  10136.  Sender:
  10137.   cd xxx                           ; CD to root of source tree
  10138.   set file type binary             ; Default transfer mode
  10139.   set file character-set hp-roman8 ; Local character set for text files
  10140.   set xfer character-set latin1    ; Transfer character set
  10141.   set file patterns on             ; Enable automatic file-type switching...
  10142.   set file binary-patterns *.Z *.gz *.o  ; based on these patterns...
  10143.   set file text-patterns *.txt *.c *.h   ; for binary and text files.
  10144.   send /recursive *                ; Send all the file in this directory tree
  10145.  
  10146.  Receiver:
  10147.   cd yyy                           ; CD to root of destination tree
  10148.   set file character-set cp850     ; Local character set for text files
  10149.   receive /pathnames:relative      ; Receive with pathnames
  10150.  
  10151.    Notes:
  10152.      * Replace "xxx" and "yyy" with the desired directories.
  10153.      * Replace the file character sets appropriately.
  10154.      * Change the patterns as needed (or just use the built-in default
  10155.        lists).
  10156.      * SEND /RECURSIVE also implies /PATHNAMES:RELATIVE.
  10157.      * The file sender tells the file receiver the transfer mode of each
  10158.        file.
  10159.      * The file sender tells the file receiver the transfer character
  10160.        set.
  10161.      * By default, destination file dates will be the same as on the
  10162.        source.
  10163.      * Many of the settings shown might already be set by default.
  10164.      * See [513]Sections 4.3, [514]4.10, and [515]4.15 for additional
  10165.        explanation.
  10166.        
  10167.    If you are refreshing an existing directory on the destination
  10168.    computer, use "set file collision update" or other appropriate file
  10169.    collision option to handle filename collisions.
  10170.      _________________________________________________________________
  10171.    
  10172.   4.12. Where Did My File Go?
  10173.   
  10174.    Now that Kermit can be started by clicking on desktop icons (thus
  10175.    obscuring the concept of "current directory"), and can have a download
  10176.    directory, and can create directories for incoming files on the fly,
  10177.    etc, sometimes it is easy to lose a file after transfer. Of course, if
  10178.    you keep a transaction log:
  10179.    
  10180.   LOG TRANSACTIONS
  10181.  
  10182.    it will record the fate and final resting place of each file. But in
  10183.    case you did not keep a log, the new command:
  10184.    
  10185.   WHERE
  10186.  
  10187.    added in C-Kermit 7.0, gives you as much information as it has about
  10188.    the location of the last files transferred, including the pathname
  10189.    reported by the receiving Kermit, if any, when C-Kermit is the sender.
  10190.    This information was also added to SHOW FILE in somewhat less detail.
  10191.      _________________________________________________________________
  10192.    
  10193.   4.13. File Output Buffer Control
  10194.   
  10195.    (UNIX only). The new command SET FILE OUTPUT lets you control how
  10196.    incoming files are written to disk:
  10197.    
  10198.    SET FILE OUTPUT BUFFERED [ size ]
  10199.           Chooses buffered file output; this is the default. UNIX does
  10200.           its normal sort of disk buffering. The optional size specifies
  10201.           Kermit's own file output buffer size, and therefore the
  10202.           frequency of disk accesses (write() system calls) -- the bigger
  10203.           the size, the fewer the disk accesses.
  10204.           
  10205.    SET FILE OUTPUT UNBUFFERED [ size ]
  10206.           This forces each file output write() call to actually commit
  10207.           the data to disk immediately. Choosing this option will usually
  10208.           slow file reception down.
  10209.           
  10210.    SET FILE OUTPUT BLOCKING
  10211.           Write() calls should not return until they are complete. This
  10212.           is the normal setting, and it lets Kermit detect disk-write
  10213.           errors immediately.
  10214.           
  10215.    SET FILE OUTPUT NONBLOCKING
  10216.           Write() calls should return immediately. This can speed up file
  10217.           reception, but also delay the detection of disk-write errors.
  10218.           
  10219.    Experimentation with these parameters should be harmless, and might
  10220.    (or might not) have a perceptible, even dramatic, effect on
  10221.    performance.
  10222.      _________________________________________________________________
  10223.    
  10224.   4.14. Improved Responsiveness
  10225.   
  10226.    In version 7.0, C-Kermit's file-transfer protocol engine has been
  10227.    tuned for additional speed and responsiveness.
  10228.    
  10229.      * Binary-mode transfers over 8-bit connections, a very common case,
  10230.        are now handled in a special way that minimizes overhead.
  10231.      * SET TRANSFER CRC-CALCULATION is now OFF by default, rather than
  10232.        ON. (This affects only the overall per-transfer CRC, \v(crc16),
  10233.        not the per-packet CRCs)
  10234.      * Connection loss during file transfer is now detected immediately
  10235.        in most cases on Internet connections and on serial connections
  10236.        when CARRIER-WATCH is not set to OFF.
  10237.      _________________________________________________________________
  10238.    
  10239.   4.15. Doubling and Ignoring Characters for Transparency
  10240.   
  10241.    The following commands were added in 7.0, primarily to allow
  10242.    successful file transfer through ARPAnet TACs and with Honeywell DPS6
  10243.    systems, but can be used in any setting where they might be needed:
  10244.    
  10245.    SET SEND DOUBLE-CHAR { [ char [ char [ ... ] ] ], NONE }
  10246.           Tells C-Kermit to double the specified characters (use decimal
  10247.           notation) in packets that it sends. For example, if you are
  10248.           sending files through a device that uses @ as an escape
  10249.           character, but allows you to send a single copy of @ through by
  10250.           doubling it, use "set send double 64".
  10251.           
  10252.    SET RECEIVE IGNORE-CHAR [ char [ char [ ... ] ] ]
  10253.           Tells C-Kermit to ignore the specified character(s) in incoming
  10254.           packets. Use this, for example, when something between the
  10255.           sender and receiver is inserting linefeeds for wrapping, NULs
  10256.           for padding, etc.
  10257.      _________________________________________________________________
  10258.    
  10259.   4.16. New File-Transfer Display Formats
  10260.   
  10261.    SET TRANSFER DISPLAY { BRIEF, CRT, FULLSCREEN, NONE, SERIAL }
  10262.           Selects the file-transfer display format.
  10263.           
  10264.    BRIEF is the new one. This writes one line to the screen per file,
  10265.    showing the file's name, transfer mode, size, the status of the
  10266.    transfer, and when the transfer is successful, the effective data rate
  10267.    in characters per second (CPS). Example:
  10268.    
  10269.   SEND ckcfn3.o (binary) (59216 bytes): OK (0.104 sec, 570206 cps)
  10270.   SEND ckcfns.o (binary) (114436 bytes): OK (0.148 sec, 772006 cps)
  10271.   SEND ckcmai.c (text) (79147 bytes): OK (0.180 sec, 438543 cps)
  10272.   SEND ckcmai.o (binary) (35396 bytes): OK (0.060 sec, 587494 cps)
  10273.   SEND ckcnet.o (binary) (62772 bytes): REFUSED
  10274.   SEND ckcpro.o (binary) (121448 bytes): OK (0.173 sec, 703928 cps)
  10275.   SEND ckcpro.w (text) (63687 bytes): OK (0.141 sec, 453059 cps)
  10276.   SEND makefile (text) (186636 bytes): OK (0.444 sec, 420471 cps)
  10277.   SEND wermit (binary) (1064960 bytes): OK (2.207 sec, 482477 cps)
  10278.  
  10279.    Note that transfer times are now obtained in fractional seconds,
  10280.    rather than whole seconds, so the CPS figures are more accurate (the
  10281.    display shows 3 decimal places, but internally the figure is generally
  10282.    precise to the microsecond).
  10283.      _________________________________________________________________
  10284.    
  10285.   4.17. New Transaction Log Formats
  10286.   
  10287.    The new command:
  10288.    
  10289.   SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF [ separator ] }
  10290.  
  10291.    lets you choose the format of the transaction log. VERBOSE (the
  10292.    default) indicates the traditional format described in the book. BRIEF
  10293.    and FTP are new. This command must be given prior to the LOG
  10294.    TRANSACTION command if a non-VERBOSE type is desired.
  10295.    
  10296.     4.17.1. The BRIEF Format
  10297.     
  10298.    BRIEF chooses a one-line per file format suitable for direct
  10299.    importation into databases like Informix, Oracle, or Sybase, in which:
  10300.    
  10301.      * Each record has 8 fields.
  10302.      * Fields are separated by a non-alphanumeric separator character.
  10303.      * The default separator character is comma (,).
  10304.      * Any field containing the separator character is enclosed in
  10305.        doublequotes.
  10306.      * The final field is enclosed in doublequotes.
  10307.        
  10308.    The fields are:
  10309.    
  10310.     1. Date in yyyymmdd format
  10311.     2. Time in hh:mm:ss format
  10312.     3. Action: SEND or RECV
  10313.     4. The local filename
  10314.     5. The size of the file
  10315.     6. The transfer mode (text, binary, image, labeled)
  10316.     7. The status of the transfer: OK or FAILED
  10317.     8. Additional status-dependent info, in doublequotes.
  10318.        
  10319.    Examples:
  10320.    
  10321.   20000208,12:08:52,RECV,/u/olga/oofa.txt,5246,text,OK,"0.284sec 18443cps"
  10322.   20000208,12:09:31,SEND,/u/olga/oofa.exe,32768,binary,OK,"1.243sec 26362cps"
  10323.   20000208,12:10:02,SEND,"/u/olga/a,b",10130,text,FAILED,"Refused: date"
  10324.  
  10325.    Note how the filename is enclosed in doublequotes in the final
  10326.    example, because it contains a comma.
  10327.    
  10328.    To obtain BRIEF format, you must give the SET TRANSACTION-LOG BRIEF
  10329.    command before the LOG TRANSACTIONS command. (If you give them in the
  10330.    opposite order, a heading is written to the log by the LOG command.)
  10331.      _________________________________________________________________
  10332.    
  10333.     4.17.2. The FTP Format
  10334.     
  10335.    SET TRANSACTION-LOG FTP (available only in UNIX) chooses a format that
  10336.    is compatible with the WU-FTPD (Washington University FTP daemon) log,
  10337.    and so can be processed by any software that processes the WU-FTPD
  10338.    log. It logs only transfers in and out, both successful and failed
  10339.    (but success or failure is not indicated, due to lack of a field in
  10340.    the WU-FTPD log format for this purpose). Non-transfer events are not
  10341.    recorded.
  10342.    
  10343.    Unlike other logs, the FTP-format transaction log is opened in append
  10344.    mode by default. This allows you to easily keep a record of all your
  10345.    kermit transfers, and it also allows the same log to be shared by
  10346.    multiple simultaneous Kermit processes or (permissions permitting)
  10347.    users. You can, of course, force creation of a new logfile by
  10348.    specifying the NEW keyword after the filename, e.g.
  10349.    
  10350.   log transactions oofa.log new
  10351.  
  10352.    All records in the FTP-style log are in a consistent format. The first
  10353.    field is fixed-length and contains spaces; subsequent fields are
  10354.    variable length, contain no spaces, and are separated by one or more
  10355.    spaces. The fields are:
  10356.    
  10357.    Timestamp
  10358.           This is an asctime-style timestamp, example: "Wed Sep 16
  10359.           20:19:05 1999" It is always exactly 24 characters long, and the
  10360.           subfields are always in fixed positions.
  10361.           
  10362.    Elapsed time
  10363.           The whole number of seconds required to transfer the file, as a
  10364.           string of decimal digits, e.g. "24".
  10365.           
  10366.    Connection
  10367.           The name of the network host to which C-Kermit is connected, or
  10368.           the name of the serial device through which it has dialed (or
  10369.           has a direct connection), or "/dev/tty" for transfers in remote
  10370.           mode.
  10371.           
  10372.    Bytes transferred
  10373.           The number of bytes transferred, decimal digits, e.g.
  10374.           "1537904".
  10375.           
  10376.    Filename
  10377.           The name of the file that was transferred, e.g.
  10378.           "/pub/ftp/kermit/a/README.TXT". If the filename contains any
  10379.           spaces or control characters, each such character is replaced
  10380.           by an underscore ('_') character.
  10381.           
  10382.    Mode
  10383.           The letter 'b' if the file was transferred in binary mode, or
  10384.           'a' if it was transferred in text (ASCII) mode.
  10385.           
  10386.    Options
  10387.           This field always contains an underscore ('_') character.
  10388.           
  10389.    Direction
  10390.           The letter 'o' if the file was transferred Out, and 'i' if the
  10391.           file was transferred In.
  10392.           
  10393.    User class
  10394.           The letter 'r' indicates the file was transferred by a Real
  10395.           user.
  10396.           
  10397.    User identification
  10398.           The ID of the user who transferred the file.
  10399.           
  10400.    Server identification
  10401.           The string "kermit". This distinguishes a Kermit transfer log
  10402.           record from a WU-FTPD record, which contains "ftp" in this
  10403.           field.
  10404.           
  10405.    Authentication class
  10406.           The digit '1' if we know the user's ID on the client system,
  10407.           otherwise '0'. Currently, always '0'.
  10408.           
  10409.    Authenticated user
  10410.           If the authentication class is '1', this is the user's ID on
  10411.           the client system. Otherwise it is an asterisk ('*'). Currently
  10412.           it is always an asterisk.
  10413.           
  10414.    Examples:
  10415.    
  10416.   Thu Oct 22 17:42:48 1998 0 * 94 /usr/olga/new.x a _ i r olga kermit 0 *
  10417.   Thu Oct 22 17:51:29 1998 1 * 147899 /usr/olga/test.c a _ o r olga kermit 0 *
  10418.   Thu Oct 22 17:51:44 1998 1 * 235 /usr/olga/test.o b _ i r olga kermit 0 *
  10419.   Fri Oct 23 12:10:25 1998 0 * 235 /usr/olga/x.ksc a _ o r olga kermit 0 *
  10420.  
  10421.    Note that an ftp-format transaction log can also be selected on the
  10422.    Kermit command line as follows:
  10423.    
  10424.   kermit --xferfile:filespec
  10425.  
  10426.    This is equivalent to:
  10427.    
  10428.   SET TRANSACTION-LOG FTP
  10429.   LOG TRANSACTIONS filespec APPEND
  10430.  
  10431.    Conceivably it could be possible to have a system-wide shared Kermit
  10432.    log, except that UNIX lacks any notion of an append-only file; thus
  10433.    any user who could append to the log could also delete it (or alter
  10434.    it). This problem could be worked around using setuid/setgid tricks,
  10435.    but these would most likely interfere with the other setuid/setgid
  10436.    tricks C-Kermit must use for getting at dialout devices and UUCP
  10437.    logfiles.
  10438.      _________________________________________________________________
  10439.    
  10440.   4.18. Unprefixing NUL
  10441.   
  10442.    As of 6.1.193 Alpha.10, C-Kermit can finally send and receive
  10443.    file-transfer packets in which NUL (ASCII 0) is unprefixed (no more
  10444.    NUL-terminated packets!). NUL is, of course, extremely prevalent in
  10445.    binary files such as executables, and this has been a significant
  10446.    source of packet overhead. For example, when transferring itself (the
  10447.    SunOS C-Kermit executable) with minimal prefixing and 9000-byte
  10448.    packets, we see:
  10449.    
  10450.   File size:                       1064960
  10451.   Packet chars with 0 prefixed:    1199629  overhead = 12.65%
  10452.   Packet chars with 0 unprefixed:  1062393  overhead = -0.03%
  10453.  
  10454.    Transfer rates go up accordingly, not only because of the reduced
  10455.    amount of i/o, but also because less computation is required on each
  10456.    end.
  10457.      _________________________________________________________________
  10458.    
  10459.   4.19. Clear-Channel Protocol
  10460.   
  10461.    Now that C-Kermit itself is capable of sending and receiving any byte
  10462.    at all on a clear channel ([516]Section 4.18), it is, for the first
  10463.    time, in a position to negotiate a clear channel with the other
  10464.    Kermit, giving it permission (but not requiring it) to unprefix any
  10465.    and all characters that it knows are safe. In general this means all
  10466.    but the Kermit start-of-packet character (normally Ctrl-A), Carriage
  10467.    Return (not only Kermit's end-of-packet character, but also treated
  10468.    specially on Telnet NVT links), and IAC (255, also special to Telnet).
  10469.    
  10470.    By default, C-Kermit will say it has a clear channel only if it has
  10471.    opened a TCP socket. Since the Kermit program on the far end of a
  10472.    TCP/IP connection generally does not know it has a TCP/IP connection,
  10473.    it will not announce a clear channel unless it has been told to do so.
  10474.    The command is:
  10475.    
  10476.    SET CLEAR-CHANNEL { ON, OFF, AUTO }
  10477.    
  10478.    AUTO is the default, meaning that the clear-channel status is
  10479.    determined automatically from the type of connection. ON means to
  10480.    announce a clear channel, OFF means not to announce it. Use SHOW
  10481.    STREAMING ([517]Section 4.20) to see the current CLEAR-CHANNEL status.
  10482.    Synonym: SET CLEARCHANNEL.
  10483.    
  10484.    CLEAR-CHANNEL is also set if you start C-Kermit with the -I switch
  10485.    (see [518]Section 4.20).
  10486.    
  10487.    Whenever a clear channel is negotiated, the resulting
  10488.    control-character unprefixing is "sticky"; that is, it remains in
  10489.    effect after the transfer so you can use SHOW CONTROL to see what was
  10490.    negotiated.
  10491.    
  10492.    You can also see whether a clear channel was negotiated in the
  10493.    STATISTICS /VERBOSE Display.
  10494.    
  10495.    The advantage of the clear channel feature is that it can make file
  10496.    transfers go faster automatically. The disadvantage would be
  10497.    file-transfer failures if the channel is not truly clear, for example
  10498.    if C-Kermit made a Telnet connection to a terminal server, and then
  10499.    dialed out from there; or if C-Kermit made an Rlogin connection to
  10500.    host and then made a Telnet connection from there to another host. If
  10501.    a file transfer fails on a TCP/IP connection, use SHOW CONTROL to
  10502.    check whether control characters became unprefixed as a result of
  10503.    protocol negotiations, and/or SHOW STREAMING ([519]Section 4.20) to
  10504.    see if "clear-channel" was negotiated. If this happened, use SET
  10505.    CLEAR-CHANNEL OFF and SET PREFIXING CAUTIOUS (or whatever) to prevent
  10506.    it from happening again.
  10507.      _________________________________________________________________
  10508.    
  10509.   4.20. Streaming Protocol
  10510.   
  10511.    A new Kermit protocol option called "streaming" was added in C-Kermit
  10512.    7.0. The idea is that if the two Kermit partners have a reliable
  10513.    transport (such as TCP/IP or X.25) between them, then there is no need
  10514.    to send ACKs for Data packets, or NAKs, since a reliable transport
  10515.    will, by definition, deliver all packets in order and undamaged. On
  10516.    such a connection, streaming cuts down not only on Kermit program
  10517.    overhead (switching back and forth between reading and sending
  10518.    packets), but also tends to make the underlying transport use itself
  10519.    more efficiently (e.g. by defeating the Nagle algorithm and/or Delayed
  10520.    ACK stratagem of the TCP layer). Furthermore, it allows transfers to
  10521.    work smoothly on extremely slow network congestions that would
  10522.    otherwise cause timeouts and retransmissions, and even failure when
  10523.    the retry limit was exceeded.
  10524.    
  10525.    The trick is knowing when we can stream:
  10526.    
  10527.     1. If C-Kermit has opened a TCP socket or X.25 connection, it offers
  10528.        stream.
  10529.     2. If C-Kermit has been started with the -I (uppercase) option, or if
  10530.        it has been told to SET RELIABLE ON, it offers to stream.
  10531.     3. If C-Kermit is in remote mode, and has been told to SET RELIABLE
  10532.        AUTO (or ON), it always offers to stream, and also always agrees
  10533.        to stream, if the other Kermit offers. Unless you take explicit
  10534.        actions to override the defaults, this allows the local Kermit
  10535.        (the one that made the connection, and so knows whether it's
  10536.        reliable) to control streaming.
  10537.        
  10538.    (Note that an offer to stream also results in a Clear-Channel
  10539.    announcement if CLEAR-CHANNEL is set to AUTO; see [520]Section 4.19.)
  10540.    
  10541.    When BOTH Kermits offer to stream, then they stream; otherwise they
  10542.    don't. Thus streaming-capable Kermit programs interoperate
  10543.    automatically and transparently with nonstreaming ones. If the two
  10544.    Kermits do agree to stream, you'll see the word "STREAMING" on the
  10545.    fullscreen file-transfer display in the Window Slots field. You can
  10546.    also find out afterwards with the STATISTICS or SHOW STREAMING
  10547.    commands.
  10548.    
  10549.      WARNING: Automatic choice of streaming is based on the assumption
  10550.      of a "direct" end-to-end network connection; for example, a Telnet
  10551.      or Rlogin connection from host A to host B, and transferring files
  10552.      between A and B. However, if your connection has additional
  10553.      components -- something "in the middle" (B) that you have made a
  10554.      network connection to, which makes a separate connection to the
  10555.      destination host (C), then you don't really have a reliable
  10556.      connection, but C-Kermit has no way of knowing this; transferring
  10557.      files between A and C will probably fail. In such cases, you'll
  10558.      need to tell the *local* C-Kermit to "set reliable off" before
  10559.      transferring files (it does no good to give this command to the
  10560.      remote Kermit since the local one controls the RELIABLE setting).
  10561.      
  10562.    Streaming is like using an infinite window size, with no timeouts and
  10563.    no tolerance for transmission errors (since there shouldn't be any).
  10564.    It relies on the underlying transport for flow control, error
  10565.    correction, timeouts, and retransmission. Thus it is very suitable for
  10566.    use on TCP/IP connections, especially slow or bursty ones, since
  10567.    Kermit's packet timeouts won't interfere with the transfer -- each
  10568.    packet takes as long to reach its destination as it takes TCP to
  10569.    deliver it. If TCP can't deliver the packet within its own timeout
  10570.    period (over which Kermit has no control), it signals a fatal error.
  10571.    Just like FTP.
  10572.    
  10573.    Streaming goes much faster than non-streaming when a relatively small
  10574.    packet length is used, and it tends to go faster than non-streaming
  10575.    with even the longest packet lengths. The Kermit window size is
  10576.    irrelevant to streaming protocol, but still might affect performance
  10577.    in small ways since it can result in different paths through the code.
  10578.    
  10579.    The definition of "reliable transport" does not necessarily demand
  10580.    8-bit and control-character transparency. Streaming can work with
  10581.    parity and/or control-character prefixing just as well (but not as
  10582.    fast) as without them; in such cases you can leave RELIABLE set to ON,
  10583.    but set CLEARCHANNEL and/or PARITY appropriately.
  10584.    
  10585.    Maximum performance -- comparable to and often exceeding FTP -- is
  10586.    achieved on socket-to-socket connections (in which the considerable
  10587.    overhead of the terminal driver and Telnet or Rlogin server is
  10588.    eliminated) with long packets and the new "brief" file-transfer
  10589.    display ([521]Section 4.16).
  10590.      _________________________________________________________________
  10591.    
  10592.     4.20.1. Commands for Streaming
  10593.     
  10594.    SET RELIABLE { ON, OFF, AUTO }
  10595.           SET RELIABLE ON tells Kermit that it has a reliable transport.
  10596.           SET RELIABLE OFF tells Kermit the transport is not reliable.
  10597.           SET RELIABLE AUTO tells Kermit that it should SET RELIABLE ON
  10598.           whenever it makes a reliable connection (e.g. TELNET or SET
  10599.           HOST on a TCP/IP or X.25 network), and when in remote mode it
  10600.           should believe the transport is reliable if the other Kermit
  10601.           says it is during Kermit protocol negotiation.
  10602.           
  10603.    AUTO is the default; the Kermit program that makes the connection
  10604.    knows whether it is reliable, and tells the remote Kermit.
  10605.    
  10606.    The RELIABLE setting has several effects, including:
  10607.    
  10608.      * It can affect the timeouts used during normal ACK/NAK protocol.
  10609.      * It can affect the clear-channel announcement.
  10610.      * It can affect streaming.
  10611.        
  10612.    If you TELNET or SET HOST somewhere, this includes an implicit SET
  10613.    RELIABLE ON command. The -I command-line option is equivalent to SET
  10614.    RELIABLE ON.
  10615.    
  10616.    Since SET RELIABLE ON (and -I) also implies SET CLEAR CHANNEL ON, you
  10617.    might find that in certain cases you need to tell Kermit that even
  10618.    though the connection is reliable, it doesn't have a clear channel
  10619.    after all:
  10620.    
  10621.   SET CLEAR-CHANNEL OFF
  10622.   SET PREFIXING CAUTIOUS ; or whatever...
  10623.  
  10624.    You can control streaming without affecting the other items with:
  10625.    
  10626.   SET STREAMING { ON, OFF, AUTO }
  10627.  
  10628.    AUTO is the default, meaning streaming will occur if Kermit has made a
  10629.    TCP/IP connection or if RELIABLE is ON (or it was started with the -I
  10630.    command line option). OFF means don't stream; ON means offer to stream
  10631.    no matter what.
  10632.      _________________________________________________________________
  10633.    
  10634.     4.20.2. Examples of Streaming
  10635.     
  10636.    Here we look at the use and behavior of streaming on several different
  10637.    kinds of connections, and compare its performance with non-streaming
  10638.    transfers.
  10639.    
  10640.     4.20.2.1. Streaming on Socket-to-Socket Connections
  10641.     
  10642.    Here we get streaming automatically when both Kermit programs are
  10643.    capable of it, since they both make socket connections. For example,
  10644.    on the far end:
  10645.    
  10646.   C-Kermit> set host * 3000
  10647.   C-Kermit> server
  10648.  
  10649.    and on the near end:
  10650.    
  10651.   C-Kermit> set host foo.bar.xyz.com 3000
  10652.   (now give SEND and GET command)
  10653.  
  10654.    All subsequent file transfers use streaming automatically.
  10655.    
  10656.    Here are the results from 84 trials, run on a production network,
  10657.    disk-to-disk, in which a 1-MB binary file (the SunOS C-Kermit Sparc
  10658.    executable) was sent from a Sun Sparc-10 with SunOS 4.1.3 to an IBM
  10659.    Power Server 850 with AIX 4.1, socket-to-socket, over a 10Mbps 10BaseT
  10660.    Ethernet, using minimal control-character unprefixing, window sizes
  10661.    from 10 to 32, and packet sizes from 1450 to 9010:
  10662.    
  10663.                 Streaming    Nonstreaming
  10664.   Max CPS         748955        683354
  10665.   Min CPS         221522        172491
  10666.   Mean CPS        646134        558680
  10667.   Median CPS      678043        595874
  10668.   Std Dev         101424        111493
  10669.  
  10670.    Correlations:
  10671.    
  10672.   CPS and window size:   -0.036
  10673.   CPS and packet length:  0.254
  10674.   CPS and streaming:      0.382
  10675.  
  10676.    Note that the relationship between streaming and throughput is
  10677.    significantly stronger than that between CPS and window size or packet
  10678.    length.
  10679.    
  10680.    Also note that this and all other performance measurements in this
  10681.    section are snapshots in time; the results could be much different at
  10682.    other times when the load on the systems and/or the network is higher
  10683.    or lower.
  10684.    
  10685.    In a similar socket-to-socket trial, but this time over a wide-area
  10686.    TCP/IP connection (from New York City to Logan, Utah, about 2000
  10687.    miles), the following results were obtained:
  10688.    
  10689.                 Streaming    Nonstreaming
  10690.   Max CPS         338226        318203
  10691.   Min CPS         191659        132314
  10692.   Mean CPS        293744        259240
  10693.   Median CPS      300845        273271
  10694.   Std Dev          41914         52351
  10695.  
  10696.    Correlations:
  10697.    
  10698.   CPS and window size:    0.164
  10699.   CPS and packet length:  0.123
  10700.   CPS and streaming:      0.346
  10701.      _________________________________________________________________
  10702.    
  10703.     4.20.2.2. Streaming on Telnet Connections
  10704.     
  10705.    In this case the local copy of Kermit is told to TELNET or SET HOST,
  10706.    and so it knows it has a reliable connection and -- unless it has been
  10707.    told not to -- will offer to stream, and the other Kermit program,
  10708.    since it has STREAMING set to AUTO, agrees.
  10709.    
  10710.    Since we have a reliable connection, we'll also get control-character
  10711.    unprefixing automatically because of the new clear-channel protocol
  10712.    ([522]Section 4.19).
  10713.    
  10714.    Any errors that occur during streaming are fatal to the transfer. The
  10715.    message is "Transmission error on reliable link". Should this happen:
  10716.    
  10717.     1. Check the remote Kermit's flow control setting (SHOW
  10718.        COMMUNICATIONS). If it is NONE, change it to XON/XOFF, or vice
  10719.        versa. If it is XON/XOFF (or you just changed it to XOFF/XOFF),
  10720.        make sure the file sender is prefixing the XON and XOFF
  10721.        characters. In the most drastic case, use "set prefix all" to
  10722.        force prefixing of all control characters.
  10723.     2. The remote Telnet server might chop off the 8th bit. In that case,
  10724.        tell C-Kermit to "set parity space". Or, you might be able to
  10725.        force the Telnet to allow eight-bit data by telling C-Kermit to
  10726.        "set telopt binary request accept" -- that is, request the Telnet
  10727.        server to enter binary mode, and accept binary-mode bids from the
  10728.        server.
  10729.     3. The remote Telnet server might have a buffering limitation. If a
  10730.        and b don't cure the problem, tell the file receiver to "set
  10731.        receive packet-length 1000" (or other number -- use the largest
  10732.        one that works). This too, is no different from the non-streaming
  10733.        case (more about this in [523]Section 4.20.2.3).
  10734.        
  10735.    And remember you can continue interrupted binary-mode transfers where
  10736.    they left off with the RESEND (= SEND /RECOVER) command.
  10737.    
  10738.    Here are the figures for the same 84 trials between the same Sun and
  10739.    IBM hosts as in 4.20.2.1, on the same network, but over a Telnet
  10740.    connection rather than socket-to-socket:
  10741.    
  10742.                   Streaming    Nonstreaming
  10743.   Max CPS         350088        322523
  10744.   Min CPS          95547        173152
  10745.   Mean CPS        321372        281830
  10746.   Median CPS      342604        291469
  10747.   Std Dev          40503         29948
  10748.  
  10749.    Correlations:
  10750.    
  10751.   CPS and window size:    0.001
  10752.   CPS and packet length:  0.152
  10753.   CPS and streaming:      0.128
  10754.  
  10755.    Here the effect is not as emphatic as in the socket-to-socket case,
  10756.    yet on the whole streaming tends to be beneficial.
  10757.    
  10758.    Additional measurements on HP-UX using C-Kermit 7.0 Beta.06:
  10759.    
  10760.                   Windowing     Streaming
  10761.   HP-UX 8->8      not tested       14Kcps
  10762.   HP-UX 8->9      not tested       76Kcps
  10763.   HP-UX 8->10      36Kcps          66Kcps
  10764.   HP-UX 9->9      not tested      190Kcps
  10765.   HP-UX 9->10     160Kcps         378Kcps
  10766.      _________________________________________________________________
  10767.    
  10768.     4.20.2.3. Streaming with Limited Packet Length
  10769.     
  10770.    The IRIX telnet server (at least the ones observed in IRIX 5.3 and
  10771.    6.2) does not allow Kermit to send packets longer than 4096 bytes.
  10772.    Thus when sending from IRIX C-Kermit when it is on the remote end of a
  10773.    Telnet connection, the packet length must be 4K or less. Trials in
  10774.    this case (in which packet lengths range from 1450 to 4000) show a
  10775.    strong advantage for streaming, which would be evident in any other
  10776.    case where the packet length is restricted, and stronger the shorter
  10777.    the maximum packet length.
  10778.    
  10779.                   Streaming    Nonstreaming
  10780.   Max CPS         426187        366870
  10781.   Min CPS         407500        276517
  10782.   Mean CPS        415226        339168
  10783.   Median CPS      414139        343803
  10784.   Std Dev           6094         25851
  10785.  
  10786.    Correlations:
  10787.    
  10788.   CPS and window size:    0.116
  10789.   CPS and packet length:  0.241
  10790.   CPS and streaming:      0.901
  10791.      _________________________________________________________________
  10792.    
  10793.     4.20.2.4. Streaming on Dialup Connections
  10794.     
  10795.    Here "dialup" refers to a "direct" dialup connection, not a SLIP or
  10796.    PPP connection, which is only a particular kind of TCP/IP connection.
  10797.    
  10798.    Attempt this at your own risk, and then only if (a) you have
  10799.    error-correcting modems, and (b) the connections between the modems
  10800.    and computers are also error-free, perfectly flow-controlled, and free
  10801.    of interrupt conflicts. Streaming can be used effectively and to
  10802.    fairly good advantage on such connections, but remember that the
  10803.    transfer is fatal if even one error is detected (also remember that
  10804.    should a binary-mode transfer fail, it can be recovered from the point
  10805.    of failure with RESEND).
  10806.    
  10807.    To use streaming on an unreliable connection, you must tell both
  10808.    Kermits that the connection is reliable:
  10809.    
  10810.   kermit -I
  10811.  
  10812.    or:
  10813.    
  10814.   C-Kermit> set reliable on
  10815.  
  10816.    In this case, it will probably be necessary to prefix some control
  10817.    characters, for example if your connection is through a terminal
  10818.    server that has an escape character. Most Cisco terminal servers, for
  10819.    example, require Ctrl-^ (30, as well as its high-bit equivalent, 158)
  10820.    to be prefixed. To unprefix these, you'll need to defeat the "clear
  10821.    channel" feature:
  10822.    
  10823.   C-Kermit> set reliable on
  10824.   C-Kermit> set clear-channel off
  10825.   C-Kermit> set prefixing none
  10826.   C-Kermit> set control prefix 1 13 30 158 ; and whatever else is necessary
  10827.  
  10828.    Dialup trials were done using fixed large window and packet sizes.
  10829.    They compare uploading and downloading of two common types of files,
  10830.    with and without streaming. Configuration:
  10831.    
  10832.      HP-9000/715/33 -- 57600bps, RTS/CTS -- USR Courier V.34 --
  10833.      V.34+V.42, 31200bps -- USR V.34+ Rackmount -- 57600bps, RTS/CTS --
  10834.      Cisco terminal server -- Solaris 2.5.1. Packet size = 8000, Window
  10835.      Size = 30, Control Character Unprefixing Minimal (but including the
  10836.      Cisco escape character).
  10837.      
  10838.    Since this is not a truly reliable connection, a few trials failed
  10839.    when a bad packet was received (most likely due to UART overruns); the
  10840.    failure was graceful and immediate, and the message was informative.
  10841.    The results of ten successful trials uploading and downloading the two
  10842.    files with and without streaming are:
  10843.    
  10844.             Streaming..
  10845.             Off    On
  10846.    Upload   5194   5565   txt (= C source code, 78K)
  10847.             3135   3406   gz  (= gzip file, compressed, 85K)
  10848.  Download   5194   5565   txt
  10849.             3041   3406   gz
  10850.  
  10851.    Each CPS figure is the mean of 10 results.
  10852.    
  10853.    A brief test was also performed on a LAT-based dialout connection from
  10854.    a VAX 3100 with VMS 5.5 to a USR Courier V.34 connected to a DECserver
  10855.    700 at 19200 bps. The 1-MB Sparc executable downloaded from a Sun to
  10856.    the VAX at 1100cps without streaming and 1900cps with streaming, using
  10857.    8000-byte packets, 30 window slots, and minimal prefixing in both
  10858.    cases.
  10859.      _________________________________________________________________
  10860.    
  10861.     4.20.2.5. Streaming on X.25 Connections
  10862.     
  10863.    We have only limited access to X.25 networks. One trial was performed
  10864.    in which the 1MB Solaris 2.4 Sparc executable was transferred over a
  10865.    SunLink X.25 connection; nothing is known about the actual physical
  10866.    connection. With a packet length of 8000 and a window size of 30, the
  10867.    file transferred at 6400 cps (using a maximum of 6 window slots). With
  10868.    the same packet length, but with streaming, it transferred without
  10869.    mishap at 6710 cps, about 5% faster.
  10870.      _________________________________________________________________
  10871.    
  10872.     4.20.3. Streaming - Preliminary Conclusions
  10873.     
  10874.    The results vary with the particular connection, but are good overall.
  10875.    Although numerous lower-level tricks can be used to improve
  10876.    performance on specific platforms or connection methods, streaming
  10877.    occurs at a high, system-independent level of the Kermit protocol and
  10878.    therefore can apply to all types of platforms and (reliable)
  10879.    connections transparently.
  10880.      _________________________________________________________________
  10881.    
  10882.   4.21. The TRANSMIT Command
  10883.   
  10884.    Prior to C-Kermit 7.0, the TRANSMIT command transmitted in text or
  10885.    binary mode according to SET FILE TYPE { TEXT, BINARY }. But now that
  10886.    binary mode is likely to be the default for protocol transfers, it is
  10887.    evident that this not also an appropriate default for TRANSMIT, since
  10888.    binary-mode TRANSMIT is a rather specialized and tricky operation.
  10889.    Therefore, TRANSMIT defaults to text mode always, regardless of the
  10890.    FILE TYPE setting.
  10891.    
  10892.    C-Kermit 7.0 expands the capabilities of the TRANSMIT command by
  10893.    adding the following switches (see [524]Section 1.5). The new syntax
  10894.    is:
  10895.    
  10896.   TRANSMIT [ switches... ] filename
  10897.  
  10898.    Zero or more switches may be included:
  10899.    
  10900.    /PIPE
  10901.           When /PIPE is included, "filename" is interpreted as a system
  10902.           command or program whose output is to be sent. Synonym:
  10903.           /COMMAND. Example:
  10904.           
  10905.   transmit /pipe finger
  10906.  
  10907.           You may enclose the command in braces, but you don't have to:
  10908.           
  10909.   xmit /pipe {ls -l | sort -r +0.22 -0.32 | head}
  10910.  
  10911.    /BINARY
  10912.           Transmits the file (or pipe output) in binary mode.
  10913.           
  10914.    /TEXT
  10915.           Transmits the file (or pipe output) in line-oriented text mode.
  10916.           Current FILE CHARACTER-SET and TERMINAL CHARACTER-SET
  10917.           selections govern translation. Default.
  10918.           
  10919.    /TRANSPARENT
  10920.           Specifies text mode without character-set translation, no
  10921.           matter what the FILE and TERMINAL CHARACTER-SET selections are.
  10922.           
  10923.    /NOWAIT
  10924.           This is equivalent to SET TRANSMIT PROMPT 0, but for this
  10925.           TRANSMIT command only. Applies only to text mode; it means to
  10926.           not wait for any kind of echo or turnaround character after
  10927.           sending a line before sending the next line. (Normally Kermit
  10928.           waits for a linefeed.)
  10929.           
  10930.    When TRANSMIT ECHO is ON, C-Kermit tries to read back the echo of each
  10931.    character that is sent. Prior to C-Kermit 7.0, 1 second was allowed
  10932.    for each echo to appear; if it didn't show up in a second, the
  10933.    TRANSMIT command would fail. Similarly for the TRANSMIT PROMPT
  10934.    character. However, with today's congested Internet connections, etc,
  10935.    more time is often needed:
  10936.    
  10937.    SET TRANSMIT TIMEOUT number
  10938.    Specifies the number of seconds to wait for an echo or the prompt
  10939.    character when TRANSMIT PROMPT is nonzero; the default wait is 1
  10940.    second. If you specify 0, the wait is indefinite. When a timeout
  10941.    interval of 0 is specified, and a desired echo or prompt does not show
  10942.    up, the TRANSMIT command will not terminate until or unless you
  10943.    interrupt it with Ctrl-C; use SET TRANSMIT TIMEOUT 0 with caution.
  10944.    
  10945.    Note: to blast a file out the communications connection without any
  10946.    kind of synchronization or timeouts or other manner of checking, use:
  10947.    
  10948.   SET TRANSMIT ECHO OFF
  10949.   SET TRANSMIT PROMPT 0 (or include the /NOWAIT switch)
  10950.   SET TRANSMIT PAUSE 0
  10951.   TRANSMIT [ switches ] filename
  10952.  
  10953.    In this case, text-file transmission is not-line oriented and large
  10954.    blocks can be sent, resulting in a significant performance improvement
  10955.    over line-at-at-time transmission. Successful operation depends (even
  10956.    more than usual for the TRANSMIT command!) on a clean connection with
  10957.    effective flow control.
  10958.    
  10959.    For details on TRANSMIT and character sets, see [525]Section 6.6.5.4.
  10960.      _________________________________________________________________
  10961.    
  10962.   4.22. Coping with Faulty Kermit Implementations
  10963.   
  10964.    Kermit protocol has been implemented in quite a few third-party
  10965.    commercial, shareware, and freeware software packages, with varying
  10966.    degrees of success. In most cases operation is satisfactory but slow
  10967.    -- only the bare minimum subset of the protocol is available -- short
  10968.    packets, no sliding windows, no attributes, etc. In other cases, the
  10969.    implementation is incorrect, resulting in failures at the initial
  10970.    negotiation stage or corrupted files.
  10971.    
  10972.    C-Kermit 7.0 and Kermit 95 1.1.19 include some new defense mechanisms
  10973.    to help cope with the most common situations. However, bear in mind
  10974.    there is only so much we can do in such cases -- the responsibility
  10975.    for fixing the problem lies with the maker of the faulty software.
  10976.      _________________________________________________________________
  10977.    
  10978.     4.22.1. Failure to Accept Modern Negotiation Strings
  10979.     
  10980.    The published Kermit protocol specification states that new fields can
  10981.    be added to the parameter negotiation string. These are to be ignored
  10982.    by any Kermit implementation that does not understand them; this is
  10983.    what makes the Kermit protocol extensible. Unfortunately, some Kermit
  10984.    implementations become confused (or worse) when receiving a
  10985.    negotiation string longer than the one they expect. You can try
  10986.    working around such problems by telling Kermit to shorten its
  10987.    negotiation string (and thus disable the corresponding new features):
  10988.    
  10989.   SET SEND NEGOTIATION-STRING-MAX-LENGTH number
  10990.  
  10991.    Try a number like 10. If that doesn't work, try 9, 8, 7, 6, and so on.
  10992.      _________________________________________________________________
  10993.    
  10994.     4.22.2. Failure to Negotiate 8th-bit Prefixing
  10995.     
  10996.    The published Kermit protocol specification states that 8th-bit
  10997.    prefixing (which allows transfer of 8-bit data over a 7-bit
  10998.    connection) occurs if the file sender puts a valid prefix character
  10999.    (normally "&") in the 8th-bit-prefix field of the negotiation string,
  11000.    and the receiver puts either a letter "Y" or the same prefix
  11001.    character. At least one faulty Kermit implementation exists that does
  11002.    not accept the letter "Y". To force C-Kermit / K-95 to reply with the
  11003.    other Kermit's prefix character rather than a "Y", give the following
  11004.    (invisible) command:
  11005.    
  11006.   SET Q8FLAG ON
  11007.  
  11008.    Use SET Q8FLAG OFF to restore the normal behavior.
  11009.      _________________________________________________________________
  11010.    
  11011.     4.22.3. Corrupt Files
  11012.     
  11013.    Refer to [526]Section 4.22.2. Some Kermit implementations mistakenly
  11014.    interpret the "Y" as a prefix character. Then, whenever a letter Y
  11015.    appears in the data, the Y and the character that follows it are
  11016.    replaced by a garbage character. At this writing, we are not sure if
  11017.    there is any solution, but try "set send negotiation-string-max-length
  11018.    6" and/or "set q8flag on".
  11019.    
  11020.    File corruption can also occur when control characters within the file
  11021.    data are sent without prefixing, as at least some are by default in
  11022.    C-Kermit 7.0 and K-95. Some Kermit implementations do not handle
  11023.    incoming "bare" control characters. To work around, "set prefixing
  11024.    all".
  11025.      _________________________________________________________________
  11026.    
  11027.     4.22.4. Spurious Cancellations
  11028.     
  11029.    The Kermit protocol specification states that if an ACK to a Data
  11030.    packet contains X in its data field, the transfer of the current file
  11031.    is canceled, and if it contains a Z, the entire transfer is canceled.
  11032.    At least one overzealous Kermit implementation applies this rule to
  11033.    non-Data packets as well, the typical symptom being that any attempt
  11034.    to transfer a file whose name begins with X or Z results in
  11035.    cancellation. This is because the file receiver typically sends back
  11036.    the name under which it stored the file (which might not be the same
  11037.    as the name it was sent with) in the ACK to the File Header packet.
  11038.    This is information only and should not cause cancellation. To work
  11039.    around the problem, use:
  11040.    
  11041.   SET F-ACK-BUG { ON, OFF }
  11042.  
  11043.    ON tells Kermit not to send back the filename in the ACK to the file
  11044.    header packet as it normally would do (OFF puts Kermit back to normal
  11045.    after using ON).
  11046.    
  11047.    A variation on the this bug occurs in an obscure Kermit program for
  11048.    MUMPS: When this Kermit program sends a file called (say) FOO.BAR, it
  11049.    requires that the ACK to its F packet contain exactly the same name,
  11050.    FOO.BAR. However, C-Kermit likes to send back the full pathname,
  11051.    causing the MUMPS Kermit to fail. SET F-ACK-BUG ON doesn't help here.
  11052.    So a separate command has been added to handle this situation:
  11053.    
  11054.   SET F-ACK-PATH { ON, OFF }
  11055.  
  11056.    Normally it is ON (regardless of the SET SEND PATHNAMES setting). Use
  11057.    SET F-ACK-PATH OFF to instruct Kermit to send back only the filename
  11058.    without the path in the ACK to the F packet.
  11059.      _________________________________________________________________
  11060.    
  11061.     4.22.5. Spurious Refusals
  11062.     
  11063.    Some Kermit implementations, notably PDP-11 Kermit 3.60 and earlier,
  11064.    have bugs in their handling of Attribute packets that can cause
  11065.    unwarranted refusal of incoming files, e.g. based on date or size.
  11066.    This can be worked around by telling one or both of the Kermit
  11067.    partners to:
  11068.    
  11069.   SET ATTRIBUTES OFF
  11070.      _________________________________________________________________
  11071.    
  11072.     4.22.6. Failures during the Data Transfer Phase
  11073.     
  11074.    This can be caused by control-character unprefixing ([527]Section
  11075.    4.22.3 ), and fixed by:
  11076.    
  11077.   SET PREFIXING ALL
  11078.  
  11079.    It can also have numerous other causes, explained in Chapter 10 of
  11080.    [528]Using C-Kermit: the connection is not 8-bit transparent (so use
  11081.    "set parity space" or somesuch), inadequate flow control, etc. Consult
  11082.    the manual.
  11083.      _________________________________________________________________
  11084.    
  11085.     4.22.7. Fractured Filenames
  11086.     
  11087.    At least one well-known PC-based communications package negotiates
  11088.    data compression, which (according to the protocol specification)
  11089.    applies to both the filename and the file data, but then fails to
  11090.    decompress the filename. Example: C-Kermit sends a file called
  11091.    R000101.DAT (where 000101 might be non-Y2K-wise YYMMDD notation), and
  11092.    the package in question stores the files as R~#0101.DAT. Workaround:
  11093.    Tell C-Kermit to SET REPEAT COUNTS OFF.
  11094.      _________________________________________________________________
  11095.    
  11096.     4.22.8. Bad File Dates
  11097.     
  11098.    At least one well-known PC-based communications package negotiates the
  11099.    passing of file timestamps from sender to receiver, but when it is
  11100.    sending files, it always gives them a timestamp of 1 February 1970.
  11101.    Workaround: tell C-Kermit to SET ATTRIBUTE DATE OFF. You don't get the
  11102.    file's real date, but you also don't get 1 Feb 1970; instead the file
  11103.    gets the current date and time.
  11104.      _________________________________________________________________
  11105.    
  11106.   4.23. File Transfer Recovery
  11107.   
  11108.    Prior to C-Kermit 7.0, RESEND (SEND /RECOVER) and REGET (GET /RECOVER)
  11109.    refused to work if FILE TYPE was not BINARY or the /BINARY switch was
  11110.    not included. Now these commands include an implied /BINARY switch,
  11111.    meaning they set the file type to binary for the duration of the
  11112.    command automatically.
  11113.    
  11114.    In the client/server arrangement, this also forces the server into
  11115.    binary mode (if it is C-Kermit 7.0 or greater, or K95 1.1.19 or
  11116.    greater) so the recovery operation proceeds, just as you asked and
  11117.    expected.
  11118.    
  11119.    BUT... Just as before, the results are correct only under the
  11120.    following conditions:
  11121.    
  11122.      * If the prior interrupted transfer was also in binary mode; or:
  11123.      * If the prior transfer was in text mode and the other computer was
  11124.        a "like platform" (e.g. UNIX-to-UNIX, Windows-to-Windows,
  11125.        DOS-to-Windows) AND there was no character-set translation (i.e.
  11126.        TRANSFER CHARACTER-SET was TRANSPARENT).
  11127.        
  11128.    Note that these circumstances are more likely to obtain in C-Kermit
  11129.    7.0, in which:
  11130.    
  11131.      * The default FILE TYPE in C-Kermit 7.0 is BINARY.
  11132.      * The default FILE INCOMPLETE setting is AUTO, which means KEEP if
  11133.        the transfer is in binary mode, DISCARD otherwise.
  11134.      * C-Kermit 7.0, Kermit 95 1.1.17, and MS-DOS Kermit 3.15 and later
  11135.        can recognize "like platforms" and switch into binary mode
  11136.        automatically. Transfers between like platforms are always binary
  11137.        unless character-set translation has been requested, and then is
  11138.        still binary for all files whose names match a binary pattern,
  11139.        unless the automatic mechanisms have been disabled (with a /TEXT
  11140.        switch, or with SET TRANSFER MODE MANUAL).
  11141.      * SEND /BINARY and GET /BINARY always force binary-mode transfers,
  11142.        even when FILE TYPE is TEXT, even when TRANSFER MODE is AUTOMATIC,
  11143.        even when PATTERNS are ON and the file's name matches a text
  11144.        pattern.
  11145.        
  11146.    But also note that the automatic client/server transfer-mode
  11147.    adjustments do not work with versions of C-Kermit prior to 7.0 or K95
  11148.    prior to 1.1.16.
  11149.    
  11150.    If the prior transfer was in text mode:
  11151.    
  11152.      * If text-mode transfers between the two platforms are
  11153.        "length-changing" (as they are between UNIX -- which terminates
  11154.        text lines with LF -- and DOS or Windows -- which terminates text
  11155.        lines with CRLF), the recovered file will be corrupt.
  11156.      * If text-mode transfers between the two platforms are not
  11157.        length-changing, but character-set translation was active in the
  11158.        prior transfer, the result will be a file in which the first part
  11159.        has translated characters and the second part does not.
  11160.        
  11161.    But in C-Kermit 7.0 and K95 1.1.19 and later, incompletely transferred
  11162.    text files are not kept unless you change the default. But if you have
  11163.    done this, and you have an incompletely transferred text file, you'll
  11164.    need to:
  11165.    
  11166.      * Transfer the whole file again in text mode, or:
  11167.      * Use SEND /STARTING-AT: to recover the transfer at the correct
  11168.        point; but you have to find out what that point is, as described
  11169.        in the manual.
  11170.        
  11171.    Kermit has no way of knowing whether the previous transfer was in text
  11172.    or binary mode so it is your responsibility to choose the appropriate
  11173.    recovery method.
  11174.    
  11175.    If you use C-Kermit to maintain parallel directories on different
  11176.    computers, using SET FILE COLLISION to transfer only those files that
  11177.    changed since last time, and the files are big enough (or the
  11178.    connection slow enough) to require SEND /RECOVER to resume interrupted
  11179.    transfers, you should remember that SEND /RECOVER (RESEND) overrides
  11180.    all FILE COLLISION settings. Therefore you should use SEND /RECOVER
  11181.    (RESEND) only on the file that was interrupted, not the file group.
  11182.    For example, if the original transfer was initiated with:
  11183.    
  11184.   SEND *
  11185.  
  11186.    and was interrupted, then after reestablishing your connection and
  11187.    starting the Kermit receiver with SET FILE COLLISION UPDATE on the
  11188.    remote end, use the following sequence at the sender to resume the
  11189.    transfer:
  11190.    
  11191.   SEND /RECOVER name-of-interrupted-file
  11192.  
  11193.    and then:
  11194.    
  11195.   SEND *
  11196.  
  11197.    (In C-Kermit 7.0 and later, \v(filename) contains the name of the file
  11198.    most recently transferred, as long you have not EXITed from Kermit or
  11199.    changed directory, etc.
  11200.      _________________________________________________________________
  11201.    
  11202.   4.24. FILE COLLISION UPDATE Clarification
  11203.   
  11204.    In UNIX, file modification dates are used when comparing the file date
  11205.    with the date in the attribute packet. In VMS, however, the file
  11206.    creation date is used. These two policies reflect the preferences of
  11207.    the two user communities.
  11208.    
  11209.    Also, remember that the file date/time given in the attribute packet
  11210.    is the local time at the file sender. At present, no timezone
  11211.    conversions are defined in or performed by the Kermit protocol. This
  11212.    is primarily because this feature was designed at a time when many of
  11213.    the systems where Kermit runs had no concept of timezone, and
  11214.    therefore would be unable to convert (say, to/from GMT or UTC or Zulu
  11215.    time).
  11216.    
  11217.    As a consequence, some unexpected results might occur when
  11218.    transferring files across timezones; e.g. commands on the target
  11219.    system that are sensitive to file dates might work (UNIX "make",
  11220.    backups, etc).
  11221.    
  11222.    Timezone handling is deferred for a future release.
  11223.      _________________________________________________________________
  11224.    
  11225.   4.25. Autodownload Improvements
  11226.   
  11227.    Refer to pages 164-165 of [529]Using C-Kermit about the hazards of
  11228.    autodownload when C-Kermit is "in the middle". As of C-Kermit 7.0, no
  11229.    more hazards. If C-Kermit has TERMINAL AUTODOWNLOAD ON and it detects
  11230.    a packet of the current protocol type (Kermit or Zmodem), it "erases"
  11231.    the visual aspect of the packet that would be seen by the terminal
  11232.    (or, more to the point, the emulator, such as K95). This way, only
  11233.    C-Kermit goes into RECEIVE mode, and not also the terminal emulator
  11234.    through which C-Kermit is accessed. And therefore, it is no longer
  11235.    necessary to SET TERMINAL AUTODOWNLOAD OFF to prevent multiple Kermits
  11236.    from going into receive mode at once, but of course it is still
  11237.    necessary to ensure that, when you have multiple Kermits in a chain,
  11238.    that the desired one receives the autodownload.
  11239.    
  11240.    The defaults have not been changed; Kermit 95 still has autodownload
  11241.    ON by default, and C-Kermit has it OFF by default.
  11242.      _________________________________________________________________
  11243.    
  11244.   5. CLIENT/SERVER
  11245.   
  11246.   5.0. Hints
  11247.   
  11248.    If you use SET SERVER GET-PATH to set up your server, and the GET-PATH
  11249.    does not include the server's current directory, clients can become
  11250.    quite confused. For example, "remote dir oofa.txt" shows a file named
  11251.    oofa.txt, but "get oofa.txt" fails. In this situation, you should
  11252.    either DISABLE DIR or make your GET-PATH include the current
  11253.    directory.
  11254.      _________________________________________________________________
  11255.    
  11256.   5.1. New Command-Line Options
  11257.   
  11258.    The -G command-line option is like -g (GET), except the incoming file
  11259.    is sent to standard output rather than written to disk.
  11260.    
  11261.    The -I option ("Internet") is used to tell a remote C-Kermit program
  11262.    that you are coming in via Internet Telnet or Rlogin and therefore
  11263.    have a reliable connection. The -I option is equivalent to SET
  11264.    RELIABLE ON and SET FLOW NONE.
  11265.    
  11266.    The -O option ("Only One") tells C-Kermit to enter server mode but
  11267.    then exit after the first client operation.
  11268.    
  11269.    See [530]Section 9.3 for details.
  11270.      _________________________________________________________________
  11271.    
  11272.   5.2. New Client Commands
  11273.   
  11274.    BYE and FINISH no longer try to do anything if a connection is not
  11275.    active. Thus a sequence like "hangup" followed by "bye" or "finish"
  11276.    will no longer get stuck in a long timeout-and-retransmission cycle,
  11277.    nor will it try to open a new connection.
  11278.    
  11279.    REMOTE EXIT
  11280.           Similar to FINISH, except it ensures that the Kermit server
  11281.           program exits back to the operating system or shell prompt.
  11282.           (FINISH would return it to its interactive prompt if it was
  11283.           started in interactive mode, and would cause it to exit if it
  11284.           entered server mode via command-line option.) When C-Kermit is
  11285.           to be the server, you can use { ENABLE, DISABLE } EXIT to
  11286.           control the client's access to this feature.
  11287.           
  11288.    REMOTE MKDIR directory-name
  11289.           Tells the client to ask the server to create a directory with
  11290.           the given name, which can be absolute or relative. The syntax
  11291.           of the directory name depends on the Kermit server (see
  11292.           [531]next section); in all cases, it can be in the syntax of
  11293.           the system where the server is running (UNIX, VMS, DOS, etc)
  11294.           but newer servers also accept UNIX syntax, no matter what the
  11295.           underlying platform. The server will not execute this command
  11296.           if (a) it does not understand it, (b) a DISABLE MKDIR command
  11297.           has been given, or (c) a DISABLE CWD command has been given;
  11298.           otherwise, the command is executed, but will fail if the
  11299.           directory can not be created, in which cases most servers will
  11300.           attempt to return a message giving the reason for failure. The
  11301.           REMOTE MKDIR command succeeds if the remote directory is
  11302.           created, or if it already exists and therefore does not need to
  11303.           be created, and fails otherwise.
  11304.           
  11305.    REMOTE RMDIR directory-name
  11306.           Tells the client to ask the server to remove (delete) a
  11307.           directory with the given name. The same considerations apply as
  11308.           for REMOTE MKDIR.
  11309.           
  11310.    REMOTE SET FILE INCOMPLETE { DISCARD, KEEP, AUTO }
  11311.           Previously this was only available in its earlier form, REMOTE
  11312.           SET INCOMPLETE (no FILE). The earlier form is still available,
  11313.           but invisible. Also, AUTO was added, meaning KEEP if in binary
  11314.           mode, DISCARD otherwise.
  11315.           
  11316.    REMOTE SET TRANSFER MODE { AUTOMATIC, MANUAL }
  11317.           Tells the client to ask the server to set the given
  11318.           file-transfer mode. Automatic means (roughly): if the client
  11319.           and the server are running on the same kind of computer (e.g.
  11320.           both are on UNIX), then use binary mode automatically; if the
  11321.           system types are different, use some other method to
  11322.           automatically determine text or binary mode, such as filename
  11323.           pattern matching. MANUAL means, in this context, obey the
  11324.           client's FILE TYPE setting (TEXT or BINARY). Synonym: REMOTE
  11325.           SET XFER MODE.
  11326.           
  11327.    [ REMOTE ] QUERY KERMIT function(args...)
  11328.           Prior to C-Kermit 7.0, the arguments were not evaluated
  11329.           locally. Thus it was not possible to have the server run the
  11330.           function with client-side variables as arguments. Now:
  11331.           
  11332.   define \%a oofa.*
  11333.   remote query kermit files(\%a)    ; Client's \%a
  11334.   remote query kermit files(\\%a)   ; Server's \%a
  11335.  
  11336.    [ REMOTE ] LOGIN [ user [ password ] ]
  11337.           LOGIN is now a synonym for REMOTE LOGIN.
  11338.           
  11339.    LOGOUT
  11340.           This command, when given in local mode, is equivalent to REMOTE
  11341.           LOGOUT. When given at the IKSD prompt, it logs out the IKSD.
  11342.           When given at the C-Kermit prompt when it has no connection, it
  11343.           does nothing.
  11344.           
  11345.    Note that in C-Kermit 7.0, the REMOTE (or R) prefix is not required
  11346.    for QUERY, since there is no local QUERY command. The new top-level
  11347.    QUERY command does exactly what REMOTE QUERY (RQUERY) does.
  11348.    
  11349.    All REMOTE commands now have single-word shortcuts:
  11350.    
  11351.  Shortcut   Full Form
  11352.   RASG       REMOTE ASSIGN
  11353.   RCD        REMOTE CD
  11354.   RCOPY      REMOTE COPY
  11355.   RDEL       REMOTE DELETE
  11356.   RDIR       REMOTE DIRECTORY
  11357.   REXIT      REMOTE EXIT
  11358.   RHELP      REMOTE HELP
  11359.   RHOST      REMOTE HOST
  11360.   RPWD       REMOTE PWD
  11361.   RSET       REMOTE SET
  11362.   etc.
  11363.  
  11364.    The R prefix is not applied to LOGIN because there is already an
  11365.    RLOGIN command with a different meaning. It is not applied to LOGOUT
  11366.    either, since LOGOUT knows what to do in each case, and for symmetry
  11367.    with LOGIN.
  11368.      _________________________________________________________________
  11369.    
  11370.     5.2.1. Remote Procedure Definitions and Calls
  11371.     
  11372.    This is nothing new, but it might not be obvious... REMOTE ASSIGN and
  11373.    REMOTE QUERY may be used to achieve remote procedure execution. The
  11374.    remote procedure can be defined locally or remotely.
  11375.    
  11376.    A remote procedure call is accomplished as noted in the previous
  11377.    section:
  11378.    
  11379.   [ remote ] query kermit function-name(args...)
  11380.  
  11381.    This invokes any function that is built in to the Kermit server, e.g.:
  11382.    
  11383.   [ remote ] query kermit size(foo.bar)
  11384.  
  11385.    returns the size of the remote file, foo.bar.
  11386.    
  11387.    Now note that C-Kermit includes an \fexecute() function, allowing it
  11388.    to execute any macro as if it were a built-in function. So suppose
  11389.    MYMACRO is the name of a macro defined in the server. You can execute
  11390.    it from the client as follows (the redundant "remote" prefix is
  11391.    omitted in the remaining examples):
  11392.    
  11393.   query kermit execute(mymacro arg1 arg2...)
  11394.  
  11395.    The return value, if any, is the value of the RETURN command that
  11396.    terminated execution of the macro, for example:
  11397.    
  11398.   define addtwonumbers return \feval(\%1+\%2)
  11399.  
  11400.    The client invocation would be:
  11401.    
  11402.   query kermit execute(addtwonumbers 3 4)
  11403.   7
  11404.  
  11405.    The result ("7" in this case) is also assigned to the client's
  11406.    \v(query) variable.
  11407.    
  11408.    To execute a remote system command or command procedure (shell script,
  11409.    etc) use:
  11410.    
  11411.   query kermit command(name args...)
  11412.  
  11413.    Finally, suppose you want the client to send a macro to the server to
  11414.    be executed on the server end. This is done as follows:
  11415.    
  11416.   remote assign macroname definition
  11417.   query kermit execute(macroname arg1 arg2...)
  11418.  
  11419.    Quoting is required if the definition contains formal parameters.
  11420.      _________________________________________________________________
  11421.    
  11422.   5.3. New Server Capabilities
  11423.   
  11424.     5.3.1. Creating and Removing Directories
  11425.     
  11426.    The C-Kermit 7.0 server responds to REMOTE MKDIR and REMOTE RMDIR
  11427.    commands. The directory name may be in either the native format of the
  11428.    server's computer, or in UNIX format. For example, a server running on
  11429.    VMS with a current directory of [IVAN] can accept commands from the
  11430.    client like:
  11431.    
  11432.   remote mkdir olga         ; Makes [IVAN.OLGA] (nonspecific format)
  11433.   remote mkdir .olga        ; Makes [IVAN.OLGA] (VMS format without brackets)
  11434.   remote mkdir olga/        ; Makes [IVAN.OLGA] (UNIX relative format)
  11435.   remote mkdir /ivan/olga   ; Makes [IVAN.OLGA] (UNIX absolute format)
  11436.   remote mkdir [ivan.olga]  ; Makes [IVAN.OLGA] (VMS absolute format)
  11437.   remote mkdir [.olga]      ; Makes [IVAN.OLGA] (VMS relative format)
  11438.  
  11439.     5.3.1.1. Creating Directories
  11440.     
  11441.    If a directory name is given that contains more than one segment that
  11442.    does not exist, the server attempts to create all the segments. For
  11443.    example, if the client says:
  11444.    
  11445.   REMOTE MKDIR letters/angry
  11446.  
  11447.    a "letters" subdirectory is created in the server's current directory
  11448.    if it does not already exist, and then an "angry" subdirectory is
  11449.    created beneath it, if it does not already have one. This can repeated
  11450.    to any reasonable depth:
  11451.    
  11452.   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
  11453.  
  11454.     5.3.1.2. Removing Directories
  11455.     
  11456.    When attempting to execute a REMOTE RMDIR, the server can remove only
  11457.    a single directory, not an entire sequence or tree. The system service
  11458.    that is called to remove the directory generally requires not only
  11459.    that the server process has write delete access, but also that the
  11460.    directory contain no files.
  11461.    
  11462.    In the future, a REMOTE RMDIR /RECURSIVE command (and the accompanying
  11463.    protocol) might be added. For now, use the equivalent REMOTE HOST
  11464.    command(s), if any.
  11465.      _________________________________________________________________
  11466.    
  11467.     5.3.2. Directory Listings
  11468.     
  11469.    Directory listings are generated by C-Kermit itself, rather than by
  11470.    running the underlying system's directory command. Some control over
  11471.    the listing format can be obtained with the SET OPTIONS DIRECTORY
  11472.    command ([532]Section 4.5.1). The following options affect listings
  11473.    sent by the server: /[NO]HEADING, /[NO]DOTFILES, and /[NO]BACKUP. In
  11474.    UNIX and VMS, the listing is always sorted by filename. There is, at
  11475.    present, no protocol defined for the client to request listing options
  11476.    of the server; this might be added in the future.
  11477.    
  11478.    The server's directory listings are in the following format:
  11479.    
  11480.    Protection or permissions:
  11481.           In UNIX and OS-9, this is a 10-character field, left adjusted.
  11482.           In VMS it is a 22-character field, left-adjusted. In each case,
  11483.           the protection / permission codes are shown in the server
  11484.           platform's native format. In other operating systems, this
  11485.           field is not shown.
  11486.           
  11487.    Size in bytes:
  11488.           This is always a 10-character field. The file's size is shown
  11489.           as a decimal number, right adjusted in the field. If the file
  11490.           is a directory and its size can not be obtained, the size is
  11491.           shown as "<DIR>". Two blanks follow this field.
  11492.           
  11493.    Date:
  11494.           Always in yyyy-mm-dd hh:mm:ss numeric format, and therefore 19
  11495.           characters long. If the file's date/time can't be obtained,
  11496.           zeros (0) are shown for all the digits. This field is followed
  11497.           by two blanks.
  11498.           
  11499.    Filename:
  11500.           This field extends to the end of the line. Filenames are shown
  11501.           relative to the server's current directory. In UNIX, symbolic
  11502.           links are shown as they are in an "ls -l" listing as "linkname
  11503.           -> filename".
  11504.           
  11505.    In UNIX and VMS, listings are returned by the server in alphabetical
  11506.    order of filename. There are presently no other sort or selection
  11507.    options.
  11508.    
  11509.    However, since these are fixed-field listings, all fields can be used
  11510.    as sort keys by external sort programs. Note, in particular, that the
  11511.    format used for the date allows a normal lexical on that field to
  11512.    achieve the date ordering. For example, let's assume we have a UNIX
  11513.    client and a UNIX server. In this case, the server's listing has the
  11514.    date in columns 22-40, and thus could be sorted by the UNIX sort
  11515.    program using "sort +0.22 -0.40" or in reverse order by "sort +0.22
  11516.    -0.40r".
  11517.    
  11518.    Since the UNIX client can pipe responses to REMOTE commands through
  11519.    filters, any desired sorting can be accomplished this way, for
  11520.    example:
  11521.    
  11522. C-Kermit> remote directory | sort +0.22 -0.40
  11523.  
  11524.    You can also sort by size:
  11525.    
  11526.   C-Kermit> remote directory | sort +0.11 -0.19
  11527.  
  11528.    You can use sort options to select reverse or ascending order. "man
  11529.    sort" (in UNIX) for more information. And of course, you can pipe
  11530.    these listings through any other filter of your choice, such as grep
  11531.    to skip unwanted lines.
  11532.      _________________________________________________________________
  11533.    
  11534.   5.4. Syntax for Remote Filenames with Embedded Spaces
  11535.   
  11536.    C-Kermit and K95, when in server mode, assume that any spaces in the
  11537.    file specification in an incoming GET command are filename separators.
  11538.    Thus if the client gives a command like:
  11539.    
  11540.   get {oofa.txt oofa.bin}
  11541.  
  11542.    or, equivalently:
  11543.    
  11544.   mget oofa.txt oofa.bin
  11545.  
  11546.    the server tries to send the two files, oofa.txt and oofa.bin. But
  11547.    what if you want the server to send you a file named, say:
  11548.    
  11549.   D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL
  11550.  
  11551.    How does the server know this is supposed to be one file and not
  11552.    seven? In this case, you need to the send file name to the server
  11553.    enclosed in either curly braces:
  11554.    
  11555.   {D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}
  11556.  
  11557.    or ASCII doublequotes:
  11558.    
  11559.   "D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"
  11560.  
  11561.    The method for doing this depends on your client. If your client is
  11562.    C-Kermit 7.0, any recent version of Kermit 95, or MS-DOS Kermit 3.16,
  11563.    then you have to enclose the name in braces just so the client can
  11564.    parse it, so to send braces or doublequotes to the server, you must
  11565.    put them inside the first, outside pair of braces. And you also need
  11566.    to double the backslashes to prevent them from being interpreted:
  11567.    
  11568.   get {{D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL}}
  11569.   get {"D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL"}
  11570.  
  11571.    To get around the requirement to double backslashes in literal
  11572.    filenames, of course you can also use:
  11573.    
  11574.   set command quoting off
  11575.   get {{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}}
  11576.   get {"D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"}
  11577.   set command quoting on
  11578.  
  11579.    If you are giving a "kermit" command to the UNIX shell, you have to
  11580.    observe the shell's quoting rules, something like this:
  11581.    
  11582.   kermit -ig "{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}"
  11583.  
  11584.    Here, the quotes go on the outside so UNIX will pass the entire
  11585.    filename, spaces, braces, and all, as a single argument to Kermit, and
  11586.    the backslashes are not doubled because (a) the UNIX shell ignores
  11587.    them since they are in a quoted string, and (b) Kermit ignores them
  11588.    since the interactive command parser is not activated in this case.
  11589.      _________________________________________________________________
  11590.    
  11591.   5.5. Automatic Orientation Messages upon Directory Change
  11592.   
  11593.    C-Kermit 7.0, when acting as a server, can send an orientation message
  11594.    to the client whenever the server directory changes. For example, when
  11595.    the client gives a REMOTE CD command, the server sends the contents of
  11596.    the new directory's "Read Me" file to the client's screen. The
  11597.    following commands govern this feature:
  11598.    
  11599.    SET SERVER CD-MESSAGE FILE name
  11600.           Given to the servr, allows the message-file name to be
  11601.           specified at runtime. A list of names to look for can be given
  11602.           in the following format:
  11603.           
  11604.   {{name1}{name2}{name3}{...}}
  11605.  
  11606.           e.g. SET SERVER CD-MESSAGE FILE
  11607.           {{./.readme}{README.TXT}{READ.ME}}
  11608.           
  11609.    REMOTE SET SERVER CD-MESSAGE { ON, OFF }
  11610.           Given to the client, lets the client control whether the server
  11611.           sends automatic CD messages.
  11612.           
  11613.    SHOW SERVER
  11614.           Given to server, includes CD-Message status.
  11615.           
  11616.    The default CD message file name is system dependent. SHOW CD or SHOW
  11617.    SERVER displays the list. Also see [533]Section 4.5.2.
  11618.      _________________________________________________________________
  11619.    
  11620.   5.6. New Server Controls
  11621.   
  11622.    DISABLE ENABLE
  11623.           Allows the server to configured such that DISABLEd features can
  11624.           not be re-enabled by any means -- e.g. if the client is somehow
  11625.           able to get the server into command mode. Once DISABLEd, ENABLE
  11626.           can not be re-ENABLEd.
  11627.           
  11628.    SET SERVER IDLE-TIMEOUT seconds
  11629.           This was available previously in Kermit 95 only. Now it can be
  11630.           used in C-Kermit also to specify a maximum number of seconds
  11631.           the server is allowed to be idle before exiting server mode. 0
  11632.           seconds means no idle timeout. In C-Kermit (but not K-95), SET
  11633.           SERVER TIMEOUT and SET SERVER IDLE-TIMEOUT are mutually
  11634.           exclusive -- you can have one or the other (or neither), but
  11635.           not both. (Server timeouts are for the benefit of primitive
  11636.           Kermit clients that are not capable of timing out on their own;
  11637.           to our knowledge, no such clients are still in circulation.)
  11638.           
  11639.    SET SERVER KEEPALIVE { ON, OFF }
  11640.           (See next section).
  11641.      _________________________________________________________________
  11642.    
  11643.   5.7. Timeouts during REMOTE HOST Command Execution
  11644.   
  11645.    Prior to C-Kermit 7.0, the C-Kermit server would block waiting for
  11646.    output from a system command invoked via REMOTE HOST from the client.
  11647.    If the system command took a long time to execute, the client would
  11648.    time out and send NAK packets. If the command took too long, the
  11649.    client would reach its retry limit and give up. Even if it didn't, the
  11650.    NAKs would cause unnecessary retransmissions.
  11651.    
  11652.    In version 7.0, the C-Kermit server (VMS and select()-capable UNIX
  11653.    versions only), sends "keepalive packets" (empty data packets) once
  11654.    per second while waiting for the system command to complete. This
  11655.    procedure should be entirely transparent to the Kermit client, and
  11656.    should prevent the unwanted timeouts and NAKs. When C-Kermit 7.0
  11657.    itself (or K95 1.1.19) is the client, it prints dots to show the
  11658.    keepalive packets.
  11659.    
  11660.    The keepalive feature can be turned off and on with:
  11661.    
  11662.   SET SERVER KEEPALIVE { ON, OFF }
  11663.  
  11664.    Normally it should be on. Turn it off it if causes trouble with the
  11665.    client, or if it seems to slow down the server (as it might on some
  11666.    platforms under certain circumstances).
  11667.      _________________________________________________________________
  11668.    
  11669.   6. INTERNATIONAL CHARACTER SETS
  11670.   
  11671.    Support for several new single-byte character sets was added in
  11672.    C-Kermit 7.0. Unicode / ISO 10646 is not yet supported, but is a high
  11673.    priority for forthcoming releases.
  11674.    
  11675.   6.0. ISO 8859-15 Latin Alphabet 9
  11676.   
  11677.    To accommodate the Euro currency symbol, and to correct several other
  11678.    longstanding problems with ISO Latin Alphabet 1, ISO 8859-15 Latin
  11679.    Alphabet 9 was issued in May 1998. It is supported by C-Kermit 7.0 as
  11680.    a transfer character set, a file character set, and a terminal
  11681.    character set. Translations that preserve the new characters are
  11682.    available between Latin-9 and several other sets including:
  11683.    
  11684.   PC Code Page 858         (Western European languages, similar to CP850)
  11685.   Windows Code Page 1252   (Western European languages, similar to Latin-1)
  11686.   Windows Code Page 1250   (Eastern European languages, similar to Latin-2)
  11687.  
  11688.    The Latin-9 transfer character set also allows for the OE digraph
  11689.    character, used primarily in French, to be preserved in transfers
  11690.    involving the DEC MCS or NeXT character sets.
  11691.    
  11692.    The Euro character is also present in the Universal Character Set,
  11693.    described in [534]Section 6.6.
  11694.    
  11695.   6.1. The HP-Roman8 Character Set
  11696.   
  11697.    The HP-Roman8 character set is supported in C-Kermit 6.0 and later but
  11698.    was omitted from Table VII-4 in the 2nd Edition of Using C-Kermit due
  11699.    to lack of space. It is listed in [535]Appendix III.
  11700.    
  11701.   6.2. Greek Character Sets
  11702.   
  11703.    Greek character sets were added in 6.1:
  11704.    
  11705.   SET FILE CHARACTER-SET { CP869, ELOT927, GREEK-ISO }
  11706.   SET TRANSFER CHARACTER-SET { GREEK-ISO }
  11707.  
  11708.    GREEK-ISO is ISO 8859-7, which the same as ELOT 928.
  11709.    
  11710.    The new Greek character sets are listed in [536]Appendix III.
  11711.    
  11712.   6.3. Additional Latin-2 Character Sets
  11713.   
  11714.    The following have been added as FILE and TERMINAL CHARACTER-SETs:
  11715.    
  11716.    MAZOVIA-PC
  11717.           A PC code page used in Poland, equivalent to CP437, but with 18
  11718.           substitutions needed for Polish.
  11719.           
  11720.    CP1250
  11721.           The Windows Latin 2 Code Page. Equivalent to ISO 8859-2, but
  11722.           with different encoding.
  11723.           
  11724.   6.4. Additional Cyrillic Character Sets
  11725.   
  11726.    The following have been added as FILE and TERMINAL CHARACTER-SETs:
  11727.    
  11728.    BULGARIA-PC
  11729.           This is the Cyrillic PC code page used in Bulgaria, where it is
  11730.           called Code Page 856. It is attributed to a company called
  11731.           DATEC, Inc, but CP856 is not a proper designation, since it
  11732.           refers to a Hebrew Code Page (see the IBM Registry).
  11733.           
  11734.    CP855
  11735.           This PC Code Page contains all the Cyrillic letters that are
  11736.           also in ISO 8859-5, and is therefore useful for non-Russian
  11737.           Cyrillic text (Ukrainian, Belorussian, etc), unlike CP866,
  11738.           which has a smaller repertoire of Cyrillic letters.
  11739.           
  11740.    CP1251
  11741.           The Windows Cyrillic Code Page. Equivalent to CP855, but with
  11742.           different encoding.
  11743.           
  11744.    KOI8R
  11745.           An extension to "Old KOI-8" that adds upper and lower case
  11746.           Cyrillic letter Io (looks like Roman E with diaeresis) plus a
  11747.           selection of box-drawing characters to columns 8 through 11,
  11748.           which are vacant in original Old KOI-8. KOI8-R is used for the
  11749.           Russian language. It is specified in [537]RFC 1489.
  11750.           
  11751.    KOI8U
  11752.           A similar extension of Old KOI-8, but for Ukrainian. It is
  11753.           specified in [538]RFC 2319.
  11754.      _________________________________________________________________
  11755.    
  11756.   6.5. Automatic Character-Set Switching
  11757.   
  11758.    Prior to version 7.0, C-Kermit's file character-set always had to be
  11759.    set explicitly. In 7.0 and later, it is set automatically when:
  11760.    
  11761.     1. This feature is enabled (as it is unless you disable it).
  11762.     2. An incoming text-mode transfer includes a transfer-character-set
  11763.        announcer and you have not previously given a SET FILE
  11764.        CHARACTER-SET command. In this case, C-Kermit switches to an
  11765.        appropriate file character set. For example, on an HP-UX
  11766.        workstation, an incoming Latin-1 file automatically selects
  11767.        HP-Roman8 for the local copy of the file; in Data General AOS/VS,
  11768.        it would select DG International.
  11769.     3. You give a SET TRANSFER CHARACTER-SET command without having
  11770.        previously specified a FILE CHARACTER-SET. An appropriate file
  11771.        character-set is chosen automatically.
  11772.        
  11773.    In addition, when you give a SET FILE CHARACTER-SET command, the
  11774.    appropriate transfer character-set is automatically chosen, to be used
  11775.    when you are sending files (but this does not override the one
  11776.    announced by the sender when you are receiving files).
  11777.    
  11778.    You might not agree about what is "appropriate", so of course you can
  11779.    disable or change all of the above actions.
  11780.    
  11781.    You can disable (or re-enable) the new automatic character-set
  11782.    switching feature in each direction separately:
  11783.    
  11784.    SET RECEIVE CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
  11785.           AUTOMATIC is the default, causing the behavior described above
  11786.           when an incoming file arrives. Choose MANUAL to defeat this
  11787.           behavior and force your current FILE CHARACTER-SET setting to
  11788.           be used, no matter what it is. Note that SET RECEIVE
  11789.           CHARACTER-SET MANUAL does not disable recognition of the
  11790.           incoming transfer character-set announcer, and translation from
  11791.           the corresponding character-set to your current file
  11792.           character-set. To disable that, use SET ATTRIBUTE CHARACTER-SET
  11793.           OFF.
  11794.           
  11795.    SET SEND CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
  11796.           Again AUTOMATIC is the default, causing the behavior described
  11797.           above when you give a SET { FILE, TRANSFER } CHARACTER-SET
  11798.           command. Use MANUAL to allow you to specify the transfer and
  11799.           file character-sets independently.
  11800.           
  11801.    SHOW CHARACTER-SETS
  11802.           Tells settings of { SEND, RECEIVE } CHARACTER-SET-SELECTION.
  11803.           
  11804.    Normally, however, it is more convenient to leave automatic switching
  11805.    active, and change any associations that are not appropriate for your
  11806.    application, area, or country. The commands are:
  11807.    
  11808.    SHOW ASSOCIATIONS
  11809.           This command lists all the associations in each direction: for
  11810.           each possible transfer character-set, it lists the associated
  11811.           file character-set, and vice versa. These are two separate and
  11812.           independent lists.
  11813.           
  11814.    ASSOCIATE TRANSFER-CHARACTER-SET name1 [ name2 ]
  11815.           Changes the association for the transfer character-set name1 to
  11816.           be the file character-set name2. If name2 is omitted, automatic
  11817.           switching is disabled for this transfer character-set only.
  11818.           
  11819.    ASSOCIATE FILE-CHARACTER-SET name1 [ name2 ]
  11820.           Changes the association for the file character-set name1 to be
  11821.           the transfer character-set name2. If name2 is omitted,
  11822.           automatic switching is disabled for this file character-set
  11823.           only.
  11824.      _________________________________________________________________
  11825.    
  11826.   6.6. UNICODE
  11827.   
  11828.    C-Kermit 7.0 adds support for Unicode, the Universal Character Set,
  11829.    for:
  11830.    
  11831.      * File Transfer (SEND, RECEIVE, GET, etc)
  11832.      * Terminal connection (CONNECT)
  11833.      * Unguarded file capture (LOG SESSION)
  11834.      * Unguarded file transmission (TRANSMIT)
  11835.      * Local file character-set conversion (TRANSLATE)
  11836.        
  11837.    C-Kermit is not, however, a "Unicode application" in the sense that
  11838.    its commands, messages, or user interface are Unicode. Rather, it is
  11839.    "Unicode aware" in its ability to handle and convert Unicode text in
  11840.    the course of file transfer and terminal connection, and you can also
  11841.    use Kermit to convert local files between Unicode and other character
  11842.    sets. TLA's:
  11843.    
  11844.   BMP - Base Multilingual Plane
  11845.   BOM - Byte Order Mark
  11846.   CJK - Chinese, Japanese, and Korean
  11847.   ISO - International Standards Organization
  11848.   TLA - Three-Letter Acronym
  11849.   UCS - Universal Character Set
  11850.   UTF - UCS Transformation Format
  11851.  
  11852.    Unicode and ISO 10646 are the coordinated and compatible corporate and
  11853.    international standards for the Universal Character Set (UCS). Unlike
  11854.    single-byte and even most multibyte character sets, the UCS can
  11855.    represent all characters in every existing writing system. A flat
  11856.    plain-text file encoded in some form of UCS can contain any mixture of
  11857.    English, Spanish, Italian, German, Hebrew, Arabic, Greek, Russian,
  11858.    Armenian, Georgian, Japanese, Chinese, Korean, Vietnamese, Tibetan,
  11859.    Hindi, Bengali, Tamil, Thai, Ethiopic, and so on, plus scientific and
  11860.    mathematical notation, as well as texts in Runes, Ogham, Glagolitic,
  11861.    and other historic scripts.
  11862.    
  11863.    The UCS already covers these scripts and many more, but it's an
  11864.    evolving standard with efforts underway to accommodate even more
  11865.    languages and writing systems. Support is growing for native UCS use
  11866.    on many platforms and in many applications. The goal of the framers of
  11867.    the UCS is for it to replace ASCII, the ISO Latin Alphabets, ISCII,
  11868.    VISCII, the Chinese, Japanese, and Korean (CJK) multibyte sets, etc,
  11869.    as well as the many private character sets in use today, in other
  11870.    words to become *the* Universal Character Set.
  11871.    
  11872.    Until that time, however, conversions between existing sets and the
  11873.    UCS will be necessary when moving text between platforms and
  11874.    applications. Now Kermit can help.
  11875.      _________________________________________________________________
  11876.    
  11877.     6.6.1. Overview of Unicode
  11878.     
  11879.    For a more complete picture, please visit:
  11880.    
  11881.   [539]http://www.unicode.org/
  11882.  
  11883.    and access the various online introductions, FAQs, technical reports,
  11884.    and other information. For greater depth, order the latest version of
  11885.    the published Unicode Standard. The following overview contains a
  11886.    great many oversimplifications and perhaps an opinion or two.
  11887.    
  11888.    At present, the UCS is a 16-bit (2-byte) character set, but with
  11889.    provisions to grow to a 4-byte set. UCS-2 refers to the two-byte set,
  11890.    also called the Base Multilingual Plane (BMP), in which each character
  11891.    has 16 bits, and therefore there are 2^16 = 65536 possible characters.
  11892.    The first 128 characters are the same as US ASCII (C0 control
  11893.    characters and DEL included), the next 32 are the C1 control
  11894.    characters of ISO 6429, and the next 96 are the Right Half of ISO
  11895.    8859-1 Latin Alphabet 1. The remaining tens of thousands of characters
  11896.    are arranged newly for the UCS, usually (but not always) in sections
  11897.    corresponding to existing standards, such as ISO Latin/Cyrillic, often
  11898.    plus additional characters not appearing in the existing standards due
  11899.    to lack of space (or other reasons).
  11900.    
  11901.    ISO 10646 allows for additional planes, e.g. for Egyptian
  11902.    hieroglyphics or ancient (or other esoteric) CJK characters, but these
  11903.    planes are not yet defined and so we will say nothing more about them
  11904.    here, except that their use will require the 4-byte form of UCS,
  11905.    called UCS-4, in some form (more about "forms" in [540]Section 6.6.2).
  11906.    
  11907.    Unicode and ISO 10646 are constantly under revision, mainly to add new
  11908.    characters. The Unicode revision is denoted by a version number, such
  11909.    as 1.0, 1.1, 2.0, 3.0. The ISO 10646 standard revision is identified
  11910.    by Edition (such as ISO 10646-1 1993), plus reference to any
  11911.    amendments. The first versions of these standards included encodings
  11912.    for Korean Hangul syllables (Jamos); these encodings were changed in
  11913.    version 1.1 of Unicode and by Amendment 5 to ISO 10646-1. The Unicode
  11914.    Technical Committee and the ISO acknowledge that this was a bad thing
  11915.    to do, and promise never change encodings or character names again,
  11916.    since this poses serious problems for conformance and data
  11917.    interchange.
  11918.    
  11919.    A UCS-2 value is customarily written like this:
  11920.    
  11921.   U+xxxx
  11922.  
  11923.    where "xxxx" represents four hexadecimal digits, 0-9 and A-F. For
  11924.    example, U+0041 is "A", U+00C1 is A-acute, U+042F is uppercase
  11925.    Cyrillic "Ya", U+FB4F is Hebrew Ligature Alef Lamed, and U+FFFD is the
  11926.    special character that means "not a character".
  11927.    
  11928.    Most characters from widely-used alphabetic writing systems such as
  11929.    the West European ones, Cyrillic, Greek, Hebrew, Vietnamese, etc, are
  11930.    available in "precomposed" form; for example Uppercase Latin Letter A
  11931.    with Acute Accent is a single character (as it is in Latin-1).
  11932.    However, the UCS also permits composition of a base character with one
  11933.    or more nonspacing diacritics. This means the same character can be
  11934.    represented in more than one way, which can present problems in many
  11935.    application areas, including transfer and character-set conversion of
  11936.    text.
  11937.    
  11938.    Conversion from ASCII or Latin-1 to UCS-2 text is "trivial": simply
  11939.    insert a NUL (0) byte before each ASCII or Latin-1 byte. Converting in
  11940.    the reverse direction (provided the UCS-2 file contains only U+0000 to
  11941.    U+00FF) is equally simple (if we ignore the issue of composition):
  11942.    remove every second (NUL) byte. Conversion of other character sets to
  11943.    and from UCS, however, requires tables or algorithms specific to each
  11944.    set. Nevertheless, the relatively transparent upwards compatibility
  11945.    from ASCII and Latin-1, in which a very large share of the world's
  11946.    textual data is encoded, gives the UCS an entree onto existing
  11947.    platforms.
  11948.    
  11949.    But the 2-byte format and the preponderance of NUL and other control
  11950.    bytes in UCS-2 text pose problems for current applications and
  11951.    transmission methods. And to make matters worse, different hardware
  11952.    platforms store UCS-2 characters in different byte order. Thus a UCS-2
  11953.    file transferred by FTP (or accessed via NFS, etc) between two
  11954.    computers with different architecture might have its bytes in the
  11955.    wrong order (or worse; see [541]Section 6.6.5.1 ).
  11956.      _________________________________________________________________
  11957.    
  11958.     6.6.2. UCS Byte Order
  11959.     
  11960.    Consider the number 1. In an 8-bit byte, this would be represented by
  11961.    the following series of 0- and 1-bits:
  11962.    
  11963.   +-----------------+
  11964.   | 0 0 0 0 0 0 0 1 |
  11965.   +-----------------+
  11966.  
  11967.    Therefore in a 16-bit "word" the representation might be:
  11968.    
  11969.   +-----------------+-----------------+
  11970.   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
  11971.   +-----------------+-----------------+
  11972.  
  11973.    Now consider the number 256, which is 2 to the 8th power. The binary
  11974.    representation is 100000000 (1 followed by 8 zeros). 256 would go into
  11975.    a 16-bit word like this:
  11976.    
  11977.   +-----------------+-----------------+
  11978.   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
  11979.   +-----------------+-----------------+
  11980.  
  11981.    When a computer works this way, it is said to be Big Endian, meaning
  11982.    it puts the most significant (biggest) byte first (on the "left") in a
  11983.    16-bit word, and the least significant byte second (on the right).
  11984.    
  11985.    However, some other computers have the opposite arrangement, called
  11986.    Little Endian, in which 1 is:
  11987.    
  11988.   +-----------------+-----------------+
  11989.   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
  11990.   +-----------------+-----------------+
  11991.  
  11992.    and 256 is:
  11993.    
  11994.   +-----------------+-----------------+
  11995.   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
  11996.   +-----------------+-----------------+
  11997.  
  11998.    Computers such as Sparc, MIPS, PA-RISC, and PowerPC are Big Endian,
  11999.    whereas the PC and the Alpha are Little Endian. Endianness has never
  12000.    been an issue with 7- or 8-bit characters, but it is with UCS
  12001.    characters. It can be a tricky business to share or transfer a UCS-2
  12002.    file between two different kinds of computers.
  12003.    
  12004.    To alleviate (but not entirely solve) the problem, UCS-2 files are
  12005.    supposed to begin with the Unicode character U+FEFF, Zero-Width
  12006.    No-Break Space (ZWNBS). This is a kind of "no-op" (note: any such
  12007.    assertion must normally be qualified with many "but ifs" and "excepts"
  12008.    which are omitted here in the interest of brevity). If the bytes are
  12009.    reversed the ZWNBS becomes U+FFFE, which is not (and never will be) a
  12010.    defined UCS character. U+FEFF at the beginning of a UCS file is
  12011.    therefore called a Byte Order Mark, or BOM.
  12012.    
  12013.    Any application that creates a UCS-2 (or UTF-16, or UCS-4) file should
  12014.    include a BOM, and any application that reads one should test for a
  12015.    BOM, and if one is found, infer the byte order from it. This is a
  12016.    convention, however -- not a standard or a requirement -- and
  12017.    applications vary in their ability to handle BOMs and "backwards"
  12018.    UCS-2 files.
  12019.    
  12020.    Note that a BOM is useful only at the beginning of a file. If you
  12021.    append one UCS-2 file to another, and both have BOMs, the internal BOM
  12022.    is no longer a BOM. And if the byte orders of the two files differ,
  12023.    then either the first part or the second will be backwards. (Various
  12024.    other undesirable effects might also occur, not discussed here.)
  12025.      _________________________________________________________________
  12026.    
  12027.     6.6.2. UCS Transformation Formats
  12028.     
  12029.    UCS textual data can be modified in various ways for transmission or
  12030.    storage. Any officially sanctioned method of doing this is called a
  12031.    UCS Transformation Format, or UTF. One such method, called UTF-16, is
  12032.    essentially identical with UCS-2 except that it designates certain
  12033.    code values as "escape sequences" (called surrogate pairs) to access
  12034.    characters in other planes without having to use full UCS-4. We won't
  12035.    discuss UTF-16 further here, since at the moment there are no other
  12036.    planes. Several other UTF's (such as UTF-1, UTF-2, and UTF-7) have
  12037.    fallen into disuse and are not discussed here. The most important
  12038.    transformation format today is UTF-8.
  12039.    
  12040.    UTF-8, so called because it "serializes" UCS-2 data into a stream of
  12041.    8-bit bytes, is designed to allow the UCS to work with present-day
  12042.    communications gear, computers, and software. The most important
  12043.    properties of UTF-8 are that byte order is constant (no byte swapping)
  12044.    and all (7-bit) ASCII characters represent themselves. Therefore
  12045.    conversion between ASCII and UTF-8 is no conversion at all, and
  12046.    applications or platforms (such as Plan 9 from Bell Labs) that use
  12047.    UTF-8 "for everything" can still run traditional ASCII-only
  12048.    applications and be accessed from them. In particular, unlike UCS-2,
  12049.    ASCII characters are not padded with NUL bytes. But also unlike UCS-2,
  12050.    there is no transparency for Latin-1 or any other non-ASCII character
  12051.    set. Every non-ASCII UCS-2 character is represented by a sequence of 2
  12052.    or 3 UTF-8 bytes. Thus UTF-8 is more compact than UCS-2 for text
  12053.    containing a preponderance of ABC's (or other ASCII characters), about
  12054.    the same as UCS-2 for other alphabetic scripts (Cyrillic, Roman,
  12055.    Greek, etc), and larger than UCS-2 for Chinese, Japanese, and Korean.
  12056.    
  12057.    The UTF-8 uncoding of the UCS has been adopted by the Internet as the
  12058.    preferred character set for new applications, and is gradually being
  12059.    retrofitted into traditional applications like FTP ([542]RFC 2640).
  12060.      _________________________________________________________________
  12061.    
  12062.     6.6.3. Conformance Levels
  12063.     
  12064.    Although the Unicode and ISO 10646 standards both describe the same
  12065.    character set, these standards differ in many ways, including their
  12066.    stated requirements for conformance and their classification of
  12067.    conformance levels.
  12068.    
  12069.    Kermit has always abided by ISO character-set standards, including ISO
  12070.    character-set designation and invocation methods. In adapting Unicode,
  12071.    therefore, we had to choose from among the available ISO designations
  12072.    which, in turn, correspond with ISO 10646 conformance levels. At
  12073.    present, Kermit claims the lowest conformance level, 1, meaning
  12074.    (roughly) that it does not handle combining forms and it does not
  12075.    handle Korean Hangul Jamos (just as, at present, it does not handle
  12076.    Korean in general). Note that ISO 10646 Conformance Levels 1 and 2
  12077.    sidestep the issue of the code changes for Korean Hangul by announcing
  12078.    non-support for Hangul regardless of encoding.
  12079.    
  12080.    ISO 10646 Conformance Level 1 is approximately equivalent to Unicode
  12081.    Normalization Form C (described in Unicode Technical Report 15,
  12082.    incorporated into Unicode 3.0).
  12083.    
  12084.    As noted in [543]Section 6.6.2, Kermit does not claim to support
  12085.    UTF-16 at the present time, hence the UCS-2 nomenclature. Kermit
  12086.    treats surrogates just as if they were any other UCS-2 characters,
  12087.    rather than as escapes to other planes, which means that (except when
  12088.    converting between UCS-2 and UTF-8) they are translated to "error"
  12089.    characters, since (a) no other planes are defined yet (and if they
  12090.    were, no other character sets supported by Kermit would encode their
  12091.    characters), and (b) no valid surrogate character corresponds to any
  12092.    other UCS-2 character.
  12093.    
  12094.    A minor yet significant aspect of Unicode 3.0 and some recent
  12095.    perturbation of ISO 10646-1 (probably Amendment 18, "Symbols and Other
  12096.    Characters") is the addition of the Euro Sign at U+20AC. As noted in
  12097.    [544]Section 6.0, Kermit's "Euro compliance" includes conversion
  12098.    between Latin Alphabet 9 and various PC code pages. Text can also be
  12099.    converted between UCS-2 or UTF-8 and any other Euro-compliant
  12100.    character set (Latin-9, CP858, CP1250, CP1252) without loss of the
  12101.    Euro Sign.
  12102.      _________________________________________________________________
  12103.    
  12104.     6.6.4. Relationship of Unicode with Kermit's Other Character Sets
  12105.     
  12106.    Kermit's character sets are divided into two groups: single-byte sets
  12107.    (such as Roman, Hebrew, Cyrillic, Greek) and multibyte (various
  12108.    Japanese sets). The two groups are distinct since one normally would
  12109.    not expect to convert Kanji ideograms to Roman (or other) letters, or
  12110.    vice versa.
  12111.    
  12112.    Unicode character-set conversion works with both groups, but obviously
  12113.    the result depends on the repertoires of the source and destination
  12114.    character-sets both including the characters in the file. For example,
  12115.    you can translate a Hungarian text file between Latin-2 and Unicode,
  12116.    but not between (say) Unicode and Latin/Greek. By the same token you
  12117.    can convert Japanese text from Shift-JIS or EUC or JIS-7 to Unicode
  12118.    and back, but you can't convert the same file to (say) Latin-1 if it
  12119.    contains Japanese characters.
  12120.    
  12121.      JIS-7 is equivalent to DEC Kanji and ISO-2022-JP except that the
  12122.      latter two do not support halfwidth Katakana. Kermit treats all
  12123.      three of these sets the same way, i.e. as JIS-7.
  12124.      
  12125.    As noted, Kermit presently does not handle combining diacritics, and
  12126.    so will not correctly convert UCS files that use them into a
  12127.    single-byte character set. For example, if a UCS file contains Latin
  12128.    Capital Letter A (U+0041) followed by Combining Acute Accent (U+0301),
  12129.    the result will be a two-character sequence, A followed by another
  12130.    character. This is what is meant by Conformance Level 1. (The
  12131.    situation grows worse with multiple diacritics, since they can occur
  12132.    in any order.)
  12133.    
  12134.    A higher level of conformance is possible, in which "canonical
  12135.    equivalences" are handled via algorithms and databases, at some
  12136.    (perhaps considerable) cost in performance, since a fair amount of
  12137.    additional code must be executed for every character during data
  12138.    transfer (database lookup, sorting of combining sequences into
  12139.    canonical order, etc). This can be added in future releases if there
  12140.    is a need (but in many cases, pre- and postpostprocessing might be a
  12141.    better option).
  12142.    
  12143.    Within these constraints, Kermit converts between the UCS and its
  12144.    other character sets. For example, a mixture of Russian and English
  12145.    (and/or Dutch, or Latin) text can bet converted between the UCS and
  12146.    ISO Latin/Cyrillic or KOI-8. But since Kermit does not presently
  12147.    support Arabic character-set conversion, the new availability of UCS
  12148.    conversion does not mean that Kermit can convert from Arabic UCS text
  12149.    to some other character set, because Kermit does not support any other
  12150.    character set that includes Arabic. Ditto for Thai, Armenian,
  12151.    Georgian, Tibetan, Chinese, Korean, etc. However, Kermit CAN convert
  12152.    Arabic (or any other script) between UCS-2 and UTF-8.
  12153.    
  12154.    Considering Cyrillic more carefully, note that the UCS also contains
  12155.    numerous Cyrillic characters not found in any of the Cyrillic sets
  12156.    (ISO Latin/Cyrillic, KOI8, CP866, etc) that Kermit supports;
  12157.    characters needed for Abkhasian, Yakut, Tatar, Bashkir, Altaic, Old
  12158.    Church Slavonic, etc; UCS text containing any of these historic or
  12159.    "extended" Cyrillic characters can not be converted to any of Kermit's
  12160.    current single-byte Cyrillic sets without loss. The situation is
  12161.    similar for Greek, Hebrew, etc, and even worse for Japanese since
  12162.    Unicode contains thousands of Kanjis that are lacking from the
  12163.    Japanese character sets based on JIS X 0208, such as EUC-JP, JIS-7,
  12164.    and Shift-JIS.
  12165.    
  12166.    In general, when converting from UCS to a single-byte set, there is
  12167.    always the possibility of data loss, just as there is when converting
  12168.    from any larger set to a smaller one. For example, if a UCS file
  12169.    contains Devanagari characters, these characters will be lost when
  12170.    converting to (say) Latin-1, just as Roman vowels with acute accents
  12171.    are lost when converting from Latin-1 (an 8-bit set) to German ISO 646
  12172.    (a 7-bit set).
  12173.      _________________________________________________________________
  12174.    
  12175.     6.6.5. Kermit's Unicode Features
  12176.     
  12177.    C-Kermit can convert between UCS-2 or UTF-8 and any of its other
  12178.    character sets, and also between UCS-2 and UTF-8. When converting
  12179.    between UCS-2 or UTF-8 and a non-Unicode character set (such as
  12180.    Latin-1), the UCS Line Separator (LS, U+2028) and Paragraph Separator
  12181.    (PS, U+2029) characters are converted to the appropriate line
  12182.    terminator (CR, LF, or CRLF). When converting from a non-Unicode set
  12183.    to UCS-2 or UTF-8, however, line terminators are not converted to LS
  12184.    or PS. This is in accordance with the recommendations of Unicode
  12185.    Technical Report #13.
  12186.    
  12187.    When C-Kermit starts, it tests the native byte order of the computer.
  12188.    You can see the result in the SHOW FEATURES or SHOW FILE display. It's
  12189.    also available in the variable \v(byteorder): 0 means Big Endian, 1
  12190.    means Little Endian.
  12191.    
  12192.    When UCS-2 is involved in file transfer or translation, the following
  12193.    commands tell C-Kermit what to do about byte order:
  12194.    
  12195.    SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
  12196.           This is for reading UCS-2 files that don't have a BOM, and also
  12197.           for writing UCS-2 files. If this command is not given, the
  12198.           machine's native byte order is used when writing UCS-2 files,
  12199.           and also when reading UCS-2 files that don't have a BOM.
  12200.           
  12201.    SET FILE UCS BOM { ON, OFF }
  12202.           This setting is used when creating UCS-2 files. A BOM is added
  12203.           at the beginning by default. Use OFF to not add the BOM. This
  12204.           command has no affect when writing files.
  12205.           
  12206.    COPY /SWAP-BYTES sourcefile destinationfile
  12207.           Use this for fixing a UCS-2 file whose bytes are in the wrong
  12208.           order.
  12209.           
  12210.    Use SHOW FILE to display the FILE UCS settings.
  12211.    
  12212.    Please note, again, that C-Kermit's user interface, including its
  12213.    script language, is not internationalized in any way. String
  12214.    comparisons, case conversion, and so on, work only for US ASCII
  12215.    (comparisons for equality work with other sets, but not
  12216.    lexically-greater-or-less-than or caseless comparisons; even
  12217.    comparisons for equality can fail when composed characters or byte
  12218.    order are involved). String functions such as \findex() and
  12219.    \fsubstring() that reference byte positions do just that; they won't
  12220.    work with UTF-8 text that contains any non-ASCII characters, and they
  12221.    will not work with UCS-2 text at all since they use C strings
  12222.    internally, which are NUL-terminated. These are just a few examples to
  12223.    illustrate that neither Unicode nor any other character-set beyond
  12224.    ASCII is supported at the user-interface, command, or scripting level
  12225.    in this version of C-Kermit.
  12226.      _________________________________________________________________
  12227.    
  12228.     6.6.5.1. File Transfer
  12229.     
  12230.    Kermit supports both UCS-2 and UTF-8 as file and transfer character
  12231.    sets in text-mode file transfer.
  12232.    
  12233.    To select UCS-2 or UTF-8 as a file character-set, use:
  12234.    
  12235.   SET FILE CHARACTER-SET { UCS2, UTF8 }
  12236.  
  12237.    If you want to send a UCS-2 text file (or save an incoming file in
  12238.    UCS-2 format), tell Kermit to:
  12239.    
  12240.   SET FILE CHARACTER-SET UCS2
  12241.  
  12242.    and if you want to send a UTF-8 text file (or store an incoming file
  12243.    in UTF-8 format), tell Kermit to:
  12244.    
  12245.   SET FILE CHARACTER-SET UTF8
  12246.  
  12247.    When sending UCS-2 files, Kermit determines the byte order from the
  12248.    BOM, if there is one (and if there is a BOM, it is stripped, i.e. not
  12249.    sent). If there is no BOM, the byte order is the one specified in the
  12250.    most recent SET FILE UCS BYTE-ORDER command, if any, otherwise the
  12251.    computer's native byte order is assumed. When storing incoming files
  12252.    as UCS-2, the byte order is according SET FILE UCS BYTE-ORDER, if
  12253.    given, otherwise the native one; a BOM is written according to SET
  12254.    FILE UCS BOM.
  12255.    
  12256.    A transfer character-set should be chosen that includes all of the
  12257.    characters in the source file. So, for example, if you are sending a
  12258.    UCS-2 file containing only German-language text, your transfer
  12259.    character-set can be Latin-1, Latin-2, Latin-9, UCS-2, or UTF-8. But
  12260.    if you are sending a file that contains a combination of Hebrew and
  12261.    Greek, your transfer character-set must be UCS-2 or UTF-8 if you don't
  12262.    want to lose one script or the other. Furthermore, the transfer
  12263.    character-set must be one that is supported by the receiving Kermit
  12264.    program. Since UCS support is new, it is possible that the other
  12265.    Kermit program (if it supports character sets at all) does not support
  12266.    it, but does support single-byte sets such as Latin-1, Latin/Cyrillic,
  12267.    etc.
  12268.    
  12269.    To select UCS-2 or UTF-8 as a transfer character-set, use:
  12270.    
  12271.   SET TRANSFER CHARACTER-SET { UCS2, UTF8 }
  12272.  
  12273.    It is up to the receiving Kermit program to convert the transfer
  12274.    format to its own local format, if necessary. If it does not
  12275.    understand the UTF-8 or UCS-2 transfer character-set, and your file
  12276.    can not be adequately represented by any single-byte transfer
  12277.    character-set (such as Latin-1 or Latin/Cyrillic) then, if UTF-8
  12278.    format is acceptable on the receiving computer, use UTF-8 as the
  12279.    transfer character-set, with the receiver told to "set unknown-char
  12280.    keep", or with the sender told to "set attribute char off". If you
  12281.    want the file to be stored in UCS-2 format at the receiver, send it it
  12282.    binary mode if the source file is also UCS-2, or else use the
  12283.    TRANSLATE command (next section) to convert it to UCS-2 first, then
  12284.    send it in binary mode. You should not use UCS-2 as a transfer
  12285.    character-set in text-mode transfers to Kermit programs that don't
  12286.    support it, because they are likely to corrupt the result the same way
  12287.    FTP would (see the final paragraph of this section).
  12288.    
  12289.    When UCS-2 is the transfer character set, it always goes into Kermit
  12290.    packets in Big Endian format, with no BOM. As always, the transfer
  12291.    character-set is announced by the sender to the receiver. The
  12292.    announcement for UCS-2 is "I162" (ISO Registration 162 = UCS-2 Level
  12293.    1) and by definition it is Big Endian (the standards say that when
  12294.    UCS-2 is serialized into bytes, the order must be Big Endian). The
  12295.    announcement for UTF-8 is "I190" (UTF-8 Level 1).
  12296.    
  12297.    When receiving a file whose transfer character-set is UCS-2 or UTF-8,
  12298.    you must choose the appropriate file character set for the result.
  12299.    There is no way Kermit can do this for you automatically, since UCS
  12300.    data can be in any script at all, or any combination.
  12301.    
  12302.    In general, UTF-8 or UCS-2 should be chosen as a transfer
  12303.    character-set if the source file is also encoded in some form of UCS
  12304.    and it contains more than one script. But there are other situations
  12305.    where where UTF-8 or UCS-2 offer advantages. For example, suppose the
  12306.    source file is on a NeXTstation and the destination file is on VMS.
  12307.    Both the NeXT and the DEC Multinational character sets include the
  12308.    French OE digraph, but Latin-1 does not. Therefore French words
  12309.    containing this character might not arrive intact when Latin-1 is the
  12310.    transfer character-set, but will with UTF-8 or UCS-2, since the UCS
  12311.    includes the OE digraph (but so does Latin-9).
  12312.    
  12313.    UCS-2 should be chosen as a transfer character-set only for Japanese
  12314.    text files that contain a large preponderance of Kanji, since in this
  12315.    case (and only this case) UCS-2 (two bytes per Kanji) is more
  12316.    efficient than UTF-8 (three bytes per Kanji). The same will be true
  12317.    for Chinese and Korean when they are supported by Kermit. UCS-2 should
  12318.    never be used as a transfer character-set with a transfer partner that
  12319.    does not support UCS-2 since this can cause file corruption (see last
  12320.    paragraph in this section).
  12321.    
  12322.    Note that Kermit's repeat-count compression is 100% ineffective for
  12323.    UCS-2, and is also ineffective for multibyte characters in UTF-8 and
  12324.    EUC-JP; this is because repeat-compression is a transport-level
  12325.    mechanism that operates on a per-byte basis; it has no knowledge of
  12326.    the distinction between a byte and a character.
  12327.    
  12328.    When C-Kermit starts, it sets up associations ([545]Section 6.5) for
  12329.    incoming files whose transfer character sets are UCS-2 or UTF-8
  12330.    appropriately for the platform so that the file character-set for the
  12331.    incoming file is UCS-2 in Windows and UTF-8 elsewhere. Otherwise,
  12332.    C-Kermit does not make any default associations for UCS-2 or UTF-8,
  12333.    but of course you may add or change associations to suit your needs
  12334.    and preferences by including the appropriate ASSOCIATE commands in
  12335.    your Kermit startup file. For example, if you are a PC user and deal
  12336.    only with text written in Greek and English, you can:
  12337.    
  12338.   ASSOCIATE TRANSFER-CHARACTER-SET UTF8 CP869
  12339.   ASSOCIATE TRANSFER-CHARACTER-SET UCS2 CP869
  12340.   ASSOCIATE FILE-CHARACTER-SET CP869 UTF8
  12341.  
  12342.    Note that when file transfer involves conversion between a single-byte
  12343.    character set and UCS-2 or UTF-8, the file-transfer thermometer and
  12344.    estimated time left might be inaccurate, since they are based on the
  12345.    source file size, not the transfer encoding. This is purely a cosmetic
  12346.    issue and does not effect the final result. (And is not, strictly
  12347.    speaking, a bug; Kermit protocol presently includes no method for the
  12348.    sender to furnish an "estimated transfer size" to the receiver, and in
  12349.    any case any such guess could be as far off as the file size, given
  12350.    the many other factors that come into play, such as compression and
  12351.    prefixing).
  12352.    
  12353.    A caution about FTP and UCS-2. As noted previously, if you transfer a
  12354.    UCS-2 file with FTP in binary mode between two computers with opposite
  12355.    Endianness, the result will have its bytes in the wrong order.
  12356.    However, if you use FTP to transfer a UCS-2 file in "ascii" (text)
  12357.    mode to ANY computer, even if it is identical to yours, the result
  12358.    will be corrupted because FTP's line-terminator conversions do not
  12359.    account for UCS-2. The same holds when sending from a UCS-aware Kermit
  12360.    program to an older Kermit program in text mode with a transfer
  12361.    character-set of UCS-2. So use UCS-2 as a transfer character-set ONLY
  12362.    with a UCS-2-aware Kermit partner.
  12363.      _________________________________________________________________
  12364.    
  12365.     6.6.5.2. The TRANSLATE Command
  12366.     
  12367.    In Kermit versions that have Unicode support included, TRANSLATE now
  12368.    always goes through Unicode; that is, the source set is converted to
  12369.    UCS-2 and thence to the target set. This is a major improvement, since
  12370.    in prior releases, C-Kermit had to pick the "most appropriate"
  12371.    transfer character-set as the intermediate set, and this would result
  12372.    in the loss of any characters that the source and target sets had in
  12373.    common but were lacking from the intermediate set (for example the OE
  12374.    digraph when translating from NeXT to DEC MCS through Latin-1). This
  12375.    never happens when Unicode is the intermediate set because Unicode is
  12376.    a superset of all other character sets supported by Kermit. A more
  12377.    dramatic example would be translation between Cyrillic PC code page
  12378.    866 and KOI8-R ([546]Section 6.4); formerly all the line- and
  12379.    box-drawing characters would be lost (since ISO 8859-5 does not have
  12380.    any); now the ones that these two sets have in common are preserved.
  12381.    
  12382.    UCS-2 and UTF-8 are now both supported as source-file and
  12383.    destination-file character sets by C-Kermit's TRANSLATE command, for
  12384.    example:
  12385.    
  12386.   translate oofa.txt ucs2 latin1 oofa-l1.txt
  12387.  
  12388.    translates oofa.txt from UCS-2 to Latin-1, storing the result as
  12389.    oofa-l1.txt. Similarly:
  12390.    
  12391.   translate oofa.txt utf8 latin1 oofa-l1.txt
  12392.   translate oofa.txt latin1 ucs2 oofa-ucs2.txt
  12393.   translate oofa.txt latin1 utf8 oofa-utf8.txt
  12394.   translate oofa.txt ucs2 utf8 oofa-utf8.txt
  12395.   translate oofa.txt utf8 ucs2 oofa-ucs2.txt
  12396.  
  12397.    Treatment of the UCS-2 BOM is exactly the same as for file transfer.
  12398.    Note that if a UCS-2 source file is in the "wrong" byte order and
  12399.    lacks a BOM, and you don't tell Kermit about it with SET FILE UCS
  12400.    BYTE-ORDER, the result of the translation is total gibberish. Recall
  12401.    that you can use COPY /SWAP-BYTES to switch the byte order of an
  12402.    errant UCS-2 file (or any other file for that matter, if you can think
  12403.    of a reason to). Also note that:
  12404.    
  12405.   translate oofa.txt ucs2 ucs2 new.txt
  12406.  
  12407.    Produces a result in the native (or SET FILE UCS) byte-order as long
  12408.    as oofa.txt has a BOM.
  12409.    
  12410.    As a side benefit of the Unicode work, the TRANSLATE command now works
  12411.    for the first time also for all Japanese character sets that Kermit
  12412.    supports. In other words, if you have a Japanese text file in any of
  12413.    the following encodings:
  12414.    
  12415.   EUC-JP
  12416.   Shift-JIS
  12417.   JIS-7
  12418.   UCS-2
  12419.   UTF-8
  12420.  
  12421.    You can use the TRANSLATE command to convert to any other encoding
  12422.    from the same list.
  12423.      _________________________________________________________________
  12424.    
  12425.     6.6.5.3. Terminal Connection
  12426.     
  12427.    The CONNECT command now allows UTF-8 as a local or remote terminal
  12428.    character-set:
  12429.    
  12430.   SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
  12431.   SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
  12432.   SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
  12433.  
  12434.    (Recall that Kermit's terminal character-set has two "ends" -- the set
  12435.    used on the host to which Kermit is connected, and the set used on the
  12436.    local keyboard and screen.)
  12437.    
  12438.    UCS-2 is not supported as a terminal character-set (either end) since
  12439.    (a) it is not used that way anywhere to our knowledge, and (b) the
  12440.    problems of Endianness and the high likelihood of loss of
  12441.    synchronization make it impractical. (Telecommunications is
  12442.    byte-oriented; if one byte, or any odd number of bytes, is lost
  12443.    because of buffer overruns, circuit resets, etc (or likewise if a
  12444.    burst of noise appears that takes the guise of an odd number of
  12445.    bytes), the byte order of the subsequent data stream will be
  12446.    backwards; unlike UTF-8 and traditional byte-based character sets,
  12447.    UCS-2 is not "self synchronizing".)
  12448.    
  12449.    UTF-8 does not have byte-order or synchronization problems and is
  12450.    growing in popularity as a terminal character set as well as in other
  12451.    application areas. It allows a single terminal session to use multiple
  12452.    scripts (Roman, Cyrillic, Greek, etc) without ISO 2022 character-set
  12453.    switching (which terminal emulators like Kermit 95 can handle but few
  12454.    host applications understand or use), and meshes nicely with the
  12455.    Unicode screen fonts that are beginning to appear.
  12456.    
  12457.    UTF-8 was first used in Plan 9 and soon will be available in Linux. It
  12458.    will probably spread from there (Unicode in some form is, of course,
  12459.    also used in Windows NT, but only internally -- not for access from
  12460.    outside).
  12461.    
  12462.    To use UTF-8 or any other character set that uses 8-bit bytes in your
  12463.    terminal session, be sure to tell C-Kermit to:
  12464.    
  12465.   SET TERMINAL BYTESIZE 8
  12466.   SET COMMAND BYTESIZE 8
  12467.   SET PARITY NONE
  12468.  
  12469.    (or use the shortcut command, EIGHTBIT, which does all three at once).
  12470.    
  12471.    In a setup where your local Kermit program uses a single-byte
  12472.    character set such as PC Code Page 850 and the remote host uses UTF-8:
  12473.    
  12474.   SET TERM CHAR UTF8 CP850
  12475.  
  12476.    or:
  12477.    
  12478.   SET TERM REMOTE CHAR UTF8
  12479.   SET TERM LOCAL CHAR CP850
  12480.  
  12481.    all works as expected. UTF-8 text on the remote displays correctly on
  12482.    your screen, and when you type CP850 characters, they are translated
  12483.    to UTF-8 sequences for transmission, and the echo from the host is
  12484.    translated from UTF-8 back to CP850. Telnet negotiations and
  12485.    autodownload take place before any character-set translation and work
  12486.    as before. The session log (if text mode was selected for it) contains
  12487.    only the local terminal character-set. And so on.
  12488.    
  12489.    Kermit merely supplies translations from UTF-8 to your local terminal
  12490.    character-set (this includes treating UTF-8 Line Separator and
  12491.    Paragraph separator as CRLF). However, Kermit does does not, at
  12492.    present, perform "canonicalization" of composed sequences, nor does it
  12493.    automatically execute bidirectionality algorithms for display of
  12494.    mixed-direction text (e.g. Hebrew and English). Such presentation
  12495.    issues, like all others in the terminal-host regime, are left to the
  12496.    host.
  12497.    
  12498.    By the way, C-Kermit also allows UTF-8 to be the local end of the
  12499.    terminal character-set, but so far this code is not tested, since we
  12500.    don't have a UTF-8 console or terminal to work with. However, it can
  12501.    be stated without doubt that C-Kermit's key mapping will not work for
  12502.    UTF-8 values, since (a) the key map is indexed by 8-bit byte values
  12503.    and (b) C-Kermit reads keystrokes a byte at a time (these comments do
  12504.    not apply to K95, which has direct access to the keyboard and can read
  12505.    "wide" keycodes and uses them to index a "wide" keymap).
  12506.    
  12507.    Restrictions: As noted, the CONNECT command does not support UCS-2 as
  12508.    a REMOTE TERMINAL character-set. Neither does it support the Japanese
  12509.    sets EUC-JP, JIS-7, and Shift-JIS. Support for the Japanese sets (and
  12510.    possibly Chinese and Korean too) might be added in a future release.
  12511.    Since the TRANSMIT command (next section) uses the same REMOTE
  12512.    TERMINAL character-sets as the CONNECT command, it has the same
  12513.    restrictions.
  12514.      _________________________________________________________________
  12515.    
  12516.     6.6.5.4. The TRANSMIT Command
  12517.     
  12518.    As described in Chapter 15 of [547]Using C-Kermit and [548]Section
  12519.    4.21 of this document, the TRANSMIT command can be used to upload a
  12520.    file without protocol, more or less as if you were typing it on your
  12521.    keyboard while connected to the host. When TRANSMITting in text mode,
  12522.    the file's character set is converted to the host's unless you have
  12523.    SET TERMINAL CHARACTER-SET TRANSPARENT, or you include the new
  12524.    TRANSMIT switch, /TRANSPARENT.
  12525.    
  12526.    Before C-Kermit 7.0, the file character-set was assumed to be the same
  12527.    as the local end of the terminal character-set, and the TRANSMIT
  12528.    command used the same translations as the CONNECT command, ignoring
  12529.    the file character-set.
  12530.    
  12531.    In C-Kermit 7.0, that assumption (a poor one to begin with) can no
  12532.    longer be made, since UCS-2 can be a file character-set but not a
  12533.    terminal character-set. So now the file's character-set is given by
  12534.    your most recent SET FILE CHARACTER-SET command. The host's character
  12535.    set is the remote end of your most recent SET TERMINAL CHARACTER-SET
  12536.    command:
  12537.    
  12538.   SET TERMINAL CHARACTER-SET remote-set [ local-set ]
  12539.  
  12540.    or:
  12541.    
  12542.   SET TERMINAL REMOTE-CHARACTER-SET remote-set
  12543.  
  12544.    The TRANSMIT command converts each source-file character from the FILE
  12545.    character-set to the REMOTE TERMINAL character-set, and then transmits
  12546.    the translated characters according to your SET TRANSMIT preferences
  12547.    (Chapter 15).
  12548.    
  12549.    If you have SET TRANSMIT ECHO ON, and the host is echoing the
  12550.    transmitted characters, the echos are converted from the remote
  12551.    terminal character-set to the local terminal character-set.
  12552.    
  12553.   [ A picture would help... ]
  12554.  
  12555.    Confused? Let's work through an example. Suppose your local computer
  12556.    is a NeXTstation, on which text files are encoded in the NeXT
  12557.    character set, and that the remote computer is a Data General AViiON,
  12558.    which uses the Data General International character set. Further
  12559.    suppose that you are logged in to the NeXT from a VT220 terminal which
  12560.    uses the DEC Multinational character set.
  12561.    
  12562.    You need to convert the file from NeXT encoding to DG encoding and
  12563.    convert the echoes from DG encoding to DEC encoding. So on the NeXT,
  12564.    tell C-Kermit to:
  12565.    
  12566.   eightbit
  12567.   set file character-set next
  12568.   set term character-set dg-international dec-mcs
  12569.   transmit /text nextdata.txt
  12570.  
  12571.    (This assumes you have some sort of collection process already set up
  12572.    on the Data General, such as a text editor or the venerable "cat >
  12573.    foo". The EIGHTBIT command is equivalent to SET TERMINAL BYTESIZE 8,
  12574.    SET COMMAND BYTESIZE 8, SET PARITY NONE.)
  12575.    
  12576.    To further complicate matters, suppose your local terminal character
  12577.    set is the same as the remote one, so you don't need terminal
  12578.    character-set translation, but you need to TRANSMIT a file that is in
  12579.    a different character set and you want it translated to the host set.
  12580.    In this case, use SET TERM CHARACTER-SET to actually specify the
  12581.    character set used on each end, rather than specifying TRANSPARENT:
  12582.    
  12583.   eightbit
  12584.   set file character-set ucs2
  12585.   set term character-set latin1 latin1
  12586.   transmit /text ucs2data.txt
  12587.  
  12588.    The distinction between:
  12589.    
  12590.   SET TERMINAL CHARACTER-SET xxx yyy
  12591.  
  12592.    (where xxx and yyy are the same set) and:
  12593.    
  12594.   SET TERMINAL CHARACTER-SET TRANSPARENT
  12595.  
  12596.    is new to C-Kermit 7.0, but affects only the TRANSMIT command.
  12597.    
  12598.    The TRANSMIT command currently does nothing special with UCS-2/UTF-8
  12599.    Line and Paragraph Separator characters; more experience is required
  12600.    to find out how these behave in a genuine Unicode terminal-host
  12601.    setting.
  12602.    
  12603.    Restrictions: As noted, the TRANSMIT command translates from the FILE
  12604.    character-set to the REMOTE TERMINAL character-set. This rules out
  12605.    translations to any character set that is not supported as a REMOTE
  12606.    TERMINAL character-set, such as UCS-2, EUC-JP, JIS-7, and Shift-JIS.
  12607.      _________________________________________________________________
  12608.    
  12609.     6.6.5.5. Summary of Kermit Unicode Commands
  12610.     
  12611.    Specifying file character-set and byte order:
  12612.           SET FILE CHARACTER-SET { ..., UCS2, UTF8 }
  12613.           REMOTE SET FILE CHARACTER-SET { ..., UCS2, UTF8 } (See next
  12614.           section)
  12615.           SET FILE UCS BOM { ON, OFF }
  12616.           SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
  12617.           
  12618.    Specifying the transfer character-set:
  12619.           SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
  12620.           REMOTE SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
  12621.           
  12622.    Specifying the terminal character-set:
  12623.           SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
  12624.           SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
  12625.           SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
  12626.           
  12627.    Displaying settings:
  12628.           SHOW FILE
  12629.           SHOW TRANSFER
  12630.           SHOW TERMINAL
  12631.           SHOW CHARACTER-SETS
  12632.           
  12633.    Commands that use these settings include:
  12634.           SEND, RECEIVE, GET, etc.
  12635.           CONNECT
  12636.           TRANSMIT
  12637.           LOG SESSION
  12638.           
  12639.    Converting files:
  12640.           TRANSLATE infile { ..., UCS-2, UTF-8 } { ..., UCS-2, UTF-8 }
  12641.           outfile
  12642.           COPY /SWAP-BYTES infile outfile
  12643.      _________________________________________________________________
  12644.    
  12645.   6.7. Client/Server Character-Set Switching
  12646.   
  12647.    A simple mechanism has been added to allow the client to change the
  12648.    server's FILE CHARACTER-SET:
  12649.    
  12650.    REMOTE SET FILE CHARACTER-SET name
  12651.           The client asks the server to change its file character-set to
  12652.           the one given. The name must match one of the server's file
  12653.           character-set names. For convenience, C-Kermit uses its own
  12654.           file character-set keyword list for parsing this command so you
  12655.           can use ? for help and Tab or Esc for completion. However,
  12656.           since the server might have a different repertoire (or even use
  12657.           different names for the same sets), C-Kermit accepts any string
  12658.           you supply and sends it to the server. The server, if it
  12659.           supports this command (C-Kermit 7.0 and K95 1.1.19 do), sets
  12660.           its file character-set as requested, and also disables
  12661.           automatic character-set switching ([549]Section 6.5). If the
  12662.           server does not support this command or if it does not support
  12663.           the given character set, the REMOTE SET FILE CHARACTER-SET
  12664.           command fails.
  12665.           
  12666.    Here's an example that sends a Japanese text file encoded in Shift-JIS
  12667.    to a server using every combination of Kermit's Japanese-capable file
  12668.    and transfer character sets:
  12669.    
  12670.   dcl \&x[] = euc ucs2 utf8             ; transfer character-sets
  12671.   dcl \&y[] = eu uc ut                  ; 2-letter abbreviations for them
  12672.   dcl \&f[] = shift euc jis7 ucs2 utf8  ; file character-sets
  12673.   dcl \&g[] = sj eu j7 uc ut            ; 2-letter abbreviations
  12674.  
  12675.   set file char shift-jis               ; local file character-set is Shift-JIS
  12676.   for \%i 1 \fdim(&x) 1 {               ; for each transfer character-set...
  12677.       set xfer char \&x[\%i]            ; set it
  12678.       for \%j 1 \fdim(&f) 1 {           ; for each remote file character-set...
  12679.           remote set file char \&f[\%j] ; set it
  12680.           if fail exit 1 SERVER REJECTED CHARSET
  12681.           send /text meibo-sj.html meibo-sj-\&y[\%i]-\&g[\%j].txt ; send the fi
  12682. le
  12683.           if fail exit 1 TRANSFER FAILED
  12684.       }
  12685.   }
  12686.  
  12687.    The Kermit-370 server does not support REMOTE SET FILE CHARACTER-SET,
  12688.    but since it supports REMOTE KERMIT commands, you can get the same
  12689.    effect with REMOTE KERMIT SET FILE CHARACTER-SET name.
  12690.      _________________________________________________________________
  12691.    
  12692.   7. SCRIPT PROGRAMMING
  12693.   
  12694.    (Also see [550]Section 2.8, Scripting Local Programs.)
  12695.    
  12696.   7.0. Bug Fixes
  12697.   
  12698.    The following script programming bugs were fixed in C-Kermit 7.0:
  12699.    
  12700.      * IF EXIST and IF DIRECTORY were fixed to properly strip braces from
  12701.        around their arguments, so "if directory {C:\Program Files}", etc,
  12702.        would work as expected. However, this means that if the file or
  12703.        directory name is actually enclosed in braces, the braces must be
  12704.        doubled.
  12705.      * The READ command did not fail if the READ file wasn't open; now it
  12706.        does.
  12707.      * The READ command refused to read the last or only line of a file
  12708.        if it did not end with a proper line terminator; now it does.
  12709.      * The END command, when given from within a SWITCH statement, did
  12710.        not exit from the current macro or command file; instead it just
  12711.        terminated the SWITCH.
  12712.      _________________________________________________________________
  12713.    
  12714.   7.1. The INPUT Command
  12715.   
  12716.    7.1.1. INPUT Timeouts
  12717.    
  12718.    The description of the INPUT command on page 422 fails to mention the
  12719.    following two points about the timeout (which apply to C-Kermit 6.0
  12720.    and later):
  12721.    
  12722.     1. "INPUT -1 text" (or "INPUT \%x text", where \%x is any variable
  12723.        whose value is -1 or less) means "wait forever". This form of the
  12724.        INPUT command fails only if it is interrupted, since it will never
  12725.        time out.
  12726.     2. INPUT 0 performs a nonblocking read of material that has already
  12727.        arrived but has not yet been read, and succeeds immediately if the
  12728.        target string is found, or fails immediately if it is not found.
  12729.        
  12730.    The same points apply to MINPUT. REINPUT ignores its timeout
  12731.    parameter.
  12732.      _________________________________________________________________
  12733.    
  12734.     7.1.2. New INPUT Controls
  12735.     
  12736.    The following new INPUT controls were added in version 7.0:
  12737.    
  12738.    SET INPUT AUTODOWNLOAD { ON, OFF }
  12739.           Explained in [551]Section 7.7.
  12740.           
  12741.    SET INPUT CANCELLATION { ON, OFF }
  12742.           This governs whether an INPUT command can be canceled by
  12743.           "pressing any key" on the keyboard. Normally it can be, in
  12744.           which case the INPUT command fails immediately and \v(instatus)
  12745.           is set to 2, indicating interruption. SET INPUT CANCELLATION
  12746.           OFF disables keyboard cancellations; thus if the search text is
  12747.           not encountered, the INPUT command will run for its entire
  12748.           timeout interval. SET INPUT CANCELLATION OFF does not disable
  12749.           interruption by Ctrl-C, however; every command needs an
  12750.           emergency exit. (If you really want to disable interruption by
  12751.           Ctrl-C, use SET COMMAND INTERRUPTION OFF.)
  12752.           
  12753.    Also see [552]Section 7.2 for any new variables related to INPUT.
  12754.      _________________________________________________________________
  12755.    
  12756.     7.1.3. INPUT with Pattern Matching
  12757.     
  12758.    C-Kermit 7.0 allows INPUT, MINPUT, and REINPUT targets to be a pattern
  12759.    (explained in [553]Sections 1.19 and [554]4.9). This solves a
  12760.    long-standing problem illustrated by the following scenario: a certain
  12761.    company has a bank of TCP/IP modem servers, with hostnames server1,
  12762.    server2, server3, and so on. Each server's prompt is its name,
  12763.    followed by a colon (:), for example "Server72:". Without INPUT
  12764.    patterns, it would be rather difficult to wait for the prompt. The
  12765.    brute force approach:
  12766.    
  12767.   minput 20 Server1: Server2: Server3: ... (enumerating each one)
  12768.  
  12769.    is subject to failure whenever a new server is added. A more subtle
  12770.    approach:
  12771.    
  12772.   input 20 Server
  12773.   if fail ...
  12774.   input 2 :
  12775.  
  12776.    is liable to false positives, e.g. "Welcome to the XYZ Corp Modem
  12777.    Server. Please read the following message:"...
  12778.    
  12779.    With patterns, you can match the prompt with "Server*:" (which doesn't
  12780.    solve the "false positives" problem, but certainly is more compact
  12781.    than the brute force method), or with more specific patterns such as
  12782.    "Server[1-9]:" and "Server[1-9][0-9]:", or equivalently:
  12783.    
  12784.   Server{[1-9],[1-9][0-9]}:
  12785.  
  12786.    meaning the word "Server" followed by a single digit (1-9) or by two
  12787.    digits representing a number from 1 to 99, followed by a colon.
  12788.    
  12789.    INPUT pattern matching has been added in a way that does not interfere
  12790.    with existing scripts. No new commands or switches are used. The
  12791.    simple rule is: if an INPUT search target is the argument of the (new)
  12792.    \fpattern() function, it is a pattern. Otherwise it is taken
  12793.    literally, as before. For example:
  12794.    
  12795.   input 5 a*b
  12796.  
  12797.    searches for an 'a' followed by an asterisk ('*'), followed by a 'b'.
  12798.    But:
  12799.    
  12800.   input 5 \fpattern(a*b)
  12801.  
  12802.    searches for an 'a' followed by anything at all up to and including
  12803.    the first 'b'. This means that any search target to INPUT, MINPUT, or
  12804.    REINPUT can be a pattern or a literal string, and in particular that
  12805.    MINPUT can accommodate any mixture of patterns and literal strings.
  12806.    
  12807.    In selecting patterns, note that:
  12808.    
  12809.      * A leading '*' is always implied so there is no need to include
  12810.        one.
  12811.      * A trailing '*' is meaningless and ignored.
  12812.      * A '*' by itself matches the first character that arrives.
  12813.        
  12814.    A syntax note: If your pattern is a selection list, meaning a list of
  12815.    alternatives separated by commas and enclosed in braces, then the
  12816.    outer braces will be stripped by various levels of parsers, so you
  12817.    must include three of each:
  12818.    
  12819.   input 10 \fpattern({{{abc,mno,xyz}}})
  12820.  
  12821.    Note that this is equivalent to:
  12822.    
  12823.   minput 10 abc mno xyz
  12824.  
  12825.    except for the setting of the \v(minput) variable.
  12826.    
  12827.    And a caution: INPUT pattern matching has a limitation that you
  12828.    probably never noticed with literal-string matching, namely that there
  12829.    is a limit on the size of the match. For example, if the pattern is
  12830.    "a*b", the match will succeed if the 'a' and 'b' are not separated by
  12831.    more than (say) 8K bytes, but will fail if they are farther apart than
  12832.    that. In such cases, it better to use two INPUTs (e.g. "input 10 a"
  12833.    and then "input 100 b").
  12834.      _________________________________________________________________
  12835.    
  12836.     7.1.4. The INPUT Match Result
  12837.     
  12838.    The result of any INPUT, MINPUT, or REINPUT command, no matter whether
  12839.    the search targets are patterns or literal strings, is available in
  12840.    the new \v(inmatch) variable. For example:
  12841.    
  12842.   minput 10 cat \fpattern([dh]og)
  12843.   if success echo MINPUT matched "\v(inmatch)"
  12844.  
  12845.    This is especially useful when a pattern was matched, since it makes
  12846.    the string that matched the pattern available to Kermit; there would
  12847.    be no way to get it otherwise.
  12848.    
  12849.    After an INPUT command, you can view all the INPUT-related variables
  12850.    by typing "show variables in" (abbreviate as "sho var in"), which
  12851.    shows the values of all built-in variables whose names start with
  12852.    "in".
  12853.      _________________________________________________________________
  12854.    
  12855.   7.2. New or Improved Built-In Variables
  12856.   
  12857.    \v(blockcheck)
  12858.           Current BLOCK-CHECK setting, 1, 2, 3, or 4. 4 is the code for
  12859.           BLANK-FREE-2.
  12860.           
  12861.    \v(byteorder)
  12862.           The machine's byte order: 0 = Big Endian, 1 = Little Endian.
  12863.           
  12864.    \v(cmdbufsize)
  12865.           The length of the command buffer, which is the maximum size for
  12866.           a macro, a command, a variable, or anything else in C-Kermit's
  12867.           script language.
  12868.           
  12869.    \v(ctty)
  12870.           The device name of C-Kermit's controlling (login) terminal.
  12871.           
  12872.    \v(filename)
  12873.           Described in [555]Sections 4.1 and [556]4.2.
  12874.           
  12875.    \v(filenumber)
  12876.           Described in [557]Sections 4.1 and [558]4.2.
  12877.           
  12878.    \v(filespec)
  12879.           As of C-Kermit 7.0, contains fully qualified filenames rather
  12880.           than (usually) relative ones.
  12881.           
  12882.    \v(return)
  12883.           Now holds the END n value of the macro that most recently
  12884.           returned, in case END was used rather than RETURN.
  12885.           
  12886.    \v(editor)
  12887.           Pathname of preferred text editor
  12888.           
  12889.    \v(editopts)
  12890.           Command-line options for editor
  12891.           
  12892.    \v(editfile)
  12893.           File most recently edited
  12894.           
  12895.    \v(browser)
  12896.           Pathname of preferred Web browser
  12897.           
  12898.    \v(browsopts)
  12899.           Command-line options for Web browser
  12900.           
  12901.    \v(browsurl)
  12902.           URL most recently given to Web browser
  12903.           
  12904.    \v(dialtype)
  12905.           Type of call most recently placed (see [559]Section 2.1.11).
  12906.           
  12907.    \v(kbchar)
  12908.           The character, if any, that was typed at the keyboard to to
  12909.           interrupt the most recent PAUSE, SLEEP, WAIT, MSLEEP, or INPUT
  12910.           command; empty if the most recent such command was not
  12911.           interrupted from the keyboard.
  12912.           
  12913.    \v(lockdir)
  12914.           UNIX only - The name of the UUCP lockfile directory, if known,
  12915.           otherwise "(unknown)".
  12916.           
  12917.    \v(lockpid)
  12918.           UNIX only - PID of process that owns the communication port
  12919.           that you tried to open with a SET LINE command that failed
  12920.           because the port was in use, otherwise empty. This variable is
  12921.           set with every SET LINE command.
  12922.           
  12923.    \v(cx_time)
  12924.           If no connection (SET HOST, SET LINE, DIAL, TELNET, etc) is
  12925.           active, this is 0. If a connection is active, this is the
  12926.           number of seconds since the connection was made.
  12927.           
  12928.    \v(hwparity)
  12929.           If hardware parity is in effect, this variable gives its value,
  12930.           such as "even" or "odd" (in which case, the \v(parity) variable
  12931.           will be "none"). Otherwise this variable is empty.
  12932.           
  12933.    \v(serial)
  12934.           Current serial port settings in 8N1 format ([560]Section 2.10).
  12935.           
  12936.    \v(errno)
  12937.           In UNIX, the current value of the C runtime errno variable,
  12938.           which is quite volatile (meaning that often an "interesting"
  12939.           error code can be overwritten by some other library call or
  12940.           system service that sets errno before you have a chance to look
  12941.           at it). In VMS, the error code returned by the system or
  12942.           library call that most recently failed (success codes are not
  12943.           saved). Not available in other operating systems.
  12944.           
  12945.    \v(errstring)
  12946.           The UNIX or VMS system error message that corresponds to
  12947.           \v(errno). Not available in all OS's. Also see
  12948.           [561]\ferrstring().
  12949.           
  12950.    \v(setlinemsg)
  12951.           The error message, if any, from the most recent SET LINE, SET
  12952.           PORT, SET HOST, TELNET, or other connection-making command.
  12953.           This is not necessarily the same as \v(errstring) since these
  12954.           commands might fail without generating a system error code, for
  12955.           example (in UNIX) because a lockfile existed indicating the
  12956.           device was assigned by another user.
  12957.           
  12958.    \v(exitstatus)
  12959.           The exit status C-Kermit would return if it exited now.
  12960.           
  12961.    \v(pexitstat)
  12962.           The exit status of the inferior process most recently invoked
  12963.           by C-Kermit (by RUN, !, REDIRECT, SEND /COMMAND, etc). In VMS,
  12964.           this code can be given to \ferrstring() to get the
  12965.           corresponding error message (in UNIX, program/command return
  12966.           codes are not the same as system error codes). Not available in
  12967.           operating systems other than UNIX and VMS. See [562]Section
  12968.           4.2.5 for details.
  12969.           
  12970.    \v(inmatch)
  12971.           The incoming string of characters, if any, that matched the
  12972.           most recent INPUT, REINPUT, or MINPUT command.
  12973.           
  12974.    \v(intime)
  12975.           The number of milliseconds (thousandths of seconds) it took for
  12976.           the most recent INPUT command to find its match, or -1 if no
  12977.           INPUT command has been given yet. If the INPUT command timed
  12978.           out, the value is approximately equal to 1000 times the INPUT
  12979.           timeout. If INPUT failed for some other reason, the value is
  12980.           undefined (\v(instatus) gives INPUT completion status). If your
  12981.           version of C-Kermit is built without high-precision
  12982.           floating-point timers, this number will always be a multiple of
  12983.           1000.
  12984.           
  12985.    \v(inwait)
  12986.           The number of seconds specified as the timeout in the most
  12987.           recent INPUT command.
  12988.           
  12989.    \v(dialsuffix)
  12990.           Dialing suffix for use during PDIAL sequence; see [563]Section
  12991.           2.1.10.
  12992.           
  12993.    \v(pid)
  12994.           UNIX, VMS, and K95 only. C-Kermit's primary process ID,
  12995.           numeric, decimal. If you want to show it in hex, use
  12996.           \fn2hex(\v(pid)) If you want to show it in octal, use
  12997.           \fn2octal(\v(pid)).
  12998.           
  12999.    \v(printer)
  13000.           Current printer name or SET PRINTER value.
  13001.           
  13002.    \v(p_ctl)
  13003.           Control prefix char \v(p_8bit) 8-bit prefix char (if parity not
  13004.           none)
  13005.           
  13006.    \v(p_rpt)
  13007.           Repeat prefix char (if repeat compression enabled)
  13008.           
  13009.    \v(herald)
  13010.           Kermit's version herald
  13011.           
  13012.    \v(test)
  13013.           Kermit's test version, if any, or 0 if this is not a test
  13014.           version. Typical values for test versions are "Alpha.03" or
  13015.           "Beta.14".
  13016.           
  13017.    \v(sendlist)
  13018.           The number of entries in the SEND-LIST, 0 if none. Note:
  13019.           entries do not necessarily correspond to files, since an entry
  13020.           might contain wildcards. Also note that the value does not go
  13021.           back to 0 after the files in the list are sent. To reset this
  13022.           variable, use CLEAR SEND-LIST. The purpose of this variable is
  13023.           to determine if a SEND command, when given without any
  13024.           filenames, will be legal. Example:
  13025.           
  13026.   xif \v(sendlist) { send } else { send oofa.txt }
  13027.  
  13028.    \v(trigger)
  13029.           If the most recent CONNECT session was terminated automatically
  13030.           by a trigger, this variable contains the trigger value.
  13031.           
  13032.    \v(ty_ln)
  13033.           TYPE line number (during TYPE)
  13034.           
  13035.    \v(ty_lc)
  13036.           TYPE line count (after TYPE)
  13037.           
  13038.    \v(ty_mc)
  13039.           TYPE match count (after TYPE)
  13040.           
  13041.    \v(xferstat)
  13042.           Status of most recent file transfer:
  13043.           
  13044. -1: No transfer yet
  13045.  0: Succeeded
  13046.  1: Failed
  13047.  
  13048.    \v(xfermsg)
  13049.           If the most recent file transfer failed, this is the reason. If
  13050.           it succeeded, \v(xfermsg) is an empty string.
  13051.           
  13052.    \v(tftime)
  13053.           Total elapsed time of most recent file transfer operation, in
  13054.           seconds.
  13055.           
  13056.    \v(textdir)
  13057.           Directory that holds (or is supposed to hold) Kermit text files
  13058.           such as installation instructions, release notes, update notes,
  13059.           read-me files, "beware" files, etc.
  13060.           
  13061.    \v(name)
  13062.           The name with which the Kermit program was invoked, e.g.
  13063.           "kermit", "wermit", "k95", "k2", etc (see [564]Section 9.1).
  13064.           
  13065.    \v(osname)
  13066.           Name of operating system on computer where C-Kermit is running,
  13067.           obtained at runtime (from uname or equivalent).
  13068.           
  13069.    \v(osversion)
  13070.           Version of operating system on computer where C-Kermit is
  13071.           running, obtained at runtime (from uname or equivalent).
  13072.           
  13073.    \v(osrelease)
  13074.           Release of operating system on computer where C-Kermit is
  13075.           running, obtained at runtime (from uname or equivalent).
  13076.           
  13077.    \v(model)
  13078.           The specific hardware model of the computer where C-Kermit is
  13079.           running, if known.
  13080.           
  13081.    \v(math_pi)
  13082.           The value of Pi (see [565]Section 7.23)
  13083.           
  13084.    \v(math_e)
  13085.           The value of e (see [566]Section 7.23)
  13086.           
  13087.    \v(math_precision)
  13088.           How many significant digits in a floating-point number.
  13089.           
  13090.    \v(f_count)
  13091.           Result of the most recent FILE COUNT (FCOUNT) command.
  13092.           
  13093.    \v(f_error)
  13094.           Numeric error code of most recent FILE command.
  13095.           
  13096.    \v(f_max)
  13097.           Maximum number of files open simultaneously.
  13098.           
  13099.    The math constants are given in the precision of underlying computer's
  13100.    floating-point arithmetic.
  13101.    
  13102.    Note the distinction between \v(osname), \v(osversion), and
  13103.    \v(platform); the latter refers to the platform for which and/or upon
  13104.    which C-Kermit was built, as opposed to the one on which it is
  13105.    actually running. Also note that each operating system can, and
  13106.    probably will, interpret and fill in the os* variables differently, or
  13107.    not at all.
  13108.    
  13109.    The SHOW VARIABLES command now accepts a variable name, prefix, or
  13110.    pattern:
  13111.    
  13112.   show variables         Shows all variables.
  13113.   show variables t       Shows all variables that start with "t".
  13114.   show variables *ver*   Shows all variables whose names contain "ver".
  13115.   show variables *ver    Ditto (an implied "*" is appended).
  13116.      _________________________________________________________________
  13117.    
  13118.   7.3. New or Improved Built-In Functions
  13119.   
  13120.    The following new file-i/o functions are explained in [567]Section
  13121.    1.22.
  13122.    
  13123.   \f_status(channel)           Status of file open on channel
  13124.   \f_pos(channel)              Read/write (byte) pointer of given file
  13125.   \f_line(channel)             Current line of file
  13126.   \f_handle(channel)           Handle of file
  13127.   \f_eof(channel)              Whether given file is at EOF
  13128.   \f_getchar(channel)          Read a char from given file
  13129.   \f_getline(channel)          Read a line from given file
  13130.   \f_getblock(channel,n)       Read a block from given file
  13131.   \f_putchar(channel,c)        Write a char to given file
  13132.   \f_putline(channel,string)   Write a line to given file
  13133.   \f_putblock(channel,string)  Write a block to given file
  13134.  
  13135.    The following new date-time-related functions are explained in
  13136.    [568]Section 1.6:
  13137.    
  13138.   \fday()                Returns day of week of given date
  13139.   \fnday()               Returns numeric day of week of given date
  13140.   \ftime()               Returns time portion of given date-time
  13141.   \fntime()              Converts time to seconds since midnight
  13142.   \fn2time()             Converts seconds since midnight to hh:mm:ss
  13143.   \fcvtdate(date-time)   Converts free-format date to yyyymmdd hh:mm:ss
  13144.   \fdayofyear(date-time) Converts date to yyyyddd (day-of-year) format
  13145.   \fdoy(date-time)       Synonym for \fdayofyear()
  13146.   \fdoy2date(dayofyear)  Converts yyyyddd to yyyymmdd
  13147.   \fmjd(date-time)       Converts free-format date to Modified Julian Date
  13148.   \fmjd2date(mjd)        Converts modified Julian date to yyyymmdd
  13149.  
  13150.    The new floating-point arithmetic functions are explained in
  13151.    [569]Section 7.23. f1 and f2 are floating-point (real) numbers; d is
  13152.    the number of decimal places to show:
  13153.    
  13154.   \ffpabsolute(f1,d)     Absolute value of f1
  13155.   \ffpadd(f1,f2,d)       f1 + f1
  13156.   \ffpcosine(f1,d)       Cosine of f1
  13157.   \ffpdivide(f1,f2,d)    f1 divided by f2
  13158.   \ffpexp(f1,d)          e to the f1 power
  13159.   \ffpint(f1)            Integer part of f1
  13160.   \ffplog10(f1,d)        Log base 10 of f1
  13161.   \ffplogn(f1,d)         Natural log of f1
  13162.   \ffpmaximum(f1,f2,d)   Maximum of f1 and f2
  13163.   \ffpminimum(f1,f2,d)   Minimum of f1 and f2
  13164.   \ffpmodulus(f1,f2,d)   Modulus of f1 and f2
  13165.   \ffpmultiply(f1,f2,d)  Product of f1 and f2
  13166.   \ffpraise(f1,f2,d)     Raise f1 to power f2
  13167.   \ffpround(f1,d)        Round f1 to d places
  13168.   \ffpsine(f1,d)         Sine of f1
  13169.   \ffpsqrt(f1,d)         Square root of f1
  13170.   \ffpsubtract(f1,f2,d)  f2 - f1
  13171.   \ffptangent(f1,d)      Tangent of f1
  13172.  
  13173.    Integer number functions:
  13174.    
  13175.    \fabsolute(n)
  13176.           Absolute value of integer n.
  13177.           
  13178.    \frandom(n)
  13179.           Returns a random integer between 0 and n-1.
  13180.           
  13181.    \fradix(s,n1,n2)
  13182.           If the string s is an integer in radix n1, the result is the
  13183.           same number expressed in radix n2, where n1 and n2 may be any
  13184.           number from 2 through 36, expressed as decimal numbers, or
  13185.           variables (etc) that evaluate to decimal numbers. For the
  13186.           source and result, the digits of any radix, r, are the first r
  13187.           characters in the sequence 0-9,a-z (case doesn't matter for the
  13188.           letters). The string s may have a sign, + or -; if it starts
  13189.           with a minus (-) sign, the result also has a minus sign.
  13190.           
  13191.    The \fradix() function does not work with floating-point numbers. It
  13192.    does not reveal the internal storage format of a number; for example,
  13193.    \fradix(-1,10,16) is -1, not something like FFFFFFFFFF. If all three
  13194.    arguments are not given, or if n1 or n2 are not numbers between 2 and
  13195.    36 inclusive, or s is not a number in radix n1, an error occurs and
  13196.    the empty string is returned. \fradix() also does not offer
  13197.    extended-precision arithmetic; number values are limited to those
  13198.    expressed as a long integer in the architecture of the underlying
  13199.    computer, usually 32 or 64 bits. If you give it an argument whose
  13200.    absolute value is larger than can be held in an unsigned long, the
  13201.    result is -1.
  13202.    
  13203.    The next four are shorthand functions for decimal/hexadecimal and
  13204.    decimal/octal number conversion:
  13205.    
  13206.    \fn2hex(n)
  13207.           Returns the hexadecimal (base 16) representation of the integer
  13208.           n. This is different from \fhexify(s), which treats its
  13209.           argument as a string rather than a number. The result is always
  13210.           left-padded with 0's to make its length even. Examples:
  13211.           
  13212.   \n2hex(0)   = "00"                    \fhexify(0)   = "30"
  13213.   \n2hex(255) = "ff"                    \fhexify(255) = "323535"
  13214.   \n2hex(256) = "0100"                  \fhexify(256) = "323536"
  13215.  
  13216.    \fhex2n(x)
  13217.           Converts hexadecimal number x to decimal equivalent decimal
  13218.           number. This is the inverse of \fn2hex(). Equivalent to
  13219.           \fradix(s,16,10).
  13220.           
  13221.    \fn2octal(n)
  13222.           Returns the octal (base 8) representation of the number n.
  13223.           Examples:
  13224.           
  13225.  
  13226.   \n2octal(0) = "0"
  13227.   \n2oct(255) = "377"
  13228.   \n2oct(256) = "400"
  13229.   Equivalent to \fradix(n,10,8).
  13230.  
  13231.    \foct2n(n)
  13232.           Returns the decimal representation of the given octal number,
  13233.           n. The inverse of \fn2octal(). Equivalent to \fradix(n,8,10).
  13234.           
  13235.    String functions:
  13236.    
  13237.    \s(name[n:m])
  13238.           Equivalent to \fsubstring(\m(name),n,m) ([570]Section 7.24).
  13239.           
  13240.    \:(name[n:m])
  13241.           Equivalent to \fsubstring(name,n,m) (where "name" is any
  13242.           \-quantity) ([571]Section 7.24).
  13243.           
  13244.    \fleft(s,n)
  13245.           The leftmost ncharacters of string s; equivalent to
  13246.           \fsubstring(s,1,n).
  13247.           
  13248.    \fstripx(string,char)
  13249.           Returns the part of the string up to the rightmost occurrence,
  13250.           if any, of the given character. The default character is period
  13251.           (.) Examples:
  13252.           
  13253.  
  13254.   \fstripx(foo/bar,/)                 = "foo"
  13255.   \fstripx(foo/bar/baz,/)             = "foo/bar"
  13256.   \fstripx(autoexec.bat,.)            = "autoexec"
  13257.   \fstripx(autoexec.bat)              = "autoexec"
  13258.   \fstripx(fstripx(foo/bar/baz,/),/)  = "foo"
  13259.  
  13260.    \flop(string,character)
  13261.           Returns the portion of the string starting after the first
  13262.           occurrence of the given character. The default character is
  13263.           period (.) Examples:
  13264.           
  13265.  
  13266.   \flop(autoexec.bat)                 = "bat"
  13267.   \flop(baz.foo/bar)                  = "foo/bar"
  13268.   \flop(baz.foo/bar,/)                = "bar
  13269.  
  13270.    \fstripn(string,n)
  13271.           Returns the string with ncharacters removed from the end.
  13272.           Example:
  13273.           
  13274.  
  13275.   \fstripn(12345678,3)                = "12345"
  13276.  
  13277.           (For more discussion of \fstripx(), \fstripn(), and \flop() see
  13278.           [572]Section 4.2.3).
  13279.           
  13280.    \fb64encode(s)
  13281.           Returns the Base-64 encoding of the string s.
  13282.           
  13283.    \fb64decode(s)
  13284.           Returns the decoding of the Base-64 string s. Fails if s is not
  13285.           a Base-64 string, or if its length is not a multiple of 4. Note
  13286.           that if any of the result bytes are null (0), the result string
  13287.           stops there. There is no way to represent strings that contain
  13288.           null bytes in C-Kermit (the same is true for \funhexify()).
  13289.           
  13290.    \fword(s1,n,s2,s3)
  13291.           Extracts word number nfrom string s1. By default, a "word" is
  13292.           any sequence of ASCII letters or digits; nis 1-based. If nis
  13293.           omitted, "1" is used. Examples:
  13294.           
  13295.   \fword(one two three)    = "one"
  13296.   \fword(one two three,1)  = "one"
  13297.   \fword(one two three,2)  = "two"
  13298.   \fword(one two three,3)  = "three"
  13299.  
  13300.           and:
  13301.           
  13302.     \fword(\v(dialresult),2) = "31200"
  13303.  
  13304.           is "31200" if \v(dialresult) is (e.g.) "CONNECT
  13305.           31200/ARQ/V32/LAPM/V42BIS".
  13306.           
  13307.           If you include s2, this replaces the default break set. For
  13308.           example, suppose you have a string \%a whose value is:
  13309.           
  13310.   $150.00 $300.00 $39.95
  13311.  
  13312.           and you want each dollar amount to be a word; use:
  13313.           
  13314.   \fword(\%a,\%n,{ })
  13315.  
  13316.           This returns dollar amount number \%n, e.g. "$300.00" for \%n =
  13317.           2. "{ }" denotes a space (you must enclose it in braces,
  13318.           otherwise it is squeezed out). Note that ASCII control
  13319.           characters are always included in the break set; you don't have
  13320.           to specify them (and you can't not specify them).
  13321.           
  13322.           The optional s3 argument lists characters (even control
  13323.           characters) that normally would be considered separators that
  13324.           you want included in words. So the dollars-and-cents example
  13325.           could also be handled this way:
  13326.           
  13327.   \fword(\%a,\%n,,$.)
  13328.  
  13329.           in other words, use the default separator list, but remove "$"
  13330.           and "." from it so they will be considered part of a word.
  13331.           
  13332.    \fsplit(s1,&a,s2,s3)
  13333.           This is like \fword(), except instead of extracting and
  13334.           returning a particular word from string s1, it counts the words
  13335.           and optionally assigns them to the array whose identifying
  13336.           letter, a-z, is given after the "&" in the second argument,
  13337.           with the first word going into element 1, the second into
  13338.           element 2, and so on. The rules regarding break and include
  13339.           lists (s2 and s3) are exactly the same as for \fword().
  13340.           \fsplit() returns the number of words that were assigned, which
  13341.           is either the number of words in the string, or the dimension
  13342.           of the array, whichever is less. If the array is not declared,
  13343.           \fsplit() creates it and returns a number which is both the
  13344.           number of words in s1 and the dimension of the new array.
  13345.           Examples:
  13346.           
  13347.   declare \&w[20]        ; (Optional.)
  13348.   ...
  13349.   read \%s               ; \%s is "This is a sentence with seven words."
  13350.   ...
  13351.   echo "\fsplit(\%s)"    ; This would print "7".
  13352.   echo "\fsplit(\%s,&w)" ; Ditto, and also assigns them to array \&w[].
  13353.  
  13354.   echo "\&w[7]"          ; This would print "words".
  13355.  
  13356.           If the line contained fields that were delimited by colon (:),
  13357.           you would use \fsplit(\%s,&w,:). If the fields were delimited
  13358.           by comma, then you would use \fsplit(\%s,&w,{,}); in this case
  13359.           the literal comma must be enclosed in braces to distinguish it
  13360.           from the comma that separates function arguments. To get a word
  13361.           count without loading an array, but still specify break and/or
  13362.           include lists, leave the array argument empty:
  13363.           
  13364.    echo "\fsplit(\%s,,:)" ; Use colon as the separator.
  13365.  
  13366.           WARNINGS:
  13367.           
  13368.          1. If you use the same array repeatedly, \fsplit() leaves any
  13369.             trailing members undisturbed. For example:
  13370.  
  13371.   dcl \&w[10]
  13372.   \fsplit(1 2 3 4 5,&w) ; Sets \&w[1] thru \&w[5].
  13373.   \fsplit(a b c,&w)     ; Sets \&w[1]-[3] leaving [4]-[5] as they were.
  13374.          2. If you allow \fsplit to create the array (by not declaring it
  13375.             first), it is dimensioned to the number of elements it was
  13376.             created with:
  13377.  
  13378.   \fsplit(1 2 3,&x)     ; Creates an array \&x[] with 3 elements.
  13379.   \fsplit(a b c d e,&x) ; This overflows the array.
  13380.  
  13381.           Thus if you want to use \fsplit() repeatedly on the same array,
  13382.           either dimension it in advance to the maximum expected size
  13383.           (and then some -- more efficient), or else destroy it after
  13384.           each use (to allow for unexpectedly large arguments). Example
  13385.           using a dynamic array:
  13386.           
  13387.   fopen /read \%c some-file
  13388.   if fail ...
  13389.   set function error on    ; See [573]Section 7.12
  13390.   while true {
  13391.       dcl \&w[]            ; Destroy \&[w] each time thru the loop
  13392.       fread /line \%c \%a
  13393.       if fail break
  13394.       asg \%x \fsplit(\%a,&w)
  13395.       if fail ...
  13396.       ; (do what you want with \&w[] here...)
  13397.   }
  13398.   fclose \%c
  13399.  
  13400.    \frindex(s1,s2,n)
  13401.           The "n" argument to \frindex() now works consistently (in
  13402.           mirror image) with the corresponding \findex() argument. In
  13403.           each case, the (n-1)-most characters of s2 are ignored in the
  13404.           search; for findex, this means the starting position of the
  13405.           search is n (the default nis 1, and 0 is treated like 1). For
  13406.           \frindex() it means the default starting point is:
  13407.           
  13408.   length(s2) - length(s1) - n (with the same defaults for n).
  13409.  
  13410.    \fsearch(pattern,string[,position])
  13411.           Exactly like \findex(), except with a pattern (see [574]Section
  13412.           7.9) rather than a literal string.
  13413.           
  13414.    \frsearch(pattern,string[,position])
  13415.           Exactly like \frindex(), except with a pattern rather than a
  13416.           literal string.
  13417.           
  13418.           File Functions:
  13419.           
  13420.    \ffiles(), \fnextfile()
  13421.           It is no longer necessary to copy the file list to an array
  13422.           before use, as shown on p.398 of [575]Using C-Kermit 2nd
  13423.           Edition. \ffiles() and friends now make their own safe copies
  13424.           of the file list. Thus constructions like the following are now
  13425.           possible:
  13426.           
  13427.   for \%i 1 \ffiles(*.txt) 1 { send \fnextfile() }
  13428.  
  13429.           The same is true for the new function \frfiles(),
  13430.           \fdirectories(), and \frdirectories(), described in
  13431.           [576]Section 4.11.3.
  13432.           
  13433.           But note that each reference to \fnextfile() still gets you the
  13434.           next file. So "if newer \fnextfile() foo.txt send \fnextfile()"
  13435.           compares one file's age with that of foo.txt, and then sends an
  13436.           entirely different file. If you're going to refer to the same
  13437.           file more than once, assign it to a variable:
  13438.           
  13439.   asg \%f \fnextfile()
  13440.   if newer \%f foo.txt send \%f
  13441.  
  13442.           (note: assign, not define).
  13443.           
  13444.           Also note that \ffiles(), \frfiles(), \fdirectories(), and
  13445.           \frdirectories() all now accept on optional 2nd argument: the
  13446.           name of an array to load with the resulting file or directory
  13447.           list, explained in [577]Section 4.11.3. So you can also load an
  13448.           array with the filelist when you need to refer to the same file
  13449.           more than once:
  13450.           
  13451.   for \%i 1 \ffiles(*,&a) 1 { if newer \&a[\%i] foo.txt send \&a[\%i] }
  13452.  
  13453.    \fpermissions(file)
  13454.           Returns the platform-specific permissions string for the file,
  13455.           such as "-rw-rw-r--" in UNIX or "(RWE,RWE,RE,E)" in VMS.
  13456.           
  13457.    \fdirname(f)
  13458.           Given a file specification f, this function returns the
  13459.           complete pathname of directory the file is in.
  13460.           
  13461.    Array Functions:
  13462.    
  13463.    \fdimension(&a)
  13464.           Returns the dimension declared for the array whose identifying
  13465.           letter, a-z, or special character "_" or "@", is given after
  13466.           the "&" in the argument. If the array is not declared, 0 is
  13467.           returned. Note that when used with the macro argument vector
  13468.           array, \&_[] (see [578]Section 7.5), the value of this function
  13469.           is one less than \v(argc), and when used with the C-Kermit
  13470.           command-line argument vector array, \&@[], it is equal to the
  13471.           \v(args) variable. Examples:
  13472.           
  13473.   echo \fdimension(&a)       ; Not declared.
  13474.   0
  13475.   declare \&a[12]            ; Now it's declared.
  13476.   echo \fdim(&a)
  13477.   12
  13478.  
  13479.    \farraylook(pattern,arrayname)
  13480.           Looks in the given array for the pattern and returns the index
  13481.           of the first element that matches, if any, or -1 if none match.
  13482.           The arrayname can include a range specifier to restrict to
  13483.           search to a segment of the array, e.g.
  13484.           \farraylook(*xyz*,&a[32:63]). For greater detail see
  13485.           [579]Section 7.10.7.
  13486.           
  13487.    \ftablelook(keyword,arrayname[,delimiter])
  13488.           Looks in the given "table", which must be sorted, for the given
  13489.           keyword. Returns the index of the table element that uniquely
  13490.           matches the given keyword, or -1 if none match, or -2 if more
  13491.           than 1 match. For greater detail see [580]Section 7.10.7.
  13492.           
  13493.    Other new functions:
  13494.    
  13495.    \fip2hex(s)
  13496.           Converts a dotted decimal IP address to an 8-digit hexadecimal
  13497.           number. \fip2hex(128.59.39.2) = 803b2702.
  13498.           
  13499.    \fhex2ip(x)
  13500.           Converts an 8-digit hexadecimal IP address to dotted decimal
  13501.           form, e.g. \fhex2ip(803b2702) = 128.59.39.2. The inverse of
  13502.           \fip2hex().
  13503.           
  13504.    \fcommand()
  13505.           
  13506.    \frawcommand()
  13507.           These run an external command and return its output; see
  13508.           [581]Section 4.2.8.4.
  13509.           
  13510.    \fdialconvert(s)
  13511.           s is a phone number in either literal or portable format (not a
  13512.           dialing directory entry name). The function returns the dial
  13513.           string that would actually be used when dialing from the
  13514.           current location (after processing country code, area code, and
  13515.           other SET DIAL values).
  13516.           
  13517.    \ferrstring(n)
  13518.           Returns the system error message associated with the (numeric)
  13519.           error code n. UNIX and VMS only. Use in conjunction with
  13520.           \v(errno) or \v(pexitstat). See [582]Section 4.2.5 for a usage
  13521.           example. Note: This function doesn't work in Windows because
  13522.           there is not a consistent error-code-to-message mapping; error
  13523.           code "x" means something completely different depending on
  13524.           whether it comes from the C runtime library, Winsock, a
  13525.           Windows-32 API, TAPI, etc,
  13526.           
  13527.    \fpattern(s)
  13528.           Used in INPUT, REINPUT, and MINPUT commands to denote search
  13529.           strings that are to be treated as patterns rather than
  13530.           literally.
  13531.           
  13532.    Also see [583]Section 7.8 on built-in help for functions.
  13533.      _________________________________________________________________
  13534.    
  13535.   7.4. New IF Conditions
  13536.   
  13537.    IF AVAILABLE feature command
  13538.           Executes the command if the given feature is available.
  13539.           Presently used only to determine if specific authentication and
  13540.           encryption options are available. Type "if available ?" to see
  13541.           which features may be tested.
  13542.           
  13543.    IF FLOAT f1 command
  13544.           Executes command if f1 is a legal floating point number (which
  13545.           includes integers). Use this to preverify arguments for the
  13546.           \ffp...() floating-point arithmetic functions, e.g. "if float
  13547.           \%1 echo \ffpint(\%1)".
  13548.           
  13549.    IF == n1 n2 command
  13550.           Synonym for "if =" (numeric equality). Note that as of C-Kermit
  13551.           7.0, this and all other numeric comparison operators also work
  13552.           for floating-point numbers.
  13553.           
  13554.    IF != n1 n2 command
  13555.           Executes the command if n1 and n2 are both numbers or variables
  13556.           containing numbers and the value of n1 is not equal to the
  13557.           value of n2. This is equivalent to "if not = n1 n2".
  13558.           
  13559.    IF <= n1 n2 command
  13560.           Executes the command if n1 and n2 are both numbers or variables
  13561.           containing numbers and the value of n1 is less than or equal to
  13562.           the value of n2. This is equivalent to "if not > n1 n2".
  13563.           
  13564.    IF >= n1 n2 command
  13565.           Executes the command if n1 and n2 are both numbers or variables
  13566.           containing numbers and the value of n1 is greater than or equal
  13567.           to the value of n2. Equivalent to "if not < n1 n2".
  13568.           
  13569.    IF COMMAND word command
  13570.           Executes the command if word is a built-in C-Kermit command.
  13571.           Example:
  13572.           
  13573.   if not command copy define { copy run copy \%1 \%2 }".
  13574.  
  13575.           This defines a COPY macro that runs an external COPY command if
  13576.           COPY is not already a built-in command.
  13577.           
  13578.    IF LOCAL command
  13579.           Executes the command if Kermit is in local mode, i.e. if it has
  13580.           a SET LINE, SET PORT, or SET HOST (TELNET, RLOGIN, etc) device
  13581.           or connection open. Does not execute the command if in remote
  13582.           mode.
  13583.           
  13584.    IF MATCH string pattern command
  13585.           Executes the command if the string matches the pattern. For a
  13586.           description of the syntax for the pattern, see [584]Section
  13587.           4.9.1. If you want to test if the string contains pattern, use
  13588.           IF \fsearch(pattern,string).
  13589.           
  13590.    IF OPEN { DEBUG-LOG, SESSION-LOG, TRANSACTION-LOG, ... } command
  13591.           Executes the command if the given file is open, fails if it is
  13592.           not open. Type IF OPEN ? for a complete list of files that can
  13593.           be checked (all the files that can be opened with the OPEN or
  13594.           LOG commands).
  13595.           
  13596.    IF QUIET command
  13597.           Executes the command if SET QUIET is ON, and does not execute
  13598.           it if SET QUIET is OFF. Example: IF NOT QUIET ECHO { This is a
  13599.           message.}.
  13600.           
  13601.    IF READABLE name
  13602.           Succeeds if name is the name of an existing file or directory
  13603.           that is readable.
  13604.           
  13605.    IF WRITEABLE name
  13606.           Succeeds if name is the name of an existing file or directory
  13607.           that is writeable, e.g.:
  13608.           
  13609.  
  13610.   if not writeable \v(lockdir) echo Please read installation instructions!
  13611.  
  13612.    IF FLAG command
  13613.           This tests a user-settable condition, which can mean anything
  13614.           you like. SET FLAG ON causes subsequent IF FLAG commands to
  13615.           succeed; SET FLAG OFF causes them to fail. One way to use it
  13616.           would be for debugging your scripts; precede any debugging
  13617.           statements with IF FLAG. Then SET FLAG on to debug your script,
  13618.           SET FLAG OFF to run it without debugging. Another common use is
  13619.           for causing an inner loop to cause an outer loop to exit.
  13620.           
  13621.    IF C-KERMIT command
  13622.           C-Kermit, but not Kermit 95 or MS-DOS Kermit, executes the
  13623.           command.
  13624.           
  13625.    IF K-95 command
  13626.           Kermit 95, but not C-Kermit or MS-DOS Kermit, executes the
  13627.           command.
  13628.           
  13629.    IF MS-KERMIT command
  13630.           MS-DOS Kermit, but not C-Kermit or Kermit 95, executes the
  13631.           command.
  13632.      _________________________________________________________________
  13633.    
  13634.   7.5. Using More than Ten Macro Arguments
  13635.   
  13636.    The \v(argc) variable now gives the actual number of arguments, even
  13637.    if the number is greater than 9:
  13638.    
  13639.   C-Kermit> define xx echo \v(argc)
  13640.   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
  13641.   27
  13642.  
  13643.    Remember that \v(argc) includes the name of the macro itself, so it is
  13644.    always at least 1, and is always 1 greater than the actual number of
  13645.    arguments. As in versions 6.0 and earlier, if more than 9 arguments
  13646.    are given, only the first nine are assigned to the variables \%1..\%9.
  13647.    
  13648.    The \&_[] array, discussed on page 353 of [585]Using C-Kermit, 2nd ed,
  13649.    now holds all the arguments, up to some implementation-dependent limit
  13650.    (64 or greater), rather than only the first 9. To illustrate: the
  13651.    following macro tells the number of arguments it was called with and
  13652.    then prints them:
  13653.    
  13654.   define show_all_args {
  13655.       local \%i
  13656.       echo \&_[0] - Number of arguments: \feval(\v(argc)-1)
  13657.       for \%i 1 \v(argc)-1 1 { echo \flpad(\%i,3). "\&_[\%i]" }
  13658.   }
  13659.  
  13660.    Within a macro \&_[0], like \%0, contains the name of the macro.
  13661.    
  13662.    At top level, the \&_[] array is filled as follows:
  13663.    
  13664.      * If the first argument on the C-Kermit command line was a filename,
  13665.        or C-Kermit was invoked from a "Kerbang" script ([586]Section
  13666.        7.19), element 0 contains the filename, and elements 1 through
  13667.        \v(argc)-1 hold the remaining command-line arguments.
  13668.      * Otherwise the program name goes in element 0, and elements 1
  13669.        through \v(argc)-1 hold any arguments that were included after
  13670.        "--" or "="
  13671.        
  13672.    The new \%* variable, when used within a macro, is replaced by the
  13673.    text that followed the macro name in the macro invocation. If no
  13674.    arguments were given, \%* is replaced by the empty string. Examples:
  13675.    
  13676.   C-Kermit> define xx echo [\%*]
  13677.   C-Kermit> define \%a oofa
  13678.   C-Kermit> xx
  13679.   []
  13680.   C-Kermit> xx \%a
  13681.   [oofa]
  13682.   C-Kermit> xx a
  13683.   [a]
  13684.   C-Kermit> xx a b
  13685.   [a b]
  13686.   C-Kermit> xx a b c
  13687.   [a b c]
  13688.   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
  13689.   [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]
  13690.  
  13691.    Note that \%* can not be used at top level, since Kermit does not have
  13692.    access to the raw command line (only to its elements separately, after
  13693.    they have been processed by the shell and the C library).
  13694.    
  13695.    C-Kermit 7.0 also adds a SHIFT command:
  13696.    
  13697.    SHIFT [ number ]
  13698.           Shifts the macro arguments (except argument 0) the given number
  13699.           of places to the left and adjusts \v(argc) accordingly. The
  13700.           default number is 1.
  13701.           
  13702.    To illustrate, suppose macro XXX is invoked as follows:
  13703.    
  13704.   xxx arg1 arg2 arg3
  13705.  
  13706.    Then inside XXX, \%1 is "arg1", \%2 is "arg2", and \%3 is "arg3".
  13707.    After a SHIFT command is given inside XXX, then \%1 is "arg2", \%2 is
  13708.    "arg3", and \%3 is empty. \%0 (the name of the macro) remains
  13709.    unchanged.
  13710.    
  13711.    If more than 9 arguments were given, then arguments are shifted into
  13712.    the \%1..9 variables from the argument vector array.
  13713.    
  13714.    At top level, the SHIFT command operates on the \&_[] array and \%1..9
  13715.    variables; the \&@[] array is not affected. See [587]Section 7.16 for
  13716.    details.
  13717.    
  13718.    The \%* variable is not affected by the SHIFT command.
  13719.      _________________________________________________________________
  13720.    
  13721.   7.6. Clarification of Function Call Syntax
  13722.   
  13723.    Spaces are normally stripped from the front and back of each function
  13724.    argument; to prevent this enclose the argument in braces:
  13725.    
  13726.   \fsplit(\%a,&a,{ })
  13727.  
  13728.    However, function calls that contain spaces can make trouble when the
  13729.    function is to be used in a "word" field, since space separates words.
  13730.    For example:
  13731.    
  13732.   for \%i 1 \fsplit(\%a,&a,{ }) 1 {
  13733.     echo \%i. "\&a[\%i]"
  13734.   }
  13735.  
  13736.    In most cases, the trouble can be averted by enclosing the function
  13737.    reference in braces:
  13738.    
  13739.   for \%i 1 {\fsplit(\%a,&a,{ })} 1 {
  13740.     echo \%i. "\&a[\%i]"
  13741.   }
  13742.  
  13743.    or by replacing spaces with \32 (the ASCII code for space):
  13744.    
  13745.   for \%i 1 \fsplit(\%a,&a,\32) 1 {
  13746.     echo \%i. "\&a[\%i]"
  13747.   }
  13748.  
  13749.    Braces are also used in function calls to indicate grouping. For
  13750.    example:
  13751.    
  13752.   \fsubstring(abcd,2,2) = "bc"
  13753.  
  13754.    But suppose "abcd" needed to contain a comma:
  13755.    
  13756.   \fsubstring(ab,cd,2,2)
  13757.  
  13758.    This would cause an error, since "cd" appears to be the second
  13759.    argument, when really you want the first "2" to be the second
  13760.    argument. Braces to the rescue:
  13761.    
  13762.   \fsubstring({ab,cd},2,2) = "b,"
  13763.  
  13764.    Similarly, leading and trailing spaces are stripped from each
  13765.    argument, so:
  13766.    
  13767.   \fsubstring( abcd ,2,2) = "bc"
  13768.  
  13769.    but braces preserve them:
  13770.    
  13771.   \fsubstring({ abcd },2,2) = "ab"
  13772.  
  13773.    Given these special uses for braces, there is no way to pass literal
  13774.    braces to the function itself. For example:
  13775.    
  13776.   \fsubstring(ab{cd,2,2)
  13777.  
  13778.    causes an error.
  13779.    
  13780.    So if you need a function to include braces, define a variable
  13781.    containing the string that has braces. Example:
  13782.    
  13783.   define \%a ab{cd
  13784.   \fsubstring(\%a,2,2) = "b{"
  13785.  
  13786.    If the string is to start with a leading brace and end with a closing
  13787.    brace, then double braces must appear around the string (which itself
  13788.    is enclosed in braces):
  13789.    
  13790.   define \%a {{{foo}}}
  13791.   \fsubstring(\%a) = "{foo}"
  13792.  
  13793.    This also works for any other kind of string:
  13794.    
  13795.   define \%a {{ab{cd}}
  13796.   echo \fsubstring(\%a) = "ab{cd"
  13797.      _________________________________________________________________
  13798.    
  13799.   7.7. Autodownload during INPUT Command Execution
  13800.   
  13801.    As of 6.1 / 1.1.12, C-Kermit can be told to look for incoming Kermit
  13802.    (or Zmodem) packets during execution of an INPUT command. By default
  13803.    (for consistency with earlier releases), this is not done. You can
  13804.    enable this feature with:
  13805.    
  13806.   SET INPUT AUTODOWNLOAD ON
  13807.  
  13808.    (and disable it again with OFF.)
  13809.    
  13810.    One possible use for this feature is as a server mode with a time
  13811.    limit:
  13812.    
  13813.   INPUT 3600 secret-string-to-end-the-INPUT-command
  13814.  
  13815.    In this example, any GET, SEND, or REMOTE commands received within one
  13816.    hour (3600 seconds) of when the INPUT command was issued will be
  13817.    executed. Here's another example, in which we want to stay open until
  13818.    11:30pm, or until interrupted by seven consecutive Ctrl-C (\3)
  13819.    characters:
  13820.    
  13821.   INPUT 23:30:00 \3\3\3\3\3\3\3
  13822.  
  13823.    The INPUT AUTODOWNLOAD setting is displayed by SHOW SCRIPTS or SHOW
  13824.    INPUT.
  13825.      _________________________________________________________________
  13826.    
  13827.   7.8. Built-in Help for Functions.
  13828.   
  13829.    Beginning in C-Kermit 7.0, you may obtain a description of the calling
  13830.    conventions and return values of any built-in function, such as
  13831.    \fsubstring(), with the new HELP FUNCTION command; give the function's
  13832.    name without the leading "\f", e.g. "help func substring". You can use
  13833.    ?, completion, and abbreviation in the normal manner.
  13834.      _________________________________________________________________
  13835.    
  13836.   7.9. Variable Assignments
  13837.   
  13838.     7.9.1. Assignment Operators
  13839.     
  13840.    Programmers accustomed to languages such as C or Fortran might find
  13841.    Kermit's method of assigning values to variables unnatural or awkward.
  13842.    Beginning in C-Kermit 7.0, you can use the following alternative
  13843.    notation:
  13844.    
  13845.  .name = value    is equivalent to   DEFINE name value
  13846.  .name := value   is equivalent to   ASSIGN name value
  13847.  .name ::= value  is equivalent to   ASSIGN name \feval(value)
  13848.  
  13849.    When the command begins with a period (.), this indicates an
  13850.    assignment. The name can be a macro name, a \%{digit,letter} variable,
  13851.    or an array element. There can be space(s) between "." and the name.
  13852.    Examples:
  13853.    
  13854.   .\%a = This is a string  ; Same as "define \%a This is a string"
  13855.   echo \%a
  13856.   This is a string
  13857.  
  13858.   .xxx = \%a               ; Same as "define xxx \%a"
  13859.   echo \m(xxx)
  13860.   \%a
  13861.  
  13862.   .xxx := \%a              ; Same as "assign xxx \%a"
  13863.   echo \m(xxx)
  13864.   This is a string
  13865.  
  13866.   declare \&a[2]           ; Use with arrays...
  13867.   define \%i 2
  13868.   .\&a[1] = first
  13869.   .\&a[\%i] = second
  13870.  
  13871.    The following sequence illustrates the differences among three levels
  13872.    of evaluation:
  13873.    
  13874.   .\%x = 2          ; Define a variable to have a numeric value
  13875.   .\%y = (3 + \%x)  ; Define another variable as an arithmetic expression
  13876.  
  13877.   .xxx = 4 * \%y    ; "=" simply copies the right-hand side.
  13878.   echo \m(xxx)
  13879.   4 * \%y
  13880.  
  13881.   .xxx := 4 * \%y   ; ":=" evaluates the variables first, then copies.
  13882.   echo \m(xxx)
  13883.   4 * (3 + 2)
  13884.  
  13885.   .xxx ::= 4 * \%y  ; "::=" evaluates the expression, then copies.
  13886.   echo \m(xxx)
  13887.   20
  13888.  
  13889.    You can also use this syntax to clear (undefine) a variable:
  13890.    
  13891.   .\%a = oofa       ; Define the variable
  13892.   echo "\%a"
  13893.   "oofa"
  13894.   .\%a              ; Clear the variable
  13895.   echo "\%a"
  13896.   ""
  13897.  
  13898.    Extra credit: Can you guess what happens below when the file "abc"
  13899.    does not exist?
  13900.    
  13901.   fopen /read \%c abc
  13902.   if fail ...
  13903.      _________________________________________________________________
  13904.    
  13905.     7.9.2. New Assignment Commands
  13906.     
  13907.    Recall the DEFINE and ASSIGN commands, and their hidden counterparts,
  13908.    _DEFINE and _ASSIGN. The former take the variable name literally, the
  13909.    latter evaluate the variable-name field to form the variable name
  13910.    dynamically. Examples:
  13911.    
  13912.   DEFINE \%x foo    ; Sets the value of the variable \%x to "foo".
  13913.   DEFINE \%a \%x    ; Sets the value of the variable \%a to "\%x".
  13914.   _DEFINE x_\%a \%x ; Sets the value of the variable x_foo to "\%x".
  13915.   ASSIGN \%a \%x    ; Sets the value of the variable \%a to the "foo".
  13916.   _ASSIGN x_\%a \%x ; Sets the value of the variable x_foo to "foo".
  13917.  
  13918.    This concept has been carried over to the remaining
  13919.    variable-assignment commands: EVALUATE, INCREMENT, and DECREMENT:
  13920.    
  13921.    EVALUATE variablename expression
  13922.           Evaluates the arithmetic expression and assigns its value to
  13923.           the variable whose name is given. Example: "eval \%a 1+1"
  13924.           assigns "2" to \%a.
  13925.           
  13926.    _EVALUATE metaname expression
  13927.           Evaluates the arithmetic expression and assigns its value to
  13928.           the variable whose name is computed from the given metaname.
  13929.           Example: "eval foo<\%a>::\%1 \%2 * (\%3 + \%4)" assigns the
  13930.           value of "\%2 * (\%3 + \%4)" to the variable whose name is
  13931.           computed from "foo<\%a>::\%1".
  13932.           
  13933.    INCREMENT variablename [ expression ]
  13934.           Evaluates the arithmetic expression and adds its value to the
  13935.           value of the variable whose name is given. Example: "increment
  13936.           \%a".
  13937.           
  13938.    _INCREMENT metaname [ expression ]
  13939.           Evaluates the arithmetic expression and adds its value to the
  13940.           value of the variable whose name is computed from the given
  13941.           metaname. Example: "_increment Words::\%1.count[\%2]".
  13942.           
  13943.    DECREMENT variablename [ expression ]
  13944.           Evaluates the arithmetic expression and subtracts its value
  13945.           from the value of the variable whose name is given.
  13946.           
  13947.    _DECREMENT metaname [ expression ]
  13948.           Evaluates the arithmetic expression and subtracts its value
  13949.           from the value of the variable whose name is computed from the
  13950.           given metaname.
  13951.           
  13952.    WARNING: The syntax of the EVALUATE command has changed since C-Kermit
  13953.    6.0 and K95 1.1.17. Previously, it did not include a variable name,
  13954.    only an expression. To restore the old behavior, use SET EVALUATE OLD.
  13955.    To return to the new behavior after restoring the old behavior, use
  13956.    SET EVALUATE NEW.
  13957.    
  13958.    NOTE: There are no analogs to the "_" commands for the operators
  13959.    described in [588]Section 7.9.1; those operators can not be used to
  13960.    assign values to variables whose names must be computed.
  13961.      _________________________________________________________________
  13962.    
  13963.   7.10. Arrays
  13964.   
  13965.    C-Kermit 7.0 adds lots of new array-related features, and groups them
  13966.    together under the NEW ARRAY command:
  13967.    
  13968.    ARRAY { CLEAR, COPY, DECLARE, DESTROY, RESIZE, SHOW, SORT }
  13969.    
  13970.    In each of the ARRAY commands, wherever an array name is expected,
  13971.    "short forms" may be used. For example, all of the following are
  13972.    acceptable:
  13973.    
  13974.   array show \&a[]  (or SHOW ARRAY...)
  13975.   array show &a[]
  13976.   array show a[]
  13977.   array show &a
  13978.   array show a
  13979.  
  13980.    In addition, ranges are accepted in the ARRAY COPY, ARRAY CLEAR, ARRAY
  13981.    SET, ARRAY SHOW, and ARRAY SORT commands:
  13982.    
  13983.   array clear \&a[16]     ; Clears 16 thru end
  13984.   array clear &a[16]      ; Ditto
  13985.   array clear a[16]       ; Ditto
  13986.  
  13987.   array clear \&a[16:32]  ; Clears 16 thru 32
  13988.   array clear &a[16:32]   ; Ditto
  13989.   array clear a[16:32]    ; Ditto
  13990.  
  13991.    When using array names as function arguments, you must omit the "\"
  13992.    and you must include the "&". You may optionally include empty
  13993.    brackets. Examples:
  13994.    
  13995.   \fsplit(\%a,a)          ; Bad
  13996.   \fsplit(\%a,\&a)        ; Bad
  13997.   \fsplit(\%a,&a[3])      ; Bad
  13998.  
  13999.   \fsplit(\%a,&a)         ; Good
  14000.   \fsplit(\%a,&a[])       ; Good
  14001.      _________________________________________________________________
  14002.    
  14003.     7.10.1. Array Initializers
  14004.     
  14005.    Beginning in C-Kermit 7.0, you may initialize an array -- in whole or
  14006.    in part -- in its declaration:
  14007.    
  14008.    [ ARRAY ] DECLARE array-name[size] [ = ] [ value1 [ value2 [...] ] ]
  14009.    
  14010.    For compatibility with versions 5A and 6.0, the ARRAY keyword is
  14011.    optional. DECLARE can also be spelled DCL.
  14012.    
  14013.    Initializers are (a) optional, (b) start with element 1, (c) must be
  14014.    enclosed in braces if they contain spaces, and (d) are evaluated
  14015.    according to normal rules by the DECLARE command prior to assignment.
  14016.    Thus the assignments made here are the same as those made by the
  14017.    ASSIGN command. This allows you to initialize array elements from the
  14018.    values of other variables. If you actually want to initialize an array
  14019.    element to variable's name, as opposed to its value, use double
  14020.    backslashes (as in "\\&a", "\\v(time)", etc).
  14021.    
  14022.    The size (dimension) of the array is optional. If the size is omitted,
  14023.    as in "\&a[]", then the array sizes itself to the number of
  14024.    initializers; if there are no initializers the array is not declared
  14025.    or, if it was declared previously, it is destroyed. If a size is
  14026.    given, any extra elements in the initialization list are discarded and
  14027.    ignored.
  14028.    
  14029.    NOTE: Unlike in C, the list of initializers is NOT enclosed in braces.
  14030.    Instead, braces are used to group multiple words together. So:
  14031.    
  14032.   ARRAY DECLARE \&a[] = { one two three }
  14033.  
  14034.    would create an array with two elements (0 and 1), with element 1
  14035.    having the value " one two three ".
  14036.    
  14037.    Examples:
  14038.    
  14039.    ARRAY DECLARE \&a[16]
  14040.           Declares the array \&a with 17 elements (0 through 16), in
  14041.           which all elements are initially empty. If the array \&a[]
  14042.           existed before, the earlier copy is destroyed.
  14043.           
  14044.    ARRAY DECLARE &a[16]
  14045.           
  14046.    ARRAY DECLARE a[16]
  14047.           
  14048.    ARRAY DCL \&a[16]
  14049.           
  14050.    ARRAY DCL &a[16]
  14051.           
  14052.    ARRAY DCL a[16]
  14053.           
  14054.    DECLARE \&a[16]
  14055.           
  14056.    DECLARE &a[16]
  14057.           
  14058.    DECLARE a[16]
  14059.           
  14060.    DCL \&a[16]
  14061.           
  14062.    DCL &a[16]
  14063.           
  14064.    DCL a[16]
  14065.           All of the above are the same as the first example.
  14066.           
  14067.    ARRAY DECLARE \&a[16] = alpha beta {gamma delta}
  14068.           Declares the array \&a with 17 elements (0 through 16),
  14069.           initializing \&a[1] to "alpha", \&a[2] to "beta", and \&a[3] to
  14070.           "gamma delta". The remaining elements are empty.
  14071.           
  14072.    ARRAY DECLARE \&a[] = alpha beta {gamma delta}
  14073.           Same as the previous example, but the array is automatically
  14074.           dimensioned to 3.
  14075.           
  14076.    ARRAY DECLARE \&a[3] = alpha beta {gamma delta} epsilon zeta
  14077.           Too many initializers; only the first three are kept.
  14078.           
  14079.    ARRAY DECLARE \&a[0]
  14080.           
  14081.    ARRAY DECLARE \&a[]
  14082.           
  14083.    ARRAY DECLARE &a[]
  14084.           
  14085.    ARRAY DECLARE &a
  14086.           
  14087.    ARRAY DECLARE a
  14088.           
  14089.    DECLARE \&[0]
  14090.           
  14091.    DECLARE a
  14092.           
  14093.    DCL a
  14094.           All of these are equivalent. Each destroys \&a[] if it exists.
  14095.           Declaring an array with a dimension of 0 is the same as ARRAY
  14096.           DESTROY arrayname.
  14097.           
  14098.    ARRAY DECLARE \&a[] = \%1 \%2 \%3
  14099.           Declares the array \&a with 3 elements (0 through 3),
  14100.           initializing \&a[1] to the value of \%1, \&a[2] to the value of
  14101.           \%2, and \&a[3] to the value of \%3. In this case, any
  14102.           reference to one of these array elements is replaced by the
  14103.           value of the corresponding \%n variable at the time the
  14104.           declaration was executed (immediate evaluation; the array
  14105.           element's value does not change if the initializer variable's
  14106.           value changes).
  14107.           
  14108.    ARRAY DECLARE \&a[] = \\%1 \\%2 \\%3
  14109.           Declares the array \&a with 3 elements (0 through 3),
  14110.           initializing \&a[1] to the string "\%1", \&a[2] to "\%2", and
  14111.           \&a[3] to "\%3". In this case any reference to one of these
  14112.           array elements is replaced by the CURRENT value of the
  14113.           corresponding \%n variable (deferred evaluation -- the array
  14114.           element's value follows the value of the initializer variable).
  14115.           
  14116.    The equal sign (=) preceding the initializer list is optional, but is
  14117.    recommended for clarity. If you need to initialize element 1 to a
  14118.    literal equal sign, use two of them, separated by a space, as in this
  14119.    example:
  14120.    
  14121.   ARRAY DECLARE \&a[] = = + - * /
  14122.  
  14123.    Remember, element 0 is not initialized by the DECLARE command. To
  14124.    initialize element 0, use a regular DEFINE or ASSIGN command:
  14125.    
  14126.   ARRAY DECLARE \&a[] one two three four five six seven eight nine
  14127.   DEFINE \&a[0] zero
  14128.  
  14129.    Finally, remember that every command level has its own local array,
  14130.    \&_[], containing all the macro arguments (\%0, \%1, ...) for that
  14131.    level. See [589]Section 7.5 for details.
  14132.      _________________________________________________________________
  14133.    
  14134.     7.10.2. Turning a String into an Array of Words
  14135.     
  14136.    The \fsplit(s1,&a,s2,s3) function assigns the words of string s1 to
  14137.    successive elements of the array (beginning with element 1) whose
  14138.    identifying letter, a-z, is given after the "&" in the second
  14139.    argument, using break and include characters given in s2 and s3. See
  14140.    [590]Section 7.3 for details.
  14141.      _________________________________________________________________
  14142.    
  14143.     7.10.3. Arrays of Filenames
  14144.     
  14145.    See [591]Section 4.11.3 for news about how \ffiles() and related
  14146.    functions can assign a list of filenames to an array. To recapitulate
  14147.    briefly here:
  14148.    
  14149.   \ffiles(*,&a)
  14150.  
  14151.    assigns all files that match the first argument to the array denoted
  14152.    by the second argument. If the array has not been declared, it is
  14153.    declared automatically, with exactly the number of elements needed to
  14154.    hold the file list; if it was previously declared, it is destroyed and
  14155.    reused. The filenames are assigned starting at array element 1.
  14156.    Element 0 holds the number of files in the list.
  14157.    
  14158.    The DIRECTORY command ([592]Section 4.5.1) can also create filename
  14159.    arrays if you give it the /ARRAY: switch; this allows selection
  14160.    criteria beyond whether the filename matches the given pattern.
  14161.    
  14162.    All functions and commands that create filename arrays store the
  14163.    number of filenames, n, as element 0 of the array, and the filenames
  14164.    as elements 1 through n.
  14165.      _________________________________________________________________
  14166.    
  14167.     7.10.4. Automatic Arrays
  14168.     
  14169.    In a command file or macro, you can now have local (automatic) arrays.
  14170.    Just give the name followed by empty subscript brackets (no spaces
  14171.    inside the brackets please) in a LOCAL command, and then declare the
  14172.    array:
  14173.    
  14174.   LOCAL \%a \&a[] oofa
  14175.   ARRAY DECLARE \&a[32] = value1 value2 value3 ...
  14176.  
  14177.    This declares the scalar variable \%a, the array \&a[], and the macro
  14178.    name "oofa" to be local, and then declares the new local copy of \&a[]
  14179.    with 32 elements, perhaps assigning some initial values. When C-Kermit
  14180.    exits from the command file or macro containing these command, the
  14181.    previous \&a[] array is restored (and if there was no \&a[] at any
  14182.    higher level, this will still be true). The process can be repeated to
  14183.    any level. Thus it is now safe to write scripts or macros containing
  14184.    arrays without danger of interfering with global arrays of the same
  14185.    name.
  14186.    
  14187.    Just as scalars are inherited by lower command levels, so are arrays.
  14188.    So, for example, if \&a[] is declared at top level, all lower levels
  14189.    will see it unless they include a "local \&a[]" statement, in which
  14190.    case all levels at and beneath the level where the LOCAL statement was
  14191.    executed will see the local copy. This too can be repeated to any
  14192.    level.
  14193.    
  14194.    On the other hand, if you DECLARE an array at a lower command level
  14195.    without also making it LOCAL, this replaces the copy that was declared
  14196.    at the lowest command level above this one.
  14197.      _________________________________________________________________
  14198.    
  14199.     7.10.5. Sorting Arrays
  14200.     
  14201.    Although arrays can be sorted using FOR loops as shown on page 383 of
  14202.    Using C-Kermit, 2nd Ed., this involves quite a bit of repetitive
  14203.    interpretation by the command parser, and so can be slow for large
  14204.    arrays. For this reason, C-Kermit 7.0 adds a built-in SORT command:
  14205.    
  14206.    ARRAY SORT [ switches ] array [ array2 ]
  14207.           Sorts the given array in place. Sorting is strictly lexical
  14208.           (string based). The array name can be given fully, e.g.
  14209.           "\&a[]", or the "\" and/or "&" and/or brackets can be omitted,
  14210.           e.g. "array sort \&a[]", "sort &a", "sort a". Also, a range can
  14211.           be indicated in the brackets as noted in [593]Section 7.10, to
  14212.           restrict the sort to a range of elements (equivalent to the
  14213.           /RANGE switch, described just below), e.g. "array sort
  14214.           &a[20:30]".
  14215.           
  14216.    A second array may be specified. If it is, and if it is at least as
  14217.    big as the first array, it is sorted according to the first array. For
  14218.    a sample application, see [594]Section 7.10.10.
  14219.    
  14220.    See [595]Section 1.5 for an explanation of switches. The optional
  14221.    switches are:
  14222.    
  14223.    /CASE:{ON,OFF}
  14224.           /CASE:ON means that alphabetic case is significant in
  14225.           comparisons; uppercase letters are sorted before lowercase
  14226.           ones. /CASE:OFF means case is ignored, e.g. "A" is the same as
  14227.           "a". If this switch is not given, sorting is according the
  14228.           current SET CASE setting.
  14229.           
  14230.    /KEY:n
  14231.           Comparison begins at position n(1-based) in each string. If no
  14232.           key is given, the entire strings are compared. Only one key can
  14233.           be given. If an array element is shorter than the key value, n,
  14234.           that element is considered empty for comparison purposes, and
  14235.           therefore lexically less than any element at least ncharacters
  14236.           long.
  14237.           
  14238.    /NUMERIC
  14239.           If this switch is included, it means sorting should be numeric,
  14240.           rather than lexical. The sort key is the string starting at the
  14241.           key position, skipping any leading blanks or tabs, and then as
  14242.           much of the string from that point on that fits the definition
  14243.           of "numeric", terminating at the first character that does not
  14244.           qualify. A numeric string has an optional sign (+ or -)
  14245.           followed by one or more digits, and (if your version of Kermit
  14246.           was built with floating-point support; see [596]Section 7.23 )
  14247.           zero or one decimal point (period). If both /CASE and /NUMERIC
  14248.           are given, /NUMERIC takes precedence.
  14249.           
  14250.    /RANGE:n[:m]
  14251.           Sort elements nthrough m of the array. By default, the entire
  14252.           array from element 1 to its dimensioned size is sorted, which
  14253.           might produce surprising results if the array is not full; see
  14254.           example in [597]Section 7.10.7. If ":m" is omitted from the
  14255.           range, the dimensioned size is used. Thus, to sort an entire
  14256.           array, \&a[], including its 0th element, use "sort /range:0
  14257.           &a". You can also sort any desired section of an array, e.g.
  14258.           "sort /range:10:20 &a" or "sort /range:\%i:\%j-1 &b". As noted
  14259.           above, you can also specify a range in the array-name brackets.
  14260.           If you specify a range in the array-name brackets AND with a
  14261.           /RANGE switch, the ones in the brackets take precedence.
  14262.           
  14263.    /REVERSE
  14264.           Sort in reverse order. If this switch is not given, the array
  14265.           is sorted in ascending order.
  14266.           
  14267.    Remember that numeric switch arguments can be numbers, arithmetic
  14268.    expressions, or variables whose values are numbers or expressions, as
  14269.    illustrated in the /RANGE examples above.
  14270.    
  14271.    A typical sorting application might be to list students' test scores
  14272.    in descending order. Suppose you had the following records:
  14273.    
  14274.   olaf      65
  14275.   olga      98
  14276.   ivan      83
  14277.   xena     100
  14278.  
  14279.    (and so on) stored in array \&s[] (e.g. by reading them from a file as
  14280.    illustrated in [598]section 7.10.7). In these records, the student's
  14281.    name is in columns 1-9 and the score in 10-12. So to rearrange the
  14282.    list in descending order of score:
  14283.    
  14284.   sort /key:10 /reverse &s
  14285.  
  14286.    Then to list your top five students:
  14287.    
  14288.   for \%i 1 5 1 { echo \&s[\%i] }
  14289.  
  14290.    Or more simply (see next section):
  14291.    
  14292.   show array a[1:5]
  14293.  
  14294.    To illustrate the difference between a lexical and a numeric sort,
  14295.    suppose you have the following records (the lines that are numbered,
  14296.    starting at column 1) in array \&a[]:
  14297.    
  14298.     Column   1         2
  14299.     12345678901234567890
  14300.  
  14301.    1. Ivan 10.0 2. Olaf 9.95 3. Olga 101.5
  14302.    
  14303.    ARRAY SORT /KEY:10 &a[] would order them 3,1,2, but ARRAY SORT /KEY:10
  14304.    /NUMERIC &a[] would order them 2,1,3.
  14305.      _________________________________________________________________
  14306.    
  14307.     7.10.6. Displaying Arrays
  14308.     
  14309.    The SHOW ARRAY command (or ARRAY SHOW) now accepts an optional
  14310.    array-name argument:
  14311.    
  14312.   SHOW ARRAY \&a[]
  14313.  
  14314.    (you can leave off the \, the \&, and/or the []'s if you like; "show
  14315.    array a" is equivalent to "show array \&a[]"). When an array is
  14316.    specified, its dimension is shown and all defined (non-empty) elements
  14317.    are listed.
  14318.    
  14319.    Example:
  14320.    
  14321.   assign \%n \ffiles(*,&a)  ; Fill an array with filenames ([599]Section 4.11.3
  14322. )
  14323.   show array \&a[]          ; Show the array we just read
  14324.   array show \&a[]          ; Same as previous
  14325.   array sort \&a[]          ; Sort the array
  14326.   array show \&a[]          ; Show it after sorting
  14327.   array show \&a            ; Show it again
  14328.   array show &a             ; Show it again
  14329.   array show a              ; Show it again
  14330.  
  14331.    (The final four commands demonstrate the alternative forms that are
  14332.    accepted for the array name.)
  14333.    
  14334.    If you SHOW ARRAY without giving an array name, all defined arrays are
  14335.    listed by name and dimension, but their contents are not shown.
  14336.    
  14337.    You can also show a piece of an array by including a subscript or
  14338.    range within the array brackets:
  14339.    
  14340.   array show \&a[5]         ; Shows \&a[5]
  14341.   array show &a[3:8]        ; Shows \&a[3] through \&a[8]
  14342.   array show a[:\%n-1]      ; Shows \&a[0] through \&a[\%n-1]
  14343.      _________________________________________________________________
  14344.    
  14345.     7.10.7. Other Array Operations
  14346.     
  14347.    ARRAY DESTROY arrayname
  14348.           Destroys and undeclares the named array. Subscripts or ranges
  14349.           are not accepted in this command.
  14350.           
  14351.    ARRAY COPY array1 array2
  14352.           Copies the first array to the second array. If the target array
  14353.           has not been declared, it is created automatically with the
  14354.           same size as the first. If it has been declared, it will be
  14355.           used as declared; if the source array is larger, only as much
  14356.           of it as will fit is copied to the target array. Syntax for
  14357.           array1 and array2 is as in ARRAY SHOW (SHOW ARRAY). Example:
  14358.           
  14359.   .\%n := \ffiles(*,&a)  ; Create and load array A with a file list.
  14360.   array copy &a &b       ; Copy array A to array B.
  14361.  
  14362.           The ARRAY COPY command also lets you copy pieces of arrays by
  14363.           including range specifiers, as in these examples:
  14364.           
  14365.         ARRAY COPY \&a[4:27] \&b
  14366.                 This copies \&a[] elements 4-27 to \&b[] elements 1-23,
  14367.                 creating \&b[] if necessary or, if \&b[] is already
  14368.                 declared, stopping early if its size is less than 23.
  14369.                 
  14370.         ARRAY COPY \&a[4:27] \&b[12]
  14371.                 This copies \&a[] elements 4-27 to \&b[] elements 12-35,
  14372.                 creating \&b[] if necessary or, if \&b[] is already
  14373.                 declared, stopping early if its size is less than 35.
  14374.                 
  14375.         ARRAY COPY \&a[4:27] \&b[12:14]
  14376.                 This copies \&a[] elements 4-6 to \&b[] elements 12-14,
  14377.                 creating \&b[] if necessary or, if \&b[] is already
  14378.                 declared, stopping early if its size is less than 14.
  14379.                 
  14380.         ARRAY COPY \&a[17] \&b
  14381.                 This copies all the elements of \&a[] starting with 17
  14382.                 until the last to \&b[], creating \&b[] if necessary or,
  14383.                 if \&b[] is already declared, stopping early if \&b[] is
  14384.                 not big enough.
  14385.                 
  14386.    ARRAY CLEAR arrayname
  14387.           Sets all the elements of the array to the empty value. You may
  14388.           also include a range specifier to clear only a selected portion
  14389.           of the array; for example "array clear \&a[37:214]". If the
  14390.           range is out of bounds, only the part of the array that is in
  14391.           bounds is cleared.
  14392.           
  14393.    ARRAY SET arrayname [ value ]
  14394.           Sets all the elements of the array to the given value. If no
  14395.           value is given, the array is cleared. You may also include a
  14396.           range specifier to set only a selected portion of the array;
  14397.           for example "array set \&a[1:9] -1". If the range is out of
  14398.           bounds, only the part of the array that is in bounds is set.
  14399.           
  14400.    ARRAY RESIZE arrayname size
  14401.           Resizes the given array. If the size is greater than the
  14402.           array's current dimension, new empty elements are added to the
  14403.           end. If the size is less than the current dimension, the extra
  14404.           elements are discarded. Note: If you have stored the array size
  14405.           in element 0, ARRAY RESIZE does not change this value.
  14406.           Alternative notation: ARRAY RESIZE arrayname[size]. For a
  14407.           practical example, see [600]Section 7.10.11.
  14408.           
  14409.    \farraylook(pattern,arrayname)
  14410.           This function returns the index of the first element of the
  14411.           given array that matches the given pattern (for details about
  14412.           pattern syntax, see [601]section 4.9). The array name can
  14413.           include a range specification to restrict the search to a given
  14414.           segment of the array. If no elements match the pattern, -1 is
  14415.           returned.
  14416.           
  14417.    \ftablelook(keyword,arrayname[,delimiter])
  14418.           Looks in the given "table", which must be sorted, for the given
  14419.           keyword. The keyword need not be spelled out in full.
  14420.           Pattern-matching characters should not be included as part of
  14421.           the keyword. The function returns the index of the table
  14422.           element that uniquely matches the given keyword, or -1 if none
  14423.           match, or -2 if more than 1 match.
  14424.           
  14425.    A "table" is an array that is sorted in lexical order; each of its
  14426.    elements may contain multiple fields, delimited by the given delimiter
  14427.    character or, if no delimiter is specified, a colon (:).
  14428.    
  14429.    The \farraylook() function does exactly what you tell it. If you give
  14430.    it a pattern that does not include wildcard characters (such as *, ?,
  14431.    etc), it requires an exact match. For example:
  14432.    
  14433.   \farraylook(oofa,&a)
  14434.  
  14435.    searches for the first element of \&a[] whose value is "oofa". But:
  14436.    
  14437.   \farraylook(oofa*,&a)
  14438.  
  14439.    finds the first element whose value starts with "oofa", and;
  14440.    
  14441.   \farraylook(*oofa,&a)
  14442.  
  14443.    finds the first element whose value ends with "oofa", and;
  14444.    
  14445.   \farraylook(*oofa*,&a)
  14446.  
  14447.    finds the first element whose value contains "oofa".
  14448.    
  14449.    Here's a simple demonstration of looking up patterns in arrays:
  14450.    
  14451.   local \&a[] \%x \%n
  14452.   declare \&a[] = zero one two three four five six seven eight nine ten
  14453.   while true {
  14454.       .\%x = 1
  14455.       .\%n = 0
  14456.       ask \%a { Pattern? }
  14457.       if not def \%a exit 0 Done.
  14458.       while <= \%x \fdim(&a) {
  14459.           .\%x := \farraylook(\%a,&a[\%x])
  14460.           if ( < \%x 0 ) break
  14461.           echo \flpad(\%x,3). \&a[\%x]
  14462.           increment \%x
  14463.           increment \%n
  14464.       }
  14465.       if ( < \%n 1 ) echo Pattern not found - "\%a"
  14466.   }
  14467.  
  14468.    The array need not be sorted. When a pattern is given, a search is
  14469.    performed; if there is a match, the matching element's index and the
  14470.    element itself are printed, and the search begins again at the next
  14471.    element. Thus each matching element is printed. If none match, the
  14472.    "Pattern not found" message is printed. The process repeats for as
  14473.    many patterns as the user wants to type, and terminates when the user
  14474.    types an empty pattern.
  14475.    
  14476.    Now let's build a little command parser, consisting of a keyword
  14477.    table, and a loop to look up the user's commands in it with
  14478.    \ftablelook(). In this case the array elements have "fields" separated
  14479.    by colon (:) -- a keyword and a value. Keyword tables must be sorted
  14480.    if \tablelook() is to work right, so after declaring and initializing
  14481.    the table array, we sort it.
  14482.    
  14483.   local \&k[] \%a \%i \%n
  14484.  
  14485.   array declare \&k[] = drive:9 do:8 discuss:7 live:6 spend:5 help:4 quit:0
  14486.  
  14487.   array sort &k                             ; Make sure array is sorted
  14488.   echo Type "help" for help.                ; Print greeting & instructions
  14489.  
  14490.   while true {                              ; Loop to get commands
  14491.       undefine \%a
  14492.       while not defined \%a {               ; Get a command
  14493.           ask \%a { Command? }
  14494.       }
  14495.       .\%n := \ftablelook(\%a,&k)           ; Look up the command
  14496.       switch \%n {                          ; Handle errors
  14497.         :-1, echo Not found - "\%a"         ; Doesn't match
  14498.              continue
  14499.         :-2, echo Ambiguous - "\%a"         ; Matches too many
  14500.              continue
  14501.       }
  14502.       switch \fword(\&k[\%n],2) {           ; Dispatch according to value
  14503.          :9, echo Driving..., break
  14504.          :8, echo Doing..., break
  14505.          :7, echo Discussing..., break
  14506.          :6, echo Living..., break
  14507.          :5, echo Spending..., break
  14508.          :4, echo { Commands (may be abbreviated):}
  14509.              for \%i 1 \fdim(&k) 1 {
  14510.                 echo {  \%i. \fword(\&k[\%i],1) }
  14511.              }
  14512.              break
  14513.          :0, exit 0 Bye!
  14514.          :default, stop 1 Internal error
  14515.       }
  14516.   }
  14517.  
  14518.    In this example, keywords are "drive", "do", "discuss", etc, and their
  14519.    values are unique numbers (values need not be numbers, and there need
  14520.    not be only one value -- there can be 0, 1, 2, or more of them). The
  14521.    user types a command, which can be the whole word (like "help") or any
  14522.    abbreviation (like "hel", "he", or just "h"). If this does not match
  14523.    any keywords, \ftablelook() returns -1; if it matches more than one
  14524.    (as would "d"), it returns -2. Otherwise the array index is returned,
  14525.    1 or higher.
  14526.    
  14527.    Given the array index \%n, we can get the table values as follows:
  14528.    
  14529.   \fword(\&k[\%n],1) is the keyword (first field)
  14530.   \fword(\&k[\%n],2) is the value (second field, in this case a number)
  14531.  
  14532.    In our example, we use the value (number) as the SWITCH variable. As
  14533.    noted, \fablelook() expects the array elements to contain multiple
  14534.    fields separated by colon (:) (or other character that you specify,
  14535.    e.g. \ftablelook(\%a,&a,^)) and when matching the keyword, ignores the
  14536.    first delimiter and everything after it.
  14537.      _________________________________________________________________
  14538.    
  14539.     7.10.8. Hints for Using Arrays
  14540.     
  14541.    C programmers are accustomed to out-of-bounds array references causing
  14542.    core dumps or worse. In C-Kermit:
  14543.    
  14544.      * A reference to an an out-of-bounds array element returns the empty
  14545.        string.
  14546.      * An attempt to set the value of an array element that is out of
  14547.        bounds or that has not been declared simply fails.
  14548.        
  14549.    C programmers expect an array of size nto have elements 0 through n-1.
  14550.    Fortran programmers expect the same array to have elements 1 through
  14551.    n. C-Kermit accommodates both styles; when you declare an array of
  14552.    size n, it has n=1 elements, 0 through n, and you can use the array in
  14553.    your accustomed manner, 0-based or 1-based.
  14554.    
  14555.    However, note that C-Kermit has certain biases towards 1-based arrays:
  14556.    
  14557.      * Assignment of file lists starts with element 1 ([602]Section
  14558.        7.10.3).
  14559.      * Assignment by \fsplit() starts with element 1 ([603]Section 7.3).
  14560.      * Array initialization skips the 0th element. To initialize a
  14561.        0-based array, use something like this:
  14562.  
  14563.   declare \&a[3] = one two three
  14564.   .\&a[0] = zero
  14565.      * The ARRAY SORT command skips the 0th element unless you include
  14566.        /RANGE:0
  14567.      * The SHIFT command ignores element 0 of the \&_[] array.
  14568.        
  14569.    The distinction between an array's dimensioned size and the number of
  14570.    elements in the array is important when sorting. To illustrate:
  14571.    
  14572.   declare \&a[100]                  ; Declare array &a with 100 elements
  14573.   fopen /read \%c oofa.txt          ; Open a file
  14574.   if fail...
  14575.   for \%i 1 \fdim(&a) 1 {           ; Read the file into the array
  14576.       fread \%c \&a[\%i]
  14577.       if fail break
  14578.   }
  14579.   fclose \%c
  14580.   if > \%i \fdim(&a) end 1 File has too many lines for array.
  14581.   .\%n ::= \%i - 1
  14582.   echo File has \%n line(s).
  14583.  
  14584.    Let's say the file had 95 lines. This leaves elements 96-100 of the
  14585.    array empty. Now suppose you sort the array and write out the result:
  14586.    
  14587.   sort &a                           ; Sort the whole array
  14588.   fopen /write \%o oofa.txt.sorted  ; Open an output file
  14589.   if fail ...
  14590.   for \%i 1 \%n 1 {                 ; Write out 95 records
  14591.       fwrite /line \%o \&a[\%i]
  14592.       if fail end 1 Write error
  14593.   }
  14594.   close write
  14595.  
  14596.    You might be surprised at the contents of "oofa.txt.sorted" -- five
  14597.    empty elements, 96-100, floated to the top of the array in the sort,
  14598.    and since your write loop only had 95 iterations, the final 5 lines of
  14599.    the sorted file are lost.
  14600.    
  14601.    Therefore, when dealing with partially filled arrays -- especially
  14602.    when sorting them -- remember to specify the number of elements. A
  14603.    handy way of recording an array's "true" size is to put it in the 0th
  14604.    element. That way, it "travels with the array". To illustrate
  14605.    (continuing the previous example at the "close read" statement):
  14606.    
  14607.   close read
  14608.   if > \%i \fdim(&a) end 1 File has too many lines for array.
  14609.   .\&a[0] ::= \%i - 1     ; Assign number of lines to \&a[0].
  14610.   echo File has \&a[0] line(s).
  14611.   sort /range:1:\&a[0] &a
  14612.   open write oofa.txt.sorted
  14613.   if fail ...
  14614.   for \%i 1 \&a[0] 1 {
  14615.       writeln file \&a[\%j]
  14616.       if fail end 1 Write error
  14617.   }
  14618.   close write
  14619.  
  14620.    Note the SORT switch, /RANGE:1:\&a[0]. This keeps the sort 1-based,
  14621.    and uses element 0 of the array as its size indicator.
  14622.    
  14623.    Finally, note that even though some commands or functions might put a
  14624.    size in array element 0, no built-in functions or commands depend on a
  14625.    size actually being there. Thus you are perfectly free to replace the
  14626.    size with something else and treat the array as 0-based.
  14627.      _________________________________________________________________
  14628.    
  14629.     7.10.9. Do-It-Yourself Arrays
  14630.     
  14631.    Kermit's \&x[] arrays are nice because of the accompanying built-in
  14632.    functionality -- ARRAY commands, built-in functions that load and
  14633.    search arrays, automatic evaluation of arithmetic expressions within
  14634.    the subscript brackets, and so on. Yet they also have certain
  14635.    limitations:
  14636.    
  14637.     1. Except when created by dynamic loading (e.g. by \ffiles()) they
  14638.        must be declared and dimensioned in advance.
  14639.     2. Indices must be numeric, positive, and in range.
  14640.     3. There can be only one dimension. Matrices or other
  14641.        higher-dimensioned arrays are not available.
  14642.        
  14643.    But none of this is to say you can't invent any kind of data structure
  14644.    you like. In [604]Section 7.9.2 you can see some examples. Here's
  14645.    another (courtesy of Dat Thuc Nguyen), in which a pair of matrices is
  14646.    created and then added: no dimensioning necessary.
  14647.    
  14648.   .row = 4
  14649.   .col = 9
  14650.  
  14651.   ; MACRO TO PRINT A MATRIX
  14652.   define PMATRIX {
  14653.       echo Matrix \%1:
  14654.       for \%r 1 \m(row) 1 {
  14655.           for \%c 1 \m(col) 1 {
  14656.               xecho \flpad(\m(\%1[\%r][\%c]),4)
  14657.           }
  14658.           echo
  14659.       }
  14660.       echo
  14661.   }
  14662.   ; CREATE MATRICES A AND B
  14663.   for \%r 1 \m(row) 1 {
  14664.       for \%c 1 \m(col) 1 {
  14665.           _eval A[\%r][\%c] \%r + \%c
  14666.           _eval B[\%r][\%c] \%r * \%c
  14667.       }
  14668.   }
  14669.   ; CREATE MATRIX C = SUM OF MATRIX A AND MATRIX B
  14670.   for \%r 1 \m(row) 1 {
  14671.       for \%c 1 \m(col) 1 {
  14672.           _eval C[\%r][\%c] \m(A[\%r][\%c]) + \m(B[\%r][\%c])
  14673.       }
  14674.   }
  14675.   pmatrix A  ; Print Matrix A
  14676.   pmatrix B  ; Print Matrix B
  14677.   pmatrix C  ; Print Matrix C
  14678.  
  14679.    In the example, we use matrix-like notation to create macros with
  14680.    names like "A[1][1]", "B[3][7]", and so on.
  14681.      _________________________________________________________________
  14682.    
  14683.     7.10.10. Associative Arrays
  14684.     
  14685.    An associative array is a special kind of Do-It-Yourself array. It
  14686.    differs from a regular array in that its indices need not be numbers
  14687.    -- they can be anything at all -- words, filenames, names of months,
  14688.    any character string at all, and that it doesn't have to be (and in
  14689.    fact can't be) declared. An associative array element is simply a
  14690.    macro whose name ends with an index enclosed in angle brackets, for
  14691.    example:
  14692.    
  14693.   file<oofa.txt>
  14694.  
  14695.    More formally:
  14696.    
  14697.   basename<index>
  14698.  
  14699.    An associative array is a collection of all associative array elements
  14700.    that have the same basename. Any number of associative arrays, each
  14701.    with any number of elements, can exist at the same time.
  14702.    
  14703.    An associative array element can be assigned a value, such as "1",
  14704.    just like any other macro:
  14705.    
  14706.   define file<oofa.txt> 1     ; Give "file<oofa.txt>" the value "1".
  14707.  
  14708.    or:
  14709.    
  14710.   assign file<oofa.txt> \%a   ; Give it the value of the variable \%a.
  14711.  
  14712.    However, since an associative array element is a macro, it may not
  14713.    have an empty (null) value, since assigning an empty value to a macro
  14714.    undefines the macro.
  14715.    
  14716.    You can refer to the value of an associative array element using the
  14717.    familiar notation for macro values:
  14718.    
  14719.   echo \m(file<oofa.txt>)     ; Echo the value of "file<oofa.txt>".
  14720.  
  14721.    Associative arrays are most useful, however, when the value of the
  14722.    index is a variable. In that case, you must use the "hidden" forms of
  14723.    the DEFINE or ASSIGN commands that evaluate the macro name before
  14724.    making the assignment (see [605]Using C-Kermit, page 457). Example:
  14725.    
  14726.   define \%f oofa.txt
  14727.   _define file<\%f> 1
  14728.   echo file<\%f> = \m(file<\%f>)
  14729.  
  14730.    prints:
  14731.    
  14732.   file<oofa.txt> = 1
  14733.  
  14734.    and then:
  14735.    
  14736.   _increment file<\%f>
  14737.   echo file<\%f> = \m(file<\%f>)
  14738.  
  14739.    prints:
  14740.    
  14741.   file<oofa.txt> = 2
  14742.  
  14743.    What are associative arrays good for? The classic example is "word
  14744.    counts": finding the number of times each word is used in a text
  14745.    without knowing in advance what the words are. Without associative
  14746.    arrays, your program would have to build a table of some kind, and
  14747.    every time a word was encountered, look it up in the table to find its
  14748.    position and counter, or add it to the table if it wasn't found -- a
  14749.    time-consuming and laborious process. Associative arrays, however, let
  14750.    you use the word itself as the table index and therefore sidestep all
  14751.    the table building and lookups.
  14752.    
  14753.    Let's work through a practical example. Suppose you have a
  14754.    file-transfer log in which each line is composed of a number of
  14755.    blank-separated fields, and the 9th field is a filename (which happens
  14756.    to be the format of certain FTP server logs, as well as of C-Kermit's
  14757.    new FTP-format transaction log, described in [606]Section 4.17.2), for
  14758.    example:
  14759.    
  14760.   Wed Jul 14 09:35:31 1999 22 xx.mit.edu 13412 /pub/ftp/mm/intro.txt ....
  14761.  
  14762.    and you want to find out how many times each file was transferred. The
  14763.    following code builds an associative array, file<>, containing the
  14764.    counts for each file:
  14765.    
  14766.   local name line max \%c \%n          ; Declare local variables
  14767.   fopen /read \%c /var/log/ftpd.log    ; Open the log file ([607]Section 1.22)
  14768.   if fail exit 1 Can't open log        ; Check
  14769.   while true {                         ; Loop for each record
  14770.       fread /line \%c line             ; Read a line
  14771.       if fail break                    ; Check for end of file
  14772.       .name := \fword(\m(line),9,{ })  ; Get 9th field = filename (Sec 7.3)
  14773.       _increment file<\m(name)>        ; Increment its counter (Sec 7.9.2)
  14774.   }
  14775.   fclose \%c                           ; Close file when done.
  14776.  
  14777.    Note that _INCREMENT (and INCREMENT, and [_]DECREMENT) treat an empty
  14778.    (i.e. nonexistent) variable as having a value of 0, and therefore
  14779.    creates the variable with a value of 1.
  14780.    
  14781.    At this point, if you told Kermit to "show macro file<", it would list
  14782.    the associative array. But since you don't necessarily know the names
  14783.    of the files in the array, or even how many elements are in the array,
  14784.    how can you use it in a script program?
  14785.    
  14786.    The idea of creating macro names that include character-string indices
  14787.    enclosed in angle brackets is perfectly arbitrary and doesn't depend
  14788.    on any Kermit features that weren't already there -- we could just as
  14789.    easily have used some other notation, such as "file[index]",
  14790.    "file:index", or "file.index", and the code above would have worked
  14791.    just as well (with the corresponding syntax adjustments). But to be
  14792.    able to use an associative array in a program after the array is
  14793.    built, we need a method of accessing all its elements without knowing
  14794.    in advance what they are. That's where the chosen notation comes in.
  14795.    
  14796.    First of all, any macro name that ends with "<xxx>" (where "xxx" is
  14797.    any string) is case sensitive, unlike all other macro names, which are
  14798.    case independent. To illustrate, "file<oofa.txt>" and "file<OOFA.TXT>"
  14799.    are two distinct macros, whereas "OOFA", "Oofa", and "oofa", when used
  14800.    as macro names, are all the same.
  14801.    
  14802.    Second, the new \faaconvert() function converts an associative array
  14803.    (that is, all macros with names of the form "base<index>" that have
  14804.    the same "base" part) into a pair of regular arrays and returns the
  14805.    number of elements:
  14806.    
  14807.   \faaconvert(name,&a[,&b])
  14808.  
  14809.    "name" is the name of the associative array, without the angle
  14810.    brackets or index ("file" in our example).
  14811.    
  14812.    The second argument is the name of a regular array in which to store
  14813.    the indices of the associative array (filenames in our example); if an
  14814.    array of this name already exists, it is destroyed unless the array is
  14815.    LOCAL. The third argument is the name of another regular array in
  14816.    which to store the values (the counts in our example), with the same
  14817.    rules about array name collisions. If you care only about the indices
  14818.    and not the values, you can omit the third argument to \faaconvert().
  14819.    In any case, the associative array is converted, not copied: its
  14820.    elements are moved to the specified regular arrays, so after
  14821.    conversion the original associative array is gone.
  14822.    
  14823.    As with other array-loading functions, \faaconvert() sets element 0 of
  14824.    each array to the number of elements in the array.
  14825.    
  14826.    To continue our example:
  14827.    
  14828.   .max := 0                                   ; Maximum count
  14829.   .\%n := \faaconvert(file,&a,&b)             ; Convert
  14830.   for \%i 1 \%n 1 {                           ; Loop through values
  14831.       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
  14832.       if ( > \&b[\%i] \m(max) ) {             ; Check for new maximum
  14833.           .name := \&a[\%i]
  14834.           .max  := \&b[\%i]
  14835.       }
  14836.   }
  14837.   echo Most popular file: \m(name), accesses: \m(max)
  14838.  
  14839.    This lists the files and counts and then announces which file has the
  14840.    highest count.
  14841.    
  14842.    Now suppose you want to sort the array pair created from an
  14843.    associative array. In our example, \&a[] contains filenames, and \&b[]
  14844.    contains the associated counts. Here we take advantage of the ARRAY
  14845.    SORT command's ability to sort a second array according to the first
  14846.    one:
  14847.    
  14848.   array sort /reverse /numeric &b &a          ; Descending sort by count
  14849.  
  14850.    Now to see the top five files and their counts:
  14851.    
  14852.   echo The top 5 files are:
  14853.   for \%i 1 5 1 {                             ; Loop through top 5 values
  14854.       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
  14855.   }
  14856.      _________________________________________________________________
  14857.    
  14858.     7.10.11. Transferring Array Contents to Other Computers
  14859.     
  14860.    The SEND /ARRAY:arrayname command ([608]Section 4.7.1) allows you to
  14861.    send the contents of any array, or any contiguous segment of it, in
  14862.    either text or binary mode to another computer, using Kermit protocol.
  14863.    When used in conjunction with C-Kermit's other features (the array
  14864.    features described in this section; the file i/o package from
  14865.    [609]Section 1.22; its decision-making, pattern-matching, and string
  14866.    manipulation capabilities, and so on) the possibilities are endless:
  14867.    extracts of large files, remote database queries, ..., all without
  14868.    recourse to system-dependent mechanisms such UNIX pipes and filters,
  14869.    thus ensuring cross-platform portability of scripts that use these
  14870.    features.
  14871.    
  14872.    When sending an array in text mode, Kermit appends a line terminator
  14873.    to each array element, even empty ones, and it also converts the
  14874.    character set from your current FILE character-set to your current
  14875.    TRANSFER character-set, if any. No conversions are made or line
  14876.    terminations added in binary mode. For example, the following array:
  14877.    
  14878.   dcl \&a[] = One Two Three Four Five Six
  14879.  
  14880.    is sent as six lines, one word per line, in text mode, and as the bare
  14881.    unterminated string "OneTwoThreeFourFiveSix" in binary mode.
  14882.    
  14883.    You should always include a /TEXT or /BINARY switch in any SEND /ARRAY
  14884.    command to force the desired transfer mode, otherwise you're likely to
  14885.    be surprised by the effects described in [610]Section 4.3.
  14886.    
  14887.    Here are some examples:
  14888.    
  14889.    send /text /array:\&a[]
  14890.           Sends the entire contents of the array \&a[] in text mode.
  14891.           Since an as-name is not included, the receiver is told the
  14892.           filename is _array_a_.
  14893.           
  14894.    send /text /array:&a[]
  14895.           
  14896.    send /text /array:a[]
  14897.           
  14898.    send /text /array:&a
  14899.           
  14900.    send /text /array:a
  14901.           These are all equivalent to the previous example.
  14902.           
  14903.    send /text /array:&a /as-name:foo.bar
  14904.           As above, but the array is sent under the name foo.bar.
  14905.           
  14906.    send /text /array:&a[100:199] /as:foo.bar
  14907.           As above, but only the elements from 100 through 199 are sent.
  14908.           
  14909.    In text-mode transfers, character sets are translated according to
  14910.    your current settings, just as for text files. In binary mode, of
  14911.    course, there is no character-set translation or other conversion of
  14912.    any kind. But remember that array elements can not contain the NUL
  14913.    (ASCII 0) character, since they are implemented as NUL-terminated
  14914.    strings.
  14915.    
  14916.    Here's an example that shows how to send all the lines (up to 1000 of
  14917.    them) from a file animals.txt that contain the words "cat", "dog", or
  14918.    "hog" (see [611]Section 4.9 about pattern matching):
  14919.    
  14920.   declare \&a[1000]
  14921.   fopen /read \%c animals.txt
  14922.   if fail exit 1
  14923.   .\%i = 0
  14924.   while true {
  14925.       fread \%c line
  14926.       if fail break
  14927.       if match {\m(line)} {*{cat,[dh]og}*} {
  14928.           increment \%i
  14929.           if ( > \%i \fdim(&a) ) break
  14930.           .\&a[\%i] := \m(line)
  14931.       }
  14932.   }
  14933.   fclose \%c
  14934.   send /array:a[1:\%i] /text
  14935.  
  14936.    Note that we are careful to send only the part of the array that was
  14937.    filled, not the entire array, because there are likely to be lots of
  14938.    unused elements at the end, and these would be sent as blank lines
  14939.    otherwise.
  14940.    
  14941.    This example raises an interesting question: what if we want to send
  14942.    ALL the matching lines, even if there are more than 1000 of them, but
  14943.    we don't know the number in advance? Clearly the problem is limited by
  14944.    Kermit's (and the computer's) memory. If there are a thousand trillion
  14945.    matching lines, they most likely will not fit in memory, and in this
  14946.    case the only solution is to write them first to a temporary file on
  14947.    mass storage and then send the temporary file and delete it
  14948.    afterwards.
  14949.    
  14950.    However, when the selection is likely to fit in memory, the
  14951.    once-familiar technique of initial allocation with extents can be
  14952.    used:
  14953.    
  14954.   if match {\m(line)} {*{cat,[dh]og}*} {
  14955.       increment \%i
  14956.       if ( > \%i \fdim(&a) ) {
  14957.           array resize a \fdim(&a)+100
  14958.           if fail stop 1 MEMORY FULL
  14959.           echo NEW DIMENSION: \fdim(&a)
  14960.       }
  14961.       .\&a[\%i] := \m(line)
  14962.   }
  14963.  
  14964.    This grows the array in chunks of 100 as needed.
  14965.      _________________________________________________________________
  14966.    
  14967.   7.11. OUTPUT Command Improvements
  14968.   
  14969.    LINEOUT [ text ]
  14970.           This command is exactly like OUTPUT, except it supplies a
  14971.           carriage return at the end of the text. "lineout exit" is
  14972.           exactly the same as "output exit\13".
  14973.           
  14974.    SET OUTPUT SPECIAL-ESCAPES { ON, OFF }
  14975.           This command lets you tell C-Kermit whether to process \N, \L,
  14976.           and \B specially in an OUTPUT command, as distinct from other \
  14977.           sequences (such as \%a, \13, \v(time), etc). Normally the
  14978.           special escapes are handled. Use SET OUTPUT SPECIAL-ESCAPES OFF
  14979.           to disable them.
  14980.           
  14981.    Disabling special escapes is necessary in situations when you need to
  14982.    transmit lines of data and you have no control over what is in the
  14983.    lines. For example, a file oofa.txt that contains:
  14984.    
  14985.   This is a file
  14986.   It has \%a variables in it
  14987.   And it has \B in it.
  14988.   And it has \L in it.
  14989.   And it has \N in it.
  14990.   And this is the last line.
  14991.  
  14992.    can be sent like this:
  14993.    
  14994.   local line
  14995.   set output special-escapes off
  14996.   fopen /read \%c oofa.txt
  14997.   if fail stop 1 Can't open oofa.txt
  14998.   while success {
  14999.       fread \%c line
  15000.       if fail break
  15001.       ; Add filtering or processing commands here...
  15002.       output \m(line)\13
  15003.   }
  15004.      _________________________________________________________________
  15005.    
  15006.   7.12. Function and Variable Diagnostics
  15007.   
  15008.    In C-Kermit 6.0 and earlier, the only diagnostic returned by a failing
  15009.    function call was an empty value, which (a) could not be distinguished
  15010.    from an empty value returned by a successful function call; (b) did
  15011.    not give any indication of the cause of failure; and (c) did not cause
  15012.    the enclosing statement to fail. C-Kermit 7.0 corrects these
  15013.    deficiencies.
  15014.    
  15015.    SET FUNCTION DIAGNOSTICS { ON, OFF }
  15016.           when ON, allows built-in functions to return diagnostic
  15017.           messages when improperly referenced, instead of an empty
  15018.           string. FUNCTION DIAGNOSTICS are ON by default. When OFF,
  15019.           improperly referenced functions continue to return an empty
  15020.           string. This command also affects built-in variables; in this
  15021.           case, an error message is returned only if the variable does
  15022.           not exist. When FUNCTION DIAGNOSTICS are ON, the error message
  15023.           is also printed.
  15024.           
  15025.    For variables, the only message is:
  15026.    
  15027.   <ERROR:NO_SUCH_VARIABLE:\v(name)>
  15028.  
  15029.    where "name" is the name of the nonexistent variable.
  15030.    
  15031.    For functions, the diagnostic message is:
  15032.    
  15033.   <ERROR:message:\fname()>
  15034.  
  15035.    where "message" is replaced by a message, and "name" is replaced by
  15036.    the function name, e.g. <ERROR:ARG_NOT_NUMERIC:\fmod()>. Messages
  15037.    include:
  15038.    
  15039.   ARG_BAD_ARRAY       An argument contains a malformed array reference.
  15040.   ARG_BAD_DATE        An argument contains a malformed date and/or time.
  15041.   ARG_BAD_PHONENUM    An argument contains a malformed telephone number.
  15042.   ARG_BAD_VARIABLE    An argument contains a malformed \%x variable.
  15043.   ARG_INCOMPLETE      An argument is incomplete (e.g. a broken Base64 string).
  15044.   ARG_EVAL_FAILURE    An argument could not be evaluated (internal error).
  15045.   ARG_NOT_ARRAY       An argument references an array that is not declared.
  15046.   ARG_NOT_NUMERIC     An argument that must be integer contains non-digits.
  15047.   ARG_NOT_FLOAT       An argument has bad floating-point number format.
  15048.   ARG_NOT_VARIABLE    An argument that must be a variable is not a variable.
  15049.   ARG_OUT_OF_RANGE    An argument's numeric value is too big or too small,
  15050.                       or an argument contains illegal characters (e.g. a hex
  15051.                       or Base-64 string).
  15052.   ARG_TOO_LONG        An argument's value is too long.
  15053.   ARRAY_FAILURE       Failure to create an array.
  15054.   DIVIDE_BY_ZERO      Execution of the function would cause division by zero.
  15055.   FLOATING_POINT_OP   Execution error in a floating-point operation.
  15056.   FILE_NOT_FOUND      Filename argument names a file that can't be found.
  15057.   FILE_NOT_READABLE   Filename argument is not a regular file.
  15058.   FILE_NOT_ACCESSIBLE Filename argument names a file that is read-protected.
  15059.   FILE_ERROR          Other error with filename argument.
  15060.   FILE_NOT_OPEN       A file function was given a channel that is not open.
  15061.   FILE_ERROR_-n       A file function got error -n ([612]Section 1.22).
  15062.   LOOKUP_FAILURE      Error looking up function (shouldn't happen).
  15063.   MALLOC_FAILURE      Failure to allocate needed memory (shouldn't happen).
  15064.   NAME_AMBIGUOUS      The function is not uniquely identified.
  15065.   MISSING_ARG         A required argument is missing.
  15066.   NO_SUCH_FUNCTION    An argument references a function that is not defined.
  15067.   NO_SUCH_MACRO       An argument references a macro that is not defined.
  15068.   RESULT_TOO_LONG     The result of a function is too long.
  15069.   UNKNOWN_FUNCTION    Internal error locating function (shouldn't happen).
  15070.  
  15071.    Examples:
  15072.    
  15073.   assign \%m \fmod()
  15074.   ?<ERROR:MISSING_ARG:\fmod()>
  15075.   echo "\fcontents(\%m)"
  15076.   "<ERROR:MISSING_ARG:\fmod()>"
  15077.   echo \fmod(3,x)
  15078.   ?<ERROR:ARG_NOT_NUMERIC:\fmod()>
  15079.   echo \fmod(3,4-2*2)
  15080.   ?<ERROR:DIVIDE_BY_ZERO:\fmod()>
  15081.  
  15082.    Notice the use of \fcontents() in echoing the value of a variable that
  15083.    contains a returned error message. That's because the error message
  15084.    includes the name of the variable or function that failed, so you must
  15085.    use \fcontents() to prevent it from being evaluated again -- otherwise
  15086.    the same error will occur.
  15087.    
  15088.    The handling of function and variable errors is controlled by:
  15089.    
  15090.    SET FUNCTION ERROR { ON, OFF }
  15091.           Tells whether invalid function calls or variable references
  15092.           should cause command errors. FUNCTION ERROR is ON by default.
  15093.           When ON, and an error is diagnosed in a built-in function or
  15094.           variable, the command that includes the function call or
  15095.           variable reference fails. The failing command can be handled in
  15096.           the normal way with IF FAILURE / IF SUCCESS, SET TAKE ERROR, or
  15097.           SET MACRO ERROR.
  15098.           
  15099.    When FUNCTION DIAGNOSTICS is OFF, there is no error message.
  15100.    
  15101.    SHOW SCRIPTS displays the current FUNCTION DIAGNOSTICS and ERROR
  15102.    settings.
  15103.      _________________________________________________________________
  15104.    
  15105.   7.13. Return Value of Macros
  15106.   
  15107.    In C-Kermit 5A and 6.0, there are two ways to return one level from a
  15108.    macro: RETURN value and END number text. When RETURN is used, the
  15109.    value, which can be a number or a text string, is assigned to
  15110.    \v(return). When END was used, however, \v(return) was not set.
  15111.    SUCCESS/FAILURE was set according to whether the number was zero, and
  15112.    the text was printed, but the actual value of the number was lost.
  15113.    
  15114.    In C-Kermit 7.0, the END number is available in the \v(return)
  15115.    variable.
  15116.      _________________________________________________________________
  15117.    
  15118.   7.14. The ASSERT, FAIL, and SUCCEED Commands.
  15119.   
  15120.    The ASSERT command is just like the IF command, but without a command
  15121.    to execute. It simply succeeds or fails, and this can be tested by a
  15122.    subsequent IF SUCCESS or IF FAILURE command. Example:
  15123.    
  15124.   ASSERT = 1 1
  15125.   IF SUCCESS echo 1 = 1.
  15126.  
  15127.    The FAIL command does nothing, but always fails. The SUCCEED command
  15128.    does nothing, but always succeeds.
  15129.    
  15130.    These commands are handy in debugging scripts when you want to induce
  15131.    a failure (or success) that normally would not occur, e.g. for testing
  15132.    blocks of code that normally are not executed.
  15133.      _________________________________________________________________
  15134.    
  15135.   7.15. Using Alarms
  15136.   
  15137.    Alarms may be set in two ways:
  15138.    
  15139.    SET ALARM number
  15140.           Sets an alarm for the given number of seconds "from now", i.e.
  15141.           in the future, relative to when the SET ALARM command was
  15142.           given. Examples:
  15143.           
  15144.  
  15145.   set alarm 60        ; 60 seconds from now
  15146.   set alarm +60       ; The same as "60"
  15147.   set alarm -60       ; Not legal - you can't set an alarm in the past.
  15148.   set alarm 60*60     ; 60 minutes from now.
  15149.   set alarm \%a+10    ; You can use variables, etc.
  15150.  
  15151.    SET ALARM hh:mm:ss
  15152.           Sets an alarm for the specified time. If the given time is
  15153.           earlier than the current time, the alarm is set for the given
  15154.           time in the next day. You may give the time in various formats:
  15155.           
  15156.  
  15157.   set alarm 15:00:00  ; 3:00:00pm
  15158.   set alarm 3:00:00pm ; 3:00:00pm
  15159.   set alarm 3:00pm    ; 3:00:00pm
  15160.   set alarm 3pm       ; 3:00:00pm
  15161.  
  15162.    SHOW ALARM
  15163.           Displays the current alarm, if any, in standard date-time
  15164.           format (see [613]Section 1.6): yyyymmdd hh:mm:ss.
  15165.           
  15166.    IF ALARM command
  15167.           Executes the command if an alarm has been set and the alarm
  15168.           time has passed.
  15169.           
  15170.    IF ALARM { command-list } [ ELSE { command-list } ]
  15171.           Executes the command-list if an alarm has been set and the
  15172.           alarm time has passed. Otherwise, if an ELSE part is given, its
  15173.           command-list is executed.
  15174.           
  15175.    CLEAR ALARM
  15176.           Clears the alarm.
  15177.           
  15178.    Only one alarm may be set at a time.
  15179.    
  15180.    Example: Suppose you have a script that is always running, and that
  15181.    transfers files periodically, and that keeps a transaction log.
  15182.    Suppose you want to start a new transaction log each day:
  15183.    
  15184.   log transactions \v(date).log
  15185.   set alarm 00:00:00                     ; Set an alarm for midnight
  15186.   while true {                           ; Main script loop
  15187.       xif alarm {                        ; If the alarm time is past...
  15188.           close transactions             ; Close current log
  15189.           log transactions \v(date).log  ; Start new one
  15190.           pause 1                        ; To make sure 00:00:00 is past
  15191.           set alarm 00:00:00             ; Set a new alarm
  15192.       }
  15193.       ; put the rest of the script here...
  15194.   }
  15195.  
  15196.    Note that IF ALARM -- no matter whether it succeeds or fails -- does
  15197.    NOT clear an expired alarm. Thus, once an alarm has expired, every IF
  15198.    ALARM will succeed until the alarm is cleared (with the CLEAR ALARM
  15199.    command) or reset with a new SET ALARM command.
  15200.      _________________________________________________________________
  15201.    
  15202.   7.16. Passing Arguments to Command Files
  15203.   
  15204.    Beginning in version 7.0, C-Kermit accepts arguments on the TAKE
  15205.    command line, for example:
  15206.    
  15207.   C-Kermit> take oofa.ksc one two {this is three} four
  15208.  
  15209.    This automatically sets the variables \%1 through \%9 to the
  15210.    arguments, and \%0 to the name of the file, in this case:
  15211.    
  15212.   \%0 = /usr/olga/oofa.ksc
  15213.   \%1 = one
  15214.   \%2 = two
  15215.   \%3 = this is three
  15216.   \%4 = four
  15217.  
  15218.    and \%5..\%9 are undefined (empty). Arguments past the ninth are
  15219.    available in the \&_[] argument-vector array ( [614]Section 7.5).
  15220.    
  15221.    The variables are those at the current macro level. Thus, if the TAKE
  15222.    command is executed from within a macro, the macro's arguments are
  15223.    replaced by those given on the TAKE command line (but only if at least
  15224.    one argument is given). The command shown above is exactly equivalent
  15225.    to:
  15226.    
  15227.   assign \%0 /usr/olga/oofa.ksc
  15228.   assign \%1 one
  15229.   assign \%2 two
  15230.   assign \%3 this is three
  15231.   assign \%4 four
  15232.   assign \%5
  15233.   assign \%6
  15234.   assign \%7
  15235.   assign \%8
  15236.   assign \%9
  15237.   take oofa.ksc
  15238.  
  15239.    Remember, the variables \%0..\%9 are on the macro call stack, and
  15240.    command files are independent of the macro stack. Thus, if a command
  15241.    file TAKEs another command file and passes arguments to it, the
  15242.    variables are changed from that point on for both files, and so forth
  15243.    for all levels of nested command files without intervening macro
  15244.    invocations.
  15245.    
  15246.    It would have been possible to change C-Kermit to use the overall
  15247.    command stack, rather than the macro stack, for arguments -- this
  15248.    would have made TAKE work exactly like DO, which is "nicer", but it
  15249.    would also have broken countless existing scripts. However, the new
  15250.    SHIFT command ([615]Section 7.5) makes it possible to create an
  15251.    alternative TAKE command that does indeed save and restore the
  15252.    argument variables at its own level around execution of a command
  15253.    file:
  15254.    
  15255.   define mtake {
  15256.      local \%f
  15257.      assign \%f \fcontents(\%1)
  15258.      shift
  15259.      take \%f
  15260.   }
  15261.  
  15262.    C-Kermit 7.0 also supports a new, easier way to pass arguments to
  15263.    scripts from the system command line:
  15264.    
  15265.   kermit filename arg1 arg2 arg3 ...
  15266.  
  15267.    in which arg1, arg2, arg3 (etc) are arguments for the script (whose
  15268.    filename is given), and are assigned to \%1, \%2, ... \%9. The
  15269.    filename is assigned to \%0. This applies equally to "Kerbang" scripts
  15270.    in UNIX ([616]Section 7.19). For example, suppose you have a file
  15271.    called "showargs" containing the following lines:
  15272.    
  15273.   #!/usr/local/bin/kermit +
  15274.   echo Hello from \%0
  15275.   show args
  15276.   exit
  15277.  
  15278.    (except not indented, since the "#!" line must be on the left margin).
  15279.    If you give this file execute permission:
  15280.    
  15281.   chmod +x showargs
  15282.  
  15283.    then you can run it exactly as you would run a UNIX shell script,
  15284.    e.g.:
  15285.    
  15286.   $ showargs one two three
  15287.   Hello from /usr/olga/showargs
  15288.   Top-level arguments (\v(argc) = 4):
  15289.    \&_[0] = /usr/olga/showargs
  15290.    \&_[1] = one
  15291.    \&_[2] = two
  15292.    \&_[3] = three
  15293.  
  15294.    Furthermore, the \&_[] array now contains the filename, if one was
  15295.    given as the first command line argument, or it is a "Kerbang" script,
  15296.    in element 0.
  15297.    
  15298.    Otherwise element 0 is program name, and elements 1 through \v(argc)-1
  15299.    contain the command-line arguments, if any, that appear after "--" or
  15300.    "=", if any. This array is saved and restored around macro calls;
  15301.    recall that inside macros it contains the macro argument vector
  15302.    (allowing you to access arguments programmatically, and to have more
  15303.    than 9 of them).
  15304.    
  15305.    At top level, notice the difference between the \&@[] and \&_[]
  15306.    arrays. The former includes C-Kermit options; the latter omits them.
  15307.      _________________________________________________________________
  15308.    
  15309.   7.17. Dialogs with Timed Responses
  15310.   
  15311.    The ASK, ASKQ, GETOK, and GETC commands (let's call them the
  15312.    "ASK-class commands") let you write scripts that carry on dialogs with
  15313.    the user, asking them for text, a Yes/No answer, or a character,
  15314.    respectively. Prior to C-Kermit 7.0, these questions would always wait
  15315.    forever for an answer. In C-Kermit 7.0, you may specify a time limit
  15316.    for them with the new command:
  15317.    
  15318.    SET ASK-TIMER number
  15319.           Sets a time-limit on ASK-CLASS commands to the given number of
  15320.           seconds. If the number is 0 or less, there is no time limit and
  15321.           these commands wait forever for a response. Any timer that is
  15322.           established by this command remains in effect for all future
  15323.           ASK-class commands until another SET ASK-TIMER command is given
  15324.           (e.g. with a value of 0 to disable ASK timeouts).
  15325.           
  15326.    IF ASKTIMEOUT command
  15327.           An ASK-class command that times out returns a failure status.
  15328.           You can test explicitly for a timeout with:
  15329.      _________________________________________________________________
  15330.    
  15331.   7.18. Increased Flexibility of SWITCH Case Labels
  15332.   
  15333.    Prior to C-Kermit 7.0 / K95 1.1.19, the case labels in SWITCH
  15334.    statements were string constants.
  15335.    
  15336.    Now case labels can be variables, function calls, or any mixture of
  15337.    these with each other and/or with regular characters.
  15338.    
  15339.    Furthermore, after the case label is evaluated, it is treated not as a
  15340.    string constant, but as a pattern against which the SWITCH variable is
  15341.    matched ([617]Section 4.9.1).
  15342.    
  15343.    This introduces a possible incompatibility with previous releases,
  15344.    since the following characters in case labels are no longer taken
  15345.    literally:
  15346.    
  15347.   \ * ? [ {
  15348.  
  15349.    Any scripts that previously included any of these characters in case
  15350.    labels must now quote them with backslash (\).
  15351.      _________________________________________________________________
  15352.    
  15353.   7.19. "Kerbang" Scripts
  15354.   
  15355.    In UNIX only, Kermit scripts can be stored in files and run
  15356.    "directly", without starting Kermit first (as noted on page 467 of the
  15357.    manual), just as a shell script can be "run" as if it were a program.
  15358.    This section amplifies on that idea a bit, and presents some new
  15359.    aspects of version 7.0 that make it easier to write and run Kermit
  15360.    scripts directly.
  15361.    
  15362.      NOTE: On non-UNIX platforms, such as VMS or Windows, Kerbang
  15363.      scripts can be run as "kermit + scriptfilename arg1 arg2 arg3 ...".
  15364.      Windows 95/98/NT file associations do not allow for the passing of
  15365.      parameters. In VMS, however, you can achieve the Kerbang effect by
  15366.      defining a symbol, as in this example:
  15367.      
  15368.   $ autotelnet :== "$SYS$TOOLS:KERMIT.EXE + AUTOTELNET.KSC"
  15369.  
  15370.      and then running the script like any other command:
  15371.      
  15372.   $ autotelnet xyzcorp.com myuserid
  15373.  
  15374.      See [618]Section 9.3 for an explanation of the "+" symbol.
  15375.      
  15376.    UNIX shell scripts can specify which shell should run them by
  15377.    including a "shebang" line at the top, e.g.:
  15378.    
  15379.   #!/bin/sh
  15380.  
  15381.    (but not indented; the shebang line must be on the left margin). The
  15382.    term "shebang" is a contraction of "shell" and "bang". "Bang" is a
  15383.    slang word for the exclamation mark ("!"); "shebang" itself is an
  15384.    American slang word used in in the phrase "the whole shebang".
  15385.    
  15386.    We can run Kermit scripts directly too, by including a "shebang" line
  15387.    that names Kermit as the "shell"; thus we call these "Kerbang"
  15388.    scripts. This mechanism has been considerably simplified in C-Kermit
  15389.    7.0 to facilitate C-Kermit's use a scripting tool just like any of the
  15390.    UNIX shells or scripting languages. The rules are the same as for
  15391.    shell scripts:
  15392.    
  15393.     1. The first line of the Kermit script must begin with "#!"
  15394.        immediately followed by the full pathname of the program that will
  15395.        execute the script (in this case, C-Kermit rather than a UNIX
  15396.        shell), followed by any Kermit command-line options. To suppress
  15397.        execution of the C-Kermit initialization file and to make command
  15398.        line arguments available to the script, the final option should be
  15399.        "+":
  15400.  
  15401.   #!/usr/local/bin/kermit +
  15402.        Some users have reported that in some circumstances a space might
  15403.        be necessary after the plus sign; this depends on your shell -- it
  15404.        has nothing to do with Kermit. In most cases, no space is needed.
  15405.     2. The file must have execute permission (granted via "chmod +x
  15406.        filename").
  15407.        
  15408.    When C-Kermit is invoked from a Kerbang script (or from the system
  15409.    prompt with a "+" command-line argument, which amounts to the same
  15410.    thing), the following special rules apply:
  15411.    
  15412.     1. The C-Kermit initialization file is NOT executed automatically. If
  15413.        you want it to be executed, include a TAKE command for it in the
  15414.        script, e.g. "take \v(home).kermrc". (In previous releases, the
  15415.        initialization file was always executed, with no way to prevent it
  15416.        except for the user to include Kermit-specific command line
  15417.        options which had nothing to do with the script). Many scripts
  15418.        have no need for the standard Kermit initialization file, which is
  15419.        quite lengthy and not only delays startup of the script, but also
  15420.        spews forth numerous messages that are most likely unrelated to
  15421.        the script.
  15422.     2. If the initialization file is not executed, neither is your
  15423.        customization file, since the initialization file is the command
  15424.        file from which the customization file is TAKEn. Again, you can
  15425.        include a TAKE command for the initialization file if desired, or
  15426.        for the customization file by itself, or for any other file.
  15427.     3. C-Kermit does not process command-line arguments at all. Instead,
  15428.        it passes all words on the command line after the "+" to the
  15429.        script as \%0 (the script name), \%1..\%9 (the first nine
  15430.        arguments), as well as in the argument vector array \&_[]. The
  15431.        variable \v(argc) is set to the total number of "words" (as passed
  15432.        by the shell to Kermit) including the script name. Quoting and
  15433.        grouping rules are those of the shell.
  15434.     4. At any point where the script terminates, it must include an EXIT
  15435.        command if you want it to exit back to the shell; otherwise
  15436.        C-Kermit enters interactive prompting mode when the script
  15437.        terminates. The EXIT command can include a numeric status to be
  15438.        returned to the shell (0, 1, etc), plus an optional message.
  15439.        
  15440.    Here is a simple Kerbang script that prints its arguments:
  15441.    
  15442.   #/usr/local/bin/kermit +
  15443.   echo Hello from \%0
  15444.   for \%i 0 \v(argc)-1 1 {
  15445.       echo \%i. "\&_[\%i]"
  15446.   }
  15447.   exit 0
  15448.  
  15449.    Save this file as (say) "showargs", then give it execute permission
  15450.    and run it (the \&_[] array is the same as \%0..\%9, but allows you to
  15451.    refer to argument variables programmatically; see [619]Section 7.5).
  15452.    (Yes, you could substitute SHOW ARGUMENTS for the loop.)
  15453.    
  15454.   $ chmod +x showargs
  15455.   $ ./showargs one "this is two" three
  15456.  
  15457.    The script displays its arguments:
  15458.    
  15459.   Hello from /usr/olga/showargs
  15460.   0. "/usr/olga/showargs"
  15461.   1. "one"
  15462.   2. "this is two"
  15463.   3. "three"
  15464.   $
  15465.  
  15466.    Notice that no banners or greetings are printed and that startup is
  15467.    instantaneous, just like a shell script. Also notice that grouping of
  15468.    arguments is determined by *shell* quoting rules, not Kermit ones,
  15469.    since the command line is parsed by the shell before Kermit ever sees
  15470.    it.
  15471.    
  15472.    Of course you can put any commands at all into a Kerbang script. It
  15473.    can read and write files, make connections, transfer files, anything
  15474.    that Kermit can do -- because it *is* Kermit. And of course, Kerbang
  15475.    scripts can also be executed from the Kermit prompt (or from another
  15476.    script) with a TAKE command; the Kerbang line is ignored since it
  15477.    starts with "#", which is a comment introducer to Kermit just as it is
  15478.    to the UNIX shell. In VMS and other non-UNIX platforms, the Kerbang
  15479.    line has no effect and can be omitted.
  15480.    
  15481.    It might be desireable for a script to know whether it has been
  15482.    invoked directly from the shell (as a Kerbang script) or by a TAKE
  15483.    command given to the Kermit prompt or in a Kermit command file or
  15484.    macro. This can be done as in this example:
  15485.    
  15486.   #!/usr/local/bin/kermit +
  15487.   assign \%m \fbasename(\%0)
  15488.   define usage { exit 1 {usage: \%m phonenumber message} }
  15489.   define apage { (definition of APAGE...) } ; (See [620]book pp.454-456)
  15490.   xif equal "\%0" "\v(cmdfil)" {
  15491.       if not def \%1 usage
  15492.       if not def \%2 usage
  15493.       apage {\%1} {\%2}
  15494.       exit \v(status)
  15495.   }
  15496.  
  15497.    In a Kerbang script, \%0 and \v(cmdfile) are the same; both of them
  15498.    are the name of the script. When a script is invoked by a Kermit TAKE
  15499.    command, \%0 is the name of the Kermit program, but \v(cmdfile) is the
  15500.    name of the script. In the example above, a macro called APAGE is
  15501.    defined. If the script was invoked directly, the APAGE macro is also
  15502.    executed. Otherwise, it is available for subsequent and perhaps
  15503.    repeated use later in the Kermit session.
  15504.    
  15505.    An especially handy use for Kerbang scripts is to have the
  15506.    initialization file itself be one. Since the standard initialization
  15507.    file is rather long and time-consuming to execute, it is often
  15508.    overkill if you want to start Kermit just to transfer a file. Of
  15509.    course there are command-line switches to suppress initialization-file
  15510.    execution, etc, but another approach is to "run" the initialization
  15511.    file when you want its features (notably the services directory), and
  15512.    run C-Kermit directly when you don't. A setup like this requires that
  15513.    (a) the C-Kermit initialization file is configured as a Kerbang script
  15514.    (has #!/path.../kermit as first line), has execute permission, and is
  15515.    in your PATH; and (b) that you don't have a .kermrc file in your login
  15516.    directory.
  15517.      _________________________________________________________________
  15518.    
  15519.   7.20. IF and XIF Statement Syntax
  15520.   
  15521.    The IF command has been improved in two significant ways in C-Kermit
  15522.    7.0, described in the following subsections. All changes are backwards
  15523.    compatible.
  15524.    
  15525.     7.20.1. The IF/XIF Distinction
  15526.     
  15527.    The distinction between IF and XIF is no longer important as of
  15528.    C-Kermit 7.0. You should be able to use IF in all cases (and of
  15529.    course, also XIF for backwards compatibility). In the past, IF was
  15530.    used for single-command THEN parts, followed optionally by a separate
  15531.    ELSE command:
  15532.    
  15533.   IF condition command1    ; THEN part
  15534.   ELSE command2            ; ELSE part
  15535.  
  15536.    whereas XIF was required if either part had multiple commands:
  15537.    
  15538.   XIF condition { command, command, ... } ELSE { command, command, ... }
  15539.  
  15540.    The syntactic differences were primarily that IF / ELSE was two
  15541.    commands on two separate lines, whereas XIF was one command on one
  15542.    line, and that XIF allowed (and in fact required) braces around its
  15543.    command lists, whereas IF did not allow them.
  15544.    
  15545.    Furthermore, the chaining or nesting of parts and conditions was
  15546.    inconsistent. For example, the IF command could be used like this:
  15547.    
  15548.   IF condition command
  15549.   ELSE IF condition command
  15550.   ELSE IF condition command
  15551.   ELSE IF condition command
  15552.   ...
  15553.  
  15554.    but XIF could not. C-Kermit 7.0 accepts the old syntax and executes it
  15555.    the same as previous versions, but also accepts a new unified and more
  15556.    convenient syntax:
  15557.    
  15558.    IF condition command-list [ ELSE command-list ]
  15559.    
  15560.    or:
  15561.    
  15562. IF condition command-list
  15563. ELSE command-list
  15564.  
  15565.    in which the ELSE part is optional, and where command-list can be a
  15566.    single command (with or without braces around it) or a list of
  15567.    commands enclosed in braces. Examples:
  15568.    
  15569.    Example 1:
  15570.    
  15571.   IF condition { command1, command2 } ELSE { command3, command4 }
  15572.  
  15573.    Example 2 (same as Example 1):
  15574.    
  15575.   IF condition {
  15576.      command1
  15577.      command2
  15578.   } ELSE {
  15579.      command3
  15580.      command4
  15581.   }
  15582.  
  15583.    Example 3 (same as 1 and 2):
  15584.    
  15585.   IF condition {
  15586.      command1
  15587.      command2
  15588.   }
  15589.   ELSE { command3, command4 }
  15590.  
  15591.    Example 4 (same as 1-3):
  15592.    
  15593.   IF condition {
  15594.      command1
  15595.      command2
  15596.   }
  15597.   ELSE {
  15598.      command3
  15599.      command4
  15600.   }
  15601.  
  15602.    Example 5 (ELSE can be followed by another command):
  15603.    
  15604.   IF condition {
  15605.      command1
  15606.      command2
  15607.   } ELSE IF condition {
  15608.      command3
  15609.      command4
  15610.   } ELSE {
  15611.      command5
  15612.      command6
  15613.   }
  15614.  
  15615.    Example 5 suggests other possibilities:
  15616.    
  15617.   IF condition {
  15618.      command1
  15619.      command2
  15620.   } ELSE FOR variable initial final increment {
  15621.      command3
  15622.      command4
  15623.   }
  15624.  
  15625.    And this too is possible, except for some non-obvious quoting
  15626.    considerations:
  15627.    
  15628.   dcl \&a[6] = one two three four five six
  15629.  
  15630.   IF < \%n 3 {
  15631.       echo \\%n is too small: \%n
  15632.   } ELSE FOR \\%i 1 \\%n 1 {
  15633.       echo \\%i. \\&a[\\%i]
  15634.   }
  15635.  
  15636.    (The loop variable must be quoted in this context to prevent premature
  15637.    evaluation.)
  15638.      _________________________________________________________________
  15639.    
  15640.     7.20.2. Boolean Expressions (The IF/WHILE Condition)
  15641.     
  15642.    Prior to C-Kermit 7.0, the IF and WHILE commands accepted only a
  15643.    single Boolean ("true or false") assertion, e.g. "if > \%m 0 command"
  15644.    or "if exist filename command". There was no way to form Boolean
  15645.    expressions and, in particular, nothing that approached a Boolean OR
  15646.    function (AND could be simulated by concatenating IF statements: "if
  15647.    condition1 if condition2..").
  15648.    
  15649.    C-Kermit 7.0 (and K95 1.1.19) allow grouping of Boolean assertions
  15650.    using parentheses and combining them using AND (or &&) and OR (or ||).
  15651.    Each of these operators -- including the parentheses -- is a field and
  15652.    must be set off by spaces. AND has higher precedence than OR, NOT has
  15653.    higher precedence than AND, but parentheses can be used to force any
  15654.    desired order of evaluation. The old syntax is still accepted.
  15655.    
  15656.    Here are some examples:
  15657.    
  15658.   define \%z 0                          ; Define some variables
  15659.   define \%n 1                          ; for use in the examples.
  15660.  
  15661.   if > \%n \%z echo \%n is greater.     ; Original format - still accepted.
  15662.   if ( > \%n \%z ) echo \%n is greater. ; Parentheses may be used in 7.0.
  15663.   if ( > \%n \%z && not = \%z 0 ) ...   ; Two assertions combined with AND.
  15664.   if ( > \%n \%z and not = \%z 0 ) ...  ; Same as previous ("and" = "&&").
  15665.   if ( > \%n \%z || not = \%z 0 ) ...   ; Two assertions combined with OR.
  15666.   if ( > \%n \%z or not = \%z 0 ) ...   ; Same as previous ("or" = "||").
  15667.   if ( > \%n \%z || != \%z 0 ) ...      ; Ditto ("!=" = "not =").
  15668.   while ( 1 ) { ... }                   ; Just like C.
  15669.  
  15670.    Notice the spaces around all operators including the parentheses --
  15671.    these are required. The following examples show how parentheses can be
  15672.    used to alter the precedence of the AND and OR operators:
  15673.    
  15674.   if ( false || false && false || true ) ,..         ; True
  15675.   if ( false || ( false && false ) || true ) ...     ; Same as previous
  15676.   if ( ( false || false ) && ( false || true ) ) ... ; False
  15677.  
  15678.    Similarly for NOT:
  15679.    
  15680.   if ( not true && false ) ...          ; False (NOT binds to TRUE only)
  15681.   if ( ( not true ) && false ) ...      ; Same as previous
  15682.   if ( not ( true && false ) ) ...      ; True (NOT binds to (TRUE && FALSE))
  15683.  
  15684.    Notes:
  15685.    
  15686.     1. The syntax of the Boolean expression itself has not changed; each
  15687.        expression begins with a keyword or token such as "EXIST", ">", or
  15688.        "=", etc; operators such as "<", "=", and ">" do not go between
  15689.        their operands but precede them as before; this might be called
  15690.        "reverse reverse Polish notation"; it allows deterministic
  15691.        on-the-fly parsing of these expressions at the C-Kermit> prompt as
  15692.        well as in scripts, and allows ?-help to be given for each item
  15693.        when IF or WHILE commands are typed at the prompt.
  15694.     2. Parentheses are required when there is more than one Boolean
  15695.        assertion.
  15696.     3. Parentheses are not required, but are allowed, when there is only
  15697.        one Boolean assertion.
  15698.     4. Evaluation of Boolean assertions occurs left to right, but the
  15699.        resulting Boolean expression is evaluated afterwards according to
  15700.        the rules of precedence. All Boolean assertions are always
  15701.        evaluated; there is no "early stopping" property and therefore no
  15702.        question about when or if side effects will occur -- if any
  15703.        Boolean assertion has side effects, they will always occur.
  15704.        
  15705.    Constructions of arbitrary complexity are possible, within reason.
  15706.    
  15707.    Also see [621]Section 7.4 for new IF / WHILE conditions.
  15708.      _________________________________________________________________
  15709.    
  15710.   7.21. Screen Formatting and Cursor Control
  15711.   
  15712.    C-Kermit 7.0 adds a simple way to create formatted screens, the SCREEN
  15713.    command:
  15714.    
  15715.    SCREEN { CLEAR, CLEOL, MOVE-TO row [ column ] }
  15716.           Performs screen-formatting actions. Correct operation of these
  15717.           commands depends on proper terminal setup on both ends of the
  15718.           connection -- mainly that the host terminal type is set to
  15719.           agree with the kind of terminal or the emulation you are
  15720.           viewing C-Kermit through. The UNIX version uses terminfo or
  15721.           termcap (not curses); the VMS version uses SMG; K-95 uses its
  15722.           built in screen manager.
  15723.           
  15724.    SCREEN CLEAR
  15725.           Moves the cursor to home position and clears the entire screen.
  15726.           Synonyms: CLEAR COMMAND-SCREEN ALL (K-95 only), CLS, CLEAR
  15727.           SCREEN.
  15728.           
  15729.    SCREEN CLEOL
  15730.           Clears from the current cursor position to the end of the line.
  15731.           Synonym: CLEAR COMMAND-SCREEN EOL (K-95 only)
  15732.           
  15733.    SCREEN MOVE-TO row column
  15734.           Moves the cursor to the indicated row and column. The row and
  15735.           column numbers are 1-based, so on a 24x80 screen the home
  15736.           position is 1 1 and the lower right corner is 24 80. If a row
  15737.           or column number is given that too large for what Kermit or the
  15738.           operating system thinks is your screen size, the appropriate
  15739.           number is substituted.
  15740.           
  15741.    These escape sequences used by these commands depends on the platform.
  15742.    In UNIX, your TERM environment variable is used to query the
  15743.    terminfo/termcap database; if the query fails, ANSI/VT100 sequences
  15744.    are used. In VMS, the SMG library is used, which sends sequences based
  15745.    on your VMS terminal type. K95 does its own screen control. On other
  15746.    platforms (such as AOS/VS, VOS, etc), screen formatting is not
  15747.    supported, and the SCREEN command does nothing.
  15748.    
  15749.    The three SCREEN actions can be used in scripts to produce menus,
  15750.    formatted screens, dynamic displays, etc. Related variables include:
  15751.    
  15752.   \v(terminal)     The type terminal C-Kermit thinks you have.
  15753.   \v(rows)         The number of rows C-Kermit thinks your terminal has.
  15754.   \v(columns)      The number of columns C-Kermit thinks your terminal has.
  15755.  
  15756.    And functions:
  15757.    
  15758.   \fscrncurx()     The current X coordinate of the cursor (K-95 only).
  15759.   \fscrncury()     The current Y coordinate of the cursor (K-95 only).
  15760.   \fscrnstr(x,y,n) The string of length nat position (x,y) (K-95 only).
  15761.  
  15762.    And commands:
  15763.    
  15764.   ECHO string      Writes string + CRLF at the current cursor position.
  15765.   XECHO string     Writes string at current cursor position; CRLF not supplied.
  15766.   GETC v prompt    Issues prompt, reads one character into variable v, no echo.
  15767.  
  15768.    And special characters:
  15769.    
  15770.   Ctrl-L           At the C-Kermit> command prompt, or in a C-Kermit command,
  15771.                    works like Return or Enter, but also clears the screen
  15772.  
  15773.    Example 1: A macro that prints a message \%1 at cursor position
  15774.    (\%2,\%3):
  15775.    
  15776.   define MSG {
  15777.       if not def \%3 def \%3 0             ; Default column to 0
  15778.       if > \v(argc) 2 screen move \%2 \%3  ; Move to given row/col (if any)
  15779.       screen cleol                         ; Clear to end of line
  15780.       if def \%1 xecho \fcontents(\%1)     ; Print message (if any)
  15781.   }
  15782.  
  15783.    Example 2: A macro put the cursor on the bottom screen line, left
  15784.    margin:
  15785.    
  15786.   define BOT {
  15787.       screen move \v(rows) 0
  15788.   }
  15789.  
  15790.    Example 3: A macro to center message \%1 on line \%2.
  15791.    
  15792.   define CENTER {
  15793.       if not def \%2 def \%2 1
  15794.       .\%x ::= (\v(cols)-\flen(\%1))/2
  15795.       msg {\%1} {\%2} {\%x}
  15796.   }
  15797.  
  15798.    Example 4: A simple menu (building on Examples 1-3):
  15799.    
  15800.   def \%c 0                             ; Menu choice variable
  15801.   screen clear                          ; Clear the screen
  15802.   center {Welcome to This Menu} 2       ; Display the menu
  15803.   msg {Choices:} 4
  15804.   msg { 1. File} 6
  15805.   msg { 2. Edit} 7
  15806.   msg { 3. Exit} 8
  15807.   while ( != \%c 3 ) {                  ; Read and verify choice
  15808.       while true {                      ; Keep trying till we get a good one
  15809.           screen move 10                ; Move to line 10
  15810.           screen cleol                  ; Clear this line
  15811.           getc \%c {Your choice: }      ; Prompt and get and echo 1 character
  15812.           xecho \%c
  15813.           if ( not numeric \%c ) { msg {Not numeric - "\%c"} 12, continue }
  15814.           if ( >= \%c 1 && <= \%c 3 ) break
  15815.           msg {Out of range - "\%c"} 12
  15816.       }
  15817.       switch \%c {                      ; Valid choice - execute it.
  15818.         :1, msg {Filing... } 12, break
  15819.         :2, msg {Editing...} 12, break
  15820.         :3, msg {Exiting...} 12, break
  15821.       }
  15822.   }
  15823.   echo Bye                              ; Exit chosen - say goodbye.
  15824.   bot                                   ; Leave cursor at screen bottom.
  15825.   exit                                  ; And exit.
  15826.  
  15827.    Similar scripts can work over the communication connection; substitute
  15828.    INPUT and OUTPUT for GETC and ECHO/XECHO.
  15829.      _________________________________________________________________
  15830.    
  15831.   7.22. Evaluating Arithmetic Expressions
  15832.   
  15833.    A new arithmetic operator was added to the list recognized by the
  15834.    EVALUATE command, the \feval() function, and which can also be used
  15835.    anywhere else arithmetic expressions are accepted (numeric command
  15836.    fields, array subscripts, etc):
  15837.    
  15838.    Prefix "!"
  15839.           This operator inverts the "truth value" of the number or
  15840.           arithmetic expression that follows. If the value of the operand
  15841.           is 0, the result is 1. If the value is nonzero, the result is
  15842.           0.
  15843.           
  15844.    Examples:
  15845.    
  15846.   set eval old
  15847.   evaluate 0
  15848.   0
  15849.  
  15850.   evaluate !0
  15851.   1
  15852.  
  15853.   evaluate !3
  15854.   0
  15855.  
  15856.   evaluate !(-3)
  15857.   0
  15858.  
  15859.   .\%a = 1
  15860.   .\%b = 0
  15861.   evaluate !(\%a|\%b)
  15862.   0
  15863.  
  15864.   evaluate !(\%a&\%b)
  15865.   1
  15866.  
  15867.   evaluate !(!(\%a&\%b))
  15868.   0
  15869.  
  15870.    Note the distinction between Prefix ! (invert truth value) and Suffix
  15871.    ! (factorial). Also the distinction between Prefix ! and Prefix ~
  15872.    (which inverts all the bits in its operand). Also note that prefix
  15873.    operators (!, -, and ~) can not be adjacent unless you use parentheses
  15874.    to separate them, as shown in the final example above.
  15875.      _________________________________________________________________
  15876.    
  15877.   7.23. Floating-Point Arithmetic
  15878.   
  15879.    C-Kermit 7.0 adds limited support for floating-point numbers (numbers
  15880.    that have fractional parts, like 3.141592653). This support is
  15881.    provided through a small repertoire of functions and in Boolean
  15882.    expressions that compare numbers, but does not apply to number parsing
  15883.    in general, or to expression evaluation, array subscripts, the
  15884.    INCREMENT and DECREMENT commands, or in any context other than those
  15885.    listed in this section.
  15886.    
  15887.    A floating point number has an optional sign (+ or -), followed by a
  15888.    series of decimal digits containing either zero or one period (.)
  15889.    character, which is the decimal point. The use of comma or any other
  15890.    character besides period as a decimal point is not supported.
  15891.    Scientific notation is not supported either. Examples of legal
  15892.    floating-point numbers:
  15893.    
  15894.   0                Integers can be used
  15895.   1                Ditto
  15896.   2.               A decimal point without decimal digits
  15897.   3.0              A decimal point with decimal digits
  15898.   3.141592653      Ditto
  15899.  -4.0              A negative sign can be included
  15900.  +5.0              A positive sign can be included
  15901.  
  15902.    Examples of notations that are not accepted:
  15903.    
  15904.   1,000,000        Separators can not be used
  15905.   1.000.000        Ditto (or multiple decimal points)
  15906.   6.022137E23      No scientific notation
  15907.   6.62606868e-34   Ditto
  15908.   12.5+6.25        No "bare" expressions
  15909.  
  15910.    You can use IF FLOAT test a string or variable to see if it's in
  15911.    acceptable floating-point format. Example:
  15912.    
  15913.   ask \%f { Type a number: }
  15914.   if not def \%f .\%f = 0.0
  15915.   if not float \%f stop 1 Invalid floating-point number: "\%f"
  15916.  
  15917.    C-Kermit's floating-point support, like its support for whole numbers
  15918.    (integers), relies on the capabilities of the underlying computer.
  15919.    Your computer has only a limited amount of precision for numbers,
  15920.    depending on its architecture. Thus floating-point numbers that have
  15921.    too many digits will not be accurate; adding a very small number to a
  15922.    very large one might have no effect at all; and so on. For details,
  15923.    read a text on numerical analysis. Example:
  15924.    
  15925.   .\%a = 11111111111111111111  ; A long number
  15926.   .\%b = 22222222222222222222  ; Another one
  15927.   echo \ffpadd(\%a,\%b)        ; Add them - the result should be all 3's
  15928.   33333333333333330000.0       ; See the result
  15929.  
  15930.    In this example, the computer has 16 digits of precision; after that,
  15931.    the (low-order) digits are set to 0, since the computer doesn't know
  15932.    what they really are. In fact, the computer returns random digits, but
  15933.    Kermit sets all digits beyond the computer's precision to 0.
  15934.    
  15935.    C-Kermit's floating-point functions have names of the form
  15936.    "\ffpxxx(args)" ("\f" for function, "fp" for floating-point), where
  15937.    "xxx" is replaced by the name of the function, such as "sqrt", and
  15938.    "args" is the argument list, consisting of one or two floating-point
  15939.    numbers (depending on the function), and an optional "d" argument that
  15940.    says now many decimal places should be shown in the result. Example:
  15941.    
  15942.   \ffpdiv(10,3,1) returns "3.3"
  15943.   \ffpdiv(10,3,2) returns "3.33"
  15944.   \ffpdiv(10,3,3) returns "3.333"
  15945.  
  15946.    and so on, up to the precision of the computer. If the decimal-places
  15947.    argument is less than zero, the fractional part of the result is
  15948.    truncated:
  15949.    
  15950.   \ffpdiv(10,3,-1) returns "3".
  15951.  
  15952.    If the decimal-places argument is 0, or is omitted, C-Kermit returns
  15953.    as many decimal places as are meaningful in the computer's
  15954.    floating-point precision, truncating any extraneous trailing 0's:
  15955.    
  15956.   \ffpdiv(10,8) returns "1.25".
  15957.   \ffpdiv(10,4) returns "2.5".
  15958.   \ffpdiv(10,2) returns "5.0".
  15959.   \ffpdiv(10,3) returns "3.333333333333333" (for 16-digit precision).
  15960.  
  15961.    There is no way to request that a floating-point function return a
  15962.    decimal point but no decimal places. However, this is easy enough to
  15963.    accomplish in other ways, for example by supplying it outside the
  15964.    function call:
  15965.    
  15966.   echo \ffpadd(\%a,\%b,-1).
  15967.  
  15968.    Kermit's floating-point functions always round the result for the
  15969.    requested number of decimal places when the "d" argument is given and
  15970.    has a value greater than 0 (see the description of \ffpround() just
  15971.    below).
  15972.    
  15973.    Floating-point arguments can be constants in floating-point format or
  15974.    variables whose values are floating-point numbers. If a floating-point
  15975.    argument is omitted, or is a variable with no value, 0.0 is supplied
  15976.    automatically. Example:
  15977.    
  15978.   def \%x 999.999
  15979.   undef \%y
  15980.   echo \ffpmin(\%x,\%y)
  15981.   0.0
  15982.  
  15983.    Or equivalently:
  15984.    
  15985.   echo \ffpmin(999.999)
  15986.   0.0
  15987.  
  15988.    The floating-point functions are:
  15989.    
  15990.    \ffpround(f1,d)
  15991.           Returns f1 rounded to d decimal places. For this function only,
  15992.           d = 0 (or d omitted) has a special meaning: return the integer
  15993.           part of f1 rounded according to the fractional part. Examples:
  15994.           
  15995.  
  15996.   \ffpround(2.74653,-1) returns "2" (fraction truncated, no rounding).
  15997.   \ffpround(2.74653,0)  returns "3" (integer part is rounded).
  15998.   \ffpround(2.74653)    returns "3" (d omitted same as d = 0).
  15999.   \ffpround(2.74653,1)  returns "2.7".
  16000.   \ffpround(2.74653,2)  returns "2.75".
  16001.   \ffpround(2.74653,3)  returns "2.747".
  16002.   \ffpround(2.74653,4)  returns "2.7465", etc.
  16003.  
  16004.    \ffpadd(f1,f2,d)
  16005.           Returns the sum of f1 and f2.
  16006.           
  16007.    \ffpsubtract(f1,f2,d)
  16008.           Subtracts f2 from f1 and returns the result.
  16009.           
  16010.    \ffpmultiply(f1,f2,d)
  16011.           Returns the product of f1 and f2.
  16012.           
  16013.    \ffpdivide(f1,f2,d)
  16014.           If f2 is not 0, divides f1 by f2 and returns the quotient.
  16015.           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
  16016.           
  16017.    \ffpraise(f1,f2,d)
  16018.           If f1 = 0 and f2 <= 0, or if f1 < 0 and f2 has a fractional
  16019.           part, an ARG_OUT_OF_RANGE error occurs; otherwise f1 raised to
  16020.           the f2 power is returned.
  16021.           
  16022.    \ffpsqrt(f1,d)
  16023.           If f1 >= 0, returns the square root of f1; otherwise
  16024.           ARG_OUT_OF_RANGE.
  16025.           
  16026.    \ffpabsolute(f1,d)
  16027.           Returns the absolute value of f1 (i.e. f1 without a sign). This
  16028.           is the floating-point analog of \fabsolute(n1).
  16029.           
  16030.    \ffpint(f1)
  16031.           Returns the integer part of f1. Equivalent to \ffpround(f1,-1).
  16032.           
  16033.    \ffpexp(f1,d)
  16034.           The base of natural logarithms, e (2.718282...), raised to the
  16035.           f1 power.
  16036.           
  16037.    \ffplogn(f1,d)
  16038.           The natural logarithm of f1 (the power to which e must be
  16039.           raised to obtain f1).
  16040.           
  16041.    \ffplog10(f1,d)
  16042.           The base-10 logarithm of f1 (the power to which 10 must be
  16043.           raised to obtain f1).
  16044.           
  16045.    \ffpmodulus(f1,f2,d)
  16046.           If f2 is not 0, the remainder after dividing f1 by f2.
  16047.           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
  16048.           This is the floating-point analog of \fmod(n1,n2).
  16049.           
  16050.    \ffpmaximum(f1,f2,d)
  16051.           Returns the maximum of f1 and f2. This is the floating-point
  16052.           analog of \fmax(n1,n2).
  16053.           
  16054.    \ffpminimum(f1,f2,d)
  16055.           Returns the minimum of f1 and f2. This is the floating-point
  16056.           analog of \fmin(n1,n2).
  16057.           
  16058.    \ffpsine(f1,d)
  16059.           Returns the sine of f1 radians.
  16060.           
  16061.    \ffpcosine(f1,d)
  16062.           Returns the cosine of f1 radians.
  16063.           
  16064.    \ffptangent(f1,d)
  16065.           Returns the tangent of f1 radians.
  16066.           
  16067.    Note that all of these functions can be used with integer arguments.
  16068.    If you want an integer result, specify d = -1 (to truncate) or feed
  16069.    the result to \ffpround(xxx,0) (to round).
  16070.    
  16071.    Floating-point numbers (or variables or functions that return them)
  16072.    can be used in Boolean expressions (see [622]Section 7.20.2) that
  16073.    compare numbers:
  16074.    
  16075.   = x y
  16076.   != x y
  16077.   < x y
  16078.   > x y
  16079.   <= x y
  16080.   >= x y
  16081.  
  16082.    In these examples, x and y can be either integers or floating-point
  16083.    numbers in any combination. In an arithmetic comparison of an integer
  16084.    and a floating-point number, the integer is converted to
  16085.    floating-point before the comparison is made. Examples:
  16086.    
  16087.   .\%t = 3.000000000
  16088.   .\%f = 3.141592653
  16089.   .\%i = 3
  16090.  
  16091.   if > \%f \%i echo Pi is greater.
  16092.   if = \%t \%i echo "\%i" = "\%t".
  16093.  
  16094.    A floating-point number can also be used in:
  16095.    
  16096.   IF number command
  16097.  
  16098.    where the command is executed if the number is nonzero. If the number
  16099.    is floating-point, the command is not executed if the number is 0.0,
  16100.    and is executed otherwise.
  16101.    
  16102.    Floating-point numbers can be sorted using ARRAY SORT /NUMERIC (see
  16103.    [623]Section 7.10.5 ).
  16104.    
  16105.    Two floating-point constants are provided:
  16106.    
  16107.   \v(math_pi) = Pi (3.141592653...)
  16108.   \v(math_e)  = e, the base of natural logarithms (2.71828...)
  16109.  
  16110.    These are given to the computer's precision, e.g. 16 digits. This
  16111.    number itself is available in a variable:
  16112.    
  16113.    \v(math_precision)
  16114.           How many significant digits in a floating-point number.
  16115.      _________________________________________________________________
  16116.    
  16117.   7.24. Tracing Script Execution
  16118.   
  16119.    The TRACE command is handy for debugging scripts.
  16120.    
  16121.    TRACE [ { /ON, /OFF } ] [ { ASSIGNMENTS, COMMAND-LEVEL, ALL } ]
  16122.           Selects tracing of the given object.
  16123.           
  16124.    Optional switches are /ON and /OFF. If no switch is given, /ON is
  16125.    implied. The trace objects are ASSIGNMENTS, COMMAND-LEVEL, and ALL.
  16126.    The default object is ALL, meaning to select all trace objects
  16127.    (besides ALL). Thus TRACE by itself selects tracing of everything, as
  16128.    does TRACE /ON, and TRACE /OFF turns off all tracing.
  16129.    
  16130.    When tracing of ASSIGNMENTS is on, every time the value of any
  16131.    user-defined variable or macro changes, C-Kermit prints one of the
  16132.    following:
  16133.    
  16134.    >>> name: "value"
  16135.           The name of the variable or macro followed by the new value in
  16136.           quotes. This includes implicit macro-parameter assignments
  16137.           during macro invocation.
  16138.           
  16139.    >>> name: (undef)
  16140.           This indicates that the variable or macro has been undefined.
  16141.           
  16142.    <<< name: "value"
  16143.           For RETURN statements: the name of the macro and the return
  16144.           value.
  16145.           
  16146.    <<< name: (null)
  16147.           For RETURN statements that include no value or an empty value.
  16148.           
  16149.    When tracing of COMMAND-LEVEL is on, C-Kermit prints:
  16150.    
  16151.    [n] +F: "name"
  16152.           Whenever a command file is entered, where "n" is the command
  16153.           level (0 = top); the name of the command file is shown in
  16154.           quotes.
  16155.           
  16156.    [n] +M: "name"
  16157.           Whenever a macro is entered; "n" is the command level. The name
  16158.           of the macro is shown in quotes.
  16159.           
  16160.    [n] -F: "name"
  16161.           Whenever a command file is reentered from below, when a macro
  16162.           or command file that it has invoked has returned.
  16163.           
  16164.    [n] -M: "name"
  16165.           Whenever a macro is reentered from below.
  16166.           
  16167.    For other debugging tools, see SHOW ARGS, SHOW STACK, SET TAKE, SET
  16168.    MACRO, and of course, ECHO.
  16169.      _________________________________________________________________
  16170.    
  16171.   7.25. Compact Substring Notation
  16172.   
  16173.    It is often desirable to extract a substring from a string which is
  16174.    stored in a variable, and for this we have the \fsubstring() function,
  16175.    which is used like this:
  16176.    
  16177.   define \%a 1234567890
  16178.   echo \fsubstring(\%a,3,4) ; substring from 3rd character length 4
  16179.   3456
  16180.  
  16181.    or like this with macro-named variables:
  16182.    
  16183.   define string 1234567890
  16184.   echo \fsubstring(\m(string),3,4)
  16185.   3456
  16186.  
  16187.    C-Kermit 7.0 adds a pair of alternative compact notations:
  16188.    
  16189. \:(variablename[start:length])  <-- Substring of variable's value
  16190. \s(macroname[start:length])     <-- Substring of macro's definition
  16191.  
  16192.    These are exactly equivalent to using \fsubstring(), except more
  16193.    compact to write and also faster since evaluation is in one step
  16194.    instead of two.
  16195.    
  16196.    The "\:()" notation can be used with any Kermit variable, that is,
  16197.    almost anything that starts with a backslash:
  16198.    
  16199.   \:(\%a[2:6])      <-- equivalent to \fsubstring(\%a,2,6)
  16200.   \:(\&x[1][2:6])   <-- equivalent to \fsubstring(\&x[1],2,6)
  16201.   \:(\m(foo)[2:6])  <-- equivalent to \fsubstring(\m(foo),2,6)
  16202.   \:(\v(time)[2:6]) <-- equivalent to \fsubstring(\v(time),2,6)
  16203.   \:(\$(TERM)[2:6]) <-- equivalent to \fsubstring(\$(TERM),2,6)
  16204.   \:(ABCDEFGH[2:6]) <-- equivalent to \fsubstring(ABCDEFGH,2,6)
  16205.  
  16206.    Whatever appears between the left parenthesis and the left bracket is
  16207.    evaluated and then the indicated substring of the result is returned.
  16208.    
  16209.    The "\s()" notation is the same, except after evaluating the variable,
  16210.    the result is treated as a macro name and is looked up in the macro
  16211.    table. Then the indicated substring of the macro definition is
  16212.    returned. Example:
  16213.    
  16214.   define testing abcdefghijklmnopqrstuvwxyz
  16215.   define \%a testing
  16216.  
  16217.   \s(testing[2:6])  -->  bcdefg
  16218.   \:(testing[2:6])  -->  esting
  16219.   \:(\%a[2:6])      -->  esting
  16220.   \s(\%a[2:6])      -->  bcdefg
  16221.  
  16222.    Note that the following two examples are equivalent:
  16223.    
  16224.   \:(\m(foo)[2:6])
  16225.   \s(foo[2:6])
  16226.  
  16227.    The first number in the brackets is the 1-based starting position. If
  16228.    it is omitted, or less than 1, it is treated as 1. If it is greater
  16229.    than the length of the string, an empty string is returned.
  16230.    
  16231.    The second number is the length of the desired substring. If the
  16232.    second number is omitted, is less than 0, or would be past the end of
  16233.    the string, then "through the end of the string" is assumed. If it is
  16234.    0, the empty string is returned.
  16235.    
  16236.    If the brackets are empty or omitted, the original string is returned.
  16237.    
  16238.    The starting position and length need not be literal numbers; they can
  16239.    also be variables, functions, arithmetic expressions, or even other
  16240.    \s() or \:() quantities; anything that evaluates to a number, for
  16241.    example:
  16242.    
  16243.   \s(block[1025:\fhex2n(\s(block[\%b:\%n+4]))/2])
  16244.  
  16245.    Syntactically, \m(name) and \s(name) differ only in that the sequence
  16246.    [*] at the end of the name (where * is any sequence of 0 or more
  16247.    characters) is treated as substring notation in \s(name), but is
  16248.    considered part of the name in \m(name) (to see why, see [624]Section
  16249.    7.10.9).
  16250.      _________________________________________________________________
  16251.    
  16252.   7.26. New WAIT Command Options
  16253.   
  16254.    The WAIT command has been extended to allow waiting for different
  16255.    kinds of things (formerly it only waited for modem signals). Now it
  16256.    also can wait for file events.
  16257.    
  16258.     7.26.1. Waiting for Modem Signals
  16259.     
  16260.    The previous syntax:
  16261.    
  16262.   WAIT time { CD, DSR, RTS, RI, ... }
  16263.  
  16264.    has changed to:
  16265.    
  16266.   WAIT time MODEM-SIGNALS { CD, DSR, RTS, RI, ... }
  16267.  
  16268.    However, the previous syntax is still accepted. The behavior is the
  16269.    same in either case.
  16270.      _________________________________________________________________
  16271.    
  16272.     7.26.2. Waiting for File Events
  16273.     
  16274.    The new WAIT option:
  16275.    
  16276.   WAIT time FILE { CREATION, DELETION, MODIFICATION } filename
  16277.  
  16278.    lets you tell Kermit to wait the given amount of time (or until the
  16279.    given time of day) for a file whose name is filename to be created,
  16280.    deleted, or modified, respectively. The filename may not contain
  16281.    wildcards. If the specified event does not occur within the time
  16282.    limit, or if WAIT CANCELLATION is ON and you interrupt from the
  16283.    keyboard before the time is up, the WAIT command fails. If the event
  16284.    is MODIFICATION and the file does not exist, the command fails.
  16285.    Otherwise, if the given event occurs within the time limit, the
  16286.    command succeeds. Examples:
  16287.    
  16288.    WAIT 600 FILE DELETION oofa.tmp
  16289.           Wait up to 10 minutes for file oofa.tmp to disappear.
  16290.           
  16291.    WAIT 23:59:59 FILE MOD orders.db
  16292.           Wait until just before midnight for the orders.db file to be
  16293.           changed.
  16294.           
  16295.    Example: Suppose you want to have the current copy of /etc/motd on
  16296.    your screen at all times, and you want to hear a bell whenever it
  16297.    changes:
  16298.    
  16299.   def \%f /etc/motd                      ; The file of interest.
  16300.   while 1 {                              ; Loop forever...
  16301.       cls                                ; Clear the screen.
  16302.       echo \%f: \v(date) \v(time)...     ; Print 2-line heading...
  16303.       echo
  16304.       if ( not exist \%f ) {             ; If file doesn't exist,
  16305.           echo \%f does not exist...     ; print message,
  16306.           wait 600 file creat \%f        ; and wait for it to appear.
  16307.           continue
  16308.       }
  16309.       beep                               ; Something new - beep.
  16310.       type /head:\v(rows-2) \%f          ; Display the file
  16311.       if fail exit 1 \%f: \ferrstring()  ; (checking for errors).
  16312.       wait 999 file mod \%f              ; Wait for it to change.
  16313.   }
  16314.  
  16315.    This notices when the file is created, deleted, or modified, and acts
  16316.    only then (or when you interrupt it with); the time shown in the
  16317.    heading is the time of the most recent event (including when the
  16318.    program started).
  16319.    
  16320.    See [625]Section 1.10, where the \v(kbchar) variable is explained.
  16321.    This lets you modify a loop like the one above to also accept
  16322.    single-character commands, which interrupt the WAIT, and dispatch
  16323.    accordingly. For example:
  16324.    
  16325.   wait 999 file mod \%f              ; Wait for the file to change.
  16326.   if defined \v(kbchar) {            ; Interrupted from keyboard?
  16327.       switch \v(kbchar) {            ; Handle the keystroke...
  16328.         :q, exit                     ; Q to Quit
  16329.         :h, echo blah blah, break    ; H for Help
  16330.         :default, beep, continue     ; Anything else beep and ignore
  16331.       }
  16332.   }
  16333.  
  16334.    This lets you write event-driven applications that wait for up to
  16335.    three events at once: a file or modem event, a timeout, and a
  16336.    keystroke.
  16337.      _________________________________________________________________
  16338.    
  16339.   7.27. Relaxed FOR and SWITCH Syntax
  16340.   
  16341.    For consistency with the extended IF and WHILE syntax, the FOR and
  16342.    SWITCH control lists may (but need not be) enclosed in parentheses:
  16343.    
  16344.   FOR ( \%i 1 \%n 1 ) { command-list... }
  16345.   SWITCH ( \%c ) { command-list... }
  16346.  
  16347.    In the FOR command, the increment item can be omitted if the control
  16348.    list is enclosed in parentheses, in which case the increment defaults
  16349.    appropriately to 1 or -1, depending on the values of the first two
  16350.    variables.
  16351.    
  16352.    As with IF, the parentheses around the FOR-command control list must
  16353.    be set off by spaces (in the SWITCH command, the spaces are not
  16354.    required since the SWITCH expression is a single arithmetic
  16355.    expression).
  16356.    
  16357.    Also, outer braces around the command list are supplied automatically
  16358.    if you omit them, e.g.:
  16359.    
  16360.   FOR ( \%i 1 %n 1 ) echo \%i
  16361.      _________________________________________________________________
  16362.    
  16363.   8. USING OTHER FILE TRANSFER PROTOCOLS
  16364.   
  16365.    In C-Kermit 7.0, alternative protocols can be selected using switches.
  16366.    Switches are described in [626]Section 1.5; the use of
  16367.    protocol-selection switches is described in [627]Section 4.7.1.
  16368.    Example:
  16369.    
  16370.   send /binary /protocol:zmodem x.tar.gz
  16371.  
  16372.    Note that file transfer recovery works only with Kermit and Zmodem
  16373.    protocols. With Zmodem, recovery can be initiated only by the sender.
  16374.    
  16375.    Only pre-1988 versions of the publicly-distributed sz/rz programs use
  16376.    Standard I/O; those released later than that do not use Standard I/O
  16377.    and therefore do not work with REDIRECT. However, Omen Technology does
  16378.    offer an up-to-date redirectable version called crzsz, which must be
  16379.    licensed for use:
  16380.    
  16381.      "Unix Crz and Csz support XMODEM, YMODEM, and ZMODEM transfers when
  16382.      called by dial-out programs such as Kermit and certain versions of
  16383.      cu(1). They are clients designed for this use.
  16384.      
  16385.      "Crz and Csz are Copyrighted shareware programs. Use of these
  16386.      programs beyond a brief evaluation period requires registration.
  16387.      Please print the "mailer.rz" file, fill out the form and return
  16388.      same with your registration."
  16389.      
  16390.    To use the crzsz programs as your external XYZMODEM programs in
  16391.    C-Kermit, follow the instructions in the book, but put a "c" before
  16392.    each command, e.g.:
  16393.    
  16394.   set protocol zmodem {csz %s} {csz -a %s} crz crz crz crz
  16395.  
  16396.    To use Zmodem protocol over Telnet or other non-transparent
  16397.    connections, you might need to add the -e (Escape) option:
  16398.    
  16399.   set protocol zmodem {csz -e %s} {csz -e -a %s} crz crz crz crz
  16400.      _________________________________________________________________
  16401.    
  16402.   9. COMMAND-LINE OPTIONS
  16403.   
  16404.   9.0. Extended-Format Command-Line Options
  16405.   
  16406.    Standard UNIX command line options are a single letter. C-Kermit has
  16407.    run out of letters, so new options are in a new extended format:
  16408.    
  16409.  --word[:arg]
  16410.  
  16411.    where a keyword (rather than a single letter) specifies the function,
  16412.    and if an argument is to be included, it is separated by a colon (or
  16413.    equal sign). Most of the new extended-format command-line options are
  16414.    only for use with the Internet Kermit Service Daemon; see the
  16415.    [628]IKSD Administration Guide for details. However, several of them
  16416.    are also general in nature:
  16417.    
  16418.    --nointerrupts
  16419.           Disables keyboard interrupts that are normally enabled, which
  16420.           are usually Ctrl-C (to interrupt a command) and Ctrl-Z (UNIX
  16421.           only, to suspend C-Kermit).
  16422.           
  16423.    --help
  16424.           Lists the extended command-line options that are available in
  16425.           your version of C-Kermit. If any options seem to be missing,
  16426.           that is because your copy of C-Kermit was built with
  16427.           compile-time options to deselect them.
  16428.           
  16429.    --helpfile:filename
  16430.           Specifies the name of a file to be displayed if the user types
  16431.           HELP (not followed by a specific command or topic), in place of
  16432.           the built-in top-level help text. The file need not fit on one
  16433.           screen; more-prompting is used if the file is more than one
  16434.           screen long if COMMAND MORE-PROMPTING is ON, as it is by
  16435.           default.
  16436.           
  16437.    --bannerfile:filename
  16438.           The name of a file containing a message to be printed after the
  16439.           user logs in, in place of the normal message (Copyright notice,
  16440.           "Type HELP or ? for help", "Default transfer mode is...", etc).
  16441.           
  16442.    --cdmessage:{on,off,0,1,2}
  16443.           For use in the Server-Side Server configuration; whenever the
  16444.           client tells the server to change directory, the server sends
  16445.           the contents of a "read me" file to the client's screen. This
  16446.           feature is On by default, and operates only in client/server
  16447.           mode when ON or 1. If set to 2 or higher, it also operates when
  16448.           the CD command is given at the IKSD> prompt. Synonym: --cdmsg.
  16449.           
  16450.    --cdfile:filename
  16451.           When cdmessage is on, this is the name of the "read me" file to
  16452.           be sent. Normally you would specify a relative (not absolute)
  16453.           name, since the file is opened using the literal name you
  16454.           specified, after changing to the new directory. Example:
  16455.           
  16456.   --cdfile:READ.ME
  16457.  
  16458.           You can also give a list of up to 8 filenames by (a) enclosing
  16459.           each filename in braces, and (b) enclosing the entire list in
  16460.           braces. Example:
  16461.           --cdfile:{{./.readme}{READ.ME}{aaareadme.txt}{README}{read-this
  16462.           -first}} When a list is given, it is searched from left to
  16463.           right and the first file found is displayed. The default list
  16464.           for UNIX is:
  16465.           
  16466.   {{./.readme}{README.TXT}{READ.ME}}
  16467.      _________________________________________________________________
  16468.    
  16469.   9.1. Command Line Personalities
  16470.   
  16471.    Beginning in version 7.0, if the C-Kermit binary is renamed to
  16472.    "telnet" (or TELNET.EXE, telnet.pr, etc, depending on the platform),
  16473.    it accepts the Telnet command line:
  16474.    
  16475.   telnet [ host [ port ] ]
  16476.  
  16477.    In Unix, you can achieve the same effect with a symlink:
  16478.    
  16479.   cd /usr/bin
  16480.   mv telnet oldtelnet
  16481.   ln -ls /usr/local/bin/kermit telnet
  16482.  
  16483.    When installed in this manner, C-Kermit always reads its
  16484.    initialization file. If no host (and therefore no port) is given,
  16485.    C-Kermit starts in interactive prompting mode. If a host is given as
  16486.    the first command-line argument, C-Kermit makes a connection to it.
  16487.    The host argument can be an IP host name or address, or the name of a
  16488.    TCP/IP entry in your C-Kermit network directory.
  16489.    
  16490.    If a port is given, it is used. If a port is not given, then if the
  16491.    hostname was found in your network directory and port was also listed
  16492.    there, then that port is used. Otherwise port 23 (the Telnet port) is
  16493.    used.
  16494.    
  16495.    When C-Kermit is called "telnet" and it is invoked with a hostname on
  16496.    the command line, it exits automatically when the connection is
  16497.    closed. While the connection is open, however, you may escape back and
  16498.    forth as many times as you like, transfer files, etc.
  16499.    
  16500.    An rlogin personality is also available, but it is less useful, at
  16501.    least in UNIX and VMS, where the Rlogin TCP port is privileged.
  16502.    
  16503.    The new variable \v(name) indicates the name with which C-Kermit was
  16504.    invoked ("kermit", "wermit", "k95", "telnet", etc).
  16505.      _________________________________________________________________
  16506.    
  16507.   9.2. Built-in Help for Command Line Options
  16508.   
  16509.    "kermit -h", given from the system prompt, lists as many command-line
  16510.    options as will fit on a standard 24x80 screen. For more comprehensive
  16511.    help, use the interactive HELP OPTIONS command that was added in
  16512.    C-Kermit 7.0:
  16513.    
  16514.    HELP OPTIONS
  16515.    Explains how command-line options work, their syntax, etc.
  16516.    
  16517.    HELP OPTIONS ALL
  16518.    Lists all command-line options and gives brief help about each one.
  16519.    
  16520.    HELP OPTION x
  16521.    Gives brief help about option "x".
  16522.    
  16523.    HELP EXTENDED-OPTIONS
  16524.    Lists the available extended-format command-line options.
  16525.    
  16526.    HELP EXTENDED-OPTION xxx
  16527.    Gives help for the specified extended option.
  16528.      _________________________________________________________________
  16529.    
  16530.   9.3. New Command-Line Options
  16531.   
  16532.    Command-line options added since C-Kermit 6.0 are:
  16533.    
  16534.    +
  16535.           (plus sign by itself): The next argument is the name of a
  16536.           script to execute; all subsequent arguments are ignored by
  16537.           C-Kermit itself, but passed to the script as top-level copies
  16538.           of \%1, \%2, etc; the \&_[] is also set accordingly. \%0 and
  16539.           \&_[0] become the name of the script file, rather than the
  16540.           pathname of the C-Kermit program, which is its normal value.
  16541.           Primarily for use in the top line of "Kerbang" scripts in UNIX
  16542.           (see [629]Section 7.19). Example from UNIX command line:
  16543.           
  16544.   $ kermit [ regular kermit args ] + filename
  16545.  
  16546.           Sample first line of Kerbang script:
  16547.           
  16548.   #!/usr/local/bin/kermit +
  16549.  
  16550.    --
  16551.           (two hyphens surrounded by whitespace) Equivalent to "=", for
  16552.           compatibility with UNIX getopt(1,3).
  16553.           
  16554.    -G
  16555.           GET (like -g), but send the incoming file to standard output.
  16556.           Example: "kermit -G oofa.txt | lpr" retrieves a file from your
  16557.           local computer (providing it is running a Kermit program that
  16558.           supports the autodownload feature and has it enabled) and
  16559.           prints it.
  16560.           
  16561.    -O
  16562.           equivalent to -x (start up in server mode), but exits after the
  16563.           first client command has been executed (mnemonic: O = Only
  16564.           One). This one is handy replacing "kermit -x" in the
  16565.           "automatically start Kermit on the other end" string:
  16566.           
  16567.   set protocol kermit {kermit -ir} {kermit -r} {kermit -x}
  16568.  
  16569.           since -x leaves the remote Kermit in server mode after the
  16570.           transfer, which can be confusing, whereas -O makes it go away
  16571.           automatically after the transfer.
  16572.           
  16573.    -L
  16574.           Recursive, when used in combination with -s (mnemonic: L =
  16575.           Levels). In UNIX or other environments where the shell expands
  16576.           wildcards itself, the -s argument, if it contains wildcards,
  16577.           must be quoted to prevent this, e.g.:
  16578.           
  16579.   kermit -L -s "*.c"
  16580.  
  16581.           In UNIX only, "kermit -L -s ." means to send the current
  16582.           directory tree. See [630]Sections 4.10 and [631]4.11 about
  16583.           recursive file transfer.
  16584.           
  16585.    -V
  16586.           Equivalent to SET FILE PATTERNS OFF ([632]Section 4.3) and SET
  16587.           TRANSFER MODE MANUAL. In other words, take the FILE TYPE
  16588.           setting literally. For example, "kermit -VT oofa.bin" means
  16589.           send the file in Text mode, no matter what its name is and no
  16590.           matter whether a kindred spirit is recognized at the other end
  16591.           of the connection.
  16592.           
  16593.    -0
  16594.           (digit zero) means "be 100% transparent in CONNECT mode". This
  16595.           is equivalent to the following series of commands: SET PARITY
  16596.           NONE, SET COMMAND BYTESIZE 8, SET TERMINAL BYTESIZE 8, SET FLOW
  16597.           NONE, SET TERM ESCAPE DISABLED, SET TERM CHAR TRANSPARENT, SET
  16598.           TERM AUTODOWNLOAD OFF, SET TERM APC OFF, SET TELOPT KERMIT
  16599.           REFUSE REFUSE.
  16600.      _________________________________________________________________
  16601.    
  16602.   10. C-KERMIT AND G-KERMIT
  16603.   
  16604.    Every multifunctioned and long-lived software program grows in
  16605.    complexity and size over time to meet the needs and requests of its
  16606.    users and the demands of the underlying technology as it changes.
  16607.    
  16608.    Eventually users begin to notice how big the application has grown,
  16609.    how much disk space it occupies, how long it takes to load, and they
  16610.    start to long for the good old days when it was lean and mean. Not
  16611.    long after that they begin asking for a "light" version that only does
  16612.    the basics with no frills.
  16613.    
  16614.    And so it is with C-Kermit. A "light" version of Kermit was released
  16615.    (for UNIX only) in December 1999 under the GNU General Public License;
  16616.    thus it is called G-Kermit (for GNU Kermit). All it does is send and
  16617.    receive files, period. You can find it at:
  16618.    
  16619.   [633]http://www.columbia.edu/kermit/gkermit.html
  16620.  
  16621.    Where the C-Kermit 7.0 binary might be anywhere from 1 to 3 million
  16622.    bytes in size, the G-Kermit binary ranges from 30K to 100K, depending
  16623.    on the underlying architecture (RISC vs CISC, etc).
  16624.    
  16625.    G-Kermit and C-Kermit may reside side-by-side on the same computer.
  16626.    G-Kermit does not make connections; it does not have a script
  16627.    language; it does not translate character sets. G-Kermit may be used
  16628.    instead of C-Kermit when:
  16629.    
  16630.      * It is on the remote end.
  16631.      * Files are to be transferred in binary mode or in text mode without
  16632.        character-set translation.
  16633.      * File timestamps don't need to be preserved.
  16634.        
  16635.    In such cases G-Kermit might be preferred since it generally starts up
  16636.    faster, and yet transfers files just as fast on most (but not
  16637.    necessarily all) kinds of connections; for example, it supports
  16638.    streaming ([634]Section 4.20).
  16639.    
  16640.    G-Kermit is also handy for bootstrapping. It is easier to load on a
  16641.    new computer than C-Kermit -- it fits on a floppy diskette with plenty
  16642.    of room to spare. Thus if you have (say) an old PC running (say) SCO
  16643.    Xenix and no network connection, you can download the Xenix version of
  16644.    G-Kermit to (say) a DOS or Windows PC, copy it to diskette, read the
  16645.    diskette on Xenix with "dosread", and then use G-Kermit to receive
  16646.    C-Kermit (which does not fit on a diskette). If diskettes aren't an
  16647.    option, other bootstrapping methods are possible too -- see the
  16648.    [635]G-Kermit web page for details.
  16649.      _________________________________________________________________
  16650.    
  16651. III. APPENDICES
  16652.  
  16653.   III.1. Character Set Tables
  16654.   
  16655.     III.1.1. The Hewlett Packard Roman8 Character Set
  16656.     
  16657. dec col/row oct hex  description
  16658. 160  10/00  240  A0  (Undefined)
  16659. 161  10/01  241  A1  A grave
  16660. 162  10/02  242  A2  A circumflex
  16661. 163  10/03  243  A3  E grave
  16662. 164  10/04  244  A4  E circumflex
  16663. 165  10/05  245  A5  E diaeresis
  16664. 166  10/06  246  A6  I circumflex
  16665. 167  10/07  247  A7  I diaeresis
  16666. 168  10/08  250  A8  Acute accent
  16667. 169  10/09  251  A9  Grave accent
  16668. 170  10/10  252  AA  Circumflex accent
  16669. 171  10/11  253  AB  Diaeresis
  16670. 172  10/12  254  AC  Tilde accent
  16671. 173  10/13  255  AD  U grave
  16672. 174  10/14  256  AE  U circumflex
  16673. 175  10/15  257  AF  Lira symbol
  16674. 176  11/00  260  B0  Top bar (macron)
  16675. 177  11/01  261  B1  Y acute
  16676. 178  11/02  262  B2  y acute
  16677. 179  11/03  263  B3  Degree Sign
  16678. 180  11/04  264  B4  C cedilla
  16679. 181  11/05  265  B5  c cedilla
  16680. 182  11/06  266  B6  N tilde
  16681. 183  11/07  267  B7  n tilde
  16682. 184  11/08  270  B8  Inverted exclamation mark
  16683. 185  11/09  271  B9  Inverted question mark
  16684. 186  11/10  272  BA  Currency symbol
  16685. 187  11/11  273  BB  Pound sterling symbol
  16686. 188  11/12  274  BC  Yen symbol
  16687. 189  11/13  275  BD  Paragraph
  16688. 190  11/14  276  BE  Florin (Guilder) symbol
  16689. 191  11/15  277  BF  Cent symbol
  16690. 192  12/00  300  C0  a circumflex
  16691. 193  12/01  301  C1  e circumflex
  16692. 194  12/02  302  C2  o circumflex
  16693. 195  12/03  303  C3  u circumflex
  16694. 196  12/04  304  C4  a acute
  16695. 197  12/05  305  C5  e acute
  16696. 198  12/06  306  C6  o acute
  16697. 199  12/07  307  C7  u acute
  16698. 200  12/08  310  C8  a grave
  16699. 201  12/09  311  C9  e grave
  16700. 202  12/10  312  CA  o grave
  16701. 203  12/11  313  CB  u grave
  16702. 204  12/12  314  CC  a diaeresis
  16703. 205  12/13  315  CD  e diaeresis
  16704. 206  12/14  316  CE  o diaeresis
  16705. 207  12/15  317  CF  u diaeresis
  16706. 208  13/00  320  D0  A ring
  16707. 209  13/01  321  D1  i circumflex
  16708. 210  13/02  322  D2  O with stroke
  16709. 211  13/03  323  D3  AE digraph
  16710. 212  13/04  324  D4  a ring
  16711. 213  13/05  325  D5  i acute
  16712. 214  13/06  326  D6  o with stroke
  16713. 215  13/07  327  D7  ae digraph
  16714. 216  13/08  330  D8  A diaeresis
  16715. 217  13/09  331  D9  i grave
  16716. 218  13/10  332  DA  O diaeresis
  16717. 219  13/11  333  DB  U diaeresis
  16718. 220  13/12  334  DC  E acute
  16719. 221  13/13  335  DD  i diaeresis
  16720. 222  13/14  336  DE  German sharp s
  16721. 223  13/15  337  DF  O circumflex
  16722. 224  14/00  340  E0  A acute
  16723. 225  14/01  341  E1  A tilde
  16724. 226  14/02  342  E2  a tilde
  16725. 227  14/03  343  E3  Icelandic Eth
  16726. 228  14/04  344  E4  Icelandic eth
  16727. 229  14/05  345  E5  I acute
  16728. 230  14/06  346  E6  I grave
  16729. 231  14/07  347  E7  O acute
  16730. 232  14/08  350  E8  O grave
  16731. 233  14/09  351  E9  O tilde
  16732. 234  14/10  352  EA  o tilde
  16733. 235  14/11  353  EB  S caron
  16734. 236  14/12  354  EC  s caron
  16735. 237  14/13  355  ED  U acute
  16736. 238  14/14  356  EE  Y diaeresis
  16737. 239  14/15  357  EF  y diaeresis
  16738. 240  15/00  360  F0  Icelandic Thorn
  16739. 241  15/01  361  F1  Icelandic thorn
  16740. 242  15/02  362  F2  Middle dot
  16741. 243  15/03  363  F3  Greek mu
  16742. 244  15/04  364  F4  Pilcrow sign
  16743. 245  15/05  365  F5  Fraction 3/4
  16744. 246  15/06  366  F6  Long dash, horizontal bar
  16745. 247  15/07  367  F7  Fraction 1/4
  16746. 248  15/08  370  F8  Fraction 1/2
  16747. 249  15/09  371  F9  Feminine ordinal
  16748. 250  15/10  372  FA  Masculine ordinal
  16749. 251  15/11  373  FB  Left guillemot
  16750. 252  15/12  374  FC  Solid box
  16751. 253  15/13  375  FD  Right guillemot
  16752. 254  15/14  376  FE  Plus or minus sign
  16753. 255  15/15  377  FF  (Undefined)
  16754.      _________________________________________________________________
  16755.    
  16756.     III.1.2. Greek Character Sets
  16757.     
  16758.     III.1.2.1. The ISO 8859-7 Latin / Greek Alphabet = ELOT 928
  16759.     
  16760. dec col/row oct hex  description
  16761. 160  10/00  240  A0  No-break space
  16762. 161  10/01  241  A1  Left single quotation mark
  16763. 162  10/02  242  A2  right single quotation mark
  16764. 163  10/03  243  A3  Pound sign
  16765. 164  10/04  244  A4  (UNUSED)
  16766. 165  10/05  245  A5  (UNUSED)
  16767. 166  10/06  246  A6  Broken bar
  16768. 167  10/07  247  A7  Paragraph sign
  16769. 168  10/08  250  A8  Diaeresis (Dialytika)
  16770. 169  10/09  251  A9  Copyright sign
  16771. 170  10/10  252  AA  (UNUSED)
  16772. 171  10/11  253  AB  Left angle quotation
  16773. 172  10/12  254  AC  Not sign
  16774. 173  10/13  255  AD  Soft hyphen
  16775. 174  10/14  256  AE  (UNUSED)
  16776. 175  10/15  257  AF  Horizontal bar (Parenthetiki pavla)
  16777. 176  11/00  260  B0  Degree sign
  16778. 177  11/01  261  B1  Plus-minus sign
  16779. 178  11/02  262  B2  Superscript two
  16780. 179  11/03  263  B3  Superscript three
  16781. 180  11/04  264  B4  Accent (tonos)
  16782. 181  11/05  265  B5  Diaeresis and accent (Dialytika and Tonos)
  16783. 182  11/06  266  B6  Alpha with accent
  16784. 183  11/07  267  B7  Middle dot (Ano Teleia)
  16785. 184  11/08  270  B8  Epsilon with accent
  16786. 185  11/09  271  B9  Eta with accent
  16787. 186  11/10  272  BA  Iota with accent
  16788. 187  11/11  273  BB  Right angle quotation
  16789. 188  11/12  274  BC  Omicron with accent
  16790. 189  11/13  275  BD  One half
  16791. 190  11/14  276  BE  Upsilon with accent
  16792. 191  11/15  277  BF  Omega with accent
  16793. 192  12/00  300  C0  iota with diaeresis and accent
  16794. 193  12/01  301  C1  Alpha
  16795. 194  12/02  302  C2  Beta
  16796. 195  12/03  303  C3  Gamma
  16797. 196  12/04  304  C4  Delta
  16798. 197  12/05  305  C5  Epsilon
  16799. 198  12/06  306  C6  Zeta
  16800. 199  12/07  307  C7  Eta
  16801. 200  12/08  310  C8  Theta
  16802. 201  12/09  311  C9  Iota
  16803. 202  12/10  312  CA  Kappa
  16804. 203  12/11  313  CB  Lamda
  16805. 204  12/12  314  CC  Mu
  16806. 205  12/13  315  CD  Nu
  16807. 206  12/14  316  CE  Ksi
  16808. 207  12/15  317  CF  Omicron
  16809. 208  13/00  320  D0  Pi
  16810. 209  13/01  321  D1  Rho
  16811. 210  13/02  322  D2  (UNUSED)
  16812. 211  13/03  323  D3  Sigma
  16813. 212  13/04  324  D4  Tau
  16814. 213  13/05  325  D5  Upsilon
  16815. 214  13/06  326  D6  Phi
  16816. 215  13/07  327  D7  Khi
  16817. 216  13/08  330  D8  Psi
  16818. 217  13/09  331  D9  Omega
  16819. 218  13/10  332  DA  Iota with diaeresis
  16820. 219  13/11  333  DB  Upsilon with diaeresis
  16821. 220  13/12  334  DC  alpha with accent
  16822. 221  13/13  335  DD  epsilon with accent
  16823. 222  13/14  336  DE  eta with accent
  16824. 223  13/15  337  DF  iota with accent
  16825. 224  14/00  340  E0  upsilon with diaeresis and accent
  16826. 225  14/01  341  E1  alpha
  16827. 226  14/02  342  E2  beta
  16828. 227  14/03  343  E3  gamma
  16829. 228  14/04  344  E4  delta
  16830. 229  14/05  345  E5  epsilon
  16831. 230  14/06  346  E6  zeta
  16832. 231  14/07  347  E7  eta
  16833. 232  14/08  350  E8  theta
  16834. 233  14/09  351  E9  iota
  16835. 234  14/10  352  EA  kappa
  16836. 235  14/11  353  EB  lamda
  16837. 236  14/12  354  EC  mu
  16838. 237  14/13  355  ED  nu
  16839. 238  14/14  356  EE  ksi
  16840. 239  14/15  357  EF  omicron
  16841. 240  15/00  360  F0  pi
  16842. 241  15/01  361  F1  rho
  16843. 242  15/02  362  F2  terminal sigma
  16844. 243  15/03  363  F3  sigma
  16845. 244  15/04  364  F4  tau
  16846. 245  15/05  365  F5  upsilon
  16847. 246  15/06  366  F6  phi
  16848. 247  15/07  367  F7  khi
  16849. 248  15/08  370  F8  psi
  16850. 249  15/09  371  F9  omega
  16851. 250  15/10  372  FA  iota with diaeresis
  16852. 251  15/11  373  FB  upsilon with diaeresis
  16853. 252  15/12  374  FC  omicron with diaeresis
  16854. 253  15/13  375  FD  upsilon with accent
  16855. 254  15/14  376  FE  omega with accent
  16856. 255  15/15  377  FF  (UNUSED)
  16857.      _________________________________________________________________
  16858.    
  16859.     III.1.2.2. The ELOT 927 Character Set
  16860.     
  16861. dec col/row oct hex  description
  16862.  32  02/00   40  20  SPACE
  16863.  33  02/01   41  21  EXCLAMATION MARK
  16864.  34  02/02   42  22  QUOTATION MARK
  16865.  35  02/03   43  23  NUMBER SIGN
  16866.  36  02/04   44  24  DOLLAR SIGN
  16867.  37  02/05   45  25  PERCENT SIGN
  16868.  38  02/06   46  26  AMPERSAND
  16869.  39  02/07   47  27  APOSTROPHE
  16870.  40  02/08   50  28  LEFT PARENTHESIS
  16871.  41  02/09   51  29  RIGHT PARENTHESIS
  16872.  42  02/10   52  2A  ASTERISK
  16873.  43  02/11   53  2B  PLUS SIGN
  16874.  44  02/12   54  2C  COMMA
  16875.  45  02/13   55  2D  HYPHEN, MINUS SIGN
  16876.  46  02/14   56  2E  PERIOD, FULL STOP
  16877.  47  02/15   57  2F  SOLIDUS, SLASH
  16878.  48  03/00   60  30  DIGIT ZERO
  16879.  49  03/01   61  31  DIGIT ONE
  16880.  50  03/02   62  32  DIGIT TWO
  16881.  51  03/03   63  33  DIGIT THREE
  16882.  52  03/04   64  34  DIGIT FOUR
  16883.  53  03/05   65  35  DIGIT FIVE
  16884.  54  03/06   66  36  DIGIT SIX
  16885.  55  03/07   67  37  DIGIT SEVEN
  16886.  56  03/08   70  38  DIGIT EIGHT
  16887.  57  03/09   71  39  DIGIT NINE
  16888.  58  03/10   72  3A  COLON
  16889.  59  03/11   73  3B  SEMICOLON
  16890.  60  03/12   74  3C  LESS-THAN SIGN, LEFT ANGLE BRACKET
  16891.  61  03/13   75  3D  EQUALS SIGN
  16892.  62  03/14   76  3E  GREATER-THAN SIGN, RIGHT ANGLE BRACKET
  16893.  63  03/15   77  3F  QUESTION MARK
  16894.  64  04/00  100  40  COMMERCIAL AT SIGN
  16895.  65  04/01  101  41  CAPITAL LETTER A
  16896.  66  04/02  102  42  CAPITAL LETTER B
  16897.  67  04/03  103  43  CAPITAL LETTER C
  16898.  68  04/04  104  44  CAPITAL LETTER D
  16899.  69  04/05  105  45  CAPITAL LETTER E
  16900.  70  04/06  106  46  CAPITAL LETTER F
  16901.  71  04/07  107  47  CAPITAL LETTER G
  16902.  72  04/08  110  48  CAPITAL LETTER H
  16903.  73  04/09  111  49  CAPITAL LETTER I
  16904.  74  04/10  112  4A  CAPITAL LETTER J
  16905.  75  04/11  113  4B  CAPITAL LETTER K
  16906.  76  04/12  114  4C  CAPITAL LETTER L
  16907.  77  04/13  115  4D  CAPITAL LETTER M
  16908.  78  04/14  116  4E  CAPITAL LETTER N
  16909.  79  04/15  117  4F  CAPITAL LETTER O
  16910.  80  05/00  120  50  CAPITAL LETTER P
  16911.  81  05/01  121  51  CAPITAL LETTER Q
  16912.  82  05/02  122  52  CAPITAL LETTER R
  16913.  83  05/03  123  53  CAPITAL LETTER S
  16914.  84  05/04  124  54  CAPITAL LETTER T
  16915.  85  05/05  125  55  CAPITAL LETTER U
  16916.  86  05/06  126  56  CAPITAL LETTER V
  16917.  87  05/07  127  57  CAPITAL LETTER W
  16918.  88  05/08  130  58  CAPITAL LETTER X
  16919.  89  05/09  131  59  CAPITAL LETTER Y
  16920.  90  05/10  132  5A  CAPITAL LETTER Z
  16921.  91  05/11  133  5B  LEFT SQUARE BRACKET
  16922.  92  05/12  134  5C  REVERSE SOLIDUS, BACKSLASH
  16923.  93  05/13  135  5D  RIGHT SQUARE BRACKET
  16924.  94  05/14  136  5E  CIRCUMFLEX ACCENT
  16925.  95  05/15  137  5F  UNDERSCORE
  16926.  96  06/00  140  60  ACCENT GRAVE
  16927.  97  06/01  141  61  GREEK LETTER ALPHA
  16928.  98  06/02  142  62  GREEK LETTER BETA
  16929.  99  06/03  143  63  GREEK LETTER GAMMA
  16930. 100  06/04  144  64  GREEK LETTER DELTA
  16931. 101  06/05  145  65  GREEK LETTER EPSILON
  16932. 102  06/06  146  66  GREEK LETTER ZETA
  16933. 103  06/07  147  67  GREEK LETTER ETA
  16934. 104  06/08  150  68  GREEK LETTER THETA
  16935. 105  06/09  151  69  GREEK LETTER IOTA
  16936. 106  06/10  152  6A  GREEK LETTER KAPPA
  16937. 107  06/11  153  6B  GREEK LETTER LAMDA
  16938. 108  06/12  154  6C  GREEK LETTER MU
  16939. 109  06/13  155  6D  GREEK LETTER NU
  16940. 110  06/14  156  6E  GREEK LETTER KSI
  16941. 111  06/15  157  6F  GREEK LETTER OMICRON
  16942. 112  07/00  160  70  GREEK LETTER PI
  16943. 113  07/01  161  71  GREEK LETTER RHO
  16944. 114  07/02  162  72  GREEK LETTER SIGMA
  16945. 115  07/03  163  73  GREEK LETTER TAU
  16946. 116  07/04  164  74  GREEK LETTER UPSILON
  16947. 117  07/05  165  75  GREEK LETTER FI
  16948. 118  07/06  166  76  GREEK LETTER XI
  16949. 119  07/07  167  77  GREEK LETTER PSI
  16950. 120  07/08  170  78  GREEK LETTER OMEGA
  16951. 121  07/09  171  79  SPACE
  16952. 122  07/10  172  7A  SPACE
  16953. 123  07/11  173  7B  LEFT CURLY BRACKET, LEFT BRACE
  16954. 124  07/12  174  7C  VERTICAL LINE, VERTICAL BAR
  16955. 125  07/13  175  7D  RIGHT CURLY BRACKET, RIGHT BRACE
  16956. 126  07/14  176  7E  TILDE
  16957. 127  07/15  177  7F  RUBOUT, DELETE
  16958.      _________________________________________________________________
  16959.    
  16960.     III.1.2.3. PC Code Page 869
  16961.     
  16962.    (to be filled in...)
  16963.      _________________________________________________________________
  16964.    
  16965.     III.2. Updated Country Codes
  16966.     
  16967.    Date: Mon, 7 Apr 1997 23:23:49 EDT
  16968.    From: Dave Leibold <dleibold@else.net>
  16969.    Newsgroups: comp.dcom.telecom
  16970.    Subject: Ex-USSR Country Codes Profile
  16971.    Organization: TELECOM Digest
  16972.    
  16973.    Ex-USSR Country Codes Profile
  16974.    4 April 1997
  16975.    
  16976.    Below is a summary of the country codes that have formed in the wake
  16977.    of the USSR dissolution, along with some updated findings and reports.
  16978.    Additional or corrected information on any of these nations would be
  16979.    welcome (c/o dleibold@else.net).
  16980.      * Kyrgyz Republic country code 996 will take effect, at least in
  16981.        Canada, effective 1 May 1997, according to CRTC Telecom Order
  16982.        97-464, based on Stentor Tariff Notice 433. There is no indication
  16983.        whether there will be a permissive dialing period involved or for
  16984.        how long such a permissive operation would remain.
  16985.      * Country code 992 was reported as a recent assignment for
  16986.        Tajikistan, which will be moving from country code 7 at some
  16987.        unknown time.
  16988.      * Uzbekistan has its own country code assignment, but I have no
  16989.        information if this is in service yet or what implementation dates
  16990.        have been set.
  16991.      * Kazakstan does not have a known separate country code assignment
  16992.        at present. It remains in country code 7 for the time being.
  16993.      * Russia seems destined to keep country code 7.
  16994.      * Recent news reports speak of some agreements forming between
  16995.        Russia and Belarus. While there is no outright reunification yet,
  16996.        there is expected to be much closer ties between the two nations.
  16997.        Whether this will lead to a reunification of telephone codes
  16998.        remains to be seen.
  16999.        
  17000.    In the table, "Effective" means the date at which the country code
  17001.    began service (which could vary according to the nation). "Mandatory"
  17002.    means the date at which the country code 7 is invalid for calls to
  17003.    that nation. There are a number of question marks since exact dates
  17004.    have not been collected in all cases.
  17005.    
  17006. CC  Nation            Effective     Mandatory    Notes
  17007.  
  17008. 370 Lithuania         1993?         ???          Announced Jan 1993
  17009. 371 Latvia            1993?         ???
  17010. 372 Estonia           1 Feb 1993?   March 1993?
  17011. 373 Moldova           1993?         ???          Announced Jan 1993
  17012. 374 Armenia           1 May 1995    1 July 1995  Announced Jan 1995 (ITU)
  17013. 375 Belarus           16 Apr 1995   1997?
  17014. 380 Ukraine           16 Apr 1995   Oct 1995?
  17015. 7   Kazakstan         (no known changes)
  17016. 7   Russia            (presumably not changing)
  17017. 992 Tajikistan        ???           ???          Announced 1996-7?
  17018. 993 Turkmenistan      3 Jan 1997    3 Apr 1997   Canada as of 29 Nov 1996
  17019. 994 Azerbaijan        Sept 1994?    ???          Announced 1992
  17020. 995 Georgia           1994?         ???          ref: Telecom Digest Oct 1994
  17021. 996 Kyrgyz Republic   1 May 1997    ???          ref: Stentor Canada/CRTC
  17022. 998 Uzbekistan        ???           ???          Announced 1996? (ITU)
  17023.  
  17024.    Details courtesy Toby Nixon, ITU, Stentor (Canada), CRTC (Canada),
  17025.    TELECOM Digest (including information collected for the country code
  17026.    listings).
  17027.      _________________________________________________________________
  17028.    
  17029. IV. ERRATA & CORRIGENDA
  17030.  
  17031.    The following errors in [636]Using C-Kermit, Second Edition, first
  17032.    printing, have been noted.
  17033.    
  17034.    First, some missing acknowledgements for C-Kermit 6.0: JE Jones of
  17035.    Microware for help with OS-9, Nigel Roles for his help with Plan 9,
  17036.    Lucas Hart for help with VMS and Digital UNIX, Igor Kovalenko for his
  17037.    help with QNX. And later, to Susan Kleinmann for her help with Debian
  17038.    Linux packaging; Patrick Volkerding for his help with Slackware Linux
  17039.    packaging; Jim Knoble for his help with Red Hat Linux packaging; and
  17040.    to dozens of others for sending individual C-Kermit binaries for
  17041.    varied and diverse platforms.
  17042.    
  17043.    Thanks to James Spath for both binaries and reporting many of the
  17044.    typos noted below. Also to Dat Thuc Nguyen for spotting several typos.
  17045.    
  17046. PAGE    REMARKS
  17047. COVER   "COS" is a misprint.  There is no COS.  Pretend it says "SCO" or "VOS".
  17048.         (This is fixed in the second printing.)
  17049.  xxi    Second line: Fred Smith's affiliation should be Computrition.
  17050.  83     Change "commands other" to "commands as other" (1st paragraph)
  17051.  87     Change "The the" to "The" (2nd paragraph)
  17052.  92     "set modem-type user-defined supra" should be "set modem type ..."
  17053.  95     Change "VI" to "vi" (1st paragraph)
  17054.  96     Change "it it" to "it is" (1st paragraph)
  17055.  97     Change "advantage a literal" to "advantage of a literal" (2nd
  17056.         paragraph)
  17057. 102     The call-waiting example would be better as SET DIAL PREFIX *70W
  17058.         (rather than "*70,") because the former will not cause an incorrect
  17059.         call to be placed with pulse dialing.
  17060. 123     Third paragraph from bottom: "..otherwise if a your local username.."
  17061.         should be "..otherwise your local username..".
  17062. 160     Delete the "it" between "and" and "to" (2nd paragraph)
  17063. 185     In "When TRANSFER DISPLAY is OFF, C-Kermit skips the display...",
  17064.         "OFF" should be "NONE".
  17065. 187     The last paragraph says the "A command" is ignored, should be "S".
  17066. 194     Change "it known" to "it is known" (4th paragraph).
  17067. 235     In C-Kermit 7.0, the syntax of the GET command changed.  MGET now
  17068.         must be used to get a list of files and there is no more multiline
  17069.         GET command.
  17070. 268     Last paragraph: "effect" should be "affect".
  17071. 275     In the SET PROTOCOL KERMIT description, the following sentence is
  17072.         incorrect and should be removed: 'If you omit the commands, the
  17073.         default ones are restored: "kermit -ir" and "kermit -r" respectively".
  17074.         The correct information is given at the bottom of page 281.
  17075. 279     9th line.  The decimal value of ST is 156, not 155.
  17076. 295     In the stepping stones, skip ahead to Chapter 17 on p. 327.
  17077. 298     Table 16-2, Portuguese entry.  Column 4/00 should show section sign,
  17078.         not acute accent.
  17079. 316     Other languages written in the Hebrew alphabet include Karaim (a Turkic
  17080.         language spoken in Lithuania and Poland), Judeo-Kurdish, and Judeo-
  17081.         Georgian.
  17082. 332     UNDEFINE definition, change "This just" to "This is just".
  17083. 344     It might be necessary to set the modem's pulse generation rate when
  17084.         sending numeric pages; most Hayes compatible modems use the S11
  17085.         register for this.
  17086. 350     Delete "is" from between "It" and "ceases" (4th paragraph)
  17087. 351     Top - both occurrences of "print \%a" should be "echo \%a".
  17088. 364     \v(input) and \v(query) out of alphabetical order.
  17089. 378     In the MYSEND macro, "if not \m(rc) goto bad" should be:
  17090.         "if \m(rc) goto bad" (remove the "not").
  17091. 382-383 It should be stated that the loop control variable must be of the \%a
  17092.         type, or else an array element; macro names can not be used for this.
  17093. 383     In line 3, "\%f[\%i]" should be "\&f[\%i]".
  17094. 383     In the sort example, it should be stated that the array is 1-based.
  17095. 387     Change "You can list" to "You can get a list" (5th paragraph)
  17096. 393     \Fverify() description.  The 3rd sentence could be stated more clearly
  17097.         as "If all characters in string2 are also in string1, 0 is returned."
  17098. 398     Copying \ffiles() results to an array before is not required as of
  17099.         C-Kermit 7.0 (see [637]Section 7.3).
  17100. 403     In "(\%a + 3) * (\%b  5)", a minus sign is missing between b and 5.
  17101. 407     C-Kermit 7.0 no longer supports multiline GET.  Change
  17102.         "get, \%1, \%2" to "get {\%1} {\%2}" or "get /as:{\%2} {\%1}".
  17103. 409     READ example while loop should be:
  17104.         while success { echo \m(line), read line }
  17105. 409     "WRITE file" should be "WRITE keyword" (you can't put a filename there)
  17106.         (The same applies to WRITE-LINE / WRITELN).
  17107. 414     \Funhexify() missing from Table 18-3.
  17108. 425     MINPUT definition, change 2nd "text2" to "text3".
  17109. 436     Several lines are missing from the UNIXLOGIN macro listing.
  17110.         After the "xif fail" block, insert:
  17111.  
  17112.           out \%1\13                    ; Send username, carriage return
  17113.           inp 5 Password:               ; Wait 5 sec for this prompt
  17114.           if fail end 1 No password prompt
  17115.           pause                         ; Wait a sec
  17116.           out \%2\13                    ; Send password
  17117.  
  17118. 440     Change "set terminal byteszie" to "set terminal bytesize".
  17119.         Change "input Password:" to "input 10 Password".
  17120. 448     Franchise script: "access line" should be "access \m(line)".
  17121. 453     There are two incorrectly coded IF statements in the DELIVER macro
  17122.         definition.  Replace both occurrences of "if > \%1 \%3 {" with
  17123.         "xif > \%i \%3 {" (replace "if" by "xif" and "\%1" with "\%i").
  17124. 453     "the the" (last paragraph) should be "the".
  17125. 454     EOT (last paragraph) is End of Transmission, not End of Text.
  17126. 457     _DEFINE definition: "name constructed" should be "name is constructed".
  17127. 457     "macro for and" (last paragraph) should be "macro and".
  17128. 459     Should explain that \v(user) is a legal abbreviation of \v(userid).
  17129. 480     Figure II-2 is backwards; the least-significant bit is transmitted
  17130.         first, then up to the highest, and the parity bit last.
  17131. 534     The VMS Appendix section on Odd Record Lengths no longer applies;
  17132.         C-Kermit 7.0 handles odd record lengths as well as even ones.
  17133. 559     Table VIII-3, Portuguese entry.  Column 4/00 should show section sign,
  17134.         not acute accent.
  17135. 560-563 HP-Roman8 missing from Table VII-4; there wasn't room to squeeze it in.
  17136.         It is listed in section II(6).
  17137. 565     "d stroke" in Table VII-5 has the wrong appearance; the stem should
  17138.         be upright.  The letter shown in the table is actually a lowercase
  17139.         Icelandic eth, which has a curved stem.
  17140. 601-604 BeBox, BeOS, Plan 9, and probably others not listed in trademarks.
  17141. 604     The words "SCRIBE TEXT FORMATTER" appear at the end of the last
  17142.         sentence of the first paragraph of the Colophon.  They should have
  17143.         been in the Index.
  17144. Index:  Missing entries: SET { SEND, RECEIVE } PATHNAMES, Call waiting, ...
  17145.         \F()            Page 605, add also 413-414
  17146.         \Fbreak         389
  17147.         \Fcapitalize    390
  17148.         \Fchecksum      414
  17149.         \Fcrc16         414
  17150.         \Fexecute       414
  17151.         \Fhexify        390
  17152.         \Fltrim         391
  17153.         \Frepeat        392
  17154.         \Fspawn         392
  17155.         \Ftod2secs      399
  17156.         \v() built_in   Page 606, add also 361-364
  17157.         \v(_line)       354, 361
  17158.         \v(apcactive)   361
  17159.         \v(charset)     362
  17160.         \v(cpu)         362
  17161.         \v(crc16)       357, 362
  17162.         \v(d$xxx)       add page 362
  17163.         \v(dialnumber)  362
  17164.         \v(dialresult)  362
  17165.         \v(errno)       362
  17166.         \v(errstring)   362
  17167.         \v(exedir)      362
  17168.         \v(inidir)      363
  17169.         \v(ipaddress)   363
  17170.         \v(keyboard)    363
  17171.         \v(macro)       363
  17172.         \v(minput)      363
  17173.         \v(m_xxx)       94, 363
  17174.         \v(password)    364
  17175.         \v(query)       364
  17176.         \v(prompt)      364
  17177.         \v(speed)       356, 364
  17178.         \v(startup)     364
  17179.         \v(status)      364
  17180.         \v(sysid)       364
  17181.         \v(system)      364
  17182.         \v(fsize)       at lower half page 606 should read \v(tfsize)
  17183.         \v(xversion)    364
  17184.         BEEP Command    40
  17185.         SET FLOW        62, 212
  17186.  
  17187.    Figure II-5 on page 493. The pin assignments of the Mini Din-8
  17188.    connector are not described anywhere. As noted in the text, these tend
  17189.    to vary from vendor to vendor. One common arrangement is:
  17190.    
  17191.   1. HSKout (Handshake out -- definition depends on software)
  17192.   2. HSKin  (Handshake in or external clock)
  17193.   3. TxD-
  17194.   4. Not used
  17195.   5. RxD-
  17196.   6. TxD+
  17197.   7. Not used
  17198.   8. RxD+
  17199.  
  17200.    Note the "balanced pairs" for Receive Data (RxD) and Transmit Data
  17201.    (TxD), and the utter lack of modem signals. These connectors follow
  17202.    the RS-423 standard, rather than RS-232. In some arrangements, Pin 1
  17203.    is used for DTR and Pin 2 for CD; in others Pin 1 is RTS and Pin 2 is
  17204.    CTS.
  17205.    
  17206.    Please send reports of other errors to the authors, as well as
  17207.    suggestions for improvements, additional index entries, and any other
  17208.    comments:
  17209.    
  17210.    [638]kermit@columbia.edu
  17211.      _________________________________________________________________
  17212.    
  17213. APPENDIX V. ADDITIONAL COPYRIGHT NOTICES
  17214.  
  17215.    The following copyrights cover some of the source code used in the
  17216.    development of C-Kermit, Kermit 95, or Kermit 95 support libraries.
  17217.    
  17218. /*****************************************************************************/
  17219. /*                                                                           */
  17220. /*              Copyright (c) 1995 by Oy Online Solutions Ltd.               */
  17221. /*                                                                           */
  17222. /*   Distribution of this source code is strictly forbbidden. Use of this    */
  17223. /*   source code is granted to the University of Columbia C-Kermit project   */
  17224. /*   to be distributed in binary format only. Please familiarize yourself    */
  17225. /*   with the accompanying LICENSE.P file.                                   */
  17226. /*                                                                           */
  17227. /*****************************************************************************/
  17228.  
  17229.    used for Xmodem, Ymodem, and Zmodem protocol in Kermit 95 (p95.dll,
  17230.    p2.dll)
  17231.      _________________________________________________________________
  17232.    
  17233.    Copyright (c) 1997 Stanford University
  17234.    
  17235.    The use of this software for revenue-generating purposes may require a
  17236.    license from the owners of the underlying intellectual property.
  17237.    Specifically, the SRP-3 protocol may not be used for
  17238.    revenue-generating purposes without a license.
  17239.    
  17240.    Within that constraint, permission to use, copy, modify, and
  17241.    distribute this software and its documentation for any purpose is
  17242.    hereby granted without fee, provided that the above copyright notices
  17243.    and this permission notice appear in all copies of the software and
  17244.    related documentation.
  17245.    
  17246.    THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  17247.    EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  17248.    WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  17249.    
  17250.    IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17251.    INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  17252.    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  17253.    ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  17254.    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  17255.    SOFTWARE.
  17256.    
  17257.    Used for Secure Remote Password (TM) protocol (SRP) in C-Kermit,
  17258.    Kermit 95 (k95.exe, k2.exe, k95crypt.dll, k2crypt.dll)
  17259.      _________________________________________________________________
  17260.    
  17261.    Copyright 1990 by the Massachusetts Institute of Technology. All
  17262.    Rights Reserved.
  17263.    
  17264.    Export of this software from the United States of America may require
  17265.    a specific license from the United States Government. It is the
  17266.    responsibility of any person or organization contemplating export to
  17267.    obtain such a license before exporting.
  17268.    
  17269.    WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
  17270.    distribute this software and its documentation for any purpose and
  17271.    without fee is hereby granted, provided that the above copyright
  17272.    notice appear in all copies and that both that copyright notice and
  17273.    this permission notice appear in supporting documentation, and that
  17274.    the name of M.I.T. not be used in advertising or publicity pertaining
  17275.    to distribution of the software without specific, written prior
  17276.    permission. M.I.T. makes no representations about the suitability of
  17277.    this software for any purpose. It is provided "as is" without express
  17278.    or implied warranty.
  17279.    
  17280.    Used for Telnet Authentication Option, Telnet Encryption Option, and
  17281.    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
  17282.    k95crypt.dll, k2crypt.dll)
  17283.      _________________________________________________________________
  17284.    
  17285.    Copyright (c) 1991, 1993 The Regents of the University of California.
  17286.    All rights reserved.
  17287.    
  17288.    Redistribution and use in source and binary forms, with or without
  17289.    modification, are permitted provided that the following conditions are
  17290.    met:
  17291.     1. Redistributions of source code must retain the above copyright
  17292.        notice, this list of conditions and the following disclaimer.
  17293.     2. Redistributions in binary form must reproduce the above copyright
  17294.        notice, this list of conditions and the following disclaimer in
  17295.        the documentation and/or other materials provided with the
  17296.        distribution.
  17297.     3. All advertising materials mentioning features or use of this
  17298.        software must display the following acknowledgement:
  17299.        
  17300.      This product includes software developed by the University of
  17301.      California, Berkeley and its contributors.
  17302.     4. Neither the name of the University nor the names of its
  17303.        contributors may be used to endorse or promote products derived
  17304.        from this software without specific prior written permission.
  17305.        
  17306.    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
  17307.    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  17308.    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  17309.    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
  17310.    BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  17311.    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  17312.    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  17313.    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  17314.    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  17315.    OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  17316.    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17317.    
  17318.    Used for Telnet Authentication Option, Telnet Encryption Option, and
  17319.    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
  17320.    k95crypt.dll, k2crypt.dll)
  17321.      _________________________________________________________________
  17322.    
  17323.    Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) All rights
  17324.    reserved.
  17325.    
  17326.    This package is an DES implementation written by Eric Young
  17327.    (eay@cryptsoft.com). The implementation was written so as to conform
  17328.    with MIT's libdes.
  17329.    
  17330.    This library is free for commercial and non-commercial use as long as
  17331.    the following conditions are aheared to. The following conditions
  17332.    apply to all code found in this distribution.
  17333.    
  17334.    Copyright remains Eric Young's, and as such any Copyright notices in
  17335.    the code are not to be removed. If this package is used in a product,
  17336.    Eric Young should be given attribution as the author of that the SSL
  17337.    library. This can be in the form of a textual message at program
  17338.    startup or in documentation (online or textual) provided with the
  17339.    package.
  17340.    
  17341.    Redistribution and use in source and binary forms, with or without
  17342.    modification, are permitted provided that the following conditions are
  17343.    met:
  17344.     1. Redistributions of source code must retain the copyright notice,
  17345.        this list of conditions and the following disclaimer.
  17346.     2. Redistributions in binary form must reproduce the above copyright
  17347.        notice, this list of conditions and the following disclaimer in
  17348.        the documentation and/or other materials provided with the
  17349.        distribution.
  17350.     3. All advertising materials mentioning features or use of this
  17351.        software must display the following acknowledgement: This product
  17352.        includes software developed by Eric Young (eay@cryptsoft.com)
  17353.        
  17354.    THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR
  17355.    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17356.    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17357.    DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  17358.    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  17359.    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  17360.    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  17361.    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  17362.    IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  17363.    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  17364.    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17365.    
  17366.    The license and distribution terms for any publically available
  17367.    version or derivative of this code cannot be changed. i.e. this code
  17368.    cannot simply be copied and put under another distrubution license
  17369.    [including the GNU Public License.]
  17370.    
  17371.    The reason behind this being stated in this direct manner is past
  17372.    experience in code simply being copied and the attribution removed
  17373.    from it and then being distributed as part of other packages. This
  17374.    implementation was a non-trivial and unpaid effort.
  17375.    
  17376.    Used DES encryption in Kermit 95 (k95crypt.dll, k2crypt.dll)
  17377.      _________________________________________________________________
  17378.    
  17379.  * This is version 1.1 of CryptoLib
  17380.  *
  17381.  * The authors of this software are Jack Lacy, Don Mitchell and Matt Blaze
  17382.  *              Copyright (c) 1991, 1992, 1993, 1994, 1995 by AT&T.
  17383.  * Permission to use, copy, and modify this software without fee
  17384.  * is hereby granted, provided that this entire notice is included in
  17385.  * all copies of any software which is or includes a copy or
  17386.  * modification of this software and in all copies of the supporting
  17387.  * documentation for such software.
  17388.  *
  17389.  * NOTE:
  17390.  * Some of the algorithms in cryptolib may be covered by patents.
  17391.  * It is the responsibility of the user to ensure that any required
  17392.  * licenses are obtained.
  17393.  *
  17394.  *
  17395.  * SOME PARTS OF CRYPTOLIB MAY BE RESTRICTED UNDER UNITED STATES EXPORT
  17396.  * REGULATIONS.
  17397.  *
  17398.  *
  17399.  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
  17400.  * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
  17401.  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  17402.  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  17403.  
  17404.    Used for Big Number library in Kermit 95 (k95crypt.dll, k2crypt.dll).
  17405.    
  17406.    [ [639]Top ] [ [640]C-Kermit ] [ [641]Kermit Home ]
  17407.      _________________________________________________________________
  17408.    
  17409.    CKERMIT70.HTM / The Kermit Project / Columbia University / 8 Feb 2000
  17410.  
  17411. References
  17412.  
  17413.    1. http://www.columbia.edu/kermit/ckermit70.html#contents
  17414.    2. http://www.columbia.edu/kermit/ckermit.html
  17415.    3. http://www.columbia.edu/kermit/index.htm
  17416.    4. mailto:kermit-support@columbia.edu
  17417.    5. http://www.columbia.edu/kermit/
  17418.    6. http://www.kermit-project.org/
  17419.    7. http://www.columbia.nyc.ny.us/kermit/
  17420.    8. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
  17421.    9. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
  17422.   10. http://www.columbia.edu/kermit/ckermit70.html#xv
  17423.   11. http://www.columbia.edu/kermit/ckb2.htm
  17424.   12. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
  17425.   13. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17426.   14. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
  17427.   15. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17428.   16. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt
  17429.   17. ftp://kermit.columbia.edu/kermit/f/security.txt
  17430.   18. http://www.columbia.edu/kermit/security.htm
  17431.   19. ftp://kermit.columbia.edu/kermit/f/iksd.txt
  17432.   20. http://www.columbia.edu/kermit/iksd.htm
  17433.   21. http://www.columbia.edu/kermit/cuiksd.htm
  17434.   22. ftp://kermit.columbia.edu/kermit/f/telnet.txt
  17435.   23. http://www.columbia.edu/kermit/telnet.htm
  17436.   24. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
  17437.   25. http://www.columbia.edu/kermit/k95.html
  17438.   26. http://www.opensource.org/
  17439.   27. http://www.columbia.edu/kermit/ckb2.htm
  17440.   28. http://www.columbia.edu/kermit/ckermit70.html#xi
  17441.   29. http://www.columbia.edu/kermit/ckermit70.html#xii
  17442.   30. http://www.columbia.edu/kermit/ckermit70.html#x0
  17443.   31. http://www.columbia.edu/kermit/ckermit70.html#x1
  17444.   32. http://www.columbia.edu/kermit/ckermit70.html#x1.0
  17445.   33. http://www.columbia.edu/kermit/ckermit70.html#x1.1
  17446.   34. http://www.columbia.edu/kermit/ckermit70.html#x1.2
  17447.   35. http://www.columbia.edu/kermit/ckermit70.html#x1.3
  17448.   36. http://www.columbia.edu/kermit/ckermit70.html#x1.4
  17449.   37. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17450.   38. http://www.columbia.edu/kermit/ckermit70.html#x1.5.1
  17451.   39. http://www.columbia.edu/kermit/ckermit70.html#x1.5.2
  17452.   40. http://www.columbia.edu/kermit/ckermit70.html#x1.5.3
  17453.   41. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17454.   42. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
  17455.   43. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17456.   44. http://www.columbia.edu/kermit/ckermit70.html#x1.7
  17457.   45. http://www.columbia.edu/kermit/ckermit70.html#x1.8
  17458.   46. http://www.columbia.edu/kermit/ckermit70.html#x1.9
  17459.   47. http://www.columbia.edu/kermit/ckermit70.html#x1.10
  17460.   48. http://www.columbia.edu/kermit/ckermit70.html#x1.11
  17461.   49. http://www.columbia.edu/kermit/ckermit70.html#x1.11.1
  17462.   50. http://www.columbia.edu/kermit/ckermit70.html#x1.11.2
  17463.   51. http://www.columbia.edu/kermit/ckermit70.html#x1.11.3
  17464.   52. http://www.columbia.edu/kermit/ckermit70.html#x1.11.4
  17465.   53. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
  17466.   54. http://www.columbia.edu/kermit/ckermit70.html#x1.11.6
  17467.   55. http://www.columbia.edu/kermit/ckermit70.html#x1.11.7
  17468.   56. http://www.columbia.edu/kermit/ckermit70.html#x1.12
  17469.   57. http://www.columbia.edu/kermit/ckermit70.html#x1.13
  17470.   58. http://www.columbia.edu/kermit/ckermit70.html#x1.14
  17471.   59. http://www.columbia.edu/kermit/ckermit70.html#x1.15
  17472.   60. http://www.columbia.edu/kermit/ckermit70.html#x1.16
  17473.   61. http://www.columbia.edu/kermit/ckermit70.html#x1.17
  17474.   62. http://www.columbia.edu/kermit/ckermit70.html#x1.18
  17475.   63. http://www.columbia.edu/kermit/ckermit70.html#x1.19
  17476.   64. http://www.columbia.edu/kermit/ckermit70.html#x1.20
  17477.   65. http://www.columbia.edu/kermit/ckermit70.html#x1.21
  17478.   66. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  17479.   67. http://www.columbia.edu/kermit/ckermit70.html#x1.22.1
  17480.   68. http://www.columbia.edu/kermit/ckermit70.html#x1.22.2
  17481.   69. http://www.columbia.edu/kermit/ckermit70.html#x1.22.3
  17482.   70. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
  17483.   71. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
  17484.   72. http://www.columbia.edu/kermit/ckermit70.html#x1.22.6
  17485.   73. http://www.columbia.edu/kermit/ckermit70.html#x1.22.7
  17486.   74. http://www.columbia.edu/kermit/ckermit70.html#x1.22.8
  17487.   75. http://www.columbia.edu/kermit/ckermit70.html#x1.23
  17488.   76. http://www.columbia.edu/kermit/ckermit70.html#x1.24
  17489.   77. http://www.columbia.edu/kermit/ckermit70.html#x2
  17490.   78. http://www.columbia.edu/kermit/ckermit70.html#x2.0
  17491.   79. http://www.columbia.edu/kermit/ckermit70.html#x2.1
  17492.   80. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
  17493.   81. http://www.columbia.edu/kermit/ckermit70.html#x2.1.2
  17494.   82. http://www.columbia.edu/kermit/ckermit70.html#x2.1.3
  17495.   83. http://www.columbia.edu/kermit/ckermit70.html#x2.1.4
  17496.   84. http://www.columbia.edu/kermit/ckermit70.html#x2.1.5
  17497.   85. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
  17498.   86. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
  17499.   87. http://www.columbia.edu/kermit/ckermit70.html#x2.1.8
  17500.   88. http://www.columbia.edu/kermit/ckermit70.html#x2.1.9
  17501.   89. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
  17502.   90. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
  17503.   91. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
  17504.   92. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
  17505.   93. http://www.columbia.edu/kermit/ckermit70.html#x2.1.14
  17506.   94. http://www.columbia.edu/kermit/ckermit70.html#x2.1.15
  17507.   95. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
  17508.   96. http://www.columbia.edu/kermit/ckermit70.html#x2.2
  17509.   97. http://www.columbia.edu/kermit/ckermit70.html#x2.2.1
  17510.   98. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
  17511.   99. http://www.columbia.edu/kermit/ckermit70.html#x2.3
  17512.  100. http://www.columbia.edu/kermit/ckermit70.html#x2.3.0
  17513.  101. http://www.columbia.edu/kermit/ckermit70.html#x2.3.1
  17514.  102. http://www.columbia.edu/kermit/ckermit70.html#x2.3.2
  17515.  103. http://www.columbia.edu/kermit/ckermit70.html#x2.3.3
  17516.  104. http://www.columbia.edu/kermit/ckermit70.html#x2.3.4
  17517.  105. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
  17518.  106. http://www.columbia.edu/kermit/ckermit70.html#x2.3.6
  17519.  107. http://www.columbia.edu/kermit/ckermit70.html#x2.4
  17520.  108. http://www.columbia.edu/kermit/ckermit70.html#x2.5
  17521.  109. http://www.columbia.edu/kermit/ckermit70.html#x2.6
  17522.  110. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17523.  111. http://www.columbia.edu/kermit/ckermit70.html#x2.7.0
  17524.  112. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1
  17525.  113. http://www.columbia.edu/kermit/ckermit70.html#x2.7.2
  17526.  114. http://www.columbia.edu/kermit/ckermit70.html#x2.7.3
  17527.  115. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4
  17528.  116. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.1
  17529.  117. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.2
  17530.  118. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.3
  17531.  119. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.4
  17532.  120. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.5
  17533.  121. http://www.columbia.edu/kermit/ckermit70.html#x2.8
  17534.  122. http://www.columbia.edu/kermit/ckermit70.html#x2.9
  17535.  123. http://www.columbia.edu/kermit/ckermit70.html#x2.9.1
  17536.  124. http://www.columbia.edu/kermit/ckermit70.html#x2.9.2
  17537.  125. http://www.columbia.edu/kermit/ckermit70.html#x2.10
  17538.  126. http://www.columbia.edu/kermit/ckermit70.html#x2.11
  17539.  127. http://www.columbia.edu/kermit/ckermit70.html#x2.12
  17540.  128. http://www.columbia.edu/kermit/ckermit70.html#x2.13
  17541.  129. http://www.columbia.edu/kermit/ckermit70.html#x2.14
  17542.  130. http://www.columbia.edu/kermit/ckermit70.html#x2.15
  17543.  131. http://www.columbia.edu/kermit/ckermit70.html#x3
  17544.  132. http://www.columbia.edu/kermit/ckermit70.html#x3.1
  17545.  133. http://www.columbia.edu/kermit/ckermit70.html#x3.2
  17546.  134. http://www.columbia.edu/kermit/ckermit70.html#x3.3
  17547.  135. http://www.columbia.edu/kermit/ckermit70.html#x3.4
  17548.  136. http://www.columbia.edu/kermit/ckermit70.html#x4
  17549.  137. http://www.columbia.edu/kermit/ckermit70.html#x4.0
  17550.  138. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17551.  139. http://www.columbia.edu/kermit/ckermit70.html#x4.1.1
  17552.  140. http://www.columbia.edu/kermit/ckermit70.html#x4.1.2
  17553.  141. http://www.columbia.edu/kermit/ckermit70.html#x4.1.3
  17554.  142. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17555.  143. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1
  17556.  144. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.1
  17557.  145. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.2
  17558.  146. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
  17559.  147. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17560.  148. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.1
  17561.  149. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.2
  17562.  150. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
  17563.  151. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.1
  17564.  152. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.2
  17565.  153. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
  17566.  154. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
  17567.  155. http://www.columbia.edu/kermit/ckermit70.html#x4.2.6
  17568.  156. http://www.columbia.edu/kermit/ckermit70.html#x4.2.7
  17569.  157. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8
  17570.  158. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
  17571.  159. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
  17572.  160. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.3
  17573.  161. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
  17574.  162. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17575.  163. http://www.columbia.edu/kermit/ckermit70.html#x4.3.1
  17576.  164. http://www.columbia.edu/kermit/ckermit70.html#x4.3.2
  17577.  165. http://www.columbia.edu/kermit/ckermit70.html#x4.3.3
  17578.  166. http://www.columbia.edu/kermit/ckermit70.html#x4.3.4
  17579.  167. http://www.columbia.edu/kermit/ckermit70.html#x4.4
  17580.  168. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1
  17581.  169. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.1
  17582.  170. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.2
  17583.  171. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2
  17584.  172. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1
  17585.  173. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.1
  17586.  174. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.2
  17587.  175. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.2
  17588.  176. http://www.columbia.edu/kermit/ckermit70.html#x4.5
  17589.  177. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17590.  178. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
  17591.  179. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.1
  17592.  180. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.2
  17593.  181. http://www.columbia.edu/kermit/ckermit70.html#x4.5.3
  17594.  182. http://www.columbia.edu/kermit/ckermit70.html#x4.5.4
  17595.  183. http://www.columbia.edu/kermit/ckermit70.html#x4.6
  17596.  184. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  17597.  185. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17598.  186. http://www.columbia.edu/kermit/ckermit70.html#x4.7.2
  17599.  187. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
  17600.  188. http://www.columbia.edu/kermit/ckermit70.html#x4.8
  17601.  189. http://www.columbia.edu/kermit/ckermit70.html#x4.8.1
  17602.  190. http://www.columbia.edu/kermit/ckermit70.html#x4.8.2
  17603.  191. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17604.  192. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17605.  193. http://www.columbia.edu/kermit/ckermit70.html#x4.9.2
  17606.  194. http://www.columbia.edu/kermit/ckermit70.html#x4.9.3
  17607.  195. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17608.  196. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17609.  197. http://www.columbia.edu/kermit/ckermit70.html#x4.11.1
  17610.  198. http://www.columbia.edu/kermit/ckermit70.html#x4.11.2
  17611.  199. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  17612.  200. http://www.columbia.edu/kermit/ckermit70.html#x4.11.4
  17613.  201. http://www.columbia.edu/kermit/ckermit70.html#x4.11.5
  17614.  202. http://www.columbia.edu/kermit/ckermit70.html#x4.11.6
  17615.  203. http://www.columbia.edu/kermit/ckermit70.html#x4.12
  17616.  204. http://www.columbia.edu/kermit/ckermit70.html#x4.13
  17617.  205. http://www.columbia.edu/kermit/ckermit70.html#x4.14
  17618.  206. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17619.  207. http://www.columbia.edu/kermit/ckermit70.html#x4.16
  17620.  208. http://www.columbia.edu/kermit/ckermit70.html#x4.17
  17621.  209. http://www.columbia.edu/kermit/ckermit70.html#x4.17.1
  17622.  210. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
  17623.  211. http://www.columbia.edu/kermit/ckermit70.html#x4.18
  17624.  212. http://www.columbia.edu/kermit/ckermit70.html#x4.19
  17625.  213. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17626.  214. http://www.columbia.edu/kermit/ckermit70.html#x4.20.1
  17627.  215. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2
  17628.  216. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.1
  17629.  217. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.2
  17630.  218. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
  17631.  219. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.4
  17632.  220. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.5
  17633.  221. http://www.columbia.edu/kermit/ckermit70.html#x4.20.3
  17634.  222. http://www.columbia.edu/kermit/ckermit70.html#x4.21
  17635.  223. http://www.columbia.edu/kermit/ckermit70.html#x4.22
  17636.  224. http://www.columbia.edu/kermit/ckermit70.html#x4.22.1
  17637.  225. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
  17638.  226. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
  17639.  227. http://www.columbia.edu/kermit/ckermit70.html#x4.22.4
  17640.  228. http://www.columbia.edu/kermit/ckermit70.html#x4.22.5
  17641.  229. http://www.columbia.edu/kermit/ckermit70.html#x4.22.6
  17642.  230. http://www.columbia.edu/kermit/ckermit70.html#x4.22.7
  17643.  231. http://www.columbia.edu/kermit/ckermit70.html#x4.22.8
  17644.  232. http://www.columbia.edu/kermit/ckermit70.html#x4.23
  17645.  233. http://www.columbia.edu/kermit/ckermit70.html#x4.24
  17646.  234. http://www.columbia.edu/kermit/ckermit70.html#x4.25
  17647.  235. http://www.columbia.edu/kermit/ckermit70.html#x5
  17648.  236. http://www.columbia.edu/kermit/ckermit70.html#x5.0
  17649.  237. http://www.columbia.edu/kermit/ckermit70.html#x5.1
  17650.  238. http://www.columbia.edu/kermit/ckermit70.html#x5.2
  17651.  239. http://www.columbia.edu/kermit/ckermit70.html#x5.3
  17652.  240. http://www.columbia.edu/kermit/ckermit70.html#x5.3.1
  17653.  241. http://www.columbia.edu/kermit/ckermit70.html#x5.3.2
  17654.  242. http://www.columbia.edu/kermit/ckermit70.html#x5.4
  17655.  243. http://www.columbia.edu/kermit/ckermit70.html#x5.5
  17656.  244. http://www.columbia.edu/kermit/ckermit70.html#x5.6
  17657.  245. http://www.columbia.edu/kermit/ckermit70.html#x5.7
  17658.  246. http://www.columbia.edu/kermit/ckermit70.html#x6
  17659.  247. http://www.columbia.edu/kermit/ckermit70.html#x6.0
  17660.  248. http://www.columbia.edu/kermit/ckermit70.html#x6.1
  17661.  249. http://www.columbia.edu/kermit/ckermit70.html#x6.2
  17662.  250. http://www.columbia.edu/kermit/ckermit70.html#x6.3
  17663.  251. http://www.columbia.edu/kermit/ckermit70.html#x6.4
  17664.  252. http://www.columbia.edu/kermit/ckermit70.html#x6.5
  17665.  253. http://www.columbia.edu/kermit/ckermit70.html#x6.6
  17666.  254. http://www.columbia.edu/kermit/ckermit70.html#x6.6.1
  17667.  255. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17668.  256. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17669.  257. http://www.columbia.edu/kermit/ckermit70.html#x6.6.3
  17670.  258. http://www.columbia.edu/kermit/ckermit70.html#x6.6.4
  17671.  259. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
  17672.  260. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
  17673.  261. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.2
  17674.  262. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.3
  17675.  263. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
  17676.  264. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.5
  17677.  265. http://www.columbia.edu/kermit/ckermit70.html#x6.7
  17678.  266. http://www.columbia.edu/kermit/ckermit70.html#x7
  17679.  267. http://www.columbia.edu/kermit/ckermit70.html#x7.0
  17680.  268. http://www.columbia.edu/kermit/ckermit70.html#x7.1
  17681.  269. http://www.columbia.edu/kermit/ckermit70.html#x7.1.1
  17682.  270. http://www.columbia.edu/kermit/ckermit70.html#x7.1.2
  17683.  271. http://www.columbia.edu/kermit/ckermit70.html#x7.1.3
  17684.  272. http://www.columbia.edu/kermit/ckermit70.html#x7.1.4
  17685.  273. http://www.columbia.edu/kermit/ckermit70.html#x7.2
  17686.  274. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  17687.  275. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  17688.  276. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17689.  277. http://www.columbia.edu/kermit/ckermit70.html#x7.6
  17690.  278. http://www.columbia.edu/kermit/ckermit70.html#x7.7
  17691.  279. http://www.columbia.edu/kermit/ckermit70.html#x7.8
  17692.  280. http://www.columbia.edu/kermit/ckermit70.html#x7.9
  17693.  281. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
  17694.  282. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
  17695.  283. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  17696.  284. http://www.columbia.edu/kermit/ckermit70.html#x7.10.1
  17697.  285. http://www.columbia.edu/kermit/ckermit70.html#x7.10.2
  17698.  286. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
  17699.  287. http://www.columbia.edu/kermit/ckermit70.html#x7.10.4
  17700.  288. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  17701.  289. http://www.columbia.edu/kermit/ckermit70.html#x7.10.6
  17702.  290. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  17703.  291. http://www.columbia.edu/kermit/ckermit70.html#x7.10.8
  17704.  292. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
  17705.  293. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
  17706.  294. http://www.columbia.edu/kermit/ckermit70.html#x7.11
  17707.  295. http://www.columbia.edu/kermit/ckermit70.html#x7.12
  17708.  296. http://www.columbia.edu/kermit/ckermit70.html#x7.13
  17709.  297. http://www.columbia.edu/kermit/ckermit70.html#x7.14
  17710.  298. http://www.columbia.edu/kermit/ckermit70.html#x7.15
  17711.  299. http://www.columbia.edu/kermit/ckermit70.html#x7.16
  17712.  300. http://www.columbia.edu/kermit/ckermit70.html#x7.17
  17713.  301. http://www.columbia.edu/kermit/ckermit70.html#x7.18
  17714.  302. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  17715.  303. http://www.columbia.edu/kermit/ckermit70.html#x7.20
  17716.  304. http://www.columbia.edu/kermit/ckermit70.html#x7.20.1
  17717.  305. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
  17718.  306. http://www.columbia.edu/kermit/ckermit70.html#x7.21
  17719.  307. http://www.columbia.edu/kermit/ckermit70.html#x7.22
  17720.  308. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  17721.  309. http://www.columbia.edu/kermit/ckermit70.html#x7.24
  17722.  310. http://www.columbia.edu/kermit/ckermit70.html#x7.25
  17723.  311. http://www.columbia.edu/kermit/ckermit70.html#x7.26
  17724.  312. http://www.columbia.edu/kermit/ckermit70.html#x7.26.1
  17725.  313. http://www.columbia.edu/kermit/ckermit70.html#x7.26.2
  17726.  314. http://www.columbia.edu/kermit/ckermit70.html#x7.27
  17727.  315. http://www.columbia.edu/kermit/ckermit70.html#x8
  17728.  316. http://www.columbia.edu/kermit/ckermit70.html#x9
  17729.  317. http://www.columbia.edu/kermit/ckermit70.html#x9.0
  17730.  318. http://www.columbia.edu/kermit/ckermit70.html#x9.1
  17731.  319. http://www.columbia.edu/kermit/ckermit70.html#x9.2
  17732.  320. http://www.columbia.edu/kermit/ckermit70.html#x9.3
  17733.  321. http://www.columbia.edu/kermit/ckermit70.html#x10
  17734.  322. http://www.columbia.edu/kermit/ckermit70.html#xiii
  17735.  323. http://www.columbia.edu/kermit/ckermit70.html#xiii.1
  17736.  324. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.1
  17737.  325. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2
  17738.  326. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.1
  17739.  327. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.2
  17740.  328. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.3
  17741.  329. http://www.columbia.edu/kermit/ckermit70.html#xiii.2
  17742.  330. http://www.columbia.edu/kermit/ckermit70.html#xiv
  17743.  331. http://www.columbia.edu/kermit/ckermit70.html#xv
  17744.  332. http://www.columbia.edu/kermit/ckb2.htm
  17745.  333. http://www.columbia.edu/kermit/ckbreviews.html
  17746.  334. http://www.bhusa.com/
  17747.  335. http://www.columbia.edu/kermit/manuals.html#ckde
  17748.  336. http://www.columbia.edu/kermit/manuals.html#ktb
  17749.  337. http://www.columbia.edu/kermit/news.html
  17750.  338. news:comp.protocols.kermit.announce
  17751.  339. news:comp.protocols.kermit.misc
  17752.  340. http://www.columbia.edu/kermit/ckb2.htm
  17753.  341. http://www.columbia.edu/kermit/ckermit70.html#x4
  17754.  342. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17755.  343. http://www.columbia.edu/kermit/ckermit70.html#x4.23
  17756.  344. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17757.  345. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17758.  346. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17759.  347. http://www.columbia.edu/kermit/ckermit70.html#x4.9.
  17760.  348. http://www.columbia.edu/kermit/ckb2.htm
  17761.  349. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
  17762.  350. http://www.columbia.edu/kermit/ckermit70.html#x2.15
  17763.  351. http://www.columbia.edu/kermit/ckermit70.html#x9.1
  17764.  352. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17765.  353. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  17766.  354. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17767.  355. http://www.columbia.edu/kermit/ckermit70.html#mjd
  17768.  356. http://www.columbia.edu/kermit/ckermit70.html#mjd
  17769.  357. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17770.  358. http://www.columbia.edu/kermit/ckb2.htm
  17771.  359. http://www.columbia.edu/kermit/ckb2.htm
  17772.  360. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17773.  361. http://www.columbia.edu/kermit/ckermit70.html#x2.12
  17774.  362. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17775.  363. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17776.  364. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
  17777.  365. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17778.  366. http://www.columbia.edu/kermit/ckermit70.html#x7.18
  17779.  367. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  17780.  368. http://www.columbia.edu/kermit/ckermit70.html#x1.15
  17781.  369. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17782.  370. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  17783.  371. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  17784.  372. http://www.columbia.edu/kermit/ckermit70.html#x7.1
  17785.  373. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17786.  374. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  17787.  375. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  17788.  376. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
  17789.  377. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
  17790.  378. http://www.columbia.edu/kermit/ckb2.htm
  17791.  379. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
  17792.  380. http://www.columbia.edu/kermit/ckermit70.html#x7.12
  17793.  381. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
  17794.  382. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17795.  383. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
  17796.  384. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17797.  385. http://www.telefonica.es/cambiodenumeracion/
  17798.  386. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17799.  387. http://www.columbia.edu/kermit/ckb2.htm
  17800.  388. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
  17801.  389. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
  17802.  390. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
  17803.  391. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
  17804.  392. http://www.columbia.edu/kermit/ckb2.htm
  17805.  393. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
  17806.  394. http://www.columbia.edu/kermit/ckb2.htm
  17807.  395. http://www.columbia.edu/kermit/ckb2.htm
  17808.  396. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
  17809.  397. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
  17810.  398. http://www.columbia.edu/kermit/ckb2.htm
  17811.  399. ftp://kermit.columbia.edu/kermit/f/telnet.txt
  17812.  400. http://www.columbia.edu/kermit/telnet.htm
  17813.  401. ftp://kermit.columbia.edu/kermit/f/telnet.txt
  17814.  402. http://www.columbia.edu/kermit/telnet.htm
  17815.  403. ftp://ftp.isi.edu/in-notes/rfc1572.txt
  17816.  404. ftp://ftp.isi.edu/in-notes/rfc779.txt
  17817.  405. http://www.columbia.edu/kermit/ckb2.htm
  17818.  406. http://www.columbia.edu/kermit/ckermit70.html#x2.10
  17819.  407. http://www.columbia.edu/kermit/ckermit70.html#x2.8
  17820.  408. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17821.  409. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17822.  410. http://www.psy.uq.oz.au/~ftp/Crypto/
  17823.  411. http://www.columbia.edu/kermit/security.htm
  17824.  412. http://srp.stanford.edu/srp/
  17825.  413. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1,
  17826.  414. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
  17827.  415. http://www.columbia.edu/kermit/security.htm
  17828.  416. http://www.columbia.edu/kermit/ckb2.htm
  17829.  417. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17830.  418. http://www.columbia.edu/kermit/ckermit70.html#x2.0
  17831.  419. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
  17832.  420. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17833.  421. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
  17834.  422. http://www.columbia.edu/kermit/iksd.html#x4.2
  17835.  423. http://www.columbia.edu/kermit/iksd.html
  17836.  424. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
  17837.  425. ftp://ftp.isi.edu/in-notes/rfc1945.txt
  17838.  426. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17839.  427. http://www.columbia.edu/kermit/ckermit70.html#x3.2
  17840.  428. http://www.columbia.edu/kermit/ckermit70.html#x3.2
  17841.  429. http://www.columbia.edu/kermit/ckb2.htm
  17842.  430. http://www.columbia.edu/kermit/ckb2.htm
  17843.  431. http://www.columbia.edu/kermit/ckermit70.html#x5.4
  17844.  432. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
  17845.  433. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17846.  434. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17847.  435. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
  17848.  436. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17849.  437. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17850.  438. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17851.  439. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17852.  440. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
  17853.  441. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  17854.  442. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
  17855.  443. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
  17856.  444. http://www.columbia.edu/kermit/ckb2.htm
  17857.  445. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17858.  446. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17859.  447. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
  17860.  448. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17861.  449. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17862.  450. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17863.  451. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17864.  452. http://www.telstra.com.au/docs/PGP/
  17865.  453. http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
  17866.  454. http://www.columbia.edu/kermit/security.htm
  17867.  455. http://www.columbia.edu/kermit/ckermit70.html#x2.7
  17868.  456. http://www.columbia.edu/kermit/ckb2.htm
  17869.  457. http://www.columbia.edu/kermit/ckermit70.html#x2.14
  17870.  458. http://www.columbia.edu/kermit/ckermit70.html#x1.23
  17871.  459. http://www.columbia.edu/kermit/ckermit70.html#x4.7
  17872.  460. http://www.columbia.edu/kermit/ckb2.htm
  17873.  461. http://www.columbia.edu/kermit/ckb2.htm
  17874.  462. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17875.  463. http://www.columbia.edu/kermit/ckb2.htm
  17876.  464. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17877.  465. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17878.  466. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
  17879.  467. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17880.  468. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17881.  469. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17882.  470. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17883.  471. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17884.  472. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
  17885.  473. http://www.columbia.edu/kermit/ckb2.htm
  17886.  474. http://www.columbia.edu/kermit/ckb2.htm
  17887.  475. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17888.  476. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17889.  477. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  17890.  478. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
  17891.  479. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17892.  480. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17893.  481. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17894.  482. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
  17895.  483. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17896.  484. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
  17897.  485. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17898.  486. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17899.  487. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17900.  488. http://www.columbia.edu/kermit/ckb2.htm
  17901.  489. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17902.  490. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17903.  491. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17904.  492. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17905.  493. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17906.  494. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
  17907.  495. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  17908.  496. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17909.  497. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17910.  498. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
  17911.  499. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
  17912.  500. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  17913.  501. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17914.  502. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  17915.  503. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17916.  504. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17917.  505. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17918.  506. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  17919.  507. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  17920.  508. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
  17921.  509. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  17922.  510. http://www.columbia.edu/kermit/ckb2.htm
  17923.  511. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17924.  512. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17925.  513. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  17926.  514. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  17927.  515. http://www.columbia.edu/kermit/ckermit70.html#x4.15
  17928.  516. http://www.columbia.edu/kermit/ckermit70.html#x4.18
  17929.  517. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17930.  518. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17931.  519. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  17932.  520. http://www.columbia.edu/kermit/ckermit70.html#x4.19
  17933.  521. http://www.columbia.edu/kermit/ckermit70.html#x4.16
  17934.  522. http://www.columbia.edu/kermit/ckermit70.html#x4.19
  17935.  523. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
  17936.  524. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  17937.  525. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
  17938.  526. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
  17939.  527. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
  17940.  528. http://www.columbia.edu/kermit/ckb2.htm
  17941.  529. http://www.columbia.edu/kermit/ckb2.htm
  17942.  530. http://www.columbia.edu/kermit/ckermit70.html#x9.3
  17943.  531. http://www.columbia.edu/kermit/ckermit70.html#x5.2.1
  17944.  532. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  17945.  533. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
  17946.  534. http://www.columbia.edu/kermit/ckermit70.html#x6.6
  17947.  535. http://www.columbia.edu/kermit/ckermit70.html#xiii
  17948.  536. http://www.columbia.edu/kermit/ckermit70.html#xiii
  17949.  537. ftp://ftp.isi.edu/in-notes/rfc1489.txt
  17950.  538. ftp://ftp.isi.edu/in-notes/rfc2319.txt
  17951.  539. http://www.unicode.org/
  17952.  540. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17953.  541. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
  17954.  542. ftp://ftp.isi.edu/in-notes/rfc2640.txt
  17955.  543. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
  17956.  544. http://www.columbia.edu/kermit/ckermit70.html#x6.0
  17957.  545. http://www.columbia.edu/kermit/ckermit70.html#x6.5
  17958.  546. http://www.columbia.edu/kermit/ckermit70.html#x6.4
  17959.  547. http://www.columbia.edu/kermit/ckb2.htm
  17960.  548. http://www.columbia.edu/kermit/ckermit70.html#x4.21
  17961.  549. http://www.columbia.edu/kermit/ckermit70.html#x6.5
  17962.  550. http://www.columbia.edu/kermit/ckermit70.html#x2.8
  17963.  551. http://www.columbia.edu/kermit/ckermit70.html#x7.7
  17964.  552. http://www.columbia.edu/kermit/ckermit70.html#x7.2
  17965.  553. http://www.columbia.edu/kermit/ckermit70.html#x1.19
  17966.  554. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  17967.  555. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17968.  556. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17969.  557. http://www.columbia.edu/kermit/ckermit70.html#x4.1
  17970.  558. http://www.columbia.edu/kermit/ckermit70.html#x4.2
  17971.  559. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
  17972.  560. http://www.columbia.edu/kermit/ckermit70.html#x2.10
  17973.  561. http://www.columbia.edu/kermit/ckermit70.html#ferrstring
  17974.  562. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
  17975.  563. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
  17976.  564. http://www.columbia.edu/kermit/ckermit70.html#x9.1
  17977.  565. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  17978.  566. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  17979.  567. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  17980.  568. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  17981.  569. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  17982.  570. http://www.columbia.edu/kermit/ckermit70.html#x7.24
  17983.  571. http://www.columbia.edu/kermit/ckermit70.html#x7.24
  17984.  572. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
  17985.  573. http://www.columbia.edu/kermit/ckermit70.html#x7.12
  17986.  574. http://www.columbia.edu/kermit/ckermit70.html#x7.9
  17987.  575. http://www.columbia.edu/kermit/ckb2.htm
  17988.  576. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  17989.  577. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  17990.  578. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  17991.  579. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  17992.  580. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  17993.  581. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
  17994.  582. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
  17995.  583. http://www.columbia.edu/kermit/ckermit70.html#x7.8
  17996.  584. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  17997.  585. http://www.columbia.edu/kermit/ckb2.htm
  17998.  586. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  17999.  587. http://www.columbia.edu/kermit/ckermit70.html#x7.16
  18000.  588. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
  18001.  589. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18002.  590. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  18003.  591. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  18004.  592. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
  18005.  593. http://www.columbia.edu/kermit/ckermit70.html#x7.10
  18006.  594. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
  18007.  595. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  18008.  596. http://www.columbia.edu/kermit/ckermit70.html#x7.23
  18009.  597. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  18010.  598. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
  18011.  599. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
  18012.  600. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
  18013.  601. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  18014.  602. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
  18015.  603. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  18016.  604. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
  18017.  605. http://www.columbia.edu/kermit/ckb2.htm
  18018.  606. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
  18019.  607. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  18020.  608. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  18021.  609. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  18022.  610. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  18023.  611. http://www.columbia.edu/kermit/ckermit70.html#x4.9
  18024.  612. http://www.columbia.edu/kermit/ckermit70.html#x1.22
  18025.  613. http://www.columbia.edu/kermit/ckermit70.html#x1.6
  18026.  614. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18027.  615. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18028.  616. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  18029.  617. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
  18030.  618. http://www.columbia.edu/kermit/ckermit70.html#x9.3
  18031.  619. http://www.columbia.edu/kermit/ckermit70.html#x7.5
  18032.  620. http://www.columbia.edu/kermit/ckb2.htm
  18033.  621. http://www.columbia.edu/kermit/ckermit70.html#x7.4
  18034.  622. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
  18035.  623. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
  18036.  624. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
  18037.  625. http://www.columbia.edu/kermit/ckermit70.html#x1.10
  18038.  626. http://www.columbia.edu/kermit/ckermit70.html#x1.5
  18039.  627. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
  18040.  628. http://www.columbia.edu/kermit/iksd.html
  18041.  629. http://www.columbia.edu/kermit/ckermit70.html#x7.19
  18042.  630. http://www.columbia.edu/kermit/ckermit70.html#x4.10
  18043.  631. http://www.columbia.edu/kermit/ckermit70.html#x4.11
  18044.  632. http://www.columbia.edu/kermit/ckermit70.html#x4.3
  18045.  633. http://www.columbia.edu/kermit/gkermit.html
  18046.  634. http://www.columbia.edu/kermit/ckermit70.html#x4.20
  18047.  635. http://www.columbia.edu/kermit/gkermit.html
  18048.  636. http://www.columbia.edu/kermit/ckb2.htm
  18049.  637. http://www.columbia.edu/kermit/ckermit70.html#x7.3
  18050.  638. mailto:kermit@columbia.edu
  18051.  639. http://www.columbia.edu/kermit/ckermit70.html#top
  18052.  640. http://www.columbia.edu/kermit/ckermit.html
  18053.  641. http://www.columbia.edu/kermit/index.html
  18054.