Temporarily use -O1 until segfault with -O2+krb5+iksd is fixed
[ckermit.git] / ckermit70.txt
1
2    [1]The Columbia Crown The Kermit Project | Columbia University
3    612 West 115th Street, New York NY 10025 USA o [2]kermit@columbia.edu
4    ...since 1981
5    [3]Home [4]Kermit 95 [5]C-Kermit [6]Scripts [7]Current [8]New [9]FAQ
6    [10]Support
7
8 Supplement to [11]Using C-Kermit , 2nd Edition
9
10 For C-Kermit 7.0
11
12 As of C-Kermit version:  7.0.196
13 This file created:  8 February 2000
14 This file last updated:
15 Mon Sep 13 08:52:41 2010
16
17
18 Authors: Frank da Cruz and Christine M. Gianone
19 Address: The Kermit Project
20          Columbia University
21          612 West 115th Street
22          New York NY 10025-7799
23          USA
24 Fax:     +1 (212) 662-6442
25 E-Mail:  [12]kermit-support@columbia.edu
26 Web:     [13]http://www.columbia.edu/kermit/
27 Or:      [14]http://www.kermit-project.org/
28 Or:      [15]http://www.columbia.nyc.ny.us/kermit/
29
30 NOTICES
31
32    This document:
33           Copyright © 1997, 2000, Frank da Cruz and Christine M. Gianone.
34           All rights reserved.
35
36    Kermit 95:
37           Copyright © 1995, 2000, Trustees of Columbia University in the
38           City of New York. All rights reserved.
39
40    C-Kermit:
41           Copyright © 1985, 2000,
42           Trustees of Columbia University in the City of New York. All
43           rights reserved. See the C-Kermit [16]COPYING.TXT file or the
44           copyright text in the [17]ckcmai.c module for disclaimer and
45           permissions.
46
47    When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or SSL
48           protocol are included:
49           Portions Copyright © 1990, Massachusetts Institute of
50           Technology.
51           Portions Copyright © 1991, 1993 Regents of the University of
52           California.
53           Portions Copyright © 1991, 1992, 1993, 1994, 1995 by AT&T.
54           Portions Copyright © 1997, Stanford University.
55           Portions Copyright © 1995-1997, Eric Young <eay@cryptosoft.com>.
56
57    For the full text of the third-party copyright notices, see
58    [18]Appendix V.
59
60 WHAT IS IN THIS FILE
61
62    This file lists changes made to C-Kermit since the second edition of
63    the book [19]Using C-Kermit was published and C-Kermit 6.0 was released
64    in November 1996. Use this file as a supplement to the second edition
65    of Using C-Kermit until the third edition is published some time in
66    2000. If the "most recent update" shown above is long ago, contact
67    Columbia University to see if there is a newer release.
68
69    For further information, also see the [20]CKCBWR.TXT ("C-Kermit
70    beware") file for hints, tips, tricks, restrictions, frequently asked
71    questions, etc, plus the system-specific "beware file", e.g.
72    [21]CKUBWR.TXT for UNIX, [22]CKVBWR.TXT for VMS, etc, and also any
73    system-specific update files such as KERMIT95.HTM for Kermit 95 (in the
74    DOCS\MANUAL\ subdirectory of your K95 directory).
75
76      This Web-based copy of the C-Kermit 7.0 update notes supersedes the
77      plain-text CKERMIT2.TXT file. All changes after 19 January 2000
78      appear only here in the Web version. If you need an up-to-date
79      plain-text copy, use your Web browser to save this page as plain
80      text.
81
82 ABOUT FILENAMES
83
84    In this document, filenames are generally shown in uppercase, but on
85    file systems with case-sensitive names such as UNIX, OS-9, and AOS/VS,
86    lowercase names are used: [23]ckubwr.txt, [24]ckermit70.txt, etc.
87
88 ADDITIONAL FILES
89
90    Several other files accompany this new Kermit release:
91
92    SECURITY.TXT
93           Discussion of Kermit's new authentication and encryption
94           features:
95
96           + [25]Plain-text version
97           + [26]HTML (hypertext) version
98
99    IKSD.TXT
100           How to install and manage an Internet Kermit Service Daemon.
101
102           + [27]Plain-text version
103           + [28]HTML (hypertext) version
104
105           Also see [29]cuiksd.htm for instructions for use.
106
107    TELNET.TXT
108           A thorough presentation of Kermit's new advanced Telnet features
109           and controls.
110
111           + [30]Plain-text version
112           + [31]HTML (hypertext) version
113
114 THE NEW C-KERMIT LICENSE
115
116    The C-Kermit license was rewritten for version 7.0 to grant automatic
117    permission to packagers of free operating-system distributions to
118    include C-Kermit 7.0. Examples include Linux (GNU/Linux), FreeBSD,
119    NetBSD, etc. The new license is in the [32]COPYING.TXT file, and is
120    also displayed by C-Kermit itself when you give the VERSION or
121    COPYRIGHT command. The new C-Kermit license does not apply to
122    [33]Kermit 95.
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 Allen,
133    Ric Anderson, William Bader, Mitch Baker, Mitchell Bass, Nelson Beebe,
134    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 Martin,
144    Peter Mauzey, Dragan Milicic, Todd Miller, Christian Mondrup, Daniel
145    Morato, Dat Nguyen, Herb Peyerl, Jean-Pierre Radley, Steve Rance,
146    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 Whitaker,
151    Jim Whitby, Matt Willman, Joellen Windsor, Farrell Woods, and many
152    others for binaries, hosting, reviews, suggestions, advice, bug
153    reports, and all the rest over the 3+ year C-Kermit 7.0 development
154    cycle. Thanks to Russ Nelson and the board of the Open Software
155    Initiative ([34]http://www.opensource.org) for their cooperation in
156    developing the new C-Kermit license and to the proprietors of those
157    free UNIX distributions that have incorporated C-Kermit 7.0 for their
158    cooperation and support, especially FreeBSD's Jörg Wunsch.
159
160 NOTE TO KERMIT 95 USERS
161
162    Kermit 95 and C-Kermit share the same command and scripting language,
163    the same Kermit file-transfer protocol implementation, and much else
164    besides.
165
166    Like the book [35]Using C-Kermit, this file concentrates on the aspects
167    of C-Kermit that are common to all versions: UNIX, VMS, Windows, OS/2,
168    VOS, AOS/VS, etc. Please refer to your Kermit 95 documentation for
169    information that is specific to Kermit 95.
170
171    C-Kermit 7.0 corresponds to Kermit 95 1.1.19.
172
173 C-KERMIT VERSIONS AND VERSION NUMBERS
174
175    "C-Kermit" refers to all the many programs that are compiled in whole
176    or in part from common C-language source code, comprising:
177
178      * A Kermit file transfer protocol module
179      * A command parser and script execution module
180      * A modem-dialing module
181      * A network support module
182      * A character-set translation module.
183
184    and several others. These "system-independent" modules are combined
185    with system-dependent modules for each platform to provide the required
186    input/output functions, and also in some cases overlaid with an
187    alternative user interface, such as Macintosh Kermit's point-and-click
188    interface, and in some cases also a terminal emulator, as Kermit 95.
189
190    The C-Kermit version number started as 1.0, ... 3.0, 4.0, 4.1 and then
191    (because of confusion at the time with Berkeley UNIX 4.2), 4B, 4C, and
192    so on, with the specific edit number in parentheses, for example
193    4E(072) or 5A(188). This scheme was used through 5A(191), but now we
194    have gone back to the traditional numbering scheme with decimal points:
195    major.minor.edit; for example 7.0.196. Internal version numbers (the
196    \v(version) variable), however, are compatible in C-Kermit 5A upwards.
197
198    Meanwhile, C-Kermit derivatives for some platforms (Windows, Macintosh)
199    might go through several releases while C-Kermit itself remains the
200    same. These versions have their own platform-specific version numbers,
201    such as Kermit 95 1.1.1, 1.1.2, and so on.
202
203    C-Kermit Version History:
204
205   1.0       1981-1982         Command-line only, 4.2 BSD UNIX only
206   2.0       (*)               (who remembers...)
207   3.0       May 1984          Command-line only, supports several platforms
208   4.0-4.1   Feb-Apr 1985 (*)  First interactive and modular version
209   4C(050)   May 1985
210   4D(060)   April 1986
211   4E(066)   August 1987       Long packets
212   4E(068)   January 1988
213   4E(072)   January 1989
214   4F(095)   August 1989 (*)   Attribute packets
215   5A(188)   November 1992     Scripting, TCP/IP, sliding windows (1)
216   5A(189)   September 1993    Control-char unprefixing
217   5A(190)   October 1994      Recovery
218   5A(191)   April 1995        OS/2 only
219   6.0.192   September 1996    Intelligent dialing, autodownload, lots more (2)
220   6.1.193   1997-98 (*)       Development only
221   6.1.194   June 1998         K95 only - switches, directory recursion, more
222   7.0.195   August 1999       IKSD + more (CU only as K95 1.1.18-CU)
223   7.0.196   1 January 2000    Unicode, lots more
224
225    (*) Never formally released (4.0 was a total rewrite)
226    (1) Using C-Kermit, 1st Edition
227    (2) Using C-Kermit, 2nd Edition
228
229 CONTENTS
230
231  I.  [36]C-KERMIT DOCUMENTATION
232
233  II. [37]NEW FEATURES
234
235      (0) [38]INCOMPATIBILITIES WITH PREVIOUS RELEASES
236      (1) [39]PROGRAM AND FILE MANAGEMENT AND COMMANDS
237          1.0.  [40]Bug fixes
238          1.1.  [41]Command Continuation
239          1.2.  [42]Editor Interface
240          1.3.  [43]Web Browser and FTP Interface
241          1.4.  [44]Command Editing
242          1.5.  [45]Command Switches
243                1.5.1. [46]General Switch Syntax
244                1.5.2. [47]Order and Effect of Switches
245                1.5.3. [48]Distinguishing Switches from Other Fields
246                1.5.4. [49]Standard File Selection Switches
247                1.5.5. [50]Setting Preferences for Different Commands
248          1.6.  [51]Dates and Times
249          1.7.  [52]Partial Completion of Keywords
250          1.8.  [53]Command Recall
251          1.9.  [54]EXIT Messages
252          1.10. [55]Managing Keyboard Interruptions
253          1.11. [56]Taming the Wild Backslash -- Part Deux
254                1.11.1. [57]Background
255                1.11.2. [58]Kermit's Quoting Rules
256                1.11.3. [59]Passing DOS Filenames from Kermit to Shell Commands
257                1.11.4. [60]Using Variables to Hold DOS Filenames
258                1.11.5. [61]Passing DOS Filenames as Parameters to Macros
259                1.11.6. [62]Passing DOS File Names from Macro Parameters to the D
260 OS Shell
261                1.11.7. [63]Passing DOS Filenames to Kermit from the Shell
262          1.12. [64]Debugging
263          1.13. [65]Logs
264          1.14. [66]Automatic File-Transfer Packet Recognition at the Command Pro
265 mpt
266          1.15. [67]The TYPE Command
267          1.16. [68]The RESET Command
268          1.17. [69]The COPY and RENAME Commands
269          1.18. [70]The MANUAL Command
270          1.19. [71]String and Filename Matching Patterns
271          1.20. [72]Multiple Commands on One Line
272          1.21. [73]What Do I Have?
273          1.22. [74]Generalized File Input and Output
274                1.22.1. [75]Why Another I/O System?
275                1.22.2. [76]The FILE Command
276                1.22.3. [77]FILE Command Examples
277                1.22.4. [78]Channel Numbers
278                1.22.5. [79]FILE Command Error Codes
279                1.22.6. [80]File I/O Variables
280                1.22.7. [81]File I/O Functions
281                1.22.8. [82]File I/O Function Examples
282          1.23. [83]The EXEC Command
283          1.24. [84]Getting Keyword Lists with '?'
284      (2) [85]MAKING AND USING CONNECTIONS
285          2.0. [86]SET LINE and SET HOST Command Switches
286          2.1. [87]Dialing
287               2.1.1. [88]The Dial Result Message
288               2.1.2. [89]Long-Distance Dialing Changes
289               2.1.3. [90]Forcing Long-Distance Dialing
290               2.1.4. [91]Exchange-Specific Dialing Decisions
291               2.1.5. [92]Cautions about Cheapest-First Dialing
292               2.1.6. [93]Blind Dialing (Dialing with No Dialtone)
293               2.1.7. [94]Trimming the Dialing Dialog
294               2.1.8. [95]Controlling the Dialing Speed
295               2.1.9. [96]Pretesting Phone Number Conversions
296               2.1.10. [97]Greater Control over Partial Dialing
297               2.1.11. [98]New DIAL-related Variables and Functions
298               2.1.12. [99]Increased Flexibility of PBX Dialing
299               2.1.13. [100]The DIAL macro - Last-Minute Phone Number Conversions
300               2.1.14. [101]Automatic Tone/Pulse Dialing Selection
301               2.1.15. [102]Dial-Modifier Variables
302               2.1.16. [103]Giving Multiple Numbers to the DIAL Command
303          2.2. [104]Modems
304               2.2.1. [105]New Modem Types
305               2.2.2. [106]New Modem Controls
306          2.3. [107]TELNET and RLOGIN
307               2.3.0. [108]Bug Fixes
308               2.3.1. [109]Telnet Binary Mode Bug Adjustments
309               2.3.2. [110]VMS UCX Telnet Port Bug Adjustment
310               2.3.3. [111]Telnet New Environment Option
311               2.3.4. [112]Telnet Location Option
312               2.3.5. [113]Connecting to Raw TCP Sockets
313               2.3.6. [114]Incoming TCP Connections
314          2.4. [115]The EIGHTBIT Command
315          2.5. [116]The Services Directory
316          2.6. [117]Closing Connections
317          2.7. [118]Using C-Kermit with External Communication Programs
318               2.7.0. [119]C-Kermit over tn3270 and tn5250
319               2.7.1. [120]C-Kermit over Telnet
320               2.7.2. [121]C-Kermit over Rlogin
321               2.7.3. [122]C-Kermit over Serial Communication Programs
322               2.7.4. [123]C-Kermit over Secure Network Clients
323               2.7.4.1. [124]SSH
324               2.7.4.2. [125]SSL
325               2.7.4.3. [126]SRP
326               2.7.4.4. [127]SOCKS
327               2.7.4.5. [128]Kerberos and SRP
328          2.8. [129]Scripting Local Programs
329          2.9. [130]X.25 Networking
330               2.9.1. [131]IBM AIXLink/X.25 Network Provider Interface for AIX
331               2.9.2. [132]HP-UX X.25
332          2.10. [133]Additional Serial Port Controls
333          2.11. [134]Getting Access to the Dialout Device
334          2.12. [135]The Connection Log
335          2.13. [136]Automatic Connection-Specific Flow Control Selection
336          2.14. [137]Trapping Connection Establishment and Loss
337          2.15. [138]Contacting Web Servers with the HTTP Command
338      (3) [139]TERMINAL CONNECTION
339          3.1. [140]CONNECT Command Switches
340          3.2. [141]Triggers
341          3.3. [142]Transparent Printing
342          3.4. [143]Binary and Text Session Logs
343      (4) [144]FILE TRANSFER AND MANAGEMENT
344          4.0. [145]Bug Fixes, Minor Changes, and Clarifications
345          4.1. [146]File-Transfer Filename Templates
346          4.1.1. [147]Templates in the As-Name
347          4.1.2. [148]Templates on the Command Line
348          4.1.3. [149]Post-Transfer Renaming
349          4.2. [150]File-Transfer Pipes and Filters
350          4.2.1. [151]Introduction
351          4.2.1.1. [152]Terminology
352          4.2.1.2. [153]Notation
353          4.2.1.3. [154]Security
354          4.2.2. [155]Commands for Transferring from and to Pipes
355          4.2.2.1. [156]Sending from a Command
356          4.2.2.2. [157]Receiving to a Command
357          4.2.3. [158]Using File-Transfer Filters
358          4.2.3.1. [159]The SEND Filter
359          4.2.3.2. [160]The RECEIVE Filter
360          4.2.4. [161]Implicit Use of Pipes
361          4.2.5. [162]Success and Failure of Piped Commands
362          4.2.6. [163]Cautions about Using Pipes to Transfer Directory Trees
363          4.2.7. [164]Pipes and Encryption
364          4.2.8. [165]Commands and Functions Related to Pipes
365          4.2.8.1. [166]The OPEN !READ and OPEN !WRITE Commands
366          4.2.8.2. [167]The REDIRECT Command
367          4.2.8.3. [168]Receiving Mail and Print Jobs
368          4.2.8.4. [169]Pipe-Related Functions
369          4.3. [170]Automatic Per-File Text/Binary Mode Switching
370          4.3.1. [171]Exceptions
371          4.3.2. [172]Overview
372          4.3.3. [173]Commands
373          4.3.4. [174]Examples
374          4.4. [175]File Permissions
375          4.4.1. [176]When ATTRIBUTES PROTECTION is OFF
376          4.4.1.1. [177]Unix
377          4.4.1.2. [178]VMS
378          4.4.2. [179]When ATTRIBUTES PROTECTION is ON
379          4.4.2.1. [180]System-Specific Permissions
380          4.4.2.1.1. [181]UNIX
381          4.4.2.1.2. [182]VMS
382          4.4.2.2. [183]System-Independent Permissions
383          4.5. [184]File Management Commands
384          4.5.1. [185]The DIRECTORY Command
385          4.5.2. [186]The CD and BACK Commands
386          4.5.2.1. [187]Parsing Improvements
387          4.5.2.2. [188]The CDPATH
388          4.5.3. [189]Creating and Removing Directories
389          4.5.4. [190]The DELETE and PURGE Commands
390          4.6. [191]Starting the Remote Kermit Server Automatically
391          4.7. [192]File-Transfer Command Switches
392          4.7.1. [193]SEND Command Switches
393          4.7.2. [194]GET Command Switches
394          4.7.3. [195]RECEIVE Command Switches
395          4.8. [196]Minor Kermit Protocol Improvements
396          4.8.1. [197]Multiple Attribute Packets
397          4.8.2. [198]Very Short Packets
398          4.9. [199]Wildcard / File Group Expansion
399          4.9.1. [200]In UNIX C-Kermit
400          4.9.2. [201]In Kermit 95
401          4.9.3. [202]In VMS, AOS/VS, OS-9, VOS, etc.
402          4.10. [203]Additional Pathname Controls
403          4.11. [204]Recursive SEND and GET: Transferring Directory Trees
404          4.11.1. [205]Command-Line Options
405          4.11.2. [206]The SEND /RECURSIVE Command
406          4.11.3. [207]The GET /RECURSIVE Command
407          4.11.4. [208]New and Changed File Functions
408          4.11.5. [209]Moving Directory Trees Between Like Systems
409          4.11.6. [210]Moving Directory Trees Between Unlike Systems
410          4.12. [211]Where Did My File Go?
411          4.13. [212]File Output Buffer Control
412          4.14. [213]Improved Responsiveness
413          4.15. [214]Doubling and Ignoring Characters for Transparency
414          4.16. [215]New File-Transfer Display Formats
415          4.17. [216]New Transaction Log Formats
416          4.17.1. [217]The BRIEF Format
417          4.17.2. [218]The FTP Format
418          4.18. [219]Unprefixing NUL
419          4.19. [220]Clear-Channel Protocol
420          4.20. [221]Streaming Protocol
421          4.20.1. [222]Commands for Streaming
422          4.20.2. [223]Examples of Streaming
423          4.20.2.1. [224]Streaming on Socket-to-Socket Connections
424          4.20.2.2. [225]Streaming on Telnet Connections
425          4.20.2.3. [226]Streaming with Limited Packet Length
426          4.20.2.4. [227]Streaming on Dialup Connections
427          4.20.2.5. [228]Streaming on X.25 Connections
428          4.20.3. [229]Streaming - Preliminary Conclusions
429          4.21. [230]The TRANSMIT Command
430          4.22. [231]Coping with Faulty Kermit Implementations
431          4.22.1. [232]Failure to Accept Modern Negotiation Strings
432          4.22.2. [233]Failure to Negotiate 8th-bit Prefixing
433          4.22.3. [234]Corrupt Files
434          4.22.4. [235]Spurious Cancellations
435          4.22.5. [236]Spurious Refusals
436          4.22.6. [237]Failures during the Data Transfer Phase
437          4.22.7. [238]Fractured Filenames
438          4.22.8. [239]Bad File Dates
439          4.23. [240]File Transfer Recovery
440          4.24. [241]FILE COLLISION UPDATE Clarification
441          4.25. [242]Autodownload Improvements
442      (5) [243]CLIENT/SERVER
443          5.0. [244]Hints
444          5.1. [245]New Command-Line Options
445          5.2. [246]New Client Commands
446          5.3. [247]New Server Capabilities
447          5.3.1. [248]Creating and Removing Directories
448          5.3.2. [249]Directory Listings
449          5.4. [250]Syntax for Remote Filenames with Embedded Spaces
450          5.5. [251]Automatic Orientation Messages upon Directory Change
451          5.6. [252]New Server Controls
452          5.7. [253]Timeouts during REMOTE HOST Command Execution
453      (6) [254]INTERNATIONAL CHARACTER SETS
454          6.0. [255]ISO 8859-15 Latin Alphabet 9
455          6.1. [256]The HP-Roman8 Character Set
456          6.2. [257]Greek Character Sets
457          6.3. [258]Additional Latin-2 Character Sets
458          6.4. [259]Additional Cyrillic Character Sets
459          6.5. [260]Automatic Character-Set Switching
460          6.6. [261]Unicode
461          6.6.1. [262]Overview of Unicode
462          6.6.2. [263]UCS Byte Order
463          6.6.2. [264]UCS Transformation Formats
464          6.6.3. [265]Conformance Levels
465          6.6.4. [266]Relationship of Unicode with Kermit's Other Character Sets
466          6.6.5. [267]Kermit's Unicode Features
467          6.6.5.1. [268]File Transfer
468          6.6.5.2. [269]The TRANSLATE Command
469          6.6.5.3. [270]Terminal Connection
470          6.6.5.4. [271]The TRANSMIT Command
471          6.6.5.5. [272]Summary of Kermit Unicode Commands
472          6.7. [273]Client/Server Character-Set Switching
473      (7) [274]SCRIPT PROGRAMMING
474          7.0. [275]Bug Fixes
475          7.1. [276]The INPUT Command
476          7.1.1. [277]INPUT Timeouts
477          7.1.2. [278]New INPUT Controls
478          7.1.3. [279]INPUT with Pattern Matching
479          7.1.4. [280]The INPUT Match Result
480          7.2. [281]New or Improved Built-In Variables
481          7.3. [282]New or Improved Built-In Functions
482          7.4. [283]New IF Conditions
483          7.5. [284]Using More than Ten Macro Arguments
484          7.6. [285]Clarification of Function Call Syntax
485          7.7. [286]Autodownload during INPUT Command Execution
486          7.8. [287]Built-in Help for Functions.
487          7.9. [288]Variable Assignments
488          7.9.1. [289]Assignment Operators
489          7.9.2. [290]New Assignment Commands
490          7.10. [291]Arrays
491          7.10.1. [292]Array Initializers
492          7.10.2. [293]Turning a String into an Array of Words
493          7.10.3. [294]Arrays of Filenames
494          7.10.4. [295]Automatic Arrays
495          7.10.5. [296]Sorting Arrays
496          7.10.6. [297]Displaying Arrays
497          7.10.7. [298]Other Array Operations
498          7.10.8. [299]Hints for Using Arrays
499          7.10.9. [300]Do-It-Yourself Arrays
500          7.10.10. [301]Associative Arrays
501          7.11. [302]OUTPUT Command Improvements
502          7.12. [303]Function and Variable Diagnostics
503          7.13. [304]Return Value of Macros
504          7.14. [305]The ASSERT, FAIL, and SUCCEED Commands.
505          7.15. [306]Using Alarms
506          7.16. [307]Passing Arguments to Command Files
507          7.17. [308]Dialogs with Timed Responses
508          7.18. [309]Increased Flexibility of SWITCH Case Labels
509          7.19. "[310]Kerbang" Scripts
510          7.20. [311]IF and XIF Statement Syntax
511          7.20.1. [312]The IF/XIF Distinction
512          7.20.2. [313]Boolean Expressions (The IF/WHILE Condition)
513          7.21. [314]Screen Formatting and Cursor Control
514          7.22. [315]Evaluating Arithmetic Expressions
515          7.23. [316]Floating-Point Arithmetic
516          7.24. [317]Tracing Script Execution
517          7.25. [318]Compact Substring Notation
518          7.26. [319]New WAIT Command Options
519          7.26.1. [320]Waiting for Modem Signals
520          7.26.2. [321]Waiting for File Events
521          7.27. [322]Relaxed FOR and SWITCH Syntax
522      (8) [323]USING OTHER FILE TRANSFER PROTOCOLS
523      (9) [324]COMMAND-LINE OPTIONS
524          9.0. [325]Extended-Format Command-Line Options
525          9.1. [326]Command Line Personalities
526          9.2. [327]Built-in Help for Command Line Options
527          9.3. [328]New Command-Line Options
528     (10) [329]C-KERMIT AND G-KERMIT
529
530 III. [330]APPENDICES
531
532 III.1. [331]Character Set Tables
533 III.1.1. [332]The Hewlett Packard Roman8 Character Set
534 III.1.2. [333]Greek Character Sets
535 III.1.2.1. [334]The ISO 8859-7 Latin / Greek Alphabet
536 III.1.2.2. [335]The ELOT 927 Character Set
537 III.1.2.3. [336]PC Code Page 869
538 III.2. [337]Updated Country Codes
539
540 IV. [338]ERRATA & CORRIGENDA: Corrections to "Using C-Kermit" 2nd Edition.
541 V. [339]ADDITIONAL COPYRIGHT NOTICES
542
543 I. C-KERMIT DOCUMENTATION
544
545    The user manual for C-Kermit is:
546
547      Frank da Cruz and Christine M. Gianone, [340]Using C-Kermit, Second
548      Edition, Digital Press / Butterworth-Heinemann, Woburn, MA, 1997,
549      622 pages, ISBN 1-55558-164-1.
550
551    [341]CLICK HERE for reviews.
552
553    The present document is a supplement to Using C-Kermit 2nd Ed, not a
554    replacement for it.
555
556    US single-copy price: $52.95; quantity discounts available. Available
557    in bookstores or directly from Columbia University:
558
559   The Kermit Project
560   Columbia University
561   612 West 115th Street
562   New York NY  10025-7799
563   USA
564   Telephone: +1 (212) 854-3703
565   Fax:       +1 (212) 662-6442
566
567    Domestic and overseas orders accepted. Price: US $44.95 (US, Canada,
568    and Mexico). Shipping: $4.00 within the USA; $15.00 to all other
569    countries. Orders may be paid by MasterCard or Visa, or prepaid by
570    check in US dollars. Add $65 bank fee for checks not drawn on a US
571    bank. Do not include sales tax. Inquire about quantity discounts.
572
573    You can also order by phone from the publisher, Digital Press /
574    [342]Butterworth-Heinemann, with MasterCard, Visa, or American Express:
575
576   +1 800 366-2665   (Woburn, Massachusetts office for USA & Canada)
577   +44 1865 314627   (Oxford, England distribution centre for UK & Europe)
578   +61 03 9245 7111  (Melbourne, Vic, office for Australia & NZ)
579   +65 356-1968      (Singapore office for Asia)
580   +27 (31) 2683111  (Durban office for South Africa)
581
582    A [343]German-language edition of the First Edition is also available:
583
584      Frank da Cruz and Christine M. Gianone, C-Kermit - Einführung und
585      Referenz, Verlag Heinz Heise, Hannover, Germany (1994). ISBN
586      3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 88,00. Verlag
587      Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625 Hannover.
588      Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 52-1 29.
589
590    The [344]Kermit file transfer protocol is specified in:
591
592      Frank da Cruz, Kermit, A File Transfer Protocol, Digital Press,
593      Bedford, MA, 1987, 379 pages, ISBN 0-932376-88-6. US single-copy
594      price: $39.95. Availability as above.
595
596    News and articles about Kermit software and protocol are published
597    periodically in the journal, [345]Kermit News. Subscriptions are free;
598    contact Columbia University at the address above.
599
600    Online news about Kermit is published in the
601    [346]comp.protocols.kermit.announce and [347]comp.protocols.kermit.misc
602    newsgroups.
603
604 II. NEW FEATURES
605
606    Support for the Bell Labs Plan 9 operating system was added to version
607    6.0 too late to be mentioned in the book (although it does appear on
608    the cover).
609
610    Specific changes and additions are grouped together by major topic,
611    roughly corresponding to the chapters of [348]Using C-Kermit.
612
613 0. INCOMPATIBILITIES WITH PREVIOUS RELEASES
614
615     1. C-Kermit 7.0 uses FAST Kermit protocol settings by default. This
616        includes "unprefixing" of certain control characters. Because of
617        this, file transfers that worked with previous releases might not
618        work in the new release (but it is more likely that they will work,
619        and much faster). If a transfer fails, you'll get a
620        context-sensitive hint suggesting possible causes and cures.
621        Usually SET PREFIXING ALL does the trick.
622     2. C-Kermit 7.0 transfers files in BINARY mode by default. To restore
623        the previous behavior, put SET FILE TYPE TEXT in your C-Kermit
624        initialization file.
625     3. No matter whether FILE TYPE is BINARY or TEXT by default, C-Kermit
626        7.0 now switches between text and binary mode automatically on a
627        per-file basis according to various criteria, including (a) which
628        kind of platform is on the other end of the connection (if known),
629        (b) the version of Kermit on the other end, and (c) the file's name
630        (see [349]Section 4, especially [350]4.3). To disable this
631        automatic switching and restore the earlier behavior, put SET
632        TRANSFER MODE MANUAL in your C-Kermit initialization file. To
633        disable automatic switching for a particular transfer, include a
634        /TEXT or /BINARY switch with your SEND or GET command.
635     4. The RESEND and REGET commands automatically switch to binary mode;
636        previously if RESEND or REGET were attempted when FILE TYPE was
637        TEXT, these commands would fail immediately, with a message telling
638        you they work only when the FILE TYPE is BINARY. Now they simply do
639        this for you. See [351]Section 4.23 for additional (important)
640        information.
641     5. SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10 and
642        138) in case rlogin, ssh, or cu are "in the middle", since
643        otherwise <LF>~ might appear in Kermit packets, and this would
644        cause rlogin, ssh, or cu to disconnect, suspend, escape back, or
645        otherwise wreck the file transfer. Xon and Xoff are now always
646        prefixed too, even when Xon/Xoff flow control is not in effect,
647        since unprefixing them has proven dangerous on TCP/IP connections.
648     6. In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built
649        into C-Kermit itself rather than implemented by running an external
650        command or program. The built-in command might not behave the way
651        the platform-specific external one did, but many options are
652        available for customization. Of course the underlying
653        platform-specific command can still be accessed with "!", "@", or
654        "RUN" wherever the installation does not forbid. In UNIX, the "ls"
655        command can be accessed directly as "ls" in C-Kermit. See
656        [352]Section 4.5.1 for details.
657     7. SEND ? prints a list of switches rather than a list of filenames.
658        If you want to see a list of filenames, use a (system-dependent)
659        construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND
660        []? (VMS), etc. See [353]Sections 1.5 and [354]4.7.1.
661     8. In UNIX, OS-9, and Kermit 95, the wildcard characters in previous
662        versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and
663        }, with dash used inside []'s to denote ranges and comma used
664        inside {} to separate list elements. If you need to include any of
665        these characters literally in a filename, precede each one with
666        backslash (\). See [355]Section 4.9.
667     9. SET QUIET { ON, OFF } is now on the command stack, just like SET
668        INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458
669        of [356]Using C-Kermit, 2nd Edition. This allows any macro or
670        command file to SET QUIET ON or OFF without worrying about saving
671        and restoring the global QUIET value. For example, this lets you
672        write a script that tries SET LINE on lots of devices until it
673        finds one free without spewing out loads of error messages, and
674        also without disturbing the global QUIET setting, whatever it was.
675    10. Because of the new "." operator (which introduces assignments),
676        macros whose names begin with "." can not be invoked "by name".
677        However, they still can be invoked with DO.
678    11. The syntax of the EVALUATE command has changed. See [357]Section
679        7.9.2. To restore the previous syntax, use SET EVALUATE OLD.
680    12. The \v(directory) variable now includes the trailing directory
681        separator; in previous releases it did not. This is to allow
682        constructions such as:
683   cd \v(dir)data.tmp
684
685        to work across platforms that might have different directory
686        notation, such as UNIX, Windows, and VMS.
687    13. Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and
688        sticky. In C-Kermit 7.0, there is an array of default flow-control
689        values for each kind of connection, that are applied automatically
690        at SET LINE/PORT/HOST time. Thus a SET FLOW command given before
691        SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can
692        be guaranteed to have the desired effect only if given after the
693        SET LINE/PORT/HOST command.
694    14. Character-set translation works differently in the TRANSMIT command
695        when (a) the file character-set is not the same as the local end of
696        the terminal character-set, or (b) when the terminal character-set
697        is TRANSPARENT.
698
699 1. PROGRAM AND FILE MANAGEMENT AND COMMANDS
700
701 1.0. Bug Fixes
702
703    The following patches were issued to correct bugs in C-Kermit 6.0.
704    These are described in detail in the 6.0 PATCHES file. All of these
705    fixes have been incorporated in C-Kermit 6.1 (never released except as
706    K95 1.1.16-17) and 7.0.
707
708  0001   All UNIX         C-Kermit mishandles timestamps on files before 1970
709  0002   Solaris 2.5++    Compilation error on Solaris 2.5 with Pro C
710  0003   All VMS          CKERMIT.INI Fix for VMS
711  0004   VMS/VAX/UCX 2.0  C-Kermit 6.0 can't TELNET on VAX/VMS with UCX 2.0
712  0005   All              C-Kermit Might Send Packets Outside Window
713  0006   All              MOVE from SEND-LIST does not delete original files
714  0007   Solaris 2.5++    Higher serial speeds on Solaris 2.5
715  0008   All              C-Kermit application file name can't contain spaces
716  0009   AT&T 7300 UNIXPC setuid and hardware flow-control problems
717  0010   Linux on Alpha   Patch to make ckutio.c compile on Linux/Alpha
718  0011   OS-9/68000 2.4   Patch to make ck9con.c compile on OS-9/68000 2.4
719  0012   MW Coherent 4.2  Patches for successful build on Coherent 4.2
720  0013   SINIX-Y 5.43     "delay" variable conflicts with <sys/clock.h>
721  0014   VMS/VAX/CMU-IP   Subject: Patches for VAX/VMS 5.x + CMU-IP
722  0015   All              XECHO doesn't flush its output
723  0016   VMS              CD and other directory operations might not work
724  0017   Linux 1.2.x++    Use standard POSIX interface for high serial speeds
725  0018   UNIX             SET WILDCARD-EXPANSION SHELL dumps core
726  0019   All              Hayes V.34 modem init string problem
727  0020   All              READ command does not fail if file not open
728  0021   All              Problems with long function arguments
729  0022   All              Certain \function()s can misbehave
730  0023   All              X MOD 0 crashes program
731  0024   All              Internal bulletproofing for lower() function
732  0025   OpenBSD          Real OpenBSD support for C-Kermit 6.0
733  0026   All              Incorrect checks for macro/command-file nesting depth
734  0027   All              ANSWER doesn't automatically CONNECT
735  0028   All              Overzealous EXIT warning
736  0029   All              OUTPUT doesn't echo when DUPLEX is HALF
737  0030   All              Minor problems with REMOTE DIRECTORY/DELETE/etc
738  0031   All              CHECK command broken
739  0032   All              Problem with SET TRANSMIT ECHO
740  0033   UNIX, VMS, etc   HELP SET SERVER says too much
741  0034   All              READ and !READ too picky about line terminators
742  0035   All              END from inside SWITCH doesn't work
743  0036   All              Problem telnetting to multihomed hosts
744  0037   All              Redirection failures in REMOTE xxx > file
745
746    REDIRECT was missing in many UNIX C-Kermit implementations; in version
747    7.0, it should be available in all of them.
748
749 1.1. Command Continuation
750
751    Comments that start with ";" or "#" can no longer be continued. In:
752
753   ; this is a comment -
754   echo blah
755
756    the ECHO command will execute, rather than being taken as a
757    continuation of the preceding comment line. This allows easy
758    "commenting out" of commands from macro definitions.
759
760    However, the text of the COMMENT command can still be continued onto
761    subsequent lines:
762
763   comment this is a comment -
764   echo blah
765
766    As of version 6.0, backslash is no longer a valid continuation
767    character. Only hyphen should be used for command continuation. This is
768    to make it possible to issue commands like "cd a:\" on DOS-like
769    systems.
770
771    As of version 7.0:
772
773      * You can quote a final dash to prevent it from being a continuation
774        character:
775   echo foo\-
776
777        This prints "foo-". The command is not continued.
778      * You can enter commands such as:
779   echo foo - ; this is a comment
780
781        interactively and they are properly treated as continued commands.
782        Previously this worked only in command files.
783
784 1.2. Editor Interface
785
786    SET EDITOR name [ options ]
787           Lets you specify a text-editing program. The name can be a fully
788           specified pathname like /usr/local/bin/emacs19/emacs, or it can
789           be the name of any program in your PATH, e.g. "set editor
790           emacs". In VMS, it must be a DCL command like "edit",
791           "edit/tpu", "emacs", etc. If an environment variable EDITOR is
792           defined when Kermit starts, its value is the default editor. You
793           can also specify options to be included on the editor command
794           line. Returns to Kermit when the editor exits.
795
796    EDIT [ filename ]
797           If the EDIT command is given without a filename, then if a
798           previous filename had been given to an EDIT command, it is used;
799           if not, the editor is started without a file. If a filename is
800           given, the editor is started on that file, and the filename is
801           remembered for subsequent EDIT commands.
802
803    SHOW EDITOR
804           Displays the full pathname of your text editor, if any, along
805           with any command line options, and the file most recently edited
806           (and therefore the default filename for your next EDIT command).
807
808    Related variables: \v(editor), \v(editopts), \v(editfile).
809
810 1.3. Web Browser and FTP Interface
811
812    C-Kermit includes an FTP command, which simply runs the FTP program;
813    C-Kermit does not include any built-in support for Internet File
814    Transfer Protocol, nor any method for interacting directly with an FTP
815    server. In version 7.0, however, C-Kermit lets you specify your FTP
816    client:
817
818    SET FTP-CLIENT [ name [ options ] ]
819           The name is the name of the FTP executable. In UNIX, Windows, or
820           OS/2, it can be the filename of any executable program in your
821           PATH (e.g. "ftp.exe" in Windows, "ftp" in UNIX); elsewhere (or
822           if you do not have a PATH definition), it must be the fully
823           specified pathname of the FTP program. If the name contains any
824           spaces, enclose it braces. Include any options after the
825           filename; these depend the particular ftp client.
826
827    The Web browser interface is covered in the following subsections.
828
829 1.3.1. Invoking your Browser from C-Kermit
830
831    BROWSE [ url ]
832           Starts your preferred Web browser on the URL, if one is given,
833           otherwise on the most recently given URL, if any. Returns to
834           Kermit when the browser exits.
835
836    SET BROWSER [ name [ options ] ]
837           Use this command to specify the name of your Web browser
838           program, for example: "set browser lynx". The name must be in
839           your PATH, or else it must be a fully specified filename; in VMS
840           it must be a DCL command.
841
842    SHOW BROWSER
843           Displays the current browser, options, and most recent URL.
844
845    Related variables: \v(browser), \v(browsopts), \v(browsurl).
846
847    Also see [358]Section 2.15: Contacting Web Servers with the HTTP
848    Command.
849
850 1.3.2. Invoking C-Kermit from your Browser
851
852    The method for doing this depends, of course, on your browser. Here are
853    some examples:
854
855    Netscape on UNIX (X-based)
856           In the Options->Applications section, set your Telnet
857           application to:
858
859   xterm -e /usr/local/bin/kermit/kermit -J %h %p
860
861           (replace "/usr/local/bin/kermit/kermit" by C-Kermit's actual
862           pathname). -J is C-Kermit's command-line option to "be like
863           Telnet"; %h and %p are Netscape placeholders for hostname and
864           port.
865
866    Lynx on UNIX
867           As far as we know, this can be done only at compile time. Add
868           the following line to the Lynx userdefs.h file before building
869           the Lynx binary:
870
871   #define TELNET_COMMAND "/opt/bin/kermit -J"
872
873           And then add lines like the following to the Lynx.cfg file:
874
875   DOWNLOADER:Kermit binary download:/opt/bin/kermit -i -V -s %s -a %s:TRUE
876   DOWNLOADER:Kermit text download:/opt/bin/kermit -s %s -a %s:TRUE
877
878   UPLOADER:Kermit binary upload:/opt/bin/kermit -i -r -a %s:TRUE
879   UPLOADER:Kermit text upload:/opt/bin/kermit -r -a %s:TRUE
880   UPLOADER:Kermit text get:/opt/bin/kermit -g %s:TRUE
881   UPLOADER:Kermit binary get:/opt/bin/kermit -ig %s:TRUE
882
883    But none of the above is necessary if you make C-Kermit your default
884    Telnet client, which you can do by making a symlink called 'telnet' to
885    the C-Kermit 7.0 binary. See [359]Section 9.1 for details.
886
887 1.4. Command Editing
888
889    Ctrl-W ("Word delete") was changed in 7.0 to delete back to the
890    previous non-alphanumeric, rather than all the way back to the previous
891    space.
892
893 1.5. Command Switches
894
895    As of version 7.0, C-Kermit's command parser supports a new type of
896    field, called a "switch". This is an optional command modifier.
897
898 1.5.1. General Switch Syntax
899
900    A switch is a keyword beginning with a slash (/). If it takes a value,
901    then the value is appended to it (with no intervening spaces),
902    separated by a colon (:) or equal sign (=). Depending on the switch,
903    the value may be a number, a keyword, a filename, a date/time, etc.
904    Examples:
905
906   send oofa.txt                              ; No switches
907   send /binary oofa.zip                      ; A switch without a value
908   send /protocol:zmodem oofa.zip             ; A switch with a value (:)
909   send /protocol=zmodem oofa.zip             ; A switch with a value (=)
910   send /text /delete /as-name:x.x oofa.txt   ; Several switches
911
912    Like other command fields, switches are separated from other fields,
913    and from each other, by whitespace, as shown in the examples just
914    above. You can not put them together like so:
915
916   send/text/delete/as-name:x.x oofa.txt
917
918    (as you might do in VMS or DOS, or as we might once have done in
919    TOPS-10 or TOPS0-20, or PIP). This is primarily due to ambiguity
920    between "/" as switch introducer versus "/" as UNIX directory
921    separator; e.g. in:
922
923   send /delete/as-name:foo/text oofa.txt
924
925    Does "foo/text" mean the filename is "foo" and the transfer is to be in
926    text mode, or does it mean the filename is "foo/text"? Therefore we
927    require whitespace between switches to resolve the ambiguity. (That's
928    only one of several possible ambiguities -- it is also conceivable that
929    a file called "text" exists in the path "/delete/as-name:foo/").
930
931    In general, if a switch can take a value, but you omit it, then either
932    a reasonable default value is supplied, or an error message is printed:
933
934   send /print:-Plaserwriter oofa.txt         ; Value included = print options
935   send /print oofa.txt                       ; Value omitted, OK
936   send /mail:kermit@columbia.edu oofa.txt    ; Value included = address
937   send /mail oofa.txt                        ; Not OK - address required
938   ?Address required
939
940    Context-sensitive help (?) and completion (Esc or Tab) are available in
941    the normal manner:
942
943   C-Kermit> send /pr? Switch, one of the following:
944     /print /protocol
945   C-Kermit> send /pro<ESC>tocol:?  File-transfer protocol,
946    one of the following:
947     kermit   xmodem   ymodem   ymodem-g   zmodem
948   C-Kermit> send /protocol:k<TAB>ermit
949
950    If a switch takes a value and you use completion on it, a colon (:) is
951    printed at the end of its name to indicate this. If it does not take a
952    value, a space is printed.
953
954    Also, if you type ? in a switch field, switches that take values are
955    shown with a trailing colon; those that don't take values are shown
956    without one.
957
958 1.5.2. Order and Effect of Switches
959
960    The order of switches should not matter, except that they are evaluated
961    from left to right, so if you give two switches with opposite effects,
962    the rightmost one is used:
963
964   send /text /binary oofa.zip                ; Sends oofa.zip in binary mode.
965
966    Like other command fields, switches have no effect whatsoever until the
967    command is entered (by pressing the Return or Enter key). Even then,
968    switches affect only the command with which they are included; they do
969    not have global effect or side effects.
970
971 1.5.3. Distinguishing Switches from Other Fields
972
973    All switches are optional. A command that uses switches lets you give
974    any number of them, including none at all. Example:
975
976   send /binary oofa.zip
977   send /bin /delete oofa.zip
978   send /bin /as-name:mupeen.zip oofa.zip
979   send oofa.zip
980
981    But how does Kermit know when the first "non-switch" is given? It has
982    been told to look for both a switch and for something else, the data
983    type of the next field (filename, number, etc). In most cases, this
984    works well. But conflicts are not impossible. Suppose, for example, in
985    UNIX there was a file named "text" in the top-level directory. The
986    command to send it would be:
987
988   send /text
989
990    But C-Kermit would think this was the "/text" switch. To resolve the
991    conflict, use braces:
992
993   send {/text}
994
995    or other circumlocutions such as "send //text", "send /./text", etc.
996
997    The opposite problem can occur if you give an illegal switch that
998    happens to match a directory name. For example:
999
1000   send /f oofa.txt
1001
1002    There is no "/f" switch (there are several switches that begin with
1003    "/f", so "/f" is ambiguous). Now suppose there is an "f" directory in
1004    the root directory; then this command would be interpreted as:
1005
1006      Send all the files in the "/f" directory, giving each one an as-name
1007      of "oofa.txt".
1008
1009    This could be a mistake, or it could be exactly what you intended;
1010    C-Kermit has no way of telling the difference. To avoid situations like
1011    this, spell switches out in full until you are comfortable enough with
1012    them to know the minimum abbreviation for each one. Hint: use ? and
1013    completion while typing switches to obtain the necessary feedback.
1014
1015 1.5.4. Standard File Selection Switches
1016
1017    The following switches are used on different file-oriented commands
1018    (such as SEND, DIRECTORY, DELETE, PURGE) to refine the selection of
1019    files that match the given specification.
1020
1021    /AFTER:date-time
1022           Select only those files having a date-time later than the one
1023           given. See [360]Section 1.6 for date-time formats. Synonym:
1024           /SINCE.
1025
1026    /NOT-AFTER:date-time
1027           Select only those files having a date-time not later than (i.e.
1028           earlier or equal to) the one given. Synonym: /NOT-SINCE.
1029
1030    /BEFORE:date-time
1031           Select only those files having a date-time earlier than the one
1032           given.
1033
1034    /NOT-BEFORE:date-time
1035           Select only those files having a date-time not earlier than
1036           (i.e. later or equal to) the one given.
1037
1038    /DOTFILES
1039           UNIX and OS-9 only: The filespec is allowed to match files whose
1040           names start with (dot) period. Normally these files are not
1041           shown.
1042
1043    /NODOTFILES
1044           (UNIX and OS-9 only) Don't show files whose names start with dot
1045           (period). This is the opposite of /DOTFILES, and is the default.
1046           Note that when a directory name starts with a period, the
1047           directory and (in recursive operations) all its subdirectories
1048           are skipped.
1049
1050    /LARGER-THAN:number
1051           Only select files larger than the given number of bytes.
1052
1053    /SMALLER-THAN:number
1054           Only select files smaller than the given number of bytes.
1055
1056    /EXCEPT:pattern
1057           Specifies that any files whose names match the pattern, which
1058           can be a regular filename, or may contain "*" and/or "?"
1059           metacharacters (wildcards), are not to be selected. Example:
1060
1061   send /except:*.log *.*
1062
1063           sends all files in the current directory except those with a
1064           filetype of ".log". Another:
1065
1066   send /except:*.~*~ *.*
1067
1068           sends all files except the ones that look like Kermit or EMACS
1069           backup files (such as "oofa.txt.~17~") (of course you can also
1070           use the /NOBACKUP switch for this).
1071
1072           The pattern matcher is the same one used by IF MATCH string
1073           pattern ([361]Section 7.4), so you can test your patterns using
1074           IF MATCH. If you need to match a literal * or ? (etc), precede
1075           it by a backslash (\). If the pattern contains any spaces, it
1076           must be enclosed in braces:
1077
1078   send /except:{Foo bar} *.*
1079
1080           The pattern can also be a list of up to 8 patterns. In this
1081           case, the entire pattern must be enclosed in braces, and each
1082           sub-pattern must also be enclosed in braces; this eliminates the
1083           need for designating a separator character, which is likely to
1084           also be a legal filename character on some platform or other,
1085           and therefore a source of confusion. You may include spaces
1086           between the subpatterns but they are not necessary. The
1087           following two commands are equivalent:
1088
1089   send /except:{{ck*.o} {ck*.c}} ck*.?
1090   send /except:{{ck*.o}{ck*.c}} ck*.?
1091
1092           If a pattern is to include a literal brace character, precede it
1093           with "\". Also note the apparent conflict of this list format
1094           and the string-list format described in [362]Section 4.9.1. In
1095           case you want to include a wildcard string-list with braces on
1096           its outer ends as an /EXCEPT: argument, do it like this:
1097
1098   send /except:{{{ckuusr.c,ckuus2.c,ckuus6.c}}} ckuus*.c
1099
1100 1.5.5. Setting Preferences for Different Commands
1101
1102    Certain oft-used commands offer lots of switches because different
1103    people have different requirements or preferences. For example, some
1104    people want to be able to delete files without having to watch a list
1105    of the deleted files scroll past, while others want to be prompted for
1106    permission to delete each file. Different people prefer different
1107    directory-listing styles. And so on. Such commands can be tailored with
1108    the SET OPTIONS command:
1109
1110    SET OPTIONS command [ switch [ switch [ ... ] ] ]
1111           Sets each switch as the default for the given command, replacing
1112           the "factory default". Of course you can also override any
1113           defaults established by the SET OPTIONS command by including the
1114           relevant switches in the affected command any time you issue it.
1115
1116    SHOW OPTIONS
1117           Lists the commands that allows option-setting, and the options
1118           currently in effect, if any, for each. Switches that have
1119           synonyms are shown under their primary name; for example. /LOG
1120           and /VERBOSE are shown as /LIST.
1121
1122    Commands for which options may be set include DIRECTORY, DELETE, PURGE,
1123    and TYPE. Examples:
1124
1125   SET OPTIONS DIRECTORY /PAGE /NOBACKUP /HEADING /SORT:DATE /REVERSE
1126   SET OPTIONS DELETE /LIST /NOHEADING /NOPAGE /NOASK /NODOTFILES
1127   SET OPTIONS TYPE /PAGE
1128
1129    Not necessarily all of a command's switches can be set as options. For
1130    example, file selection switches, since these would normally be
1131    different for each command.
1132
1133    Put the desired SET OPTIONS commands in your C-Kermit customization
1134    file for each command whose default switches you want to change every
1135    time you run C-Kermit.
1136
1137 1.6. Dates and Times
1138
1139    Some commands and switches take date-time values, such as:
1140
1141   send /after:{8-Feb-2000 10:28:01}
1142
1143    Various date-time formats are acceptable. The rules for the date are:
1144
1145      * The year must have 4 digits.
1146      * If the year comes first, the second field is the month.
1147      * The day, month, and year may be separated by spaces, /, -, or
1148        underscore.
1149      * The month may be numeric (1 = January) or spelled out or
1150        abbreviated in English.
1151
1152    If the date-time string contains any spaces, it must be enclosed in
1153    braces. Examples of legal dates:
1154
1155                            Interpretation:
1156   2000-Feb-8                8 February 2000
1157   {2000 Feb 8}              8 February 2000
1158   2000/Feb/8                8 February 2000
1159   2000_Feb_8                8 February 2000
1160   2000-2-8                  8 February 2000
1161   2000-02-08                8 February 2000
1162   8-Feb-2000                8 February 2000
1163   08-Feb-2000               8 February 2000
1164   12/25/2000                25 December 2000
1165   25/12/2000                25 December 2000
1166
1167    The last two examples show that when the year comes last, and the month
1168    is given numerically, the order of the day and month doesn't matter as
1169    long as the day is 13 or greater (mm/dd/yyyy is commonly used in the
1170    USA, whereas dd/mm/yyyy is the norm in Europe). However:
1171
1172   08/02/2000                Is ambiguous and therefore not accepted.
1173
1174    If a date is given, the time is optional and defaults to 00:00:00. If
1175    the time is given with a date, it must follow the date, separated by
1176    space, /, -, or underscore, and with hours, minutes, and seconds
1177    separated by colon (:). Example:
1178
1179   2000-Feb-8 10:28:01       Represents 8 February 2000, 10:28:01am
1180
1181    If a date is not given, the current date is used and a time is
1182    required.
1183
1184    Time format is hh:mm:ss or hh:mm or hh in 24-hour format, or followed
1185    by "am" or "pm" (or "AM" or "PM") to indicate morning or afternoon.
1186    Examples of times that are acceptable:
1187
1188                            Interpretation:
1189   3:23:56                    3:23:56am
1190   3:23:56am                  3:23:56am
1191   3:23:56pm                  3:23:56pm = 15:23:56
1192  15:23:56                    3:23:56pm = 15:23:56
1193   3:23pm                     3:23:00pm = 15:23:00
1194   3:23PM                     3:23:00pm = 15:23:00
1195   3pm                        3:00:00pm = 15:00:00
1196
1197    Examples of legal date-times:
1198
1199   send /after:{8 Feb 2000 10:28:01}
1200   send /after:8_Feb_2000_10:28:01
1201   send /after:8-Feb-2000/10:28:01
1202   send /after:2000/02/08/10:28:01
1203   send /after:2000/02/08_10:28:01
1204   send /after:2000/02/08_10:28:01am
1205   send /after:2000/02/08_10:28:01pm
1206   send /after:2000/02/08_10:28pm
1207   send /after:2000/02/08_10pm
1208   send /after:10:00:00pm
1209   send /after:10:00pm
1210   send /after:10pm
1211   send /after:22
1212
1213    Finally, there is a special all-numeric format you can use:
1214
1215   yyyymmdd hh:mm:ss
1216
1217    For example:
1218
1219   20000208 10:28:01
1220
1221    This is Kermit's standard date-time format (based on ISO 8601), and is
1222    accepted (among other formats) by any command or switch that requires a
1223    date-time, and is output by any function whose result is a calendar
1224    date-time.
1225
1226    There are no optional parts to this format and it must be exactly 17
1227    characters long, punctuated as shown (except you can substitute
1228    underscore for space in contexts where a single "word" is required).
1229    The time is in 24-hour format (23:00:00 is 11:00pm). This is the format
1230    returned by \fdate(filename), so you can also use constructions like
1231    this:
1232
1233   send /after:\fdate(oofa.txt)
1234
1235    which means "all files newer than oofa.txt".
1236
1237    Besides explicit dates, you can also use the any of the following
1238    shortcuts:
1239
1240    TODAY
1241           Stands for the current date at 00:00:00.
1242
1243    TODAY 12:34:56
1244           Stands for the current date at the given time.
1245
1246    YESTERDAY
1247           Stands for yesterday's date at 00:00:00. A time may also be
1248           given.
1249
1250    TOMORROW
1251           Stands for tomorrow's date at 00:00:00. A time may also be
1252           given.
1253
1254    + number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
1255           Is replaced by the future date indicated, relative to the
1256           current date. If the time is omitted, 00:00:00 is used.
1257           Examples: +3days, +2weeks, +1year, +37months.
1258
1259    - number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
1260
1261           Is replaced by the past date indicated, relative to the current
1262           date. If the time is omitted, 00:00:00 is used.
1263
1264    The time can be separated from the date shortcut by any of the same
1265    separators that are allowed for explicit date-times: space, hyphen,
1266    slash, period, or underscore. In switches and other space-delimited
1267    fields, use non-spaces to separate date/time fields, or enclose the
1268    date-time in braces, e.g.:
1269
1270   purge /before:-4days_12:00:00
1271   purge /before:{- 4 days 12:00:00}
1272
1273    Of course you can also use variables:
1274
1275   define \%n 43
1276   purge /before:-\%ndays_12:00:00
1277
1278    Shortcut names can be abbreviated to any length that still
1279    distinguishes them from any other name that can appear in the same
1280    context, e.g. "TOD" for today, "Y" for yesterday. Also, the special
1281    abbreviation "wks" is accepted for WEEKS, and "yrs" for "YEARS".
1282
1283    (To see how to specify dates relative to a specific date, rather than
1284    the current one, see the [363]\fmjd() function description below.)
1285
1286    You can check date formats with the DATE command. DATE by itself prints
1287    the current date and time in standard format: yyyymmdd hh:mm:ss. DATE
1288    followed by a date and/or time (including shortcuts) converts it to
1289    standard format if it can understand it, otherwise it prints an error
1290    message.
1291
1292    The following variables and functions deal with dates and times; any
1293    function argument designated as "date-time" can be in any of the
1294    formats described above.
1295
1296    \v(day)
1297           The first three letters of the English word for the current day
1298           of the week, e.g. "Wed".
1299
1300    \fday(date-time)
1301           The first three letters of the English word for day of the week
1302           of the given date. If a time is included, it is ignored.
1303           Example: \fday(8 Feb 1988) = "Mon".
1304
1305    \v(nday)
1306           The numeric day of the week: 0 = Sunday, 1 = Monday, ..., 6 =
1307           Saturday.
1308
1309    \fnday(date-time)
1310           The numeric day of the week for the given date. If a time is
1311           included, it is ignored. Example: \fnday(8 Feb 1988) = "1".
1312
1313    \v(date)
1314           The current date as dd mmm yyyy, e.g. "08 Feb 2000" (as in this
1315           example, a leading zero is supplied for day-of-month less than
1316           10).
1317
1318    \v(ndate)
1319           The current date in numeric format: yyyymmdd, e.g. "20000208".
1320
1321    \v(time)
1322           The current time as hh:mm:ss, e.g. "15:27:14".
1323
1324    \ftime(time)
1325           The given free-format date and/or time (e.g. "3pm") returns the
1326           time (without the date) converted to hh:mm:ss 24-hour format,
1327           e.g. "15:00:00" (the date, if given, is ignored).
1328
1329    \v(ntime)
1330           The current time as seconds since midnight, e.g. "55634".
1331
1332    \v(tftime)
1333           The elapsed time of the most recent file-transfer operation in
1334           seconds.
1335
1336    \v(intime)
1337           The elapsed time for the most recent INPUT command to complete,
1338           in milliseconds.
1339
1340    \fntime(time)
1341           The given free-format date and/or time is converted to seconds
1342           since midnight (the date, if given, is ignored). This function
1343           replaces \ftod2secs(), which is now a synonym for \fntime().
1344           Unlike \ftod2secs(), \fntime() allows a date to be included, and
1345           it allows the time to be in free format (like 3pm), and it
1346           allows the amount of time to be more than 24 hours. E.g.
1347           \fntime(48:00:00) = 172800. Example of use:
1348
1349   set alarm \fntime(48:00:00) ; set alarm 48 hours from now.
1350
1351    \fn2time(seconds)
1352           The given number of seconds is converted to hh:mm:ss format.
1353
1354    \fdate(filename)
1355           Returns the modification date-time of the given file in standard
1356           format: yyyymmdd hh:mm:ss.
1357
1358    \fcvtdate(date-time)
1359           Converts a free-format date and/or time to Kermit standard
1360           format: yyyymmdd hh:mm:ss. If no argument is given, returns the
1361           current date-time in standard format. If a date is given but no
1362           time, the converted date is returned without a time. If a time
1363           is given with no date, the current date is supplied. Examples:
1364
1365   \fcvtdate(4 Jul 2000 2:21:17pm) = 20000704 14:21:17
1366   \fcvtdate() = 20000704 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
1367   \fcvtd(4 Jul 2000) = 20000704
1368   \fcvtd(6pm) = 20000704 18:00:00 (on 4 Jul 2000 at 6:00pm).
1369
1370    \fdayofyear(date-time)
1371    \fdoy(date-time)
1372           Converts a free-format date and/or time to yyyyddd, where ddd is
1373           the 3-digit day of the year, and 1 January is Day 1. If a time
1374           is included with the date, it is returned in standard format. If
1375           a date is included but no time, the date is returned without a
1376           time. If a time is given with no date, the time is converted and
1377           the current date is supplied. If no argument is given, the
1378           current date-time is returned. Synonym: \fdoy(). Examples:
1379
1380   \fddayofyear(4 Jul 2000 2:21:17pm) = 2000185 14:21:17
1381   \fdoy() = 2000185 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
1382   \fdoy(4 Jul 2000) = 2000185
1383   \fdoy(6pm) = 2000185 18:00:00 (on 4 Jul 2000 at 6:00pm).
1384
1385    Note: The yyyyddd day-of-year format is often erroneously referred to
1386    as a Julian date. However, a true Julian date is a simple counting
1387    number, the number of days since a certain fixed day in the past.
1388    [364]See \fmjd() below.
1389
1390    \fdoy2date(date-time)
1391           Converts a date or date-time in day-of-year format to a standard
1392           format date. A yyyyddd-format date must be supplied; time is
1393           optional. The given date is converted to yyyymmdd format. If a
1394           time is given, it is converted to 24-hour format. Examples:
1395
1396   \fdoy2date(2000185) = 20000704
1397   \fdoy2(2000185 3pm) = 20000704 15:00:00
1398
1399    \fmjd(date-time)
1400           Converts free-format date and/or time to a Modified Julian Date
1401           (MJD), the number of days since 17 Nov 1858 00:00:00. If a time
1402           is given, it is ignored. Examples:
1403
1404   \fmjd(4 Jul 2000) = 50998
1405   \fmjd(17 Nov 1858) = 0
1406   \fmjd(16 Nov 1858) = -1
1407
1408    \fmjd2date(mjd)
1409           Converts an MJD (integer) to standard date format, yyyymmdd:
1410
1411   \fmjd2(50998) = 4 Jul 1998
1412   \fmjd2(0) = 17 Nov 1858
1413   \fmjd2(-1) = 16 Nov 1858
1414   \fmjd2(-365) = 17 Nov 1857
1415
1416    MJDs are normal integers and, unlike DOYs, may be added, subtracted,
1417    etc, with each other or with other integers, to obtain meaningful
1418    results. For example, to find out the date 212 days ago:
1419
1420   echo \fmjd2date(\fmjd()-212)
1421
1422    Constructions such as this can be used in any command where a date-time
1423    is required, e.g.:
1424
1425   send /after:\fmjd2date(\fmjd()-212)
1426
1427    to send all files that are not older than 212 days (this is equivalent
1428    to "send /after:-212days").
1429
1430    MJDs also have other regularities not exhibited by other date formats.
1431    For example, \fmodulus(\fmjd(any-date),7) gives the day of the week for
1432    any date (where 4=Sun, 5=Mon, ..., 3=Sat). (However, it is easier to
1433    use \fnday() for this purpose, and it gives the more conventional
1434    result of 0=Sun, 1=Mon, ..., 6=Sat).
1435
1436    Note that if MJDs are to be compared, they must be compared numerically
1437    (IF <, =, >) and not lexically (IF LLT, EQUAL, LGT), whereas DOYs must
1438    be compared lexically if they include a time (which contains ":"
1439    characters); however, if DOYs do not include a time, they may also be
1440    compared numerically.
1441
1442    In any case, lexical comparison of DOYs always produces the appropriate
1443    result, as does numeric comparison of MJDs.
1444
1445    The same comments apply to sorting. Also note that DOYs are fixed
1446    length, but MJDs can vary in length. However, all MJDs between 3 April
1447    1886 and 30 Aug 2132 are 5 decimal digits long. (MJDs become 6 digits
1448    long on 31 Aug 2132, and 7 digits long on 13 Oct 4596).
1449
1450 1.7. Partial Completion of Keywords
1451
1452    Partial completion of keywords was added in C-Kermit 7.0. In prior
1453    versions, if completion was attempted (by pressing the Esc or Tab key)
1454    on a string that matched different keywords, you'd just get a beep. Now
1455    Kermit completes up to the first character where the possibly matching
1456    keywords differ and then beeps. For example:
1457
1458   C-Kermit> send /n<Tab>
1459
1460    which matches /NOT-BEFORE and /NOT-AFTER, now completes up to the dash:
1461
1462   C-Kermit> send /n<Tab>ot-<Beep>
1463
1464    Partial completion works for filenames too (as it has for some years).
1465
1466 1.8. Command Recall
1467
1468    C-Kermit has had a command history buffer for some time, which could be
1469    scrolled interactively using control characters or (in Kermit 95 only)
1470    arrow keys. Version 7.0 adds a REDO command that allows the most recent
1471    command matching a given pattern to be re-executed:
1472
1473    { REDO, RR, ^ } [ pattern ]
1474           Search the command history list for the most recent command that
1475           matches the given pattern, and if one is found, execute it
1476           again.
1477
1478    The pattern can be a simple string (like "send"), in which case the
1479    last SEND command is re-executed. Or it can contain wildcard characters
1480    "*" and/or "?", which match any string and any single character,
1481    respectively (note that "?" must be preceded by backslash to override
1482    its normal function of giving help), and in most C-Kermit versions may
1483    also include [] character lists and {} string lists (see [365]Section
1484    4.9).
1485
1486    The match works by appending "*" to the end of the given pattern (if
1487    you didn't put one there yourself). Thus "redo *oofa" becomes "redo
1488    *oofa*" and therefore matches the most recent command that contains
1489    "oofa" anywhere within the command. If you want to inhibit the
1490    application of the trailing "*", e.g. to force matching a string at the
1491    end of a command, enclose the pattern in braces:
1492
1493   redo {*oofa}
1494
1495    matches the most recent command that ends with "oofa".
1496
1497    REDO commands themselves are not entered into the command history list.
1498    If no pattern is given, the previous (non-REDO) command is re-executed.
1499    The REDOne command is reinserted at the end of the command history
1500    buffer, so the command scrollback character (Ctrl-P, Ctrl-B, or
1501    Uparrow) can retrieve it.
1502
1503    Examples:
1504
1505   C-Kermit> echo foo
1506   foo
1507   C-Kermit> show alarm
1508   (no alarm set)
1509   C-Kermit> echo blah
1510   blah
1511   C-Kermit> redo          ; Most recent command
1512   blah
1513   C-Kermit> redo s        ; Most recent command starting with "s"
1514   (no alarm set)
1515   C-Kermit> redo echo f   ; Most recent command starting with "echo f"
1516   foo
1517   C-Kermit> redo *foo     ; Most recent command that has "foo" in it
1518   foo
1519   C-Kermit> <Ctrl-P>      ; Scroll back
1520   C-Kermit> echo foo      ; The REDOne command is there
1521   C-Kermit> redo {*foo}   ; Most recent command that ends with "foo"
1522   foo
1523   C-Kermit>
1524
1525    Since REDO, REDIAL, and REDIRECT all start the same way, and RED is the
1526    designated non-unique abbreviation for REDIAL, REDO must be spelled out
1527    in full. For convenience, RR is included as an invisible easy-to-type
1528    synonym for REDO. You can also use the "^" character for this:
1529
1530   C-Kermit> ^             ; Most recent command
1531   C-Kermit> ^ s           ; Most recent command starting with "s"
1532   C-Kermit> ^s            ; Ditto (space not required after "^").
1533   C-Kermit> ^*foo         ; Most recent command that has "foo" in it.
1534   C-Kermit> ^{*foo}       ; Most recent command ends with "foo".
1535
1536    Unlike the manual command-history-scrolling keys, the REDO command can
1537    be used in a script, but it's not recommended (since the command to be
1538    REDOne might not be found, so if the REDO command fails, you can't tell
1539    whether it was because REDO failed to find the requested command, or
1540    because the command was found but it failed).
1541
1542 1.9. EXIT Messages
1543
1544    The EXIT and QUIT commands now accept an optional message to be
1545    printed. This makes the syntax of EXIT and QUIT just like END and STOP:
1546
1547    { EXIT, QUIT, END, STOP } [ status-code [ message ] ]
1548
1549    where status-code is a number (0 indicating success, nonzero indicating
1550    failure). This is handy in scripts that are never supposed to enter
1551    interactive mode:
1552
1553   dial 7654321
1554   if fail exit 1 Can't make connection - try again later.
1555
1556    Previously this could only be done in two steps:
1557
1558   dial 7654321
1559   xif fail { echo Can't make connection - try again later, exit 1 }
1560
1561    A status code must be included in order to specify a message. In the
1562    case of EXIT and QUIT, the default status code is contained in the
1563    variable \v(exitstatus), and is set automatically by various events
1564    (file transfer failures, etc; it can also be set explicitly with the
1565    SET EXIT STATUS command). If you want to give an EXIT or QUIT command
1566    with a message, but without changing the exit status from what it
1567    normally would have been, use the \v(exitstatus) variable, e.g.:
1568
1569    exit \v(existatus) Goodbye from \v(cmdfile).
1570
1571    The EXIT status is returned to the system shell or whatever other
1572    process invoked C-Kermit, e.g. in UNIX:
1573
1574   C-Kermit> exit 97 bye bye
1575   bye bye
1576   $ echo $?
1577   97
1578   $
1579
1580 1.10. Managing Keyboard Interruptions
1581
1582    When C-Kermit is in command or file-transfer mode (as opposed to
1583    CONNECT mode), it can be interrupted with Ctrl-C. Version 7.0 adds the
1584    ability to disarm the Ctrl-C interrupt:
1585
1586    SET COMMAND INTERRUPT { ON, OFF }
1587           COMMAND INTERRUPT is ON by default, meaning the Ctrl-C can be
1588           used to interrupt a command or a file transfer in progress. Use
1589           OFF to disable these interruptions, and use it with great
1590           caution for obvious reasons.
1591
1592    SET TRANSFER INTERRUPT { ON, OFF }
1593           This can be used to disable keyboard interruption of file
1594           transfer when C-Kermit is in local mode, or to re-enable it
1595           after it has been disabled. This applies to the X, Z, E, and
1596           similar keys as well as to the system interrupt character,
1597           usually Ctrl-C. This is distinct from SET TRANSFER CANCELLATION,
1598           which tells whether packet mode can be exited by sending a
1599           special sequence of characters.
1600
1601    Several other commands can be interrupted by pressing any key while
1602    they are active. Version 7.0 adds the ability to disable this form of
1603    interruption also:
1604
1605    SET INPUT CANCELLATION { ON, OFF }
1606           Whether an INPUT command in progress can be interrupted by
1607           pressing a key. Normally ON. Setting INPUT CANCELLATION OFF
1608           makes INPUT commands uninterruptible except by Ctrl-C (unless
1609           COMMAND INTERRUPTION is also OFF).
1610
1611    SET SLEEP CANCELLATION { ON, OFF }
1612           Whether a SLEEP, PAUSE, or WAIT command in progress can be
1613           interrupted by pressing a key. Normally ON. Setting SLEEP
1614           CANCELLATION OFF makes these commands uninterruptible except by
1615           Ctrl-C (unless COMMAND INTERRUPTION is also OFF). Synonyms: SET
1616           PAUSE CANCELLATION, SET WAIT CANCELLATION.
1617
1618    So to make certain a script is not interruptible by the user, include
1619    these commands:
1620
1621   SET TRANSFER INTERRUPT OFF
1622   SET SLEEP CANCELLATION OFF
1623   SET INPUT CANCELLATION OFF
1624   SET COMMAND INTERRUPTION OFF
1625
1626    Make sure to turn them back on afterwards if interruption is to be
1627    re-enabled.
1628
1629    When a PAUSE, SLEEP, WAIT, or INPUT command is interrupted from the
1630    keyboard, the new variable \v(kbchar) contains a copy of the (first)
1631    character that was typed and caused the interruption, provided it was
1632    not the command interrupt character (usually Ctrl-C). If these commands
1633    complete successfully or time out without a keyboard interruption, the
1634    \v(kbchar) variable is empty.
1635
1636    The \v(kbchar) variable (like any other variable) can be tested with:
1637
1638   if defined \v(kbchar) command
1639
1640    The command is executed if the variable is not empty.
1641
1642    The \v(kbchar) variable can be reset with WAIT 0 (PAUSE 0, SLEEP 0,
1643    etc).
1644
1645 1.11. Taming The Wild Backslash -- Part Deux
1646
1647    [366]Using C-Kermit, 2nd Edition, contains a brief section, "Taming the
1648    Wild Backslash", on page 48, which subsequent experience has shown to
1649    be inadequate for Kermit users intent on writing scripts that deal with
1650    Windows, DOS, and OS/2 filenames, in which backslash (\) is used as the
1651    directory separator. This section fills in the blanks.
1652
1653 1.11.1. Background
1654
1655    The Kermit command language shares a certain unavoidable but annoying
1656    characteristic with most other command languages that are capable of
1657    string replacement, namely the necessity to "quote" certain characters
1658    when you want them to be taken literally. This is a consequence of the
1659    facts that:
1660
1661     1. One or more characters must be set aside to denote replacement,
1662        rather than acting as literal text.
1663     2. We have only 96 printable characters to work with in ASCII, which
1664        is still the only universally portable character set.
1665     3. There is no single printable character that is unused everywhere.
1666     4. Variables are not restricted to certain contexts, as they are in
1667        formal programming languages like C and Fortran, but can appear
1668        anywhere at all within a command, and therefore require special
1669        syntax.
1670
1671    Thus there can be conflicts. To illustrate, the standard UNIX shell
1672    uses dollar sign ($) to introduce variables. So the shell command:
1673
1674   echo $TERM
1675
1676    displays the value of the TERM variable, e.g. vt320. But suppose you
1677    want to display a real dollar sign:
1678
1679   echo The price is $10.20
1680
1681    This causes the shell to evaluate the variable "$1", which might or
1682    might not exist, and substitute its value, e.g.:
1683
1684   The price is 0.20
1685
1686    (in this case the $1 variable had no value.) This is probably not what
1687    you wanted. To force the dollar sign to be taken literally, you must
1688    apply a "quoting rule", such as "precede a character by backslash (\)
1689    to force the shell to take the character literally":
1690
1691   echo The price is \$10.20
1692   The price is $10.20
1693
1694    But now suppose you want the backslash AND the dollar sign to be taken
1695    literally:
1696
1697   echo The price is \\$10.20
1698
1699    This doesn't work, since the first backslash quotes the second one,
1700    thereby leaving the dollar sign unquoted again:
1701
1702   The price is \0.20
1703
1704    Quoting the dollar sign requires addition of a third backslash:
1705
1706   echo The price is \\\$10.20
1707   The price is \$10.20
1708
1709    The first backslash quotes the second one, and the third backslash
1710    quotes the dollar sign.
1711
1712    Every command language -- all UNIX shells, VMS DCL, DOS Batch, AOS/VS
1713    CLI, etc etc -- has similar rules. UNIX shell rules are probably the
1714    most complicated, since many printable characters -- not just one --
1715    are special there: dollar sign, single quote, double quote, backslash,
1716    asterisk, accent grave, number sign, ampersand, question mark,
1717    parentheses, brackets, braces, etc -- practically every
1718    non-alphanumeric character needs some form of quoting if it is to be
1719    taken literally. And to add to the confusion, the UNIX shell offers
1720    many forms of quoting, and many alternative UNIX shells are available,
1721    each using slightly different syntax.
1722
1723 1.11.2. Kermit's Quoting Rules
1724
1725    Kermit's basic quoting rules are simple by comparison (there are, of
1726    course, additional syntax requirements for macro definitions, command
1727    blocks, function calls, etc, but they are not relevant here).
1728
1729    The following characters are special in Kermit commands:
1730
1731    Backslash (\)
1732           Introduces a variable, or the numeric representation of a
1733           special character, or a function, or other item for
1734           substitution. If the backslash is followed by a digit or by any
1735           of the following characters:
1736
1737   x, o, d, m, s, f, v, $, %, &, :, {
1738
1739           this indicates a special substitution item; otherwise the
1740           following character is to be taken literally (exceptions: \ at
1741           end of line is taken literally; \n, \b, and \n are special items
1742           in the OUTPUT command only).
1743
1744    Semicolon (;)
1745           (Only when at the beginning of a line or preceded by at least
1746           one space or tab) Introduces a comment.
1747
1748    Number sign (#)
1749           (Only when at the beginning of a line or preceded by at least
1750           one space or tab) Just like semicolon; introduces a comment.
1751
1752    Question mark (?)
1753           (Only at the command prompt - not in command files or macros)
1754           Requests context-sensitive help.
1755
1756    To force Kermit to take any of these characters literally, simply
1757    precede it by a backslash (\).
1758
1759    Sounds easy! And it is, except when backslash also has a special
1760    meaning to the underlying operating system, as it does in DOS, Windows,
1761    and OS/2, where it serves as the directory separator in filenames such
1762    as:
1763
1764   D:\K95\KEYMAPS\READ.ME
1765
1766    Using our rule, we would need to refer to this file in Kermit commands
1767    as follows:
1768
1769   D:\\K95\\KEYMAPS\\READ.ME
1770
1771    But this would not be obvious to new users of Kermit software on DOS,
1772    Windows, or OS/2, and it would be annoying to seasoned ones. Thus
1773    MS-DOS Kermit and Kermit 95 go to rather extreme lengths to allow the
1774    more natural notation, as in:
1775
1776   send d:\k95\keymaps\read.me
1777
1778    The reason this is tricky is that we also need to allow for variables
1779    and other expressions introduced by backslash in the same command. For
1780    example, suppose \%a is a variable whose value is "oofa" (without the
1781    quotes). What does the following command do?
1782
1783   send d:\%a
1784
1785    Does it send the file named "oofa" in the current directory of the D:
1786    disk, or does it send a file named "%a" in the root directory of the D:
1787    disk? This is the kind of trouble we get into when we attempt to bend
1788    the rules in the interest of user friendliness. (The answer is: if the
1789    variable \%a has definition that is the name of an existing file, that
1790    file is sent; if a file d:\%a exists, it is sent; otherwise if both
1791    conditions are true, the variable takes precedence, and the literal
1792    filename can be forced by quoting: \\%a.)
1793
1794    In Kermit 95 (but not MS-DOS Kermit), we also bend the rules another
1795    way by allowing you to use forward slash (/) rather than backslash (\)
1796    as the directory separator:
1797
1798   send d:/k95/keymaps/read.me
1799
1800    This looks more natural to UNIX users, and in fact is perfectly
1801    acceptable to the Windows 95/98/NT and OS/2 operating systems on the
1802    API level. BUT (there is always a "but") the Microsoft shell,
1803    COMMAND.COM, for Windows 95/98 and NT does not allow this notation, and
1804    therefore it can not be used in any Kermit command -- such as RUN --
1805    that invokes the Windows command shell AND your command shell is
1806    COMMAND.COM or any other shell that does not allow forward slash as
1807    directory separator (some alternative shells do allow this).
1808
1809      NOTE: There exists a wide variety of alternative shells from third
1810      parties that do not have this restriction. If you are using a shell
1811      that accepts forward slash as a directory separator, you can stop
1812      reading right now -- UNLESS (there is always an "unless") you want
1813      your scripts to be portable to systems that have other shells. Also
1814      note that some Windows shells might actually REQUIRE forward slashes
1815      (instead of backslashes) as directory separators; we do not treat
1816      this situation below, but the treatment is obvious -- use slash
1817      rather backslash as the directory separator.
1818
1819 1.11.3. Passing DOS Filenames from Kermit to Shell Commands
1820
1821    The following Kermit commands invoke the system command shell:
1822
1823   RUN (and its synonyms ! and @)
1824   REDIRECT
1825   PIPE
1826
1827    Each of these commands takes a shell command as an operand. These shell
1828    commands are not, and can not be, parsed by Kermit since Kermit does
1829    not know the syntax of shell commands, and so can't tell the difference
1830    between a keyword, a filename, a variable, a switch, or other item.
1831    Therefore the rules can not be bent since Kermit doesn't know where or
1832    how to bend them. To illustrate (using the regular Windows shell):
1833
1834   run c:\\windows\\command\\chkdsk.exe
1835
1836    works OK, but:
1837
1838   run c:/windows/command/chkdsk.exe
1839
1840    is not accepted by COMMAND.COM. But:
1841
1842   run c:\windows\command\chkdsk.exe
1843
1844    results in Kermit applying its quoting rules before sending the text to
1845    the shell. Since "w" and "c" are not in the list of backslash-item
1846    codes, the backslash means "take the following character literally".
1847    Thus, by the time this filename gets to the Windows shell, it has
1848    become:
1849
1850   c:windowscommandchkdsk.exe
1851
1852    which is probably not what you wanted. (If "w" and "c" were in the
1853    list, the results could be even stranger.) Even more confusing is the
1854    case where a directory or filename starts with one or more digits:
1855
1856   run c:\123\lotus.exe
1857
1858    in which "\123" is the Kermit notation for ASCII character 123, which
1859    happens to be left brace ({), resulting in "c:{lotus.exe".
1860
1861    So when passing filenames to a Windows shell, always use double
1862    backslashes as directory separators, to ensure that the shell gets
1863    single backslashes:
1864
1865   run c:\\windows\\command\\chkdsk.exe
1866   run c:\\123\\lotus.exe
1867
1868    Similar problems might occur with the built-in EDIT, BROWSE, and FTP
1869    commands. These commands result in Kermit building a shell command
1870    internally to invoke the associated helper program; the form of this
1871    command might conflict with the form demanded by certain alternative
1872    shells.
1873
1874 1.11.4. Using Variables to Hold DOS Filenames
1875
1876    Now to the next level. Suppose you want to write a script in which
1877    filenames are parameters, and therefore are stored in variables.
1878    Example:
1879
1880   define \%f c:\windows\command\chkdsk.exe
1881   ...
1882   run \%f
1883
1884    Obviously this won't work for the reasons just noted; the RUN command
1885    requires directory separators be coded as double backslashes:
1886
1887   define \%f c:\\windows\\command\\chkdsk.exe
1888   ...
1889   run \%f
1890
1891    This will work; no surprises here. However, if you had used ASSIGN
1892    rather than DEFINE, you might have been surprised after all; review
1893    pages 348-349 of [367]Using C-Kermit (2nd Ed) for the difference
1894    between DEFINE and ASSIGN.
1895
1896    We have said that any Kermit 95 or MS-DOS Kermit command that parses
1897    filenames itself -- SEND, for example -- does not require double
1898    backslashes since it knows it is parsing a filename. So since the
1899    following works:
1900
1901   send c:\windows\command\chkdsk.exe
1902
1903    Should the following also work?
1904
1905   define \%f c:\windows\command\chkdsk.exe
1906   ...
1907   send \%f
1908
1909    Answer: No. Why? Because \%f is evaluated "recursively", to allow for
1910    the possibility that its definition contains further variable
1911    references. This is true of all "backslash-percent-letter" (or -digit)
1912    variables, and also for array references. So \%f becomes
1913    c:\windows\command\chkdsk.exe, which becomes
1914    c:windowscommandchkdsk.exe.
1915
1916    The trick here is to use the "other" kind of variable, that is
1917    evaluated only "one level deep" rather than recursively:
1918
1919   define filename c:\windows\command\chkdsk.exe
1920   ...
1921   send \m(filename)
1922
1923    Similarly if you want to prompt the user for a filename:
1924
1925   ask filename { Please type a filename: }
1926    Please type a filename: c:\windows\command\chkdsk.exe
1927   send \m(filename)
1928
1929 1.11.5. Passing DOS Filenames as Parameters to Macros
1930
1931    Suppose you want to pass a DOS filename containing backslashes as a
1932    parameter to a Kermit macro. This raises two issues:
1933
1934     1. Parameters to macros are "just text" and so are fully evaluated
1935        before they are passed to the macro.
1936     2. Once inside the macro, the formal parameters \%1, \%2, ... \%9 are
1937        the type of variable that is evaluated recursively.
1938
1939    Thus a DOS filename is ruined once in the act of parsing the macro
1940    invocation, and again when referring to it from within the macro. To
1941    illustrate, suppose "test" is a macro. Then in the invocation:
1942
1943   test c:\mydir\blah.txt
1944
1945    "c:mydirblah.txt" is assigned to \%1. However, if we double the
1946    backslashes:
1947
1948   test c:\\mydir\\blah.txt
1949
1950    "c:\mydir\blah.txt" is assigned to \%1. But then when you refer to \%1
1951    in the macro, it is evaluated recursively, resulting in
1952    "c:mydirblah.txt". To illustrate:
1953
1954   define test echo \%1
1955   test c:\mydir\blah.txt
1956   c:mydirblah.txt
1957   test c:\\mydir\\blah.txt
1958   c:mydirblah.txt
1959   test c:\\\\mydir\\\\blah.txt
1960   c:\mydir\blah.txt
1961
1962    Let's address each part of the problem separately. First, inside the
1963    macro. You can use the \fcontents() function to force a
1964    backslash-percent variable (such as a macro argument) to be evaluated
1965    one level deep instead of recursively, for example:
1966
1967   define test echo { The filename is "\fcontents(\%1)"}
1968
1969   test c:\mydir\blah.txt               ; We don't expect this to work
1970    The filename is "c:mydirblah.txt"   ; and it doesn't.
1971   test c:\\mydir\\blah.txt             ; But this does...
1972    The filename is "c:\mydir\blah.txt"
1973
1974    Thus if the filename arrives inside the macro with single backslashes,
1975    the backslashes are preserved if you always refer to the parameter
1976    through the \fcontents() function.
1977
1978    Now how to ensure that backslashes are not stripped or misinterpreted
1979    when passing a filename to a macro? This brings us back to what we
1980    learned in earlier sections:
1981
1982     1. If it is a literal filename, either double the backslashes, or (if
1983        the filename is to be used only within Kermit itself and not passed
1984        to a DOS shell, or it is to be passed to an alternative shell that
1985        accepts forward slash as a directory separator), use forward slash
1986        instead of backslash as the directory separator.
1987     2. If it is a variable that contains a filename, make sure you use a
1988        macro-style variable name, rather than a
1989        backslash-percent-character name.
1990
1991    Examples:
1992
1993   define test echo \fcontents(\%1)
1994   define filename c:\mydir\blah.txt
1995
1996   test c:\\mydir\\blah.txt  ; Literal filename with double backslashes
1997   c:\mydir\blah.txt
1998
1999   test c:/mydir/blah.txt    ; Literal filename with forward slashes
2000   c:/mydir/blah.txt
2001
2002   test \m(filename)         ; Variable
2003   c:\mydir\blah.txt
2004
2005    But what if you don't like these rules and you still want to pass a
2006    literal filename containing single backslashes to a macro? This is
2007    possible too, but a bit tricky: turn command quoting off before
2008    invoking the macro, and then turn it back on inside the macro. Example:
2009
2010   define test set command quoting on, echo \fcontents(\%1)
2011
2012   set command quoting off
2013   test c:\mydir\blah.txt
2014   c:\mydir\blah.txt
2015
2016    Upon return from the macro, command quoting is back on (since the macro
2017    turned it on).
2018
2019    Obviously this trick can not be used if the filename is stored in a
2020    variable, since it prevents the variable from being evaluated.
2021
2022 1.11.6. Passing DOS File Names from Macro Parameters to the DOS Shell
2023
2024    Now suppose you need to pass a DOS filename to a macro, and the macro
2025    needs to pass it, in turn, to the Windows shell via (say) Kermit's RUN
2026    command. This works too:
2027
2028   define xrun run \fcontents(\%1)
2029   xrun c:\\windows\\command\\chkdsk.exe
2030
2031    (or you can use the SET COMMAND QUOTING OFF / ON technique described
2032    above to avoid the double backslashes.) But..
2033
2034   xrun c:/windows/command/chkdsk.exe
2035
2036    does not work if the Windows shell does not recognize "/" as a
2037    directory separator. If there is a chance that a filename might be
2038    passed to the macro in this form, the macro will need to convert it to
2039    a form acceptable to the shell:
2040
2041   define xrun run \freplace(\fcontents(\%1),/,\\)
2042
2043    Here we replace all occurrences (if any) of "/" in the argument with
2044    "\" prior to issuing the RUN command. Of course, in order to specify
2045    "\" as a literal character in the \freplace() argument list, we have to
2046    double it.
2047
2048 1.11.7. Passing DOS Filenames to Kermit from the Shell
2049
2050    As noted in the manual, the \&@[] array contains Kermit's command-line
2051    arguments. Suppose one of these arguments, say \&@[3], is a DOS
2052    filename such as C:\FOO\BAR\BAZ\OOFA.TXT. (Note: In C-Kermit 7.0 and
2053    K95 1.1.18 and later, command-line arguments after "=" or "--" are also
2054    available in the top-level \%1..9 variables; see [368]Section 7.5.)
2055
2056    Of course you can eliminate any problems by using forward slashes
2057    rather than backslashes in the filename, but sometimes this is not
2058    possible, as when the Kermit command line is being generated by another
2059    program than can only generate "native" format DOS filenames.
2060
2061    As noted in the manual, "\%x" variables and \&x[] arrays are always
2062    evaluated "all the way" (recursively). If the contents of one of these
2063    variables contains backslashes, this causes another level of
2064    evaluation.
2065
2066    There is another kind of variable, which is evaluated only "one level
2067    deep". You can use this to prevent interpretation of the backslashes in
2068    the filenames. Example:
2069
2070   assign filename \fcontents(\&@[3])  ; Transfer contents
2071   ...
2072   send \m(filename)
2073
2074    Or, more simply:
2075
2076   send \fcontents(\&@[3])
2077
2078 1.12. Debugging
2079
2080    The debug log is produced when you give a "log debug" command. This is
2081    normally done at the request of the Kermit help desk, for forwarding to
2082    the Kermit developers for analysis as a last resort in troubleshooting
2083    problems. (Last resort because it can grow quite huge in a very short
2084    time.) In cases where timing information is critical to understanding a
2085    problem, you can tell C-Kermit to put a timestamp on each debug log
2086    line by giving the command:
2087
2088   SET DEBUG TIMESTAMP ON
2089
2090    At any time before or after activating the debug log (SET DEBUG
2091    TIMESTAMP OFF turns off timestamping). Timestamps can be turned off and
2092    on as desired while logging. Obviously, they increase the size and
2093    growth rate of the log significantly, and so should be used sparingly.
2094    Timestamps are of the form hh:mm:ss.xxx, where .xxx is thousands of a
2095    second (but is included only on platforms that include this feature).
2096
2097 1.13. Logs
2098
2099    In UNIX C-Kermit and in K-95, you can now direct any log to a pipe.
2100    This not only lets you send your logs to places other than disk files,
2101    but also lets you customize them to any desired degree.
2102
2103    LOG { DEBUG, PACKETS, SESSION, TRANSACTION, CONNECTION } { file, pipe }
2104           ...
2105           A "pipe" is the name of a command, preceded by a vertical bar.
2106           If the pipe contains any spaces, it must be enclosed in braces.
2107
2108    Here are some examples for UNIX (always remember the importance of
2109    getting the UNIX shell quoting rules right):
2110
2111    LOG TRANSACTIONS |lpr
2112           This sends the transaction log to the default UNIX printer,
2113           rather than to a file (use "lp" rather than "lpr" if necessary).
2114
2115    LOG TRANSACTIONS {| myfilter > t.log}
2116           For those who don't like the format of the transaction log, or
2117           want to extract certain information from it; write your own
2118           output filter.
2119
2120    LOG SESSION {| lpr -Plaserwriter}
2121           This sends the session log to a specific UNIX printer, rather
2122           than to a file. Note the braces around the pipeline. These are
2123           required because it contains spaces.
2124
2125    LOG DEBUG {| tail -100 > debug.log}
2126           This causes the debug log file to contain only the final 100
2127           lines. Suppose C-Kermit crashes under some unpredictable
2128           circumstances, and you need a debug log to catch it in the act.
2129           But the debug log can grow to huge proportions very quickly,
2130           possibly filling up the disk. Piping the debug log through
2131           "tail" results in keeping only the last 100 lines (or other
2132           number of your choice).
2133
2134    LOG DEBUG {| grep "^TELNET" > debug.log}
2135           This one shows how to log only Telnet negotiations. Piping the
2136           debug log through grep or egrep lets you log only specific
2137           information, rather than everything. "man grep" for further
2138           info.
2139
2140    LOG DEBUG {| gzip -c > debug.log.gz}
2141           Creates a full debug log, but compressed by gzip to save space.
2142
2143    LOG PACKETS {| tr "\\01" "X" | cut -c9- > packet.log}
2144           This one writes the regular packet log, but translates the
2145           Ctrl-A that starts each packet to the letter "X" and removes the
2146           s-nn-nn- notation from the beginning of each line. Note the
2147           double backslash (normal Kermit quoting rules). "man tr" and
2148           "man cut" for further info.
2149
2150    See [369]Section 2.12 for information about the new connection log.
2151
2152 1.14. Automatic File-Transfer Packet Recognition at the Command Prompt
2153
2154    Beginning in version 7.0, C-Kermit can recognize Kermit (and in some
2155    cases also Zmodem) file-transfer packets while at its command prompt.
2156    This is convenient (for example), if you escaped back from a remote
2157    Kermit program and told the local Kermit program to send a file, but
2158    forgot to tell the remote Kermit program to receive it (and the local
2159    Kermit did not have the "send a Kermit receive command" feature
2160    available). This feature is controlled by the following command:
2161
2162    SET COMMAND AUTODOWNLOAD { ON, OFF }
2163           When ON, which is the default, the command parser recognizes
2164           Kermit packets when Kermit is in remote mode. An S packet makes
2165           it go into receive mode, an I packet makes it go into server
2166           mode. When OFF, packet recognition is disabled and the behavior
2167           when a packet is received at the command prompt is as it was in
2168           C-Kermit 6.1 and earlier (namely to print an error message).
2169
2170    COMMAND AUTODOWNLOAD is the command-mode equivalent of TERMINAL
2171    AUTODOWNLOAD, which is effective during CONNECT mode.
2172
2173 1.15. The TYPE Command
2174
2175    The TYPE command now accepts a selection of optional switches
2176    ([370]Section 1.5), and also sets several variables.
2177
2178    Syntax: TYPE [ switches... ] filename
2179
2180    Variables:
2181
2182    \v(ty_ln)
2183           Line number of current line (during TYPE command; see /PREFIX)
2184
2185    \v(ty_lc)
2186           Line count of file most recently TYPEd.
2187
2188    \v(ty_mc)
2189           Match count of file most recently TYPEd (see /MATCH).
2190
2191    Switches:
2192
2193    /PAGE
2194           If /PAGE is included, Kermit pauses at the end of each screenful
2195           and issues a "more?" prompt. You may press the space bar to view
2196           the next page (screenful), or press "q" or "n" to return to the
2197           C-Kermit prompt. If this switch is given, it overrides the
2198           COMMAND MORE-PROMPTING setting for this command only. If it is
2199           not given, paging is according to COMMAND MORE-PROMPTING.
2200
2201    /NOPAGE
2202           Do not pause at the end of each screenful; show the whole file
2203           (or all selected lines) at once. If this switch is given, it
2204           overrides the COMMAND MORE-PROMPTING setting for this command
2205           only. If it is not given, paging is according to COMMAND
2206           MORE-PROMPTING.
2207
2208    /HEAD[:n]
2209           Only show the first n lines of the file (where n is a number).
2210           If n is omitted, 10 is used.
2211
2212    /TAIL[:n]
2213           Only show the last n lines of the file (where n is a number). If
2214           nis omitted, 10 is used. Note: /HEAD and /TAIL can't be
2215           combined; if you give both switches, only the most recent one is
2216           used.
2217
2218    /MATCH:pattern
2219           Only type lines from the file that match the given pattern (see
2220           [371]Section 4.9.1 for pattern notation). UNIX users familiar
2221           with grep should note a significant difference: there is no
2222           implied "*" at the beginning and end of the pattern. Thus:
2223
2224   TYPE /MATCH:foo    Lists lines whose entire contents are "foo".
2225   TYPE /MATCH:foo*   Lists lines that start with "foo".
2226   TYPE /MATCH:*foo   Lists lines that end with "foo".
2227   TYPE /MATCH:*foo*  Lists lines that have "foo" anywhere in them.
2228
2229           /HEAD and /TAIL apply after /MATCH, so "type /tail:20 /match:x*"
2230           shows the last 20 lines in the file that start with "x".
2231
2232    /PREFIX:string
2233           Print the given string at the beginning of each line. The string
2234           may be a constant, a variable, or a quoted variable. If it's an
2235           unquoted variable, its value at the time the TYPE command was
2236           given is used as a constant. If it is a quoted variable, it is
2237           re-evaluated for each line; a useful variable for this context
2238           is \v(ty_ln) (the line number of the current line being typed).
2239           If the prefix is to include spaces, it must be enclosed in
2240           braces. Examples:
2241
2242         type /prefix:{oofa.txt: } /match:*thing* oofa.txt
2243                 Prints all lines in oofa.txt that contain "thing" with the
2244                 filename itself as the prefix (similar to UNIX grep).
2245
2246         type /prefix:{\v(time). } oofa.txt
2247                 Prefixes each line of oofa.txt with the time at which the
2248                 TYPE command was given (one backslash)
2249
2250         type /prefix:{\\v(time). } oofa.txt
2251                 Prefixes each line of oofa.txt with the time at which that
2252                 line is being typed (two backslashes).
2253
2254         type /prefix:{\\v(ty_ln). } oofa.txt
2255                 Prefixes each line of oofa.txt with its line number.
2256
2257         type /prefix:{\\flpad(\\v(ty_ln),4). } oofa.txt
2258                 Same as the previous example, except the line number is
2259                 right-adjusted in a 4-column field.
2260
2261    /WIDTH[:n]
2262           Truncates each line at column n (which must be a number) prior
2263           to printing it. This option can be used for long lines when you
2264           don't want them to wrap. If nis omitted, your current screen
2265           width is used.
2266
2267    /COUNT
2268           Counts lines and -- if /MATCH was included, matches -- but does
2269           not print any lines from the file. The line and match count is
2270           shown at the end, and the variables \v(ty_lc) and \v(ty_lm) are
2271           set accordingly.
2272
2273    SET OPTIONS TYPE { /PAGE, /NOPAGE, /WIDTH:n }
2274           Sets the paging default for TYPE commands, which can be
2275           overridden in any particular TYPE command by including the
2276           desired switch.
2277
2278    If a TYPE command is given with no switch, and no SET OPTIONS TYPE
2279    selection is in effect, paging is according to your COMMAND
2280    MORE-PROMPTING setting (SHOW COMMAND).
2281
2282 1.16. The RESET Command
2283
2284    The RESET command, added in 7.0, closes all open files and logs, but
2285    does not affect the open connection (if any).
2286
2287 1.17. The COPY and RENAME Commands
2288
2289    As of C-Kermit 7.0, in the UNIX version only, the COPY and RENAME
2290    commands are built in and do not call the underlying platform's COPY or
2291    RENAME command. This allows them to work in "NOPUSH" versions and other
2292    circumstances where it can't access system commands, and it allows file
2293    copying and renaming to be done portably in scripts. The
2294    characteristics of the built-in COPY or RENAME include:
2295      * It fails if the source file is a directory or is wild or lacks read
2296        access.
2297      * It fails if the source file is the destination file.
2298      * It allows the destination file to be a directory, in which case the
2299        source file is copied (or renamed) into it with the same name.
2300      * It overwrites an existing destination file if its permission
2301        allows.
2302      * It sets the new file's permission according to umask but also
2303        carries forward the source file's execute permission bits if the
2304        destination file did not already exist.
2305      * It fails if interrupted by Ctrl-C.
2306      * Upon error, it prints an appropriate message.
2307      * It returns standardized error codes that can be tested by IF
2308        SUCCESS / FAIL.
2309
2310    These commands now also accept the following switches:
2311
2312   /LIST (/LOG, /VERBOSE)    = Print "file1 => file2 (OK)" (or error message).
2313   /NOLIST (/NOLOG, /QUIET)  = Don't print anything (except error messages).
2314
2315    /NOLIST is the default.
2316
2317    The same built-in code is used by the UNIX C-Kermit server to execute
2318    REMOTE COPY commands (except in this case no switches are available).
2319
2320    The COPY command also accepts the following additional switches. When
2321    any of these are given (and they can be used in any combination except
2322    /SWAP and /APPEND), some of the checks listed above are relaxed, and
2323    thus it might be possible to get into trouble in certain cases, e.g.
2324    when the source and target files are the same file:
2325
2326   /APPEND                   = Append source file to destination file.
2327   /SWAP-BYTES               = Swap bytes (see [372]Section 6.6.5).
2328   /FROMB64                  = Decode the source file from Base64 encoding.
2329   /TOB64                    = Encode the target file in Base64.
2330
2331    Base64 is the encoding commonly used for enclosures in Internet email.
2332
2333 1.18. The MANUAL Command
2334
2335    The MANUAL command can be used to access the appropriate Kermit manual
2336    or other manual. The general syntax is:
2337
2338    MANUAL [ string ]
2339           If the string is omitted, C-Kermit asks the underlying system to
2340           access the C-Kermit manual using whatever method is appropriate
2341           for the system.
2342
2343    The specific action depends on the system. In UNIX, a "man" command is
2344    issued; "kermit" is the default argument but other manual topics may be
2345    specified. If the "man" command allows index or string searching, the
2346    appropriate syntax may be included.
2347
2348    In Kermit 95, the MANUAL command brings up the HTML online K95 manual.
2349
2350    In VMS and elsewhere, "man" is simply translated to "help", with a
2351    default argument of "kermit"; other and/or additional arguments may be
2352    included according to the definition of the system's "help" command.
2353
2354    Correct operation of the "man" command in C-Kermit depends on the
2355    appropriate man page or help topic having been installed in the right
2356    place with the right permissions and format.
2357
2358 1.19. String and Filename Matching Patterns
2359
2360    A pattern is a string that includes special notation for matching
2361    classes or sequences of characters. C-Kermit 7.0 / K95 1.1.19 supports
2362    patterns in several places:
2363
2364      * Filenames ([373]Section 4.9)
2365      * SWITCH case labels ([374]Section 7.18)
2366      * The new IF MATCH statement ([375]Section 7.4)
2367      * TYPE /MATCH ([376]Section 1.15)
2368      * SET FILE TEXT-PATTERNS and BINARY-PATTERNS ([377]Section 4.3)
2369      * The \fsearch() and \farraylook() functions ([378]Sections 7.3 and
2370        [379]7.10.7)
2371      * The \fpattern() function used with [M,RE]INPUT ([380]Section 7.1)
2372
2373    Patterns are also called wildcards, especially when used for filename
2374    matching. C-Kermit's pattern syntax is explained in [381]Section 4.9.1,
2375    and also by the HELP WILDCARDS command.
2376
2377 1.20. Multiple Commands on One Line
2378
2379    As of C-Kermit 7.0, commands can be grouped together on one line by
2380    separating the commands with commas and enclosing the list in braces.
2381    For example:
2382
2383   C-Kermit> { echo One, echo Two, echo Three }
2384   C-Kermit> do { echo One, echo Two, echo Three }
2385
2386    Command lists can be nested:
2387
2388   [ do ] { echo One, echo Two, if true { echo A, echo B}, echo Three }
2389
2390    and the END command works as it does in macros:
2391
2392   [ do ] { echo One, echo Two, if true end, echo Three }
2393
2394    The "one line" stricture is, of course, pliant to line-continuation
2395    conventions, namely that lines ending in hyphen (-) or left brace ({)
2396    are to be continued. Thus the first example can also be rendered:
2397
2398   [ do ] {
2399       echo One
2400       echo Two
2401       echo Three
2402   }
2403
2404    (the "do" is optional).
2405
2406 1.21. What Do I Have?
2407
2408    C-Kermit can be built for hundreds of different platforms with
2409    practically countless configuration options. Certain commands might not
2410    be available in certain configurations, etc. Even on the same platform,
2411    different builds are possible: "maximum functionality", "minimum size",
2412    "maximum performance", and so on. You can find out a lot about the
2413    configuration of your C-Kermit program with the SHOW FEATURES command.
2414    Of course, a lot of what it says, especially in the bottom part, might
2415    seem like gibberish, but can be deciphered with a Rosetta Stone (such
2416    as the C-Kermit source or the [382]ckccfg.txt file). In any case, the
2417    output from SHOW FEATURES might easily explain why some expected
2418    feature is missing, or some buffer is smaller than expected. Here's a
2419    sample of the bottom section for the SunOS version:
2420
2421 C-Kermit 7.0.196, 1 Jan 2000
2422
2423 Major optional features included:
2424  Network support (type SHOW NET for further info)
2425  Telnet Kermit Option
2426  Hardware flow control
2427  External XYZMODEM protocol support
2428  Latin-1 (West European) character-set translation
2429  Latin-2 (East European) character-set translation
2430  Cyrillic (Russian, Ukrainian, etc) character-set translation
2431  Greek character-set translation
2432  Hebrew character-set translation
2433  Japanese character-set translation
2434  Unicode character-set translation
2435  Pseudoterminal control
2436  REDIRECT command
2437  RESEND command
2438  Fullscreen file transfer display
2439  Control-character unprefixing
2440  Streaming
2441  Autodownload
2442
2443 Major optional features not included:
2444  No Kerberos(TM) authentication
2445  No SRP(TM) (Secure Remote Password) protocol
2446  No Secure Sockets Layer (SSL) protocol
2447  No Transport Layer Security (TLS) protocol
2448  No encryption
2449  No X Windows forwarding
2450
2451 Host info:
2452  Machine:    sun4m
2453  Model:      (unknown)
2454  OS:         SunOS
2455  OS Release: 4.1.3_U1
2456  OS Version: 4
2457
2458 Target: sunos41gsc
2459 GCC version: 2.7.2
2460 Compiled Dec 31 1999 10:38:54, options:
2461  __GNUC__ __STDC__ _POSIX_JOB_CONTROL _SC_JOB_CONTROL ARRAYREFLEN=1024 BIGBUFOK
2462  BROWSER BSD4 CK_ANSIC CK_APC CK_AUTODL CK_CURSES CK_DNS_SRV CK_ENVIRONMENT
2463  CK_FAST CK_LOGIN CK_MKDIR CK_NAWS CK_PCT_BAR CK_PERMS CK_RECALL CK_RTSCTS
2464  CK_SPEED CK_TIMERS CK_TMPDIR CK_TTGWSIZ CK_TTYFD CK_WREFRESH CKEXEC
2465  CKFLOAT=double CKGHNLHOST ckmaxfiles=64 CKMAXOPEN=64 CKMAXPATH=1023 CKREALPATH
2466  CKREGEX CKSYSLOG CKTUNING CMDBL=32763 CMDDEP=64 CONGSPD DCMDBUF DIRENT DYNAMIC
2467  FNFLOAT FORDEPTH=32 GFTIMER HADDRLIST HDBUUCP IFDEBUG IKS_OPTION IKSDB
2468  IKSDCONF INBUFSIZE=32768 INPBUFSIZ=4096 MAC_MAX=16384 MACLEVEL=128 MAXDDIR=32
2469  MAXDNUMS=4095 MAXGETPATH=128 MAXTAKE=54 MAXWLD=102400 MSENDMAX=1024 NETCMD
2470  NETCONN NETPTY NOKVERBS NOSETBUF OBUFSIZE=32768 PARSENSE PATTERNS PIPESEND
2471  RENAME RLOGCODE SAVEDUID SELECT SIG_V SOL_SOCKET sparc STREAMING sun SUNOS4
2472  SYSTIMEH TCPSOCKET TIMEH TLOG TNCODE TTLEBUF TTSPDLIST UIDBUFLEN=256 UNIX
2473  UNPREFIXZERO USE_LSTAT USE_MEMCPY VNAML=4096 WHATAMI XFRCAN Z_MAXCHAN=46
2474  z_maxchan=46 ZXREWIND
2475
2476  byte order: big endian
2477
2478  sizeofs: int=4 long=4 short=2 char=1 char*=4 float=4 double=8
2479
2480  floating-point: precision=16 rounding=1
2481
2482    Without going into detail about what all the notation means, notice a
2483    couple things:
2484
2485      * The Options section shows symbols ("macros") in effect during
2486        compilation, together with their values (for those that have
2487        values). The options are listed in alphabetical order to make any
2488        particular option easier to find.
2489      * MAXWLD is the maximum number of files that a wildcard can expand
2490        to.
2491      * Anything starting with "NO" is a feature (or something other than a
2492        feature) that has been deliberately "compiled out", or omitted.
2493      * Important items for script writers include: CMDBL=32763 (the size
2494        of the command buffer and therefore the maximum length for a macro
2495        or variable definition; CMDDEP=64 (the limit on recursion depth);
2496        FORDEPTH=32 (the nesting limit on FOR loops); INBUFSIZE=32768 (the
2497        size of the INPUT command circular buffer); MAC_MAX=16384 (the
2498        maximum number of macros), etc.
2499
2500    See the [383]ckccfg.txt file for details.
2501
2502 1.22. Generalized File Input and Output
2503
2504    C-Kermit 7.0 adds a new generalized I/O system for stream files,
2505    augmenting (and to some extent, overlapping with) the older OPEN, READ,
2506    WRITE, and CLOSE commands. In the new file i/o system, which can be
2507    used simultaneously with the old one, all commands are grouped together
2508    under the new FILE keyword, and some related functions and variables
2509    are added.
2510
2511 1.22.1. Why Another I/O System?
2512
2513    The well-known LOG, OPEN, READ, WRITE, and CLOSE commands have the
2514    following restrictions:
2515
2516     1. Only one READ file and one WRITE file can be open at a time.
2517     2. The READ and WRITE commands are strictly line oriented.
2518     3. These commands can not be used with binary files.
2519     4. They do not support read/write access or random access.
2520     5. The syntax is a bit counterintuitive for programmers.
2521
2522    The new file i/o system allows multiple files to be open at once, in
2523    any desired combination of modes (read/write/append) supported by the
2524    operating system, for line, block (record), or character i/o, for
2525    sequential or random access, using consistent syntax and conventions.
2526
2527    The new system, however, does not replace the old one, since the old
2528    system still must be used for:
2529
2530     1. The session, packet, debug, transaction, and connection logs.
2531     2. Reading and writing commands rather than files.
2532     3. Existing scripts.
2533
2534    The new system works only with regular files, not with commands or
2535    pipes or mailboxes or pseudoterminals. No special provisions are made
2536    in the FILE commands for handling devices or network connections, nor
2537    for preventing you from trying to open them; if the underlying
2538    operating system treats them like regular stream disk files, the FILE
2539    commands (except, of course SEEK, REWIND, and COUNT) might work with
2540    them. (In C programming terms, the FILE commands are, at present,
2541    nothing more than a front end to fopen() / fread() / fwrite() /
2542    fclose() and friends, which are a portable API to sequential files, but
2543    this might change in the future for platforms like VMS and VOS that
2544    have more complicated file systems.)
2545
2546    Definitions:
2547
2548    Channel
2549           A number assigned to a file when it is opened, by which it must
2550           be referred to in all input/output operations.
2551
2552    Read/Write Pointer
2553           The current position in an open file, expressed as the 0-based
2554           byte count from the beginning.
2555
2556 1.22.2. The FILE Command
2557
2558    FILE keyword [ switches ] channel [ data ]
2559           The keyword specifies the function: FILE OPEN, FILE READ, FILE
2560           WRITE, FILE CLOSE, etc. For convenience (and for familiarity to
2561           C programmers), the two-word FILE commands can be shortened to
2562           the single words FOPEN, FREAD, FWRITE, FCLOSE, and so on.
2563           Switches are optional, and modify or amplify the requested file
2564           function.
2565
2566    As in C, Fortran, and other programming languages, open files are
2567    referred to by "channels", integers such as 0, 1, 2, 3, and so on. A
2568    channel number is assigned when you open a file. The number of
2569    available channels depends on the underlying operating system, and can
2570    be seen in the variable:
2571
2572   \v(f_max)
2573
2574    or by giving the FILE LIST (FLIST) command. Channels are discussed in
2575    greater detail in [384]Section 1.22.4.
2576
2577    FILE command errors can be caught with IF FAIL after the FILE command.
2578    In addition, the \v(f_error) variable is set to the completion code of
2579    the command: 0 if no error, or a negative number if there was an error.
2580    The error codes are listed in [385]Section 1.22.5.
2581
2582    The command to open a file is:
2583
2584    FILE OPEN [ switches ] variable filename
2585           Opens a file for the type of access specified by the switches,
2586           or for read-only access if no switches are given. Upon success,
2587           a channel number is assigned to this file and stored in the
2588           given variable so you can refer to the open file in subsequent
2589           i/o commands. If the file can not be opened, the FILE OPEN
2590           command fails. Synonym: FOPEN.
2591
2592    The FILE OPEN switches are:
2593
2594    /READ
2595           Open the file for read access. If no switches are given, /READ
2596           is assumed. If the file does not exist or can't be opened for
2597           read access, the FILE OPEN command fails.
2598
2599    /WRITE
2600           Allow writing. If a file of the same name already exists, it is
2601           overwritten unless /READ or /APPEND is also included. If a file
2602           of the given name does not exist, it is created.
2603
2604    /APPEND
2605           Equivalent to /WRITE, except that if the file exists, it is not
2606           destroyed. The read/write pointer is set to the end of the file,
2607           so unless you change it with FILE SEEK or REWIND (see below),
2608           the first FILE WRITE command adds to the end of the file,
2609           preserving what was there already. If /WRITE is also given, it
2610           is ignored.
2611
2612    /BINARY
2613           Open the file in "binary" mode, rather than text mode. This
2614           switch is meaningless (but still can be used) in UNIX. In VMS,
2615           Windows, and OS/2, it inhibits end-of-line processing and
2616           conversion, and so should be used for binary files and/or files
2617           that are to be accessed in record or character mode rather than
2618           line by line.
2619
2620    The variable for the channel number can be any kind of variable: the
2621    \%x kind, a macro name, or an array element. But it must be a variable,
2622    not a number -- C-Kermit assigns the channel number; you can't tell it
2623    what number to use.
2624
2625    Example:
2626
2627   FILE OPEN \%c oofa.txt                  ; Open oofa.txt for reading.
2628   IF FAIL exit 1 Can't open oofa.txt      ; Always check to see if it worked.
2629   ECHO oofa.txt: channel = \%c
2630
2631    If the file oofa.txt is opened successfully, a channel number is
2632    assigned to the variable \%c. Here's another example using a macro name
2633    for the channel number:
2634
2635   FILE OPEN channel oofa.txt              ; Open oofa.txt for reading.
2636   IF SUCCESS ECHO oofa.txt: channel = \m(channel)
2637
2638    Switches can be combined when it makes sense and the underlying
2639    operating system allows it. For example, to open a file in binary mode
2640    for reading and writing (sometimes called "update"):
2641
2642   FILE OPEN /READ /WRITE /BINARY \%c budget.db
2643
2644    Some combinations might be allowed, others not. For example /READ
2645    /APPEND will usually not be allowed. /WRITE /APPEND is treated as
2646    /APPEND.
2647
2648    A major advantage of the new system over the older one is that you can
2649    have multiple files open at once. Suppose, for example, that you want
2650    to open all the files in a certain directory at once:
2651
2652   .\%n := \ffiles(/usr/olga*,&f)          ; Get file list into array.
2653   if ( > \%n \v(f_max) ) {                ; Make sure there aren't too many.
2654       exit 1 {\v(dir): \%n = Too many files}
2655   }
2656   declare \&c[\%n]                        ; Make array for channel numbers.
2657   for \%i 1 \%n 1 {                       ; Loop to open every file...
2658       file open \&c[\%i] \&f[\%i]         ; Try to open this one
2659       if fail exit 1 Open error: \&f[\%i] ; Check for failure
2660   }
2661
2662    If this loop completes successfully, the \&c[] array will contain \%n
2663    channel numbers of open files in elements 1 through \%n.
2664
2665    Any file that you open with FILE OPEN stays open until Kermit exits, or
2666    you close it explicitly. The command to close a file is:
2667
2668    FILE CLOSE { ALL, channel }
2669           If a channel number is given and the channel refers to an open
2670           file, the file is closed and the channel is freed for reuse; if
2671           the channel does not refer to an open file, an error message is
2672           printed and the command fails. If ALL is specified instead of a
2673           specific channel, all files opened with FILE OPEN are closed and
2674           if all open files were closed successfully (even if no files
2675           were open), the command succeeds; if any open file could not be
2676           closed, the command fails; however, all open files that could be
2677           closed are still closed. Synonym: FCLOSE.
2678
2679    FILE CLOSE might fail because, for example, the disk filled up or a
2680    quota was exceeded. Example:
2681
2682   fopen /write \%c new.txt                ; Open new.txt for writing.
2683   if fail exit 1                          ; Check for error.
2684   fclose \%c                              ; Close the file we just opened.
2685
2686    This creates a 0-length file called new.txt.
2687
2688    Note that FILE OPEN /WRITE (without /READ or /APPEND) always creates a
2689    new file, and therefore destroys any file with the same name that might
2690    already exist (assuming you have permission to delete it). To avoid
2691    overwriting existing files, simply check first:
2692
2693   if exist new.txt exit 1 {Fatal - new.txt already exists}
2694   fopen /write \%c new.txt
2695   if fail ...
2696
2697    The next two commands give information about open files:
2698
2699    FILE STATUS channel
2700           Tells the name of the file, if any, open on the given channel
2701           and the switches it was opened with. The read/write pointer is
2702           also shown; this is where the next read or write will occur;
2703           "[EOF]" is shown if the current position in the open file is the
2704           end -- i.e. the next read will fail if the file was opened in
2705           /READ mode; the next write will add material to the end. The
2706           current line number (0-based) is also shown if known. The FILE
2707           STATUS command succeeds if the channel is open, and fails if
2708           there is no open file on the given channel, or if the channel
2709           number is invalid or out of range. Synonym: FSTATUS.
2710
2711    FILE LIST
2712           Lists the channel number and name of each open file, along with
2713           its OPEN modes (R, W, A, B, RW, etc) and its current read/write
2714           pointer or "[EOF]" if it is at the end. Also tells the number of
2715           files currently opened with FILE OPEN, plus the maximum number
2716           of open files allowed by the system and the maximum number
2717           allowed for FILE OPEN. Synonym: FLIST.
2718
2719    Next come the commands for reading and writing files:
2720
2721    FILE READ [ switches ] channel [ variable ]
2722           Reads data from the file on the given channel number into the
2723           variable, if one was given; if no variable was given, the result
2724           is printed on the screen. IMPORTANT: The variable should
2725           normally be a macro name rather than a \%x or \&x[] variable if
2726           you want backslash characters in the file to be taken literally
2727           (see pp.408-412 of [386]Using C-Kermit for an explanation; you
2728           can also read into a \%x or \&x[] variable, but then you must
2729           remember to protect future references to by \fcontents() if you
2730           don't want C-Kermit to process any backslashes it might
2731           contain). The desired amount of data (according to the switches)
2732           is read from the file at the current read/write pointer, and
2733           upon completion the read/write position is updated to first byte
2734           after the data that was read, no matter what switches were
2735           given. Synonym: FREAD.
2736
2737    FILE WRITE [ switches ] channel text
2738           Writes the given text to the file on the given channel number.
2739           The text, of course, can be literal text or a variable, or any
2740           combination. If the text might contain leading or trailing
2741           spaces, it must be enclosed in braces if you want to preserve
2742           them. Synonym: FWRITE.
2743
2744    Before proceeding, a caution about the NUL character. C-Kermit is so
2745    named because it is a Kermit program written in the C language. In C,
2746    character strings are represented as a sequence of non-NUL bytes
2747    terminated by a NUL byte (a byte in which all bits are 0). Thus a C
2748    string can not contain NUL bytes; it always ends with the first NUL
2749    byte. C-Kermit variables are implemented as C strings and therefore
2750    can't contain NUL bytes either, so the FILE READ and FILE WRITE
2751    commands do not handle files or strings that contain NUL bytes, except
2752    when the /CHARACTER switch is included with the FILE READ or WRITE
2753    command, or when /LPAD:0 or /RPAD:0 is given with the FILE WRITE
2754    command; these switches are explained below.
2755
2756    Also note that Kermit can not be used read or write binary numbers in
2757    the machine's internal format (integer or floating-point); in general,
2758    numbers can be processed only when represented as numeric or
2759    floating-point strings.
2760
2761    FILE READ switches are:
2762
2763    /LINE
2764           Specifies that a line of text is to be read. A line is defined
2765           according to the underlying operating system's text-file format.
2766           For example, in UNIX a line is a sequence of characters up to
2767           and including a linefeed, or the end of the file, which ever
2768           comes first. The line terminator (if any) is removed before
2769           assigning the text to the variable. If no switches are included
2770           with the FILE READ command, /LINE is assumed. Normally this
2771           switch should not be used with files opened in /BINARY mode (but
2772           nothing prevents it either).
2773
2774    /SIZE:number
2775           Specifies that the given number of bytes (characters) is to be
2776           read. The actual number of bytes returned will be less if the
2777           end of file is reached (or a NUL byte is encountered). For
2778           example, if a file is 514 bytes long, FILE READ /SIZE:512
2779           returns 512 bytes the first time and 2 bytes the second time.
2780           FILE READ /SIZE provides a kind of "record i/o" for files that
2781           do not necessarily contain lines. The resulting block of
2782           characters is assigned to the variable without any editing.
2783           Synonym: /BLOCK.
2784
2785    /CHARACTER
2786           Equivalent to /SIZE:1. If FILE READ /CHAR succeeds but the
2787           variable is empty, this indicates a NUL byte was read. Synonym:
2788           BYTE.
2789
2790    FILE WRITE switches are:
2791
2792    /LINE
2793           Specifies that an appropriate line terminator is to be added to
2794           the end of the text. If no switches are included, /LINE is
2795           assumed.
2796
2797    /SIZE:number
2798           Specifies that the given number of bytes (characters) is to be
2799           written. If the given text is longer than the requested size, it
2800           is truncated; if is shorter, it is padded according /LPAD and
2801           /RPAD switches. Synonym: /BLOCK.
2802
2803    /LPAD[:value]
2804           If /SIZE was given, but the text is shorter than the requested
2805           size, the text is padded on the left with sufficient copies of
2806           the character whose ASCII value is given to write the given
2807           length. If no value is specified, 32 (the code for Space) is
2808           used. The value can also be 0 to write the indicated number of
2809           NUL bytes. If /SIZE was not given, this switch is ignored.
2810
2811    /RPAD[:value]
2812           Like LPAD, but pads on the right.
2813
2814    /CHARACTER
2815           Specifies that one character should be written. If the text is
2816           empty or not given, a NUL character is written; otherwise the
2817           first character of text is given. Synonym: /BYTE.
2818
2819    /STRING
2820           Specifies that the text is to be written as-is, with no
2821           terminator added.
2822
2823    Here's an example in which we copy a text file line by line:
2824
2825   file open /read \%c oofa.txt            ; Open input file
2826   if fail exit 1 Can't open input file    ; Check that it's open
2827   file open /write \%d new.txt            ; Open output file
2828   if fail exit 1 Can't open output file   ; Check
2829   while true {                            ; Loop to copy lines
2830       file read /line \%c line            ; Read a line
2831       if fail break                       ; Assume failure = end of file
2832       file write /line \%d {\m(line)}     ; Write the line to output file
2833       if fail exit 1 Write failure        ; Failure here is fatal
2834   }
2835   file close \%c                          ; Close the two files
2836   file close \%d
2837
2838    Note that since /LINE is the default for both FILE READ and FILE WRITE,
2839    it can be omitted as in the following example, where we also use the
2840    short names for the FILE commands.
2841
2842   fopen /read \%c oofa.txt                ; Open input file
2843   if fail exit 1 Can't open input file    ; Check that it's open
2844   fopen /write \%d new.txt                ; Open output file
2845   if fail exit 1 Can't open output file   ; Check
2846   while true {                            ; Loop to copy lines
2847       fread \%c line                      ; Read a line
2848       if fail break                       ; Assume failure = end of file
2849       fwrite \%d {\m(line)}               ; Write the line to output file
2850       if fail exit 1 Write failure        ; Failure here is fatal
2851   }
2852   fclose \%c                              ; Close the two files
2853   fclose \%d
2854
2855    Here's the same example using "record i/o" (the open and close
2856    sequences are are omitted since they are the same as above). The result
2857    is the same, but execution is much faster:
2858
2859   while true {                            ; Loop to copy blocks
2860       fread /size:512 \%c block           ; Read a block into \%a
2861       if fail break                       ; Assume failure = end of file
2862       fwrite /string \%d {\m(block)}      ; Write the block to output file
2863       if fail exit 1 Write failure        ; Failure here is fatal
2864   }
2865
2866    Although record i/o is faster, it should not be used in line-oriented
2867    applications, since it returns arbitrary chunks of the file to your
2868    script, rather than lines. In this example, FWRITE /STRING is used
2869    rather than FWRITE /SIZE:512 to avoid the last output block being
2870    padded beyond the original file's length.
2871
2872    A file can also be copied character by character, but this is much
2873    slower than line i/o and VERY much slower than block i/o:
2874
2875   while true {                            ; Loop to copy blocks
2876       fread /char \%c c                   ; Read a character into c
2877       if fail break                       ; Assume failure = end of file
2878       fwrite /char \%d {\m(c)}            ; Write character to output file
2879       if fail exit 1 Write failure        ; Failure is fatal
2880   }
2881
2882    Although character i/o is slow, it is the only way to process files
2883    that contain NUL characters (i.e. bytes composed of only zero bits). In
2884    the example above, when "fread /char \%c c" returns a NUL, the c
2885    variable is empty. But since the FREAD /CHAR command did not fail, we
2886    know the result was really a NUL. FWRITE /CHAR, when given an empty
2887    variable (or no variable at all) writes a NUL. Thus the loop above will
2888    copy any file at all (very slowly). In non-copying applications, NULs
2889    are detected like this:
2890
2891   fread /char \%c c
2892   if fail (do something)
2893   if not def c (a NUL byte was read)
2894
2895    Finally some advanced file operations:
2896
2897    FILE FLUSH channel
2898           For output files only: commits all previous writes to disk, in
2899           case the computer was buffering them. Synonym: FFLUSH.
2900
2901    FILE COUNT [ { /BYTES, /LINES, /LIST, /NOLIST } ] channel
2902           By default, or if the /BYTES switch is given, counts the bytes
2903           in the file, if any, open on the given channel. If the /LINES
2904           switch is given, counts lines in the file. If the /LIST switch
2905           is given, the result is printed. If the /NOLIST switch is given,
2906           the result is not printed. /QUIET is a synonym for /NOLIST. If
2907           neither /LIST nor /NOLIST is given, the result is printed if the
2908           command is given at top level, i.e. not from a command file or
2909           macro. In all cases, the result of the most recent FILE COUNT
2910           command is stored in the variable \v(f_count). Note that FILE
2911           COUNT /LINE works (and can only work) by reading the entire
2912           file; expect it to take some time if the file is large. Synonym:
2913           FCOUNT.
2914
2915    FILE REWIND channel
2916           Moves the read/write pointer to the beginning of the file.
2917           Equivalent to FILE SEEK channel 0. Synonym: FREWIND.
2918
2919    FILE SEEK [ switches ] channel { [{+,-}]number, LAST, EOF }
2920           Moves the read/write pointer for the file on this channel to the
2921           given position, which may be a byte (character) number or a line
2922           number, expressed in either absolute or relative terms.
2923           Switches:
2924
2925         /BYTE
2926                 The number given is a byte number. Synonym: /CHARACTER.
2927
2928         /LINE
2929                 The number given is a line number.
2930
2931         /ABSOLUTE
2932                 The number given is absolute.
2933
2934         /RELATIVE
2935                 The number given is relative to the current position.
2936
2937           By default, or if the /BYTE switch is given, the number is a
2938           byte number (0 = first byte). If /LINE is given, the number is a
2939           line number (0 = first line). EOF means to move to the end of
2940           the file. LAST means to move to the last line or character of
2941           the file, depending on whether it's a line or character seek.
2942
2943           If neither the /RELATIVE nor the /ABSOLUTE switch is given, then
2944           if a signed number is given, the motion is relative to the
2945           current position. An expression that evaluates to a negative
2946           number is not considered signed for this purpose; that is, a
2947           sign (+ or -) must be included as the first character of the
2948           number in the command itself to force a relative seek (in the
2949           absence of /RELATIVE or /ABSOLUTE).
2950
2951           If the number has no sign, or if the /ABSOLUTE switch is given,
2952           the number represents an absolute position (relative to the
2953           beginning of the file). Subsequent FILE READs or WRITEs will
2954           take place at the new position.
2955
2956           If the read/write pointer is placed after the end of the file, a
2957           subsequent FILE READ will fail, but a FILE WRITE will succeed
2958           (possibly creating a file with "holes"). If a FILE SEEK /BYTE
2959           command is given, the current line becomes unknown (unless the
2960           position is 0) and subsequent FILE SEEK /RELATIVE /LINE commands
2961           will fail until the next non-relative FILE SEEK /LINE command is
2962           given. Synonym: FSEEK.
2963
2964    An absolute FILE SEEK to a negative position fails silently, as does a
2965    relative seek to a position before the beginning of the file.
2966
2967    A caution about relative SEEKs: remember that the number is relative to
2968    the current position. Whenever you read or write, this changes the
2969    position. In each of the following examples, assume the file open on
2970    channel \%c is positioned at line n (the FREAD target variable is
2971    omitted for lack of space):
2972
2973   { FREAD \%c, FSEEK /LINE \%c -1, FREAD \%c }  <-- Reads line n twice
2974   { FREAD \%c, FSEEK /LINE \%c +0, FREAD \%c }  <-- Reads lines n and n+1
2975   { FREAD \%c, FSEEK /LINE \%c +1, FREAD \%c }  <-- Reads lines n and n+2
2976   { FREAD \%c, FSEEK /LINE \%c -2, FREAD \%c }  <-- Reads lines n and n-1
2977   { FREAD \%c, FSEEK /LINE \%c -3, FREAD \%c }  <-- Reads lines n and n-2
2978
2979    Another caution: Using FSEEK and FREAD /SIZE to repeatedly read the
2980    same disk block (e.g. when sampling a database record that is
2981    frequently updated) might not give you updated disk blocks due to the
2982    internal buffering and caching of the C library (this probably varies
2983    from one platform/compiler combination to another). If necessary you
2984    can force a fresh disk read with a close/open sequence:
2985
2986   FCLOS \%c
2987   FOPEN \%c samefilename
2988   FSEEK \%c samespot
2989   FREAD /SIZE:howmanybytes \%c variable
2990
2991 1.22.3. FILE Command Examples
2992
2993    To read the last 10 lines of a text file into an array:
2994
2995   fopen /read \%c oofa.txt                ; Open the file
2996   if fail exit 1 Can't open oofa.txt      ; Always check for failure
2997   dcl \&a[10]                             ; Declare a 10-element array
2998   fcount /line \%c                        ; Count lines in the file
2999   fseek /line \%c \v(f_count)-10          ; Seek to 10 lines from the end
3000   if fail exit 1 Can't seek               ; Check for failure
3001   for \%i 1 10 1 { fread \%c \&a[\%i] }   ; Read the last 10 lines
3002   fclose \%c                              ; Close the file
3003
3004    Note that blank lines show up as empty (undefined) array elements, for
3005    example if you give a "show array a" command at this point. This is
3006    normal. You can still use these elements; e.g.:
3007
3008   for \%i 1 10 1 { echo \%i. \&a[\%i] }   ; Display the 10 lines
3009
3010    Here is how to read the last line of a file (already open on channel
3011    \%c):
3012
3013   fseek /line \%c last                    ; Seek directly to last line
3014
3015    Alternatively:
3016
3017   fseek /line \%c eof                     ; Seek to end of file
3018   fseek /line \%c -1                      ; Seek to beginning of last line
3019
3020    Alternatively:
3021
3022   fcount /line \%c                        ; Count the file's lines
3023   fseek /line \%c \v(f_count)-1           ; Seek to last line
3024   fread \%c                               ; Read it
3025
3026    To read every other line from the file (using relative SEEK), skipping
3027    the first line:
3028
3029   fopen /read \%c oofa.txt                ; Open the file
3030   while ( success ) {                     ; Loop through lines
3031       fseek /line \%c +1                  ; Skip a line
3032       if success fread \%c                ; Read & display a line
3033   }
3034   fclose \%c                              ; Close the file
3035
3036    Here is how to read the lines of a file in reverse order:
3037
3038   fopen /read \%c oofa.txt                ; Open
3039   if fail exit 1                          ; Check
3040   fseek /line \%c last                    ; Seek to last line
3041   while success {                         ; Loop
3042       fread \%c                           ; Read line
3043       fseek /line \%c -2                  ; Seek backwards two lines
3044   }
3045   fclose \%c                              ; Close the file
3046
3047    The loop works because a relative SEEK outside the file fails.
3048
3049    It is also possible to use block i/o to manage random-access files with
3050    fixed-length records (as long as they don't contain NUL characters).
3051    Suppose, for example, you have a file of "card image" records with
3052    fixed-field information about customers, such as:
3053
3054   Name:     Columns  1-32  (column numbers are 1-based)
3055   Address:  Columns 33-72
3056   Balance:  Columns 73-80
3057
3058    The records are indexed by customer number, starting with 0. There are
3059    no line terminators separating them. Therefore the record for customer
3060    number n starts at position nx 80 (\%n*80).
3061
3062    Now suppose we received a payment from customer number 173 and want to
3063    update the balance:
3064
3065   .\%n = 173                               ; Customer (record) number
3066   .\%a = 12.72                             ; Amount
3067   fopen /read /write \%c customer.db       ; Open the file
3068   if fail stop 1 OPEN FAILED: \f_errmsg()  ; Check
3069   fseek /byte \%c 80*\%n                   ; Seek to record
3070   fread /size:80 \%c r                     ; Read the record
3071   if fail stop 1 READ FAILED: \f_errmsg()  ; Check (IMPORTANT)
3072   .\%b := \fright(\m(r),8)                 ; Extract the balance
3073   .\%b := \ffpadd(\%b,\%a,2)               ; Add the new payment
3074   if fail stop 1 ARITHMETIC ERROR: \%b/\%a ; Catch bad records
3075   .r := {\fleft(\m(r),72)\flpad(\%b,8)}    ; Update the record
3076   fseek /byte \%c 80*\%n                   ; Reposition to same spot
3077   fwrite /size:80 \%c {\m(r)}              ; Replace the record
3078   if fail stop 1 WRITE FAILED: \f_errmsg() ; Check
3079   fclose \%c                               ; Close the file
3080
3081    REMEMBER: Using FILE SEEK to move beyond the end of file can result in
3082    a file with holes when writing; when reading, an end-of-file error will
3083    occur -- be sure to check for it.
3084
3085 1.22.4. Channel Numbers
3086
3087    C-Kermit's channel numbers are integers from 0 to some
3088    platform-dependent limit, such as 46 or 1985 (the value of \v(f_max)).
3089    This is the limit placed by the operating system on the number of files
3090    that may be opened by one process or user or job, minus the standard
3091    input, output, and error files, and minus the number of files reserved
3092    by C-Kermit for logs, OPEN READ and WRITE, and file transfer (and maybe
3093    some command files -- the \v(f_max) number can't be exact).
3094
3095    Although you must include a variable in the FILE OPEN command, to which
3096    the channel number is assigned, you don't have to use a variable in the
3097    other FILE commands if you know what the number is -- you can just put
3098    the number. This saves you a few keystrokes when typing commands at the
3099    prompt:
3100
3101   fopen \%c oofa.txt
3102   flist
3103   0. /usr/olga.oofa.txt (R) 0
3104
3105    This tells the channel number is 0 (the number on the left is the
3106    channel file's channel number). Of course you can also find it by
3107    echoing the variable:
3108
3109   echo \%c
3110   0
3111
3112    Or with "fstatus \%c". Now you can type commands like:
3113
3114   fread 0
3115
3116    to read a line from the file. Obviously, however, using digits rather
3117    than a variable for the channel number would be poor practice in a
3118    script.
3119
3120    If in commands like:
3121
3122   fread \%c \%a
3123
3124    you have trouble remembering which variable is which, note that the
3125    channel number is, indeed, a number. Anywhere C-Kermit accepts a number
3126    it can also accept an expression, so you can put parentheses around the
3127    channel number to remind you it's the channel number and not the
3128    variable into which data is to be read:
3129
3130   fread (\%c) \%a
3131
3132    Normally channel numbers are assigned sequentially as 0, 1, 2, ... up
3133    to the limit. However, once you start closing files, there can be holes
3134    in the sequence. New channels are assigned to fill in the holes. Thus
3135    you can't depend on channel numbers being in any particular sequence.
3136
3137 1.22.5. FILE Command Errors
3138
3139    Each FILE command sets the variable \v(f_error) to one of the following
3140    values:
3141
3142     0 = No error
3143    -1 = System error
3144    -2 = Attempt to read after end of file
3145    -3 = Channel not open
3146    -4 = Channel number out of range (negative or too large)
3147    -5 = Numeric argument (size, ...) out of range
3148    -6 = File not found
3149    -7 = Bad or missing filename
3150    -8 = Too many files are already open (FILE OPEN only)
3151    -9 = Forbidden operation (e.g. write to a read-only file)
3152   -10 = Access denied
3153   -11 = Illegal combination of OPEN modes (FILE OPEN only)
3154   -12 = Buffer overflow
3155   -13 = Current line number unknown (for relative line seeks)
3156   -14 through -98: Reserved.
3157   -99 = Requested operation not implemented in this version of C-Kermit
3158  -999 = Unknown error
3159
3160    When \v(f_error) is -1, this means the FILE command failed because
3161    because of a system error, in which case you can examine the following
3162    variables:
3163
3164   \v(errno)     = System error number.
3165   \v(errstring) = Error message corresponding to \v(errno).
3166
3167    A special function is available for translating the \v(f_error) code to
3168    an error message string:
3169
3170 \f_errmsg([code])
3171   If the code is -1, returns error message of the most recent system
3172   error; otherwise if the code is a valid \v(f_error) value, the associated
3173   message is returned.  If the code is omitted, the status message
3174   corresponding to the current \v(f_error) value is returned.
3175
3176    A FILE command that fails prints the appropriate error message
3177    automatically, except when the command is READ or SEEK and the error is
3178    -2 (end of file); in that case, the command still fails, but does not
3179    print a message. This allows constructions such as:
3180
3181   fopen \%c oofa.txt
3182   while success { fread \%c }
3183   fclose \%c
3184
3185    to work as expected, i.e. without an annoying message when the end of
3186    file is reached.
3187
3188 1.22.6. File I/O Variables
3189
3190    The variables associated with the file i/o package are:
3191
3192    \v(f_count)
3193           Result of the most recent FILE COUNT (FCOUNT) command.
3194
3195    \v(f_error)
3196           Numeric error code of most recent FILE command (0 = no error).
3197
3198    \v(f_max)
3199           Maximum number of files open simultaneously.
3200
3201 1.22.7. File I/O Functions
3202
3203    Some of the FILE commands can also be issued as function calls, which
3204    makes script writing a bit more convenient, especially for C
3205    programmers. Also, several functions are provided that do not have
3206    command equivalents. Each of these functions takes a channel number as
3207    the first argument. These functions do not work for OPEN { READ, !READ,
3208    WRITE, !WRITE, and APPEND } files.
3209
3210    \f_status(channel)
3211           Returns 0 if the channel is not open, otherwise a number between
3212           1 and 15 which is the sum of the OPEN modes:
3213
3214   1 = /READ
3215   2 = /WRITE
3216   4 = /APPEND
3217   8 = /BINARY
3218
3219    The remaining functions work only for open channels. Each of these
3220    functions can fail for the applicable reasons listed in [387]Section
3221    1.22.5. For instructions on handling function errors, see [388]Section
3222    7.12.
3223
3224    \f_pos(channel)
3225           Returns the file's current read/write pointer (0-based). There
3226           is no FILE command equivalent.
3227
3228    \f_line(channel)
3229           Returns the file's current line number (0-based), if known,
3230           otherwise -1. There is no FILE command equivalent. The line
3231           number is known as long as no character or block i/o has been
3232           done on the channel.
3233
3234    \f_handle(channel)
3235           Returns the "file handle" of the file. That is, it translates
3236           the portable C-Kermit channel number into a system-specific file
3237           handle or number that can be passed to other programs on the
3238           same platform. In UNIX this is a file descriptor. There is no
3239           FILE command equivalent.
3240
3241    \f_eof(channel)
3242           Returns 1 if the read/write pointer of the file on the given
3243           channel is at the end of the file, 0 otherwise. Convenient in
3244           WHILE statements, e.g.:
3245
3246     while not \f_eof(\%c) { fread \%c }
3247
3248    \f_getchar(channel)
3249           Equivalent to FREAD /CHAR. Returns the character actually read.
3250           If \f_getchar() does not fail but the return value is empty,
3251           this means a NULL character was read.
3252
3253    \f_getline(channel)
3254           Equivalent to FREAD /LINE. Returns the line actually read, but
3255           with the line terminator stripped. If \f_getline() does not fail
3256           but the return value is empty, this normally means an empty line
3257           was read.
3258
3259    \f_getblock(channel,n)
3260           Equivalent to FREAD /SIZE:n. Returns the block of characters
3261           actually read. If the returned block is smaller than n, it
3262           indicates either that the end of file was reached or a NUL
3263           character is in the block.
3264
3265    \f_putchar(channel,c)
3266           Equivalent to FWRITE /CHARACTER. Writes the character c. If c
3267           contains more than one character, only the first is written. If
3268           c is empty a NUL is written. Returns the number of characters
3269           written on success, or a negative error code upon failure.
3270
3271    \f_putline(channel,string)
3272           Equivalent to FWRITE /LINE. Writes the string and adds the
3273           appropriate line termination character or sequence. If the
3274           string is empty or omitted, an empty line is written. Returns
3275           the number of characters written on success, or a negative error
3276           code upon failure.
3277
3278    \f_putblock(channel,string)
3279           Equivalent to FWRITE /STRING. Writes the string as given. If the
3280           string is empty or omitted, nothing is written. Returns the
3281           number of characters written on success, or a negative error
3282           code upon failure.
3283
3284 1.22.8. File I/O Function Examples
3285
3286   fopen /read \%c oofa.txt            ; Open our favorite file for reading
3287   if failure exit 1                   ; Check that it's open
3288   while not \f_eof(\%c) {             ; Loop until EOF
3289       .line := \f_getline(\%c)        ; Get a line
3290       if success echo {\m(line)}      ; Echo it
3291   }
3292   if not \f_eof(\%c) {                ; Check reason for loop exit
3293       exit 1 File Error: \f_errmsg()  ; If not EOF say so.
3294   }
3295
3296   frewind \%c                         ; Rewind the file
3297   while not \f_eof(\%c) {             ; Same thing but with block i/o
3298       .block := \f_getblock(\%c,256)  ; (much faster than line i/o)
3299       if success xecho {\m(block)}
3300   }
3301
3302   frewind \%c                         ; Rewind again
3303   while not \f_eof(\%c) {             ; Same deal but with character i/o
3304       .c := \f_getchar(\%c)           ; (much slower than line i/o)
3305       if success xecho {\m(c)}
3306   }
3307   close \%c
3308
3309    To close all open files (equivalent to FCLOSE ALL):
3310
3311   for \%i 0 \v(f_max)-1 1 {
3312       if \f_status(\%i) fclose \%i
3313   }
3314
3315 1.23. The EXEC Command
3316
3317    The EXEC command is available only in UNIX.
3318
3319    EXEC [ /REDIRECT ] command [ arg1 [ arg2 [ ... ] ]
3320           Runs the given command with the arguments in such a way that the
3321           command replaces C-Kermit in memory, and C-Kermit ceases to
3322           execute. EXEC is like RUN, except instead of returning to
3323           C-Kermit when finished, the command returns to whatever process
3324           invoked Kermit.
3325
3326    In the normal case, no files are closed, so the EXEC'd command inherits
3327    the open files, read/write pointers, working directory, process ID,
3328    user ID (unless command is SUID), group ID (unless command is SGID),
3329    groups, etc. (In UNIX, the EXEC command is simply a front end for
3330    execvp().)
3331
3332    If the /REDIRECT switch is included, then if a connection is open (SET
3333    LINE or SET HOST), it becomes the standard input and output of the
3334    EXEC'd program. If no connection is open, the /REDIRECT switch has no
3335    effect. For example to use C-Kermit for PPP dialing in Linux:
3336
3337   set modem type usr          ; Specify the kind of modem you have
3338   set line /dev/ttyS1         ; Specify the device it's connected to
3339   set speed 57600             ; and the speed
3340   set flow rts/cts            ; and flow control.
3341   set dial retries 100        ; Try the dial sequence up to 100 times.
3342   dial {{9-212-555-1212}{9-212-555-1213}{9-212-555-1214}{9-212-555-1215}}
3343   if fail exit 1
3344   for \%i 1 16 1 {            ; Try up to 16 times to get login prompt
3345       input 10 Login:         ; Wait 10 sec for it to appear
3346       if success break        ; Got it - proceed...
3347       output \13              ; Send a carriage return and try again
3348   }
3349   if ( > \%i 16 ) stop 1 NO LOGIN PROMPT
3350   lineout \(myuserid)         ; Send user ID
3351   input 30 assword:           ; Wait for Password prompt
3352   if fail stop 1 NO PASSWORD PROMPT
3353   lineout \m(mypassword)      ; Send the password.
3354   exec /redirect pppd         ; Replace ourselves with pppd.
3355
3356    In this example we assume that the script has already set up the
3357    myuserid and mypassword variables -- normally the password should be
3358    prompted for, rather than stored on disk. Notice the advantages over
3359    the well-known "chat script":
3360      * You don't have to control the modem itself with AT commands;
3361        Kermit's DIAL command does this for you.
3362      * You can have Kermit automatically redial as many times as you want
3363        until it gets a connection (if this is legal in your country).
3364      * You can have Kermit fetch the number or numbers from a dialing
3365        directory.
3366      * You can have Kermit cycle through a list of phone numbers (this is
3367        new in C-Kermit 7.0; see [389]Section 2.1.16) without having to
3368        enter the numbers in a dialing directory.
3369      * Dialing is location-independent; you can use the same script to
3370        dial from different areas or countries.
3371      * Once the connection is made, the full power of Kermit's script
3372        language is available to manage the dialog with the terminal server
3373        or other device that answers the phone call.
3374
3375    NOTE: PPP and SLIP dialing are not available in Windows 95/98/NT/2000,
3376    whose APIs do not provide a method for an application to hand over a
3377    connection to the PPP or SLIP driver.
3378
3379 1.24. Getting Keyword Lists with '?'
3380
3381    Suppose you type "te" at the C-Kermit> 6.0 prompt and then Esc or Tab
3382    to request keyword completion. Kermit beeps, indicating that more than
3383    one command starts with "te". But if you type '?' to see what they are,
3384    Kermit shows only "telnet". So why the beep? Because of invisible
3385    keywords like "telopt", "terminal", and "text". Lots of keywords are
3386    invisible because they are either synonyms for other keywords or else
3387    esoteric options to be used only in special circumstances, so we don't
3388    want them cluttering up the menus.
3389
3390    But then there is no way for you to discover them. So in C-Kermit 7.0,
3391    if you type '?' AFTER the beginning of a keyword field, then invisible
3392    keywords are shown too:
3393
3394   C-Kermit> te<Esc><BEEP>
3395   C-Kermit> te? Command, one of the following:
3396    telnet    telopt    terminal  text
3397   C-Kermit>te
3398
3399    But if '?' is typed at the beginning of a field, only visible keywords
3400    are shown, as before (so, in this example, if '?' is typed at the
3401    C-Kermit> prompt, "telnet" is the only command shown that starts with
3402    "te").
3403
3404 2. MAKING AND USING CONNECTIONS The SET LINE, SET HOST, and SET PORT (a
3405 synonym for SET LINE) commands have new synonyms, in which the word SET is
3406 replaced by the word OPEN: OPEN LINE, etc. There is no new functionality
3407 here, but OPEN is a better verb, since SET generally takes no action, whereas
3408 these commands actually try to open a connection. Furthermore, there is the
3409 symmetry with CLOSE. 2.0. SET LINE and SET HOST Command SwitchesThe SET LINE
3410 (SET PORT) and SET HOST commands now allow switches before the device or host
3411 name, in most cases, and under certain circumstances, also at the end. The
3412 new syntax is backwards compatible with the previous syntax; thus SET LINE,
3413 SET PORT, and SET HOST commands in command files written for C-Kermit 6.0 or
3414 earlier still work. The expanded syntax is:
3415
3416 { OPEN, SET } { LINE, PORT, HOST } [ switches ] device-or-address [ switches
3417 ]
3418
3419 The first group of switches is:
3420
3421    /NETWORK-TYPE:{TCP/IP,X.25,PIPE,PTY...}
3422           When more than one network type is available, this lets you
3423           specify the type of network to use for this connection without
3424           affecting your global SET NETWORK TYPE. See [390]Section 2.7
3425           about pipes and ptys.
3426
3427    /USERID:[string]
3428           This switch is equivalent to SET LOGIN USERID. If a string is
3429           given, it sent to host during Telnet negotiations; if this
3430           switch is given but the string is omitted, no user ID is sent to
3431           the host. If this switch is not given, your current LOGIN USERID
3432           (\v(userid) value), if any, is sent. Unlike most other switches,
3433           this one is "sticky", since the value must persist throughout
3434           the session in case the server requests the ID string at a later
3435           time.
3436
3437    /CONNECT
3438           Enter CONNECT mode immediately and automatically after the
3439           device or connection is open. On serial devices, however, when
3440           CARRIER-WATCH is not OFF, wait up to 1 second for the Carrier
3441           Detect signal to appear before trying to connect, to give the
3442           device time to react DTR, which might have been off prior to
3443           opening the device.
3444
3445    /SERVER
3446           Enter server mode immediately and automatically after the device
3447           or connection is open. Treatment of carrier is the same as for
3448           /CONNECT.
3449
3450    /WAIT
3451    /NOWAIT
3452           For Telnet connections only: Like SET TELNET WAIT { ON, OFF },
3453           but applies only to this connection, and in fact applies only
3454           when OPENing this connection (which is usually the only place it
3455           matters). Typically you would use TELNET /NOWAIT to make a
3456           connection to a misbehaving Telnet server that does not reply to
3457           negotiations as required by the Telnet protocol definition.
3458
3459    Note: /CONNECT and /SERVER switches are not available in the RLOGIN and
3460    TELNET commands, since these commands already include an implicit
3461    /CONNECT and preclude automatic entry into server mode.
3462
3463    The /CONNECT and /SERVER switches are especially useful with "set host
3464    *" connections. For example, suppose you want to start a Kermit server
3465    on socket 3000 of your TCP host. Normally you would have to give the
3466    command:
3467
3468   set host * 3000
3469
3470    and then wait for a connection to come in, and only then could you give
3471    the SERVER command (or else define a macro to do this, and then execute
3472    the macro). Now you can do it in one step:
3473
3474   set host /server * 3000
3475
3476    This tells C-Kermit to wait for the connection and then enter server
3477    mode once it comes in, no matter how long it takes. Similarly, "set
3478    host /conn *" can be used to wait for a "chat" connection to come in.
3479
3480    Another set of switches is available in VMS only, for use only with SET
3481    LINE:
3482
3483    /SHARE
3484           Allows the SET LINE device to be opened in shared mode. Normally
3485           it makes no sense to open a serial device in shared mode, but
3486           it's necessary when C-Kermit is running in an environment such
3487           as DECIntact, that opens your job's controlling terminal in such
3488           a way that C-Kermit can't open it too, unless it enables SHARE
3489           privilege. Note: SHARE privilege is required.
3490
3491    /NOSHARE
3492           Requires that the SET LINE device not be in use by any other
3493           process in order for it to be successfully opened by C-Kermit.
3494           If neither /SHARE nor /NOSHARE is specified, /NOSHARE is used.
3495
3496    The second group of switches is:
3497
3498    /NO-TELNET-INIT
3499           Do not send initial Telnet negotiations even if this is a Telnet
3500           port.
3501
3502    /RAW-SOCKET
3503           This is a connection to a raw TCP socket ([391]Section 2.3.5).
3504
3505    /RLOGIN
3506           Use Rlogin protocol even if this is not an Rlogin port.
3507
3508    /TELNET
3509           Send initial Telnet negotiations even if this is not a Telnet
3510           port.
3511
3512    As of C-Kermit 7.0 and K95 1.1.19, the TELNET command includes an
3513    implicit /TELNET switch. So if you TELNET to a non-TELNET port, Kermit
3514    sends initial Telnet negotiations. This makes sense, since that's what
3515    "telnet" means.
3516
3517    If you want to make a connection to a non-Telnet port without sending
3518    initial Telnet negotiations, use:
3519
3520   set host [ /connect ] name-or-address port
3521
3522    or:
3523
3524   telnet name-or-address port /no-telnet-init
3525
3526    Additional switches might be added in the future; type "set host ?" or
3527    "set line ?" to see a current list.
3528
3529 2.1. Dialing
3530
3531    Automatic redialing is illegal or restricted in many countries, so
3532    until C-Kermit 7.0, it was disabled by default, i.e. until a SET DIAL
3533    RETRIES command was given. In C-Kermit 7.0, if no SET DIAL RETRIES
3534    command has been given, a default is picked dynamically at DIAL time
3535    based on the calling country code, if known. At this writing, the only
3536    country code known to have no restrictions on automatic redialing is 1.
3537    So in this case a limit of 10 is chosen; otherwise 1. If you have not
3538    given an explicit SET DIAL RETRIES command, SHOW DIAL shows the value
3539    as "(auto)", and then the value actually used is shown when you give
3540    the DIAL command.
3541
3542    As of C-Kermit 7.0, automatic redialing is automatically canceled if
3543    the call could not be placed because no dialtone was detected.
3544
3545 2.1.1. The Dial Result Message
3546
3547    If DIAL DISPLAY is not ON, the "Call complete" message now shows the
3548    modem's call result message, for example:
3549
3550   Dialing: ...
3551   Call complete: "CONNECT 31200/ARQ/V32/LAPM/V42BIS"
3552
3553    The exact format and contents of this message, of course, depends on
3554    the make, model, and configuration of your modem, so use your modem
3555    manual to interpret it. The call result message is also available in
3556    C-Kermit's \v(dialresult) variable.
3557
3558   C-Kermit> echo \v(dialresult)
3559   CONNECT 31200/ARQ/V32/LAPM/V42BIS
3560   C-Kermit> echo Speed = \fword(\v(dialresult),2)
3561   Speed = 31200
3562   C-Kermit>
3563
3564    Suppose your modem reports the modulation speed as shown above and you
3565    want to ensure your call is completed at (say) 24000 bps or more. You
3566    can use a little macro to do the job:
3567
3568 define HSDIAL {                ; High Speed DIAL
3569     local \%s
3570     if < \v(argc) 1 if not def \v(dialnumber) end 1 Usage: \%0 number
3571     set dial retries 100
3572     set dial interval 1
3573     while true {
3574         dial \%*
3575         if fail end 1 DIAL failed.
3576         asg \%s \fword(\v(dialresult),2)
3577         if def \%s if numeric \%s if not < \%s 24000 break
3578     }
3579 }
3580
3581    (See [392]Section 7.5 about the \%* variable.)
3582
3583 2.1.2. Long-Distance Dialing Changes
3584
3585    Due to the glut of cell phones, pagers, fax machines, ISPs, etc, area
3586    codes and dialing rules are changing all the time. In the North
3587    American Numbering Plan (NANP) countries (USA, Canada, etc), area codes
3588    are split or overlayed with increasing frequency, and 10- and 11-digit
3589    dialing is gradually becoming the norm for local calls. Changes are
3590    occurring In Europe, too, partly for these reasons and partly because
3591    of some new EC rules.
3592
3593    In France, effective 18 October 1996, all calls, even local ones, must
3594    be dialed with an area code. French area codes are presently 1-digit
3595    numbers, 1-6, and the long-distance dialing prefix is 0. All calls
3596    within France are considered long distance and begin with 01, 02, ...,
3597    06.
3598
3599    Effective 1 May 1997, all calls within the US state of Maryland, even
3600    local ones, must be dialed with an area code but without the
3601    long-distance prefix -- this is the now widely-known North American
3602    phenomenon of "ten digit dialing". The same is happening elsewhere --
3603    many cities in Florida adopted 10-digit dialing in 1998.
3604
3605    In Italy beginning 19 June 1998, all calls to fixed (as opposed to
3606    mobile) numbers must be prefixed by 0. When calling into Italy from
3607    outside, the 0 must follow the country code (39). Calls to cell phones,
3608    however, must be placed without the 0. Then on 29 December 2000, the 0
3609    will become a 4 (for calling fixed numbers) and a prefix of 3 must used
3610    for calling mobile phones. More info at:
3611    http://www.telecomitalia.it/npnn/.
3612
3613    In Spain, effective 4 April 1998, with hard cutover on 18 July 1998,
3614    all calls within the country must be dialed with 9 digits, and all
3615    calls from outside Spain must also be dialed with 9 digits (after the
3616    country code, 34). The new 9-digit numbers all begin with "9". More
3617    info at: [393]http://www.telefonica.es/cambiodenumeracion/
3618
3619    Several new dialing features and commands have been added in version
3620    6.1 and 7.0 to address these changes.
3621
3622    C-Kermit 6.0 and Kermit 95 1.1.11 and earlier handle the French
3623    situation via a reasonable subterfuge (setting the local area code to a
3624    nonexistent one), but did not handle "ten-digit dialing" well at all;
3625    the recommended technique was to change the long-distance dialing
3626    prefix to nothing, but this defeated Kermit's "list numbers for one
3627    name" feature when the numbers were in different locations. For
3628    example:
3629
3630   set dial ld-prefix
3631   dial onlineservice
3632
3633    where "onlineservice" is a dialing directory entry name corresponding
3634    to entries that are in (say) Maryland as well as other states, would
3635    not correctly dial the numbers not in Maryland.
3636
3637    A new command lets you specify a list of area codes to be considered
3638    local, except that the area code must be dialed:
3639
3640    SET DIAL LC-AREA-CODES [ areacode [ areacode [ areacode [ ... ] ] ] ]
3641           The list may include up to 32 area codes. If a number is called
3642           whose area code is in this list, it is dialed WITHOUT the
3643           long-distance prefix, but WITH the area code.
3644
3645    So in Maryland, which (last time we looked) has two area codes, 410 and
3646    301, the setup would be:
3647
3648   SET DIAL LC-AREA-CODES 410 301
3649
3650    Example:
3651
3652   SET DIAL LD-PREFIX 1
3653   SET DIAL AREA-CODE 301
3654   SET DIAL LC-AREA-CODES 410 301 <-- Area codes in 10-digit dialing region
3655   DIAL +1 (301) 765-4321         <-- Dials 3017654321  (local with area code)
3656   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
3657   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
3658
3659    The SET DIAL LC-AREA-CODES command does not replace the SET DIAL
3660    AREA-CODE command. The latter specifies the area code you are dialing
3661    from. If the called number is in the same area code, then the area code
3662    is dialed if it is also in the LC-AREA-CODES list, and it is not dialed
3663    otherwise. So if "301" had not appeared in the LC-AREA-CODES list in
3664    the previous example:
3665
3666   SET DIAL LD-PREFIX 1
3667   SET DIAL AREA-CODE 301
3668   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
3669   DIAL +1 (301) 765-4321         <-- Dials 7654321     (local)
3670   DIAL +1 (410) 765-4321         <-- Dials 4107654321  (local with area code)
3671   DIAL +1 (212) 765-4321         <-- Dials 12127654321 (long distance)
3672
3673    The new Kermit versions also add a Local Call Prefix and Local Call
3674    Suffix, in case you have any need for it. These are added to the
3675    beginning and of local phone numbers (i.e. numbers that are not
3676    long-distance or international). Examples:
3677
3678   SET DIAL LD-PREFIX 1
3679   SET DIAL LC-PREFIX 9
3680   SET DIAL LC-SUFFIX *
3681   SET DIAL LC-AREA-CODES 410     <-- Area codes in 10-digit dialing region
3682   SET DIAL AREA-CODE 301
3683   DIAL +1 (301) 765-4321         <-- Dials 97654321*     (local)
3684   DIAL +1 (410) 765-4321         <-- Dials 94107654321*  (local with area code)
3685   DIAL +1 (212) 765-4321         <-- Dials 12127654321   (long distance)
3686
3687 2.1.3. Forcing Long-Distance Dialing
3688
3689    Suppose a number is in your country and area, but for some reason you
3690    need to dial it long-distance anyway (as is always the case in France).
3691    There have always been various ways to handle this:
3692
3693     1. Temporarily set your area code to a different (or nonexistent or
3694        impossible) one (but this required knowledge of which area codes
3695        were nonexistent or impossible in each country).
3696     2. Dial the number literally instead of using the portable format, but
3697        this defeats the purpose of the portable dialing directory.
3698
3699    Now there is also a new command that, very simply, can force
3700    long-distance dialing:
3701
3702    SET DIAL FORCE-LONG-DISTANCE { ON, OFF }
3703           If a call is placed to a portable phone number within the same
3704           country code as the calling number, it is dialed with the
3705           long-distance prefix and the area code if FORCE-LONG-DISTANCE is
3706           ON. If OFF, the regular rules and procedures apply.
3707
3708    Example (France):
3709
3710   SET DIAL COUNTRY-CODE 33
3711   SET DIAL AREA-CODE 6
3712   SET DIAL FORCE-LONG-DISTANCE ON
3713
3714    (In fact, SET DIAL COUNTRY-CODE 33 automatically sets DIAL
3715    FORCE-LONG-DISTANCE ON...)
3716
3717    Example (USA, for a certain type of reverse-charge calling in which the
3718    called number must always be fully specified):
3719
3720   SET DIAL PREFIX 18002666328$     ; 1-800-COLLECT
3721   SET DIAL COUNTRY-CODE 1
3722   SET DIAL AREA-CODE 212
3723   SET DIAL FORCE-LONG-DISTANCE ON
3724
3725    Example (Toronto, where calls to exchange 976 within area code 416 must
3726    be dialed as long distance, even when you are dialing from area code
3727    416):
3728
3729   SET DIAL COUNTRY-CODE 1
3730   SET DIAL AREA-CODE 416
3731   SET DIAL FORCE-LONG-DISTANCE ON
3732   DIAL +1 (416) 976-xxxx
3733
3734    If dialing methods were consistent and sensible, of course it would be
3735    possible to always dial every domestic call as if it were long
3736    distance. But in many locations this doesn't work or if it does, it
3737    costs extra. The following macro can be used for dialing any given
3738    number with forced long-distance format:
3739
3740   define LDIAL {
3741       local \%x
3742       set dial force-long-distance on
3743       dial \%*
3744       asg \%x \v(success)
3745       set dial force-long-distance off
3746       end \%x
3747   }
3748
3749    (See [394]Section 7.5 about the \%* variable.)
3750
3751 2.1.4. Exchange-Specific Dialing Decisions
3752
3753    This applies mainly to the North American Numbering Plan (NANP). Refer
3754    to the section "Alternative notations" in [395]Using C-Kermit 2nd
3755    Edition, pages 106-107, and the story about Toronto on page 110. Using
3756    the new LC-AREA-CODES list, we can address the problem by treating the
3757    exchange as part of the area code:
3758
3759   SET DIAL LD-PREFIX 1
3760   SET DIAL AREA-CODE 416
3761   SET DIAL LC-AREA-CODES 905276
3762   DIAL +1 416 765 4321               <-- 7654321      (local)
3763   DIAL +1 905 276 4321               <-- 9052764321   (local with area code)
3764   DIAL +1 905 528 4321               <-- 19055284321  (long distance)
3765
3766    The same technique can be used in Massachusetts (story at top of page
3767    111) and in any other place where dialing to some exchanges within a
3768    particular area code is local, but to others in the same area code is
3769    long distance.
3770
3771 2.1.5. Cautions about Cheapest-First Dialing
3772
3773    Kermit does not maintain a knowledge base of telephony information; it
3774    only provides the tools to let you enter a phone number in a standard
3775    format and dial it correctly from any location in most cases.
3776
3777    In particular, Kermit does not differentiate the charging method from
3778    the dialing method. If a call that is DIALED as long-distance (e.g.
3779    from 212 to 718 in country code 1) is not CHARGED as long distance, we
3780    have no way of knowing that without keeping a matrix of charging
3781    information for every area-code combination within every country, and
3782    any such matrix would be obsolete five minutes after it was
3783    constructed. Thus, "cheapest-first" sorting is only as reliable as our
3784    assumption that the charging method follows the dialing method. A good
3785    illustration would be certain online services that have toll-free
3786    dialup numbers which they charge you a premium (in your online service
3787    bill) for using.
3788
3789 2.1.6. Blind Dialing (Dialing with No Dialtone)
3790
3791    C-Kermit's init string for Hayes-like modems generally includes an X4
3792    command to enable as many result codes as possible, so that Kermit can
3793    react appropriately to different failure reasons. One of the result
3794    codes that X4 enables is "NO DIALTONE". A perhaps not obvious side
3795    effect of enabling this result code that the modem must hear dialtone
3796    before it will dial.
3797
3798    It is becoming increasingly necessary to force a modem to dial even
3799    though it does not hear a dialtone on the phone line; for example, with
3800    PBXs that have strange dialtones, or with phone systems in different
3801    countries, or with ISDN phones, etc. This is called "blind dialing".
3802
3803    C-Kermit 7.0 has two new commands to cope with this situation:
3804
3805    SET DIAL IGNORE-DIALTONE { ON, OFF }
3806           OFF (the default) means to tell the modem to wait for dialtone
3807           before dialing. ON means to enable "blind dialing", i.e. tell
3808           the modem NOT to wait for dialtone before dialing. Generally
3809           this is accomplished by sending ATX3 to the modem just prior to
3810           dialing. SET MODEM TYPE xxx and then SHOW MODEM displays
3811           Kermit's built-in "ignore dialtone" command.
3812
3813    SET DIAL COMMAND IGNORE-DIALTONE text
3814           This lets you change the built-in ignore-dialtone command (such
3815           as ATX3) to whatever you choose, in case the built-in one does
3816           not work, or another command works better.
3817
3818    Notes:
3819     1. The ignore-dialtone command is not sent unless SET DIAL
3820        IGNORE-DIALTONE is ON.
3821     2. The ATX3 command generally disables not only NO DIALTONE, but also
3822        BUSY. So this will prevent Kermit from detecting when the line is
3823        busy. This is a property of the modem, not of Kermit.
3824
3825 2.1.7. Trimming the Dialing Dialog
3826
3827    The command:
3828
3829   SET MODEM COMMAND action [ command ]
3830
3831    is used to override Kermit's built-in modem commands for each action,
3832    for each kind of modem in its internal database. If you include a
3833    command, this is used instead of the built-in one. If you omit the
3834    command, this restores the original built-in command.
3835
3836    If you want to omit the command altogether, so Kermit doesn't send the
3837    command at all, or wait for a response, use:
3838
3839   SET MODEM COMMAND action {}
3840
3841    That is, specify a pair of empty braces as the command, for example:
3842
3843   SET MODEM COMMAND ERROR-CORRECTION ON {}
3844
3845 2.1.8. Controlling the Dialing Speed
3846
3847    The rate at which characters are sent to the modem during dialing is
3848    normally controlled by the built-in modem database. You might want to
3849    override this if Kermit seems to be dialing too slowly, or it is
3850    sending characters to the modem faster than the modem handle them. A
3851    new command was added for this in C-Kermit 7.0:
3852
3853    SET DIAL PACING number
3854           Specifies the number of milliseconds (thousandths of seconds) to
3855           pause between each character when sending commands to the modem
3856           during DIAL or ANSWER command execution. 0 means no pause at
3857           all, -1 (the default) or any other negative number means to use
3858           the value from the database. Any number greater than 0 is the
3859           number of milliseconds to pause.
3860
3861    HINT: You might also need to control the rate at which the modem
3862    generates Touch Tones during dialing, for example when sending a
3863    numeric page. There are two ways to do this. One way is to insert pause
3864    characters into the dialing string. For modems that use the AT command
3865    set, the pause character is comma (,) and causes a 2-second pause. On
3866    most modems, you can use the S8 register to change the pause interval
3867    caused by comma in the dialing string. The other way is to set your
3868    modem's tone generation interval, if it has a command for that. Most
3869    AT-command-set modems use S11 for this; the value is in milliseconds.
3870    For example on USR modems:
3871
3872   ATS11=200
3873
3874    selects an interval of 200 milliseconds to separate each dialing tone.
3875
3876    Hint: To add S-Register settings or other commands to your dialing
3877    procedure, use the new SET MODEM COMMAND PREDIAL-INIT command
3878    ([396]Section 2.2.2).
3879
3880 2.1.9. Pretesting Phone Number Conversions
3881
3882    The LOOKUP command now accepts telephone numbers as well as
3883    directory-entry names, for example:
3884
3885   LOOKUP +1 (212) 7654321
3886
3887    When given a phone number, LOOKUP prints the result of converting the
3888    phone number for dialing under the current dialing rules. For example,
3889    if my country code is 1 and my area code is 212, and I am dialing out
3890    from a PBX whose outside-line prefix is "93,":
3891
3892   C-Kermit> lookup +1 (212) 7654321
3893   +1 (212) 7654321 => 93,7654321
3894   C-Kermit>
3895
3896    You can also use the \fdialconvert(phone-number) function ([397]Section
3897    2.1.11) to do this programmatically:
3898
3899   C-Kermit> echo "\fdialconvert(+1 (212) 7654321)"
3900   "93,7654321"
3901   C-Kermit>
3902
3903    So the new LOOKUP behaves as follows:
3904
3905    LOOKUP portable-format-phone-number
3906           Displays how the number would actually be dialed Sets FAILURE if
3907           there was a conversion error, otherwise SUCCESS.
3908
3909    LOOKUP literal-format-phone-number
3910           Displays the same literal-format-phone-number Always sets
3911           SUCCESS.
3912
3913    LOOKUP dialing-directory-name
3914           Displays all matching entries and converts portable phone
3915           numbers. Sets SUCCESS if at least one entry was found, otherwise
3916           FAILURE.
3917
3918    LOOKUP =anything
3919           Displays "=anything" and sets SUCCESS.
3920
3921    There is, at present, no programmatic way to fetch numbers from the
3922    dialing directory. This will be considered for a future release.
3923
3924 2.1.10. Greater Control over Partial Dialing
3925
3926    The following rules now apply to partial dialing:
3927
3928      * Phone number transformations based on country and area code,
3929        application of prefixes, etc, are performed only on the first
3930        PDIAL.
3931      * Each PDIAL argument is looked up in the dialing directory, so it is
3932        possible have directory entries for pieces of phone numbers or
3933        other information.
3934      * Suffixes are not applied automatically, since there is no way for
3935        C-Kermit to know in which PDIAL segment you want them to be
3936        applied.
3937
3938    However, the suffix that *would* have been applied, based on the
3939    dialing rules that were invoked when processing the first PDIAL
3940    command, is stored in the variable:
3941
3942   \v(dialsuffix)
3943
3944    which you can include in any subsequent PDIAL or DIAL commands.
3945
3946    Example:
3947
3948   pdial {\m(my_long_distance_pager_number_part_1)}
3949   pdial {\m(my_long_distance_pager_number_part_2)}
3950   pdial {\v(dialsuffix)}
3951   pdial {\m(my_long_distance_pager_number_part_3)}
3952   pdial {@\m(numeric_pager_code)#}
3953
3954 2.1.11. New DIAL-related Variables and Functions
3955
3956    \fdialconvert(s)
3957           s is a phone number in either literal or portable format (not a
3958           dialing directory entry name). The function returns the dial
3959           string that would actually be used by the DIAL command when
3960           dialing from the current location, after processing country
3961           code, area code, and other SET DIAL values, and should be the
3962           same as the result of LOOKUP when given a telephone number.
3963
3964    \v(dialsuffix)
3965           Contains the suffix, if any, that was applied in the most recent
3966           DIAL command, or the suffix that would have been applied in the
3967           most recent PDIAL command. Use this variable to send the dial
3968           suffix at any desired point in a PDIAL sequence.
3969
3970    \v(dialtype)
3971           A number indicating the type of call that was most recently
3972           placed. Can be used after a normal DIAL command, or after the
3973           first PDIAL command in a PDIAL sequence. Values are:
3974
3975   -2: Unknown because TAPI handled the phone number translation.
3976   -1: Unknown because some kind of error occured.
3977    0: Internal within PBX.
3978    1: Toll-free.
3979    2: Local within calling area.
3980    3: Unknown (e.g. because a literal-format phone number was given).
3981    4: Long distance within country.
3982    5: International
3983
3984    \v(dialcount)
3985           The current value of the DIAL retry counter, for use in a DIAL
3986           macro ([398]Section 2.1.13).
3987
3988    \v(d$px)
3989           PBX Exchange (see [399]Section 2.1.12).
3990
3991    Other dial-related variables, already documented in [400]Using C-Kermit
3992    (or other sections of this document, e.g. [401]Section 2.1.1), include
3993    \v(dialnumber), \v(dialstatus), etc. A convenient way to display all of
3994    them is:
3995
3996   show variable dial  ; hint: abbreviate "sho var dial"
3997
3998    This shows the values of all the variables whose names start with
3999    "dial". Also "show variable d$" (to show the \v(d$...) variables).
4000
4001 2.1.12. Increased Flexibility of PBX Dialing
4002
4003    Refer to [402]Using C-Kermit, 2nd Edition, pages 107-108. Recall that
4004    three commands are needed to configure C-Kermit for dialing from a PBX:
4005
4006   SET DIAL PBX-EXCHANGE number
4007   SET DIAL PBX-INSIDE-PREFIX number
4008   SET DIAL PBX-OUTSIDE-PREFIX number
4009
4010    Unfortunately, this model does not accommodate PBXs that have more than
4011    one exchange. For example our PBX at Columbia University (which must
4012    handle more than 10,000 phones) has 853-xxxx and 854-xxxx exchanges.
4013
4014    Beginning in C-Kermit 7.0, the SET DIAL PBX-EXCHANGE command accepts a
4015    list of exchanges, e.g.:
4016
4017   SET DIAL PBX-EXCHANGE 853 854
4018
4019    (multiple exchanges are separated by spaces, not commas).
4020
4021    So now when dialing a portable-format number that has the same country
4022    and area codes as those of your dialing location, C-Kermit compares the
4023    exchange of the dialed number with each number in the PBX Exchange list
4024    (rather than with a single PBX Exchange number, as it did formerly) to
4025    determine whether this is an internal PBX number or an external call.
4026    If it is an external call, then the PBX Outside Prefix is applied, and
4027    then the normal dialing rules for local or long-distance calls.
4028
4029    If it is an inside call, the exchange is replaced by the PBX Inside
4030    Prefix. But if the PBX has more than one exchange, a single fixed PBX
4031    Inside Prefix is probably not sufficient. For example, at Columbia
4032    University, we must dial 3-xxxx for an internal call to 853-xxxx, but
4033    4-xxxx for a call to 854-xxxx. That is, the inside prefix is the final
4034    digit of the exchange we are dialing. For this reason, C-Kermit 7.0
4035    provides a method to determine the inside prefix dynamically at dialing
4036    time, consisting of a new variable and new syntax for the SET DIAL
4037    PBX-INSIDE-PREFIX command:
4038
4039    \v(d$px)
4040           This variable contains the exchange that was matched when a PBX
4041           internal call was detected. For example, if the PBX exchange
4042           list is "853 854" and a call is placed to +1 (212) 854-9999,
4043           \v(d$px) is set to 854.
4044
4045    SET DIAL PBX-INSIDE-PREFIX \fxxx(...)
4046           If the PBX Inside Prefix is defined to be a function, its
4047           evaluation is deferred until dialing time. Normally, this would
4048           be a string function having \v(d$px) as an operand. Of course,
4049           you can still specify a constant string, as before.
4050
4051    So given the following setup:
4052
4053   SET DIAL COUNTRY-CODE 1
4054   SET DIAL AREA-CODE 212
4055   SET DIAL PBX-OUTSIDE-PREFIX 93,
4056   SET DIAL PBX-EXCHANGE 853 854
4057   SET DIAL PBX-INSIDE-PREFIX \fright(\v(d$px),1)
4058
4059    The following numbers give the results indicated:
4060
4061  Number                   Result
4062   +1 (212) 854-9876        4-9876
4063   +1 (212) 853-1234        3-1234
4064   +1 (212) 765-4321        93,765-4321
4065   +1 (333) 765-4321        93,1333765-4321
4066
4067    Furthermore, the K_PBX_XCH environment variable may now be set to a
4068    list of exchanges to automatically initialize C-Kermit's PBX exchange
4069    list, for example (in UNIX ksh or bash):
4070
4071   export K_PBX_XCH="853 854"
4072
4073    (Quotes required because of the space.) Of course, this variable can
4074    also be set to a single exchange, as before:
4075
4076   export K_PBX_XCH=853
4077
4078 2.1.13. The DIAL macro - Last-Minute Phone Number Conversions
4079
4080    After a DIAL or LOOKUP command is given, a list of phone numbers is
4081    assembled from the dialing directory (if any), with all
4082    location-dependent conversion rules applied as described in Chapter 5
4083    of [403]Using C-Kermit.
4084
4085    However, additional conversions might still be required at the last
4086    minute based on local or ephemeral conditions. So that you can have the
4087    final word on the exact format of the dial string, C-Kermit 7.0 lets
4088    you pass the converted string through a macro of your own design for
4089    final processing before dialing. The relevant command is:
4090
4091    SET DIAL MACRO [ name ]
4092           Specifies the name of a macro to be run on each phone number
4093           after all built-in conversions have been applied, just before
4094           the number is dialed. If no name is given, no macro is run. The
4095           phone number, as it would have been dialed if there were no dial
4096           macro, is passed to the macro.
4097
4098    The dial macro can do anything at all (except start a file transfer).
4099    However, the normal use for the macro would be to modify the phone
4100    number. For this reason the phone number is passed to the macro as
4101    argument number 1 (\%1). To cause a modified number to be dialed, the
4102    macro should terminate with a RETURN statement specifying a return
4103    value. To leave the number alone, the macro should simply end. Example:
4104
4105   define xxx return 10108889999$\%1
4106   set dial macro xxx
4107   dial xyzcorp
4108
4109    This defines a DIAL MACRO called xxx, which puts an access code on the
4110    front of the number. Another example might be:
4111
4112   def xxx if equal "\v(modem)" "hayes-1200" return \freplace(\%1,$,{,,,,,})
4113   set dial macro xxx
4114   dial xyzcorp
4115
4116    which replaces any dollar-sign in the dial string by a series of five
4117    commas, e.g. because this particular modem does not support the "wait
4118    for bong" feature (remember that commas that are to be included
4119    literally in function arguments must be enclosed in braces to
4120    distinguish them from the commas that separate the arguments) and when
4121    the IF condition is not satisfied, the macro does not return a value,
4122    and so the number is not modified. Then when a DIAL command is given
4123    referencing a dialing directory entry, "xyzcorp". The macro is
4124    automatically applied to each matching number.
4125
4126    Numerous dial-, modem-, communications-, and time-related variables are
4127    available for decision making your dial macro. Type SHOW VARIABLES for
4128    a list. Of particular interest is the \v(dialcount) variable, which
4129    tells how many times the DIAL command gone through its retry loop: 1 on
4130    the first try, 2 on the second, 3 on the third, and so on, and the
4131    \v(dialresult) and \v(dialstatus) variables.
4132
4133    Here are some other applications for the DIAL MACRO (from users):
4134
4135      * Phone numbers in the dialing directory are formatted with '-' for
4136        readability, but some modems don't like the hyphens, so the DIAL
4137        macro is used to remove them before dialing; e.g 0090-123-456-78-99
4138        becomes 00901234567899: "def xxx return \freplace(\%1,-)".
4139      * To set some specific modem (or other) options depending on the
4140        called customer or telephone number.
4141      * Choosing the most appropriate provider based on (e.g.) time of day,
4142        or cycling through a list of providers in case some providers might
4143        be busy.
4144
4145    To illustrate the final item, suppose you have a choice among many
4146    phone service providers; the provider is chosen by dialing an access
4147    code before the number. Different providers might be better (e.g.
4148    cheaper) for certain times of day or days of the week, or for dialing
4149    certain locations; you can use the DIAL macro to add the access for the
4150    most desirable provider.
4151
4152    Similarly, when the same number might be reached through multiple
4153    providers, it's possible that one provider might not be able to
4154    complete the call, but another one can. In that case, you can use the
4155    DIAL macro to switch providers each time through the DIAL loop --
4156    that's where the \v(dialcount) variable comes in handy.
4157
4158    The following command can be used to debug the DIAL macro:
4159
4160    SET DIAL TEST { ON, OFF }
4161           Normally OFF, so the DIAL command actually dials. When ON, the
4162           DIAL command performs all lookups and number conversions, and
4163           then goes through the number list and retry loop, but instead of
4164           actually dialing, lists the numbers it would have called if none
4165           of the DIAL attempts succeeded (or more precisely, every number
4166           was always busy).
4167
4168 2.1.14. Automatic Tone/Pulse Dialing Selection
4169
4170    SET DIAL METHOD { AUTO, DEFAULT, PULSE, TONE }
4171           Chooses the dialing method for subsequent calls.
4172
4173    Prior to version 7.0, C-Kermit's DIAL METHOD was DEFAULT by default,
4174    meaning it does not specify a dialing method to the modem, but relies
4175    on the modem to have an appropriate default dialing method set. So, for
4176    example, when using Hayes compatible modems, the dial string would be
4177    something like ATD7654321, rather than ATDT7654321 or ATDP7654321.
4178
4179    In C-Kermit 7.0 and K95 1.1.19, the dial method can be set from the
4180    environment variable:
4181
4182   K_DIAL_METHOD
4183
4184    when Kermit starts. The values can be TONE, PULSE, or DEFAULT, e.g.
4185    (UNIX):
4186
4187   set K_DIAL_METHOD=TONE; export K_DIAL_METHOD
4188
4189    In the absence of a K_DIAL_METHOD definition, the new default SET DIAL
4190    METHOD is AUTO rather than DEFAULT. When DIAL METHOD is AUTO and the
4191    local country code is known, then if tone dialing is universally
4192    available in the corresponding area, tone dialing is used; if dialing
4193    from a location where pulse dialing is mandatory, pulse dialing is
4194    used.
4195
4196    The "tone country" and "pulse country" lists are preloaded according to
4197    our knowledge at the time of release. You can see their contents in the
4198    SHOW DIAL listing. You can change the lists with:
4199
4200    SET DIAL TONE-COUNTRIES [ cc [ cc [ ... ] ] ]
4201           Replaces the current TONE-COUNTRIES list with the one given.
4202           Each cc is a country code; separate them with spaces (not
4203           commas). Example:
4204
4205   set dial tone-countries 1 358 44 46 49
4206
4207           If no country codes are given, the current list, if any, is
4208           removed, in which case SET DIAL METHOD AUTO is equivalent to SET
4209           DIAL METHOD DEFAULT.
4210
4211    SET DIAL PULSE-COUNTRIES [ cc [ cc [ ... ] ] ]
4212           Replaces the current PULSE-COUNTRIES list with the one give.
4213           Syntax and operation is like SET DIAL TONE-COUNTRIES.
4214
4215    If the same country code appears in both lists, Pulse takes precedence.
4216
4217    The SET DIAL TONE- and PULSE-COUNTRIES commands perform no verification
4218    whatsoever on the cc's, since almost any syntax might be legal in some
4219    settings. Furthermore, there is no facility to edit the lists; you can
4220    only replace the whole list. However, since the only purpose of these
4221    lists is to establish a basis for picking tone or pulse dialing
4222    automatically, all you need to override the effect of the list is to
4223    set a specific dialing method with SET DIAL METHOD TONE or SET DIAL
4224    METHOD PULSE.
4225
4226 2.1.15. Dial-Modifier Variables
4227
4228    As of C-Kermit 7.0, dial modifiers are available in the following
4229    variables:
4230
4231  \v(dm_lp) Long pause
4232  \v(dm_sp) Short pause
4233  \v(dm_pd) Pulse dial
4234  \v(dm_td) Tone dial
4235  \v(dm_wa) Wait for answer
4236  \v(dm_wd) Wait for dialtone
4237  \v(dm_rc) Return to command mode
4238
4239    You can use these in your dial strings in place of hardwired modifiers
4240    like "@", ",", etc, for increased portability of scripts. Example:
4241
4242   C-Kermit>set modem type usrobotics
4243   C-Kermit>sho variables dm
4244    \v(dm_lp) = ,
4245    \v(dm_sp) = /
4246    \v(dm_pd) = P
4247    \v(dm_td) = T
4248    \v(dm_wa) = @
4249    \v(dm_wd) = W
4250    \v(dm_rc) = ;
4251   C-Kermit>exit
4252
4253 2.1.16. Giving Multiple Numbers to the DIAL Command
4254
4255    Prior to C-Kermit 7.0, the only way to give a DIAL command a list of
4256    phone numbers to try until one answers was to create a dialing
4257    directory that had multiple entries under the same name, and then use
4258    that entry name in the DIAL command. Now a list of numbers can be given
4259    to the DIAL command directly in the following format:
4260
4261   dial {{number1}{number2}{number3}...}
4262
4263    This is the same list format used by SEND /EXCEPT: and other commands
4264    that allow a list where normally a single item is given. Restrictions
4265    on this form of the DIAL command are:
4266
4267      * The first two braces must be adjacent; spacing is optional
4268        thereafter.
4269      * Each number must be an actual number to dial, not a dialing
4270        directory entry.
4271      * Dialing directory entries may not contain number lists in this
4272        format.
4273
4274    In all other respects, the numbers are treated as if they had been
4275    fetched from the dialing directory; they can be in literal or portable
4276    format, etc. Example:
4277
4278   dial {{7654321} {+1 (212) 5551212} { 1-212-5556789 }}
4279
4280    The list can be any length at all, within reason.
4281
4282    This feature is especially handy for use with the K95 Dialer, allowing
4283    a list of phone numbers to be specified in the Telephone Number box
4284    without having to set up or reference a separate dialing directory.
4285
4286    You can also use it to add commonly-dialed sequences as variables in
4287    your C-Kermit customization file, e.g.:
4288
4289   define work {{7654321}{7654322}{7654323}}
4290
4291    and then:
4292
4293   dial {\m(work)}
4294
4295    (the variable name must be enclosed in braces).
4296
4297    Or more simply:
4298
4299   define work dial {{7654321}{7654322}{7654323}}
4300
4301    and then:
4302
4303   work
4304
4305 2.2. Modems
4306
4307 2.2.1. New Modem Types
4308
4309    Since C-Kermit 6.0:
4310
4311   atlas-newcom-33600ifxC Atlas/Newcom 33600
4312   att-keepintouch        AT&T KeepinTouch PCMCIA V.32bis Card Modem
4313   att-1900-stu-iii       AT&T Secure Data STU-III Model 1900
4314   att-1910-stu-iii       AT&T Secure Data STU-III Model 1910
4315   bestdata               Best Data
4316   cardinal               Cardinal V.34 MVP288X series.
4317   compaq                 Compaq Data+Fax (e.g. in Presario)
4318   fujitsu                Fujitsu Fax/Modem Adapter
4319   generic-high-speed     Any modern error-correcting data-compressing modem
4320   itu-t-v25ter/v250      ITU-T (CCITT) V.25ter (V.250) standard command set
4321   megahertz-att-v34      Megahertz AT&T V.34
4322   megahertz-xjack        Megahertz X-Jack
4323   motorola-codex         Motorola Codex 326X Series
4324   motorola-montana       Motorola Montana
4325   mt5634zpx              Multitech MT5634ZPX
4326   rockwell-v90           Rockwell V.90 56K
4327   rolm-244pc             Siemens/Rolm 244PC (AT command set)
4328   rolm-600-series        Siemens/Rolm 600 Series (AT command set)
4329   spirit-ii              QuickComm Spirit II
4330   suprasonic             SupraSonic V288+
4331   supra-express-v90      Supra Express V.90
4332
4333    One of the new types, "generic-high-speed" needs a bit of explanation.
4334    This type was added to easily handle other types that are not
4335    explicitly covered, without going through the bother of adding a
4336    complete user-defined modem type. This one works for modern modems that
4337    use the AT command set, on the assumption that all the default
4338    ("factory") settings of the modem (a) are appropriate for Kermit, (b)
4339    include error correction, data compression, and speed buffering; and
4340    (c) are recallable with the command AT&F.
4341
4342    If the command to recall your modem's profile is not AT&F, use the SET
4343    MODEM COMMAND INIT-STRING command to specify the appropriate modem
4344    command. The default init-string is AT&F\13 (that is, AT, ampersand, F,
4345    and then carriage return); a survey of about 20 modern modem types
4346    shows they all support this, but they might mean different things by
4347    it. For example, the USR Sportster or Courier needs AT&F1 (not AT&F,
4348    which is equivalent to AT&F0, which recalls an inappropriate profile),
4349    so for USR modems:
4350
4351   set modem type generic-high-speed
4352   set modem command init AT&F1\13
4353
4354    Of course, USR modems already have their own built-in modem type. But
4355    if you use this one instead, it will dial faster because it has fewer
4356    commands to give to the modem; in that sense "&F1" is like a macro that
4357    bundles numerous commands into a single one. See your modem manual for
4358    details about factory profiles and commands to recall them.
4359
4360    WARNING: Do not use the generic-high-speed modem type in operating
4361    systems like VMS where hardware flow control is not available, at least
4362    not unless you change the init string from AT&F\13 to something else
4363    that enables local Xon/Xoff or other appropriate type of flow control.
4364
4365    Also see [404]Section 2.1.7 for additional hints about making dialing
4366    go faster.
4367
4368 2.2.2. New Modem Controls
4369
4370    SET MODEM CAPABILITIES list
4371           In C-Kermit 7.0, this command automatically turns MODEM
4372           SPEED-MATCHING OFF if SB (Speed Buffering) is in the list, and
4373           turns it ON if SB is absent.
4374
4375    SET MODEM COMMAND PREDIAL-INIT [ text ]
4376           Commands to be sent to the modem just prior to dialing. Normally
4377           none.
4378
4379    SET MODEM SPEAKER { ON, OFF }
4380           Determines whether modem speaker is on or off while call is
4381           being placed. ON by default. Note: This command does not provide
4382           fine-grained control over when the speaker is on or off.
4383           Normally, ON means while the call is being placed, until the
4384           point at which carrier is successfully established. If your
4385           modem has a different speaker option that you want to choose,
4386           then use the SET MODEM COMMAND SPEAKER ON text command to
4387           specify this option.
4388
4389    SET MODEM COMMAND SPEAKER { ON, OFF } [ text ]
4390           Specify or override the commands to turn your modem's speaker on
4391           and off.
4392
4393    SET MODEM VOLUME { LOW, MEDIUM, HIGH }
4394           When MODEM SPEAKER is on, select volume. Note: In some modems,
4395           especially internal ones, these commands have no effect; this is
4396           a limitation of the particular modem, not of Kermit.
4397
4398    SET MODEM COMMAND VOLUME { LOW, MEDIUM, HIGH } [ text ]
4399           Specify or override the commands to set your modem's speaker
4400           volume.
4401
4402    SET MODEM COMMAND IGNORE-DIALTONE [ text ]
4403           The command to enable blind dialing ([405]Section 2.1.6).
4404
4405    SET MODEM ESCAPE-CHARACTER code
4406           Has been augmented to allow codes of 0 or less: < 0 means the
4407           escape mechanism is disabled. = 0 means to use (restore) the
4408           default value from the modem database. > 0 and < 128 is a
4409           literal value to be used instead of the default one. > 127 means
4410           the escape mechanism is disabled. This affects "modem hangup".
4411           When the escape mechanism is disabled, but SET MODEM
4412           HANGUP-METHOD is MODEM-COMMAND, it sends the hangup command
4413           immediately, without the <pause>+++<pause> business first. This
4414           is useful (for example) when sending lots of numeric pages, a
4415           process in which never we go online, and so never need to escape
4416           back. Eliminating the unnecessary pauses and escape sequence
4417           allows a lot more pages to be sent per unit time.
4418
4419    Recall that C-Kermit can dial modems to which it is connected via
4420    TCP/IP (Telnet or Rlogin) as described on page 126 of [406]Using
4421    C-Kermit, 2nd Ed. In this case the MODEM HANGUP-METHOD should be
4422    MODEM-COMMAND, since RS-232 signals don't work over TCP/IP connections.
4423    As noted in the manual, such connections are set up by the following
4424    sequence:
4425
4426   set host host [ port ]
4427   set modem type name
4428   dial number
4429
4430    But this can cause complications when you use Kermit to switch between
4431    serial and TCP/IP connections. In the following sequence:
4432
4433   set host name
4434   set modem type name
4435   set port name
4436
4437    the first two commands obey the rules for dialing out over Telnet.
4438    However, the SET PORT command requires that Kermit close its current
4439    (Telnet) connection before it can open the serial port (since Kermit
4440    can only have one connection open at a time). But since a modem type
4441    was set after the "set host" command was given, Kermit assumes it is a
4442    Telnet dialout connection and so sends the modem's hangup sequence is
4443    sent to the Telnet host. To avoid this, close the network connection
4444    explicitly before opening the serial one:
4445
4446   set host name
4447   close
4448   set modem type name
4449   set port name
4450
4451 2.3. TELNET and RLOGIN
4452
4453    For additional background, please also read the [407]TELNET.TXT file,
4454    also available on the Web in [408]HTML format.
4455
4456    Cautions:
4457
4458      * If making a Telnet connection with C-Kermit takes a very long time,
4459        like over a minute, whereas the system Telnet program makes the
4460        same connection immediately, try including the /NOWAIT switch:
4461   C-Kermit> telnet /nowait hostname
4462
4463        See [409]TELNET.TXT or [410]TELNET.HTM for details. If it also
4464        takes a very long time to make a Telnet connection with system
4465        Telnet, then the delay is most likely caused by reverse DNS lookups
4466        when your host is not properly registered in DNS.
4467      * When supplying numeric IP addresses to C-Kermit or to any other
4468        application (regular Telnet, Rlogin, etc), do not include leading
4469        0's in any fields unless you intend for those fields to be
4470        interpreted as octal (or hex) numbers. The description of the
4471        Internet address interpreter (the sockets library inet_addr()
4472        routine) includes these words:
4473
4474      All numbers supplied as "parts" in a "." notation may be decimal,
4475      octal, or hexadecimal, as specified in the C language (that is, a
4476      leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies
4477      octal; otherwise, the number is interpreted as decimal).
4478        To illustrate, 128.59.39.2 and 128.059.039.002 are not the same
4479        host! Even though most of the fields contain non-octal digits.
4480        Using system Telnet (not Kermit):
4481   $ telnet 128.059.039.002
4482   Trying 128.49.33.2 ...
4483
4484        Of course the same thing happens with Kermit because it uses (as it
4485        must) the same system service for resolving network addresses that
4486        Telnet, FTP, and all other TCP/IP applications use.
4487      * The RLOGIN section on page 123 does not make it clear that you can
4488        use the SET TELNET TERMINAL-TYPE command to govern the terminal
4489        type that is reported by C-Kermit to the RLOGIN server.
4490      * Note that the SET TCP commands described on pages 122-123 might be
4491        absent; some platforms that support TCP/IP do not support these
4492        particular controls.
4493
4494    New commands:
4495
4496    TELOPT { AO, AYT, BREAK, CANCEL, EC, EL, EOF, EOR, GA, IP, DMARK,
4497           DO, DONT, NOP, SB, SE, SUSP, WILL, WONT }
4498           This command was available previously, but supported only DO,
4499           DONT, WILL, and WONT. Now it lets you send all the Telnet
4500           protocol commands. Note that certain commands do not require a
4501           response, and therefore can be used as nondestructive "probes"
4502           to see if the Telnet session is still open; e.g.:
4503
4504   set host xyzcorp.com
4505   ...
4506   telopt nop
4507   if fail stop 1 Connection lost
4508
4509    SET TCP ADDRESS [ ip-address ]
4510           Specifies the IP address of the computer that C-Kermit is
4511           running on. Normally this is not necessary. The exception would
4512           be if your machine has multiple network adapters (physical or
4513           virtual) with a different address for each adapter AND you want
4514           C-Kermit to use a specific address when making outgoing
4515           connections or accepting incoming connections.
4516
4517    SET TCP DNS-SERVICE-RECORDS { ON, OFF }
4518           Tells C-Kermit whether to try to use DNS SRV records to
4519           determine the host and port number upon which to find an
4520           advertised service. For example, if a host wants regular Telnet
4521           connections redirected to some port other than 23, this feature
4522           allows C-Kermit to ask the host which port it should use. Since
4523           not all domain servers are set up to answer such requests, this
4524           feature is OFF by default.
4525
4526    SET TCP REVERSE-DNS-LOOKUP { ON, OFF, AUTO }
4527           Tells Kermit whether to perform a reverse DNS lookup on TCP/IP
4528           connections. This allows Kermit to determine the actual hostname
4529           of the host it is connected to, which is useful for connections
4530           to host pools, and is required for Kerberos connections to host
4531           pools and for incoming connections. If the other host does not
4532           have a DNS entry, the reverse lookup could take a long time
4533           (minutes) to fail, but the connection will still be made. Turn
4534           this option OFF for speedier connections if you do not need to
4535           know exactly which host you are connected to and you are not
4536           using Kerberos. AUTO, the default, means the lookup is done on
4537           hostnames, but not on numeric IP addresses.
4538
4539    SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF }
4540           Each Telnet option must be fully negotiated either On or Off
4541           before the session can continue. This is especially true with
4542           options that require sub-negotiations such as Authentication,
4543           Encryption, and Kermit; for proper support of these options
4544           Kermit must wait for the negotiations to complete. Of course,
4545           Kermit has no way of knowing whether a reply is delayed or not
4546           coming at all, and so will wait a minute or more for required
4547           replies before continuing the session. If you know that Kermit's
4548           Telnet partner will not be sending the required replies, you can
4549           set this option of OFF to avoid the long timeouts. Or you can
4550           instruct Kermit to REFUSE specific options with the SET TELOPT
4551           command.
4552
4553    SET TELOPT [ { /CLIENT, /SERVER } ] option
4554           { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
4555           [ { ACCEPTED, REFUSED, REQUESTED, REQUIRED } ]
4556           SET TELOPT lets you specify policy requirements for Kermit's
4557           handling of Telnet option negotiations. Setting an option is
4558           REQUIRED causes Kermit to offer the option to the peer and
4559           disconnect if the option is refused. REQUESTED causes Kermit to
4560           offer an option to the peer. ACCEPTED results in no offer but
4561           Kermit will attempt to negotiate the option if it is requested.
4562           REFUSED instructs Kermit to refuse the option if it is requested
4563           by the peer.
4564
4565           Some options are negotiated in two directions and accept
4566           separate policies for each direction; the first keyword applies
4567           to Kermit itself, the second applies to Kermit's Telnet partner;
4568           if the second keyword is omitted, an appropriate
4569           (option-specific) default is applied. You can also include a
4570           /CLIENT or /SERVER switch to indicate whether the given policies
4571           apply when Kermit is the Telnet client or the Telnet server; if
4572           no switch is given, the command applies to the client.
4573
4574           Note that some of Kermit's Telnet partners fail to refuse
4575           options that they do not recognize and instead do not respond at
4576           all. In this case it is possible to use SET TELOPT to instruct
4577           Kermit to REFUSE the option before connecting to the problem
4578           host, thus skipping the problematic negotiation.
4579
4580           Use SHOW TELOPT to view current Telnet Option negotiation
4581           settings. SHOW TELNET displays current Telnet settings.
4582
4583 2.3.0. Bug Fixes
4584
4585    If "set host nonexistent-host" was given (and it properly failed),
4586    followed by certain commands like SEND, the original line and modem
4587    type were not restored and C-Kermit thought that it still had a network
4588    hostname; fixed in 7.0.
4589
4590 2.3.1. Telnet Binary Mode Bug Adjustments
4591
4592    SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF } was added to edit 192
4593    after the book was printed. Also SET TELNET BUG BINARY-U-MEANS-ME-TOO.
4594    The default for both is OFF. ON should be used when communicating with
4595    a Telnet partner (client or server) that mistakenly believes that
4596    telling C-Kermit to enter Telnet binary mode also means that it, too,
4597    is in binary mode, contrary to the Telnet specification, which says
4598    that binary mode must be negotiated in each direction separately.
4599
4600 2.3.2. VMS UCX Telnet Port Bug Adjustment
4601
4602    A new command, SET TCP UCX-PORT-BUG, was added for VMS versions with
4603    UCX (DEC TCP/IP), applying only to early versions of UCX, like 2.2 or
4604    earlier. If you try to use VMS C-Kermit to make a Telnet connection
4605    using a port name (like "telnet", which is used by default), the
4606    underlying UCX getservbyname() function might return the service number
4607    with its bytes swapped and the connection will fail. If "telnet
4608    hostname 23" works, then your version of UCX has this bug and you can
4609    put "set tcp ucx-port-bug on" in your CKERMIT.INI file to get around
4610    it.
4611
4612 2.3.3. Telnet New Environment Option
4613
4614    The TELNET NEW-ENVIRONMENT option ([411]RFC 1572) is supported as 7.0.
4615    This option allows the C-Kermit Telnet client to send certain
4616    well-known variables to the Telnet server, including USER, PRINTER,
4617    DISPLAY, and several others. This feature is enabled by default in
4618    Windows and OS/2, disabled by default elsewhere. The command to enable
4619    and disable it is:
4620
4621   SET TELNET ENVIRONMENT { ON, OFF }
4622
4623    When ON, and you Telnet to another computer, you might (or might not)
4624    notice that the "login:" or "Username:" prompt does not appear --
4625    that's because your username was sent ahead, in which case the remote
4626    system might prompt you only for your password (similar to Rlogin). Use
4627    "set telnet environment off" to defeat this feature, particularly in
4628    scripts where the dialog must be predictable. You can also use this
4629    command to specify or override specific well-known environment variable
4630    values:
4631
4632  SET TELNET ENVIRONMENT { ACCT,DISPLAY,JOB,PRINTER,SYSTEMTYPE,USER } [ text ]
4633
4634 2.3.4. Telnet Location Option
4635
4636    The TELNET LOCATION option ([412]RFC 779) is supported in 7.0. This
4637    option allows the C-Kermit Telnet client to send a location string to
4638    the server if the server indicates its willingness to accept one. If an
4639    environment variable named LOCATION exists at the time C-Kermit starts,
4640    its value is used as the location string. If you want to change it,
4641    use:
4642
4643   SET TELNET LOCATION text
4644
4645    If you omit the text from this command, the Telnet location feature is
4646    disabled.
4647
4648    SET TELNET ENVIRONMENT DISPLAY is used to set the DISPLAY variable that
4649    is sent to the host, as well as the the XDISPLAY location.
4650
4651 2.3.5. Connecting to Raw TCP Sockets
4652
4653    The SET HOST and TELNET commands now accept an optional switch,
4654    /RAW-SOCKET, at the end, only if you first give a host and a port.
4655    Example:
4656
4657   set host xyzcorp.com 23 /raw-socket
4658   set host 128.49.39.2:2000 /raw-socket
4659   telnet xyzcorp.com 3000 /raw
4660
4661    Without this switch, C-Kermit behaves as a Telnet client when (a) the
4662    port is 23 or 1649, or (b) the port is not 513 and the server sent what
4663    appeared to be Telnet negotiations -- that is, messages starting with
4664    0xFF (IAC). With this switch, Kermit should treat all incoming bytes as
4665    raw data, and will not engage in any Telnet negotiations or NVT CRLF
4666    manipulations. This allows transparent operation through (e.g.) raw TCP
4667    ports on Cisco terminal servers, through the 'modemd' modem server,
4668    etc.
4669
4670 2.3.6. Incoming TCP Connections
4671
4672    Accomplished via SET HOST * port, were introduced in C-Kermit 6.0, but
4673    for UNIX only. In Version 7.0, they are also available for VMS.
4674
4675 2.4. The EIGHTBIT Command
4676
4677    EIGHTBIT is simply a shorthand for: SET PARITY NONE, SET TERMINAL
4678    BYTESIZE 8, SET COMMAND BYTESIZE 8; that is, a way to set up an 8-bit
4679    clean connection in a single command.
4680
4681 2.5. The Services Directory
4682
4683    Chapter 7 of [413]Using C-Kermit does not mention the ULOGIN macro,
4684    which is used by our sample services directory, CKERMIT.KND. Unlike
4685    UNIXLOGIN, VMSLOGIN, etc, this one is for use with systems that require
4686    a user ID but no password. Therefore it doesn't prompt for a password
4687    or wait for a password prompt from the remote service.
4688
4689    In version 7.0, the CALL macro was changed to not execute a SET MODEM
4690    TYPE command if the given modem type was the same as the current one;
4691    otherwise the new SET MODEM TYPE command would overwrite any
4692    customizations that the user had made to the modem settings. Ditto for
4693    SET LINE / SET PORT and SET SPEED.
4694
4695 2.6. Closing Connections
4696
4697    Until version 7.0, there was never an obvious and general way to close
4698    a connection. If a serial connection was open, it could be closed by
4699    "set line" or "set port" (giving no device name); if a network
4700    connection was open, it could be closed by "set host" (no host name).
4701
4702    In version 7.0, a new command closes the connection in an obvious and
4703    straightforward way, no matter what the connection type:
4704
4705   CLOSE [ CONNECTION ]
4706
4707    The CLOSE command was already present, and required an operand such as
4708    DEBUG-LOG, WRITE-FILE, etc, and so could never be given by itself. The
4709    new CONNECTION operand is now the default operand for CLOSE, so CLOSE
4710    by itself closes the connection, if one is open, just as you would
4711    expect, especially if you are a Telnet or Ftp user.
4712
4713    Also see the description of the new SET CLOSE-ON-DISCONNECT command in
4714    [414]Section 2.10.
4715
4716 2.7. Using C-Kermit with External Communication Programs
4717
4718    C-Kermit 7.0 includes a new ability to create and conduct sessions
4719    through other communications programs. Two methods are available:
4720
4721     1. Pty (pseudoterminal): The external program is run on a
4722        "pseudoterminal", which is controlled by Kermit. This method works
4723        with practically any external program, but it is not portable. At
4724        this writing, it works only on some (not all) UNIX versions, and
4725        not on any non-UNIX platforms.
4726     2. Pipe: The external program's standard input and output are
4727        redirected through a "pipe" controlled by Kermit. This method is
4728        relatively portable -- it should work across all UNIX versions, and
4729        it also works in Windows and OS/2 -- but it is effective only when
4730        the external program actually uses standard i/o (and many don't).
4731
4732    The two methods are started differently but are used the same way
4733    thereafter.
4734
4735    The purpose of this feature is to let you use C-Kermit services like
4736    file transfer, character-set translation, scripting, automatic dialing,
4737    etc, on connections that Kermit can't otherwise make itself.
4738
4739    This feature is the opposite of the REDIRECT feature, in which C-Kermit
4740    makes the connection, and redirects an external (local) command or
4741    program over this connection. In a pty or pipe connection, C-Kermit
4742    runs and controls a local command or program, which makes the
4743    connection. (The same method can be used to simply to control a local
4744    program without making a connection; see [415]Section 2.8.)
4745
4746    To find out if your version of Kermit includes PTY support, type "show
4747    features" and look for NETPTY in the alphabetical list of options. For
4748    pipes, look for NETCMD.
4749
4750    The commands are:
4751
4752    SET NETWORK TYPE PTY or SET NETWORK TYPE PIPE
4753    SET HOST command
4754           where command is any interactive command. If the command does
4755           not use standard i/o, you must use SET NETWORK TYPE PTY.
4756
4757    Notes:
4758
4759      * COMMAND is an invisible synonym for PIPE.
4760      * The command and its arguments are case-sensitive in UNIX.
4761
4762    The SET NETWORK TYPE, SET HOST sequence sets the given network type for
4763    all subsequent SET HOST commands until another SET NETWORK TYPE command
4764    is given to change it.
4765
4766    You can also use the new /NETWORK-TYPE:PTY or /NETWORK-TYPE:PIPE (or
4767    simply /PIPE or /PTY) switches on the SET HOST command itself:
4768
4769   SET HOST /NETWORK-TYPE:PIPE command  ; These two are the same
4770   SET HOST /PIPE command
4771
4772   SET HOST /NETWORK-TYPE:PTY command   ; Ditto
4773   SET HOST /PTY command
4774
4775    These are like SET NETWORK TYPE followed by SET HOST, except they apply
4776    only to the connection being made and do not change the global network
4777    type setting (see [416]Section 1.5 about the difference between
4778    switches and SET commands).
4779
4780    Include any command-line options with the command that might be needed,
4781    as in this example where C-Kermit uses another copy of itself as the
4782    communications program:
4783
4784   SET HOST /PIPE /CONNECT kermit -YQJ xyzcorp.com
4785
4786      IMPORTANT: In Unix, wildcards and redirectors are interpreted by the
4787      shell. If you want to run a program with (say) SET HOST /PTY with
4788      its i/o redirected or with wildcard file arguments, you will need to
4789      invoke the shell too. Example:
4790
4791 SET HOST /PTY {sh -c "crypt < foo.x"}
4792 SET HOST /PTY {sh -c "grep somestring *.txt"}
4793
4794    As usual, if you include the /CONNECT switch, SET HOST enters CONNECT
4795    mode immediately upon successful execution of the given command.
4796    Therefore new commands are available as a shorthand for SET HOST
4797    /CONNECT /PTY and /PIPE:
4798
4799    PTY [ command ]
4800    PIPE [ command ]
4801           The PTY and PIPE commands work like the TELNET and RLOGIN
4802           commands: they set up the connection (in this case, using the
4803           given command) and then enter CONNECT mode automatically (if the
4804           PIPE or PTY command is given without a command, it continues the
4805           current session if one is active; otherwise it gives an error
4806           message).
4807
4808    The PIPE command is named after the mechanism by which C-Kermit
4809    communicates with the command: UNIX pipes. C-Kermit's i/o is "piped"
4810    through the given command. Here is a typical example:
4811
4812   PIPE rlogin -8 xyzcorp.com
4813
4814    This is equivalent to:
4815
4816   SET HOST /PIPE rlogin -8 xyzcorp.com
4817   CONNECT
4818
4819    and to:
4820
4821   SET HOST /PIPE /CONNECT rlogin -8 xyzcorp.com
4822
4823    IMPORTANT:
4824           If you are writing a script, do not use the PIPE, PTY, TELNET,
4825           or RLOGIN command unless you really want C-Kermit to enter
4826           CONNECT mode at that point. Normally SET HOST is used in scripts
4827           to allow the login and other dialogs to be controlled by the
4828           script itself, rather than by an actively participating human at
4829           the keyboard.
4830
4831    Throughput of pty and pipe connections is limited by the performance of
4832    the chosen command or program and by the interprocess communication
4833    (IPC) method used and/or buffering capacity of the pipe or pty, which
4834    in turn depends on the underlying operating system.
4835
4836    In one trial (on SunOS 4.1.3), we observed file transfer rates over an
4837    rlogin connection proceeding at 200Kcps for downloads, but only 10Kcps
4838    for uploads on the same connection with the same settings (similar
4839    disparities were noted in HP-UX). Examination of the logs revealed that
4840    a write to the pipe could take as long as 5 seconds, whereas reads were
4841    practically instantaneous. On the other hand, using Telnet as the
4842    external program rather than rlogin, downloads and uploads were better
4843    matched at about 177K each.
4844
4845    Most external communication programs, like C-Kermit itself, have escape
4846    characters or sequences. Normally these begin with (or consist entirely
4847    of) a control character. You must be sure that this control character
4848    is not "unprefixed" when uploading files, otherwise the external
4849    program will "escape back" to its prompt, or close the connection, or
4850    take some other unwanted action. When in CONNECT mode, observe the
4851    program's normal interaction rules. Of course C-Kermit's own escape
4852    character (normally Ctrl-\) is active too, unless you have taken some
4853    action to disable it.
4854
4855    On PTY connections, the underlying PTY driver is not guaranteed to be
4856    transparent to control characters -- for example, it might expand tabs,
4857    translate carriage returns, generate signals if it sees an interrupt
4858    character, and so on. Similar things might happen on a PIPE connection.
4859    For this reason, if you plan to transfer files over a PTY or PIPE
4860    connection, tell the file sender to:
4861
4862    SET PREFIXING ALL
4863           This causes all control characters to be prefixed and
4864           transmitted as printable ASCII characters.
4865
4866    If the external connection program is not 8-bit clean, you should also:
4867
4868    SET PARITY SPACE
4869           This causes 8-bit data to be encoded in 7 bits using single
4870           and/or locking shifts.
4871
4872    And if it does not make a reliable connection (such as those made by
4873    Telnet, Rlogin, Ssh, etc), you should:
4874
4875    SET STREAMING OFF
4876           This forces C-Kermit to treat the connection as unreliable and
4877           to engage in its normal ACK/NAK protocol for error detection and
4878           correction, rather than "streaming" its packets, as it normally
4879           does on a network connection ([417]Section 4.20).
4880
4881    In some cases, buffer sizes might be restricted, so you might also need
4882    to reduce the Kermit packet length to fit; this is a trial-and-error
4883    affair. For example, if transfers always fail with 4000-byte packets,
4884    try 2000. If that fails too, try 1000, and so on. The commands are:
4885
4886    SET RECEIVE PACKET-LENGTH number
4887           This tells the file receiver to tell the file sender the longest
4888           packet length it can accept.
4889
4890    SET SEND PACKET-LENGTH number
4891           This tells the file sender not to send packets longer than the
4892           given length, even if the receiver says longer ones are OK. Of
4893           course, if the receiver's length is shorter, the shorter length
4894           is used.
4895
4896    If none of this seems to help, try falling back to the bare minimum,
4897    lowest-common-denominator protocol settings:
4898
4899    ROBUST
4900           No sliding windows, no streaming, no control-character
4901           unprefixing, packet length 90.
4902
4903    And then work your way back up by trial and error to get greater
4904    throughput.
4905
4906    Note that when starting a PIPE connection, and the connection program
4907    (such as telnet or rlogin) prints some greeting or information messages
4908    before starting the connection, these are quite likely to be printed
4909    with a stairstep effect (linefeed without carriage return). This is
4910    because the program is not connected with the UNIX terminal driver;
4911    there's not much Kermit can do about it. Once the connection is made,
4912    everything should go back to normal. This shouldn't happen on a PTY
4913    connection because a PTY is, indeed, a terminal.
4914
4915    On a similar note, some connection programs (like Solaris 2.5 rlogin)
4916    might print lots of error messages like "ioctl TIOCGETP: invalid
4917    argument" when used through a pipe. They are annoying but usually
4918    harmless. If you want to avoid these messages, and your shell allows
4919    redirection of stderr, you can redirect stderr in your pipe command, as
4920    in this example where the user's shell is bash:
4921
4922   PIPE rlogin xyzcorp.com 2> /dev/null
4923
4924    Or use PTY rather than PIPE, since PTY is available on Solaris.
4925
4926 2.7.0. C-Kermit over tn3270 and tn5250
4927
4928    Now you can make a connection from C-Kermit "directly" to an IBM
4929    mainframe and transfer files with it, assuming it has Kermit-370
4930    installed. Because tn3270 is neither 8-bit clean nor transparent to
4931    control characters, you must give these commands:
4932
4933   SET PREFIXING ALL   ; Prefix all control characters
4934   SET PARITY SPACE    ; Telnet connections are usually not 8-bit clean
4935
4936    and then:
4937
4938   SET HOST /PTY /CONNECT tn3270 abccorp.com
4939
4940    or simply:
4941
4942   pty tn3270 abccorp.com
4943
4944    SET HOST /PIPE does not work in this case, at least not for file
4945    transfer. File transfer does work, however, with SET HOST /PTY,
4946    provided you use the default packet length of 90 bytes; anything longer
4947    seems to kill the session.
4948
4949    You can also make connections to IBM AS/400 computers if you have a
4950    tn5250 program installed:
4951
4952   pty tn5250 hostname
4953
4954    In this case, however, file transfer is probably not in the cards since
4955    nobody has ever succeeded in writing a Kermit program for the AS/400.
4956    Hint:
4957
4958   define tn3270 {
4959       check pty
4960       if fail end 1 Sorry - no PTY support...
4961       pty tn3270 \%*
4962   }
4963
4964    Similarly for tn5250. Note that CHECK PTY and CHECK PIPE can be used in
4965    macros and scripts to test whether PTY or PIPE support is available.
4966
4967 2.7.1. C-Kermit over Telnet
4968
4969    Although C-Kermit includes its own Telnet implementation, you might
4970    need to use an external Telnet program to make certain connections;
4971    perhaps because it has access or security features not available in
4972    C-Kermit itself. As noted above, the only precautions necessary are
4973    usually:
4974
4975   SET PREFIXING ALL   ; Prefix all control characters
4976   SET PARITY SPACE    ; Telnet connections might not be 8-bit clean
4977
4978    and then:
4979
4980   SET HOST /PTY (or /PIPE) /CONNECT telnet abccorp.com
4981
4982    or, equivalently:
4983
4984   PTY (or PIPE) telnet abccorp.com
4985
4986 2.7.2. C-Kermit over Rlogin
4987
4988    C-Kermit includes its own Rlogin client, but this can normally be used
4989    only if you are root, since the rlogin TCP port is privileged. But ptys
4990    and pipes let you make rlogin connections with C-Kermit through your
4991    computer's external rlogin program, which is normally installed as a
4992    privileged program:
4993
4994   SET PREFIXING ALL
4995
4996    and then:
4997
4998   SET HOST /PTY (or /PIPE) /CONNECT rlogin -8 abccorp.com
4999
5000    or, equivalently:
5001
5002   PTY (or PIPE) rlogin -8 abccorp.com
5003
5004    The "-8" option to rlogin enables transmission of 8-bit data. If this
5005    is not available, then include SET PARITY SPACE if you intend to
5006    transfer files.
5007
5008    Note that the normal escape sequence for rlogin is Carriage Return
5009    followed by Tilde (~), but only when the tilde is followed by certain
5010    other characters; the exact behavior depends on your rlogin client, so
5011    read its documentation.
5012
5013 2.7.3. C-Kermit over Serial Communication Programs
5014
5015    Ptys and pipes also let you use programs that make serial connections,
5016    such as cu or tip. For example, C-Kermit can be used through cu to make
5017    connections that otherwise might not be allowed, e.g. because C-Kermit
5018    is not installed with the required write permissions to the dialout
5019    device and the UUCP lockfile directory.
5020
5021    Suppose your UUCP Devices file contains an entry for a serial device
5022    tty04 to be used for direct connections, but this device is protected
5023    against you (and Kermit when you run it). In this case you can:
5024
5025   SET CONTROL PREFIX ALL
5026   PTY (or PIPE) cu -l tty04
5027
5028    (Similarly for dialout devices, except then you also need to include
5029    the phone number in the "cu" command.)
5030
5031    As with other communication programs, watch out for cu's escape
5032    sequence, which is the same as the rlogin program's: Carriage Return
5033    followed by Tilde (followed by another character to specify an action,
5034    like "." for closing the connection and exiting from cu).
5035
5036 2.7.4. C-Kermit over Secure Network Clients
5037
5038      DISCLAIMER: There are laws in the USA and other countries regarding
5039      use, import, and/or export of encryption and/or decryption or other
5040      forms of security software, algorithms, technology, and intellectual
5041      property. The Kermit Project attempts to follow all known statutes,
5042      and neither intends nor suggests that Kermit software can or should
5043      be used in any way, in any location, that circumvents any
5044      regulations, laws, treaties, covenants, or other legitimate canons
5045      or instruments of law, international relations, trade, ethics, or
5046      propriety.
5047
5048    For secure connections or connections through firewalls, C-Kermit 7.0
5049    can be a Kerberos, SRP, and/or SOCKS client when built with the
5050    appropriate options and libraries. But other application-level security
5051    acronyms and methods -- SSH, SSL, SRP, TLS -- pop up at an alarming
5052    rate and are (a) impossible to keep up with, (b) usually mutually
5053    incompatible, and (c) have restrictions on export or redistribution and
5054    so cannot be included in C-Kermit itself.
5055
5056    However, if you have a secure text-based Telnet (or other) client that
5057    employs one of these security methods, you can use C-Kermit "through"
5058    it via a pty or pipe.
5059
5060 2.7.4.1. SSH
5061
5062    C-Kermit does not and can not incorporate SSH due to licensing, patent,
5063    and USA export law restrictions.
5064
5065    The UNIX SSH client does not use standard input/output, and therefore
5066    can be used only by Kermit's PTY interface, if one is present. The
5067    cautions about file transfer, etc, are the same as for Rlogin. Example:
5068
5069   SET PREFIXING ALL
5070   PTY ssh XYZCORP.COM
5071
5072    Or, for a scripted session:
5073
5074   SET PREFIXING ALL
5075   SET HOST /PTY ssh XYZCORP.COM
5076
5077    Hint:
5078
5079   define ssh {
5080       check pty
5081       if fail end 1 Sorry - no PTY support...
5082       pty ssh \%*
5083   }
5084
5085 2.7.4.2. SSL
5086
5087    Secure Sockets Layer (SSL) is another TCP/IP security overlay, this one
5088    designed by and for Netscape. An SSL Telnet client is available for
5089    UNIX from the University of Queensland. More info at:
5090
5091   [418]http://www.psy.uq.oz.au/~ftp/Crypto/
5092
5093    Interoperability with C-Kermit is unknown. C-Kermit also includes its
5094    own built-in SSL/TLS support, but it is not exportable; [419]CLICK HERE
5095    file for details.
5096
5097 2.7.4.3. SRP
5098
5099    SRP(TM) is Stanford University's Secure Remote Password protocol. An
5100    SRP Telnet client is available from Stanford:
5101
5102   [420]http://srp.stanford.edu/srp/
5103
5104    Stanford's SRP Telnet client for UNIX has been tested on SunOS and
5105    works fine with C-Kermit, as described in [421]Section 2.7.1, e.g.
5106
5107   SET PREFIX ALL
5108   PTY (or PIPE) srp-telnet xenon.stanford.edu
5109
5110    C-Kermit itself can be built as an SRP Telnet client on systems that
5111    have libsrp.a installed; the C-Kermit support code, however, may not be
5112    exported outside the USA or Canada.
5113
5114 2.7.4.4. SOCKS
5115
5116    C-Kermit can be built as a SOCKS-aware client on systems that have a
5117    SOCKS library. See section 8.1.1 of the [422]ckccfg.txt file.
5118
5119    C-Kermit 7.0 can also be run over SOCKSified Telnet or rlogin clients
5120    with SET NETWORK TYPE COMMAND. Suppose the Telnet program on your
5121    system is SOCKS enabled but C-Kermit is not. Make Kermit connections
5122    like this:
5123
5124   SET PREFIX ALL
5125   PTY (or PIPE) telnet zzz.com
5126
5127 2.7.4.5. Kerberos
5128
5129    UNIX C-Kermit can be built with MIT Kerberos IV or V authentication and
5130    encryption. Instructions are available in a [423]separate document.
5131    Additional modules are required that can not be exported from the USA
5132    to any country except Canada, by US law.
5133
5134    If you have Kerberos installed but you don't have a Kerberized version
5135    of C-Kermit, you can use ktelnet as C-Kermit's external communications
5136    program to make secure connections without giving up C-Kermit's
5137    services:
5138
5139   SET PREFIX ALL
5140   PTY (or PIPE) ktelnet cia.gov
5141
5142 2.8. Scripting Local Programs
5143
5144    If your version of Kermit has PTY support built in, then any text-based
5145    program can be invoked with SET HOST /PTY or equivalent command and
5146    controlled using the normal sequence of OUTPUT, INPUT, IF SUCCESS
5147    commands (this is the same service that is provided by the 'expect'
5148    program, but controlled by the Kermit script language rather than Tcl).
5149
5150    When PTY service is not available, then any program that uses standard
5151    input and output can be invoked with SET HOST /PIPE.
5152
5153    Here's an example in which we start an external Kermit program, wait
5154    for its prompt, give it a VERSION command, and then extract the numeric
5155    version number from its response:
5156
5157   set host /pty kermit -Y
5158   if fail stop 1 {Can't start external command}
5159   input 10 C-Kermit>
5160   if fail stop 1 {No C-Kermit> prompt}
5161   output version\13
5162   input 10 {Numeric: }
5163   if fail stop 1 {No match for "Numeric:"}
5164   clear input
5165   input 10 \10
5166   echo VERSION = "\fsubstr(\v(input),1,6)"
5167   output exit\13
5168
5169    This technique could be used to control any other interactive program,
5170    even those that do screen formatting (like Emacs or Vi), if you can
5171    figure out the sequence of events. If your Kermit program doesn't have
5172    PTY support, then the commands are restricted to those using standard
5173    i/o, including certain shells, interactive text-mode "hardcopy" editors
5174    like ex, and so on.
5175
5176    If you are using the PTY interface, you should be aware that it runs
5177    the given program or command directly on the pty, without any
5178    intervening shell to interpret metacharacters, redirectors, etc. If you
5179    need this sort of thing, include the appropriate shell invocation as
5180    part of your command; for example:
5181
5182   pty echo *
5183
5184    just echoes "*"; whereas:
5185
5186   pty ksh -c "echo *"
5187
5188    echoes all the filenames that ksh finds matching "*".
5189
5190    Similarly for redirection:
5191
5192   set host /pty ksh -c "cat > foo"  ; Note: use shell quoting rules here
5193   set transmit eof \4
5194   transmit bar
5195
5196    And for that matter, for built-in shell commands:
5197
5198   set host /pty ksh -c "for i in *; do echo $i; done"
5199
5200    The PIPE interface, on the other hand, invokes the shell automatically,
5201    so:
5202
5203   pipe echo *
5204
5205    prints filenames, not "*".
5206
5207 2.9. X.25 Networking
5208
5209    X.25 networking is documented in [424]Using C-Kermit, 2nd Edition. When
5210    the book was published, X.25 was available only in SunOS, Solaris, and
5211    Stratus VOS. Unlike TCP/IP, X.25 APIs are not standardized; each
5212    vendor's X.25 libraries and services (if they have them at all) are
5213    unique.
5214
5215    This section describes new additions.
5216
5217 2.9.1. IBM AIXLink/X.25 Network Provider Interface for AIX
5218
5219    Support for X.25 was added via IBM's Network Provider Interface (NPI),
5220    AIXLink/X.25 1.1, to the AIX 4.x version of C-Kermit 7.0.
5221    Unfortunately, AIXLink/X.25 is a rather bare-bones facility, lacking in
5222    particular any form of PAD support (X.3, X.28, X.29). Thus, the AIX
5223    version of C-Kermit, when built to include X.25 networking, has neither
5224    a PAD command, nor a SET PAD command. The same is true for the
5225    underlying AIX system: no PAD support. Thus it is not possible to have
5226    an interactive shell session over an X.25 connection into an AIX system
5227    (as far as we know), even from X.25-capable Kermit versions (such as
5228    Solaris or VOS) that do include PAD support.
5229
5230    Thus the X.25 capabilities in AIX C-Kermit are limited to peer-to-peer
5231    connections, e.g. from a C-Kermit client to a C-Kermit server. Unlike
5232    the Solaris, SunOS, and VOS versions, the AIX version can accept
5233    incoming X.25 connections:
5234
5235   set network type x.25
5236   if fail stop 1 Sorry - no X.25 support
5237   ; Put any desired DISABLE or ENABLE or SET commands here.
5238   set host /server *
5239   if fail stop 1 X.25 "set host *" failed
5240
5241    And then access it from the client as follows:
5242
5243   set network type x.25
5244   if fail stop 1 Sorry - no X.25 support
5245   set host xxxxxxx ; Specify the X.25/X.121 address
5246   if fail stop 1 Can't open connection
5247
5248    And at this point the client can use the full range of client commands:
5249    SEND, GET, REMOTE xxx, FINISH, BYE.
5250
5251    The AIX version also adds two new variables:
5252
5253    \v(x25local_nua)
5254           The local X.25 address.
5255
5256    \v(x25remote_nua)
5257           The X.25 address of the host on the other end of the connection.
5258
5259    C-Kermit's AIX X.25 client has not been tested against anything other
5260    than a C-Kermit X.25 server on AIX. It is not known if it will
5261    interoperate with C-Kermit servers on Solaris, SunOS, or VOS.
5262
5263    To make an X.25 connection from AIX C-Kermit, you must:
5264
5265   set x25 call-user-data xxxx
5266
5267    where xxxx can be any even-length string of hexadecimal digits, e.g.
5268    123ABC.
5269
5270 2.9.2. HP-UX X.25
5271
5272    Although C-Kermit presently does not include built-in support for HP-UX
5273    X.25, it can still be used to make X.25 connections as follows: start
5274    Kermit and tell it to:
5275
5276   set prefixing all
5277   set parity space
5278   pty padem address
5279
5280    This should work in HP-UX 9.00 and later (see [425]Section 2.7). If you
5281    have an earlier HP-UX version, or the PTY interface doesn't work or
5282    isn't available, try:
5283
5284   set prefixing all
5285   set parity space
5286   pipe padem address
5287
5288    Failing that, use Kermit to telnet to localhost and then after logging
5289    back in, start padem as you would normally do to connect over X.25.
5290
5291 2.10. Additional Serial Port Controls
5292
5293    C-Kermit 7.0 adds the following commands for greater control over
5294    serial ports. These commands are available only in C-Kermit versions
5295    whose underlying operating systems provide the corresponding services
5296    (such as POSIX and UNIX System V), and even then their successful
5297    operation depends on the capabilities of the specific device and
5298    driver.
5299
5300    SET DISCONNECT { ON, OFF }
5301           On a SET LINE or SET PORT connection with SET CARRIER ON or
5302           AUTO, if the carrier signal drops during the connection,
5303           indicating that the connection has been lost, and C-Kermit
5304           notices it, this setting governs what happens next. With SET
5305           DISCONNECT OFF, which is consistent with previous behavior, and
5306           therefore the default, C-Kermit continues to keep the device
5307           open and allocated. With SET DISCONNECT ON, C-Kermit
5308           automatically closes and releases the device when it senses a
5309           carrier on-to-off transition, thus allowing others to use it.
5310           However, it remains the default device for i/o (DIAL, REDIAL,
5311           INPUT, SEND, CONNECT, etc), so if a subsequent i/o command is
5312           given, the device is reopened if it is still available. When it
5313           has been automatically closed in this manner, SHOW
5314           COMMUNICATIONS puts "(closed)" after its name, and in UNIX, the
5315           lockfile disappears -- both from SHOW COMM and from the lockfile
5316           directory itself. Synonym: SET CLOSE-ON-DISCONNECT.
5317
5318    SET EXIT ON-DISCONNECT { ON, OFF }
5319           Like DISCONNECT, but makes the program exit if a connection
5320           drops.
5321
5322    Note that SET CLOSE-ON-DISCONNECT and SET EXIT ON-DISCONNECT apply only
5323    to connections that drop; they do not apply to connections that can't
5324    be made in the first place. For example, they have no effect when a SET
5325    LINE, SET HOST, TELNET, or DIAL command fails.
5326
5327    HANGUP
5328           If [CLOSE-ON-]DISCONNECT is ON, and the HANGUP command is given
5329           on a serial device, and the carrier signal is no longer present
5330           after the HANGUP command, the device is closed and released.
5331
5332    SET PARITY HARDWARE { EVEN, ODD }
5333           Unlike SET PARITY { EVEN, ODD, MARK, SPACE }, which selects 7
5334           data bits plus the indicated kind of parity (to be done in
5335           software by Kermit itself), SET PARITY HARDWARE selects 8 data
5336           bits plus even or odd parity, to be done by the underlying
5337           hardware, operating system, or device driver. This command is
5338           effective only with a SET LINE or SET PORT device. That is, it
5339           has no effect in remote mode, nor on network connections. There
5340           is presently no method for selecting 8 data bits plus mark or
5341           space parity. If hardware parity is in effect, the variable
5342           \v(hwparity) is set to "even" or "odd". Note: some platforms
5343           might also support settings of SPACE, MARK, or NONE.
5344
5345    SET STOP-BITS { 1, 2 }
5346           This tells the number of 1-bits to insert after an outbound
5347           character's data and parity bits, to separate it from the next
5348           character. Normally 1. Choosing 2 stop bits should do no harm,
5349           but will slow down serial transmission by approximately 10
5350           percent. Historically, 2 stop bits were used with Teletypes (at
5351           110 bps or below) for print-head recovery time. There is
5352           presently no method for choosing any number of stop bits besides
5353           1 and 2.
5354
5355    SET SERIAL [ dps ]
5356           dps stands for Data-bits, Parity, Stop-bits. This is the
5357           notation familiar to many people for serial port configuration:
5358           7E1, 8N1, 7O2, etc. The data bits number also becomes the
5359           TERMINAL BYTESIZE setting. The second character is E for Even, O
5360           for Odd, M for Mark, S for Space, or N for None. The list of
5361           available options depends on the capabilities of the specific
5362           platform. If dps is omitted, 8N1 is used. Type "set serial ?"
5363           for a list of available choices. Examples:
5364
5365         SET SERIAL 7E1
5366                 Equivalent to SET PARITY EVEN, SET STOP-BITS 1, SET TERM
5367                 BYTE 7.
5368
5369         SET SERIAL 8N1
5370                 Equivalent to SET PARITY NONE, SET STOP-BITS 1, SET TERM
5371                 BYTE 8.
5372
5373         SET SERIAL 7E2
5374                 Equivalent to SET PARITY EVEN and SET STOP-BITS 2, SET
5375                 TERM BYTE 7.
5376
5377         SET SERIAL 8E2
5378                 Same as SET PARITY HARDWARE EVEN, SET STOP-BITS 2, SET
5379                 TERM BYTE 8.
5380
5381         SET SERIAL
5382                 Same as SET PARITY NONE and SET STOP-BITS 1, SET TERM BYTE
5383                 8.
5384
5385    Notes:
5386
5387      * The SET SERIAL xx2 options are available only in Kermit versions
5388        where the SET PARITY HARDWARE command is also available. (SHOW
5389        FEATURES includes "HWPARITY" in its options list.)
5390      * The SET SERIAL 7xx and 8N1 options affect the software parity
5391        setting, even for network connections.
5392      * As noted in the manual, selecting 8 data bits does not give you
5393        8-bit terminal sessions in CONNECT mode unless you also SET
5394        TERMINAL BYTESIZE 8. The default terminal bytesize remains 7, to
5395        protect against the situation where the remote host is generating
5396        parity but you don't know about it. If the terminal bytesize was 8
5397        by default and you CONNECTed to such a host, you would see only
5398        garbage on your screen.
5399      * If you do not give a SET STOP-BITS or SET SET SERIAL command,
5400        C-Kermit does not attempt to set the device's stop bits; instead,
5401        it uses whatever setting the device uses when not given explicit
5402        instructions about stop bits.
5403
5404    SHOW COMMUNICATIONS displays the current settings. Stop bits and
5405    hardware parity are shown only for SET PORT / SET LINE (serial)
5406    devices, since they do not apply to network connections or to remote
5407    mode. STOP-BITS is shown as "(default)" if you have not given an
5408    explicit SET STOP-BITS or SET SERIAL command.
5409
5410    The \v(serial) variable shows the SET SERIAL setting (8N1, 7E1, etc).
5411
5412 2.11. Getting Access to the Dialout Device
5413
5414      This section is for UNIX only; note the special words about QNX at
5415      the end. Also see [426]Section 2.0 for SET LINE switches,
5416      particularly the /SHARE switch for VMS only.
5417
5418    C-Kermit does its best to obey the UUCP lockfile conventions of each
5419    platform (machine, operating system, OS version) where it runs, if that
5420    platform uses UUCP.
5421
5422    But simply obeying the conventions is often not good enough, due to the
5423    increasing likelihood that a particular serial device might have more
5424    than one name (e.g. /dev/tty00 and /dev/term/00 are the same device in
5425    Unixware 7; /dev/cua and /dev/cufa are the same device in NeXTSTEP),
5426    plus the increasingly widespread use of symlinks for device names, such
5427    as /dev/modem.
5428
5429    C-Kermit 7.0 goes to greater lengths than previous versions to
5430    successfully interlock with other communications program (and other
5431    instances of Kermit itself); for example, by:
5432
5433      * Creation of dual lockfiles whenever a symlink is used; one for the
5434        link name and one for the real name.
5435      * Creation of dual lockfiles in HP-UX according to HP rules.
5436      * Creation of dual uppercase/lowercase lockfile names in SCO
5437        UNIX/ODT/OSR5.
5438      * The use of ttylock() in versions of AIX where it works.
5439      * The use, wherever possible, of lockfile names based on
5440        inode/major/minor device number rather than device name.
5441
5442    See the [427]ckuins.txt and [428]ckubwr.txt files for details.
5443
5444    QNX is almost unique among UNIX varieties in having no UUCP programs
5445    nor UUCP-oriented dialout-device locking conventions. QNX does,
5446    however, allow a program to get the device open count. This can not be
5447    a reliable form of locking unless all applications do it (and they
5448    don't), so by default, Kermit uses this information only for printing a
5449    warning message such as:
5450
5451   C-Kermit>set line /dev/ser1
5452   WARNING - "/dev/ser1" looks busy...
5453
5454    However, if you want to use it as a lock, you can do so with:
5455
5456   SET QNX-PORT-LOCK { ON, OFF }
5457
5458    QNX-PORT-LOCK is OFF by default; if you set in ON, C-Kermit fails to
5459    open any dialout device when its open count indicates that another
5460    process has it open. SHOW COMM (in QNX only) displays the setting, and
5461    if you have a port open, it also shows the current open count (with
5462    C-Kermit's own access always counting as 1).
5463
5464 2.12. The Connection Log
5465
5466    C-Kermit 7.0 adds the ability to log connections, so you can see where
5467    you've been and have a record of calls you've made. A connection is
5468    defined as any communications session that is begun by SET LINE, SET
5469    PORT, DIAL, SET HOST, TELNET, or RLOGIN. Connections are not logged
5470    unless you request it; the command is:
5471
5472    LOG CX [ filename [ { NEW, APPEND } ] ]
5473           Enables logging of connections in the given file. If the
5474           trailing { NEW, APPEND } keyword is omitted, the file is opened
5475           for appending; i.e. new records are written to the end. If NEW
5476           is specified, a new file is created; if a file of the same name
5477           already existed, it is overwritten. If the filename is omitted,
5478           CX.LOG in your home (login) directory is used (note: uppercase).
5479           To accept all defaults, just use "log connections" (or "l c" for
5480           short). Synonym: LOG CONNECTIONS.
5481
5482    CLOSE CX-LOG
5483           This closes the connection log if it was open. (Note, the CLOSE
5484           CONNECTION command closes the connection itself).
5485
5486    SHOW CX
5487           This shows your current connection, if any, including the
5488           elapsed time (since you opened it). Synonym: SHOW CONNECTION.
5489
5490    \v(cx_time)
5491           This variable shows the elapsed time of your current connection,
5492           or if there is no current connection, of your most recent
5493           connection, of if there have been no connections, 0.
5494
5495    The connection contains one line per connection, of the form:
5496
5497   yyyymmdd hh:mm:ss username pid p=v [ p=v [ ... ] ]
5498
5499    where the timestamp (in columns 1-18) shows when the connection was
5500    made; username is the login identity of the person who made the
5501    connection; pid is Kermit's process ID when it made the connection. The
5502    p's are parameters that depend on the type of connection, and the v's
5503    are their values:
5504
5505   T = Connection Type (TCP, SERIAL, DIAL, DECNET, etc).
5506   H = The name of the Host from which the connection was made.
5507   N = Destination phone Number or Network host name or address.
5508   D = Serial connections only: Device name.
5509   O = Dialed calls only: Originating country code & area code if known.
5510   E = Elapsed time in hh:mm:ss format (or hhh:mm:ss, etc).
5511
5512    If you always want to keep a connection log, simply add:
5513
5514   log connections
5515
5516    to your C-Kermit customization file. Note, however, that if you make a
5517    lot of connections, your CX.LOG will grow and grow. You can handle this
5518    by adding a "logrotate" procedure like the following to your
5519    customization file, before the "log connections" command:
5520
5521   define LOGROTATE {                    ; Define LOGROTATE macro
5522       local \%i \%m \%d \%n \%f MAX
5523       def MAX 4                         ; How many months to keep
5524       if not def \%1 -                  ; No argument given
5525         end 1 \%0: No filename given
5526       if not = 1 \ffiles(\%1) -         ; Exactly 1 file must match
5527         end 1 \%0: \%1 - File not found
5528       .\%d := \fsubstr(\fdate(\%1),1,6) ; Arg OK - get file year & month
5529       if = \%d -                        ; Compare file year & month
5530         \fsubstr(\v(ndate),1,6) -       ; with current year & month
5531           end 0                         ; Same year & month - done
5532       rename \%1 \%1.\%d                ; Different - rename file
5533       .\%n := \ffiles(\%1.*)            ; How many old files
5534       if < \%n \m(MAX) end 0            ; Not enough to rotate
5535       .\%m := \%1.999999                ; Initial compare string
5536       for \%i 1 \%n 1 {                 ; Loop thru old logs
5537          .\%f := \fnextfile()           ; Get next file name
5538          if llt \%f \%m .\%m := \%f     ; If this one older remember it
5539       }
5540       delete \%m                        ; Delete the oldest one
5541   }
5542   log connections                       ; Now open the (possibly new) log
5543   logrotate \v(home)CX.LOG              ; Run the LOGROTATE macro
5544
5545    As you can see, this compares the yyyymm portion of the modification
5546    date (\fdate()) of the given file (\%1) with the current yyyymm. If
5547    they differ, the current file has the yyyymm suffix (from its most
5548    recent modification date) appended to its name. Then we search through
5549    all other such files, find the oldest one, and delete it. Thus the
5550    current log, plus the logs from the most recent four months, are kept.
5551    This is all done automatically every time you start C-Kermit.
5552
5553    On multiuser systems, it is possible to keep a single, shared,
5554    system-wide connection log, but this is not recommended since (a) it
5555    requires you keep a publicly write-accessible logfile (a glaring target
5556    for mischief), and (b) it would require each user to log to that file
5557    and not disable logging. A better method for logging connections, in
5558    UNIX at least, is syslogging (see [429]ckuins.txt Section 15 and
5559    [430]Section 4.2 of the [431]IKSD Administration Guide for details).
5560
5561 2.13. Automatic Connection-Specific Flow Control Selection
5562
5563    Beginning in C-Kermit 7.0, the appropriate flow-control method for each
5564    connection type is kept in a table, for example:
5565
5566   Remote:           NONE
5567   Modem:            RTS/CTS
5568   Direct-Serial:    NONE
5569   TCPIP:            NONE
5570
5571    The size of the table and values for each connection type can vary from
5572    platform to platform. Type "set flow ?" for a list of available
5573    flow-control types.
5574
5575    The table is used to automatically select the appropriate kind of flow
5576    control whenever you make a connection. You can display the table with:
5577
5578   SHOW FLOW-CONTROL
5579
5580    The defaults are as follows:
5581
5582    Remote:
5583           NONE or XON/XOFF. This is because C-Kermit is not allowed to
5584           find out what type of connection the incoming user has (*). No
5585           kind of flow control will work on every kind of connection,
5586           including (unexpectedly) KEEP, which we would have liked to use,
5587           but not turning off flow control at the remote end during file
5588           transfer on TCP/IP connections is fatal to the transfer (except
5589           in VMS and HP-UX, where it must be set to Xon/Xoff!) Therefore
5590           if you are dialing in to a serial port on a server (UNIX or VMS)
5591           where C-Kermit is running, you will need to tell C-Kermit to
5592           "set flow keep" before transferring files (assuming the modem
5593           and port are configured correctly by the system administrator;
5594           otherwise you'll need to give a specific kind of flow control,
5595           e.g. "set flow xon/xoff"), so in this case C-Kermit will not
5596           disable flow control, as it must do when you are coming via
5597           Telnet (directly or through a terminal server, except on VMS and
5598           HP-UX).
5599
5600    Modem:
5601           This applies when you dial out with a modem. In this case, the
5602           MODEM FLOW-CONTROL setting takes affect after the SET FLOW
5603           setting, so it can pick the most appropriate flow control for
5604           the combination of the particular modem and the
5605           computer/port/driver that is dialing.
5606
5607    Direct-Serial:
5608           The default here is NONE because C-Kermit has no way of knowing
5609           what kind of flow control, if any, is or can be done by the
5610           device at the other end of the connection. RTS/CTS would be a
5611           bad choice here, because if the CTS signal is not asserted, the
5612           connection will hang. And since direct connections are often
5613           made with 3-wire cables, there is a good chance the CTS signal
5614           will not be received.
5615
5616    TCPIP:
5617           NONE, since TCP and IP provide their own flow control
5618           transparently to the application, except in VMS, where Xon/Xoff
5619           is the default due to the requirements of the VMS TCP/IP
5620           products.
5621
5622    Other networks:
5623           NONE, since networks should provide their flow control
5624           transparently to the application.
5625
5626    (*) This is possibly the worst feature of UNIX, VMS, and other
5627    platforms where C-Kermit runs. If C-Kermit was able to ask the
5628    operating system what kind of connection it had to the user, it could
5629    set up many things for you automatically.
5630
5631    You can modify the default-flow-control table with:
5632
5633   SET FLOW-CONTROL /xxx { NONE, KEEP, RTS/CTS, XON/XOFF, ... }
5634
5635    where "xxx" is the connection type, e.g.
5636
5637   SET FLOW /REMOTE NONE
5638   SET FLOW /DIRECT RTS/CTS
5639
5640    If you leave out the switch, SET FLOW works as before, choosing the
5641    flow control method to be used on the current connection:
5642
5643   SET FLOW XON/XOFF
5644
5645    Thus, whenever you make a connection with SET PORT, SET LINE, DIAL, SET
5646    HOST, TELNET, RLOGIN, etc, an appropriate form of flow control is
5647    selected automatically. You can override the automatic selection with a
5648    subsequent SET FLOW command, such as SET FLOW NONE (no switch
5649    included).
5650
5651    The flow control is changed automatically too when you give a SET MODEM
5652    TYPE command. For example, suppose your operating system (say Linux)
5653    supports hardware flow control (RTS/CTS). Now suppose you give the
5654    following commands:
5655
5656   set line /dev/ttyS2    ; Automatically sets flow to NONE
5657   set modem type usr     ; Automatically sets flow to RTS/CTS
5658   set modem type rolm    ; Doesn't support RTS/CTS so now flow is XON/XOFF
5659
5660    IMPORTANT: This new feature tends to make the order of SET LINE/HOST
5661    and SET FLOW commands matter, where it didn't before. For example, in
5662    VMS:
5663
5664   SET FLOW KEEP
5665   SET LINE TTA0:
5666
5667    the SET LINE undoes the SET FLOW KEEP command; the sequence now must
5668    be:
5669
5670   SET FLOW /DIRECT KEEP
5671   SET LINE TTA0:
5672
5673    or:
5674
5675   SET LINE TTA0:
5676   SET FLOW KEEP
5677
5678 2.14. Trapping Connection Establishment and Loss
5679
5680    If you define a macro called ON_OPEN, it is executed any time that a
5681    SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or similar command
5682    succeeds in opening a connection. The argument is the host or device
5683    name (as shown by SHOW COMMUNICATIONS, and the same as \v(line)). This
5684    macro can be used for all sorts of things, like automatically setting
5685    connection- or host-specific parameters when the connection is opened.
5686    Example:
5687
5688   def ON_OPEN {
5689       switch \%1 {
5690         :abccorp.com, set reliable off, break
5691         :xyzcorp.com, set receive packet-length 1000, break
5692         etc etc...
5693       }
5694   }
5695
5696    If you define a macro called ON_CLOSE, it will be executed any time
5697    that a SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or any other kind
5698    of connection that C-Kermit has made is closed, either by the remote or
5699    by a local CLOSE, HANGUP, or EXIT command or other local action, such
5700    as when a new connection is opened before an old one was explicitly
5701    closed.
5702
5703    As soon as C-Kermit notices the connection has been closed, the
5704    ON_CLOSE macro is invoked at (a) the top of the command parsing loop,
5705    or (b) when a connection is closed implicitly by a command such as SET
5706    LINE that closes any open connection prior to making a new connection,
5707    or (c) when C-Kermit closes an open connection in the act of exiting.
5708
5709    The ON_CLOSE macro was inspired by the neverending quest to unite
5710    Kermit and SSH. In this case using the "tunnel" mechanism:
5711
5712   def TUNNEL {                                ; \%1 = host to tunnel to
5713       local \%p
5714       if not def \%1 stop 1
5715       assign tunnelhost \%1                   ; Make global copy
5716       undef on_close
5717       set macro error off
5718       close connection                        ; Ignore any error
5719       open !read tunnel start \%1
5720       read \%p                                ; Get port number
5721       if fail stop 1 Tunnel failure: \%1
5722       close read
5723       if fail stop 1 Tunnel failure: \%1      ; See [432]Section 4.2.8.1
5724       assign on_close {                       ; Set up close handler
5725           echo Closing tunnel: \m(tunnelhost)
5726           !tunnel stop \m(tunnelhost)
5727           undef on_close
5728       }
5729       set host localhost:\%p /telnet
5730       if success end 0
5731       undef on_close
5732       stop 1 Connection failure: \%1
5733   }
5734
5735    In this case, when the connection stops, we also need to shut down the
5736    tunnel, even if it is at a later time after TUNNEL has finished
5737    executing. This way we can escape back, reconnect, transfer files, and
5738    so on until the connection is broken by logging out from the remote, or
5739    by explicitly closing it, or by EXITing from C-Kermit, at which time
5740    the tunnel is shut down.
5741
5742    When the connection is closed, no matter how, the ON_CLOSE macro
5743    executes and then undefines (destroys) itself, since we don't want to
5744    be closing tunnels in the future when we close subsequent connections.
5745
5746    Other such tricks can be imagined, including ending ON_CLOSE with a
5747    STOP command to force the command stack to be peeled all the way back
5748    to the top, for example in a deeply nested script that depends on the
5749    connection being open:
5750
5751   def on_close { stop 1 CONNECTION LOST }
5752
5753    When C-Kermit invokes the ON_CLOSE macro, it supplies one argument
5754    (\%1): the reason the connection was closed as a number, one of the
5755    following:
5756
5757   2 - Fatal failure to negotiate a required item on a network connection.
5758   1 - Closed by C-Kermit command.
5759   0 - All others (normally closed by remote).
5760
5761    which may be used for any purpose; for example, to add a comment to the
5762    connection log:
5763
5764   def on_close {
5765       local \%m
5766       if not open cx end 0
5767       switch \%1 {
5768         :0, .\%m = Closed by remote, break
5769         :1, .\%m = Closed by me, break
5770         :2, .\%m = Network protocol negotiation failure, break
5771       }
5772       if def \%m writeln cx {# \%m}
5773   }
5774
5775 2.15. Contacting Web Servers with the HTTP Command
5776
5777    C-Kermit 7.0 (at this writing, the UNIX version only) supports direct
5778    contact and interaction with Web servers via HTTP 1.0 protocol. To make
5779    a connection, use Kermit's normal method for making a TCP/IP
5780    connection, but specify the HTTP port:
5781
5782   SET HOST host http [ switches ]
5783
5784    where host is the IP hostname or address, and http is the name of the
5785    TCP port for the Web server. Relevant switches include:
5786
5787    /RAW
5788           Treat the connection as a transparent binary pipe. This switch
5789           may be required if a port other than 'http' is used.
5790
5791    /SSL
5792           Make an secure private connection with SSL (only if SSL support
5793           is included in your version of Kermit). In this case the port
5794           name might need to be https rather than http, e.g. "set host
5795           secureserver.xyxcorp.com https /ssl".
5796
5797    /TLS
5798           Make an secure private connection with TLS (only if TLS support
5799           is included in your version of Kermit). In this case the port
5800           name would be https rather than http.
5801
5802    Then you can issue an HTTP command. In most cases, the server closes
5803    the connection when the command is complete. Example:
5804
5805   SET HOST www.columbia.edu http
5806   IF FAIL EXIT 1 Can't contact server
5807   HTTP GET kermit/index.html
5808
5809    At this point the connection is closed, since that's how HTTP 1.0
5810    works. If you want to perform additional operations, you must establish
5811    a new connection with another SET HOST command.
5812
5813    The HTTP command acts as a client to the Web server, except instead of
5814    displaying the results like a Web browser would, it stores them. Any
5815    HTTP command can (but need not) include any or all of the following
5816    switches:
5817
5818    /AGENT:user-agent
5819           Identifies the client to the server; "C-Kermit" or "Kermit-95"
5820           by default.
5821
5822    /HEADER:header-line
5823           Used for specifying any optional headers. A list of headers is
5824           provided using braces for grouping:
5825
5826   /HEADER:{{tag:value}{tag:value}...}
5827
5828           For a listing of valid tag value and value formats see [433]RFC
5829           1945: Hypertext Transfer Protocol -- HTTP/1.0. A maximum of
5830           eight headers may be specified.
5831
5832    /USER:name
5833           In case a page requires a username for access.
5834
5835    /PASSWORD:password
5836           In case a page requires a password for access.
5837
5838    /ARRAY:arrayname
5839           Tells Kermit to store the response headers in the given array,
5840           one line per element. The array need not be declared in advance.
5841           Example:
5842
5843   C-Kermit? http /array:c get kermit/index.html
5844   C-Kermit? show array c
5845   Dimension = 9
5846   1. Date: Fri, 26 Nov 1999 23:12:22 GMT
5847   2. Server: Apache/1.3.4 (Unix)
5848   3. Last-Modified: Mon, 06 Sep 1999 22:35:58 GMT
5849   4. ETag: "bc049-f72-37d441ce"
5850   5. Accept-Ranges: bytes
5851   6. Content-Length: 3954
5852   7. Connection: close
5853   8. Content-Type: text/html
5854
5855    As you can see, the header lines are like MIME e-mail header lines:
5856    identifier, colon, value. The /ARRAY switch is the only method
5857    available to a script to process the server responses for a POST or PUT
5858    command.
5859
5860    The HTTP commands are:
5861
5862    HTTP [ switches ] GET remote-filename [ local-filename ]
5863           Retrieves the named file. If a local-filename is given, the file
5864           is stored locally under that name; otherwise it is stored with
5865           its own name.
5866
5867    HTTP [ switches ] HEAD remote-filename local-filename
5868           Like GET except without actually getting the file; instead it
5869           gets only the headers, storing them into the given file, whose
5870           name must be given, one line per header item, as shown above in
5871           the /ARRAY: switch description.
5872
5873    HTTP [ switches ] INDEX remote-directory [ local-filename ]
5874           Retrieves the file listing for the given server directory. NOTE:
5875           This command is not supported by most Web servers.
5876
5877    HTTP [ switches ] POST [ /MIME-TYPE:type ] local-file remote-file
5878           Used to send a response as if it were sent from a form. The data
5879           to be posted must be read from a file.
5880
5881    HTTP [ switches ] PUT [ /MIME-TYPE:type ] local-file remote-file
5882           Uploads a local file to a server file.
5883
5884    HTTP [ switches ] DELETE remote-filename
5885           Instructs the server to delete the specified filename.
5886
5887 3. TERMINAL CONNECTION
5888
5889 3.1. CONNECT Command Switches
5890
5891    The following switches (see [434]Section 1.5) were added to the CONNECT
5892    command in 7.0:
5893
5894    /QUIETLY
5895           Don't print the "Connecting to..." or "Back at..." messages. CQ
5896           is an invisible command synonym for CONNECT /QUIETLY.
5897
5898    /TRIGGER:string
5899           Specify a trigger or triggers ([435]Section 3.2) effective for
5900           this CONNECT command only, temporarily overriding any current
5901           SET TERMINAL TRIGGER values ([436]Section 3.2).
5902
5903    Note: Other switches might also be available; type "connect ?" for a
5904    list, "help connect" for a description of each.
5905
5906 3.2. Triggers
5907
5908    Triggers were added for UNIX, VMS, AOS/VS, and K95 in C-Kermit 7.0.
5909
5910    SET TERMINAL TRIGGER string
5911           Tells C-Kermit to look for the given string during all
5912           subsequent CONNECT sessions, and if seen, to return to command
5913           mode automatically, as if you had escaped back manually. If the
5914           string includes any spaces, you must enclose it in braces.
5915           Example:
5916
5917   set terminal trigger {NO CARRIER}
5918
5919    Comparisons are made after character-set translation.
5920
5921    If a string is to include a literal brace character, precede it with a
5922    backslash:
5923
5924   ; My modem always makes this noise when the connection is lost:
5925   set terminal trigger |||ppp\{\{\{\{UUUUUUU
5926
5927    If you want Kermit to look for more than one string simultaneously, use
5928    the following syntax:
5929
5930   set terminal trigger {{string1}{string2}...{stringn}}
5931
5932    In this case, C-Kermit will return to command mode automatically if any
5933    of the given strings is encountered. Up to 8 strings may be specified.
5934
5935    If the most recent return to command mode was caused by a trigger, the
5936    new variable, \v(trigger), shows the trigger value; otherwise
5937    \v(trigger) is empty.
5938
5939    The SHOW TRIGGER command displays the SET TERMINAL TRIGGER values as
5940    well as the \v(trigger) value.
5941
5942 3.3. Transparent Printing
5943
5944    As noted in the manual, C-Kermit's CONNECT command on UNIX is not a
5945    terminal emulator, but rather a "semitransparent pipe" between the
5946    terminal or emulator you are using to access C-Kermit, and the remote
5947    host to which C-Kermit is connected. The "semitransparent" qualifier is
5948    because of character-set translation as well as several actions taken
5949    by the emulator in response to the characters or strings that pass
5950    through it, such as APCs, Kermit packets (autodownload), triggers, etc.
5951
5952    The UNIX version of C-Kermit 7.0 adds another such action: Transparent
5953    printing, also called Controller printing (as distinct from Autoprint
5954    or line or screen print). It is intended mainly for use on UNIX
5955    workstation consoles (as opposed to remote logins), but with some care
5956    can also be used when accessing C-Kermit remotely.
5957
5958    Transparent printing is related to APC by sharing C-Kermit's built-in
5959    ANSI escape-sequence parser to detect "printer on" and "printer off"
5960    sequences from the host. When the printer-on sequence is received, all
5961    subsequent arriving characters -- including NUL, control characters,
5962    and escape sequences -- are sent to the SET PRINTER device instead of
5963    to your screen until the printer-off sequence is received, or you
5964    escape back, whichever happens first. These bytes are not translated or
5965    modified or filtered in any way by Kermit (except for possibly
5966    stripping of the 8th bit, as noted below), but if filtering or
5967    translation is desired, this can be accomplished by your SET PRINTER
5968    selection (e.g. by choosing a pipeline of filters).
5969
5970    By default, your SET PRINTER device is your default UNIX printer, but
5971    it can also be a file, a command, or the null device (which causes all
5972    printer material to be discarded). See [437]Using C-Kermit, 2nd Ed.,
5973    p.41 for details.
5974
5975    Transparent printing is controlled by the command:
5976
5977    SET TERMINAL PRINT { ON, OFF }
5978           When ON, transparent-print sequences are obeyed, and printing
5979           occurs on the system where C-Kermit is running. When OFF,
5980           transparent print sequences are ignored and passed through to
5981           your actual terminal or emulator, along with the data they
5982           enclose. OFF is the default, for compatibility with earlier
5983           C-Kermit releases. As noted in the manual, when the current SET
5984           PRINTER device is a file, transparent-print material is appended
5985           to it; the file is not overwritten.
5986
5987    SET TERMINAL BYTESIZE { 7, 8 }
5988    SET PARITY { EVEN, ODD, MARK, SPACE, NONE }
5989           If the terminal bytesize is 7, or PARITY is not NONE, the 8th
5990           bit of each byte is stripped prior to printing.
5991
5992    The transparent-print escape sequences are:
5993
5994    <ESC>[5i
5995           Printer On. Send all subsequent incoming bytes to the printer
5996           without any kind of filtering, translation, or alteration. Note:
5997           <ESC> stands for ASCII character number 27 (decimal), Escape.
5998
5999    <ESC>[4i
6000           Printer Off. Resume displaying incoming bytes on the screen.
6001
6002    These are the same sequences used by DEC VT100 and higher terminals and
6003    other ANSI X3.64 and ISO 6429 compatible terminals. There is no
6004    provision for selecting other printer-control sequences.
6005
6006    Restrictions:
6007
6008     1. You must SET TERM TRANSPARENT-PRINT ON before you can use this
6009        feature.
6010     2. Only the 7-bit forms of the escape sequences are supported. The
6011        8-bit CSI C1 control is not recognized.
6012     3. Autoprint is not supported, since this requires a full-fledged
6013        terminal emulator with direct access to the screen.
6014     4. The start-print and stop-print sequences pass through to the screen
6015        (there is no way to avoid this without causing unacceptable delays
6016        or deadlocks in CONNECT mode). Thus if your terminal or emulator
6017        also supports transparent printing via these same sequences, an
6018        empty file will be sent to its printer. Normally this has no
6019        effect.
6020
6021    Point (4) is similar to the situation with autodownload and APC -- when
6022    you have several Kermit clients in a chain, you should take care that
6023    these features are enabled in only one of them.
6024
6025    Example 1:
6026
6027   set printer {|lpr -Plaser}  ; Specify the printer (if not default).
6028   set term print on           ; Enable transparent printing.
6029   set term byte 8             ; Enable 8-bit characters.
6030   connect                     ; Enter CONNECT mode.
6031
6032    Example 2:
6033
6034   set printer /home/users/olga/printer.log  ; Send printer material to a file.
6035
6036    Example 3:
6037
6038   set printer {| grep -v ^Received | lpr}   ; Filter out some lines
6039
6040    Then use "pcprint" or "vtprint" commands on the host to initiate
6041    transparent print operations. See [438]Using C-Kermit, 2nd Ed., p.406
6042    for details.
6043
6044    Here is a sample "pcprint" shell script for UNIX:
6045
6046   #!/bin/sh
6047   echo -n '<ESC>[5i'
6048   if [ $# -eq 0 ]; then
6049     cat
6050   else
6051     cat $*
6052   fi
6053   echo -n '<FF><ESC>[4i'
6054   # (end)
6055
6056    (Replace "<ESC>" by the actual ASCII Escape character and "<FF>" by the
6057    ASCII Formfeed character).
6058
6059    If you always want transparent printing enabled, put "set term print
6060    on" in your C-Kermit customization file (~/.mykermrc in UNIX). The "set
6061    term bytesize" selection, however, is a property of each separate
6062    connection.
6063
6064 3.4. Binary and Text Session Logs
6065
6066    C-Kermit 7.0 corrects an oversight in earlier releases, in which binary
6067    session logs (SET SESSION-LOG BINARY) translated character sets and
6068    performed various formatting transformations (e.g. "newline mode")
6069    before writing characters to the session log. In C-Kermit 7.0,
6070    binary-mode session logging writes characters as they come in, before
6071    anything (other that parity-bit stripping) is done to them. Text-mode
6072    session logging records the characters after processing.
6073
6074 4. FILE TRANSFER
6075
6076    Every file is transferred either in text mode (which implies
6077    record-format and character-set translation) or binary mode (in which
6078    each byte is sent literally without any kind of conversion). The mode
6079    in which a file is transferred is controlled by (a) the default mode,
6080    in the absence of any other indications; (b) the SET FILE TYPE command;
6081    (c) various automatic mechanisms based on client/server negotiations,
6082    directory information or filename patterns, etc.
6083
6084    The default FILE TYPE was changed from TEXT to BINARY in C-Kermit 7.0
6085    because:
6086
6087      * Transferring a text file in binary mode does less damage than
6088        transferring a binary file in text mode.
6089      * Only binary-mode transfers can be recovered from the point of
6090        failure.
6091      * The automatic transfer-mode mechanisms switch to text mode on a
6092        per-file basis anyway, so only those files that are not covered by
6093        the automatic mechanisms are affected.
6094      * All file transfers on the Web are done in binary mode, so people
6095        are accustomed to it and expect it.
6096
6097 4.0. BUG FIXES, MINOR CHANGES, AND CLARIFICATIONS
6098
6099 4.0.0. Filenames with Spaces
6100
6101    Filenames that contain spaces are a major nuisance to a program like
6102    Kermit, whose command language is line- and word-oriented, in which
6103    words are separated by spaces and a filename is assumed to be a "word".
6104    In general (unless noted otherwise in the description of a particular
6105    command), there is only one way to refer to such files in Kermit
6106    commands, and that is to enclose the name in braces:
6107
6108   send {this file}
6109
6110    Tells Kermit to send the file whose name is "this file" (two words, no
6111    quotes). Of course, various circumlocutions are also possible, such as:
6112
6113   define \%a this file
6114   send \%a
6115
6116    BUT, perhaps contrary to expectation, you can't use "\32" to represent
6117    the space:
6118
6119   send this\32file
6120
6121    does not work. Why? Because the Kermit parser, which must work on many
6122    operating systems including Windows, has no way of knowing what you
6123    mean by "this\32file". Do you mean a file whose name is "this file" in
6124    the current directory? Or do you mean a file whose name is "32file" in
6125    the "this" subdirectory of the current directory? Guessing won't do
6126    here; Kermit must behave consistently and deterministically in all
6127    cases on all platforms.
6128
6129    Note that you can't use Esc or Tab within {...} for filename
6130    completion, or question mark to get a filename list. However, you can
6131    include wildcards; for example:
6132
6133   send {* *}
6134
6135    sends all files whose name contains a space.
6136
6137    All things considered, it is best to avoid spaces in file and directory
6138    names if you can. Also see [439]Section 5.4 on this topic.
6139
6140 4.0.1. Packet out of Window
6141
6142    C-Kermit 6.0 could send packets "out of window" if the window size was
6143    greater than 1 and ACKs had arrived out of order. Fixed in 6.1.
6144
6145 4.0.2. MOVE after ADD SEND-LIST
6146
6147    ADD SEND-LIST followed by MOVE did not delete original files; fixed in
6148    6.1. Carrier loss was not detected during transfer; in 7.0 C-Kermit
6149    checks for this (but results can not be guaranteed). In any case, the
6150    protocol will eventually time out if the connection is lost.
6151
6152 4.0.3. GET and RECEIVE As-Names
6153
6154    In 5A(190) through 6.0.192, the GET and RECEIVE as-name did not
6155    properly override the RECEIVE PATHNAMES setting. In 7.0 it does.
6156
6157 4.0.4. New Brief Statistics Listing
6158
6159    Version 7.0 adds a /BRIEF switch to the STATISTICS command, to display
6160    a short file-transfer statistics report. /BRIEF is now the default. Use
6161    /VERBOSE to see the full display, which is about 25 lines long.
6162
6163 4.0.5. Improved FAST Command
6164
6165    The preinstalled definition of the FAST macro did not take enough
6166    factors into account. Now it sets packet lengths and window sizes
6167    appropriate to the configuration. Furthermore, in IRIX only, it might
6168    restrict the SEND packet length to 4000, to work around a bug in the
6169    IRIX Telnet server, depending on the IRIX version (see [440]ckubwr.txt,
6170    IRIX section). To see the built-in definition of the FAST macro, type
6171    "show macro fast". To change it, simply define it to be whatever you
6172    want -- it's just a macro, like any other.
6173
6174 4.0.6. The SET SEND BACKUP Command
6175
6176    Version 7.0 adds SET SEND BACKUP { ON, OFF }. This tells whether backup
6177    files should be sent. Backup files are the ones created by Kermit (and
6178    EMACS, and possibly other applications) to preserve old copies of files
6179    when creating new ones with the same name. Kermit does this when
6180    receiving a file and its FILE COLLISION setting is BACKUP (or RENAME,
6181    in which case it the new file gets the backup name). On most platforms,
6182    the backup name is formed by adding:
6183
6184   .~n~
6185
6186    to the end of the filename, where "n" is a number. For example, if the
6187    original file is oofa.txt, a backup file might be called:
6188
6189   oofa.txt.~1~
6190
6191    (or oofa.txt.~2~, etc). If you SET SEND BACKUP OFF, this tells Kermit
6192    not to send files that have backup names. Normally, SET SEND BACKUP is
6193    ON (as shown by SHOW PROTOCOL), and backup files are sent if their
6194    names match the SEND file specification.
6195
6196    Also see PURGE, SET FILE COLLISION, SEND /NOBACKUP, DIRECTORY
6197    /[NO]BACKUP.
6198
6199 4.0.7. The SET { SEND, RECEIVE } VERSION-NUMBERS Command
6200
6201    VMS Only. Normally when sending files, VMS C-Kermit strips the version
6202    number. For example, if the file is FOO.BAR;34, the name is sent as
6203    FOO.BAR (without the ";34"). If you want to keep version numbers on
6204    when sending files, use SET SEND VERSION-NUMBERS ON. The effect depends
6205    on the receiver.
6206
6207    Normally when receiving files, and an incoming filename includes a
6208    VMS-style version number (such as FOO.BAR;34) VMS C-Kermit strips it
6209    before trying to create the new file; this way the new file receives
6210    the next highest version number in the customary manner for VMS. If you
6211    want version numbers on incoming filenames to be used in creating the
6212    new files, use SET RECEIVE VERSION-NUMBERS ON.
6213
6214    Normally these commands would be effective only when VMS C-Kermit is
6215    exchanging files with a non-VMS Kermit program, since VMS-to-VMS
6216    transfers use labeled mode unless you have gone out of your way to
6217    defeat it.
6218
6219    Example: You want to send all versions of all files in the current
6220    directory from a VMS C-Kermit client to a UNIX C-Kermit server. Use:
6221
6222   set send version-numbers on
6223   send *.*;*
6224
6225    The resulting Unix files will have VMS-style version numbers as part of
6226    their name, for example "foo.bar;1", "foo.bar;2", etc.
6227
6228    Now suppose you want to send these files from Unix to another VMS
6229    system and preserve the version numbers. Again we have a Unix C-Kermit
6230    server and VMS C-Kermit client. Give these commands to the client:
6231
6232   set receive version-numbers on
6233   get *
6234
6235 4.0.8. The SET { SEND, RECEIVE } { MOVE-TO, RENAME-TO } Commands
6236
6237    These commands are persistent global versions of the /MOVE-TO: and
6238    /RENAME-TO: switches of the SEND, GET, and RECEIVE commands. They
6239    should normally be used only when setting up a dedicated
6240    transaction-processing application, in which each file is to be moved
6241    or renamed immediately after, and only if, it is transferred
6242    successfully, so that (for example) an independent, concurrent process
6243    can notice when new files appear and process them immediately without
6244    having to guess whether they are complete.
6245
6246 4.0.9. SET FILE INCOMPLETE AUTO
6247
6248    SET FILE INCOMPLETE { KEEP, DISCARD }, which tells whether to keep or
6249    discard incompletely received files, has a new option, AUTO, which is
6250    also the default. It means KEEP the incomplete file if the transfer is
6251    in binary mode, otherwise DISCARD it. This reduces the chances that a
6252    subsequent recovery operation (RESEND, REGET, etc) could produce a
6253    corrupt file, since recovery works only for binary-mode transfers.
6254
6255 4.1. FILE-TRANSFER FILENAME TEMPLATES
6256
6257    File-transfer filename templates allow files to be renamed
6258    automatically by the file sender, the receiver, or both, during
6259    transfer of groups of files.
6260
6261 4.1.1. Templates in the As-Name
6262
6263    Prior to C-Kermit 6.1 and Kermit 95 1.1.12 the only options that could
6264    be used to affect the names of files being transferred were SET
6265    FILENAMES { LITERAL, CONVERTED } and SET { SEND, RECEIVE } PATHNAMES {
6266    ON, OFF }, plus the "as-name" feature of the SEND (MOVE, etc) and
6267    RECEIVE commands.
6268
6269    Previously, the as-name could be used only for a single file. For
6270    example:
6271
6272   SEND FOO BAR
6273
6274    would send the file FOO under the name BAR, but:
6275
6276   SEND *.TXT anything
6277
6278    was not allowed, since it would give the same name to each file that
6279    was sent. When receiving:
6280
6281   RECEIVE FOO
6282
6283    would rename the first incoming file to FOO before storing it on the
6284    disk, but subsequent files would not be renamed to FOO, since this
6285    would result in overwriting the same file repeatedly. Instead, they
6286    were stored under the names they arrived with.
6287
6288    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to
6289    specify as-names in SEND, RECEIVE, and related commands even for file
6290    groups. This is accomplished by using replacement variables in the
6291    as-name, along with optional material such character-string functions
6292    and/or constant strings. An as-name containing replacement variables is
6293    called a filename template.
6294
6295    The key to filename templates is the new variable:
6296
6297   \v(filename)
6298
6299    During file transfer it is replaced by the name of each file currently
6300    being transferred (after transfer, it is the name of the last file
6301    transferred).
6302
6303    So, for example:
6304
6305   send *.txt \v(filename).new
6306
6307    sends each file with its own name, but with ".new" appended to it. Of
6308    course if the name already contains periods, this could confuse the
6309    file receiver, so you can also achieve fancier effects with
6310    constructions like:
6311
6312   send *.txt \freplace(\v(filename),.,_).new
6313
6314    which replaces all periods in the original filename by underscores, and
6315    then appends ".new" to the result. So, for example, oofa.txt would be
6316    sent as oofa_txt.new.
6317
6318    Another new variable that is useful in this regard is \v(filenumber),
6319    which is the ordinal number of the current file in the file group, so
6320    you can also:
6321
6322   send *.txt FILE\flpad(\v(filenum),2,0)
6323
6324    resulting in a series of files called FILE00, FILE01, FILE02, etc. (At
6325    the end of the transfer, \v(filenum) tells the number of files that
6326    were transferred).
6327
6328    If you specify a constant as-name when sending a file group:
6329
6330   send *.txt thisnameonly
6331
6332    Kermit complains and asks you to include replacement variables in the
6333    as-name. You should generally use \v(filename) or \v(filenumber) for
6334    this purpose, since other variables (with the possible exception of
6335    date/time related variables) do not change from one file to the next.
6336    But Kermit accepts any as-name at all that contains any kind of
6337    variables for file group, even if the variable will not change. So:
6338
6339   send *.txt \%a
6340
6341    is accepted, but all files are sent with the same name (the value of
6342    \%a, if it has one and it is constant). If the variable has no value at
6343    all, the files are sent under their own names.
6344
6345    Of course, the value of \%a in the previous example need not be
6346    constant:
6347
6348   define \%a FILE\flpad(\v(filenum),2,0)_at_\v(time)
6349   send *.txt \%a
6350
6351    The RECEIVE command, when given without an as-name, behaves as always,
6352    storing all incoming files under the names they arrive with, subject to
6353    SET FILE NAME and SET RECEIVE PATHNAMES modifications ([441]Section
6354    4.10).
6355
6356    However, when an as-name is given in the RECEIVE command, it is applied
6357    to all incoming files rather than to just the first. If it does not
6358    contain replacement variables, then the current FILE COLLISION setting
6359    governs the result. For example:
6360
6361   receive foo
6362
6363    will result in incoming files named foo, foo.~1~, foo.~2~, and so on,
6364    with the default FILE COLLISION setting of BACKUP. If it does contain
6365    replacement variables, of course they are used.
6366
6367    When receiving files, the \v(filename) variable refers to the name that
6368    was received in the incoming file-header packet, BEFORE any processing
6369    by SET FILE NAMES or SET RECEIVE PATHNAMES. Since the filenames in
6370    file-header packets are usually in uppercase, you would need to convert
6371    them explicitly if you want them in lowercase, e.g.:
6372
6373   receive \flower(\v(filename)).new
6374
6375 4.1.2. Templates on the Command Line
6376
6377    On the command-line, use templates as shown above as the -a option
6378    argument, bearing in mind the propensity of UNIX and perhaps other
6379    shells to treat backslash as a shell escape character. So in UNIX (for
6380    example):
6381
6382   kermit -s oofa.* -a x.\\v(filenum)
6383
6384    By the way, this represents a change from 6.0 and earlier releases in
6385    which the as-name (-a argument or otherwise) was not evaluated by the
6386    command parser. Thus, for example, in VMS (where the shell does not
6387    care about backslashes), it was possible to:
6388
6389   kermit -s oofa.txt -a c:\tmp\oofa.txt
6390
6391    Now backslashes in the as-name must be quoted not only for the shell
6392    (if necessary) but also for Kermit itself:
6393
6394   kermit -s oofa.txt -a c:\\tmp\\oofa.txt      ; Kermit only
6395   kermit -s oofa.txt -a c:\\\\tmp\\\\oofa.txt  ; Shell and Kermit
6396
6397    You can also use the \fliteral() function for this:
6398
6399   kermit -s oofa.txt -a \fliteral(c:\tmp\oofa.txt)      ; Kermit only
6400   kermit -s oofa.txt -a \\fliteral(c:\\tmp\\oofa.txt)   ; Shell and Kermit
6401
6402 4.1.3. Post-Transfer Renaming
6403
6404    Filename templates are now also useful in SET { SEND, RECEIVE }
6405    RENAME-TO and in the /RENAME-TO: switch, that can be given to the SEND,
6406    GET, or RECEIVE commands; this is similar to an as-name, but is
6407    effective on a per-file basis if and only if the file was transferred
6408    successfully.
6409
6410    MOVE-TO and RENAME-TO address a requirement commonly stated for
6411    transaction processing and similar systems. Suppose, for example, a
6412    central system "X" accepts connections from multiple clients
6413    simultaneously; a process on X waits for a file to appear and then
6414    processes the file. This process must have a way of knowing when the
6415    file has been completely and successfully transferred before it starts
6416    to process it. This can be accomplished easily using C-Kermit's SET {
6417    SEND, RECEIVE } { MOVE-TO, RENAME-TO } command or /MOVE-TO: or
6418    /RENAME-TO: switches, described in [442]Sections 4.7.1 through
6419    [443]4.7.3.
6420
6421    Here's an example for the client side, in which files to be sent are
6422    placed in a certain directory (/usr/olga/tosend in this example) by
6423    another process when they are ready to go. This might be in a hospital
6424    or big doctor's office, where medical insurance claims are entered at a
6425    number of workstations, and then deposited in the "tosend" directory,
6426    from which they are sent to a claims clearinghouse. We assume the
6427    connection is already made and a Kermit server is on the other end.
6428
6429   local srcdir findir              ; Declare local (automatic) variables
6430   assign srcdir /usr/olga/tosend   ; Local source directory (files to send)
6431   assign findir /usr/olga/sent     ; Where to move files after they are sent
6432   log transactions                 ; Keep a log of transfers
6433   cd \m(srcdir)                    ; Change to the source directory
6434   while true {                     ; Loop forever...
6435       send /move-to:\m(findir) *   ; Send all files
6436       sleep 60                     ; Sleep a minute
6437   }                                ; Go back and do it again
6438
6439    Note how simple this is. Once each file is sent, it is moved so it
6440    won't be sent again (you could also use SEND /RENAME-TO: or even SEND
6441    /DELETE). If a transfer fails, the file is not moved and so we try
6442    again to send it next time around. If there are no files to send, the
6443    SEND command does nothing but a message is printed; you can avoid the
6444    message by checking first to see if any files are in the directory:
6445
6446   while true {                     ; Loop forever...
6447       if > \ffiles(*) 0 -          ; If there are any files
6448         send /move-to:\m(findir) * ; send them.
6449       sleep 60                     ; Sleep a minute.
6450   }                                ; Go back and do it again.
6451
6452    It's even simpler on the server side (here again we assume the
6453    connection is already in place):
6454
6455   local rcvdir findir              ; Declare local (automatic) variables
6456   assign rcvdir /usr/ivan/tmp      ; Temporary receiving directory
6457   assign findir /usr/ivan/new      ; Where to move files after reception
6458   log transactions                 ; Keep a log of transfers
6459   cd \m(rcvdir)                    ; Change to the source directory
6460   set receive move-to \m(findir)   ; Declare move-to directory.
6461   server                           ; Enter server mode.
6462
6463    A separate process (e.g. the medical claim-form decoder) can look for
6464    files appearing in the /usr/ivan/new directory and process them with
6465    every confidence that they have been completely received.
6466
6467    Note that the use of MOVE-TO can result in moved files overwriting one
6468    another (the application would normally avoid this by assigning each
6469    transaction a unique, e.g. based on customer number and claim number).
6470    But if filename collisions are a possibility in your application,
6471    RENAME-TO might be a better choice; you can use any variables you like
6472    in the template to ensure uniqueness of the RENAME-TO filename; for
6473    example:
6474
6475   SET RECEIVE RENAME-TO \v(filename)_\v(ndate)_\v(ntime)_\v(userid)_\v(pid)
6476
6477 4.2. FILE-TRANSFER PIPES AND FILTERS
6478
6479 4.2.1. INTRODUCTION
6480
6481    Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to send
6482    from a command, or "pipe", as well as from a file, and to receive to a
6483    pipe or command. In a typical example, we might want to transfer an
6484    entire directory tree from one UNIX system to another (but without
6485    using the methods described in [444]Sections 4.3 , [445]4.10,
6486    [446]4.11, and [447]4.15). We could do this in multiple steps as
6487    follows:
6488
6489   1. Create a tar archive of the desired directory tree
6490   2. Compress the tar archive
6491   3. Transfer it in binary mode to the other computer
6492   4. Decompress it
6493   5. Extract the directory tree from the tar archive
6494
6495    But this is inconvenient and it requires a temporary file, which might
6496    be larger than we have room for.
6497
6498    The new pipe-transfer feature lets you do such things in a single step,
6499    and without intermediate files.
6500
6501    Additional new features, also discussed here, let you specify pre- and
6502    post- processing filters for outbound and incoming files, and give you
6503    a way to insert the output from shell or system commands into C-Kermit
6504    commands.
6505
6506    The file-transfer related features are available only with Kermit
6507    protocol, not with any external protocols, nor with K95's built-in
6508    XYZMODEM protocols (because XYZMODEM recovers from transmission errors
6509    by rewinding the source file, and you can't rewind a pipe).
6510
6511    This section begins by discussing the simple and straightforward use of
6512    these features in UNIX, in which pipes and input/output redirection are
6513    a fundamental component and therefore "just work", and then goes on to
6514    discuss their operation in Windows and OS/2, where matters are much
6515    more complicated.
6516
6517 4.2.1.1. TERMINOLOGY
6518
6519    Standard Input
6520           This is a precise technical term denoting the normal source of
6521           input for a command or program, which is the keyboard of your
6522           terminal by default, but which can be redirected to a file or
6523           pipe.
6524
6525    Stdin
6526           Abbreviation for Standard Input.
6527
6528    Standard Output
6529           A precise technical term denoting the normal destination for
6530           output from a command or program, which is your terminal screen
6531           by default, but which can be redirected to a file.
6532
6533    Stdout
6534           Abbreviation for Standard Output.
6535
6536    Stdio
6537           Abbreviation for Standard Input / Standard Output.
6538
6539    I/O
6540           Abbreviation for Input / Output.
6541
6542    Shell
6543           Text-based system command processor, such as the UNIX shell, DOS
6544           COMMAND.COM, etc.
6545
6546    Pipe
6547           A mechanism by which the standard output of one program is sent
6548           to the standard input of another.
6549
6550    Pipeline
6551           A series of programs connected by pipes.
6552
6553 4.2.1.2. NOTATION
6554
6555    In command descriptions, "command" is replaced by a shell or system
6556    command or pipeline. The command names specified in these commands are
6557    interpreted by your shell, just as if you were typing them at the shell
6558    prompt, and so if they are in your PATH, they will be found in the
6559    expected manner. Therefore you don't have to specify complete pathnames
6560    for commands that are programs (but it shouldn't hurt if you do).
6561
6562    The normal notation for I/O redirection is as follows:
6563
6564   <  Read Stdin from the given file.
6565   >  Send Stdout to the given file.
6566   |  Send Stdout from the command on the left to the command on the right.
6567
6568    Examples:
6569
6570    sort < foo > bar
6571           Sorts the lines in file "foo" and writes the results to file
6572           "bar"
6573
6574    grep -c "some text" *.txt | grep -v ":0" | sort | pr -3 | lpr
6575           This is a command pipeline composed of 5 commands:
6576
6577    grep -c "some text" *.txt
6578           Looks in all files whose names end with ".txt" for the string
6579           "some text" and writes to Stdout the names of each file followed
6580           by a colon and the number of occurrences in each.
6581
6582    grep -v ":0"
6583           Prints to Stdout the lines from Stdin that do NOT contain the
6584           string ":0", in this case, it removes the names of files that do
6585           not contain "some text".
6586
6587    sort
6588           Sorts the lines from Stdin alphabetically to Stdout.
6589
6590    pr -3
6591           Arranges the lines from Stdin in three columns.
6592
6593    lpr
6594           Prints its Stdin on the default printer.
6595
6596    Note that the Kermit features described here work only with commands
6597    that use Stdio. If you attempt to use them with commands whose input
6598    and output can not be redirected, Kermit will most likely get stuck.
6599    Kermit has no way of telling how an external command works, nor what
6600    the syntax of the shell is, so it's up to you to make sure you use
6601    these features only with redirectable commands.
6602
6603    The quoting rules of your shell apply to the command. Thus in UNIX,
6604    where C-Kermit tries to use your preferred shell for running commands,
6605    shell "metacharacters" within commands must be escaped if they are to
6606    be taken literally, using the methods normal for your shell. For
6607    example, the UNIX tr (translate) command must have its arguments in
6608    quotes:
6609
6610   tr "[a-z]" "[A-Z]"
6611
6612    otherwise the shell is likely to replace them by all filenames that
6613    match, which is probably not what you want. This is also true when
6614    using your shell directly, and has nothing to do with Kermit.
6615
6616 4.2.1.3. SECURITY
6617
6618    Some sites might not wish to allow access to system commands or
6619    external programs from within Kermit. Such access, including all the
6620    features described here, can be disabled in various ways:
6621
6622     1. When building from source code, include -DNOPUSH among the CFLAGS.
6623     2. At runtime, give the NOPUSH command.
6624     3. For server mode, give the DISABLE HOST command.
6625     4. Implicit use of pipes can be disabled as described in [448]Section
6626        4.2.4.
6627
6628    Note: 3 and 4 are not necessary if you have done 1 or 2.
6629
6630 4.2.2. Commands for Transferring from and to Pipes
6631
6632    SEND /COMMAND sends data from a command or command pipeline, and
6633    RECEIVE /COMMENT writes data to a command or pipeline. The GET /COMMAND
6634    command asks a server to send material, and then writes the incoming
6635    material to a command or pipeline. These features, along with switches
6636    (like "/COMMAND", described in [449]Section 4.7) are new to C-Kermit
6637    6.1. The following synonyms are also provided:
6638
6639   CSEND    = SEND /COMMAND
6640   CRECEIVE = RECEIVE /COMMAND
6641   CGET     = GET /COMMAND
6642
6643    None of these commands can be used if a SEND or RECEIVE FILTER
6644    (respectively, [450]Section 4.2.3) is in effect, or if a NOPUSH command
6645    ([451]Section 4.2.1.3) has been given, or if the current protocol is
6646    not Kermit.
6647
6648 4.2.2.1. Sending from a Command
6649
6650    SEND /COMMAND command [ as-name ]
6651    SEND /AS-NAME:as-name /COMMAND command
6652    CSEND command [ as-name ]
6653           These three forms are the same. They work like the SEND command,
6654           but instead of sending a file, it sends the standard output of
6655           the given command, either under the command's own name, or else
6656           with the given as-name. If the command contains spaces, it must
6657           be enclosed in braces. Braces should also be used for the
6658           as-name if it contains spaces. If braces are included around
6659           either the command or the as-name, they are removed after
6660           parsing but before use. As with SEND, the transfer is in text or
6661           binary mode according the current FILE TYPE setting, unless you
6662           override the global transfer mode by including a /TEXT or
6663           /BINARY switch. The command must require no input.
6664
6665    When sending from a command or pipeline, C-Kermit has no way of knowing
6666    in advance how much data will be sent, and so it can not send the size
6667    to the other Kermit in the Attribute packet, and so the receiving
6668    Kermit has no way of displaying "percent done" or a progress bar
6669    (thermometer).
6670
6671    Examples that make sense in text mode (illustrated by common UNIX
6672    commands):
6673
6674    SEND /COMMAND finger
6675    CSEND finger
6676           sends the current "finger" listing (who's logged in) under the
6677           name "finger". The two forms "send /command" and "csend" are
6678           equivalent; we won't bother showing them both in the rest of the
6679           examples.
6680
6681    SEND /COMMAND:{finger}
6682    CSEND {finger}
6683           Same as previous example (braces are removed from "{finger}").
6684
6685    SEND /COMMAND:{ finger }
6686    CSEND { finger }
6687           Same as previous example, but note that the spaces are kept.
6688           This does not prevent the shell from running the "finger"
6689           program, but its output is sent under the name " finger " (with
6690           a leading and trailing space).
6691
6692    SEND /COMMAND:finger /AS-NAME:userlist
6693    CSEND finger userlist
6694           sends the current finger listing under the name "userlist".
6695
6696    SEND /COMMAND:{finger | sort -r} /AS-NAME:userlist
6697    CSEND {finger | sort -r} userlist
6698           sends the current finger listing, sorted in reverse order, under
6699           the name "userlist". The braces are needed to distinguish the
6700           command from the as-name.
6701
6702    SEND /COMMAND:{finger | sort -r} /AS-NAME:{userlist}
6703    CSEND {finger | sort -r} {userlist}
6704           Same as previous example (braces are removed from "{userlist}").
6705
6706    SEND /COMMAND:{finger | sort -r}
6707           /AS-NAME:{\freplace(\v(filename),\32,_)}
6708
6709    CSEND {finger | sort -r} {\freplace(\v(filename),\32,_)}
6710           Like the previous example, but sends the output of the command
6711           under the name of the command, but with all spaces (\32)
6712           replaced by underscores, so the as-name is "finger_|_sort_-r".
6713
6714    Examples that make sense in binary mode (three equivalent forms are
6715    shown):
6716
6717    SEND /COMMAND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
6718    SEND /COMMAND /BINARY /AS-NAME:mydir.tar.gz {tar cf - . | gzip -c}
6719    CSEND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
6720           Makes a tar archive of the current directory, compresses it with
6721           the GNU gzip program, and sends it as "mydir.tar.gz". The other
6722           Kermit can, of course, just store it as a file, or it can use
6723           CRECEIVE to uncompress and dearchive it as part of the transfer
6724           process.
6725
6726    When using a "pipeline" of commands in the command field, obviously,
6727    the first command must not require any input, and the last command
6728    should produce some output, and all intermediate commands should get
6729    some input and produce some output.
6730
6731 4.2.2.2. Receiving to a Command
6732
6733    RECEIVE /COMMAND command
6734    CRECEIVE command
6735           This is like RECEIVE, except incoming material is written to the
6736           standard input of the given command, in text or binary mode
6737           according to the normal rules for file reception. Be sure to
6738           include a redirector to a file (if the command normally writes
6739           to standard output), or the output of the command won't go
6740           anywhere. The command may contain spaces; braces are not needed,
6741           but they are removed if used.
6742
6743    WARNING: C-Kermit has no way of knowing anything about the command, or
6744    even whether it is a command. Thus this command will always cause
6745    C-Kermit to enter protocol mode, as long as some text is specified in
6746    the command field. However, if the text does not correspond to a
6747    command, the transfer will eventually fail with a message such as
6748    "Error writing data" or "Failure to close file".
6749
6750    Examples for text mode (in UNIX):
6751
6752    RECEIVE /COMMAND sort -r > reverse.txt
6753    CRECEIVE sort -r > reverse.txt
6754           The text that is received is sorted in reverse order and stored
6755           in the file "reverse.txt". The two forms shown are equivalent.
6756
6757    RECEIVE /COMMAND {sort -r > reverse.txt}
6758    CRECEIVE {sort -r > reverse.txt}
6759           The same as the previous example; if braces are included, they
6760           are simply removed.
6761
6762    RECEIVE /COMMAND {sort -r > \flower(\v(filename)).reverse}
6763    CRECEIVE {sort -r > \flower(\v(filename)).reverse}
6764           Same but stores result under the incoming filename, lowercased,
6765           and with ".reverse" appended to it.
6766
6767    RECEIVE /COMMAND sort
6768    CRECEIVE sort
6769           Does nothing useful, since the output of sort has nowhere to go.
6770
6771    RECEIVE /COMMAND sort -r | pr -3 | lpr -Plaserjet
6772    CRECEIVE sort -r | pr -3 | lpr -Plaserjet
6773           The text that is received is sorted in reverse order, arranged
6774           into three columns, and sent to the "laserjet" printer.
6775
6776    Examples for binary mode:
6777
6778    RECEIVE /COMMAND:{gunzip -c | tar xf -}
6779    CRECEIVE {gunzip -c | tar xf -}
6780           Assuming the data that is received is a compressed tar archive,
6781           uncompresses the archive and passes it to tar for extraction. In
6782           this case the braces are needed because otherwise the final "-"
6783           would be taken as a command continuation character (see
6784           [452]Using C-Kermit, 2nd Edition, p.33).
6785
6786    GET /COMMAND remote-file command
6787    GET /COMMAND /AS-NAME:command remote-file
6788    CGET remote-file command
6789           This command tells the Kermit client to send a GET request for
6790           the given remote file to a Kermit server. Unlike GET, however,
6791           the incoming material is written to a command, rather than to a
6792           file. If the remote-file or the command contain spaces, they
6793           must be enclosed in braces. The same cautions about the command
6794           apply as for CRECEIVE.
6795
6796    Examples (for UNIX):
6797
6798    GET /COMMAND oofa.txt sort -r > oofa.new
6799    GET /COMMAND {oofa.txt} {sort -r > oofa.new}
6800    CGET oofa.txt sort -r > oofa.new
6801    CGET {oofa.txt} {sort -r > oofa.new}
6802           These four are equivalent. Each of them requests the server to
6803           send its "oofa.txt" file, and as it arrives, it is sorted in
6804           reverse order and written to "oofa.new".
6805
6806    GET /COMMAND {profile exec a} lpr
6807    GET /COMMAND {profile exec a} {lpr}
6808    GET /COMMAND /AS-NAME:lpr {profile exec a}
6809    GET /COMMAND /AS-NAME:{lpr} {profile exec a}
6810    GET /COMMAND /AS:lpr {profile exec a}
6811    CGET {profile exec a} lpr
6812    CGET {profile exec a} {lpr}
6813           Here the remote filename contains spaces so it MUST be enclosed
6814           in braces. As it arrives it is sent to the lpr program for
6815           printing. Braces are optional around "lpr" since it contains no
6816           spaces.
6817
6818    GET /COMMAND *.txt {cat >> new.txt}
6819    GET /AS-NAME:{cat >> new.txt} /COMMAND *.txt
6820    CGET *.txt {cat >> new.txt}
6821           This gets all the ".txt" files from the server and concatenates
6822           them all into a single "new.txt" file on the client.
6823
6824    GET /COMMAND *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
6825    CGET *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
6826           As above, but inserts each file's name before its contents.
6827
6828 4.2.3. Using File-Transfer Filters
6829
6830    The commands described in [453]Section 4.2.2 let you send the output of
6831    a command, or receive data into a command. But what if you want to
6832    specify preprocessing for files that you send, or postprocessing of
6833    files that you receive, even when multiple files are involved? For this
6834    you need a way to specify send and receive filters. The commands are
6835    SET SEND FILTER and SET RECEIVE FILTER; SHOW PROTOCOL displays the
6836    current settings.
6837
6838 4.2.3.1. The SEND Filter
6839
6840    SET SEND FILTER [ command ]
6841           This command specifies a command to be run on any file that you
6842           SEND (or MOVE, MSEND, etc). It also applies to files sent when
6843           in server mode, in response to GET commands, but not to the
6844           results of REMOTE commands like REMOTE DIRECTORY, REMOTE TYPE,
6845           REMOTE HOST, etc. The command may be, but need not be, enclosed
6846           in braces; if it is, the braces are stripped before use. The
6847           output of this command is sent, rather than the file itself. The
6848           current FILE TYPE setting (TEXT or BINARY) applies to the output
6849           of the command. The command must contain at least one instance
6850           of \v(filename), for which the name of the actual file is
6851           substituted. If the command is omitted, the send filter is
6852           removed and files are sent in the normal manner.
6853
6854    The SET SEND FILTER sets up a "global" filter -- that is, one that
6855    applies to all subsequent file-sending commands until you change or
6856    remove it. You can also specify a "local" filter to be used in a
6857    specific file-sending command by using the /FILTER switch (see
6858    [454]Section 1.5); for example:
6859
6860   SEND /FILTER:command [ other-switches ] filename
6861
6862    Besides \v(filename), you can include any other script programming
6863    notation in the send filter: variable names, array references, calls to
6864    built-in string or other functions, and so on. These are evaluated
6865    during file transfer, NOT during parsing, and they are evaluated
6866    separately for each file.
6867
6868    When the SEND or MOVE (SEND /DELETE) command is used with a send
6869    filter, the output from the filter is sent under the file's original
6870    name unless you specify an "as-name" or template. The Attribute packet
6871    (if any) contains the original file's attributes (size, creation date,
6872    etc). So (for example) if the filter changes the file's size, the
6873    progress thermometer might be wrong. (We can't send the size of the
6874    output from the filter, because it is not known until the transfer is
6875    finished.) If you prefer that the size not be sent, use "set attributes
6876    size off".
6877
6878    You can not use send filters with RESEND (SEND /RECOVER) or PSEND (SEND
6879    /START).
6880
6881    Examples for text mode:
6882
6883    SET SEND FILTER sort -r \v(filename) ; Braces may be omitted
6884    SET SEND FILTER {sort -r \v(filename)} ; Braces may be included
6885    SEND *.txt
6886           This sends every file in the current directory whose name ends
6887           with ".txt" under its own name, but with its lines sorted in
6888           reverse order.
6889
6890    SEND /FILTER:{sort -r \v(filename)} *.txt
6891           Same as above, but the filter applies only to this SEND command.
6892           Braces are required in this case.
6893
6894    SET SEND FILTER {sort -r \v(filename)}
6895    SEND oofa.txt reverse.txt
6896           Sends the oofa.txt file with its lines sorted in reverse order
6897           under the name "reverse.txt".
6898
6899    SET SEND FILTER {sort -r \v(filename)}
6900    SEND oofa.* \v(filename).reverse
6901           Sends all the oofa.* files with their lines sorted in reverse
6902           order; each file is sent under its own name but with ".reverse"
6903           appended to it.
6904
6905    SET SEND FILTER {tr "[a-z]" "[A-Z]" < \v(filename)}
6906    SEND *.txt
6907           Sends all ".txt" files under their own names, but uppercasing
6908           their contents.
6909
6910    Note that the SEND FILTER applies not only to files that are sent with
6911    SEND, MOVE, MSEND, etc, but also to files sent by the C-Kermit server
6912    in response to GET requests.
6913
6914    Examples for binary mode:
6915
6916    SET SEND FILTER {gzip -c \v(filename)}
6917    SEND /BINARY oofa.txt oofa.txt.gz
6918           Sends the oofa.txt file, compressed by gzip, as oofa.txt.gz.
6919
6920    SEND /BINARY /FILTER:{gzip -c \v(filename)} oofa.txt oofa.txt.gz
6921           As above, but the filter applies only to this SEND command.
6922
6923    SET SEND FILTER {gzip -c \v(filename)}
6924    SEND /BINARY oofa.* \fupper(\replace(\v(filename),.,_)).GZ
6925           Sends all the oofa.* files, compressed by gzip, each under its
6926           own name, but with the name uppercased, all periods within the
6927           name converted to underscores, and ".GZ" appended to it. So, for
6928           example, "oofa.txt" is sent as "OOFA_TXT.GZ".
6929
6930    In the gzip examples, note that the amount of data that is sent is
6931    normally less than the original file size because gzip compresses the
6932    file. But Kermit sends the original file size ahead in the attribute
6933    packet anyway (unless you tell it not too). Thus the transfer will
6934    probably appear to terminate early, e.g. when the receiver's
6935    file-transfer display thermometer is only at 40%. If this annoys you,
6936    tell Kermit to "set attribute length off". On the other hand, you can
6937    use the final position of the thermometer as a measure of the
6938    effectiveness of compression.
6939
6940 4.2.3.2. The RECEIVE Filter
6941
6942    SET RECEIVE FILTER [ command ]
6943           This command specifies that the given command will be run on any
6944           file that is received before it is written to disk. The command
6945           may be, but need not be, enclosed in braces; if it is the braces
6946           are stripped before use. The following two commands are
6947           equivalent:
6948
6949   SET RECEIVE FILTER sort -r > \v(filename)
6950   SET RECEIVE FILTER {sort -r > \v(filename)}
6951
6952    The RECEIVE filter command may contain a "\v(filename)" sequence to be
6953    replaced by the incoming filename from the file header packet, but it
6954    is not required. However you must use it whenever your filter would
6955    normally write to Stdout, otherwise its output will be lost.
6956
6957    The RECEIVE filter command may contain one or more "\v(filename)"
6958    sequence to be replaced by the incoming filename from the file header
6959    packet, but it is not required. However you must use it whenever your
6960    filter would normally write to Stdout, otherwise its output will be
6961    lost.
6962
6963    RECEIVE /FILTER:command and GET /FILTER:command can also be used to
6964    specify a filter to be used for only one file-transfer operation.
6965
6966    UNIX examples for text mode:
6967
6968    SET RECEIVE FILTER lpr
6969    RECEIVE
6970           All the files that are received are sent to the default UNIX
6971           print spooler.
6972
6973    RECEIVE /FILTER:lpr
6974           Same as above, except the lpr filter is used only with this
6975           RECEIVE command.
6976
6977    RECEIVE lpr
6978           This is probably not what you want; it creates a file called
6979           lpr.
6980
6981    SET RECEIVE FILTER {sort -r > \v(filename)}
6982    RECEIVE
6983           Stores each incoming file with its lines sorted in reverse
6984           order, under its own name.
6985
6986    RECEIVE /FILTER:{sort -r > \v(filename)}
6987           As above, but the filter is used only for this RECEIVE command.
6988
6989    SET RECEIVE FILTER sort -r > \v(filename)
6990    RECEIVE reverse.txt
6991           Stores each incoming file with its lines sorted in reverse
6992           order, under the name "reverse.txt". The actual result depends
6993           on the FILE COLLISION setting. If it is OVERWRITE and multiple
6994           files arrive, then each incoming file destroys the previous one.
6995           If it is BACKUP (the default), filename conflicts are resolve by
6996           adding "version numbers" to the filenames: reverse.txt,
6997           reverse.txt.~1~, reverse.txt.~2~, etc.
6998
6999    SET RECEIVE FILTER sort -r > \v(filename)
7000    RECEIVE \v(filename).reverse
7001           Stores each incoming file with its lines sorted in reverse
7002           order, under the name it arrived with, but with ".reverse"
7003           appended to it.
7004
7005    SET RECEIVE FILTER sort -r > \v(filename)
7006    RECEIVE \flower(\v(filename)).reverse
7007           Like the previous example, but ensures that the filename is
7008           lowercase.
7009
7010           Examples for binary mode:
7011
7012    SET RECEIVE FILTER gunzip -c > \v(filename)
7013    RECEIVE
7014           This receives one or more presumably compressed file and
7015           uncompresses each one into a file having the same name it was
7016           sent with. For example, if the file is sent with the name
7017           OOFA.TXT.GZ, it is stored with that name, even after
7018           decompression.
7019
7020    SET RECEIVE FILTER gunzip -c > \v(filename)
7021    RECEIVE \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
7022           Like the previous example, but the resulting filename has its
7023           rightmost three characters removed from it and the remainder is
7024           lowercased. So if the incoming filename is OOFA.TXT.GZ, it is
7025           stored as oofa.txt after decompression.
7026
7027    Of course you don't want to type such long hideous commands, so we have
7028    also introduced several new functions:
7029
7030    \fstripx(string[,character])
7031           This function removes the rightmost segment of the string that
7032           starts with the given character. If no character is given,
7033           period (.) is used. Thus it is most conveniently used for
7034           stripping the extension from a filename (or the decimal portion
7035           from a floating-point number written in US/UK style). Examples:
7036
7037    \fstripx(OOFA.TXT.GZ)             => OOFA.TXT
7038    \fstripx(OOFA.TXT.GZ,.)           => OOFA.TXT
7039    \fstripx(OOFA.TXT.GZ,X)           => OOFA.T
7040    \fstripx(\fstripx(OOFA.TXT.GZ))   => OOFA
7041    \fstripx($100.00)                 => $100
7042
7043    \fstripn(string,number)
7044           Removes the rightmost number characters from the string.
7045           Examples:
7046
7047    \fstripn(OOFA.TXT.GZ)             => OOFA.TXT.GZ
7048    \fstripn(OOFA.TXT.GZ,3)           => OOFA.TXT
7049    \fstripn(OOFA.TXT.GZ,7)           => OOFA
7050
7051    \fstripb(string[,c1[,c2]])
7052           Strips enclosing matching braces, brackets, parentheses, or
7053           quotes from the string. The second argument, c1, specifies which
7054           kind of enclosure to look for; if not specified, any enclosing
7055           (), [], <>, {}, "", '', or `' are removed. If c1 is specified
7056           and c2 is not, then if c1 is an opening brace, bracket, or
7057           parenthesis, the matching closing one is supplied automatically
7058           as c2. If both c1 and c2 are specified, then to be stripped the
7059           string must begin with c1 and end with c2. If the string is not
7060           enclosed in the indicated manner, the result is the original
7061           string. Examples:
7062
7063    \fstripb("abc")                   => abc
7064    \fstripb([abc])                   => abc
7065    \fstripb([abc)                    => [abc
7066    \fstripb(<abc>)                   => abc
7067    \fstripb(<abc>,[)                 => <abc>
7068    \fstripb((abc))                   => abc
7069    \fstripb((abc),[)                 => (abc)
7070    \fstripb((abc),{(})               => abc
7071    \fstripb(+abc+)                   => +abc+
7072    \fstripb(+abc+,+)                 => abc
7073    \fstripb(+abc+,+,^)               => +abc+
7074    \fstripb(+abc^,+,^)               => abc
7075    \fstripb('abc')                   => abc
7076    \fstripb(`abc')                   => abc
7077    \fstripb(``abc'')                 => `abc'
7078    \fstripb(\fstripb(``abc''))       => abc
7079
7080           Notice the special syntax required for including a literal
7081           parenthesis in the argument list. As the last two examples
7082           illustrate, \fstripb() strips only one level at at a time;
7083           nesting can be used to strip a small fixed number of levels;
7084           loops can be used to strip larger or indeterminate numbers of
7085           levels.
7086
7087    \flop(string[,char])
7088           Removes the leftmost segment of the string that ends with the
7089           given character. If no character is given, period (.) is used.
7090           Examples:
7091
7092   \flop(OOFA.TXT.GZ)               => TXT.GZ
7093   \flop(OOFA.TXT.GZ,.)             => TXT.GZ
7094   \flop(OOFA.TXT.GZ,X)             => T.GZ
7095
7096           To remove the leftmost number characters, just use
7097           \fsubstring(s,number+1). To return the rightmost number
7098           characters, use \fright(s,number).
7099
7100    So the hideous example:
7101
7102   receive \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
7103
7104    can now be written as:
7105
7106   receive \flower(\fstripx(\v(filename)))
7107
7108    That is, the filename stripped of its extension and then lowercased.
7109    This is not only shorter and less hideous, but also does not depend on
7110    the length of the extension being 3.
7111
7112    Note that when a receive filter is in effect, this overrides your FILE
7113    COLLISION setting, since Kermit has no way of knowing what the final
7114    destination filename will be (because it does not know, and can not be
7115    expected to know, the syntax of every version of every command shell on
7116    every platform on the planet).
7117
7118 4.2.4. Implicit Use of Pipes
7119
7120    If you wish, C-Kermit can also examine incoming filenames to see if
7121    they start with "!", and if so, the subsequent text is treated as a
7122    command to read from or write to. For example, if a Kermit client is
7123    given the following command:
7124
7125   get {!finger | sort}
7126
7127    the server on the other end, if it supports this feature, will run the
7128    "finger" program, pipe its standard output to the "sort" program, and
7129    send sort's standard output back to you. Similarly, if you:
7130
7131   send oofa.txt !sort -r > oofa.new
7132
7133    or, equivalently:
7134
7135   send oofa.txt {!sort -r > oofa.new}
7136
7137    or:
7138
7139   send /as-name:{!sort -r > oofa.new} oofa.txt
7140
7141    this has the receiver send the contents of the incoming oofa.txt file
7142    to the sort program, which sorts the text in reverse order and stores
7143    the result in oofa.new.
7144
7145    This use of the exclamation mark should be familiar to UNIX users as
7146    the "bang" feature that lets you run an external application or command
7147    from within another application.
7148
7149    Kermit's "bang" feature is disabled by default, since it is not unheard
7150    for filenames to actually begin with "!". So if you want to use this
7151    feature, you must enable it with the following command:
7152
7153    SET TRANSFER PIPES { ON, OFF }
7154           ON enables the recognition of "!" notation in incoming filenames
7155           during file transfer as an indicator that the remaining text is
7156           the name of a command. OFF, the default, disables this feature
7157           and uses the text as a filename in the normal fashion. This
7158           command does NOT affect SEND /COMMAND, GET /COMMAND, CSEND, etc.
7159
7160    So using a combination of CSEND (SEND /COMMAND) and the "bang" feature,
7161    you can transfer a directory tree all in one command (assuming the
7162    remote Kermit supports pipe transfers and has them enabled):
7163
7164   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
7165
7166    or:
7167
7168   SEND /COMMAND:{tar cf - . | gzip -c} /as:{!gunzip -c | tar xf -}
7169
7170    Pay close attention to the syntax. Braces are needed around the command
7171    because it contains spaces; braces are needed around the as-name
7172    because it ends with "-". The as-name must begin with "!" or receiving
7173    Kermit will not recognize it as a command. The CSEND command must NOT
7174    begin with "!" unless you are running a command whose name really does
7175    start that character.
7176
7177    Similarly, you have a Kermit server send a directory tree to be
7178    unpacked on the client end:
7179
7180   CGET {!tar cf - . | gzip -c} {gunzip -c | tar xf -}
7181
7182    or:
7183
7184   GET /COMMAND {!tar cf - . | gzip -c} /as:{gunzip -c | tar xf -}
7185
7186    Notice how, in this case, the bang is required in the remote command,
7187    to distinguish it from a filename, but not in the local command, since
7188    by definition of CGET (or GET /COMMAND), it is known to be a command.
7189
7190    SEND and RECEIVE FILTERs supersede the bang feature. For example, if a
7191    file arrives under the name "!gunzip -c | tar xf -", but the receiving
7192    Kermit also has been given a command like:
7193
7194   set receive filter sort -r > \v(filename)
7195
7196    then the incoming data will be sorted rather than gunzipped.
7197
7198    Finally, if SET TRANSFER PIPES is ON (and in this case, this must be
7199    done in your C-Kermit initialization file), you can send from a pipe on
7200    the C-Kermit command line:
7201
7202   kermit -s "!finger | sort -r" -a userlist
7203
7204    In this case the "filename" contains spaces and so must be quoting
7205    using your shell's quoting rules.
7206
7207 4.2.5. Success and Failure of Piped Commands
7208
7209    Commands or programs started by Kermit as a result of CSEND or CRECEIVE
7210    commands, CGET, SEND /COMMAND, REDIRECT commands (see [455]Section
7211    4.2.8.2), implicit use of pipes, RUN commands, and so forth, should
7212    return their exit status codes to the Kermit command that caused them
7213    to be run, and therefore IF SUCCESS and IF FAILURE tests after these
7214    commands should work as expected. For example:
7215
7216   CSEND blah < filename
7217
7218    should fail if there is no command called "blah" or if there is no file
7219    called "filename". However, this is not foolproof and sometimes
7220    C-Kermit might think a command succeeded when it failed, or vice versa.
7221    This is most likely to happen when the highly system-dependent methods
7222    that Kermit must use to determine a command's exit status code do not
7223    supply the right information.
7224
7225    It can also happen because some commands might define success and
7226    failure differently from what you expect, or because you are using a
7227    pipeline composed of many commands, and one of them fails to pass
7228    failing exit status codes up the chain. The most likely culprit is the
7229    shell itself, which in most cases must be interposed between Kermit and
7230    any external program to be run.
7231
7232    In any case, you can examine the following variable to find out the
7233    exit status code returned to Kermit by the process most recently run by
7234    any command that runs external commands or programs, including CSEND,
7235    CRECEIVE, REDIRECT, RUN, etc:
7236
7237   \v(pexitstat)
7238
7239    In UNIX, Windows and OS/2, the value should be -2 if no command has
7240    been run yet, 0 if the most recent command succeeded, -1, -3, or -4 if
7241    there was an internal error, and a positive number returned by the
7242    command itself if the command failed. If the number is in the range
7243    1-127, this is the program's exit status code. If it is 128 or greater,
7244    this is supposed to indicate that the command or program was
7245    interrupted or terminated from outside itself.
7246
7247    In Windows 95 and 98, the return values of the default shell are
7248    unreliable; various third-party shells can be used to work around this
7249    deficiency.
7250
7251    In VMS, it is the actual exit status code of the command that was run.
7252    This is an odd number if the command succeeded, and an even number if
7253    it failed. You can see the associated message as follows:
7254
7255   run write sys$output f$message(\v(pexitstat))
7256
7257    Or, more conveniently, use the new Kermit function:
7258
7259   echo \ferrstring(\v(pexitstat))
7260
7261    which converts a system error code (number) to the corresponding
7262    message.
7263
7264 4.2.6. Cautions about Using Pipes to Transfer Directory Trees
7265
7266    Although utilities such as tar and zip/unzip might be available on
7267    different platforms (such as UNIX and Windows), this does not
7268    necessarily mean you can use them successfully to transfer directory
7269    trees between unlike platforms. For example:
7270
7271   CSEND {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
7272
7273    when used from UNIX to Windows will have satisfactory results for
7274    binary files, but not for text files. UNIX text files have lines ending
7275    with Linefeed (LF) only, whereas Windows text files have lines ending
7276    in Carriage Return and Linefeed (CRLF). Thus any text files that were
7277    in the archive formed by the first tar command will be unpacked by the
7278    second tar command in their original form, and will display and print
7279    incorrectly in Windows (except in applications that have been
7280    explicitly coded to handle UNIX-format text files). On the other hand
7281    if you told gzip to use "text mode" to do record format conversion
7282    (assuming there was a way to tell it, as there is with most "zip"
7283    programs), this would destroy any binary files in the archive.
7284
7285    Furthermore, if the archive contains text files that are written in
7286    languages other than English, the "special" (accented and/or non-Roman)
7287    characters are NOT translated, and are therefore likely show up as
7288    gibberish on the target system. For example, West European languages
7289    are usually encoded in ISO Latin Alphabet 1 in UNIX, but in PC code
7290    page 850 on the PC. Capital A with acute accent is code point 193
7291    (decimal) Latin-1, but 181 in CP850. So A-acute in the UNIX file
7292    becomes Middle Box Bottom on the PC, and similarly for all the other
7293    special characters, and for all other languages -- Greek, Russian,
7294    Hebrew, Japanese, etc.
7295
7296    So when transferring text files between unlike platforms, you should
7297    use direct Kermit file transfers so Kermit can apply the needed
7298    record-format and character-set transformations. Use pipelines
7299    containing archivers like tar or zip only if all the files are binary
7300    or the two systems use the same record format and character set for
7301    text files.
7302
7303    Also see [456]Sections 4.3, [457]4.10, [458]4.11, and [459]4.15 for how
7304    to transfer directory trees between both like and unlike systems
7305    directly with Kermit.
7306
7307 4.2.7. Pipes and Encryption
7308
7309    Of course pipelines could be used for encrypted file transfers,
7310    assuming proper precautions could be taken concerning the transmission
7311    of the key. But there is rarely a good way to do this. To illustrate
7312    using UNIX crypt:
7313
7314   csend {crypt key < filename} {!crypt key > filename}
7315
7316    Or, more ambitiously:
7317
7318   csend {tar cf - . | gzip -c | crypt key} {!crypt key | gunzip -c | tar xf -}
7319
7320    transmits the key in the file header packet as part of the (clear-text)
7321    remote command, defeating the entire purpose of encrypting the file
7322    data.
7323
7324    But if you are connected in terminal mode to the remote computer and
7325    type:
7326
7327   creceive {crypt key > filename}
7328
7329    at the remote Kermit prompt, you have also transmitted the key in clear
7330    text over the communications link.
7331
7332    At present, the only secure way to use CSEND and CRECEIVE with an
7333    encryption filter is to have a human operator at both ends, so the key
7334    does not have to be transmitted.
7335
7336    Theoretically it would be possible to use PGP software (Pretty Good
7337    Privacy, by Phil Zimmerman, Phil's Pretty Good Software) to avoid key
7338    transmission (since PGP uses separate public and private key and "lets
7339    you communicate securely with people you've never met, with no secure
7340    channels needed for prior exchange of keys"), but the specific method
7341    has yet to be worked out.
7342
7343      HINT: See the PGP User's Guide, e.g. at:
7344      [460]http://www.telstra.com.au/docs/PGP/
7345      Especially the topic "Using PGP as a UNIX-Style Filter":
7346      [461]http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
7347
7348    In any case, better and more convenient security options are now
7349    available: Kerberos authentication and encryption ([462]CLICK HERE for
7350    details) and the new ability to run C-Kermit "though" other
7351    communication programs, described in [463]Section 2.7.
7352
7353 4.2.8. Commands and Functions Related to Pipes
7354
7355 4.2.8.1. The OPEN !READ and OPEN !WRITE Commands
7356
7357    These are described in [464]Using C-Kermit, and are generally useful
7358    with reading output from commands that produce more than one line on
7359    their standard output, or writing multiple lines into commands that
7360    accept them on their standard input.
7361
7362    In C-Kermit 7.0 CLOSE !READ is accepted as a synonym for CLOSE READ,
7363    and CLOSE !WRITE for CLOSE WRITE.
7364
7365    Testing the success and failure of these commands, however, can be a
7366    bit tricky. Consider:
7367
7368   open !read lalaskjfsldkfjsldkfj
7369
7370    (where "lalaskjfsldkfjsldkfj" is neither a valid command nor the name
7371    of a program or script that can be run). OPEN !READ, in UNIX at least,
7372    translates this into execl(shellpath,shellname,"-c",command). This
7373    means it starts your preferred shell (e.g. from the SHELL environment
7374    variable) and asks it to execute the given command. It must be this
7375    way, because your command can be a either an internal shell command
7376    (which only your shell can execute) or an external command, which only
7377    your shell knows how to find (it knows your PATH and interprets, etc).
7378    Therefore unless OPEN !READ can't start your shell, it always succeeds.
7379
7380    Continuing with the nonexistent-command example:
7381
7382   C-Kermit> open !read lalaskjfsldkfjsldkfj
7383   C-Kermit> status
7384    SUCCESS
7385   C-Kermit> read line
7386   C-Kermit> status
7387    SUCCESS
7388   C-Kermit> echo "\m(line)"
7389   "bash: lalaskjfsldkfjsldkfj: command not found"
7390   C-Kermit> close read
7391   C-Kermit> status
7392    FAILURE
7393   C-Kermit>
7394
7395    In other words, the failure can not be detected on OPEN, since the OPEN
7396    command succeeds if it can start your shell. It can't be detected on
7397    READ, since all this does is read output from the shell, which in this
7398    case happens to be an error message. However, failure IS detected upon
7399    close, since this is the occasion upon which the shell gives Kermit its
7400    exit status code.
7401
7402    For an illustration of this situation, see [465]Section 2.14.
7403
7404 4.2.8.2. The REDIRECT Command
7405
7406    A second method of I/O redirection is offered by the REDIRECT command.
7407    This is a rather advanced and tricky feature that is presently
7408    supported only in UNIX C-Kermit, in OS-9 C-Kermit, and in Kermit 95.
7409    Syntax:
7410
7411    REDIRECT command
7412           Runs the given command, sending its standard output to the
7413           current communications channel (SET LINE, SET PORT, or SET HOST
7414           connection), and reading its standard input from the same
7415           connection. Works only in local mode -- i.e. a connection is
7416           required -- and then only if the given command uses Standard
7417           I/O.
7418
7419    Example:
7420
7421   redirect finger
7422
7423    runs the local "finger" command and sends its output over the
7424    connection as plain text, where presumably there is a process set up to
7425    read it. Another example:
7426
7427   redirect finger | sort -r
7428
7429    shows the use of a pipeline.
7430
7431    Note: REDIRECT differs from CSEND/CRECEIVE in two important ways: (1)
7432    it does not use the Kermit protocol, and (2) it uses a bidirectional
7433    pipe rather than a one-way pipe.
7434
7435    The primary use of the REDIRECT command is to run external protocols,
7436    such as sz/rz in UNIX for ZMODEM, when they work over Standard I/O(*).
7437    Example:
7438
7439   set host xyzcorp.com
7440   (login, etc)
7441   redirect sz oofa.zip
7442
7443    lets you make a Telnet connection with C-Kermit and then do a ZMODEM
7444    transfer over it. ZMODEM protocol messages go both ways over the same
7445    connection simultaneously.
7446
7447    It is possible to use C-Kermit on UNIX as your PPP dialer and then to
7448    REDIRECT the connection to the PPP software, but C-Kermit 7.0 offers a
7449    better approach to PPP dialing in its new EXEC command ([466]Section
7450    1.23).
7451
7452    In theory, you can also redirect an interactive process. For example,
7453    suppose you tell Kermit 95 to wait for an incoming TCP/IP connection:
7454
7455   set host * 3000
7456
7457    and then tell C-Kermit on UNIX to:
7458
7459   set host kermit95hostname 3000
7460   redirect ksh
7461
7462    and then tell Kermit 95 to CONNECT: now you are talking to the UNIX
7463    K-shell; you can give commands (pwd, ls, etc) and see the results. In
7464    practice, the K-shell's terminal modes are messed up because (a) it is
7465    not going through the Unix terminal driver, and (b) it is "smart" and
7466    knows it is being redirected, and so acts in a decidedly inhospitable
7467    manner (other applications like EMACS, vi, etc, simply refuse to run if
7468    their standard i/o has been redirected).
7469
7470      (*) The publicly-distributed sz/rz programs do not work as clients.
7471      However, Omen Technology does offer an up-to-date redirectable
7472      client XYZMODEM program called crzsz.
7473
7474 4.2.8.3. Receiving Mail and Print Jobs
7475
7476    As of 7.0, and in UNIX only, files that are sent to C-Kermit as mail
7477    (when the other Kermit uses a MAIL or SEND /MAIL command) or to be
7478    printed (via REMOTE PRINT or SEND /PRINT) are now piped directly to the
7479    mail or print program, rather than written to temporary files and then
7480    mailed or printed and then deleted. This has the advantages of (a) not
7481    requiring a temporary file, and (b) allowing mail to have a proper
7482    subject in place of the filename. Temporary files were bad not only
7483    because they required (a) space, and (b) writeability of the current
7484    directory, but also because using them could result in wiping out an
7485    existing file. See [467]Section 4.7 for more about SEND /MAIL and SEND
7486    /PRINT.
7487
7488 4.2.8.4. Pipe-Related Functions
7489
7490    The \fcommand(command) function runs the given shell or system command
7491    and returns the command's standard output as its value (with any
7492    newline characters stripped from the end), unless the result is too
7493    long, in which case it returns the empty string. The maximum length for
7494    the result is at least 1022 bytes, and it might be longer on some
7495    platforms. Examples (UNIX):
7496
7497   C-Kermit> echo "\fcommand(date)"
7498   "Fri Apr 18 13:31:42 1997"
7499   C-Kermit> echo "\fcommand(finger | wc -l)" ; how many users logged in?
7500   "      83"
7501   C-Kermit> evaluate \fcommand(finger | wc -l) * 2
7502   166
7503   C-Kermit> echo Welcome to \fcommand(tty) on \fcommand(date)
7504   Welcome to /dev/ttyre on Fri Apr 18 13:31:42 1997
7505   C-Kermit> echo "\fcommand(ls oofa.*)"
7506   "oofa.c
7507   oofa.h
7508   oofa.o"
7509   C-Kermit> cd /directory-with-thousands-of-files
7510   C-Kermit> echo "\fcommand(ls -l)" ; This would be too long
7511   ""
7512   C-Kermit>
7513
7514    If a command's output would be too long, you can use the other, more
7515    laborious method of reading from a command: OPEN !READ command, READ
7516    each line, CLOSE !READ.
7517
7518    The \frawcommand(command) function is identical to \fcommand(command),
7519    except it does not remove trailing newline characters:
7520
7521   C-Kermit> echo "\frawcommand(date)"
7522   "Fri Apr 18 13:31:42 1997
7523   "
7524   C-Kermit> echo "\frawcommand(ls oofa.*)"
7525   "oofa.c
7526   oofa.h
7527   oofa.o
7528   "
7529   C-Kermit>
7530
7531    Use \frawcommand() if you want to retain the final line terminators, or
7532    if the command's output is "binary". But remember that if the result of
7533    this (or any other) function contains any NUL (ASCII code 0)
7534    characters, the first NUL will terminate the result string because this
7535    is how C strings work (it's "C-Kermit", remember?).
7536
7537    These functions are useful not only locally, but also in the
7538    client/server arena. If you need to get the results from a system
7539    command on the server end into a variable on the client end, just do:
7540
7541   [ remote ] query kermit command(date)
7542
7543    The result is in the local \v(query) variable; see [468]Using C-Kermit,
7544    2nd Ed., pp.359-360 for details.
7545
7546 4.3. Automatic Per-File Text/Binary Mode Switching
7547
7548    When transferring files between like systems (e.g. UNIX-to-UNIX),
7549    binary mode can be used for all files unless character-set translation
7550    is needed, and in fact Kermit programs of recent vintage recognize each
7551    others' platforms and switch to binary mode automatically when it is
7552    appropriate (e.g. DOS to OS/2, or UNIX to UNIX). (Exception: LABELED
7553    mode is chosen for VMS-to-VMS and OS/2-to-OS/2 transfers so complex
7554    file formats can be preserved.)
7555
7556    On a client/server connection between like systems, the transfer mode
7557    is currently determined by the file sender, rather than always by the
7558    client. If the client is sending, it controls the transfer mode. If a
7559    GET command is sent to the server, the server sends all files in binary
7560    mode if its TRANSFER CHARACTER-SET is TRANSPARENT; otherwise it uses
7561    text mode for text files (according to its text-pattern list) and
7562    binary mode for binary files. Of course, the client can control the
7563    server's transfer character-set with the REMOTE SET TRANSFER
7564    CHARACTER-SET command.
7565
7566    When transferring files between unlike systems, however, (e.g.
7567    UNIX-to-DOS), some files (such as executable program images) must be
7568    transferred in binary mode but others (such as plain-text files) must
7569    be transferred in text mode so their record format and character sets
7570    can be appropriately converted. If a binary file is transferred in text
7571    mode, it is ruined. If a text file is transferred in binary mode, then
7572    at the very least, its format can be incorrect; at worst it is also
7573    corrupted because its character set was not converted (in extreme cases
7574    the corruption is total, e.g. because one system is ASCII-based and the
7575    other EBCDIC).
7576
7577 4.3.1. Exceptions
7578
7579    VMS C-Kermit, when sending files to a non-VMS system, switches to text
7580    or binary mode automatically for each file, based on the record format
7581    in the file's directory entry; thus the mechanisms described in this
7582    section do not apply to VMS C-Kermit, yet the effect is the same:
7583    automatic text/binary mode switching when VMS C-Kermit is sending
7584    files. See the VMS Appendix of [469]Using C-Kermit for details.
7585
7586    Kermit versions that support LABELED or IMAGE transfer mode are
7587    likewise not affected by this feature when one of those modes is
7588    selected (normally used only when transferring between like systems).
7589
7590    Kermit versions that support file-transfer pipes and filters are not
7591    affected by this feature when pipes or filters are used, since the
7592    output of a pipe or filter (such as gzip) is likely to require transfer
7593    in a different mode than the original file.
7594
7595    Finally, SEND /TEXT or SEND /BINARY will force files to be sent in the
7596    indicated mode, overriding all automatic transfer-mode-choosing
7597    mechanisms.
7598
7599 4.3.2. Overview
7600
7601    Suppose you give C-Kermit a command like:
7602
7603   SEND *.*
7604
7605    And suppose the pattern *.* matches a mixture of text files (such as
7606    program source code) and binary files (such os object modules or
7607    executable programs).
7608
7609    C-Kermit 6.0 and earlier (except on VMS) send all files in the same
7610    mode: whatever you said in your most recent SET FILE TYPE command, or
7611    else whatever mode was chosen automatically according to the rules on
7612    page 236 of Using C-Kermit, 2nd Ed.
7613
7614    But when text and binary files are mixed in the same group, and the
7615    files are being transferred to an unlike system (e.g. UNIX to IBM
7616    Mainframe), this results in corruption of either all the text files or
7617    all the binary files.
7618
7619    Stream-oriented file systems such as in UNIX and DOS do not record any
7620    information about the file to tell us whether the file should be
7621    transferred in binary or text mode, making it impossible to select the
7622    transfer mode for each file in a group automatically with any
7623    certainty.
7624
7625    However, we can use some fairly-well established file naming
7626    conventions for this purpose. C-Kermit 7.0 lets you provide lists of
7627    filename patterns that are used to separately determine the file type
7628    for each individual file being transfered. A pattern is a string,
7629    possibly containing the special characters "*" (asterisk, which matches
7630    any string of zero of more characters) and/or "?" (question mark, which
7631    matches any single character). For example "a*b" matches all files
7632    whose names start with "a" and end with "b", such as "ab", "arb",
7633    "ababababab", etc, but not "abba". And "a?b" matches any file whose
7634    name starts with "a", ends with "b", and is exactly 3 characters long.
7635
7636      NOTE: When typing commands at the C-Kermit prompt, you must prefix
7637      "?" with \ to override its normal function of giving help.
7638
7639    (Also see [470]Section 4.9 for additional pattern-matching notations
7640    that might be available in your version of C-Kermit.)
7641
7642    When you have specified filename recognition patterns, C-Kermit can
7643    transfer the ones whose names match any of the binary-mode patterns in
7644    binary mode, and those with names that match any of the text-mode
7645    patterns in text mode, and those whose names match neither in the
7646    prevailing mode you have chosen, or that was chosen automatically via
7647    peer recognition.
7648
7649 4.3.3. Commands
7650
7651    SET FILE PATTERNS { ON, OFF, AUTO }
7652           This tells Kermit whether to do per-file filename
7653           pattern-matching to determine text or binary mode. The normal
7654           and default setting is AUTO, which means to use pattern lists to
7655           switch transfer mode only when it is certain that the other
7656           Kermit program supports automatic notification of transfer mode
7657           (via Attribute packets) on a per-file basis (this information is
7658           obtained automatically during protocol startup negotiation). ON
7659           means to always determine the transfer mode from the filename
7660           and pattern list when sending files. Use OFF to disable this
7661           feature (without resetting your pattern lists). Also note that
7662           if you have selected LABELED file transfer (SET FILE TYPE
7663           LABELED), this takes precedence over filename-matching patterns
7664           and all files are sent in labeled mode.
7665
7666    SET TRANSFER MODE MANUAL
7667           Disables the use of filename patterns, no matter what the FILE
7668           PATTERNS setting.
7669
7670    REMOTE SET TRANSFER MODE MANUAL
7671           Client command to disable automatic transfer mode, and therefore
7672           also filename patterns, in the server. Synonym: REMOTE SET XFER
7673           MODE MANUAL.
7674
7675    { GET, SEND, etc } { /BINARY, /TEXT }
7676           Including a /BINARY or /TEXT (or, where supported, /IMAGE or
7677           /LABELED) switch with a file-transfer command changes the
7678           transfer mode to manual for that command only, and therefore
7679           disables patterns that that command.
7680
7681    SET FILE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7682           A list of zero or more patterns, separated by spaces (not
7683           commas). Letters in a pattern are case-sensitive if the
7684           underlying filenames are case sensitive (as in UNIX), and
7685           case-insensitive otherwise (as in Windows). If a file's name is
7686           matched by any pattern in the list and SET FILE PATTERNS is ON,
7687           the file is sent in binary mode. Examples:
7688
7689   SET FILE BINARY-PATTERNS *.gz *.Z *.tar *.zip *.o *.so *.a *.out ; UNIX
7690   SET FILE BINARY-PATTERNS *.EXE *.ZIP *.OBJ *.COM ; DOS or OS/2 or Windows
7691
7692           If a pattern contains spaces, enclose it in braces.
7693
7694    SET FILE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7695           Like SET FILE BINARY-PATTERNS, but the patterns choose text
7696           files rather than binary ones. Examples:
7697
7698   SET FILE TEXT-PATTERNS *.TXT *.KSC *.HTM* *.BAT ; DOS, Windows, OS/2
7699
7700    ADD BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7701           Adds one or more patterns to the BINARY-PATTERN list.
7702
7703    ADD TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7704           Adds one or more patterns to the TEXT-PATTERN list.
7705
7706    REMOVE BINARY-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7707           Removes one or more patterns from the BINARY-PATTERN list. The
7708           given patterns are matched with the ones in the BINARY-PATTERNS
7709           list with case sensitivity if the underlying file system has
7710           case-sensitive names (as do UNIX and OS-9), otherwise with case
7711           independence.
7712
7713    REMOVE TEXT-PATTERNS [ pattern [ pattern [ pattern ... ] ] ]
7714           Removes one or more patterns from the TEXT-PATTERN list.
7715
7716    SHOW PATTERNS
7717           Displays the current pattern selections.
7718
7719    Whenever you give a SET FILE BINARY-PATTERNS or SET FILE TEXT-PATTERNS
7720    command, the previous list is replaced. If you give one of these
7721    commands without a pattern list, the previous list is removed.
7722
7723    When patterns are active and files are being sent, text patterns (if
7724    any) are applied first (but only if not RESENDing and not sending in
7725    LABELED mode), then binary patterns, so if the same pattern appears in
7726    both lists, binary mode is chosen.
7727
7728 4.3.4. Examples
7729
7730    Here's an example that might be used when sending files from UNIX:
7731
7732   set file type binary
7733   set file text-patterns *.c *.h *.w *.txt makefile
7734   set file binary-patterns *.o
7735   msend makefile wermit wart ck*.[cwho] ck*.txt
7736
7737    Note that "wermit" and "wart" do not match any patterns so they are
7738    sent in the prevailing mode, which is binary. Also note the use of
7739    "makefile" as a pattern that does not contain any wildcard characters
7740    (there is no other convention to distinguish among "wermit" and "wart",
7741    which are binary executables, and "makefile", which is a text file,
7742    purely by their names).
7743
7744    Most C-Kermit implementations have a default pattern list built in,
7745    which includes patterns that are almost certain to succeed in picking
7746    the right transfer mode. Others are omitted due to ambiguity. For
7747    example ".hlp", and ".ini" are generally binary types in Windows but
7748    text types everywhere else.
7749
7750      NOTE: ".doc", used for decades to denote plain-text documentation
7751      files, now more often than not denotes a Microsoft Word Document, so
7752      ".doc" is now considered a binary type since it does less harm to
7753      transfer a plain-text document in binary mode than it does to
7754      transfer an MS Word file in text mode (except when IBM mainframes
7755      are involved!)
7756
7757      ANOTHER NOTE: ".com" files are binary in DOS-like operating systems,
7758      but they are text (DCL command procedures) in VMS. VMS C-Kermit
7759      sends .COM files in text mode; K95 sends them in binary mode. If you
7760      download a .COM file from VMS to DOS or Windows, and then upload it
7761      to another VMS system, be sure to use SEND /TEXT to preserve its
7762      textness.
7763
7764    You can see the default pattern list by starting C-Kermit without its
7765    initialization file (e.g. "kermit -Y") and using the SHOW PATTERNS
7766    command. If you will be depending on this feature, be sure to examine
7767    the list carefully in conjunction with the applications that you use.
7768
7769    The default pattern list does not take "backup files" into account
7770    because (a) people usually don't want to transfer them; and (b) it
7771    would make the pattern lists more than twice as long. For example, we
7772    would need to include both *.txt and *.txt.~[0-9]*~ for ".txt" files,
7773    and similarly for all the others. Instead, you can use SEND /NOBACKUP
7774    (or SET SEND BACKUP OFF) to skip over all backup files.
7775
7776    Put your most commonly-used safe pattern declarations in your C-Kermit
7777    customization file (ckermod.ini, .mykermrc, k95custom.ini, etc).
7778
7779    As noted, SET FILE PATTERNS is ON by default. Sometimes, however, it is
7780    desirable, or necessary, to force files to be sent in a particular
7781    mode, and often this must be done from the command line (e.g. when
7782    using Kermit as a download helper in a Web browser like Lynx). The -V
7783    command-line options is equivalent to SET FILE PATTERNS OFF and SET
7784    TRANSFER MODE MANUAL. Example:
7785
7786   kermit -Vis oofa.txt
7787
7788    forces oofa.txt to be sent in binary mode, even though ".txt" might
7789    match a text pattern.
7790
7791 4.4. File Permissions
7792
7793    "Permissions" refers to a code associated with a file that specifies
7794    who is allowed to access it, and in what manner. For example, the
7795    owner, the members of one or more groups, the system administrator, and
7796    everybody else, might be allowed various combinations of Read, Write,
7797    Append, Execute, or Listing access.
7798
7799    The permission code goes by different names on different platforms. In
7800    UNIX, it might be called the filemode. In VMS, it is called the file
7801    protection (or protection mask).
7802
7803    The comments in this section presently apply only to the UNIX and VMS
7804    versions of C-Kermit, to which these features were added in version
7805    7.0; the DOS, Windows, and OS/2 file systems embody no notions of
7806    protection, and so MS-DOS Kermit and Kermit 95 do not send file
7807    permissions, and ignore them when received.
7808
7809    The permissions for a received file are determined by a combination of
7810    the file transfer mode (VMS-to-VMS transfers only), whether a file of
7811    the same name exists already, whether permissions of the file are
7812    received in the file attribute packet, and the setting of ATTRIBUTES
7813    PROTECTION.
7814
7815    The default for ATTRIBUTES PROTECTION is ON. If no attributes are
7816    received, the effect is the same as if attributes PROTECTION were OFF.
7817
7818    For VMS-to-VMS transfers, the default LABELED mode simply copies the
7819    protection code from source to destination.
7820
7821 4.4.1. When ATTRIBUTES PROTECTION is OFF
7822
7823    If no file of the same name exists, system defaults determine the
7824    permissions of the new file. Otherwise, the actions taken depend on the
7825    current FILE COLLISION setting: BACKUP, OVERWRITE, RENAME, etc, as
7826    documented in [471]Using C-Kermit. But now the new file (if it is
7827    created at all) automatically inherits the permissions (mode bits) of
7828    the existing file in a way that is appropriate for the platform.
7829
7830 4.4.1.1. Unix
7831
7832    All mode bits are inherited except the directory bit, since the
7833    incoming file can not possibly be a directory. (In any case, it is not
7834    possible to receive a file that has the same name as an existing
7835    directory unless FILE COLLISION is set to RENAME).
7836
7837 4.4.1.2. VMS
7838
7839    Files with the same name as an existing file, transferred in modes
7840    other than LABELED between VMS systems, inherit the protection of the
7841    prior version.
7842
7843 4.4.2 When ATTRIBUTES PROTECTION is ON
7844
7845    File permissions can be conveyed as part of the file transfer process,
7846    in accordance with the Kermit protocol definition. If the file sender
7847    puts system-dependent and/or system-independent versions of the file
7848    protection (permissions) into the Attribute (A) packet, the file
7849    receiver can set the new file's permissions from them. Otherwise, the
7850    permissions are set the same as for ATTRIBUTES PROTECTION OFF.
7851
7852    When the incoming A packet contains system-dependent permissions, the
7853    file receiver checks to see if the sender has the same system ID (e.g.
7854    both the sending and receiving systems are UNIX, or both are VMS); if
7855    so, it decodes and uses the system-dependent permissions; otherwise it
7856    uses the generic ones (if any) and applies them to the owner field,
7857    setting the other fields appropriately as described in the following
7858    sections.
7859
7860    Setting the incoming file's protection from the A packet is controlled
7861    by SET ATTRIBUTES PROTECTION (or PERMISSION), which is ON by default,
7862    and its status is displayed by SHOW ATTRIBUTES.
7863
7864    The main benefit of this feature is to not have to "chmod +x" an
7865    executable file after transfer from UNIX to UNIX. Its cross-platform
7866    benefits are less evident, perhaps to retain the status of the Unix 'x'
7867    bit on a VMS system, for subsequent transfer back to a Unix system.
7868
7869 4.4.2.1. System-Specific Permissions
7870
7871    System-specific file permissions are used when the two Kermit programs
7872    recognize each other as running on the same type of system. For
7873    example, both are running under some form of UNIX (it doesn't matter
7874    which UNIX variation -- HP-UX, Solaris, AIX, etc -- all use the same
7875    scheme for file permissions); or both are running under VMS (even if
7876    one is on an Alpha and the other on a VAX, and/or one is old and the
7877    other is new).
7878
7879 4.4.2.1.1. UNIX
7880
7881    UNIX supports three categories of users, File Owner, Group, and World,
7882    and three types of file access permission: Read, Write, and Execute.
7883    Thus, a UNIX file's permissions are expressed in 9 bits.
7884
7885    The system-dependent permission string for UNIX is a 3-digit octal
7886    string, the low-order 9 bits of the st_mode member of the stat struct;
7887    we deliberately chop off the "file format" bits because they are not
7888    permissions, nor do we convey the setuid/setgid bits, lock bit, sticky
7889    bit, etc.
7890
7891 4.4.2.1.2. VMS
7892
7893    VMS supports four categories of users, System, File Owner, Group, and
7894    World, and four types of file access permission: Read, Write, Execute,
7895    and Delete. Thus, a VMS file's permissions are expressed in 16 bits.
7896
7897    The system-dependent protection string for VMS is a 4-digit hexadecimal
7898    string, corresponding to the internal-format protection word of the
7899    file (RWED for each of World,Group,Owner,System). A new file normally
7900    gets all 16 protection bits from the original file of the same name.
7901
7902    Note: VMS-to-VMS transfers take place in LABELED mode when the two
7903    C-Kermits recognize each other's platform as VMS (unless you have
7904    disabled LABELED-mode transfers). In this case, all of a file's
7905    attributes are preserved in the transfer and the protection mask (and
7906    other information) is taken from the file's internal information, and
7907    this takes precedence over any information in the Attribute packets.
7908    You can defeat the automatic switching into LABELED mode (if you want
7909    to) with SET TRANSFER MODE MANUAL.
7910
7911 4.4.2.2. System-Independent Permissions
7912
7913    The system-independent ("generic") protection is used when the system
7914    IDs of the two Kermit programs do not agree (e.g. one is UNIX, the
7915    other is VMS). The generic protection attribute includes the following
7916    permissions (not all are applicable to every file system): Read, Write,
7917    Append, Execute, Delete, Search. The generic permissions are derived
7918    from the owner permissions of the source file, thus, a Unix 'w'
7919    permission becomes VMS Write,Delete.
7920
7921    The Owner field of the new file's permissions is set from the incoming
7922    generic protection attribute.
7923
7924    In UNIX, the Group and World permissions are set according to your
7925    umask, except that execute permission is NOT set in these fields if it
7926    was not also set in the generic protection (and consequently, is set in
7927    the Owner field).
7928
7929    In VMS, the System, Group, and World permissions are set according to
7930    the process default file permission (as shown in VMS by SHOW
7931    PROTECTION), except that no permissions are allowed in these fields
7932    that are not included in the generic permissions.
7933
7934    Note that the VMS and UNIX interpretations of Execute permission are
7935    not identical. In UNIX, a file (binary executable, shell script, etc)
7936    may not be executed unless it has Execute permission, and normally
7937    files that are not intended for execution do not have Execute
7938    permission. In VMS, Read permission implicitly supplies Execute
7939    capability. Generally files that have Read permission also have
7940    explicit Execute permission, but files (binary executables, DCL command
7941    procedures) that have Read permission and not Execute permission can
7942    still be executed.
7943
7944 4.5. File Management Commands
7945
7946 4.5.1. The DIRECTORY Command
7947
7948    Prior to C-Kermit 7.0, the DIRECTORY command always ran an external
7949    system command (such as "ls" on UNIX) or program to product the
7950    directory listing. This had certain advantages, mostly that you could
7951    include system-dependent options for customized listings, e.g. on UNIX:
7952
7953   dir -lt c* | more
7954
7955    or in VMS:
7956
7957   directory /size/date/protection/except=*.obj oofa.*;0
7958
7959    This approach, however, carries some disadvantages: C-Kermit can't
7960    return SUCCESS or FAILURE status for (e.g.) "dir foo" according to
7961    whether the file "foo" exists; and it runs an inferior process, which
7962    might be a problem in some environments for resource and/or security
7963    reasons, and won't work at all in a "nopush" environment (e.g. one in
7964    which C-Kermit is configured to forbid access to exterior commands and
7965    programs, e.g. in a VMS "captive account").
7966
7967    In C-Kermit 7.0 on VMS and UNIX, and in K95 1.1.19 and later, the
7968    DIRECTORY command is internal to Kermit. It can be run in a "nopush"
7969    environment and returns SUCCESS or FAILURE status appropriately. In
7970    UNIX it prints all dates and times in a consistent way (unlike ls). In
7971    VMS it prints precise file sizes, rather than "blocks". It offers
7972    several formatting and other options, but it is not necessarily more
7973    flexible than the corresponding external commands or programs (the UNIX
7974    "ls" program, the VMS "directory" command). The syntax is:
7975
7976    DIRECTORY [ switch [ switch [ ... ] ] ] [ filespec ]
7977
7978    If no filespec is given, all files in the current directory are listed.
7979
7980    Optional switches include all the standard file-selection switches
7981    presented in [472]Section 1.5.4, plus:
7982
7983    /ALL
7984           Show both regular files and directories; this is the default.
7985
7986    /ARRAY:x
7987           Instead of displaying a directory listing, put the files that
7988           would have been shown (based on the filespec and other selection
7989           switches) in the given array. The array need not (and should
7990           not) be predeclared; if the array already exists, it is
7991           destroyed and reused. The array name can be a single letter,
7992           like "a", or any fuller form, such as "&a", "\&a", "\&a[]", etc.
7993           If the /ARRAY switch is included, the following other switches
7994           are ignored: /BRIEF, /VERBOSE, /HEADING, /PAGE, /ENGLISHDATE,
7995           /ISODATE, /XFERMODE, /MESSAGE, /SORT, /REVERSE, /ASCENDING. In
7996           other words, only file selection switches are meaningful with
7997           /ARRAY: /FILES, /DIRECTORIES, /ALL, /DOTFILES, /NOBACKUP,
7998           /RECURSIVE, /SMALLER, /LARGER, /AFTER, /BEFORE, /EXCEPT, etc.
7999           The resulting array has the number of files (n) as its 0th
8000           element, and the filenames in elements 1 through n Example:
8001
8002   dir /array:&a /files /nobackup /after:19990101 /larger:10000 [ab]*
8003   show array &a
8004
8005    /FILES
8006           Only show regular files.
8007
8008    /DIRECTORIES
8009           Only show directories.
8010
8011    /BACKUP
8012           In UNIX, OS-9, K-95, and other versions that support SET FILE
8013           COLLISION BACKUP and create backup files by appending .~n~ to
8014           the filename (where "n" is a number), /BACKUP means to include
8015           these files in directory listings. This is the default.
8016
8017    /NOBACKUP
8018           This is the opposite of /BACKUP: that is, do not include backup
8019           files in the listing.
8020
8021    /BRIEF
8022           List filenames only; use a compact format, as many filenames as
8023           will fit across the screen (based on the longest name). A brief
8024           listing is always sorted alphabetically.
8025
8026    /VERBOSE
8027           List one file per line, and include date, size, and (in UNIX
8028           only) permissions of each file. This is the opposite of /BRIEF,
8029           and is the default.
8030
8031    /PAGE
8032           Pause at the end of each screenful and give a "more?" prompt,
8033           even if SET COMMAND MORE-PROMPTING is OFF.
8034
8035    /NOPAGE
8036           Don't pause at the end of each screenful and give a "more?"
8037           prompt, even if SET COMMAND MORE-PROMPTING is ON. If neither
8038           /PAGE or /NOPAGE is given, paging is according to the prevailing
8039           COMMAND MORE-PROMPTING setting (which can be displayed with SHOW
8040           COMMAND).
8041
8042    /ENGLISHDATE
8043           Show dates in dd-mmm-yyyy format; mmm is the first three letters
8044           of the English month name.
8045
8046    /ISODATE
8047           Show dates in yyyy-mm-dd format; mm is the month number, 1-12.
8048           This is the opposite of /ENGLISHDATE, and is the default.
8049
8050    /HEADINGS
8051           Print a heading before the listing and a summary at the end.
8052
8053    /NOHEADINGS
8054           Don't print a heading before the listing or a summary at the
8055           end. This is the opposite of /HEADINGS, and is the default.
8056
8057    /XFERMODE
8058           Only in Kermit programs that support SET FILE PATTERNS. If this
8059           switch is included, and the filename matches any FILE
8060           BINARY-PATTERN ([473]Section 4.3), "(B)" is printed after the
8061           filename; otherwise, if it matches a FILE TEXT-PATTERN, "(T)" is
8062           printed.
8063
8064    /NOXFERMODE
8065           Don't display transfer-mode indicators. This is the opposite of
8066           /XFERMODE and is the default.
8067
8068    /RECURSIVE
8069           Show files not only in the given directory, but also in its
8070           subdirectories (if any), their subdirectories, etc.
8071
8072    /NORECURSIVE
8073           Don't show files in subdirectories. This is the opposite of
8074           /RECURSIVE, and is the default.
8075
8076    /MESSAGE:text
8077           This lets you specify a short text string to be appended to the
8078           end of each directory listing line (a space is supplied
8079           automatically). If the text contains any spaces, enclose it in
8080           braces, e.g. /MESSAGE:{two words}.
8081
8082    /NOMESSAGE
8083           Don't append any message to the end of each directory listing
8084           line (default).
8085
8086    /SORT:[{NAME,SIZE,DATE}]
8087           Sort the listing by name, size, or date. If the /SORT switch is
8088           given but the "sort-by" keyword is omitted, the listing is
8089           sorted by name. /SORT:NAME /ASCENDING (alphabetic sort by name)
8090           is the default.
8091
8092    /NOSORT
8093           Don't sort the listing. Files are listed in whatever order they
8094           are supplied by the operating system, e.g. inode order in UNIX.
8095
8096    /REVERSE
8097           If the /SORT switch is given, reverse the order of the sort.
8098           Synonym: /DESCENDING.
8099
8100    /ASCENDING
8101           If the /SORT switch is given, sort the listing in normal order.
8102           This is the opposite of /REVERSE and is the default.
8103
8104    Note that most of the DIRECTORY-specific switches come in pairs, in
8105    which one member of a pair (e.g. /NOHEADINGS) is the opposite of the
8106    other (e.g. /HEADINGS).
8107
8108    If you always want to use certain options, you can set them with the
8109    SET OPTIONS DIRECTORY command ([474]Section 1.5.5). Use SHOW OPTIONS to
8110    list the options currently in effect. To make the desired options apply
8111    every time you run C-Kermit, put a SET OPTIONS DIRECTORY command in
8112    your C-Kermit customization file, specifying the desired options.
8113    Options set in this manner apply to every subsequent DIRECTORY command.
8114    Of course, if you include switches in a DIRECTORY command, these
8115    override any defaults, built-in or custom. Example:
8116
8117   DIRECTORY            ; Use "factory defaults"
8118   SET OPTIONS DIRECTORY /SORT:SIZE /REVERSE /HEADINGS  ; Customize defaults
8119   DIRECTORY            ; Use customized defaults
8120   DIR /SORT:NAME       ; Override customized default SORT key
8121   SET OPT DIR /RECURS  ; Add /RECURSIVE to customized defaults
8122   DIR /ASCEND          ; Override customized default SORT order
8123
8124    Notes:
8125
8126      * Only a single sort key is supported; there is presently no way to
8127        have multiple sort keys.
8128      * If the /BRIEF switch is given, all other switches (except
8129        /[NO]RECURSIVE, /[NO]DOTFILES, /DIRECTORIES, /FILES, and /ALL) are
8130        ignored.
8131      * /SORT:anything gives incorrect results if any files have lengths
8132        greater than 10 digits (i.e. that are more than 9999999999 bytes
8133        long, i.e. if they are 10GB or more in size) because the overlong
8134        length field causes the date and name fields to be misaligned.
8135      * /SORT:NAME is redundant in VMS since VMS returns filenames in
8136        alphabetic order anyway.
8137      * /SORT:NAME ignores alphabetic case on platforms where case does not
8138        matter in filenames, but this works only for unaccented Roman
8139        letters A-Z.
8140      * /SORT:NAME is currently based on code values, and so works fine for
8141        ASCII, but will probably produce unexpected results for files with
8142        non-ASCII or 8-bit characters in their names. (Locale-based sorting
8143        raises rather significant issues of portability, size, performance,
8144        etc.)
8145      * /SORT:DATE works right only for ISO-format dates, not English ones.
8146      * /SORT:SIZE sorts the size field lexically. On some platforms (e.g.
8147        Windows), the size of a directory file is listed as "<DIR>" rather
8148        than as a number; in this case, the "<DIR>" files are gathered at
8149        the end (or beginning, depending on the sort order) of the listing.
8150      * /RECURSIVE is accepted but ignored in AOS/VS. Use the normal
8151        system-specific filespec notation, e.g. "dir #.txt".
8152      * /RECURSIVE has no affect when a full, absolute pathname is given;
8153        e.g. "dir /recursive /tmp/foo" (where "foo" is a regular file) only
8154        shows the "/tmp/foo" file. If you want to see all "foo" files in
8155        the /tmp tree, do "cd /tmp" and then "dir /recursive foo".
8156      * If a file size of -1 is shown, or date-time of 0000-00-00 00:00:00,
8157        this means the file was located, but access to information about
8158        the file was denied to C-Kermit.
8159      * In VMS, if FOO.DIR;1 is a directory within your current directory,
8160        "directory foo" and "directory [.foo]" list the files in the [.FOO]
8161        subdirectory, but "directory foo.dir" lists the directory file
8162        itself; similarly for "*.dir" versus "[.*]", etc.
8163      * In UNIX, if "foo" is a directory within your current directory,
8164        "directory foo" lists the files in the foo directory. If you want
8165        to list the foo directory file itself, put an asterisk at the end:
8166        "dir foo*".
8167
8168    Hint: How to find the biggest files in a directory tree:
8169
8170   cd xxx ; (root of tree)
8171   directory /sort:size /recursive /reverse /dotfiles /page
8172
8173    Another hint: If you often use several different directory-listing
8174    formats, define macro shortcuts for them:
8175
8176   DEFINE WD DIRECTORY /SORT:DATE /REVERSE \%*  ; Reverse chronological order
8177   DEFINE SD DIRECTORY /SORT:SIZE /REVERSE \%*  ; Reverse order of size
8178   DEFINE ND DIRECTORY /SORT:NAME /ASCEND \%*   ; Alphabetical by name
8179   DEFINE DL DIR /DIR /SORT:NAME /ASCEND \%*    ; Alphabetical directory list
8180
8181    Put these definitions in your C-Kermit customization file. Note that
8182    "\%*" ([475]Section 7.5) in these definitions lets you include other
8183    switches in your macro invocations, e.g.:
8184
8185   wd /headings *.txt
8186
8187    Of course you can still access your external directory listing program
8188    by using RUN or "!", e.g. in VMS:
8189
8190   run directory /size/date/protection/except=*.obj oofa.*;0
8191
8192    or:
8193
8194   !dir /size/date/prot/exc=*.obj oofa.*;0
8195
8196    In UNIX, use "!ls" or just "ls" (which is a special synonym for "!ls").
8197
8198 4.5.2. The CD and BACK Commands
8199
8200    In C-Kermit 7.0, the CD command has a new friend, the BACK command.
8201    BACK means "CD to my previous current directory". A second BACK brings
8202    you back to where you were before the first one; thus successive BACK
8203    commands switch back and forth between two directories.
8204
8205 4.5.2.1. Parsing Improvements
8206
8207    The CD command, as well as other commands that parse a directory name,
8208    were changed in 7.0 to provide all the expected functions: completion
8209    on Tab or Esc, directory-name lists on ?, etc. Other affected commands
8210    include SET SERVER GET-PATH, SET TEMP-DIRECTORY, SET FILE
8211    DOWNLOAD-DIRECTORY, and SPACE. CD and REMOTE CD also now work with
8212    logical names.
8213
8214    In VMS, the situation is a bit complicated since a directory name can
8215    look like "DEV:", "[FOO.BAR]", "DEV:[FOO.BAR]", "[FOO]BAR.DIR;1", etc.
8216    Completion and ?-help might not always work, but they do in many cases.
8217    Examples:
8218
8219   cd ?           Lists all subdirectories of the current directory
8220   cd []?         Ditto
8221   cd k?          Ditto, but only those starting with K
8222   cd [foo]?      Lists all subdirectories of the [FOO] directory
8223   cd [-]?        Lists all subdirectories of the superior directory
8224   cd [--]?       Lists all subdirectories of the directory 2 levels up
8225   cd [...]?      Lists all directories below the current one
8226   cd [foo.?      Does not work.
8227
8228    C-Kermit allows all of the following in VMS:
8229
8230   cd bar         CD to subdirectory BAR of the current directory
8231   cd .bar        Ditto
8232   cd [.bar]      Ditto
8233   cd bar.dir     etc...
8234   cd bar.dir;
8235   cd bar.dir;1
8236   cd [foo.bar]
8237   cd <foo.bar>
8238   cd bar.baz     This can go more than 1 level deep...
8239   cd dir:        (where logical name DIR is defined as [FOO.BAR])
8240
8241    As well as the following:
8242
8243   cd ..          Go up one level as in UNIX
8244   cd .           The current directory
8245   cd             My login directory
8246
8247    Note that "cd -" (go up one level) does not work as expected, because
8248    "-" is Kermit's command continuation character. However, "cd [-]", and
8249    "
8250    cd {-}" have the desired effect (and so does "cd ..", which is easier
8251    to type).
8252
8253 4.5.2.2. The CDPATH
8254
8255    The CD command in the UNIX, Windows, OS/2, and VMS versions of
8256    C-Kermit, as of version 6.1 / 1.1.12, searches the CDPATH for the given
8257    directory, if it is not absolute and if a CDPATH environment variable
8258    is defined. Example (in UNIX ksh or bash):
8259
8260   $ export CDPATH=$HOME:$HOME/kermit:/tmp
8261
8262    Now if you give a "cd xxx" command, no matter what your current
8263    directory is, if the "xxx" directory is not a subdirectory of your
8264    current directory, then the xxx subdirectory of your home directory is
8265    used or if that does not exist, then the xxx subdirectory of the kermit
8266    subdirectory of your home directory is used or if that does not exist,
8267    then /tmp/xxx is used. This is how the ksh "cd" command works, and now
8268    the C-Kermit CD command works the same way.
8269
8270    In VMS, you can define CDPATH to be a list of directories that contain
8271    actual directory delimiters, and/or logical names representing
8272    directories, using commas to separate them, e.g.:
8273
8274   $ define cdpath [HOME],[SOMEOTHERDIR],[HOME.MISC]
8275   $ define cdpath SYS$LOGIN:,DISK1:[HOME],DISK2:[SCRATCH.IVAN]
8276
8277    Example:
8278
8279   $ define cdpath SYS$LOGIN:,[IVAN],[OLAF],[OLGA.MISC]
8280   $ kermit
8281   DISK1:[OLGA] C-Kermit> cd blah
8282
8283    tries the BLAH subdirectory of the user's login directory, then
8284    [OLGA.BLAH], [IVAN.BLAH], [OLAF.BLAH], and [OLGA.MISC.BLAH], in that
8285    order, using the first one it finds, failing if it finds none.
8286
8287    In C-Kermit 7.0, you may also set the CDPATH from the Kermit prompt:
8288
8289    SET CD PATH path
8290           Allows the CD PATH to be set from within C-Kermit.
8291
8292    SHOW CD shows the CD path and all other information relevant to the CD
8293    command.
8294
8295 4.5.2.3. CD Messages
8296
8297    Whenever you change directory, you can have C-Kermit display a "Read
8298    Me" file from the new directory automatically. The commands are:
8299
8300    SET CD MESSAGE { ON, OFF, FILE list }
8301           ON enables this feature; OFF (the default) disables it. File
8302           lets you specify the name of the "Read Me" file. A list of names
8303           to look for can be given in the following format:
8304
8305   {{name1}{name2}{name3}{...}}
8306
8307           e.g.:
8308
8309   SET SERVER CD-MESSAGE FILE {{./.readme}{README.TXT}{READ.ME}}
8310
8311           The default list of CD-message files is system dependent.
8312
8313    SHOW CD shows your current directory, previous directory, CD path, and
8314    CD message info.
8315
8316 4.5.3. Creating and Removing Directories
8317
8318    The MKDIR command now allows you to create multiple directories at
8319    once:
8320
8321   C-Kermit> mkdir a/b/c/d
8322
8323    creates the directory a in the current directory (if it doesn't exist
8324    already), and then creates subdirectory b in the a directory (if it
8325    didn't exist already), and so on.
8326
8327    If you use MKDIR to try to create a directory that already exists,
8328    C-Kermit will print a warning ("?Directory already exists"), but the
8329    MKDIR command will still succeed. If you want to avoid the warning
8330    message, use IF DIRECTORY first to check if the directory already
8331    exists.
8332
8333    The RMDIR command, however, will not remove more than one directory,
8334    nor will it remove a directory that contains any files. (There is, as
8335    yet, no RMDIR /RECURSIVE command, although one might be added later.)
8336
8337    In VMS, these commands (like CD) are more forgiving of your syntax than
8338    is the DCL command shell; "mkdir oofa" is equivalent to "mkdir [.oofa]"
8339    and so on. Also in VMS, you'll find that C-Kermit's RMDIR command is
8340    easier than deleting a directory in DCL, since it automatically first
8341    gives it owner delete permission if you are the owner.
8342
8343 4.5.4. The DELETE and PURGE Commands
8344
8345    The DELETE command now offers a selection of switches, and has a new
8346    companion, the PURGE command. First, DELETE:
8347
8348    DELETE [ switches... ] filespec
8349           Deletes the file or files that match the filespec, which may
8350           contain wildcards ([476]Section 4.9).
8351
8352    Optional switches include the standard file-selection switches
8353    presented in [477]Section 1.5.4, plus:
8354
8355    /ASK
8356           Before deleting each file, ask permission interactively. Answers
8357           are Yes or OK (delete the file), No (don't delete it), or Quit
8358           (stop executing the DELETE command).
8359
8360    /NOASK
8361           Don't ask permission to delete each file.
8362
8363    /LIST
8364           List each file and show whether it was deleted. Synonyms: /LOG,
8365           /VERBOSE.
8366
8367    /NOLIST
8368           Don't list files while deleting them. Synonyms: /NOLOG, /QUIET.
8369
8370    /HEADING
8371           Print a heading and summary line.
8372
8373    /NOHEADING
8374           Don't print a heading and summary line.
8375
8376    /PAGE
8377           When listing, pause at the end of each screenful and give the
8378           "More?" prompt. If you reply "n" (no), the DELETE command
8379           terminates.
8380
8381    /SIMULATE
8382           Do everything implied by the given switches and filespec, except
8383           do not actually delete any files. This lets you preview which
8384           files would be deleted; implies /LIST.
8385
8386    Now the PURGE command:
8387
8388    PURGE [ switches... ] [ filespec ]
8389           (VMS only) Runs the DCL PURGE command. Switches and filespec, if
8390           any, are passed directly to DCL without parsing or verification.
8391           Deletes excess versions of the given (or all) files. The rest of
8392           this section does not apply to VMS.
8393
8394    PURGE [ switches... ] [ filespec ]
8395           (UNIX only) Deletes "backup files" that match the filespec,
8396           which may contain wildcards ([478]Section 4.9). If no filespec
8397           is given, all backup files in the current directory are selected
8398           (subject to modification by any switches). Do not include backup
8399           notation in the filespec.
8400
8401    Explanation:
8402
8403    To avoid destroying preexisting files when a new file arrives that has
8404    the same name, C-Kermit backs up the old file by appending a "backup
8405    number" to its name. In UNIX, the backup suffix consists of a period, a
8406    tilde, a number, and another tilde. For example, if a file called
8407    oofa.txt exists and a new oofa.txt file arrives, the original is
8408    renamed to oofa.txt.~1~. If another oofa.txt file arrives, the existing
8409    one is renamed to oofa.txt.~2~. And so on. This system is compatible
8410    with the one used by EMACS. Thus over time, if you receive a lot of
8411    files with C-Kermit or edit them with EMACS, backup files can build up.
8412    The new PURGE command lets you clean out accumulated backup files:
8413
8414    Optional switches include the standard file-selection switches
8415    presented in [479]Section 1.5.4, plus all the switches listed above for
8416    the DELETE command, plus:
8417
8418    /KEEP:n
8419           Retains the n most recent (highest-numbered) backup files for
8420           each file. For example, if oofa.txt, oofa.txt.~1~, oofa.txt.~2~,
8421           oofa.txt.~10~, oofa.txt.~12~, and oofa.txt.~100~ exist, "purge
8422           /keep:2 oofa.txt" deletes oofa.txt.~1~, oofa.txt.~2~, and
8423           oofa.txt.~10~, and keeps oofa.txt, oofa.txt.~12~, and
8424           oofa.txt.~100~. If /KEEP is given without a number, one (the
8425           highest numbered) backup file is kept.
8426
8427    CAUTION: The PURGE command should be used only when *.~*~ files truly
8428    are backup files. This is the case for EMACS, and it is the DEFAULT for
8429    C-Kermit. However, if C-Kermit's FILE COLLISION has been set to RENAME,
8430    newly received files will look like backup files. In that case, don't
8431    use the PURGE command or you'll be removing new files rather than old
8432    ones. (Use SHOW FILE to find the FILE COLLISION setting.)
8433
8434    The PURGE command is presently available only in UNIX. The command
8435    succeeds if it deleted any files, or if it deleted no files but there
8436    were no errors. It fails if it deleted no files and there were errors
8437    (i.e. deletion was attempted but failed). In VMS, backup file versions
8438    are handled automatically by the OS, and a PURGE command can be used at
8439    the VMS prompt to clean them up.
8440
8441    If you want certain switches to be supplied automatically with each
8442    DELETE or PURGE command, you can set them with SET OPTIONS
8443    ([480]Section 1.5.5) and you can display any such settings with SHOW
8444    OPTIONS. Of course you can override them on a per-command basis by
8445    including switches in your PURGE or DELETE command.
8446
8447    Also see SET FILE COLLISION, SHOW FILE, SEND /NOBACKUP, SET SEND
8448    BACKUP, and DIRECTORY /[NO]BACKUP.
8449
8450 4.6. Starting the Remote Kermit Server Automatically
8451
8452    As noted on pages 275-276 of [481]Using C-Kermit 2nd edition, you can
8453    have Kermit send "kermit receive" commands automatically when it is in
8454    local mode and you give a SEND or similar command, to start the remote
8455    Kermit receiver in case it is not already started. The "kermit receive"
8456    commands are specified by:
8457
8458   SET PROTOCOL KERMIT binary-receive-command text-receive-command
8459
8460    As of version 7.0, a Kermit protocol option has been added to send a
8461    string to the host in advance of any Kermit packets when you give a
8462    GET-class or REMOTE command. This will switch the remote C-Kermit into
8463    the appropriate mode or, if the remote system is at a system command
8464    (shell) prompt, execute the string on the remote system. The new syntax
8465    of the SET PROTOCOL KERMIT command is:
8466
8467   SET PROTOCOL KERMIT [ s1 [ s2 [ s3 ] ] ]
8468
8469    where:
8470
8471        Default         Meaning
8472   s1  {kermit -ir}     Remote "kermit receive in binary mode" command.
8473   s2  {kermit -r}      Remote "kermit receive in text mode" command.
8474   s3  {kermit -x}      Remote "start kermit server" command.
8475
8476    NOTE: If the remote Kermit is 6.0, the following are recommended for
8477    fast startup and high-performance file transfer (see Appendix I in
8478    [482]Using C-Kermit, second Edition, for command-line options):
8479
8480   s1   kermit -YQir   (Kermit receive binary, skip init file, fast.)
8481   s2   kermit -YQTr   (Kermit receive text, skip init file, fast.)
8482   s3   kermit -YQx    (Kermit server, skip init file, fast.)
8483
8484    If the remote is C-Kermit 7.0 or later, change the -x option (enter
8485    server mode) to -O (uppercase letter O), which means "enter server mode
8486    for One transaction only); this way, it is not stuck in server after
8487    the transfer. Also note that the Q is redundant in version 7.0, since
8488    fast Kermit protocol settings are now the default.
8489
8490    Note that in case the C-Kermit executable is called "wermit" or
8491    "ckermit" you can change "kermit" in the strings above to "wermit" or
8492    "ckermit" and C-Kermit 7.0 or later will recognize these as synonyms
8493    for "kermit", in case it is at its command prompt when one of these
8494    strings is sent to it.
8495
8496 4.7. File-Transfer Command Switches
8497
8498    Over the years, various new methods of transferring a file have
8499    accumulated, until we had, in addition to the SEND command, also MOVE
8500    (send and then delete), MAIL (send as email), REMOTE PRINT (send to be
8501    printed), CSEND (send the output of a command), PSEND (send a part of a
8502    file), BSEND (send in binary mode), RESEND (resume an interrupted
8503    SEND), etc etc. Similarly: GET, REGET, CGET, RETRIEVE, and so on.
8504
8505    Not only is it confusing to have different names for these commands,
8506    many of which are not real words, but this also does not allow all
8507    combinations, like "send a file as mail, then delete it".
8508
8509    In C-Kermit 7.0, the SEND, GET, and RECEIVE commands were restructured
8510    to accept modifier switches (switches are explained in [483]Section
8511    1.5).
8512
8513 4.7.1. SEND Command Switches
8514
8515    Without switches, the SEND command still works exactly as before:
8516
8517   send oofa.txt      ; send a single file
8518   send oofa.*        ; send multiple files
8519   send oofa.txt x.x  ; send oofa.txt as x.x (tell receiver its name is x.x)
8520   send               ; send from SEND-LIST
8521
8522    But now the following modifier switches may be included between "send"
8523    and the filename. Zero, one, two, or more switches may be included in
8524    any combination that makes sense. Switch names (such as /BINARY) can be
8525    abbreviated, just like any other keywords. Most of these switches work
8526    only when using Kermit protocol (/TEXT and /BINARY are the exceptions).
8527
8528    /AFTER:date-time
8529           Specifies that only those files modified (or, in VMS, created)
8530           after the given date-time (see [484]Section 1.6) are to be sent.
8531           Examples:
8532
8533   send /text /after:{2-Feb-1997 10:28:30} *.txt
8534   send /text /after:\fdate(oofa.txt) *.txt
8535
8536           Synonym: /SINCE.
8537
8538    /ARRAY:arrayname
8539           Specifies that instead of sending a file, C-Kermit is to send
8540           the contents of the given array. Since an array does not have a
8541           filename, you should include an /AS-NAME switch to specify the
8542           name under which the array is to be sent (if you do not, the
8543           name "_array_x_" is used, where 'x' is replaced by the array
8544           designator). See [485]section 7.10 for array-name syntax. As
8545           noted in that section, you can also include a range to have a
8546           segment of the array sent, rather than the whole thing; for
8547           example: "send /array:&a[100:199]". It is strongly recommended
8548           that you accompany the /ARRAY switch with a /TEXT or /BINARY
8549           switch to force the desired transfer mode, since otherwise the
8550           various automatic mechanisms might switch to binary mode when
8551           you really wanted text, or vice versa. In text mode a line
8552           terminator is added to the end of each array element, but not in
8553           binary mode. For details and examples see [486]Section 7.10.11.
8554
8555    /AS-NAME:text
8556           Specifies "text" as the name to send the file under. You can
8557           also still specify the as-name as the second filename on the
8558           SEND command line. The following two commands are equivalent:
8559
8560   send oofa.txt oofa.new
8561   send /as:oofa.new oofa.txt
8562
8563    /BEFORE:date-time
8564           Specifies that only those files modified (or, in VMS, created)
8565           before the given date-time ([487]Section 1.6) are to be sent.
8566
8567    /BINARY
8568           Performs this transfer in binary mode without affecting the
8569           global transfer mode, overriding not only the FILE TYPE and
8570           TRANSFER MODE settings, but also the FILE PATTERN setting, but
8571           for this SEND command only. In other words, SEND /BINARY means
8572           what it says: send the file in binary mode, regardless of any
8573           other settings. Example:
8574
8575   set file type text      ; Set global transfer mode to text
8576   send /binary oofa.zip   ; Send a file in binary
8577   send oofa.txt           ; This one is sent in text mode
8578
8579    /COMMAND
8580           SEND /COMMAND is equivalent to CSEND ([488]Section 4.2.2) -- it
8581           says to send the output from a command, rather than the contents
8582           of a file. The first "filename" on the SEND command line is
8583           interpreted as the name of a command; the second (if any) is the
8584           as-name. Examples:
8585
8586   send /command {grep Sunday oofa.txt} sunday.txt
8587   send /as-name:sunday.txt /command {grep Sunday oofa.txt}
8588   send /bin /command {tar cf - . | gzip -c} {!gunzip -c | tar xf -}
8589
8590    /DELETE
8591           Deletes the file (or each file in the group) after it has been
8592           sent successfully (but does not delete it if it was not sent
8593           successfully). SEND /DELETE is equivalent to MOVE. Has no effect
8594           when used with /COMMAND. Example:
8595
8596   send /delete *.log
8597
8598    /DOTFILES
8599           (UNIX and OS-9 only) Normally files whose names begin with "."
8600           are skipped when matching wildcards that do not also beging with
8601           ".". Include /DOTFILES to force these files to be included too.
8602
8603    /RECURSIVE
8604           Descend the through the directory tree when locating files to
8605           send. Automatically sets /PATHNAMES:RELATIVE. Explained in
8606           [489]Section 4.11 .
8607
8608    /EXCEPT:pattern
8609           See [490]Section 1.5.4.
8610
8611    /NOBACKUP
8612           This means to skip backup files when sending, even if they match
8613           the SEND file specification. This is equivalent to using SEND
8614           /EXCEPT and including *.~[0-9]*~ in the exception list (or *.~*~
8615           if Kermit was built without pattern-matching support; see
8616           [491]Section 4.9.1). Including this switch is equivalent to
8617           giving SET SEND BACKUP OFF ([492]Section 4.0.6) prior to SEND,
8618           except its effect is local to the SEND command with which it was
8619           given.
8620
8621    /NODOTFILES
8622           The opposite of /DOTFILES (q.v.)
8623
8624    /FILENAMES:{CONVERTED,LITERAL}
8625           Use this switch to override the current global SET FILE NAMES
8626           setting for this transfer only.
8627
8628    /FILTER:command
8629           This specifies a filter to pass the file through before sending
8630           it. See the [493]section on file-transfer pipes and filters. The
8631           /FILTER switch applies only to the file-transfer command it is
8632           given with; it does not affect the global SEND FILTER setting,
8633           if any.
8634
8635    /IMAGE
8636           VMS: Sends in image mode. Non-VMS: same as /BINARY.
8637
8638    /LABELED
8639           VMS and OS/2 only: Sends in labeled mode.
8640
8641    /LARGER-THAN:number
8642           Specifies that only those files that are longer than the given
8643           number of bytes are to be sent.
8644
8645    /LISTFILE:filename
8646           Specifies that the files to be sent are listed in a file with
8647           the given filename. The file contains one filename per line.
8648           These filenames are not checked in any way; each filename is
8649           taken and does not use or depend on any Kermit-specific syntax.
8650           In particular, backslashes are not treated specially, leading
8651           and trailing spaces are not stripped, etc. However, if a
8652           filename contains wildcards, they are expanded. Example: If a
8653           file named files.txt contains the following lines:
8654
8655   blah.txt
8656   oofa*
8657   x.x
8658
8659           (but without leading or trailing spaces), then the C-Kermit
8660           command "send /listfile:files.txt" will send the files blah.txt,
8661           x.x, and all files whose names start with "oofa", assuming the
8662           files exist and are readable. The /LISTFILE switch, can, of
8663           course, be used with other switches when it makes sense, for
8664           example, /EXCEPT, /BINARY, /AFTER, /SMALLER, /MOVE-TO, /DELETE,
8665           /AS-NAME with a template, etc.
8666
8667    /MAIL:address
8668           Sends the file as e-mail to the given address or addresses.
8669           "send /mail:address filename" is equivalent to "mail filename
8670           address". You can include multiple addresses separated by
8671           commas. Examples:
8672
8673   send /mail:kermit-support@columbia.edu packet.log
8674   send /mail:cmg,fdc,jrd oofa.txt
8675
8676           As with any switch argument, if the address or address list
8677           contains any spaces, you must enclose it in braces. The format
8678           of the addresses must agree with that understood by the
8679           mail-sending program on the receiver's computer.
8680
8681    /MOVE-TO:directory-name
8682           Specifies that after each (or the only) source file is sent
8683           successfully, and ONLY if it is sent successfully, it should be
8684           moved to the named directory. If the directory name contains
8685           spaces, enclose it in braces. If the directory does not exist,
8686           it is created if possible; if it can't be created, the command
8687           fails and an error message is printed. Example:
8688
8689   send /text /move-to:/users/olga/backup/ *.txt
8690
8691    /NOT-AFTER:date-time
8692           Specifies that only those files modified at or before the given
8693           date and time are to be sent.
8694
8695    /NOT-BEFORE:date-time
8696           Specifies that only those files modified at or after the given
8697           date and time are to be sent.
8698
8699    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE}
8700           Use this switch to override the current global SET SEND
8701           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE or
8702           RELATIVE also sets /FILENAMES:LITERAL (also for this transfer
8703           only) since pathnames are not sent otherwise.
8704
8705    /RENAME-TO:text
8706           Specifies that after the (or each) source file is sent
8707           successfully, and ONLY if it is sent successfully, it should be
8708           renamed to the name given. If the name contains spaces, enclose
8709           it in braces. If a file group is being sent, then the "text"
8710           must contain a variable reference such as \v(filename) (see
8711           [494]Section 4.1). Example:
8712
8713   send /rename-to:ok_\v(filename) *.*
8714
8715           This sends each file in the current directory and if it was sent
8716           successfully, changes its name to begin with "ok_".
8717
8718    /SMALLER-THAN:number
8719           Specifies that only those files that are smaller than the given
8720           number of bytes are to be sent.
8721
8722    /SUBJECT:text
8723           Subject for email. Actually, this is just a synonym for
8724           /AS-NAME. If the text includes spaces, you must enclose it in
8725           braces. If you don't specify a subject (or as-name), the name of
8726           the file is used as the subject. Example:
8727
8728   send /mail:kermit-support@columbia.edu /subj:{As requested} packet.log
8729
8730    /PRINT:options
8731           Sends the file to be printed, optionally specifying options for
8732           the printer. Equivalent to REMOTE PRINT filename options.
8733           Examples:
8734
8735   send /print oofa.txt              ; No options.
8736   send /print:/copies=3 oofa.txt    ; "/copies=3" is a VMS PRINT switch.
8737   send /print:-#3 oofa.txt          ; "-#3" is a UNIX lpr switch.
8738
8739    /PROTOCOL:name
8740           Uses the given protocol to send the file (Kermit, Zmodem, etc)
8741           for this transfer without changing global protocol. Only
8742           available in Kermit 95, UNIX, and OS-9. Example:
8743
8744   set protocol kermit               ; Set global protocol
8745   send /proto:zmodem /bin oofa.zip  ; Send just this file with Zmodem
8746   send oofa.txt                     ; This file is sent with Kermit
8747
8748    /QUIET
8749           When sending in local mode, this suppresses the file-transfer
8750           display.
8751
8752    /RECOVER
8753           Used to recover from a previously interrupted transfer; SEND
8754           /RECOVER is equivalent to RESEND. Recovery only works in binary
8755           mode; SEND /RECOVER and RESEND include an implied /BINARY
8756           switch. Even then, recovery will successful only if (a) the
8757           original (interrupted) transfer was also in binary mode, or (b)
8758           if it was in text mode, the two Kermit programs run on platforms
8759           where text-mode transfers are not length-changing.
8760
8761    /STARTING:number
8762           Starts sending the file from the given byte position. SEND
8763           /STARTING:n filename is equivalent to PSEND filename n.
8764
8765    /TEXT
8766           Performs this transfer in text mode without affecting the global
8767           transfer mode, overriding not only the FILE TYPE and TRANSFER
8768           MODE settings, but also the FILE PATTERN setting, for this SEND
8769           command only. In other words, SEND /TEXT really send the file in
8770           text mode, regardless of any other settings or negotiations.
8771
8772    About mail... Refer to [495]Section 4.7.1. The same rules apply as for
8773    file transfer. If you are mailing multiple files, you can't use an
8774    as-name (in this case, a subject) unless it contains replacement
8775    variables like \v(filenum). For example, if you:
8776
8777   send /mail:somebody@xyz.com *.txt
8778
8779    Then each file will arrive as a separate email message with its name as
8780    the subject. But if you:
8781
8782   send /mail:somebody@xyz.com /subject:{Here is a file} *.txt
8783
8784    Then each file message will have the same subject, which is probably
8785    not what you want. You can get around this with constructions like:
8786
8787   send /mail:somebody@xyz.com /subject:{Here is \v(filename)} *.txt
8788
8789    which embed the filename in the subject.
8790
8791    The MOVE, CSEND, MAIL, and RESEND commands now also accept the same
8792    switches. And the switches are also operative when sending from a
8793    SEND-LIST (see [496]Using C-Kermit, 2nd Ed, pp.191-192), so, for
8794    example, it is now possible to SEND /PRINT or SEND /MAIL from a
8795    SEND-LIST.
8796
8797    The MSEND and MMOVE commands also take switches, but not all of them.
8798    With these commands, which take an arbitrary list of filespecs, you can
8799    use /BINARY, /DELETE, /MAIL, /PRINT, /PROTOCOL, /QUIET, /RECOVER, and
8800    /TEXT (and /IMAGE or /LABELED, depending on the platform). MMOVE is
8801    equivalent to MSEND /DELETE. (If you want to send a group of files, but
8802    in mixed transfer modes with per-file as-names, use ADD SEND-LIST and
8803    then SEND.)
8804
8805    The MSEND/MMOVE switches come before the filenames, and apply to all of
8806    them:
8807
8808   msend /print /text *.log oofa.txt /etc/motd
8809
8810    If you type any of these commands (SEND, CSEND, MSEND, etc) followed by
8811    a question mark (?), you will see a list of the switches you can use.
8812    If you want to see a list of filenames, you'll need to type something
8813    like "send ./?" (UNIX, OS/2, Windows, etc), or "send []?" (VMS), etc.
8814    Of course, you can also type pieces of a filename (anything that does
8815    not start with "/") and then "?" to get a list of filenames that start
8816    that way; e.g. "send x.?" still works as before.
8817
8818    In UNIX, where "/" is also the directory separator, there is usually no
8819    ambiguity between a fully-specified pathname and a switch, except when
8820    a file in the root directory has the same name as a switch (as noted in
8821    [497]Section 1.5):
8822
8823   send /etc/motd                        ; Works as expected
8824   send /command                         ; ???
8825
8826    The second example interprets "/command" as a switch, not a filename.
8827    To send a file actually called "command" in the root directory, use:
8828
8829   send {/command}
8830
8831    or other system-dependent forms such as //command, /./command,
8832    c:/command, etc, or cd to / and then "send command".
8833
8834 4.7.2. GET Command Switches
8835
8836    Without switches, the GET command still works about the same as before:
8837
8838   get oofa.txt                          ; GET a single file
8839   get oofa.*                            ; GET multiple files
8840
8841    However, the mechanism for including an "as-name" has changed.
8842    Previously, in order to include an as-name, you were required to use
8843    the "multiline" form of GET:
8844
8845   get
8846   remote-filespec
8847   local-name
8848
8849    This was because the remote filespec might contain spaces, and so there
8850    would be no good way of telling where it ended and where the local name
8851    began, e.g:
8852
8853   get profile exec a foo
8854
8855    But now since we can use {braces} for grouping, we don't need the
8856    multiline GET form any more, and in fact, support for it has been
8857    removed. If you give a GET command by itself on a line, it fails and an
8858    error message is printed. The new form is:
8859
8860    GET [ switches... ] remote-name [ local-name ]
8861           Ask the server to send the file whose name is remote-name. If
8862           the optional local-name is given, store it locally under this
8863           name. If the remote-name or local-name contains spaces, they
8864           must be enclosed in braces:
8865
8866   get {profile exec a} foo
8867   get oofa.txt {~/My Files/Oofa text}
8868
8869    If you want to give a list of remote file specifications, use the MGET
8870    command:
8871
8872    MGET [ switches... ] remote-name [ remote-name [ remote-name ... ] ]
8873           Ask the server to send the files whose names are given.
8874
8875    Now you can also include modifier switches between GET or MGET and the
8876    remote-name; most of the same switches as SEND:
8877
8878    /AS-NAME:text
8879           Specifies "text" as the name to store the incoming file under.
8880           (This switch is not available for MGET.) You can also still
8881           specify the as-name as the second filename on the GET command
8882           line. The following two commands are equivalent:
8883
8884   get oofa.txt oofa.new
8885   get /as:oofa.new oofa.txt
8886
8887    /BINARY
8888           Tells the server to send the given file(s) in binary mode
8889           without affecting the global transfer mode. Example:
8890
8891   set file type text      ; Set global transfer mode to text
8892   get /binary oofa.zip    ; get a file in binary mode
8893   get oofa.txt            ; This one is transferred in text mode
8894
8895           Or, perhaps more to the point:
8896
8897   get /binary foo.txt     ; where "*.txt" is a text-pattern
8898
8899           This has the expected effect only if the server is C-Kermit 7.0
8900           or later or K95 1.1.19 or later.
8901
8902    /COMMAND
8903           GET /COMMAND is equivalent to CGET ([498]Section 4.2.2) -- it
8904           says to receive the file into the standard input of a command,
8905           rather than saving it on disk. The /AS-NAME or the second
8906           "filename" on the GET command line is interpreted as the name of
8907           a command. Examples:
8908
8909   get /command sunday.txt {grep Sunday oofa.txt}
8910   get /command /as-name:{grep Sunday oofa.txt} sunday.txt
8911   get /bin /command {!gunzip -c | tar xf -} {tar cf - . | gzip -c}
8912
8913    /DELETE
8914           Asks the Kermit server to delete the file (or each file in the
8915           group) after it has been transferred successfully (but not to
8916           delete it if it was not sent successfully). GET /DELETE is
8917           equivalent to RETRIEVE. Example:
8918
8919   get /delete *.log
8920
8921    /EXCEPT:pattern
8922           Specifies that any files whose names match the pattern, which
8923           can be a regular filename, or may contain "*" and/or "?"
8924           metacharacters, are to be refused upon arrival. To specify
8925           multiple patterns (up to 8), use outer braces around the group,
8926           and inner braces around each pattern:
8927
8928   /EXCEPT:{{pattern1}{pattern2}...}
8929
8930           See the description of SEND /EXCEPT in [499]Section 4.7.1 for
8931           examples, etc. Refusal is accomplished using the Attribute
8932           Rejection mechanism (reason "name"), which works only when
8933           Attribute packets have been successfully negotiated.
8934
8935    /FILENAMES:{CONVERTED,LITERAL}
8936           Use this switch to override the current global SET FILE NAMES
8937           setting for this transfer only.
8938
8939    /FILTER:command
8940           This specifies a filter to pass the incoming file through before
8941           writing to disk. See the [500]section on file-transfer pipes and
8942           filters. The /FILTER switch applies only to the file-transfer
8943           command it is given with; it does not affect the global RECEIVE
8944           FILTER setting, if any.
8945
8946    /IMAGE
8947           VMS: Transfer in image mode. Non-VMS: same as /BINARY.
8948
8949    /LABELED
8950           VMS and OS/2 only: Specifies labeled transfer mode.
8951
8952    /MOVE-TO:directory
8953           This tells C-Kermit to move each file that is successfully
8954           received to the given directory. Files that are not successfully
8955           received are not moved. By default, files are not moved.
8956
8957    /PATHNAMES:{OFF,ABSOLUTE,RELATIVE,AUTO}
8958           Use this switch to override the current global SET RECEIVE
8959           PATHNAMES setting for this transfer only. /PATHNAMES:ABSOLUTE or
8960           RELATIVE also sets /FILENAMES:LITERAL (also for this transfer
8961           only) since incoming pathnames would not be treated as pathnames
8962           otherwise. See [501]Section 4.10.
8963
8964    /QUIET
8965           When sending in local mode, this suppresses the file-transfer
8966           display.
8967
8968    /RECOVER
8969           Used to recover from a previously interrupted transfer; GET
8970           /RECOVER is equivalent to REGET. Recovery only works in binary
8971           mode; SEND /RECOVER and RESEND include an implied /BINARY
8972           switch. Even then, recovery will successful only if (a) the
8973           original (interrupted) transfer was also in binary mode, or (b)
8974           if it was in text mode, the two Kermit programs run on platforms
8975           where text-mode transfers are not length-changing.
8976
8977    /RECURSIVE
8978           Tells the server that the GET file specification applies
8979           recursively. This switch also automatically sets
8980           /PATHNAMES:RELATIVE in both the server AND the client. When used
8981           in conjunction with /DELETE, this "moves" a directory tree from
8982           the server's computer to the client's computer (except that only
8983           regular files are deleted from the server's computer, not
8984           directories; thus the original directories will be left, but
8985           will contain no files). Note that all servers that support
8986           /RECURSIVE do not necessarily do so in combination with other
8987           switches, such as /RECOVER. (Servers that do include C-Kermit
8988           7.0 and later, K95 1.1.19 and later.)
8989
8990    /RENAME-TO:string
8991           This tells C-Kermit to rename each file that is successfully
8992           received to the given string. Files that are not successfully
8993           received are not renamed. By default, files are not renamed. The
8994           string can be a literal string, which is appropriate when only
8995           one file is being received, or it can contain one or more
8996           variables that are to be evaluated at the time each file is
8997           received, such as \v(filename), \v(filenumber), \v(ntime),
8998           \v(pid), \v(user), etc. WARNING: if you give a literal string
8999           and more than one file arrives, each incoming file will be given
9000           the same name (but SET FILE COLLISION BACKUP or RENAME can be
9001           used to keep the incoming files from overwriting each other).
9002
9003    /TEXT
9004           Tells the server to perform this transfer in text mode without
9005           affecting its global transfer mode. See /BINARY for additional
9006           info.
9007
9008    The /MAIL and /PRINT options are not available (as they are for SEND),
9009    but you can use /COMMAND to achieve the same effect, as in these UNIX
9010    examples:
9011
9012   get /command oofa.txt {mail kermit@columbia.edu}
9013   get /command oofa.txt lpr
9014
9015    In OS/2 or Windows, you can GET and print like this:
9016
9017   get oofa.txt prn
9018
9019    The CGET, REGET, RETRIEVE commands also accept the same switches as
9020    GET. CGET automatically sets /COMMAND; REGET automatically sets
9021    /RECOVER and /BINARY, and RETRIEVE automatically sets /DELETE.
9022
9023 4.7.3. RECEIVE Command Switches
9024
9025    Without switches, the RECEIVE command still works as before:
9026
9027   receive            ; Receives files under their own names
9028   receive /tmp       ; Ditto, but into the /tmp directory
9029   r                  ; Same as "receive"
9030   receive foo.txt    ; Receives a file and renames to foo.txt
9031
9032    Now you can also include modifier switches may be included between
9033    "receive" and the as-name; most of the same switches as GET:
9034
9035    /AS-NAME:text
9036           Specifies "text" as the name to store the incoming file under.
9037           You can also still specify the as-name as a filename on the
9038           command line. The following two commands are equivalent:
9039
9040   r oofa.new
9041   r /as:oofa.new
9042
9043    /BINARY
9044           Performs this transfer in binary mode without affecting the
9045           global transfer mode. NOTE: This does not override the incoming
9046           filetype (as it does with GET), so this switch is useful only if
9047           ATTRIBUTE TYPE is OFF, or if the other Kermit does not send a
9048           TYPE (text or binary) attribute. In any case, it has no affect
9049           whatsoever on the file sender.
9050
9051    /COMMAND
9052           RECEIVE /COMMAND is equivalent to CRECEIVE ([502]Section 4.2.2)
9053           -- it says to receive the file into the standard input of a
9054           command, rather than saving it on disk. The /AS-NAME or the
9055           "filename" on the RECEIVE command line is interpreted as the
9056           name of a command.
9057
9058   r /command {grep Sunday oofa.txt}
9059   r /command /as-name:{grep Sunday oofa.txt}
9060   r /bin /command {tar cf - . | gzip -c}
9061
9062    /EXCEPT:pattern
9063           Specifies that any files whose names match the pattern, which
9064           can be a regular filename, or may contain "*" and/or "?"
9065           metacharacters, are to be refused upon arrival. To specify
9066           multiple patterns (up to 8), use outer braces around the group,
9067           and inner braces around each pattern:
9068
9069   /EXCEPT:{{pattern1}{pattern2}...}
9070
9071           See the description of SEND /EXCEPT in [503]Section 4.7.1 for
9072           examples, etc. Refusal is accomplished using the Attribute
9073           Rejection mechanism (reason "name"), which works only when
9074           Attribute packets have been successfully negotiated.
9075
9076    /FILENAMES:{CONVERTED,LITERAL}
9077           Use this switch to override the current global SET FILE NAMES
9078           setting for this transfer only.
9079
9080    /FILTER:command
9081           This specifies a filter to pass the incoming file through before
9082           writing to disk. See the [504]section on file-transfer pipes and
9083           filters. The /FILTER switch applies only to the file-transfer
9084           command it is given with; it does not affect the global RECEIVE
9085           FILTER setting, if any.
9086
9087    /IMAGE
9088           VMS: Transfer in image mode. Non-VMS: same as /BINARY. See
9089           comments under RECEIVE /BINARY.
9090
9091    /LABELED
9092           VMS and OS/2 only: Specifies labeled transfer mode. See comments
9093           under RECEIVE /BINARY.
9094
9095    /MOVE-TO:directory
9096           This tells C-Kermit to move each file that is successfully
9097           received to the given directory. Files that are not successfully
9098           received are not moved. By default, files are not moved.
9099
9100    /PATHNAMES:{ABSOLUTE,RELATIVE,OFF,AUTO}
9101           Use this switch to override the current global SET RECEIVE
9102           PATHNAMES setting for this transfer only. See [505]Section 4.10.
9103
9104    /RECURSIVE
9105           When used with the RECEIVE command, /RECURSIVE is simply a
9106           synonym for /PATHNAMES:RELATIVE.
9107
9108    /RENAME-TO:string
9109           This tells C-Kermit to rename each file that is successfully
9110           received to the given string. Files that are not successfully
9111           received are not renamed. By default, files are not renamed. The
9112           string can be a literal string, which is appropriate when only
9113           one file is being received, or it can contain one or more
9114           variables that are to be evaluated at the time each file is
9115           received, such as \v(filename), \v(filenumber), \v(ntime),
9116           \v(pid), \v(user), etc. WARNING: if you give a literal string
9117           and more than one file arrives, each incoming file will be given
9118           the same name (but SET FILE COLLISION BACKUP or RENAME can be
9119           used to keep the incoming files from overwriting each other).
9120
9121    /QUIET
9122           When receiving in local mode, this suppresses the file-transfer
9123           display.
9124
9125    /TEXT
9126           Receives in text mode without affecting the global transfer
9127           mode. See comments under RECEIVE /BINARY.
9128
9129    The /MAIL and /PRINT options are not available, but you can use
9130    /COMMAND to achieve the same effect, as in these UNIX examples:
9131
9132   r /command {mail kermit@columbia.edu}
9133   r /command lpr
9134
9135    In OS/2 or Windows, you can RECEIVE and print like this:
9136
9137   receive prn
9138
9139    The CRECEIVE command now also accepts the same switches.
9140
9141 4.8. Minor Kermit Protocol Improvements
9142
9143 4.8.1. Multiple Attribute Packets
9144
9145    C-Kermit 7.0 now sends more than one Attribute packet if a file's
9146    attributes do not fit into a single packet of the negotiated length. If
9147    a particular attribute (such as file creation date-time) does not fit
9148    within the negotiated length (which will only happen when the
9149    negotiated length is around 20 or less), that attribute is not sent at
9150    all.
9151
9152 4.8.2. Very Short Packets
9153
9154    There are certain situations where extremely short packets must be
9155    used; 20 or 30 bytes at most. This can happen when one or more devices
9156    along the communication path have very small buffers and lack an
9157    effective means of flow control. Examples are sometimes cited involving
9158    radio modems.
9159
9160    When the maximum packet length is shorter than certain packets that
9161    would be sent, those packets are either truncated or else broken up
9162    into multiple packets. Specifically:
9163
9164     1. Parameter negotiation packets (I, S, and their ACKs) are truncated
9165        to the negotiated length. Any parameters that do not fit are reset
9166        to their default values. There is no provision in the Kermit
9167        protocol for fragmentation and reassembly of parameter strings.
9168     2. File header packets (containing the filename) are simply truncated.
9169        There is no provision in the Kermit protocol for fragmentation and
9170        reassembly of filenames.
9171     3. Attribute packets are fragmented and reassembled as described in
9172        4.8.1 without loss of data, except in case a field will not fit at
9173        all in the negotiated length (the longest attribute is usually the
9174        date and time of file creation/modification) because of the rule
9175        that attributes may not be broken across packets.
9176     4. Data packets and other packets are unaffected -- they can be as
9177        short as they need to be, within reason.
9178
9179 4.9. Wildcard / File Group Expansion
9180
9181    "Wildcard" refers to the notation used in filenames to specify a group
9182    of files by pattern matching.
9183
9184 4.9.1. In UNIX C-Kermit
9185
9186    Prior to C-Kermit 7.0, C-Kermit was capable of expanding wildcard
9187    strings containing only the "metacharacters" '*' and '?':
9188
9189    *
9190           Matches any sequence of zero or more characters. For example:
9191           "ck*.c" matches all files whose names start with "ck" and end
9192           with ".c", including "ck.c".
9193
9194    ?
9195           Matches any single character. For example, "ck?.c" matches all
9196           files whose names are exactly 5 characters long and start with
9197           "ck" and end with ".c". When typing commands at the prompt, you
9198           must precede any question mark to be used for matching by a
9199           backslash (\) to override the normal function of question mark,
9200           which is providing menus and file lists.
9201
9202    C-Kermit 7.0 adds the additional features that users of ksh, csh, and
9203    bash are accustomed to:
9204
9205    [abc]
9206           Square brackets enclosing a list of characters matches any
9207           single character in the list. Example: ckuusr.[ch] matches
9208           ckuusr.c and ckuusr.h.
9209
9210    [a-z]
9211           Square brackets enclosing a range of characters; the hyphen
9212           separates the low and high elements of the range. For example,
9213           [a-z] matches any character from a to z.
9214
9215    [acdm-z]
9216           Lists and ranges may be combined. This example matches a, c, d,
9217           or m through z.
9218
9219    {string1,string2,...}
9220           Braces enclose a list of strings to be matched. For example:
9221           ck{ufio,vcon,cmai}.c matches ckufio.c, ckvcon.c, or ckcmai.c.
9222           The strings may themselves contain metacharacters, bracket
9223           lists, or indeed, other lists of strings, but (when matching
9224           filenames) they may not contain directory separators.
9225
9226           Thus, the metacharacters in filenames (and in any other field
9227           that can be a pattern, such as the IF MATCH pattern, SEND or GET
9228           exception lists, etc) are:
9229
9230  * ? [ {
9231
9232           And within braces only, comma (,) is a metacharacter.
9233
9234    To include a metacharacter in a pattern literally, precede it with a
9235    backslash '\' (or two if you are passing the pattern to a macro).
9236    Examples:
9237
9238   send a*b      ; Send all files whose names start with 'a' and end with 'b'.
9239   send a?b      ; Ditto, but the name must be exactly three characters long.
9240   send a[a-z]b  ; Ditto, but the second character must be a lowercase letter.
9241   send a[x\-z]b ; Ditto, except the second character must be 'x', '-', or 'y'.
9242   send a[ghi]b  ; Ditto, except the second character must be 'g', 'h', or 'i'.
9243   send a[?*]b   ; Ditto, except the second character must be '?' or '*'.
9244   send a[\?\*]b ; Same as previous.
9245   send *?[a-z]* ; All files with names containing at least one character
9246                 ; that is followed by a lowercase letter.
9247
9248    Or, more practically:
9249
9250   send ck[cuw]*.[cwh]  ; Send the UNIX C-Kermit source files.
9251
9252    To refer to the C-Kermit sources files and makefile all in one
9253    filespec:
9254
9255   {{makefile,ck[cuw]*.[cwh]}}
9256
9257    (NOTE: if the entire pattern is a {stringlist}, you must enclose it it
9258    TWO pairs of braces, since the SEND command strips the outer brace
9259    pair, because of the "enclose in braces if the filename contains
9260    spaces" rule).
9261
9262    If the makefile is called ckuker.mak:
9263
9264   ck[cuw]*.{[cwh],mak}
9265
9266    (NOTE: double braces are not needed here since the pattern does not
9267    both begin and end with a brace.)
9268
9269    To add in all the C-Kermit text files:
9270
9271   ck[cuw]*.{[cwh],mak,txt}
9272
9273    All of these features can be used anywhere you would type a filename
9274    that is allowed to contain wildcards.
9275
9276    When you are typing at the command prompt, an extra level of quoting is
9277    required for the '?' character to defeat its regular function of
9278    producing a list of files that match what you have typed so far, for
9279    example:
9280
9281   send ck[cu]?
9282
9283    lists all the files whose names start with ckc and cku. If you quote
9284    the question mark, it is used as a pattern-matching character, for
9285    example:
9286
9287   send ck\?[ft]io.c
9288
9289    sends all the file and communications i/o modules for all the
9290    platforms: ckufio.c, ckutio.c, ckvfio.c, ckvtio.c, etc.
9291
9292    If, however, a filename actually contains a question mark and you need
9293    to refer to it on the command line, you must use three (3) backslashes.
9294    For example, if the file is actually called ck?fio.c, you would use:
9295
9296   send ck\\\?fio.c
9297
9298    Further notes on quoting:
9299
9300      * A single backslash is sufficient for quoting a special character at
9301        the command prompt or in a command file. However, when passing
9302        patterns to macros you'll need double backslashes, and when
9303        referring to these patterns within the macro, you'll need to use
9304        \fcontents(\%1) (see [506]Section 1.11.5). You should enclose macro
9305        argument references in braces in case grouped arguments were
9306        passed. Example:
9307  define ismatch {
9308      if match {\fcont(\%1)} {\fcont(\%2)} {
9309          end 0 MATCH
9310      } else {
9311          end 1 NO MATCH
9312      }
9313  }
9314  ismatch ab*yz a*\\**z           ; Backslash must be doubled
9315  ismatch {abc def xyz} *b*e*y*   ; Braces must be used for grouping
9316
9317      * Watch out for possible conflicts between {} in filename patterns
9318        and {} used for grouping multiple words into a single field, when
9319        the pattern has outer braces. For example, in:
9320      if match {abc xyz} {a* *z} echo THEY MATCH
9321
9322        braces must be used to group "abc xyz" into a single string. Kermit
9323        strips off the braces before comparing the string with the pattern.
9324        Therefore:
9325  if match makefile {makefile,Makefile} echo THEY MATCH
9326
9327        does not work, but:
9328  if match makefile {{makefile,Makefile}} echo THEY MATCH
9329
9330        does.
9331      * If you use a pattern that has outer braces, like {*.txt,*.doc}, in
9332        a field that accepts a pattern list (like SEND /EXCEPT:xxx), you'll
9333        need to add two extra sets of outer braces:
9334  send /except:{{{*.txt,*.doc}}} *.*
9335
9336    C-Kermit's new pattern matching capabilities are also used when
9337    C-Kermit is in server mode, so now you can send requests such as:
9338
9339   get ck[cuw]*.[cwh]
9340
9341    to a C-Kermit server without having to tell it to SET WILD SHELL first.
9342    Previously this would have required:
9343
9344   mget ckc*.c ckc*.w ckc*.h cku*.c cku*.w cku*.h ckw*.c ckw*.w ckw*.h
9345
9346    The new pattern matching features make SET WILD SHELL redundant, and
9347    barring any objections, it will eventually be phased out. (One possible
9348    reason for retaining it would be as an escape mechanism when Kermit
9349    does not understand the underlying file system.)
9350
9351    By the way, patterns such as these are sometimes referred to as
9352    "regular expressions", but they are not quite the same. In a true
9353    regular expression (for example), "*" means "zero or more repetitions
9354    of the previous item", so (for example), "([0-9]*)" would match zero or
9355    more digits in parentheses. In Kermit (and in most shells), this
9356    matches one digit followed by zero or more characters, within
9357    parentheses. Here are some hints:
9358
9359      * Although you can't match any sequence of digits (or letters, etc),
9360        you can match (say) 1, 2, or 3 of them in row. For example, the
9361        following pattern matches Kermit backup files (with backup numbers
9362        from 1 to 999):
9363  *.~{[1-9],[1-9][0-9],[1-9][0-9][0-9]}~
9364
9365      * There is presently no NOT operator, so no way to match any
9366        character or string EXCEPT the one(s) shown.
9367
9368    In other wildcarding news...
9369
9370      * You may now "send xxx" where "xxx" is a directory name, and this
9371        will send all the files from the directory xxx, as if you had typed
9372        "send xxx/*". You can also use the special shorthand "send ." to
9373        send all the files from the current directory.
9374      * To easily skip over backup files (the ones whose names end like
9375        .~22~) when sending, you can use SEND /NOBACKUP (see [507]Section
9376        4.0.6 for details).
9377      * When choosing Kermit to expand wildcards, rather than the shell,
9378        you can choose whether "dot files" -- files whose names begin with
9379        ".", which are normally "invisible" -- should be matched:
9380  SET WILD KERMIT /NO-MATCH-DOT-FILES (this is the default)
9381  SET WILD KERMIT /MATCH-DOT-FILES    (this allows matching of "." files)
9382
9383        or include the /DOTFILES or /NODOTFILES switch on the command you
9384        are using, such as SEND or DIRECTORY.
9385      * Commands such as DIRECTORY and SEND allow recursive directory
9386        traversal. There are also new functions for this to use in scripts.
9387        See [508]Section 4.11 for details.
9388
9389    When building file lists in UNIX, C-Kermit follows symbolic links.
9390    Because of this, you might encounter any or all of the following
9391    phenomena:
9392
9393      * Multiple copies of the same file; e.g. one from its real directory
9394        and others from links to its real directory, if both the real
9395        directory and the links to it are in the wildcard expansion list.
9396      * A command might unexpectedly "hang" for a long time because an NFS
9397        link might not be responding, or the directory you are looking at
9398        contains a link to a huge directory tree (example: "directory
9399        /recursive /etc" when /etc/spool is a symlink to /var/spool, which
9400        is a large organization's incoming email directory, containing tens
9401        of thousands of subdirectories).
9402
9403    The size of the file list that Kermit can build is limited in most
9404    C-Kermit implementations. The limit, if any, depends on the
9405    implementation. Use the SHOW FEATURES command and look in the
9406    alphabetized options list for MAXWLD to see the value.
9407
9408 4.9.2. In Kermit 95
9409
9410    Kermit 95 1.1.19 and later uses the same pattern matching syntax as in
9411    UNIX, but (as always) you will encounter numerous difficulties if you
9412    use backslash (\) as the directory separator. In any command where K95
9413    parses filenames itself (that is, practically any file-oriented command
9414    except RUN), you can use forward slash (/) as the directory separator
9415    to avoid all the nasty conflicts.
9416
9417 4.9.3. In VMS, AOS/VS, OS-9, VOS, etc.
9418
9419    Platforms other than UNIX, Windows 95/98/NT, and OS/2 have their own
9420    filename matching capabilities that are, in general, different from
9421    Kermit's built-in ones and in any case might conflict with them. For
9422    example, [] encloses directory names in VMS.
9423
9424    Nevertheless you can still use all the pattern-matching capabilities
9425    described in [509]Section 4.9.1 by loading a file list into an array
9426    (e.g. with \ffiles(*,&a), see [510]Section 4.11.3) and then using IF
9427    MATCH on the members.
9428
9429 4.10. Additional Pathname Controls
9430
9431    In version 6.0 and earlier, C-Kermit's SET { SEND, RECEIVE } PATHNAMES
9432    command had only ON and OFF as options. In version 7.0, there are more
9433    choices:
9434
9435    SET SEND PATHNAMES OFF
9436           When sending a file, strip all disk/directory information from
9437           the name. Example: "send /usr/olga/letters/oofa.txt" sends the
9438           file as "oofa.txt". This applies to actual filenames, not to any
9439           as-name you might specify.
9440
9441    SET SEND PATHNAMES RELATIVE
9442           When sending a file, leave the pathname on as given. For
9443           example, if your current directory is /usr/olga, "send
9444           letters/oofa.txt" sends the file as "letters/oofa.txt", not
9445           "/usr/olga/letters/oofa.txt" or "letters.txt".
9446
9447    SET SEND PATHNAMES ABSOLUTE
9448           When sending a file, convert its name to the full, absolute
9449           local pathname. For example, if your current directory is
9450           /usr/olga, "send letters/oofa.txt" sends the file as
9451           "/usr/olga/letters/oofa.txt". NOTE: Even with this setting,
9452           device and/or node names are not included. For example, in VMS,
9453           any node or device name is stripped; in Windows or OS/2, any
9454           disk letter is stripped.
9455
9456    SET RECEIVE PATHNAMES OFF
9457           When receiving a file, strip all disk/directory information from
9458           the name before attempting to store it. This applies to incoming
9459           filename, not to any as-name you might specify. Example: If a
9460           file arrives under the name "/usr/olga/letters/oofa.txt" it is
9461           stored simply as "oofa.txt" in your download directory or, if no
9462           download directory has been specified, in your current
9463           directory.
9464
9465    SET RECEIVE PATHNAMES RELATIVE
9466           When receiving a file, leave the pathname on as it appears in
9467           the incoming name, but if the incoming name appears to be
9468           absolute, make it relative to your current or download
9469           directory. Examples:
9470
9471           + "oofa.txt" is stored as "oofa.txt".
9472           + "letters/oofa.txt" is stored as "letters/oofa.txt"; the
9473             "letters" subdirectory is created if it does not already
9474             exist.
9475           + "/usr/olga/letters/oofa.txt" is stored as
9476             "usr/olga/letters/oofa.txt" in your current or download
9477             directory, and the "usr", "usr/olga", etc, directories are
9478             created if they do not exist.
9479
9480    SET RECEIVE PATHNAMES ABSOLUTE
9481           The incoming filename is used as given. Thus it cannot be stored
9482           unless the given path (if any) already exists or can be created.
9483           In this case, node, device, or disk designations are NOT
9484           stripped, since they most likely were given explicitly by the
9485           user as an as-name, meant to be used as given.
9486
9487    SET RECEIVE PATHNAMES AUTO
9488           This is the default, and means RELATIVE if the sender tells me
9489           it is a recursive transfer, OFF otherwise.
9490
9491    Set FILE NAMES CONVERTED now also affects pathnames too. When PATHNAMES
9492    are RELATIVE or ABSOLUTE and FILE NAMES are CONVERTED, the file sender
9493    converts its native directory-name format to UNIX format, and the file
9494    receiver converts from UNIX format to its native one; thus UNIX format
9495    is the common intermediate representation for directory hierarchies, as
9496    it is in the ZIP/UNZIP programs (which is why ZIP archives are
9497    transportable among, UNIX, DOS, and VMS).
9498
9499    Here's an example in which a file is sent from Windows to UNIX with
9500    relative pathnames and FILE NAMES CONVERTED:
9501
9502   Source name                Intermediate name      Destination Name
9503   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       k95/tmp/oofa.txt
9504
9505    In a more complicated example, we send the same file from Windows to
9506    VMS:
9507
9508   Source name                Intermediate name      Destination Name
9509   C:\K95\TMP\OOFA.TXT        K95/TMP/OOFA.TXT       [.K95.TMP]OOFA.TXT
9510
9511    (Note that disk letters and device designations are always stripped
9512    when pathnames are relative).
9513
9514    As you can imagine, as more and more directory formats are considered,
9515    this approach keeps matters simple: on each platform, Kermit must know
9516    only its own local format and the common intermediate one. In most
9517    cases, the receiver can detect which format is used automatically.
9518
9519 4.11. Recursive SEND and GET: Transferring Directory Trees
9520
9521    C-Kermit 7.0 in selected versions (UNIX, VMS, VOS, AOS/VS, Windows, and
9522    OS/2 at this writing) now permits the SEND command to traverse
9523    directories "recursively" if you ask it to; that is, to send files from
9524    the current or specified directory and all of its subdirectories too,
9525    and their subdirectories, etc. (Some other commands can do this too,
9526    including DIRECTORY.)
9527
9528    This feature is new to UNIX, Windows, VOS, and OS/2. VMS and AOS/VS
9529    have always included "wildcard" or "template" characters that allow
9530    this, and in this case, recursive directory traversal could happen
9531    behind Kermit's back, i.e. Kermit does not have to do it itself (in
9532    VMS, the notation is "[...]" or "[directory...]"; in AOS/VS is "#"). In
9533    C-Kermit 7.0, however, SEND /RECURSIVE is supported by C-Kermit itself
9534    for VMS.
9535
9536 4.11.1. Command-Line Options
9537
9538    To descend a directory tree when sending files, use the -L command-line
9539    option to indicate that the send operation is to be recursive, and
9540    include a name or pattern to be sent. When giving a pattern, you should
9541    enclose it in quotes to prevent the shell from expanding it. Examples:
9542
9543   $ kermit -Ls "/usr/olga/*" # send all of Olga's files in all her directories
9544   $ kermit -Ls foo.txt       # send all foo.txt files in this directory tree
9545   $ kermit -Ls "*.txt"       # send all .txt files in this directory tree
9546   $ kermit -Ls "letters/*"   # send all files in the letters directory tree
9547   $ kermit -Ls letters       # send all files in the letters directory tree
9548   $ kermit -Ls "*"           # send all files in this directory tree
9549   $ kermit -Ls .             # UNIX only: send all files in this directory tree
9550   $ kermit -s .              # UNIX only: a filename of . implies -L
9551
9552    If you let the shell expand wildcards, Kermit only sends files whose
9553    names match files in the current or given directory, because the shell
9554    replaces an unquoted wildcard expression with the list of matching
9555    files -- and the shell does not build recursive lists. Note that the
9556    "." notation for the tree rooted at the current directory is allowed
9557    only in UNIX, since in Windows and OS/2, it means "*.*" (nonrecursive).
9558
9559 4.11.2. The SEND /RECURSIVE Command
9560
9561    If you include the /RECURSIVE switch in a SEND (or MOVE, or similar)
9562    command, it means to descend the current or specified directory tree
9563    searching for files whose names match the given name or pattern. Since
9564    this is not terribly useful unless you also include pathnames with the
9565    outbound files, the /RECURSIVE switch also includes an implicit
9566    /PATHNAMES:RELATIVE switch (which you can undo by including an explicit
9567    /PATHNAMES switch after the /RECURSIVE switch).
9568
9569    Examples:
9570
9571    SEND /RECURSIVE *
9572           Sends all of the files in the current directory and all the
9573           files in all of its subdirectories, and all of their
9574           subdirectories, etc, including their relative pathnames. Empty
9575           directories are not sent.
9576
9577    SEND /RECURSIVE /PATHNAMES:ABSOLUTE *
9578           Sends all of the files in the current directory and all the
9579           files in all of its subdirectories, and all of their
9580           subdirectories, etc, including their absolute pathnames.
9581
9582    SEND /RECURSIVE /PATHNAMES:OFF *
9583           Sends all of the files in the current directory and all the
9584           files in all of its subdirectories, and all of their
9585           subdirectories, etc, without pathnames.
9586
9587    SEND /RECURSIVE /usr/olga/*
9588           Sends all of the files in the /usr/olga directory and all the
9589           files in all of its subdirectories, and all of their
9590           subdirectories, etc.
9591
9592    SEND /RECURSIVE /usr/olga (or /usr/olga/)
9593           Same as above. If the name is a directory name (with or without
9594           a trailing slash), its files are sent, and those of its
9595           subdirectories, and their subdirectories, etc (see [511]Section
9596           4.9).
9597
9598    SEND /RECURSIVE /TEXT /usr/olga/*.txt
9599           As above, but only files whose names end with ".txt" are sent,
9600           and they are sent in text mode (as they would be by default
9601           anyway if SET FILE PATTERNS is ON or AUTO).
9602
9603    SEND .
9604           UNIX only: Send all the files in the current directory.
9605
9606    SEND /RECURSIVE .
9607           UNIX only: Sends all of the files in the current directory and
9608           all of its subdirectories, etc ([512]Section 4.9).
9609
9610    The /RECURSIVE switch is different from most other switches in that its
9611    effect is immediate (but still local to the command in which it is
9612    given), because it determines how filenames are to be parsed. For
9613    example, "send *.txt" fails with a parse error ("No files match") if
9614    there are no *.txt files in the current directory, but "send /recursive
9615    *.txt" succeeds if there are ".txt" files anywhere in the tree rooted
9616    at the current directory.
9617
9618    The /RECURSIVE switch also affects the file lists displayed if you type
9619    "?" in a filename field. "send ./?" lists the regular files in the
9620    current directory, but "send /recursive ./?" lists the entire directory
9621    tree rooted at the current directory.
9622
9623 4.11.3. The GET /RECURSIVE Command
9624
9625    In a client/server setting, the client can also request a recursive
9626    transfer with:
9627
9628    GET /RECURSIVE [ other switches ] remote-filespec [ local-spec ]
9629
9630    In which remote file specification can be a directory name, a filename,
9631    a wildcard, or any combination. If the local-spec is not given (and
9632    PATHNAMES are RELATIVE), incoming files and directories go into the
9633    current local directory. If local-spec is given and is a directory, it
9634    becomes the root of the tree into which the incoming files and
9635    directories are placed. If local-spec has the syntax of a directory
9636    name (e.g. in UNIX it ends with /), C-Kermit creates the directory and
9637    then places the incoming files into it. If local-spec is a filename
9638    (not recommended), then all incoming files are stored with that name
9639    with collisions handled according to the FILE COLLISION setting.
9640
9641    Again, the normal method for transferring directory trees uses relative
9642    pathnames, and this is the default when the sender has been given the
9643    /RECURSIVE switch. The action at the receiver depends on its RECEIVE
9644    PATHNAMES setting. The default is AUTO, meaning that if the sender
9645    tells it to expect a recursive transfer, then it should automatically
9646    switch to relative pathnames for this transfer only; otherwise it obeys
9647    the RECEIVE PATHNAMES setting of OFF, ABSOLUTE, or RELATIVE.
9648
9649    What happens if a file arrives that has an absolute pathname, when the
9650    receiver has been told to use only relative pathnames? As a security
9651    precaution, in this case the receiver treats the name as if it was
9652    relative. For example, if a file arrives as:
9653
9654   /usr/olga/oofa.txt
9655
9656    The receiver creates a "usr" subdirectory in its current directory, and
9657    then an "olga" subdirectory under the "usr" subdirectory in which to
9658    store the incoming file.
9659
9660    Suppose, however there is a sequence of directories:
9661
9662   /usr/olga/a/b/c/d/
9663
9664    in which "a" contains nothing but a subdirectory "b", which in turn
9665    contains nothing but a subdirectory "c", which in turn contains nothing
9666    but a subdirectory "d", which contains nothing at all. Thus there are
9667    no files in the "/usr/olga/a/" tree, and so it is not sent, and
9668    therefore it is not reproduced on the target computer.
9669
9670 4.11.4. New and Changed File Functions
9671
9672    C-Kermit 7.0 adds the following functions:
9673
9674    \ffiles(pattern[,&a])
9675           This function has been changed to match only regular files in
9676           the current or given directory, and to take an optional array
9677           name as a second argument (explained below).
9678
9679    \fdirectories(pattern[,&a])
9680           Returns the number of directories that match the given pattern.
9681           If the pattern does not include a directory, then the search is
9682           performed in the current directory.
9683
9684    \frfiles(pattern[,&a])
9685           Returns the number of files in the current or given directory
9686           and all of its subdirectories, and their subdirectories, etc,
9687           that match the given pattern. Warning -- this one can take quite
9688           some time if performed at the root of a large directory tree.
9689
9690    \frdirectories(pattern[,&a])
9691           Returns the number of directories in the current or given
9692           directory and all of its subdirectories, and their
9693           subdirectories, etc, that match the given pattern.
9694
9695    Each of these functions builds up a list of files to be returned by the
9696    \fnextfile() function, just as \ffiles() always has done. (This can
9697    also be done with the /ARRAY switch of the DIRECTORY command; see
9698    [513]Sections 4.5.1 and [514]7.10).
9699
9700    Each of these functions can be given an array name as an optional
9701    second argument. If an array name is supplied, the array will contain
9702    the number of files as its 0th element, and the filenames in elements 1
9703    through last. If the array already existed, its previous contents are
9704    lost. For example, if the current directory contains two files,
9705    oofa.txt and foo.bar, then "\ffiles(*,&a)" creates an array \&a[] with
9706    a dimension of 2, containing the following elements:
9707
9708  \&a[0] = 2
9709  \&a[1] = oofa.txt
9710  \&a[2] = foo.bar
9711
9712    If no files match the specification given in the first argument, the
9713    array gets a dimension of 0, which is the same as undeclaring the
9714    array.
9715
9716    Note that the order in which the array is filled (and in which
9717    \fnextfile() returns filenames) is indeterminate (but see [515]Section
9718    7.10.5).
9719
9720    Here's an example that builds and prints a list of all the file whose
9721    names end in .txt in the current directory and all its descendents:
9722
9723   asg \%n \frfiles(*.txt)
9724   declare \&a[\%n]
9725   for \%i 1 \%n 1 {
9726       asg \&a[\%i] \fnextfile()
9727       echo \flpad(\%i,4). "\&a[\%i]"
9728   }
9729
9730    Alternatively, using the array method, and then printing the filenames
9731    in alphabetic order (see [516]Section 7.10.3 and [517]7.10.5):
9732
9733   asg \%n \frfiles(*.txt,&a)
9734   sort &a
9735   for \%i 1 \%n 1 {
9736       echo \flpad(\%i,4). "\&a[\%i]"
9737   }
9738
9739    Or even more simply:
9740
9741   asg \%n \frfiles(*.txt,&a)
9742   sort &a
9743   show array &a
9744
9745    As noted elsewhere, the file lists built by \ffiles(), \frfiles(), etc,
9746    are now "safe" in the sense that SEND and other file-related commands
9747    can reference \fnextfile() without resetting the list:
9748
9749   set send pathnames relative
9750   for \%i 1 \frfiles(*.txt) 1 {
9751       asg \%a \fnextfile()
9752       echo Sending \%a...
9753       send \%a
9754       if fail break
9755   }
9756
9757    Copying to an array (as shown on p.398 of [518]Using C-Kermit 2nd Ed)
9758    is no longer necessary.
9759
9760 4.11.5. Moving Directory Trees Between Like Systems
9761
9762 4.11.5.1. UNIX to UNIX
9763
9764    Transferring a directory tree from one computer to another replicates
9765    the file sender's arrangement of files and directories on the file
9766    receiver's computer. Normally this is done using relative pathnames,
9767    since the user IDs might not be identical on the two computers. Let's
9768    say both computers are UNIX based, running C-Kermit 7.0 or later. On
9769    the sending computer (leaving out the connection details, etc):
9770
9771   C-Kermit> cd /usr/olga
9772   C-Kermit> send /recursive .
9773
9774    The /RECURSIVE switch tells C-Kermit to descend through the directory
9775    tree and to include relative pathnames on outbound filenames.
9776
9777    On the receiving computer:
9778
9779   C-Kermit> mkdir olgas-files           ; Make a new directory.
9780   C-Kermit> cd olgas-files              ; CD to it.
9781   C-Kermit> receive /recursive          ; = /PATHNAMES:RELATIVE
9782
9783    Each Kermit program recognizes that the other is running under UNIX and
9784    switches to binary mode and literal filenames automatically.
9785    Directories are automatically created on the receiving system as
9786    needed. File dates and permissions are automatically reproduced from
9787    source to destination.
9788
9789 4.11.5.2. VMS to VMS
9790
9791    To send recursively from VMS, simply include the /RECURSIVE switch, for
9792    example at the sender:
9793
9794   $ kermit
9795   C-Kermit> cd [olga]
9796   C-Kermit> send /recursive *.*;0
9797
9798    And at the receiver:
9799
9800   C-Kermit> cd [.olga]
9801   C-Kermit> receive /recursive
9802
9803    The notation "..." within directory brackets in VMS means "this
9804    directory and all directories below it"; the /RECURSIVE switch, when
9805    given to the sender, implies the use of "..." in the file specification
9806    so you don't have to include "..."; but it makes no difference if you
9807    do:
9808
9809   $ kermit
9810   C-Kermit> send /recursive [olga...]*.*;0
9811
9812    And at the receiver:
9813
9814   C-Kermit> cd [.olga]
9815   C-Kermit> receive /recursive
9816
9817    In either case, since both systems recognize each other as VMS, they
9818    switch into LABELED transfer mode automatically.
9819
9820 4.11.6. Moving Directory Trees Between Unlike Systems
9821
9822    There are several difficulties with recursive transfers between unlike
9823    systems:
9824
9825      * File formats can be different, especially text files character sets
9826        and record formats. This can now be handled by using SET FILE
9827        PATTERN, SET FILE TEXT-PATTERNS, and SET FILE BINARY-PATTERNS
9828        ([519]Section 4.3).
9829      * File naming conventions are different. For example, one system
9830        might allow (and use) longer filenames than the other. You can tell
9831        Kermit how to handle file names with the normal "set file names"
9832        and "set file collision" mechanisms. Most modern Kermits are fairly
9833        tolerant of illegal filenames and should not fail simply because of
9834        an incoming filename; rather, it will do its best to convert it to
9835        a recognizable and unique legal filename.
9836      * Directory notations can be different, e.g. backslashes instead of
9837        slashes, brackets, parentheses, spaces, etc. But this is now
9838        handled by converting pathnames to a standard format during
9839        transfer ([520]Section 4.10).
9840
9841    So now, for the first time, it is possible to send directory trees
9842    among any combination of UNIX, DOS, Windows, OS/2, VMS, AOS/VS, etc.
9843    Here's an example sending files from an HP-UX system (where text files
9844    are encoded in the HP Roman8 character set) to a PC with K95 (where
9845    text files are encoded in CP850):
9846
9847  Sender:
9848   cd xxx                           ; CD to root of source tree
9849   set file type binary             ; Default transfer mode
9850   set file character-set hp-roman8 ; Local character set for text files
9851   set xfer character-set latin1    ; Transfer character set
9852   set file patterns on             ; Enable automatic file-type switching...
9853   set file binary-patterns *.Z *.gz *.o  ; based on these patterns...
9854   set file text-patterns *.txt *.c *.h   ; for binary and text files.
9855   send /recursive *                ; Send all the file in this directory tree
9856
9857  Receiver:
9858   cd yyy                           ; CD to root of destination tree
9859   set file character-set cp850     ; Local character set for text files
9860   receive /pathnames:relative      ; Receive with pathnames
9861
9862    Notes:
9863      * Replace "xxx" and "yyy" with the desired directories.
9864      * Replace the file character sets appropriately.
9865      * Change the patterns as needed (or just use the built-in default
9866        lists).
9867      * SEND /RECURSIVE also implies /PATHNAMES:RELATIVE.
9868      * The file sender tells the file receiver the transfer mode of each
9869        file.
9870      * The file sender tells the file receiver the transfer character set.
9871      * By default, destination file dates will be the same as on the
9872        source.
9873      * Many of the settings shown might already be set by default.
9874      * See [521]Sections 4.3, [522]4.10, and [523]4.15 for additional
9875        explanation.
9876
9877    If you are refreshing an existing directory on the destination
9878    computer, use "set file collision update" or other appropriate file
9879    collision option to handle filename collisions.
9880
9881 4.12. Where Did My File Go?
9882
9883    Now that Kermit can be started by clicking on desktop icons (thus
9884    obscuring the concept of "current directory"), and can have a download
9885    directory, and can create directories for incoming files on the fly,
9886    etc, sometimes it is easy to lose a file after transfer. Of course, if
9887    you keep a transaction log:
9888
9889   LOG TRANSACTIONS
9890
9891    it will record the fate and final resting place of each file. But in
9892    case you did not keep a log, the new command:
9893
9894   WHERE
9895
9896    added in C-Kermit 7.0, gives you as much information as it has about
9897    the location of the last files transferred, including the pathname
9898    reported by the receiving Kermit, if any, when C-Kermit is the sender.
9899    This information was also added to SHOW FILE in somewhat less detail.
9900
9901 4.13. File Output Buffer Control
9902
9903    (UNIX only). The new command SET FILE OUTPUT lets you control how
9904    incoming files are written to disk:
9905
9906    SET FILE OUTPUT BUFFERED [ size ]
9907           Chooses buffered file output; this is the default. UNIX does its
9908           normal sort of disk buffering. The optional size specifies
9909           Kermit's own file output buffer size, and therefore the
9910           frequency of disk accesses (write() system calls) -- the bigger
9911           the size, the fewer the disk accesses.
9912
9913    SET FILE OUTPUT UNBUFFERED [ size ]
9914           This forces each file output write() call to actually commit the
9915           data to disk immediately. Choosing this option will usually slow
9916           file reception down.
9917
9918    SET FILE OUTPUT BLOCKING
9919           Write() calls should not return until they are complete. This is
9920           the normal setting, and it lets Kermit detect disk-write errors
9921           immediately.
9922
9923    SET FILE OUTPUT NONBLOCKING
9924           Write() calls should return immediately. This can speed up file
9925           reception, but also delay the detection of disk-write errors.
9926
9927    Experimentation with these parameters should be harmless, and might (or
9928    might not) have a perceptible, even dramatic, effect on performance.
9929
9930 4.14. Improved Responsiveness
9931
9932    In version 7.0, C-Kermit's file-transfer protocol engine has been tuned
9933    for additional speed and responsiveness.
9934
9935      * Binary-mode transfers over 8-bit connections, a very common case,
9936        are now handled in a special way that minimizes overhead.
9937      * SET TRANSFER CRC-CALCULATION is now OFF by default, rather than ON.
9938        (This affects only the overall per-transfer CRC, \v(crc16), not the
9939        per-packet CRCs)
9940      * Connection loss during file transfer is now detected immediately in
9941        most cases on Internet connections and on serial connections when
9942        CARRIER-WATCH is not set to OFF.
9943
9944 4.15. Doubling and Ignoring Characters for Transparency
9945
9946    The following commands were added in 7.0, primarily to allow successful
9947    file transfer through ARPAnet TACs and with Honeywell DPS6 systems, but
9948    can be used in any setting where they might be needed:
9949
9950    SET SEND DOUBLE-CHAR { [ char [ char [ ... ] ] ], NONE }
9951           Tells C-Kermit to double the specified characters (use decimal
9952           notation) in packets that it sends. For example, if you are
9953           sending files through a device that uses @ as an escape
9954           character, but allows you to send a single copy of @ through by
9955           doubling it, use "set send double 64".
9956
9957    SET RECEIVE IGNORE-CHAR [ char [ char [ ... ] ] ]
9958           Tells C-Kermit to ignore the specified character(s) in incoming
9959           packets. Use this, for example, when something between the
9960           sender and receiver is inserting linefeeds for wrapping, NULs
9961           for padding, etc.
9962
9963 4.16. New File-Transfer Display Formats
9964
9965    SET TRANSFER DISPLAY { BRIEF, CRT, FULLSCREEN, NONE, SERIAL }
9966           Selects the file-transfer display format.
9967
9968    BRIEF is the new one. This writes one line to the screen per file,
9969    showing the file's name, transfer mode, size, the status of the
9970    transfer, and when the transfer is successful, the effective data rate
9971    in characters per second (CPS). Example:
9972
9973   SEND ckcfn3.o (binary) (59216 bytes): OK (0.104 sec, 570206 cps)
9974   SEND ckcfns.o (binary) (114436 bytes): OK (0.148 sec, 772006 cps)
9975   SEND ckcmai.c (text) (79147 bytes): OK (0.180 sec, 438543 cps)
9976   SEND ckcmai.o (binary) (35396 bytes): OK (0.060 sec, 587494 cps)
9977   SEND ckcnet.o (binary) (62772 bytes): REFUSED
9978   SEND ckcpro.o (binary) (121448 bytes): OK (0.173 sec, 703928 cps)
9979   SEND ckcpro.w (text) (63687 bytes): OK (0.141 sec, 453059 cps)
9980   SEND makefile (text) (186636 bytes): OK (0.444 sec, 420471 cps)
9981   SEND wermit (binary) (1064960 bytes): OK (2.207 sec, 482477 cps)
9982
9983    Note that transfer times are now obtained in fractional seconds, rather
9984    than whole seconds, so the CPS figures are more accurate (the display
9985    shows 3 decimal places, but internally the figure is generally precise
9986    to the microsecond).
9987
9988 4.17. New Transaction Log Formats
9989
9990    The new command:
9991
9992   SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF [ separator ] }
9993
9994    lets you choose the format of the transaction log. VERBOSE (the
9995    default) indicates the traditional format described in the book. BRIEF
9996    and FTP are new. This command must be given prior to the LOG
9997    TRANSACTION command if a non-VERBOSE type is desired.
9998
9999 4.17.1. The BRIEF Format
10000
10001    BRIEF chooses a one-line per file format suitable for direct
10002    importation into databases like Informix, Oracle, or Sybase, in which:
10003
10004      * Each record has 8 fields.
10005      * Fields are separated by a non-alphanumeric separator character.
10006      * The default separator character is comma (,).
10007      * Any field containing the separator character is enclosed in
10008        doublequotes.
10009      * The final field is enclosed in doublequotes.
10010
10011    The fields are:
10012
10013     1. Date in yyyymmdd format
10014     2. Time in hh:mm:ss format
10015     3. Action: SEND or RECV
10016     4. The local filename
10017     5. The size of the file
10018     6. The transfer mode (text, binary, image, labeled)
10019     7. The status of the transfer: OK or FAILED
10020     8. Additional status-dependent info, in doublequotes.
10021
10022    Examples:
10023
10024   20000208,12:08:52,RECV,/u/olga/oofa.txt,5246,text,OK,"0.284sec 18443cps"
10025   20000208,12:09:31,SEND,/u/olga/oofa.exe,32768,binary,OK,"1.243sec 26362cps"
10026   20000208,12:10:02,SEND,"/u/olga/a,b",10130,text,FAILED,"Refused: date"
10027
10028    Note how the filename is enclosed in doublequotes in the final example,
10029    because it contains a comma.
10030
10031    To obtain BRIEF format, you must give the SET TRANSACTION-LOG BRIEF
10032    command before the LOG TRANSACTIONS command. (If you give them in the
10033    opposite order, a heading is written to the log by the LOG command.)
10034
10035 4.17.2. The FTP Format
10036
10037    SET TRANSACTION-LOG FTP (available only in UNIX) chooses a format that
10038    is compatible with the WU-FTPD (Washington University FTP daemon) log,
10039    and so can be processed by any software that processes the WU-FTPD log.
10040    It logs only transfers in and out, both successful and failed (but
10041    success or failure is not indicated, due to lack of a field in the
10042    WU-FTPD log format for this purpose). Non-transfer events are not
10043    recorded.
10044
10045    Unlike other logs, the FTP-format transaction log is opened in append
10046    mode by default. This allows you to easily keep a record of all your
10047    kermit transfers, and it also allows the same log to be shared by
10048    multiple simultaneous Kermit processes or (permissions permitting)
10049    users. You can, of course, force creation of a new logfile by
10050    specifying the NEW keyword after the filename, e.g.
10051
10052   log transactions oofa.log new
10053
10054    All records in the FTP-style log are in a consistent format. The first
10055    field is fixed-length and contains spaces; subsequent fields are
10056    variable length, contain no spaces, and are separated by one or more
10057    spaces. The fields are:
10058
10059    Timestamp
10060           This is an asctime-style timestamp, example: "Wed Sep 16
10061           20:19:05 1999" It is always exactly 24 characters long, and the
10062           subfields are always in fixed positions.
10063
10064    Elapsed time
10065           The whole number of seconds required to transfer the file, as a
10066           string of decimal digits, e.g. "24".
10067
10068    Connection
10069           The name of the network host to which C-Kermit is connected, or
10070           the name of the serial device through which it has dialed (or
10071           has a direct connection), or "/dev/tty" for transfers in remote
10072           mode.
10073
10074    Bytes transferred
10075           The number of bytes transferred, decimal digits, e.g. "1537904".
10076
10077    Filename
10078           The name of the file that was transferred, e.g.
10079           "/pub/ftp/kermit/a/README.TXT". If the filename contains any
10080           spaces or control characters, each such character is replaced by
10081           an underscore ('_') character.
10082
10083    Mode
10084           The letter 'b' if the file was transferred in binary mode, or
10085           'a' if it was transferred in text (ASCII) mode.
10086
10087    Options
10088           This field always contains an underscore ('_') character.
10089
10090    Direction
10091           The letter 'o' if the file was transferred Out, and 'i' if the
10092           file was transferred In.
10093
10094    User class
10095           The letter 'r' indicates the file was transferred by a Real
10096           user.
10097
10098    User identification
10099           The ID of the user who transferred the file.
10100
10101    Server identification
10102           The string "kermit". This distinguishes a Kermit transfer log
10103           record from a WU-FTPD record, which contains "ftp" in this
10104           field.
10105
10106    Authentication class
10107           The digit '1' if we know the user's ID on the client system,
10108           otherwise '0'. Currently, always '0'.
10109
10110    Authenticated user
10111           If the authentication class is '1', this is the user's ID on the
10112           client system. Otherwise it is an asterisk ('*'). Currently it
10113           is always an asterisk.
10114
10115    Examples:
10116
10117   Thu Oct 22 17:42:48 1998 0 * 94 /usr/olga/new.x a _ i r olga kermit 0 *
10118   Thu Oct 22 17:51:29 1998 1 * 147899 /usr/olga/test.c a _ o r olga kermit 0 *
10119   Thu Oct 22 17:51:44 1998 1 * 235 /usr/olga/test.o b _ i r olga kermit 0 *
10120   Fri Oct 23 12:10:25 1998 0 * 235 /usr/olga/x.ksc a _ o r olga kermit 0 *
10121
10122    Note that an ftp-format transaction log can also be selected on the
10123    Kermit command line as follows:
10124
10125   kermit --xferfile:filespec
10126
10127    This is equivalent to:
10128
10129   SET TRANSACTION-LOG FTP
10130   LOG TRANSACTIONS filespec APPEND
10131
10132    Conceivably it could be possible to have a system-wide shared Kermit
10133    log, except that UNIX lacks any notion of an append-only file; thus any
10134    user who could append to the log could also delete it (or alter it).
10135    This problem could be worked around using setuid/setgid tricks, but
10136    these would most likely interfere with the other setuid/setgid tricks
10137    C-Kermit must use for getting at dialout devices and UUCP logfiles.
10138
10139 4.18. Unprefixing NUL
10140
10141    As of 6.1.193 Alpha.10, C-Kermit can finally send and receive
10142    file-transfer packets in which NUL (ASCII 0) is unprefixed (no more
10143    NUL-terminated packets!). NUL is, of course, extremely prevalent in
10144    binary files such as executables, and this has been a significant
10145    source of packet overhead. For example, when transferring itself (the
10146    SunOS C-Kermit executable) with minimal prefixing and 9000-byte
10147    packets, we see:
10148
10149   File size:                       1064960
10150   Packet chars with 0 prefixed:    1199629  overhead = 12.65%
10151   Packet chars with 0 unprefixed:  1062393  overhead = -0.03%
10152
10153    Transfer rates go up accordingly, not only because of the reduced
10154    amount of i/o, but also because less computation is required on each
10155    end.
10156
10157 4.19. Clear-Channel Protocol
10158
10159    Now that C-Kermit itself is capable of sending and receiving any byte
10160    at all on a clear channel ([524]Section 4.18), it is, for the first
10161    time, in a position to negotiate a clear channel with the other Kermit,
10162    giving it permission (but not requiring it) to unprefix any and all
10163    characters that it knows are safe. In general this means all but the
10164    Kermit start-of-packet character (normally Ctrl-A), Carriage Return
10165    (not only Kermit's end-of-packet character, but also treated specially
10166    on Telnet NVT links), and IAC (255, also special to Telnet).
10167
10168    By default, C-Kermit will say it has a clear channel only if it has
10169    opened a TCP socket. Since the Kermit program on the far end of a
10170    TCP/IP connection generally does not know it has a TCP/IP connection,
10171    it will not announce a clear channel unless it has been told to do so.
10172    The command is:
10173
10174    SET CLEAR-CHANNEL { ON, OFF, AUTO }
10175
10176    AUTO is the default, meaning that the clear-channel status is
10177    determined automatically from the type of connection. ON means to
10178    announce a clear channel, OFF means not to announce it. Use SHOW
10179    STREAMING ([525]Section 4.20) to see the current CLEAR-CHANNEL status.
10180    Synonym: SET CLEARCHANNEL.
10181
10182    CLEAR-CHANNEL is also set if you start C-Kermit with the -I switch (see
10183    [526]Section 4.20).
10184
10185    Whenever a clear channel is negotiated, the resulting control-character
10186    unprefixing is "sticky"; that is, it remains in effect after the
10187    transfer so you can use SHOW CONTROL to see what was negotiated.
10188
10189    You can also see whether a clear channel was negotiated in the
10190    STATISTICS /VERBOSE Display.
10191
10192    The advantage of the clear channel feature is that it can make file
10193    transfers go faster automatically. The disadvantage would be
10194    file-transfer failures if the channel is not truly clear, for example
10195    if C-Kermit made a Telnet connection to a terminal server, and then
10196    dialed out from there; or if C-Kermit made an Rlogin connection to host
10197    and then made a Telnet connection from there to another host. If a file
10198    transfer fails on a TCP/IP connection, use SHOW CONTROL to check
10199    whether control characters became unprefixed as a result of protocol
10200    negotiations, and/or SHOW STREAMING ([527]Section 4.20) to see if
10201    "clear-channel" was negotiated. If this happened, use SET CLEAR-CHANNEL
10202    OFF and SET PREFIXING CAUTIOUS (or whatever) to prevent it from
10203    happening again.
10204
10205 4.20. Streaming Protocol
10206
10207    A new Kermit protocol option called "streaming" was added in C-Kermit
10208    7.0. The idea is that if the two Kermit partners have a reliable
10209    transport (such as TCP/IP or X.25) between them, then there is no need
10210    to send ACKs for Data packets, or NAKs, since a reliable transport
10211    will, by definition, deliver all packets in order and undamaged. On
10212    such a connection, streaming cuts down not only on Kermit program
10213    overhead (switching back and forth between reading and sending
10214    packets), but also tends to make the underlying transport use itself
10215    more efficiently (e.g. by defeating the Nagle algorithm and/or Delayed
10216    ACK stratagem of the TCP layer). Furthermore, it allows transfers to
10217    work smoothly on extremely slow network congestions that would
10218    otherwise cause timeouts and retransmissions, and even failure when the
10219    retry limit was exceeded.
10220
10221    The trick is knowing when we can stream:
10222
10223     1. If C-Kermit has opened a TCP socket or X.25 connection, it offers
10224        stream.
10225     2. If C-Kermit has been started with the -I (uppercase) option, or if
10226        it has been told to SET RELIABLE ON, it offers to stream.
10227     3. If C-Kermit is in remote mode, and has been told to SET RELIABLE
10228        AUTO (or ON), it always offers to stream, and also always agrees to
10229        stream, if the other Kermit offers. Unless you take explicit
10230        actions to override the defaults, this allows the local Kermit (the
10231        one that made the connection, and so knows whether it's reliable)
10232        to control streaming.
10233
10234    (Note that an offer to stream also results in a Clear-Channel
10235    announcement if CLEAR-CHANNEL is set to AUTO; see [528]Section 4.19.)
10236
10237    When BOTH Kermits offer to stream, then they stream; otherwise they
10238    don't. Thus streaming-capable Kermit programs interoperate
10239    automatically and transparently with nonstreaming ones. If the two
10240    Kermits do agree to stream, you'll see the word "STREAMING" on the
10241    fullscreen file-transfer display in the Window Slots field. You can
10242    also find out afterwards with the STATISTICS or SHOW STREAMING
10243    commands.
10244
10245      WARNING: Automatic choice of streaming is based on the assumption of
10246      a "direct" end-to-end network connection; for example, a Telnet or
10247      Rlogin connection from host A to host B, and transferring files
10248      between A and B. However, if your connection has additional
10249      components -- something "in the middle" (B) that you have made a
10250      network connection to, which makes a separate connection to the
10251      destination host (C), then you don't really have a reliable
10252      connection, but C-Kermit has no way of knowing this; transferring
10253      files between A and C will probably fail. In such cases, you'll need
10254      to tell the *local* C-Kermit to "set reliable off" before
10255      transferring files (it does no good to give this command to the
10256      remote Kermit since the local one controls the RELIABLE setting).
10257
10258    Streaming is like using an infinite window size, with no timeouts and
10259    no tolerance for transmission errors (since there shouldn't be any). It
10260    relies on the underlying transport for flow control, error correction,
10261    timeouts, and retransmission. Thus it is very suitable for use on
10262    TCP/IP connections, especially slow or bursty ones, since Kermit's
10263    packet timeouts won't interfere with the transfer -- each packet takes
10264    as long to reach its destination as it takes TCP to deliver it. If TCP
10265    can't deliver the packet within its own timeout period (over which
10266    Kermit has no control), it signals a fatal error. Just like FTP.
10267
10268    Streaming goes much faster than non-streaming when a relatively small
10269    packet length is used, and it tends to go faster than non-streaming
10270    with even the longest packet lengths. The Kermit window size is
10271    irrelevant to streaming protocol, but still might affect performance in
10272    small ways since it can result in different paths through the code.
10273
10274    The definition of "reliable transport" does not necessarily demand
10275    8-bit and control-character transparency. Streaming can work with
10276    parity and/or control-character prefixing just as well (but not as
10277    fast) as without them; in such cases you can leave RELIABLE set to ON,
10278    but set CLEARCHANNEL and/or PARITY appropriately.
10279
10280    Maximum performance -- comparable to and often exceeding FTP -- is
10281    achieved on socket-to-socket connections (in which the considerable
10282    overhead of the terminal driver and Telnet or Rlogin server is
10283    eliminated) with long packets and the new "brief" file-transfer display
10284    ([529]Section 4.16).
10285
10286 4.20.1. Commands for Streaming
10287
10288    SET RELIABLE { ON, OFF, AUTO }
10289           SET RELIABLE ON tells Kermit that it has a reliable transport.
10290           SET RELIABLE OFF tells Kermit the transport is not reliable.
10291           SET RELIABLE AUTO tells Kermit that it should SET RELIABLE ON
10292           whenever it makes a reliable connection (e.g. TELNET or SET HOST
10293           on a TCP/IP or X.25 network), and when in remote mode it should
10294           believe the transport is reliable if the other Kermit says it is
10295           during Kermit protocol negotiation.
10296
10297    AUTO is the default; the Kermit program that makes the connection knows
10298    whether it is reliable, and tells the remote Kermit.
10299
10300    The RELIABLE setting has several effects, including:
10301
10302      * It can affect the timeouts used during normal ACK/NAK protocol.
10303      * It can affect the clear-channel announcement.
10304      * It can affect streaming.
10305
10306    If you TELNET or SET HOST somewhere, this includes an implicit SET
10307    RELIABLE ON command. The -I command-line option is equivalent to SET
10308    RELIABLE ON.
10309
10310    Since SET RELIABLE ON (and -I) also implies SET CLEAR CHANNEL ON, you
10311    might find that in certain cases you need to tell Kermit that even
10312    though the connection is reliable, it doesn't have a clear channel
10313    after all:
10314
10315   SET CLEAR-CHANNEL OFF
10316   SET PREFIXING CAUTIOUS ; or whatever...
10317
10318    You can control streaming without affecting the other items with:
10319
10320   SET STREAMING { ON, OFF, AUTO }
10321
10322    AUTO is the default, meaning streaming will occur if Kermit has made a
10323    TCP/IP connection or if RELIABLE is ON (or it was started with the -I
10324    command line option). OFF means don't stream; ON means offer to stream
10325    no matter what.
10326
10327 4.20.2. Examples of Streaming
10328
10329    Here we look at the use and behavior of streaming on several different
10330    kinds of connections, and compare its performance with non-streaming
10331    transfers.
10332
10333 4.20.2.1. Streaming on Socket-to-Socket Connections
10334
10335    Here we get streaming automatically when both Kermit programs are
10336    capable of it, since they both make socket connections. For example, on
10337    the far end:
10338
10339   C-Kermit> set host * 3000
10340   C-Kermit> server
10341
10342    and on the near end:
10343
10344   C-Kermit> set host foo.bar.xyz.com 3000
10345   (now give SEND and GET command)
10346
10347    All subsequent file transfers use streaming automatically.
10348
10349    Here are the results from 84 trials, run on a production network,
10350    disk-to-disk, in which a 1-MB binary file (the SunOS C-Kermit Sparc
10351    executable) was sent from a Sun Sparc-10 with SunOS 4.1.3 to an IBM
10352    Power Server 850 with AIX 4.1, socket-to-socket, over a 10Mbps 10BaseT
10353    Ethernet, using minimal control-character unprefixing, window sizes
10354    from 10 to 32, and packet sizes from 1450 to 9010:
10355
10356                 Streaming    Nonstreaming
10357   Max CPS         748955        683354
10358   Min CPS         221522        172491
10359   Mean CPS        646134        558680
10360   Median CPS      678043        595874
10361   Std Dev         101424        111493
10362
10363    Correlations:
10364
10365   CPS and window size:   -0.036
10366   CPS and packet length:  0.254
10367   CPS and streaming:      0.382
10368
10369    Note that the relationship between streaming and throughput is
10370    significantly stronger than that between CPS and window size or packet
10371    length.
10372
10373    Also note that this and all other performance measurements in this
10374    section are snapshots in time; the results could be much different at
10375    other times when the load on the systems and/or the network is higher
10376    or lower.
10377
10378    In a similar socket-to-socket trial, but this time over a wide-area
10379    TCP/IP connection (from New York City to Logan, Utah, about 2000
10380    miles), the following results were obtained:
10381
10382                 Streaming    Nonstreaming
10383   Max CPS         338226        318203
10384   Min CPS         191659        132314
10385   Mean CPS        293744        259240
10386   Median CPS      300845        273271
10387   Std Dev          41914         52351
10388
10389    Correlations:
10390
10391   CPS and window size:    0.164
10392   CPS and packet length:  0.123
10393   CPS and streaming:      0.346
10394
10395 4.20.2.2. Streaming on Telnet Connections
10396
10397    In this case the local copy of Kermit is told to TELNET or SET HOST,
10398    and so it knows it has a reliable connection and -- unless it has been
10399    told not to -- will offer to stream, and the other Kermit program,
10400    since it has STREAMING set to AUTO, agrees.
10401
10402    Since we have a reliable connection, we'll also get control-character
10403    unprefixing automatically because of the new clear-channel protocol
10404    ([530]Section 4.19).
10405
10406    Any errors that occur during streaming are fatal to the transfer. The
10407    message is "Transmission error on reliable link". Should this happen:
10408
10409     1. Check the remote Kermit's flow control setting (SHOW
10410        COMMUNICATIONS). If it is NONE, change it to XON/XOFF, or vice
10411        versa. If it is XON/XOFF (or you just changed it to XOFF/XOFF),
10412        make sure the file sender is prefixing the XON and XOFF characters.
10413        In the most drastic case, use "set prefix all" to force prefixing
10414        of all control characters.
10415     2. The remote Telnet server might chop off the 8th bit. In that case,
10416        tell C-Kermit to "set parity space". Or, you might be able to force
10417        the Telnet to allow eight-bit data by telling C-Kermit to "set
10418        telopt binary request accept" -- that is, request the Telnet server
10419        to enter binary mode, and accept binary-mode bids from the server.
10420     3. The remote Telnet server might have a buffering limitation. If a
10421        and b don't cure the problem, tell the file receiver to "set
10422        receive packet-length 1000" (or other number -- use the largest one
10423        that works). This too, is no different from the non-streaming case
10424        (more about this in [531]Section 4.20.2.3).
10425
10426    And remember you can continue interrupted binary-mode transfers where
10427    they left off with the RESEND (= SEND /RECOVER) command.
10428
10429    Here are the figures for the same 84 trials between the same Sun and
10430    IBM hosts as in 4.20.2.1, on the same network, but over a Telnet
10431    connection rather than socket-to-socket:
10432
10433                   Streaming    Nonstreaming
10434   Max CPS         350088        322523
10435   Min CPS          95547        173152
10436   Mean CPS        321372        281830
10437   Median CPS      342604        291469
10438   Std Dev          40503         29948
10439
10440    Correlations:
10441
10442   CPS and window size:    0.001
10443   CPS and packet length:  0.152
10444   CPS and streaming:      0.128
10445
10446    Here the effect is not as emphatic as in the socket-to-socket case, yet
10447    on the whole streaming tends to be beneficial.
10448
10449    Additional measurements on HP-UX using C-Kermit 7.0 Beta.06:
10450
10451                   Windowing     Streaming
10452   HP-UX 8->8      not tested       14Kcps
10453   HP-UX 8->9      not tested       76Kcps
10454   HP-UX 8->10      36Kcps          66Kcps
10455   HP-UX 9->9      not tested      190Kcps
10456   HP-UX 9->10     160Kcps         378Kcps
10457
10458 4.20.2.3. Streaming with Limited Packet Length
10459
10460    The IRIX telnet server (at least the ones observed in IRIX 5.3 and 6.2)
10461    does not allow Kermit to send packets longer than 4096 bytes. Thus when
10462    sending from IRIX C-Kermit when it is on the remote end of a Telnet
10463    connection, the packet length must be 4K or less. Trials in this case
10464    (in which packet lengths range from 1450 to 4000) show a strong
10465    advantage for streaming, which would be evident in any other case where
10466    the packet length is restricted, and stronger the shorter the maximum
10467    packet length.
10468
10469                   Streaming    Nonstreaming
10470   Max CPS         426187        366870
10471   Min CPS         407500        276517
10472   Mean CPS        415226        339168
10473   Median CPS      414139        343803
10474   Std Dev           6094         25851
10475
10476    Correlations:
10477
10478   CPS and window size:    0.116
10479   CPS and packet length:  0.241
10480   CPS and streaming:      0.901
10481
10482 4.20.2.4. Streaming on Dialup Connections
10483
10484    Here "dialup" refers to a "direct" dialup connection, not a SLIP or PPP
10485    connection, which is only a particular kind of TCP/IP connection.
10486
10487    Attempt this at your own risk, and then only if (a) you have
10488    error-correcting modems, and (b) the connections between the modems and
10489    computers are also error-free, perfectly flow-controlled, and free of
10490    interrupt conflicts. Streaming can be used effectively and to fairly
10491    good advantage on such connections, but remember that the transfer is
10492    fatal if even one error is detected (also remember that should a
10493    binary-mode transfer fail, it can be recovered from the point of
10494    failure with RESEND).
10495
10496    To use streaming on an unreliable connection, you must tell both
10497    Kermits that the connection is reliable:
10498
10499   kermit -I
10500
10501    or:
10502
10503   C-Kermit> set reliable on
10504
10505    In this case, it will probably be necessary to prefix some control
10506    characters, for example if your connection is through a terminal server
10507    that has an escape character. Most Cisco terminal servers, for example,
10508    require Ctrl-^ (30, as well as its high-bit equivalent, 158) to be
10509    prefixed. To unprefix these, you'll need to defeat the "clear channel"
10510    feature:
10511
10512   C-Kermit> set reliable on
10513   C-Kermit> set clear-channel off
10514   C-Kermit> set prefixing none
10515   C-Kermit> set control prefix 1 13 30 158 ; and whatever else is necessary
10516
10517    Dialup trials were done using fixed large window and packet sizes. They
10518    compare uploading and downloading of two common types of files, with
10519    and without streaming. Configuration:
10520
10521      HP-9000/715/33 -- 57600bps, RTS/CTS -- USR Courier V.34 --
10522      V.34+V.42, 31200bps -- USR V.34+ Rackmount -- 57600bps, RTS/CTS --
10523      Cisco terminal server -- Solaris 2.5.1. Packet size = 8000, Window
10524      Size = 30, Control Character Unprefixing Minimal (but including the
10525      Cisco escape character).
10526
10527    Since this is not a truly reliable connection, a few trials failed when
10528    a bad packet was received (most likely due to UART overruns); the
10529    failure was graceful and immediate, and the message was informative.
10530    The results of ten successful trials uploading and downloading the two
10531    files with and without streaming are:
10532
10533             Streaming..
10534             Off    On
10535    Upload   5194   5565   txt (= C source code, 78K)
10536             3135   3406   gz  (= gzip file, compressed, 85K)
10537  Download   5194   5565   txt
10538             3041   3406   gz
10539
10540    Each CPS figure is the mean of 10 results.
10541
10542    A brief test was also performed on a LAT-based dialout connection from
10543    a VAX 3100 with VMS 5.5 to a USR Courier V.34 connected to a DECserver
10544    700 at 19200 bps. The 1-MB Sparc executable downloaded from a Sun to
10545    the VAX at 1100cps without streaming and 1900cps with streaming, using
10546    8000-byte packets, 30 window slots, and minimal prefixing in both
10547    cases.
10548
10549 4.20.2.5. Streaming on X.25 Connections
10550
10551    We have only limited access to X.25 networks. One trial was performed
10552    in which the 1MB Solaris 2.4 Sparc executable was transferred over a
10553    SunLink X.25 connection; nothing is known about the actual physical
10554    connection. With a packet length of 8000 and a window size of 30, the
10555    file transferred at 6400 cps (using a maximum of 6 window slots). With
10556    the same packet length, but with streaming, it transferred without
10557    mishap at 6710 cps, about 5% faster.
10558
10559 4.20.3. Streaming - Preliminary Conclusions
10560
10561    The results vary with the particular connection, but are good overall.
10562    Although numerous lower-level tricks can be used to improve performance
10563    on specific platforms or connection methods, streaming occurs at a
10564    high, system-independent level of the Kermit protocol and therefore can
10565    apply to all types of platforms and (reliable) connections
10566    transparently.
10567
10568 4.21. The TRANSMIT Command
10569
10570    Prior to C-Kermit 7.0, the TRANSMIT command transmitted in text or
10571    binary mode according to SET FILE TYPE { TEXT, BINARY }. But now that
10572    binary mode is likely to be the default for protocol transfers, it is
10573    evident that this not also an appropriate default for TRANSMIT, since
10574    binary-mode TRANSMIT is a rather specialized and tricky operation.
10575    Therefore, TRANSMIT defaults to text mode always, regardless of the
10576    FILE TYPE setting.
10577
10578    C-Kermit 7.0 expands the capabilities of the TRANSMIT command by adding
10579    the following switches (see [532]Section 1.5). The new syntax is:
10580
10581   TRANSMIT [ switches... ] filename
10582
10583    Zero or more switches may be included:
10584
10585    /PIPE
10586           When /PIPE is included, "filename" is interpreted as a system
10587           command or program whose output is to be sent. Synonym:
10588           /COMMAND. Example:
10589
10590   transmit /pipe finger
10591
10592           You may enclose the command in braces, but you don't have to:
10593
10594   xmit /pipe {ls -l | sort -r +0.22 -0.32 | head}
10595
10596    /BINARY
10597           Transmits the file (or pipe output) in binary mode.
10598
10599    /TEXT
10600           Transmits the file (or pipe output) in line-oriented text mode.
10601           Current FILE CHARACTER-SET and TERMINAL CHARACTER-SET selections
10602           govern translation. Default.
10603
10604    /TRANSPARENT
10605           Specifies text mode without character-set translation, no matter
10606           what the FILE and TERMINAL CHARACTER-SET selections are.
10607
10608    /NOWAIT
10609           This is equivalent to SET TRANSMIT PROMPT 0, but for this
10610           TRANSMIT command only. Applies only to text mode; it means to
10611           not wait for any kind of echo or turnaround character after
10612           sending a line before sending the next line. (Normally Kermit
10613           waits for a linefeed.)
10614
10615    When TRANSMIT ECHO is ON, C-Kermit tries to read back the echo of each
10616    character that is sent. Prior to C-Kermit 7.0, 1 second was allowed for
10617    each echo to appear; if it didn't show up in a second, the TRANSMIT
10618    command would fail. Similarly for the TRANSMIT PROMPT character.
10619    However, with today's congested Internet connections, etc, more time is
10620    often needed:
10621
10622    SET TRANSMIT TIMEOUT number
10623
10624    Specifies the number of seconds to wait for an echo or the prompt
10625    character when TRANSMIT PROMPT is nonzero; the default wait is 1
10626    second. If you specify 0, the wait is indefinite. When a timeout
10627    interval of 0 is specified, and a desired echo or prompt does not show
10628    up, the TRANSMIT command will not terminate until or unless you
10629    interrupt it with Ctrl-C; use SET TRANSMIT TIMEOUT 0 with caution.
10630
10631    Note: to blast a file out the communications connection without any
10632    kind of synchronization or timeouts or other manner of checking, use:
10633
10634   SET TRANSMIT ECHO OFF
10635   SET TRANSMIT PROMPT 0 (or include the /NOWAIT switch)
10636   SET TRANSMIT PAUSE 0
10637   TRANSMIT [ switches ] filename
10638
10639    In this case, text-file transmission is not-line oriented and large
10640    blocks can be sent, resulting in a significant performance improvement
10641    over line-at-at-time transmission. Successful operation depends (even
10642    more than usual for the TRANSMIT command!) on a clean connection with
10643    effective flow control.
10644
10645    For details on TRANSMIT and character sets, see [533]Section 6.6.5.4.
10646
10647   4.22. Coping with Faulty Kermit Implementations
10648
10649    Kermit protocol has been implemented in quite a few third-party
10650    commercial, shareware, and freeware software packages, with varying
10651    degrees of success. In most cases operation is satisfactory but slow --
10652    only the bare minimum subset of the protocol is available -- short
10653    packets, no sliding windows, no attributes, etc. In other cases, the
10654    implementation is incorrect, resulting in failures at the initial
10655    negotiation stage or corrupted files.
10656
10657    C-Kermit 7.0 and Kermit 95 1.1.19 include some new defense mechanisms
10658    to help cope with the most common situations. However, bear in mind
10659    there is only so much we can do in such cases -- the responsibility for
10660    fixing the problem lies with the maker of the faulty software.
10661
10662     4.22.1. Failure to Accept Modern Negotiation Strings
10663
10664    The published Kermit protocol specification states that new fields can
10665    be added to the parameter negotiation string. These are to be ignored
10666    by any Kermit implementation that does not understand them; this is
10667    what makes the Kermit protocol extensible. Unfortunately, some Kermit
10668    implementations become confused (or worse) when receiving a negotiation
10669    string longer than the one they expect. You can try working around such
10670    problems by telling Kermit to shorten its negotiation string (and thus
10671    disable the corresponding new features):
10672
10673   SET SEND NEGOTIATION-STRING-MAX-LENGTH number
10674
10675    Try a number like 10. If that doesn't work, try 9, 8, 7, 6, and so on.
10676
10677     4.22.2. Failure to Negotiate 8th-bit Prefixing
10678
10679    The published Kermit protocol specification states that 8th-bit
10680    prefixing (which allows transfer of 8-bit data over a 7-bit connection)
10681    occurs if the file sender puts a valid prefix character (normally "&")
10682    in the 8th-bit-prefix field of the negotiation string, and the receiver
10683    puts either a letter "Y" or the same prefix character. At least one
10684    faulty Kermit implementation exists that does not accept the letter
10685    "Y". To force C-Kermit / K-95 to reply with the other Kermit's prefix
10686    character rather than a "Y", give the following (invisible) command:
10687
10688   SET Q8FLAG ON
10689
10690    Use SET Q8FLAG OFF to restore the normal behavior.
10691
10692     4.22.3. Corrupt Files
10693
10694    Refer to [534]Section 4.22.2. Some Kermit implementations mistakenly
10695    interpret the "Y" as a prefix character. Then, whenever a letter Y
10696    appears in the data, the Y and the character that follows it are
10697    replaced by a garbage character. At this writing, we are not sure if
10698    there is any solution, but try "set send negotiation-string-max-length
10699    6" and/or "set q8flag on".
10700
10701    File corruption can also occur when control characters within the file
10702    data are sent without prefixing, as at least some are by default in
10703    C-Kermit 7.0 and K-95. Some Kermit implementations do not handle
10704    incoming "bare" control characters. To work around, "set prefixing
10705    all".
10706
10707     4.22.4. Spurious Cancellations
10708
10709    The Kermit protocol specification states that if an ACK to a Data
10710    packet contains X in its data field, the transfer of the current file
10711    is canceled, and if it contains a Z, the entire transfer is canceled.
10712    At least one overzealous Kermit implementation applies this rule to
10713    non-Data packets as well, the typical symptom being that any attempt to
10714    transfer a file whose name begins with X or Z results in cancellation.
10715    This is because the file receiver typically sends back the name under
10716    which it stored the file (which might not be the same as the name it
10717    was sent with) in the ACK to the File Header packet. This is
10718    information only and should not cause cancellation. To work around the
10719    problem, use:
10720
10721   SET F-ACK-BUG { ON, OFF }
10722
10723    ON tells Kermit not to send back the filename in the ACK to the file
10724    header packet as it normally would do (OFF puts Kermit back to normal
10725    after using ON).
10726
10727    A variation on the this bug occurs in an obscure Kermit program for
10728    MUMPS: When this Kermit program sends a file called (say) FOO.BAR, it
10729    requires that the ACK to its F packet contain exactly the same name,
10730    FOO.BAR. However, C-Kermit likes to send back the full pathname,
10731    causing the MUMPS Kermit to fail. SET F-ACK-BUG ON doesn't help here.
10732    So a separate command has been added to handle this situation:
10733
10734   SET F-ACK-PATH { ON, OFF }
10735
10736    Normally it is ON (regardless of the SET SEND PATHNAMES setting). Use
10737    SET F-ACK-PATH OFF to instruct Kermit to send back only the filename
10738    without the path in the ACK to the F packet.
10739
10740     4.22.5. Spurious Refusals
10741
10742    Some Kermit implementations, notably PDP-11 Kermit 3.60 and earlier,
10743    have bugs in their handling of Attribute packets that can cause
10744    unwarranted refusal of incoming files, e.g. based on date or size. This
10745    can be worked around by telling one or both of the Kermit partners to:
10746
10747   SET ATTRIBUTES OFF
10748
10749     4.22.6. Failures during the Data Transfer Phase
10750
10751    This can be caused by control-character unprefixing ([535]Section
10752    4.22.3 ), and fixed by:
10753
10754   SET PREFIXING ALL
10755
10756    It can also have numerous other causes, explained in Chapter 10 of
10757    [536]Using C-Kermit: the connection is not 8-bit transparent (so use
10758    "set parity space" or somesuch), inadequate flow control, etc. Consult
10759    the manual.
10760
10761     4.22.7. Fractured Filenames
10762
10763    At least one well-known PC-based communications package negotiates data
10764    compression, which (according to the protocol specification) applies to
10765    both the filename and the file data, but then fails to decompress the
10766    filename. Example: C-Kermit sends a file called R000101.DAT (where
10767    000101 might be non-Y2K-wise YYMMDD notation), and the package in
10768    question stores the files as R~#0101.DAT. Workaround: Tell C-Kermit to
10769    SET REPEAT COUNTS OFF.
10770
10771     4.22.8. Bad File Dates
10772
10773    At least one well-known PC-based communications package negotiates the
10774    passing of file timestamps from sender to receiver, but when it is
10775    sending files, it always gives them a timestamp of 1 February 1970.
10776    Workaround: tell C-Kermit to SET ATTRIBUTE DATE OFF. You don't get the
10777    file's real date, but you also don't get 1 Feb 1970; instead the file
10778    gets the current date and time.
10779
10780   4.23. File Transfer Recovery
10781
10782    Prior to C-Kermit 7.0, RESEND (SEND /RECOVER) and REGET (GET /RECOVER)
10783    refused to work if FILE TYPE was not BINARY or the /BINARY switch was
10784    not included. Now these commands include an implied /BINARY switch,
10785    meaning they set the file type to binary for the duration of the
10786    command automatically.
10787
10788    In the client/server arrangement, this also forces the server into
10789    binary mode (if it is C-Kermit 7.0 or greater, or K95 1.1.19 or
10790    greater) so the recovery operation proceeds, just as you asked and
10791    expected.
10792
10793    BUT... Just as before, the results are correct only under the following
10794    conditions:
10795
10796      * If the prior interrupted transfer was also in binary mode; or:
10797      * If the prior transfer was in text mode and the other computer was a
10798        "like platform" (e.g. UNIX-to-UNIX, Windows-to-Windows,
10799        DOS-to-Windows) AND there was no character-set translation (i.e.
10800        TRANSFER CHARACTER-SET was TRANSPARENT).
10801
10802    Note that these circumstances are more likely to obtain in C-Kermit
10803    7.0, in which:
10804
10805      * The default FILE TYPE in C-Kermit 7.0 is BINARY.
10806      * The default FILE INCOMPLETE setting is AUTO, which means KEEP if
10807        the transfer is in binary mode, DISCARD otherwise.
10808      * C-Kermit 7.0, Kermit 95 1.1.17, and MS-DOS Kermit 3.15 and later
10809        can recognize "like platforms" and switch into binary mode
10810        automatically. Transfers between like platforms are always binary
10811        unless character-set translation has been requested, and then is
10812        still binary for all files whose names match a binary pattern,
10813        unless the automatic mechanisms have been disabled (with a /TEXT
10814        switch, or with SET TRANSFER MODE MANUAL).
10815      * SEND /BINARY and GET /BINARY always force binary-mode transfers,
10816        even when FILE TYPE is TEXT, even when TRANSFER MODE is AUTOMATIC,
10817        even when PATTERNS are ON and the file's name matches a text
10818        pattern.
10819
10820    But also note that the automatic client/server transfer-mode
10821    adjustments do not work with versions of C-Kermit prior to 7.0 or K95
10822    prior to 1.1.16.
10823
10824    If the prior transfer was in text mode:
10825
10826      * If text-mode transfers between the two platforms are
10827        "length-changing" (as they are between UNIX -- which terminates
10828        text lines with LF -- and DOS or Windows -- which terminates text
10829        lines with CRLF), the recovered file will be corrupt.
10830      * If text-mode transfers between the two platforms are not
10831        length-changing, but character-set translation was active in the
10832        prior transfer, the result will be a file in which the first part
10833        has translated characters and the second part does not.
10834
10835    But in C-Kermit 7.0 and K95 1.1.19 and later, incompletely transferred
10836    text files are not kept unless you change the default. But if you have
10837    done this, and you have an incompletely transferred text file, you'll
10838    need to:
10839
10840      * Transfer the whole file again in text mode, or:
10841      * Use SEND /STARTING-AT: to recover the transfer at the correct
10842        point; but you have to find out what that point is, as described in
10843        the manual.
10844
10845    Kermit has no way of knowing whether the previous transfer was in text
10846    or binary mode so it is your responsibility to choose the appropriate
10847    recovery method.
10848
10849    If you use C-Kermit to maintain parallel directories on different
10850    computers, using SET FILE COLLISION to transfer only those files that
10851    changed since last time, and the files are big enough (or the
10852    connection slow enough) to require SEND /RECOVER to resume interrupted
10853    transfers, you should remember that SEND /RECOVER (RESEND) overrides
10854    all FILE COLLISION settings. Therefore you should use SEND /RECOVER
10855    (RESEND) only on the file that was interrupted, not the file group. For
10856    example, if the original transfer was initiated with:
10857
10858   SEND *
10859
10860    and was interrupted, then after reestablishing your connection and
10861    starting the Kermit receiver with SET FILE COLLISION UPDATE on the
10862    remote end, use the following sequence at the sender to resume the
10863    transfer:
10864
10865   SEND /RECOVER name-of-interrupted-file
10866
10867    and then:
10868
10869   SEND *
10870
10871    (In C-Kermit 7.0 and later, \v(filename) contains the name of the file
10872    most recently transferred, as long you have not EXITed from Kermit or
10873    changed directory, etc.
10874
10875   4.24. FILE COLLISION UPDATE Clarification
10876
10877    In UNIX, file modification dates are used when comparing the file date
10878    with the date in the attribute packet. In VMS, however, the file
10879    creation date is used. These two policies reflect the preferences of
10880    the two user communities.
10881
10882    Also, remember that the file date/time given in the attribute packet is
10883    the local time at the file sender. At present, no timezone conversions
10884    are defined in or performed by the Kermit protocol. This is primarily
10885    because this feature was designed at a time when many of the systems
10886    where Kermit runs had no concept of timezone, and therefore would be
10887    unable to convert (say, to/from GMT or UTC or Zulu time).
10888
10889    As a consequence, some unexpected results might occur when transferring
10890    files across timezones; e.g. commands on the target system that are
10891    sensitive to file dates might not work (UNIX "make", backups, etc).
10892
10893    Timezone handling is deferred for a future release.
10894
10895   4.25. Autodownload Improvements
10896
10897    Refer to pages 164-165 of [537]Using C-Kermit about the hazards of
10898    autodownload when C-Kermit is "in the middle". As of C-Kermit 7.0, no
10899    more hazards. If C-Kermit has TERMINAL AUTODOWNLOAD ON and it detects a
10900    packet of the current protocol type (Kermit or Zmodem), it "erases" the
10901    visual aspect of the packet that would be seen by the terminal (or,
10902    more to the point, the emulator, such as K95). This way, only C-Kermit
10903    goes into RECEIVE mode, and not also the terminal emulator through
10904    which C-Kermit is accessed. And therefore, it is no longer necessary to
10905    SET TERMINAL AUTODOWNLOAD OFF to prevent multiple Kermits from going
10906    into receive mode at once, but of course it is still necessary to
10907    ensure that, when you have multiple Kermits in a chain, that the
10908    desired one receives the autodownload.
10909
10910    The defaults have not been changed; Kermit 95 still has autodownload ON
10911    by default, and C-Kermit has it OFF by default.
10912
10913   5. CLIENT/SERVER
10914
10915   5.0. Hints
10916
10917    If you use SET SERVER GET-PATH to set up your server, and the GET-PATH
10918    does not include the server's current directory, clients can become
10919    quite confused. For example, "remote dir oofa.txt" shows a file named
10920    oofa.txt, but "get oofa.txt" fails. In this situation, you should
10921    either DISABLE DIR or make your GET-PATH include the current directory.
10922
10923   5.1. New Command-Line Options
10924
10925    The -G command-line option is like -g (GET), except the incoming file
10926    is sent to standard output rather than written to disk.
10927
10928    The -I option ("Internet") is used to tell a remote C-Kermit program
10929    that you are coming in via Internet Telnet or Rlogin and therefore have
10930    a reliable connection. The -I option is equivalent to SET RELIABLE ON
10931    and SET FLOW NONE.
10932
10933    The -O option ("Only One") tells C-Kermit to enter server mode but then
10934    exit after the first client operation.
10935
10936    See [538]Section 9.3 for details.
10937
10938   5.2. New Client Commands
10939
10940    BYE and FINISH no longer try to do anything if a connection is not
10941    active. Thus a sequence like "hangup" followed by "bye" or "finish"
10942    will no longer get stuck in a long timeout-and-retransmission cycle,
10943    nor will it try to open a new connection.
10944
10945    REMOTE EXIT
10946           Similar to FINISH, except it ensures that the Kermit server
10947           program exits back to the operating system or shell prompt.
10948           (FINISH would return it to its interactive prompt if it was
10949           started in interactive mode, and would cause it to exit if it
10950           entered server mode via command-line option.) When C-Kermit is
10951           to be the server, you can use { ENABLE, DISABLE } EXIT to
10952           control the client's access to this feature.
10953
10954    REMOTE MKDIR directory-name
10955           Tells the client to ask the server to create a directory with
10956           the given name, which can be absolute or relative. The syntax of
10957           the directory name depends on the Kermit server (see [539]next
10958           section); in all cases, it can be in the syntax of the system
10959           where the server is running (UNIX, VMS, DOS, etc) but newer
10960           servers also accept UNIX syntax, no matter what the underlying
10961           platform. The server will not execute this command if (a) it
10962           does not understand it, (b) a DISABLE MKDIR command has been
10963           given, or (c) a DISABLE CWD command has been given; otherwise,
10964           the command is executed, but will fail if the directory can not
10965           be created, in which cases most servers will attempt to return a
10966           message giving the reason for failure. The REMOTE MKDIR command
10967           succeeds if the remote directory is created, or if it already
10968           exists and therefore does not need to be created, and fails
10969           otherwise.
10970
10971    REMOTE RMDIR directory-name
10972           Tells the client to ask the server to remove (delete) a
10973           directory with the given name. The same considerations apply as
10974           for REMOTE MKDIR.
10975
10976    REMOTE SET FILE INCOMPLETE { DISCARD, KEEP, AUTO }
10977           Previously this was only available in its earlier form, REMOTE
10978           SET INCOMPLETE (no FILE). The earlier form is still available,
10979           but invisible. Also, AUTO was added, meaning KEEP if in binary
10980           mode, DISCARD otherwise.
10981
10982    REMOTE SET TRANSFER MODE { AUTOMATIC, MANUAL }
10983           Tells the client to ask the server to set the given
10984           file-transfer mode. Automatic means (roughly): if the client and
10985           the server are running on the same kind of computer (e.g. both
10986           are on UNIX), then use binary mode automatically; if the system
10987           types are different, use some other method to automatically
10988           determine text or binary mode, such as filename pattern
10989           matching. MANUAL means, in this context, obey the client's FILE
10990           TYPE setting (TEXT or BINARY). Synonym: REMOTE SET XFER MODE.
10991
10992    [ REMOTE ] QUERY KERMIT function(args...)
10993           Prior to C-Kermit 7.0, the arguments were not evaluated locally.
10994           Thus it was not possible to have the server run the function
10995           with client-side variables as arguments. Now:
10996
10997   define \%a oofa.*
10998   remote query kermit files(\%a)    ; Client's \%a
10999   remote query kermit files(\\%a)   ; Server's \%a
11000
11001    [ REMOTE ] LOGIN [ user [ password ] ]
11002           LOGIN is now a synonym for REMOTE LOGIN.
11003
11004    LOGOUT
11005           This command, when given in local mode, is equivalent to REMOTE
11006           LOGOUT. When given at the IKSD prompt, it logs out the IKSD.
11007           When given at the C-Kermit prompt when it has no connection, it
11008           does nothing.
11009
11010    Note that in C-Kermit 7.0, the REMOTE (or R) prefix is not required for
11011    QUERY, since there is no local QUERY command. The new top-level QUERY
11012    command does exactly what REMOTE QUERY (RQUERY) does.
11013
11014    All REMOTE commands now have single-word shortcuts:
11015
11016  Shortcut   Full Form
11017   RASG       REMOTE ASSIGN
11018   RCD        REMOTE CD
11019   RCOPY      REMOTE COPY
11020   RDEL       REMOTE DELETE
11021   RDIR       REMOTE DIRECTORY
11022   REXIT      REMOTE EXIT
11023   RHELP      REMOTE HELP
11024   RHOST      REMOTE HOST
11025   RPWD       REMOTE PWD
11026   RSET       REMOTE SET
11027   etc.
11028
11029    The R prefix is not applied to LOGIN because there is already an RLOGIN
11030    command with a different meaning. It is not applied to LOGOUT either,
11031    since LOGOUT knows what to do in each case, and for symmetry with
11032    LOGIN.
11033
11034     5.2.1. Remote Procedure Definitions and Calls
11035
11036    This is nothing new, but it might not be obvious... REMOTE ASSIGN and
11037    REMOTE QUERY may be used to achieve remote procedure execution. The
11038    remote procedure can be defined locally or remotely.
11039
11040    A remote procedure call is accomplished as noted in the previous
11041    section:
11042
11043   [ remote ] query kermit function-name(args...)
11044
11045    This invokes any function that is built in to the Kermit server, e.g.:
11046
11047   [ remote ] query kermit size(foo.bar)
11048
11049    returns the size of the remote file, foo.bar.
11050
11051    Now note that C-Kermit includes an \fexecute() function, allowing it to
11052    execute any macro as if it were a built-in function. So suppose MYMACRO
11053    is the name of a macro defined in the server. You can execute it from
11054    the client as follows (the redundant "remote" prefix is omitted in the
11055    remaining examples):
11056
11057   query kermit execute(mymacro arg1 arg2...)
11058
11059    The return value, if any, is the value of the RETURN command that
11060    terminated execution of the macro, for example:
11061
11062   define addtwonumbers return \feval(\%1+\%2)
11063
11064    The client invocation would be:
11065
11066   query kermit execute(addtwonumbers 3 4)
11067   7
11068
11069    The result ("7" in this case) is also assigned to the client's
11070    \v(query) variable.
11071
11072    To execute a remote system command or command procedure (shell script,
11073    etc) use:
11074
11075   query kermit command(name args...)
11076
11077    Finally, suppose you want the client to send a macro to the server to
11078    be executed on the server end. This is done as follows:
11079
11080   remote assign macroname definition
11081   query kermit execute(macroname arg1 arg2...)
11082
11083    Quoting is required if the definition contains formal parameters.
11084
11085   5.3. New Server Capabilities
11086
11087     5.3.1. Creating and Removing Directories
11088
11089    The C-Kermit 7.0 server responds to REMOTE MKDIR and REMOTE RMDIR
11090    commands. The directory name may be in either the native format of the
11091    server's computer, or in UNIX format. For example, a server running on
11092    VMS with a current directory of [IVAN] can accept commands from the
11093    client like:
11094
11095   remote mkdir olga         ; Makes [IVAN.OLGA] (nonspecific format)
11096   remote mkdir .olga        ; Makes [IVAN.OLGA] (VMS format without brackets)
11097   remote mkdir olga/        ; Makes [IVAN.OLGA] (UNIX relative format)
11098   remote mkdir /ivan/olga   ; Makes [IVAN.OLGA] (UNIX absolute format)
11099   remote mkdir [ivan.olga]  ; Makes [IVAN.OLGA] (VMS absolute format)
11100   remote mkdir [.olga]      ; Makes [IVAN.OLGA] (VMS relative format)
11101
11102     5.3.1.1. Creating Directories
11103
11104    If a directory name is given that contains more than one segment that
11105    does not exist, the server attempts to create all the segments. For
11106    example, if the client says:
11107
11108   REMOTE MKDIR letters/angry
11109
11110    a "letters" subdirectory is created in the server's current directory
11111    if it does not already exist, and then an "angry" subdirectory is
11112    created beneath it, if it does not already have one. This can repeated
11113    to any reasonable depth:
11114
11115   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
11116
11117     5.3.1.2. Removing Directories
11118
11119    When attempting to execute a REMOTE RMDIR, the server can remove only a
11120    single directory, not an entire sequence or tree. The system service
11121    that is called to remove the directory generally requires not only that
11122    the server process has write delete access, but also that the directory
11123    contain no files.
11124
11125    In the future, a REMOTE RMDIR /RECURSIVE command (and the accompanying
11126    protocol) might be added. For now, use the equivalent REMOTE HOST
11127    command(s), if any.
11128
11129     5.3.2. Directory Listings
11130
11131    Directory listings are generated by C-Kermit itself, rather than by
11132    running the underlying system's directory command. Some control over
11133    the listing format can be obtained with the SET OPTIONS DIRECTORY
11134    command ([540]Section 4.5.1). The following options affect listings
11135    sent by the server: /[NO]HEADING, /[NO]DOTFILES, and /[NO]BACKUP. In
11136    UNIX and VMS, the listing is always sorted by filename. There is, at
11137    present, no protocol defined for the client to request listing options
11138    of the server; this might be added in the future.
11139
11140    The server's directory listings are in the following format:
11141
11142    Protection or permissions:
11143           In UNIX and OS-9, this is a 10-character field, left adjusted.
11144           In VMS it is a 22-character field, left-adjusted. In each case,
11145           the protection / permission codes are shown in the server
11146           platform's native format. In other operating systems, this field
11147           is not shown.
11148
11149    Size in bytes:
11150           This is always a 10-character field. The file's size is shown as
11151           a decimal number, right adjusted in the field. If the file is a
11152           directory and its size can not be obtained, the size is shown as
11153           "<DIR>". Two blanks follow this field.
11154
11155    Date:
11156           Always in yyyy-mm-dd hh:mm:ss numeric format, and therefore 19
11157           characters long. If the file's date/time can't be obtained,
11158           zeros (0) are shown for all the digits. This field is followed
11159           by two blanks.
11160
11161    Filename:
11162           This field extends to the end of the line. Filenames are shown
11163           relative to the server's current directory. In UNIX, symbolic
11164           links are shown as they are in an "ls -l" listing as "linkname
11165           -> filename".
11166
11167    In UNIX and VMS, listings are returned by the server in alphabetical
11168    order of filename. There are presently no other sort or selection
11169    options.
11170
11171    However, since these are fixed-field listings, all fields can be used
11172    as sort keys by external sort programs. Note, in particular, that the
11173    format used for the date allows a normal lexical on that field to
11174    achieve the date ordering. For example, let's assume we have a UNIX
11175    client and a UNIX server. In this case, the server's listing has the
11176    date in columns 22-40, and thus could be sorted by the UNIX sort
11177    program using "sort +0.22 -0.40" or in reverse order by "sort +0.22
11178    -0.40r".
11179
11180    Since the UNIX client can pipe responses to REMOTE commands through
11181    filters, any desired sorting can be accomplished this way, for example:
11182
11183 C-Kermit> remote directory | sort +0.22 -0.40
11184
11185    You can also sort by size:
11186
11187   C-Kermit> remote directory | sort +0.11 -0.19
11188
11189    You can use sort options to select reverse or ascending order. "man
11190    sort" (in UNIX) for more information. And of course, you can pipe these
11191    listings through any other filter of your choice, such as grep to skip
11192    unwanted lines.
11193
11194   5.4. Syntax for Remote Filenames with Embedded Spaces
11195
11196    C-Kermit and K95, when in server mode, assume that any spaces in the
11197    file specification in an incoming GET command are filename separators.
11198    Thus if the client gives a command like:
11199
11200   get {oofa.txt oofa.bin}
11201
11202    or, equivalently:
11203
11204   mget oofa.txt oofa.bin
11205
11206    the server tries to send the two files, oofa.txt and oofa.bin. But what
11207    if you want the server to send you a file named, say:
11208
11209   D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL
11210
11211    How does the server know this is supposed to be one file and not seven?
11212    In this case, you need to the send file name to the server enclosed in
11213    either curly braces:
11214
11215   {D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}
11216
11217    or ASCII doublequotes:
11218
11219   "D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"
11220
11221    The method for doing this depends on your client. If your client is
11222    C-Kermit 7.0, any recent version of Kermit 95, or MS-DOS Kermit 3.16,
11223    then you have to enclose the name in braces just so the client can
11224    parse it, so to send braces or doublequotes to the server, you must put
11225    them inside the first, outside pair of braces. And you also need to
11226    double the backslashes to prevent them from being interpreted:
11227
11228   get {{D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL}}
11229   get {"D:\\HP OfficeJet 500\\Images\\My Pretty Picture Dot PCL"}
11230
11231    To get around the requirement to double backslashes in literal
11232    filenames, of course you can also use:
11233
11234   set command quoting off
11235   get {{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}}
11236   get {"D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL"}
11237   set command quoting on
11238
11239    If you are giving a "kermit" command to the UNIX shell, you have to
11240    observe the shell's quoting rules, something like this:
11241
11242   kermit -ig "{D:\HP OfficeJet 500\Images\My Pretty Picture Dot PCL}"
11243
11244    Here, the quotes go on the outside so UNIX will pass the entire
11245    filename, spaces, braces, and all, as a single argument to Kermit, and
11246    the backslashes are not doubled because (a) the UNIX shell ignores them
11247    since they are in a quoted string, and (b) Kermit ignores them since
11248    the interactive command parser is not activated in this case.
11249
11250   5.5. Automatic Orientation Messages upon Directory Change
11251
11252    C-Kermit 7.0, when acting as a server, can send an orientation message
11253    to the client whenever the server directory changes. For example, when
11254    the client gives a REMOTE CD command, the server sends the contents of
11255    the new directory's "Read Me" file to the client's screen. The
11256    following commands govern this feature:
11257
11258    SET SERVER CD-MESSAGE FILE name
11259           Given to the servr, allows the message-file name to be specified
11260           at runtime. A list of names to look for can be given in the
11261           following format:
11262
11263   {{name1}{name2}{name3}{...}}
11264
11265           e.g. SET SERVER CD-MESSAGE FILE
11266           {{./.readme}{README.TXT}{READ.ME}}
11267
11268    REMOTE SET SERVER CD-MESSAGE { ON, OFF }
11269           Given to the client, lets the client control whether the server
11270           sends automatic CD messages.
11271
11272    SHOW SERVER
11273           Given to server, includes CD-Message status.
11274
11275    The default CD message file name is system dependent. SHOW CD or SHOW
11276    SERVER displays the list. Also see [541]Section 4.5.2.
11277
11278   5.6. New Server Controls
11279
11280    DISABLE ENABLE
11281           Allows the server to configured such that DISABLEd features can
11282           not be re-enabled by any means -- e.g. if the client is somehow
11283           able to get the server into command mode. Once DISABLEd, ENABLE
11284           can not be re-ENABLEd.
11285
11286    SET SERVER IDLE-TIMEOUT seconds
11287           This was available previously in Kermit 95 only. Now it can be
11288           used in C-Kermit also to specify a maximum number of seconds the
11289           server is allowed to be idle before exiting server mode. 0
11290           seconds means no idle timeout. In C-Kermit (but not K-95), SET
11291           SERVER TIMEOUT and SET SERVER IDLE-TIMEOUT are mutually
11292           exclusive -- you can have one or the other (or neither), but not
11293           both. (Server timeouts are for the benefit of primitive Kermit
11294           clients that are not capable of timing out on their own; to our
11295           knowledge, no such clients are still in circulation.)
11296
11297    SET SERVER KEEPALIVE { ON, OFF }
11298           (See next section).
11299
11300   5.7. Timeouts during REMOTE HOST Command Execution
11301
11302    Prior to C-Kermit 7.0, the C-Kermit server would block waiting for
11303    output from a system command invoked via REMOTE HOST from the client.
11304    If the system command took a long time to execute, the client would
11305    time out and send NAK packets. If the command took too long, the client
11306    would reach its retry limit and give up. Even if it didn't, the NAKs
11307    would cause unnecessary retransmissions.
11308
11309    In version 7.0, the C-Kermit server (VMS and select()-capable UNIX
11310    versions only), sends "keepalive packets" (empty data packets) once per
11311    second while waiting for the system command to complete. This procedure
11312    should be entirely transparent to the Kermit client, and should prevent
11313    the unwanted timeouts and NAKs. When C-Kermit 7.0 itself (or K95
11314    1.1.19) is the client, it prints dots to show the keepalive packets.
11315
11316    The keepalive feature can be turned off and on with:
11317
11318   SET SERVER KEEPALIVE { ON, OFF }
11319
11320    Normally it should be on. Turn it off it if causes trouble with the
11321    client, or if it seems to slow down the server (as it might on some
11322    platforms under certain circumstances).
11323
11324   6. INTERNATIONAL CHARACTER SETS
11325
11326    Support for several new single-byte character sets was added in
11327    C-Kermit 7.0. Unicode / ISO 10646 is not yet supported, but is a high
11328    priority for forthcoming releases.
11329
11330   6.0. ISO 8859-15 Latin Alphabet 9
11331
11332    To accommodate the Euro currency symbol, and to correct several other
11333    longstanding problems with ISO Latin Alphabet 1, ISO 8859-15 Latin
11334    Alphabet 9 was issued in May 1998. It is supported by C-Kermit 7.0 as a
11335    transfer character set, a file character set, and a terminal character
11336    set. Translations that preserve the new characters are available
11337    between Latin-9 and several other sets including:
11338
11339   PC Code Page 858         (Western European languages, similar to CP850)
11340   Windows Code Page 1252   (Western European languages, similar to Latin-1)
11341   Windows Code Page 1250   (Eastern European languages, similar to Latin-2)
11342
11343    The Latin-9 transfer character set also allows for the OE digraph
11344    character, used primarily in French, to be preserved in transfers
11345    involving the DEC MCS or NeXT character sets.
11346
11347    The Euro character is also present in the Universal Character Set,
11348    described in [542]Section 6.6.
11349
11350   6.1. The HP-Roman8 Character Set
11351
11352    The HP-Roman8 character set is supported in C-Kermit 6.0 and later but
11353    was omitted from Table VII-4 in the 2nd Edition of Using C-Kermit due
11354    to lack of space. It is listed in [543]Appendix III.
11355
11356   6.2. Greek Character Sets
11357
11358    Greek character sets were added in 6.1:
11359
11360   SET FILE CHARACTER-SET { CP869, ELOT927, GREEK-ISO }
11361   SET TRANSFER CHARACTER-SET { GREEK-ISO }
11362
11363    GREEK-ISO is ISO 8859-7, which the same as ELOT 928.
11364
11365    The new Greek character sets are listed in [544]Appendix III.
11366
11367   6.3. Additional Latin-2 Character Sets
11368
11369    The following have been added as FILE and TERMINAL CHARACTER-SETs:
11370
11371    MAZOVIA-PC
11372           A PC code page used in Poland, equivalent to CP437, but with 18
11373           substitutions needed for Polish.
11374
11375    CP1250
11376           The Windows Latin 2 Code Page. Equivalent to ISO 8859-2, but
11377           with different encoding.
11378
11379   6.4. Additional Cyrillic Character Sets
11380
11381    The following have been added as FILE and TERMINAL CHARACTER-SETs:
11382
11383    BULGARIA-PC
11384           This is the Cyrillic PC code page used in Bulgaria, where it is
11385           called Code Page 856. It is attributed to a company called
11386           DATEC, Inc, but CP856 is not a proper designation, since it
11387           refers to a Hebrew Code Page (see the IBM Registry).
11388
11389    CP855
11390           This PC Code Page contains all the Cyrillic letters that are
11391           also in ISO 8859-5, and is therefore useful for non-Russian
11392           Cyrillic text (Ukrainian, Belorussian, etc), unlike CP866, which
11393           has a smaller repertoire of Cyrillic letters.
11394
11395    CP1251
11396           The Windows Cyrillic Code Page. Equivalent to CP855, but with
11397           different encoding.
11398
11399    KOI8R
11400           An extension to "Old KOI-8" that adds upper and lower case
11401           Cyrillic letter Io (looks like Roman E with diaeresis) plus a
11402           selection of box-drawing characters to columns 8 through 11,
11403           which are vacant in original Old KOI-8. KOI8-R is used for the
11404           Russian language. It is specified in [545]RFC 1489.
11405
11406    KOI8U
11407           A similar extension of Old KOI-8, but for Ukrainian. It is
11408           specified in [546]RFC 2319.
11409
11410   6.5. Automatic Character-Set Switching
11411
11412    Prior to version 7.0, C-Kermit's file character-set always had to be
11413    set explicitly. In 7.0 and later, it is set automatically when:
11414
11415     1. This feature is enabled (as it is unless you disable it).
11416     2. An incoming text-mode transfer includes a transfer-character-set
11417        announcer and you have not previously given a SET FILE
11418        CHARACTER-SET command. In this case, C-Kermit switches to an
11419        appropriate file character set. For example, on an HP-UX
11420        workstation, an incoming Latin-1 file automatically selects
11421        HP-Roman8 for the local copy of the file; in Data General AOS/VS,
11422        it would select DG International.
11423     3. You give a SET TRANSFER CHARACTER-SET command without having
11424        previously specified a FILE CHARACTER-SET. An appropriate file
11425        character-set is chosen automatically.
11426
11427    In addition, when you give a SET FILE CHARACTER-SET command, the
11428    appropriate transfer character-set is automatically chosen, to be used
11429    when you are sending files (but this does not override the one
11430    announced by the sender when you are receiving files).
11431
11432    You might not agree about what is "appropriate", so of course you can
11433    disable or change all of the above actions.
11434
11435    You can disable (or re-enable) the new automatic character-set
11436    switching feature in each direction separately:
11437
11438    SET RECEIVE CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
11439           AUTOMATIC is the default, causing the behavior described above
11440           when an incoming file arrives. Choose MANUAL to defeat this
11441           behavior and force your current FILE CHARACTER-SET setting to be
11442           used, no matter what it is. Note that SET RECEIVE CHARACTER-SET
11443           MANUAL does not disable recognition of the incoming transfer
11444           character-set announcer, and translation from the corresponding
11445           character-set to your current file character-set. To disable
11446           that, use SET ATTRIBUTE CHARACTER-SET OFF.
11447
11448    SET SEND CHARACTER-SET-SELECTION { AUTOMATIC, MANUAL }
11449           Again AUTOMATIC is the default, causing the behavior described
11450           above when you give a SET { FILE, TRANSFER } CHARACTER-SET
11451           command. Use MANUAL to allow you to specify the transfer and
11452           file character-sets independently.
11453
11454    SHOW CHARACTER-SETS
11455           Tells settings of { SEND, RECEIVE } CHARACTER-SET-SELECTION.
11456
11457    Normally, however, it is more convenient to leave automatic switching
11458    active, and change any associations that are not appropriate for your
11459    application, area, or country. The commands are:
11460
11461    SHOW ASSOCIATIONS
11462           This command lists all the associations in each direction: for
11463           each possible transfer character-set, it lists the associated
11464           file character-set, and vice versa. These are two separate and
11465           independent lists.
11466
11467    ASSOCIATE TRANSFER-CHARACTER-SET name1 [ name2 ]
11468           Changes the association for the transfer character-set name1 to
11469           be the file character-set name2. If name2 is omitted, automatic
11470           switching is disabled for this transfer character-set only.
11471
11472    ASSOCIATE FILE-CHARACTER-SET name1 [ name2 ]
11473           Changes the association for the file character-set name1 to be
11474           the transfer character-set name2. If name2 is omitted, automatic
11475           switching is disabled for this file character-set only.
11476
11477   6.6. UNICODE
11478
11479    C-Kermit 7.0 adds support for Unicode, the Universal Character Set,
11480    for:
11481
11482      * File Transfer (SEND, RECEIVE, GET, etc)
11483      * Terminal connection (CONNECT)
11484      * Unguarded file capture (LOG SESSION)
11485      * Unguarded file transmission (TRANSMIT)
11486      * Local file character-set conversion (TRANSLATE)
11487
11488    C-Kermit is not, however, a "Unicode application" in the sense that its
11489    commands, messages, or user interface are Unicode. Rather, it is
11490    "Unicode aware" in its ability to handle and convert Unicode text in
11491    the course of file transfer and terminal connection, and you can also
11492    use Kermit to convert local files between Unicode and other character
11493    sets. TLA's:
11494
11495   BMP - Base Multilingual Plane
11496   BOM - Byte Order Mark
11497   CJK - Chinese, Japanese, and Korean
11498   ISO - International Standards Organization
11499   TLA - Three-Letter Acronym
11500   UCS - Universal Character Set
11501   UTF - UCS Transformation Format
11502
11503    Unicode and ISO 10646 are the coordinated and compatible corporate and
11504    international standards for the Universal Character Set (UCS). Unlike
11505    single-byte and even most multibyte character sets, the UCS can
11506    represent all characters in every existing writing system. A flat
11507    plain-text file encoded in some form of UCS can contain any mixture of
11508    English, Spanish, Italian, German, Hebrew, Arabic, Greek, Russian,
11509    Armenian, Georgian, Japanese, Chinese, Korean, Vietnamese, Tibetan,
11510    Hindi, Bengali, Tamil, Thai, Ethiopic, and so on, plus scientific and
11511    mathematical notation, as well as texts in Runes, Ogham, Glagolitic,
11512    and other historic scripts.
11513
11514    The UCS already covers these scripts and many more, but it's an
11515    evolving standard with efforts underway to accommodate even more
11516    languages and writing systems. Support is growing for native UCS use on
11517    many platforms and in many applications. The goal of the framers of the
11518    UCS is for it to replace ASCII, the ISO Latin Alphabets, ISCII, VISCII,
11519    the Chinese, Japanese, and Korean (CJK) multibyte sets, etc, as well as
11520    the many private character sets in use today, in other words to become
11521    *the* Universal Character Set.
11522
11523    Until that time, however, conversions between existing sets and the UCS
11524    will be necessary when moving text between platforms and applications.
11525    Now Kermit can help.
11526
11527     6.6.1. Overview of Unicode
11528
11529    For a more complete picture, please visit:
11530
11531   [547]http://www.unicode.org/
11532
11533    and access the various online introductions, FAQs, technical reports,
11534    and other information. For greater depth, order the latest version of
11535    the published Unicode Standard. The following overview contains a great
11536    many oversimplifications and perhaps an opinion or two.
11537
11538    At present, the UCS is a 16-bit (2-byte) character set, but with
11539    provisions to grow to a 4-byte set. UCS-2 refers to the two-byte set,
11540    also called the Base Multilingual Plane (BMP), in which each character
11541    has 16 bits, and therefore there are 2^16 = 65536 possible characters.
11542    The first 128 characters are the same as US ASCII (C0 control
11543    characters and DEL included), the next 32 are the C1 control characters
11544    of ISO 6429, and the next 96 are the Right Half of ISO 8859-1 Latin
11545    Alphabet 1. The remaining tens of thousands of characters are arranged
11546    newly for the UCS, usually (but not always) in sections corresponding
11547    to existing standards, such as ISO Latin/Cyrillic, often plus
11548    additional characters not appearing in the existing standards due to
11549    lack of space (or other reasons).
11550
11551    ISO 10646 allows for additional planes, e.g. for Egyptian hieroglyphics
11552    or ancient (or other esoteric) CJK characters, but these planes are not
11553    yet defined and so we will say nothing more about them here, except
11554    that their use will require the 4-byte form of UCS, called UCS-4, in
11555    some form (more about "forms" in [548]Section 6.6.2).
11556
11557    Unicode and ISO 10646 are constantly under revision, mainly to add new
11558    characters. The Unicode revision is denoted by a version number, such
11559    as 1.0, 1.1, 2.0, 3.0. The ISO 10646 standard revision is identified by
11560    Edition (such as ISO 10646-1 1993), plus reference to any amendments.
11561    The first versions of these standards included encodings for Korean
11562    Hangul syllables (Jamos); these encodings were changed in version 1.1
11563    of Unicode and by Amendment 5 to ISO 10646-1. The Unicode Technical
11564    Committee and the ISO acknowledge that this was a bad thing to do, and
11565    promise never change encodings or character names again, since this
11566    poses serious problems for conformance and data interchange.
11567
11568    A UCS-2 value is customarily written like this:
11569
11570   U+xxxx
11571
11572    where "xxxx" represents four hexadecimal digits, 0-9 and A-F. For
11573    example, U+0041 is "A", U+00C1 is A-acute, U+042F is uppercase Cyrillic
11574    "Ya", U+FB4F is Hebrew Ligature Alef Lamed, and U+FFFD is the special
11575    character that means "not a character".
11576
11577    Most characters from widely-used alphabetic writing systems such as the
11578    West European ones, Cyrillic, Greek, Hebrew, Vietnamese, etc, are
11579    available in "precomposed" form; for example Uppercase Latin Letter A
11580    with Acute Accent is a single character (as it is in Latin-1). However,
11581    the UCS also permits composition of a base character with one or more
11582    nonspacing diacritics. This means the same character can be represented
11583    in more than one way, which can present problems in many application
11584    areas, including transfer and character-set conversion of text.
11585
11586    Conversion from ASCII or Latin-1 to UCS-2 text is "trivial": simply
11587    insert a NUL (0) byte before each ASCII or Latin-1 byte. Converting in
11588    the reverse direction (provided the UCS-2 file contains only U+0000 to
11589    U+00FF) is equally simple (if we ignore the issue of composition):
11590    remove every second (NUL) byte. Conversion of other character sets to
11591    and from UCS, however, requires tables or algorithms specific to each
11592    set. Nevertheless, the relatively transparent upwards compatibility
11593    from ASCII and Latin-1, in which a very large share of the world's
11594    textual data is encoded, gives the UCS an entree onto existing
11595    platforms.
11596
11597    But the 2-byte format and the preponderance of NUL and other control
11598    bytes in UCS-2 text pose problems for current applications and
11599    transmission methods. And to make matters worse, different hardware
11600    platforms store UCS-2 characters in different byte order. Thus a UCS-2
11601    file transferred by FTP (or accessed via NFS, etc) between two
11602    computers with different architecture might have its bytes in the wrong
11603    order (or worse; see [549]Section 6.6.5.1 ).
11604
11605     6.6.2. UCS Byte Order
11606
11607    Consider the number 1. In an 8-bit byte, this would be represented by
11608    the following series of 0- and 1-bits:
11609
11610   +-----------------+
11611   | 0 0 0 0 0 0 0 1 |
11612   +-----------------+
11613
11614    Therefore in a 16-bit "word" the representation might be:
11615
11616   +-----------------+-----------------+
11617   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
11618   +-----------------+-----------------+
11619
11620    Now consider the number 256, which is 2 to the 8th power. The binary
11621    representation is 100000000 (1 followed by 8 zeros). 256 would go into
11622    a 16-bit word like this:
11623
11624   +-----------------+-----------------+
11625   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
11626   +-----------------+-----------------+
11627
11628    When a computer works this way, it is said to be Big Endian, meaning it
11629    puts the most significant (biggest) byte first (on the "left") in a
11630    16-bit word, and the least significant byte second (on the right).
11631
11632    However, some other computers have the opposite arrangement, called
11633    Little Endian, in which 1 is:
11634
11635   +-----------------+-----------------+
11636   | 0 0 0 0 0 0 0 1 | 0 0 0 0 0 0 0 0 |
11637   +-----------------+-----------------+
11638
11639    and 256 is:
11640
11641   +-----------------+-----------------+
11642   | 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 0 1 |
11643   +-----------------+-----------------+
11644
11645    Computers such as Sparc, MIPS, PA-RISC, and PowerPC are Big Endian,
11646    whereas the PC and the Alpha are Little Endian. Endianness has never
11647    been an issue with 7- or 8-bit characters, but it is with UCS
11648    characters. It can be a tricky business to share or transfer a UCS-2
11649    file between two different kinds of computers.
11650
11651    To alleviate (but not entirely solve) the problem, UCS-2 files are
11652    supposed to begin with the Unicode character U+FEFF, Zero-Width
11653    No-Break Space (ZWNBS). This is a kind of "no-op" (note: any such
11654    assertion must normally be qualified with many "but ifs" and "excepts"
11655    which are omitted here in the interest of brevity). If the bytes are
11656    reversed the ZWNBS becomes U+FFFE, which is not (and never will be) a
11657    defined UCS character. U+FEFF at the beginning of a UCS file is
11658    therefore called a Byte Order Mark, or BOM.
11659
11660    Any application that creates a UCS-2 (or UTF-16, or UCS-4) file should
11661    include a BOM, and any application that reads one should test for a
11662    BOM, and if one is found, infer the byte order from it. This is a
11663    convention, however -- not a standard or a requirement -- and
11664    applications vary in their ability to handle BOMs and "backwards" UCS-2
11665    files.
11666
11667    Note that a BOM is useful only at the beginning of a file. If you
11668    append one UCS-2 file to another, and both have BOMs, the internal BOM
11669    is no longer a BOM. And if the byte orders of the two files differ,
11670    then either the first part or the second will be backwards. (Various
11671    other undesirable effects might also occur, not discussed here.)
11672
11673     6.6.2. UCS Transformation Formats
11674
11675    UCS textual data can be modified in various ways for transmission or
11676    storage. Any officially sanctioned method of doing this is called a UCS
11677    Transformation Format, or UTF. One such method, called UTF-16, is
11678    essentially identical with UCS-2 except that it designates certain code
11679    values as "escape sequences" (called surrogate pairs) to access
11680    characters in other planes without having to use full UCS-4. We won't
11681    discuss UTF-16 further here, since at the moment there are no other
11682    planes. Several other UTF's (such as UTF-1, UTF-2, and UTF-7) have
11683    fallen into disuse and are not discussed here. The most important
11684    transformation format today is UTF-8.
11685
11686    UTF-8, so called because it "serializes" UCS-2 data into a stream of
11687    8-bit bytes, is designed to allow the UCS to work with present-day
11688    communications gear, computers, and software. The most important
11689    properties of UTF-8 are that byte order is constant (no byte swapping)
11690    and all (7-bit) ASCII characters represent themselves. Therefore
11691    conversion between ASCII and UTF-8 is no conversion at all, and
11692    applications or platforms (such as Plan 9 from Bell Labs) that use
11693    UTF-8 "for everything" can still run traditional ASCII-only
11694    applications and be accessed from them. In particular, unlike UCS-2,
11695    ASCII characters are not padded with NUL bytes. But also unlike UCS-2,
11696    there is no transparency for Latin-1 or any other non-ASCII character
11697    set. Every non-ASCII UCS-2 character is represented by a sequence of 2
11698    or 3 UTF-8 bytes. Thus UTF-8 is more compact than UCS-2 for text
11699    containing a preponderance of ABC's (or other ASCII characters), about
11700    the same as UCS-2 for other alphabetic scripts (Cyrillic, Roman, Greek,
11701    etc), and larger than UCS-2 for Chinese, Japanese, and Korean.
11702
11703    The UTF-8 uncoding of the UCS has been adopted by the Internet as the
11704    preferred character set for new applications, and is gradually being
11705    retrofitted into traditional applications like FTP ([550]RFC 2640).
11706
11707     6.6.3. Conformance Levels
11708
11709    Although the Unicode and ISO 10646 standards both describe the same
11710    character set, these standards differ in many ways, including their
11711    stated requirements for conformance and their classification of
11712    conformance levels.
11713
11714    Kermit has always abided by ISO character-set standards, including ISO
11715    character-set designation and invocation methods. In adapting Unicode,
11716    therefore, we had to choose from among the available ISO designations
11717    which, in turn, correspond with ISO 10646 conformance levels. At
11718    present, Kermit claims the lowest conformance level, 1, meaning
11719    (roughly) that it does not handle combining forms and it does not
11720    handle Korean Hangul Jamos (just as, at present, it does not handle
11721    Korean in general). Note that ISO 10646 Conformance Levels 1 and 2
11722    sidestep the issue of the code changes for Korean Hangul by announcing
11723    non-support for Hangul regardless of encoding.
11724
11725    ISO 10646 Conformance Level 1 is approximately equivalent to Unicode
11726    Normalization Form C (described in Unicode Technical Report 15,
11727    incorporated into Unicode 3.0).
11728
11729    As noted in [551]Section 6.6.2, Kermit does not claim to support UTF-16
11730    at the present time, hence the UCS-2 nomenclature. Kermit treats
11731    surrogates just as if they were any other UCS-2 characters, rather than
11732    as escapes to other planes, which means that (except when converting
11733    between UCS-2 and UTF-8) they are translated to "error" characters,
11734    since (a) no other planes are defined yet (and if they were, no other
11735    character sets supported by Kermit would encode their characters), and
11736    (b) no valid surrogate character corresponds to any other UCS-2
11737    character.
11738
11739    A minor yet significant aspect of Unicode 3.0 and some recent
11740    perturbation of ISO 10646-1 (probably Amendment 18, "Symbols and Other
11741    Characters") is the addition of the Euro Sign at U+20AC. As noted in
11742    [552]Section 6.0, Kermit's "Euro compliance" includes conversion
11743    between Latin Alphabet 9 and various PC code pages. Text can also be
11744    converted between UCS-2 or UTF-8 and any other Euro-compliant character
11745    set (Latin-9, CP858, CP1250, CP1252) without loss of the Euro Sign.
11746
11747     6.6.4. Relationship of Unicode with Kermit's Other Character Sets
11748
11749    Kermit's character sets are divided into two groups: single-byte sets
11750    (such as Roman, Hebrew, Cyrillic, Greek) and multibyte (various
11751    Japanese sets). The two groups are distinct since one normally would
11752    not expect to convert Kanji ideograms to Roman (or other) letters, or
11753    vice versa.
11754
11755    Unicode character-set conversion works with both groups, but obviously
11756    the result depends on the repertoires of the source and destination
11757    character-sets both including the characters in the file. For example,
11758    you can translate a Hungarian text file between Latin-2 and Unicode,
11759    but not between (say) Unicode and Latin/Greek. By the same token you
11760    can convert Japanese text from Shift-JIS or EUC or JIS-7 to Unicode and
11761    back, but you can't convert the same file to (say) Latin-1 if it
11762    contains Japanese characters.
11763
11764      JIS-7 is equivalent to DEC Kanji and ISO-2022-JP except that the
11765      latter two do not support halfwidth Katakana. Kermit treats all
11766      three of these sets the same way, i.e. as JIS-7.
11767
11768    As noted, Kermit presently does not handle combining diacritics, and so
11769    will not correctly convert UCS files that use them into a single-byte
11770    character set. For example, if a UCS file contains Latin Capital Letter
11771    A (U+0041) followed by Combining Acute Accent (U+0301), the result will
11772    be a two-character sequence, A followed by another character. This is
11773    what is meant by Conformance Level 1. (The situation grows worse with
11774    multiple diacritics, since they can occur in any order.)
11775
11776    A higher level of conformance is possible, in which "canonical
11777    equivalences" are handled via algorithms and databases, at some
11778    (perhaps considerable) cost in performance, since a fair amount of
11779    additional code must be executed for every character during data
11780    transfer (database lookup, sorting of combining sequences into
11781    canonical order, etc). This can be added in future releases if there is
11782    a need (but in many cases, pre- and postpostprocessing might be a
11783    better option).
11784
11785    Within these constraints, Kermit converts between the UCS and its other
11786    character sets. For example, a mixture of Russian and English (and/or
11787    Dutch, or Latin) text can bet converted between the UCS and ISO
11788    Latin/Cyrillic or KOI-8. But since Kermit does not presently support
11789    Arabic character-set conversion, the new availability of UCS conversion
11790    does not mean that Kermit can convert from Arabic UCS text to some
11791    other character set, because Kermit does not support any other
11792    character set that includes Arabic. Ditto for Thai, Armenian, Georgian,
11793    Tibetan, Chinese, Korean, etc. However, Kermit CAN convert Arabic (or
11794    any other script) between UCS-2 and UTF-8.
11795
11796    Considering Cyrillic more carefully, note that the UCS also contains
11797    numerous Cyrillic characters not found in any of the Cyrillic sets (ISO
11798    Latin/Cyrillic, KOI8, CP866, etc) that Kermit supports; characters
11799    needed for Abkhasian, Yakut, Tatar, Bashkir, Altaic, Old Church
11800    Slavonic, etc; UCS text containing any of these historic or "extended"
11801    Cyrillic characters can not be converted to any of Kermit's current
11802    single-byte Cyrillic sets without loss. The situation is similar for
11803    Greek, Hebrew, etc, and even worse for Japanese since Unicode contains
11804    thousands of Kanjis that are lacking from the Japanese character sets
11805    based on JIS X 0208, such as EUC-JP, JIS-7, and Shift-JIS.
11806
11807    In general, when converting from UCS to a single-byte set, there is
11808    always the possibility of data loss, just as there is when converting
11809    from any larger set to a smaller one. For example, if a UCS file
11810    contains Devanagari characters, these characters will be lost when
11811    converting to (say) Latin-1, just as Roman vowels with acute accents
11812    are lost when converting from Latin-1 (an 8-bit set) to German ISO 646
11813    (a 7-bit set).
11814
11815     6.6.5. Kermit's Unicode Features
11816
11817    C-Kermit can convert between UCS-2 or UTF-8 and any of its other
11818    character sets, and also between UCS-2 and UTF-8. When converting
11819    between UCS-2 or UTF-8 and a non-Unicode character set (such as
11820    Latin-1), the UCS Line Separator (LS, U+2028) and Paragraph Separator
11821    (PS, U+2029) characters are converted to the appropriate line
11822    terminator (CR, LF, or CRLF). When converting from a non-Unicode set to
11823    UCS-2 or UTF-8, however, line terminators are not converted to LS or
11824    PS. This is in accordance with the recommendations of Unicode Technical
11825    Report #13.
11826
11827    When C-Kermit starts, it tests the native byte order of the computer.
11828    You can see the result in the SHOW FEATURES or SHOW FILE display. It's
11829    also available in the variable \v(byteorder): 0 means Big Endian, 1
11830    means Little Endian.
11831
11832    When UCS-2 is involved in file transfer or translation, the following
11833    commands tell C-Kermit what to do about byte order:
11834
11835    SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
11836           This is for reading UCS-2 files that don't have a BOM, and also
11837           for writing UCS-2 files. If this command is not given, the
11838           machine's native byte order is used when writing UCS-2 files,
11839           and also when reading UCS-2 files that don't have a BOM.
11840
11841    SET FILE UCS BOM { ON, OFF }
11842           This setting is used when creating UCS-2 files. A BOM is added
11843           at the beginning by default. Use OFF to not add the BOM. This
11844           command has no affect when writing files.
11845
11846    COPY /SWAP-BYTES sourcefile destinationfile
11847           Use this for fixing a UCS-2 file whose bytes are in the wrong
11848           order.
11849
11850    Use SHOW FILE to display the FILE UCS settings.
11851
11852    Please note, again, that C-Kermit's user interface, including its
11853    script language, is not internationalized in any way. String
11854    comparisons, case conversion, and so on, work only for US ASCII
11855    (comparisons for equality work with other sets, but not
11856    lexically-greater-or-less-than or caseless comparisons; even
11857    comparisons for equality can fail when composed characters or byte
11858    order are involved). String functions such as \findex() and
11859    \fsubstring() that reference byte positions do just that; they won't
11860    work with UTF-8 text that contains any non-ASCII characters, and they
11861    will not work with UCS-2 text at all since they use C strings
11862    internally, which are NUL-terminated. These are just a few examples to
11863    illustrate that neither Unicode nor any other character-set beyond
11864    ASCII is supported at the user-interface, command, or scripting level
11865    in this version of C-Kermit.
11866
11867     6.6.5.1. File Transfer
11868
11869    Kermit supports both UCS-2 and UTF-8 as file and transfer character
11870    sets in text-mode file transfer.
11871
11872    To select UCS-2 or UTF-8 as a file character-set, use:
11873
11874   SET FILE CHARACTER-SET { UCS2, UTF8 }
11875
11876    If you want to send a UCS-2 text file (or save an incoming file in
11877    UCS-2 format), tell Kermit to:
11878
11879   SET FILE CHARACTER-SET UCS2
11880
11881    and if you want to send a UTF-8 text file (or store an incoming file in
11882    UTF-8 format), tell Kermit to:
11883
11884   SET FILE CHARACTER-SET UTF8
11885
11886    When sending UCS-2 files, Kermit determines the byte order from the
11887    BOM, if there is one (and if there is a BOM, it is stripped, i.e. not
11888    sent). If there is no BOM, the byte order is the one specified in the
11889    most recent SET FILE UCS BYTE-ORDER command, if any, otherwise the
11890    computer's native byte order is assumed. When storing incoming files as
11891    UCS-2, the byte order is according SET FILE UCS BYTE-ORDER, if given,
11892    otherwise the native one; a BOM is written according to SET FILE UCS
11893    BOM.
11894
11895    A transfer character-set should be chosen that includes all of the
11896    characters in the source file. So, for example, if you are sending a
11897    UCS-2 file containing only German-language text, your transfer
11898    character-set can be Latin-1, Latin-2, Latin-9, UCS-2, or UTF-8. But if
11899    you are sending a file that contains a combination of Hebrew and Greek,
11900    your transfer character-set must be UCS-2 or UTF-8 if you don't want to
11901    lose one script or the other. Furthermore, the transfer character-set
11902    must be one that is supported by the receiving Kermit program. Since
11903    UCS support is new, it is possible that the other Kermit program (if it
11904    supports character sets at all) does not support it, but does support
11905    single-byte sets such as Latin-1, Latin/Cyrillic, etc.
11906
11907    To select UCS-2 or UTF-8 as a transfer character-set, use:
11908
11909   SET TRANSFER CHARACTER-SET { UCS2, UTF8 }
11910
11911    It is up to the receiving Kermit program to convert the transfer format
11912    to its own local format, if necessary. If it does not understand the
11913    UTF-8 or UCS-2 transfer character-set, and your file can not be
11914    adequately represented by any single-byte transfer character-set (such
11915    as Latin-1 or Latin/Cyrillic) then, if UTF-8 format is acceptable on
11916    the receiving computer, use UTF-8 as the transfer character-set, with
11917    the receiver told to "set unknown-char keep", or with the sender told
11918    to "set attribute char off". If you want the file to be stored in UCS-2
11919    format at the receiver, send it it binary mode if the source file is
11920    also UCS-2, or else use the TRANSLATE command (next section) to convert
11921    it to UCS-2 first, then send it in binary mode. You should not use
11922    UCS-2 as a transfer character-set in text-mode transfers to Kermit
11923    programs that don't support it, because they are likely to corrupt the
11924    result the same way FTP would (see the final paragraph of this
11925    section).
11926
11927    When UCS-2 is the transfer character set, it always goes into Kermit
11928    packets in Big Endian format, with no BOM. As always, the transfer
11929    character-set is announced by the sender to the receiver. The
11930    announcement for UCS-2 is "I162" (ISO Registration 162 = UCS-2 Level 1)
11931    and by definition it is Big Endian (the standards say that when UCS-2
11932    is serialized into bytes, the order must be Big Endian). The
11933    announcement for UTF-8 is "I190" (UTF-8 Level 1).
11934
11935    When receiving a file whose transfer character-set is UCS-2 or UTF-8,
11936    you must choose the appropriate file character set for the result.
11937    There is no way Kermit can do this for you automatically, since UCS
11938    data can be in any script at all, or any combination.
11939
11940    In general, UTF-8 or UCS-2 should be chosen as a transfer character-set
11941    if the source file is also encoded in some form of UCS and it contains
11942    more than one script. But there are other situations where where UTF-8
11943    or UCS-2 offer advantages. For example, suppose the source file is on a
11944    NeXTstation and the destination file is on VMS. Both the NeXT and the
11945    DEC Multinational character sets include the French OE digraph, but
11946    Latin-1 does not. Therefore French words containing this character
11947    might not arrive intact when Latin-1 is the transfer character-set, but
11948    will with UTF-8 or UCS-2, since the UCS includes the OE digraph (but so
11949    does Latin-9).
11950
11951    UCS-2 should be chosen as a transfer character-set only for Japanese
11952    text files that contain a large preponderance of Kanji, since in this
11953    case (and only this case) UCS-2 (two bytes per Kanji) is more efficient
11954    than UTF-8 (three bytes per Kanji). The same will be true for Chinese
11955    and Korean when they are supported by Kermit. UCS-2 should never be
11956    used as a transfer character-set with a transfer partner that does not
11957    support UCS-2 since this can cause file corruption (see last paragraph
11958    in this section).
11959
11960    Note that Kermit's repeat-count compression is 100% ineffective for
11961    UCS-2, and is also ineffective for multibyte characters in UTF-8 and
11962    EUC-JP; this is because repeat-compression is a transport-level
11963    mechanism that operates on a per-byte basis; it has no knowledge of the
11964    distinction between a byte and a character.
11965
11966    When C-Kermit starts, it sets up associations ([553]Section 6.5) for
11967    incoming files whose transfer character sets are UCS-2 or UTF-8
11968    appropriately for the platform so that the file character-set for the
11969    incoming file is UCS-2 in Windows and UTF-8 elsewhere. Otherwise,
11970    C-Kermit does not make any default associations for UCS-2 or UTF-8, but
11971    of course you may add or change associations to suit your needs and
11972    preferences by including the appropriate ASSOCIATE commands in your
11973    Kermit startup file. For example, if you are a PC user and deal only
11974    with text written in Greek and English, you can:
11975
11976   ASSOCIATE TRANSFER-CHARACTER-SET UTF8 CP869
11977   ASSOCIATE TRANSFER-CHARACTER-SET UCS2 CP869
11978   ASSOCIATE FILE-CHARACTER-SET CP869 UTF8
11979
11980    Note that when file transfer involves conversion between a single-byte
11981    character set and UCS-2 or UTF-8, the file-transfer thermometer and
11982    estimated time left might be inaccurate, since they are based on the
11983    source file size, not the transfer encoding. This is purely a cosmetic
11984    issue and does not effect the final result. (And is not, strictly
11985    speaking, a bug; Kermit protocol presently includes no method for the
11986    sender to furnish an "estimated transfer size" to the receiver, and in
11987    any case any such guess could be as far off as the file size, given the
11988    many other factors that come into play, such as compression and
11989    prefixing).
11990
11991    A caution about FTP and UCS-2. As noted previously, if you transfer a
11992    UCS-2 file with FTP in binary mode between two computers with opposite
11993    Endianness, the result will have its bytes in the wrong order. However,
11994    if you use FTP to transfer a UCS-2 file in "ascii" (text) mode to ANY
11995    computer, even if it is identical to yours, the result will be
11996    corrupted because FTP's line-terminator conversions do not account for
11997    UCS-2. The same holds when sending from a UCS-aware Kermit program to
11998    an older Kermit program in text mode with a transfer character-set of
11999    UCS-2. So use UCS-2 as a transfer character-set ONLY with a UCS-2-aware
12000    Kermit partner.
12001
12002     6.6.5.2. The TRANSLATE Command
12003
12004    In Kermit versions that have Unicode support included, TRANSLATE now
12005    always goes through Unicode; that is, the source set is converted to
12006    UCS-2 and thence to the target set. This is a major improvement, since
12007    in prior releases, C-Kermit had to pick the "most appropriate" transfer
12008    character-set as the intermediate set, and this would result in the
12009    loss of any characters that the source and target sets had in common
12010    but were lacking from the intermediate set (for example the OE digraph
12011    when translating from NeXT to DEC MCS through Latin-1). This never
12012    happens when Unicode is the intermediate set because Unicode is a
12013    superset of all other character sets supported by Kermit. A more
12014    dramatic example would be translation between Cyrillic PC code page 866
12015    and KOI8-R ([554]Section 6.4); formerly all the line- and box-drawing
12016    characters would be lost (since ISO 8859-5 does not have any); now the
12017    ones that these two sets have in common are preserved.
12018
12019    UCS-2 and UTF-8 are now both supported as source-file and
12020    destination-file character sets by C-Kermit's TRANSLATE command, for
12021    example:
12022
12023   translate oofa.txt ucs2 latin1 oofa-l1.txt
12024
12025    translates oofa.txt from UCS-2 to Latin-1, storing the result as
12026    oofa-l1.txt. Similarly:
12027
12028   translate oofa.txt utf8 latin1 oofa-l1.txt
12029   translate oofa.txt latin1 ucs2 oofa-ucs2.txt
12030   translate oofa.txt latin1 utf8 oofa-utf8.txt
12031   translate oofa.txt ucs2 utf8 oofa-utf8.txt
12032   translate oofa.txt utf8 ucs2 oofa-ucs2.txt
12033
12034    Treatment of the UCS-2 BOM is exactly the same as for file transfer.
12035    Note that if a UCS-2 source file is in the "wrong" byte order and lacks
12036    a BOM, and you don't tell Kermit about it with SET FILE UCS BYTE-ORDER,
12037    the result of the translation is total gibberish. Recall that you can
12038    use COPY /SWAP-BYTES to switch the byte order of an errant UCS-2 file
12039    (or any other file for that matter, if you can think of a reason to).
12040    Also note that:
12041
12042   translate oofa.txt ucs2 ucs2 new.txt
12043
12044    Produces a result in the native (or SET FILE UCS) byte-order as long as
12045    oofa.txt has a BOM.
12046
12047    As a side benefit of the Unicode work, the TRANSLATE command now works
12048    for the first time also for all Japanese character sets that Kermit
12049    supports. In other words, if you have a Japanese text file in any of
12050    the following encodings:
12051
12052   EUC-JP
12053   Shift-JIS
12054   JIS-7
12055   UCS-2
12056   UTF-8
12057
12058    You can use the TRANSLATE command to convert to any other encoding from
12059    the same list.
12060
12061     6.6.5.3. Terminal Connection
12062
12063    The CONNECT command now allows UTF-8 as a local or remote terminal
12064    character-set:
12065
12066   SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
12067   SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
12068   SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
12069
12070    (Recall that Kermit's terminal character-set has two "ends" -- the set
12071    used on the host to which Kermit is connected, and the set used on the
12072    local keyboard and screen.)
12073
12074    UCS-2 is not supported as a terminal character-set (either end) since
12075    (a) it is not used that way anywhere to our knowledge, and (b) the
12076    problems of Endianness and the high likelihood of loss of
12077    synchronization make it impractical. (Telecommunications is
12078    byte-oriented; if one byte, or any odd number of bytes, is lost because
12079    of buffer overruns, circuit resets, etc (or likewise if a burst of
12080    noise appears that takes the guise of an odd number of bytes), the byte
12081    order of the subsequent data stream will be backwards; unlike UTF-8 and
12082    traditional byte-based character sets, UCS-2 is not "self
12083    synchronizing".)
12084
12085    UTF-8 does not have byte-order or synchronization problems and is
12086    growing in popularity as a terminal character set as well as in other
12087    application areas. It allows a single terminal session to use multiple
12088    scripts (Roman, Cyrillic, Greek, etc) without ISO 2022 character-set
12089    switching (which terminal emulators like Kermit 95 can handle but few
12090    host applications understand or use), and meshes nicely with the
12091    Unicode screen fonts that are beginning to appear.
12092
12093    UTF-8 was first used in Plan 9 and soon will be available in Linux. It
12094    will probably spread from there (Unicode in some form is, of course,
12095    also used in Windows NT, but only internally -- not for access from
12096    outside).
12097
12098    To use UTF-8 or any other character set that uses 8-bit bytes in your
12099    terminal session, be sure to tell C-Kermit to:
12100
12101   SET TERMINAL BYTESIZE 8
12102   SET COMMAND BYTESIZE 8
12103   SET PARITY NONE
12104
12105    (or use the shortcut command, EIGHTBIT, which does all three at once).
12106
12107    In a setup where your local Kermit program uses a single-byte character
12108    set such as PC Code Page 850 and the remote host uses UTF-8:
12109
12110   SET TERM CHAR UTF8 CP850
12111
12112    or:
12113
12114   SET TERM REMOTE CHAR UTF8
12115   SET TERM LOCAL CHAR CP850
12116
12117    all works as expected. UTF-8 text on the remote displays correctly on
12118    your screen, and when you type CP850 characters, they are translated to
12119    UTF-8 sequences for transmission, and the echo from the host is
12120    translated from UTF-8 back to CP850. Telnet negotiations and
12121    autodownload take place before any character-set translation and work
12122    as before. The session log (if text mode was selected for it) contains
12123    only the local terminal character-set. And so on.
12124
12125    Kermit merely supplies translations from UTF-8 to your local terminal
12126    character-set (this includes treating UTF-8 Line Separator and
12127    Paragraph separator as CRLF). However, Kermit does does not, at
12128    present, perform "canonicalization" of composed sequences, nor does it
12129    automatically execute bidirectionality algorithms for display of
12130    mixed-direction text (e.g. Hebrew and English). Such presentation
12131    issues, like all others in the terminal-host regime, are left to the
12132    host.
12133
12134    By the way, C-Kermit also allows UTF-8 to be the local end of the
12135    terminal character-set, but so far this code is not tested, since we
12136    don't have a UTF-8 console or terminal to work with. However, it can be
12137    stated without doubt that C-Kermit's key mapping will not work for
12138    UTF-8 values, since (a) the key map is indexed by 8-bit byte values and
12139    (b) C-Kermit reads keystrokes a byte at a time (these comments do not
12140    apply to K95, which has direct access to the keyboard and can read
12141    "wide" keycodes and uses them to index a "wide" keymap).
12142
12143    Restrictions: As noted, the CONNECT command does not support UCS-2 as a
12144    REMOTE TERMINAL character-set. Neither does it support the Japanese
12145    sets EUC-JP, JIS-7, and Shift-JIS. Support for the Japanese sets (and
12146    possibly Chinese and Korean too) might be added in a future release.
12147    Since the TRANSMIT command (next section) uses the same REMOTE TERMINAL
12148    character-sets as the CONNECT command, it has the same restrictions.
12149
12150     6.6.5.4. The TRANSMIT Command
12151
12152    As described in Chapter 15 of [555]Using C-Kermit and [556]Section 4.21
12153    of this document, the TRANSMIT command can be used to upload a file
12154    without protocol, more or less as if you were typing it on your
12155    keyboard while connected to the host. When TRANSMITting in text mode,
12156    the file's character set is converted to the host's unless you have SET
12157    TERMINAL CHARACTER-SET TRANSPARENT, or you include the new TRANSMIT
12158    switch, /TRANSPARENT.
12159
12160    Before C-Kermit 7.0, the file character-set was assumed to be the same
12161    as the local end of the terminal character-set, and the TRANSMIT
12162    command used the same translations as the CONNECT command, ignoring the
12163    file character-set.
12164
12165    In C-Kermit 7.0, that assumption (a poor one to begin with) can no
12166    longer be made, since UCS-2 can be a file character-set but not a
12167    terminal character-set. So now the file's character-set is given by
12168    your most recent SET FILE CHARACTER-SET command. The host's character
12169    set is the remote end of your most recent SET TERMINAL CHARACTER-SET
12170    command:
12171
12172   SET TERMINAL CHARACTER-SET remote-set [ local-set ]
12173
12174    or:
12175
12176   SET TERMINAL REMOTE-CHARACTER-SET remote-set
12177
12178    The TRANSMIT command converts each source-file character from the FILE
12179    character-set to the REMOTE TERMINAL character-set, and then transmits
12180    the translated characters according to your SET TRANSMIT preferences
12181    (Chapter 15).
12182
12183    If you have SET TRANSMIT ECHO ON, and the host is echoing the
12184    transmitted characters, the echos are converted from the remote
12185    terminal character-set to the local terminal character-set.
12186
12187   [ A picture would help... ]
12188
12189    Confused? Let's work through an example. Suppose your local computer is
12190    a NeXTstation, on which text files are encoded in the NeXT character
12191    set, and that the remote computer is a Data General AViiON, which uses
12192    the Data General International character set. Further suppose that you
12193    are logged in to the NeXT from a VT220 terminal which uses the DEC
12194    Multinational character set.
12195
12196    You need to convert the file from NeXT encoding to DG encoding and
12197    convert the echoes from DG encoding to DEC encoding. So on the NeXT,
12198    tell C-Kermit to:
12199
12200   eightbit
12201   set file character-set next
12202   set term character-set dg-international dec-mcs
12203   transmit /text nextdata.txt
12204
12205    (This assumes you have some sort of collection process already set up
12206    on the Data General, such as a text editor or the venerable "cat >
12207    foo". The EIGHTBIT command is equivalent to SET TERMINAL BYTESIZE 8,
12208    SET COMMAND BYTESIZE 8, SET PARITY NONE.)
12209
12210    To further complicate matters, suppose your local terminal character
12211    set is the same as the remote one, so you don't need terminal
12212    character-set translation, but you need to TRANSMIT a file that is in a
12213    different character set and you want it translated to the host set. In
12214    this case, use SET TERM CHARACTER-SET to actually specify the character
12215    set used on each end, rather than specifying TRANSPARENT:
12216
12217   eightbit
12218   set file character-set ucs2
12219   set term character-set latin1 latin1
12220   transmit /text ucs2data.txt
12221
12222    The distinction between:
12223
12224   SET TERMINAL CHARACTER-SET xxx yyy
12225
12226    (where xxx and yyy are the same set) and:
12227
12228   SET TERMINAL CHARACTER-SET TRANSPARENT
12229
12230    is new to C-Kermit 7.0, but affects only the TRANSMIT command.
12231
12232    The TRANSMIT command currently does nothing special with UCS-2/UTF-8
12233    Line and Paragraph Separator characters; more experience is required to
12234    find out how these behave in a genuine Unicode terminal-host setting.
12235
12236    Restrictions: As noted, the TRANSMIT command translates from the FILE
12237    character-set to the REMOTE TERMINAL character-set. This rules out
12238    translations to any character set that is not supported as a REMOTE
12239    TERMINAL character-set, such as UCS-2, EUC-JP, JIS-7, and Shift-JIS.
12240
12241     6.6.5.5. Summary of Kermit Unicode Commands
12242
12243    Specifying file character-set and byte order:
12244           SET FILE CHARACTER-SET { ..., UCS2, UTF8 }
12245           REMOTE SET FILE CHARACTER-SET { ..., UCS2, UTF8 } (See next
12246           section)
12247           SET FILE UCS BOM { ON, OFF }
12248           SET FILE UCS BYTE-ORDER { BIG-ENDIAN, LITTLE-ENDIAN }
12249
12250    Specifying the transfer character-set:
12251           SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
12252           REMOTE SET TRANSFER CHARACTER-SET { ..., UCS-2, UTF-8 }
12253
12254    Specifying the terminal character-set:
12255           SET TERMINAL CHARACTER-SET { ..., UTF8 } { ..., UTF8 }
12256           SET TERMINAL REMOTE-CHARACTER-SET { ..., UTF8 }
12257           SET TERMINAL LOCAL-CHARACTER-SET { ..., UTF8 }
12258
12259    Displaying settings:
12260           SHOW FILE
12261           SHOW TRANSFER
12262           SHOW TERMINAL
12263           SHOW CHARACTER-SETS
12264
12265    Commands that use these settings include:
12266           SEND, RECEIVE, GET, etc.
12267           CONNECT
12268           TRANSMIT
12269           LOG SESSION
12270
12271    Converting files:
12272           TRANSLATE infile { ..., UCS-2, UTF-8 } { ..., UCS-2, UTF-8 }
12273           outfile
12274           COPY /SWAP-BYTES infile outfile
12275
12276   6.7. Client/Server Character-Set Switching
12277
12278    A simple mechanism has been added to allow the client to change the
12279    server's FILE CHARACTER-SET:
12280
12281    REMOTE SET FILE CHARACTER-SET name
12282           The client asks the server to change its file character-set to
12283           the one given. The name must match one of the server's file
12284           character-set names. For convenience, C-Kermit uses its own file
12285           character-set keyword list for parsing this command so you can
12286           use ? for help and Tab or Esc for completion. However, since the
12287           server might have a different repertoire (or even use different
12288           names for the same sets), C-Kermit accepts any string you supply
12289           and sends it to the server. The server, if it supports this
12290           command (C-Kermit 7.0 and K95 1.1.19 do), sets its file
12291           character-set as requested, and also disables automatic
12292           character-set switching ([557]Section 6.5). If the server does
12293           not support this command or if it does not support the given
12294           character set, the REMOTE SET FILE CHARACTER-SET command fails.
12295
12296    Here's an example that sends a Japanese text file encoded in Shift-JIS
12297    to a server using every combination of Kermit's Japanese-capable file
12298    and transfer character sets:
12299
12300   dcl \&x[] = euc ucs2 utf8             ; transfer character-sets
12301   dcl \&y[] = eu uc ut                  ; 2-letter abbreviations for them
12302   dcl \&f[] = shift euc jis7 ucs2 utf8  ; file character-sets
12303   dcl \&g[] = sj eu j7 uc ut            ; 2-letter abbreviations
12304
12305   set file char shift-jis               ; local file character-set is Shift-JIS
12306   for \%i 1 \fdim(&x) 1 {               ; for each transfer character-set...
12307       set xfer char \&x[\%i]            ; set it
12308       for \%j 1 \fdim(&f) 1 {           ; for each remote file character-set...
12309           remote set file char \&f[\%j] ; set it
12310           if fail exit 1 SERVER REJECTED CHARSET
12311           send /text meibo-sj.html meibo-sj-\&y[\%i]-\&g[\%j].txt ; send the fil
12312 e
12313           if fail exit 1 TRANSFER FAILED
12314       }
12315   }
12316
12317    The Kermit-370 server does not support REMOTE SET FILE CHARACTER-SET,
12318    but since it supports REMOTE KERMIT commands, you can get the same
12319    effect with REMOTE KERMIT SET FILE CHARACTER-SET name.
12320
12321   7. SCRIPT PROGRAMMING
12322
12323    (Also see [558]Section 2.8, Scripting Local Programs.)
12324
12325   7.0. Bug Fixes
12326
12327    The following script programming bugs were fixed in C-Kermit 7.0:
12328
12329      * IF EXIST and IF DIRECTORY were fixed to properly strip braces from
12330        around their arguments, so "if directory {C:\Program Files}", etc,
12331        would work as expected. However, this means that if the file or
12332        directory name is actually enclosed in braces, the braces must be
12333        doubled.
12334      * The READ command did not fail if the READ file wasn't open; now it
12335        does.
12336      * The READ command refused to read the last or only line of a file if
12337        it did not end with a proper line terminator; now it does.
12338      * The END command, when given from within a SWITCH statement, did not
12339        exit from the current macro or command file; instead it just
12340        terminated the SWITCH.
12341
12342   7.1. The INPUT Command
12343
12344    7.1.1. INPUT Timeouts
12345
12346    The description of the INPUT command on page 422 fails to mention the
12347    following two points about the timeout (which apply to C-Kermit 6.0 and
12348    later):
12349
12350     1. "INPUT -1 text" (or "INPUT \%x text", where \%x is any variable
12351        whose value is -1 or less) means "wait forever". This form of the
12352        INPUT command fails only if it is interrupted, since it will never
12353        time out.
12354     2. INPUT 0 performs a nonblocking read of material that has already
12355        arrived but has not yet been read, and succeeds immediately if the
12356        target string is found, or fails immediately if it is not found.
12357
12358    The same points apply to MINPUT. REINPUT ignores its timeout parameter.
12359
12360     7.1.2. New INPUT Controls
12361
12362    The following new INPUT controls were added in version 7.0:
12363
12364    SET INPUT AUTODOWNLOAD { ON, OFF }
12365           Explained in [559]Section 7.7.
12366
12367    SET INPUT CANCELLATION { ON, OFF }
12368           This governs whether an INPUT command can be canceled by
12369           "pressing any key" on the keyboard. Normally it can be, in which
12370           case the INPUT command fails immediately and \v(instatus) is set
12371           to 2, indicating interruption. SET INPUT CANCELLATION OFF
12372           disables keyboard cancellations; thus if the search text is not
12373           encountered, the INPUT command will run for its entire timeout
12374           interval. SET INPUT CANCELLATION OFF does not disable
12375           interruption by Ctrl-C, however; every command needs an
12376           emergency exit. (If you really want to disable interruption by
12377           Ctrl-C, use SET COMMAND INTERRUPTION OFF.)
12378
12379    Also see [560]Section 7.2 for any new variables related to INPUT.
12380
12381     7.1.3. INPUT with Pattern Matching
12382
12383    C-Kermit 7.0 allows INPUT, MINPUT, and REINPUT targets to be a pattern
12384    (explained in [561]Sections 1.19 and [562]4.9). This solves a
12385    long-standing problem illustrated by the following scenario: a certain
12386    company has a bank of TCP/IP modem servers, with hostnames server1,
12387    server2, server3, and so on. Each server's prompt is its name, followed
12388    by a colon (:), for example "Server72:". Without INPUT patterns, it
12389    would be rather difficult to wait for the prompt. The brute force
12390    approach:
12391
12392   minput 20 Server1: Server2: Server3: ... (enumerating each one)
12393
12394    is subject to failure whenever a new server is added. A more subtle
12395    approach:
12396
12397   input 20 Server
12398   if fail ...
12399   input 2 :
12400
12401    is liable to false positives, e.g. "Welcome to the XYZ Corp Modem
12402    Server. Please read the following message:"...
12403
12404    With patterns, you can match the prompt with "Server*:" (which doesn't
12405    solve the "false positives" problem, but certainly is more compact than
12406    the brute force method), or with more specific patterns such as
12407    "Server[1-9]:" and "Server[1-9][0-9]:", or equivalently:
12408
12409   Server{[1-9],[1-9][0-9]}:
12410
12411    meaning the word "Server" followed by a single digit (1-9) or by two
12412    digits representing a number from 1 to 99, followed by a colon.
12413
12414    INPUT pattern matching has been added in a way that does not interfere
12415    with existing scripts. No new commands or switches are used. The simple
12416    rule is: if an INPUT search target is the argument of the (new)
12417    \fpattern() function, it is a pattern. Otherwise it is taken literally,
12418    as before. For example:
12419
12420   input 5 a*b
12421
12422    searches for an 'a' followed by an asterisk ('*'), followed by a 'b'.
12423    But:
12424
12425   input 5 \fpattern(a*b)
12426
12427    searches for an 'a' followed by anything at all up to and including the
12428    first 'b'. This means that any search target to INPUT, MINPUT, or
12429    REINPUT can be a pattern or a literal string, and in particular that
12430    MINPUT can accommodate any mixture of patterns and literal strings.
12431
12432    In selecting patterns, note that:
12433
12434      * A leading '*' is always implied so there is no need to include one.
12435      * A trailing '*' is meaningless and ignored.
12436      * A '*' by itself matches the first character that arrives.
12437
12438    A syntax note: If your pattern is a selection list, meaning a list of
12439    alternatives separated by commas and enclosed in braces, then the outer
12440    braces will be stripped by various levels of parsers, so you must
12441    include three of each:
12442
12443   input 10 \fpattern({{{abc,mno,xyz}}})
12444
12445    Note that this is equivalent to:
12446
12447   minput 10 abc mno xyz
12448
12449    except for the setting of the \v(minput) variable.
12450
12451    And a caution: INPUT pattern matching has a limitation that you
12452    probably never noticed with literal-string matching, namely that there
12453    is a limit on the size of the match. For example, if the pattern is
12454    "a*b", the match will succeed if the 'a' and 'b' are not separated by
12455    more than (say) 8K bytes, but will fail if they are farther apart than
12456    that. In such cases, it better to use two INPUTs (e.g. "input 10 a" and
12457    then "input 100 b").
12458
12459     7.1.4. The INPUT Match Result
12460
12461    The result of any INPUT, MINPUT, or REINPUT command, no matter whether
12462    the search targets are patterns or literal strings, is available in the
12463    new \v(inmatch) variable. For example:
12464
12465   minput 10 cat \fpattern([dh]og)
12466   if success echo MINPUT matched "\v(inmatch)"
12467
12468    This is especially useful when a pattern was matched, since it makes
12469    the string that matched the pattern available to Kermit; there would be
12470    no way to get it otherwise.
12471
12472    After an INPUT command, you can view all the INPUT-related variables by
12473    typing "show variables in" (abbreviate as "sho var in"), which shows
12474    the values of all built-in variables whose names start with "in".
12475
12476   7.2. New or Improved Built-In Variables
12477
12478    \v(blockcheck)
12479           Current BLOCK-CHECK setting, 1, 2, 3, or 4. 4 is the code for
12480           BLANK-FREE-2.
12481
12482    \v(byteorder)
12483           The machine's byte order: 0 = Big Endian, 1 = Little Endian.
12484
12485    \v(cmdbufsize)
12486           The length of the command buffer, which is the maximum size for
12487           a macro, a command, a variable, or anything else in C-Kermit's
12488           script language.
12489
12490    \v(ctty)
12491           The device name of C-Kermit's controlling (login) terminal.
12492
12493    \v(filename)
12494           Described in [563]Sections 4.1 and [564]4.2.
12495
12496    \v(filenumber)
12497           Described in [565]Sections 4.1 and [566]4.2.
12498
12499    \v(filespec)
12500           As of C-Kermit 7.0, contains fully qualified filenames rather
12501           than (usually) relative ones.
12502
12503    \v(return)
12504           Now holds the END n value of the macro that most recently
12505           returned, in case END was used rather than RETURN.
12506
12507    \v(editor)
12508           Pathname of preferred text editor
12509
12510    \v(editopts)
12511           Command-line options for editor
12512
12513    \v(editfile)
12514           File most recently edited
12515
12516    \v(browser)
12517           Pathname of preferred Web browser
12518
12519    \v(browsopts)
12520           Command-line options for Web browser
12521
12522    \v(browsurl)
12523           URL most recently given to Web browser
12524
12525    \v(dialtype)
12526           Type of call most recently placed (see [567]Section 2.1.11).
12527
12528    \v(kbchar)
12529           The character, if any, that was typed at the keyboard to to
12530           interrupt the most recent PAUSE, SLEEP, WAIT, MSLEEP, or INPUT
12531           command; empty if the most recent such command was not
12532           interrupted from the keyboard.
12533
12534    \v(lockdir)
12535           UNIX only - The name of the UUCP lockfile directory, if known,
12536           otherwise "(unknown)".
12537
12538    \v(lockpid)
12539           UNIX only - PID of process that owns the communication port that
12540           you tried to open with a SET LINE command that failed because
12541           the port was in use, otherwise empty. This variable is set with
12542           every SET LINE command.
12543
12544    \v(cx_time)
12545           If no connection (SET HOST, SET LINE, DIAL, TELNET, etc) is
12546           active, this is 0. If a connection is active, this is the number
12547           of seconds since the connection was made.
12548
12549    \v(hwparity)
12550           If hardware parity is in effect, this variable gives its value,
12551           such as "even" or "odd" (in which case, the \v(parity) variable
12552           will be "none"). Otherwise this variable is empty.
12553
12554    \v(serial)
12555           Current serial port settings in 8N1 format ([568]Section 2.10).
12556
12557    \v(errno)
12558           In UNIX, the current value of the C runtime errno variable,
12559           which is quite volatile (meaning that often an "interesting"
12560           error code can be overwritten by some other library call or
12561           system service that sets errno before you have a chance to look
12562           at it). In VMS, the error code returned by the system or library
12563           call that most recently failed (success codes are not saved).
12564           Not available in other operating systems.
12565
12566    \v(errstring)
12567           The UNIX or VMS system error message that corresponds to
12568           \v(errno). Not available in all OS's. Also see
12569           [569]\ferrstring().
12570
12571    \v(setlinemsg)
12572           The error message, if any, from the most recent SET LINE, SET
12573           PORT, SET HOST, TELNET, or other connection-making command. This
12574           is not necessarily the same as \v(errstring) since these
12575           commands might fail without generating a system error code, for
12576           example (in UNIX) because a lockfile existed indicating the
12577           device was assigned by another user.
12578
12579    \v(exitstatus)
12580           The exit status C-Kermit would return if it exited now.
12581
12582    \v(pexitstat)
12583           The exit status of the inferior process most recently invoked by
12584           C-Kermit (by RUN, !, REDIRECT, SEND /COMMAND, etc). In VMS, this
12585           code can be given to \ferrstring() to get the corresponding
12586           error message (in UNIX, program/command return codes are not the
12587           same as system error codes). Not available in operating systems
12588           other than UNIX and VMS. See [570]Section 4.2.5 for details.
12589
12590    \v(inmatch)
12591           The incoming string of characters, if any, that matched the most
12592           recent INPUT, REINPUT, or MINPUT command.
12593
12594    \v(intime)
12595           The number of milliseconds (thousandths of seconds) it took for
12596           the most recent INPUT command to find its match, or -1 if no
12597           INPUT command has been given yet. If the INPUT command timed
12598           out, the value is approximately equal to 1000 times the INPUT
12599           timeout. If INPUT failed for some other reason, the value is
12600           undefined (\v(instatus) gives INPUT completion status). If your
12601           version of C-Kermit is built without high-precision
12602           floating-point timers, this number will always be a multiple of
12603           1000.
12604
12605    \v(inwait)
12606           The number of seconds specified as the timeout in the most
12607           recent INPUT command.
12608
12609    \v(dialsuffix)
12610           Dialing suffix for use during PDIAL sequence; see [571]Section
12611           2.1.10.
12612
12613    \v(pid)
12614           UNIX, VMS, and K95 only. C-Kermit's primary process ID, numeric,
12615           decimal. If you want to show it in hex, use \fn2hex(\v(pid)) If
12616           you want to show it in octal, use \fn2octal(\v(pid)).
12617
12618    \v(printer)
12619           Current printer name or SET PRINTER value.
12620
12621    \v(p_ctl)
12622           Control prefix char \v(p_8bit) 8-bit prefix char (if parity not
12623           none)
12624
12625    \v(p_rpt)
12626           Repeat prefix char (if repeat compression enabled)
12627
12628    \v(herald)
12629           Kermit's version herald
12630
12631    \v(test)
12632           Kermit's test version, if any, or 0 if this is not a test
12633           version. Typical values for test versions are "Alpha.03" or
12634           "Beta.14".
12635
12636    \v(sendlist)
12637           The number of entries in the SEND-LIST, 0 if none. Note: entries
12638           do not necessarily correspond to files, since an entry might
12639           contain wildcards. Also note that the value does not go back to
12640           0 after the files in the list are sent. To reset this variable,
12641           use CLEAR SEND-LIST. The purpose of this variable is to
12642           determine if a SEND command, when given without any filenames,
12643           will be legal. Example:
12644
12645   xif \v(sendlist) { send } else { send oofa.txt }
12646
12647    \v(trigger)
12648           If the most recent CONNECT session was terminated automatically
12649           by a trigger, this variable contains the trigger value.
12650
12651    \v(ty_ln)
12652           TYPE line number (during TYPE)
12653
12654    \v(ty_lc)
12655           TYPE line count (after TYPE)
12656
12657    \v(ty_mc)
12658           TYPE match count (after TYPE)
12659
12660    \v(xferstat)
12661           Status of most recent file transfer:
12662
12663 -1: No transfer yet
12664  0: Succeeded
12665  1: Failed
12666
12667    \v(xfermsg)
12668           If the most recent file transfer failed, this is the reason. If
12669           it succeeded, \v(xfermsg) is an empty string.
12670
12671    \v(tftime)
12672           Total elapsed time of most recent file transfer operation, in
12673           seconds.
12674
12675    \v(textdir)
12676           Directory that holds (or is supposed to hold) Kermit text files
12677           such as installation instructions, release notes, update notes,
12678           read-me files, "beware" files, etc.
12679
12680    \v(name)
12681           The name with which the Kermit program was invoked, e.g.
12682           "kermit", "wermit", "k95", "k2", etc (see [572]Section 9.1).
12683
12684    \v(osname)
12685           Name of operating system on computer where C-Kermit is running,
12686           obtained at runtime (from uname or equivalent).
12687
12688    \v(osversion)
12689           Version of operating system on computer where C-Kermit is
12690           running, obtained at runtime (from uname or equivalent).
12691
12692    \v(osrelease)
12693           Release of operating system on computer where C-Kermit is
12694           running, obtained at runtime (from uname or equivalent).
12695
12696    \v(model)
12697           The specific hardware model of the computer where C-Kermit is
12698           running, if known.
12699
12700    \v(math_pi)
12701           The value of Pi (see [573]Section 7.23)
12702
12703    \v(math_e)
12704           The value of e (see [574]Section 7.23)
12705
12706    \v(math_precision)
12707           How many significant digits in a floating-point number.
12708
12709    \v(f_count)
12710           Result of the most recent FILE COUNT (FCOUNT) command.
12711
12712    \v(f_error)
12713           Numeric error code of most recent FILE command.
12714
12715    \v(f_max)
12716           Maximum number of files open simultaneously.
12717
12718    The math constants are given in the precision of underlying computer's
12719    floating-point arithmetic.
12720
12721    Note the distinction between \v(osname), \v(osversion), and
12722    \v(platform); the latter refers to the platform for which and/or upon
12723    which C-Kermit was built, as opposed to the one on which it is actually
12724    running. Also note that each operating system can, and probably will,
12725    interpret and fill in the os* variables differently, or not at all.
12726
12727    The SHOW VARIABLES command now accepts a variable name, prefix, or
12728    pattern:
12729
12730   show variables         Shows all variables.
12731   show variables t       Shows all variables that start with "t".
12732   show variables *ver*   Shows all variables whose names contain "ver".
12733   show variables *ver    Ditto (an implied "*" is appended).
12734
12735   7.3. New or Improved Built-In Functions
12736
12737    The following new file-i/o functions are explained in [575]Section
12738    1.22.
12739
12740   \f_status(channel)           Status of file open on channel
12741   \f_pos(channel)              Read/write (byte) pointer of given file
12742   \f_line(channel)             Current line of file
12743   \f_handle(channel)           Handle of file
12744   \f_eof(channel)              Whether given file is at EOF
12745   \f_getchar(channel)          Read a char from given file
12746   \f_getline(channel)          Read a line from given file
12747   \f_getblock(channel,n)       Read a block from given file
12748   \f_putchar(channel,c)        Write a char to given file
12749   \f_putline(channel,string)   Write a line to given file
12750   \f_putblock(channel,string)  Write a block to given file
12751
12752    The following new date-time-related functions are explained in
12753    [576]Section 1.6:
12754
12755   \fday()                Returns day of week of given date
12756   \fnday()               Returns numeric day of week of given date
12757   \ftime()               Returns time portion of given date-time
12758   \fntime()              Converts time to seconds since midnight
12759   \fn2time()             Converts seconds since midnight to hh:mm:ss
12760   \fcvtdate(date-time)   Converts free-format date to yyyymmdd hh:mm:ss
12761   \fdayofyear(date-time) Converts date to yyyyddd (day-of-year) format
12762   \fdoy(date-time)       Synonym for \fdayofyear()
12763   \fdoy2date(dayofyear)  Converts yyyyddd to yyyymmdd
12764   \fmjd(date-time)       Converts free-format date to Modified Julian Date
12765   \fmjd2date(mjd)        Converts modified Julian date to yyyymmdd
12766
12767    The new floating-point arithmetic functions are explained in
12768    [577]Section 7.23. f1 and f2 are floating-point (real) numbers; d is
12769    the number of decimal places to show:
12770
12771   \ffpabsolute(f1,d)     Absolute value of f1
12772   \ffpadd(f1,f2,d)       f1 + f1
12773   \ffpcosine(f1,d)       Cosine of f1
12774   \ffpdivide(f1,f2,d)    f1 divided by f2
12775   \ffpexp(f1,d)          e to the f1 power
12776   \ffpint(f1)            Integer part of f1
12777   \ffplog10(f1,d)        Log base 10 of f1
12778   \ffplogn(f1,d)         Natural log of f1
12779   \ffpmaximum(f1,f2,d)   Maximum of f1 and f2
12780   \ffpminimum(f1,f2,d)   Minimum of f1 and f2
12781   \ffpmodulus(f1,f2,d)   Modulus of f1 and f2
12782   \ffpmultiply(f1,f2,d)  Product of f1 and f2
12783   \ffpraise(f1,f2,d)     Raise f1 to power f2
12784   \ffpround(f1,d)        Round f1 to d places
12785   \ffpsine(f1,d)         Sine of f1
12786   \ffpsqrt(f1,d)         Square root of f1
12787   \ffpsubtract(f1,f2,d)  f2 - f1
12788   \ffptangent(f1,d)      Tangent of f1
12789
12790    Integer number functions:
12791
12792    \fabsolute(n)
12793           Absolute value of integer n.
12794
12795    \frandom(n)
12796           Returns a random integer between 0 and n-1.
12797
12798    \fradix(s,n1,n2)
12799           If the string s is an integer in radix n1, the result is the
12800           same number expressed in radix n2, where n1 and n2 may be any
12801           number from 2 through 36, expressed as decimal numbers, or
12802           variables (etc) that evaluate to decimal numbers. For the source
12803           and result, the digits of any radix, r, are the first r
12804           characters in the sequence 0-9,a-z (case doesn't matter for the
12805           letters). The string s may have a sign, + or -; if it starts
12806           with a minus (-) sign, the result also has a minus sign.
12807
12808    The \fradix() function does not work with floating-point numbers. It
12809    does not reveal the internal storage format of a number; for example,
12810    \fradix(-1,10,16) is -1, not something like FFFFFFFFFF. If all three
12811    arguments are not given, or if n1 or n2 are not numbers between 2 and
12812    36 inclusive, or s is not a number in radix n1, an error occurs and the
12813    empty string is returned. \fradix() also does not offer
12814    extended-precision arithmetic; number values are limited to those
12815    expressed as a long integer in the architecture of the underlying
12816    computer, usually 32 or 64 bits. If you give it an argument whose
12817    absolute value is larger than can be held in an unsigned long, the
12818    result is -1.
12819
12820    The next four are shorthand functions for decimal/hexadecimal and
12821    decimal/octal number conversion:
12822
12823    \fn2hex(n)
12824           Returns the hexadecimal (base 16) representation of the integer
12825           n. This is different from \fhexify(s), which treats its argument
12826           as a string rather than a number. The result is always
12827           left-padded with 0's to make its length even. Examples:
12828
12829   \n2hex(0)   = "00"                    \fhexify(0)   = "30"
12830   \n2hex(255) = "ff"                    \fhexify(255) = "323535"
12831   \n2hex(256) = "0100"                  \fhexify(256) = "323536"
12832
12833    \fhex2n(x)
12834           Converts hexadecimal number x to decimal equivalent decimal
12835           number. This is the inverse of \fn2hex(). Equivalent to
12836           \fradix(s,16,10).
12837
12838    \fn2octal(n)
12839           Returns the octal (base 8) representation of the number n.
12840           Examples:
12841
12842   \n2octal(0) = "0"
12843   \n2oct(255) = "377"
12844   \n2oct(256) = "400"
12845   Equivalent to \fradix(n,10,8).
12846
12847    \foct2n(n)
12848           Returns the decimal representation of the given octal number, n.
12849           The inverse of \fn2octal(). Equivalent to \fradix(n,8,10).
12850
12851    String functions:
12852
12853    \s(name[n:m])
12854           Equivalent to \fsubstring(\m(name),n,m) ([578]Section 7.24).
12855
12856    \:(name[n:m])
12857           Equivalent to \fsubstring(name,n,m) (where "name" is any
12858           \-quantity) ([579]Section 7.24).
12859
12860    \fleft(s,n)
12861           The leftmost ncharacters of string s; equivalent to
12862           \fsubstring(s,1,n).
12863
12864    \fstripx(string,char)
12865           Returns the part of the string up to the rightmost occurrence,
12866           if any, of the given character. The default character is period
12867           (.) Examples:
12868
12869   \fstripx(foo/bar,/)                 = "foo"
12870   \fstripx(foo/bar/baz,/)             = "foo/bar"
12871   \fstripx(autoexec.bat,.)            = "autoexec"
12872   \fstripx(autoexec.bat)              = "autoexec"
12873   \fstripx(fstripx(foo/bar/baz,/),/)  = "foo"
12874
12875    \flop(string,character)
12876           Returns the portion of the string starting after the first
12877           occurrence of the given character. The default character is
12878           period (.) Examples:
12879
12880   \flop(autoexec.bat)                 = "bat"
12881   \flop(baz.foo/bar)                  = "foo/bar"
12882   \flop(baz.foo/bar,/)                = "bar
12883
12884    \fstripn(string,n)
12885           Returns the string with ncharacters removed from the end.
12886           Example:
12887
12888   \fstripn(12345678,3)                = "12345"
12889
12890           (For more discussion of \fstripx(), \fstripn(), and \flop() see
12891           [580]Section 4.2.3).
12892
12893    \fb64encode(s)
12894           Returns the Base-64 encoding of the string s.
12895
12896    \fb64decode(s)
12897           Returns the decoding of the Base-64 string s. Fails if s is not
12898           a Base-64 string, or if its length is not a multiple of 4. Note
12899           that if any of the result bytes are null (0), the result string
12900           stops there. There is no way to represent strings that contain
12901           null bytes in C-Kermit (the same is true for \funhexify()).
12902
12903    \fword(s1,n,s2,s3)
12904           Extracts word number nfrom string s1. By default, a "word" is
12905           any sequence of ASCII letters or digits; nis 1-based. If n is
12906           omitted, "1" is used. Examples:
12907
12908   \fword(one two three)    = "one"
12909   \fword(one two three,1)  = "one"
12910   \fword(one two three,2)  = "two"
12911   \fword(one two three,3)  = "three"
12912
12913           and:
12914
12915     \fword(\v(dialresult),2) = "31200"
12916
12917           is "31200" if \v(dialresult) is (e.g.) "CONNECT
12918           31200/ARQ/V32/LAPM/V42BIS".
12919
12920           If you include s2, this replaces the default break set. For
12921           example, suppose you have a string \%a whose value is:
12922
12923   $150.00 $300.00 $39.95
12924
12925           and you want each dollar amount to be a word; use:
12926
12927   \fword(\%a,\%n,{ })
12928
12929           This returns dollar amount number \%n, e.g. "$300.00" for \%n =
12930           2. "{ }" denotes a space (you must enclose it in braces,
12931           otherwise it is squeezed out). Note that ASCII control
12932           characters are always included in the break set; you don't have
12933           to specify them (and you can't not specify them).
12934
12935           The optional s3 argument lists characters (even control
12936           characters) that normally would be considered separators that
12937           you want included in words. So the dollars-and-cents example
12938           could also be handled this way:
12939
12940   \fword(\%a,\%n,,$.)
12941
12942           in other words, use the default separator list, but remove "$"
12943           and "." from it so they will be considered part of a word.
12944
12945           Note that since 8-bit characters are not ASCII, they act as
12946           break characters unless you put them in the include list.
12947           Suppose, for example, you have a file in which each line is a
12948           Tab-separated list of words, numbers, or phrases that might
12949           contain puncuation, special characters like $ and @, 8-bit bit
12950           characters, etc (like something that might have been exported
12951           from a spreadsheet or database), and you want to split only on
12952           Tab; here is a way (\m(line) is a line read from the file):
12953
12954 undef keep
12955 for \%i 1 255 1 {
12956     if == \%i 9 continue
12957     .keep := \m(keep)\fchar(\%i)
12958 }
12959 while true {
12960     fread /line \%c line
12961     if fail break
12962     .\%n := \fsplit(\m(line),&a,\9,\m(keep))
12963     ...
12964 }
12965
12966           This problem is addressed in [581]C-Kermit 9.0.
12967
12968    \fsplit(s1,&a,s2,s3)
12969           This is like \fword(), except instead of extracting and
12970           returning a particular word from string s1, it counts the words
12971           and optionally assigns them to the array whose identifying
12972           letter, a-z, is given after the "&" in the second argument, with
12973           the first word going into element 1, the second into element 2,
12974           and so on. The rules regarding break and include lists (s2 and
12975           s3) are exactly the same as for \fword(). \fsplit() returns the
12976           number of words that were assigned, which is either the number
12977           of words in the string, or the dimension of the array, whichever
12978           is less. If the array is not declared, \fsplit() creates it and
12979           returns a number which is both the number of words in s1 and the
12980           dimension of the new array. Examples:
12981
12982   declare \&w[20]        ; (Optional.)
12983   ...
12984   read \%s               ; \%s is "This is a sentence with seven words."
12985   ...
12986   echo "\fsplit(\%s)"    ; This would print "7".
12987   echo "\fsplit(\%s,&w)" ; Ditto, and also assigns them to array \&w[].
12988
12989   echo "\&w[7]"          ; This would print "words".
12990
12991           If the line contained fields that were delimited by colon (:),
12992           you would use \fsplit(\%s,&w,:). If the fields were delimited by
12993           comma, then you would use \fsplit(\%s,&w,{,}); in this case the
12994           literal comma must be enclosed in braces to distinguish it from
12995           the comma that separates function arguments. To get a word count
12996           without loading an array, but still specify break and/or include
12997           lists, leave the array argument empty:
12998
12999    echo "\fsplit(\%s,,:)" ; Use colon as the separator.
13000
13001           WARNINGS:
13002
13003          1. If you use the same array repeatedly, \fsplit() leaves any
13004             trailing members undisturbed. For example:
13005   dcl \&w[10]
13006   \fsplit(1 2 3 4 5,&w) ; Sets \&w[1] thru \&w[5].
13007   \fsplit(a b c,&w)     ; Sets \&w[1]-[3] leaving [4]-[5] as they were.
13008
13009          2. If you allow \fsplit to create the array (by not declaring it
13010             first), it is dimensioned to the number of elements it was
13011             created with:
13012   \fsplit(1 2 3,&x)     ; Creates an array \&x[] with 3 elements.
13013   \fsplit(a b c d e,&x) ; This overflows the array.
13014
13015           Thus if you want to use \fsplit() repeatedly on the same array,
13016           either dimension it in advance to the maximum expected size (and
13017           then some -- more efficient), or else destroy it after each use
13018           (to allow for unexpectedly large arguments). Example using a
13019           dynamic array:
13020
13021   fopen /read \%c some-file
13022   if fail ...
13023   set function error on    ; See [582]Section 7.12
13024   while true {
13025       dcl \&w[]            ; Destroy \&[w] each time thru the loop
13026       fread /line \%c \%a
13027       if fail break
13028       asg \%x \fsplit(\%a,&w)
13029       if fail ...
13030       ; (do what you want with \&w[] here...)
13031   }
13032   fclose \%c
13033
13034    \frindex(s1,s2,n)
13035           The "n" argument to \frindex() now works consistently (in mirror
13036           image) with the corresponding \findex() argument. In each case,
13037           the (n-1)-most characters of s2 are ignored in the search; for
13038           findex, this means the starting position of the search is n (the
13039           default n is 1, and 0 is treated like 1). For \frindex() it
13040           means the default starting point is:
13041
13042   length(s2) - length(s1) - n (with the same defaults for n).
13043
13044    \fsearch(pattern,string[,position])
13045           Exactly like \findex(), except with a pattern (see [583]Section
13046           7.9) rather than a literal string.
13047
13048    \frsearch(pattern,string[,position])
13049           Exactly like \frindex(), except with a pattern rather than a
13050           literal string.
13051
13052           File Functions:
13053
13054    \ffiles(), \fnextfile()
13055           It is no longer necessary to copy the file list to an array
13056           before use, as shown on p.398 of [584]Using C-Kermit 2nd
13057           Edition. \ffiles() and friends now make their own safe copies of
13058           the file list. Thus constructions like the following are now
13059           possible:
13060
13061   for \%i 1 \ffiles(*.txt) 1 { send \fnextfile() }
13062
13063           The same is true for the new function \frfiles(),
13064           \fdirectories(), and \frdirectories(), described in [585]Section
13065           4.11.3.
13066
13067           But note that each reference to \fnextfile() still gets you the
13068           next file. So "if newer \fnextfile() foo.txt send \fnextfile()"
13069           compares one file's age with that of foo.txt, and then sends an
13070           entirely different file. If you're going to refer to the same
13071           file more than once, assign it to a variable:
13072
13073   asg \%f \fnextfile()
13074   if newer \%f foo.txt send \%f
13075
13076           (note: assign, not define).
13077
13078           Also note that \ffiles(), \frfiles(), \fdirectories(), and
13079           \frdirectories() all now accept on optional 2nd argument: the
13080           name of an array to load with the resulting file or directory
13081           list, explained in [586]Section 4.11.3. So you can also load an
13082           array with the filelist when you need to refer to the same file
13083           more than once:
13084
13085   for \%i 1 \ffiles(*,&a) 1 { if newer \&a[\%i] foo.txt send \&a[\%i] }
13086
13087    \fpermissions(file)
13088           Returns the platform-specific permissions string for the file,
13089           such as "-rw-rw-r--" in UNIX or "(RWE,RWE,RE,E)" in VMS.
13090
13091    \fdirname(f)
13092           Given a file specification f, this function returns the complete
13093           pathname of directory the file is in.
13094
13095    Array Functions:
13096
13097    \fdimension(&a)
13098           Returns the dimension declared for the array whose identifying
13099           letter, a-z, or special character "_" or "@", is given after the
13100           "&" in the argument. If the array is not declared, 0 is
13101           returned. Note that when used with the macro argument vector
13102           array, \&_[] (see [587]Section 7.5), the value of this function
13103           is one less than \v(argc), and when used with the C-Kermit
13104           command-line argument vector array, \&@[], it is equal to the
13105           \v(args) variable. Examples:
13106
13107   echo \fdimension(&a)       ; Not declared.
13108   0
13109   declare \&a[12]            ; Now it's declared.
13110   echo \fdim(&a)
13111   12
13112
13113    \farraylook(pattern,arrayname)
13114           Looks in the given array for the pattern and returns the index
13115           of the first element that matches, if any, or -1 if none match.
13116           The arrayname can include a range specifier to restrict to
13117           search to a segment of the array, e.g.
13118           \farraylook(*xyz*,&a[32:63]). For greater detail see
13119           [588]Section 7.10.7.
13120
13121    \ftablelook(keyword,arrayname[,delimiter])
13122           Looks in the given "table", which must be sorted, for the given
13123           keyword. Returns the index of the table element that uniquely
13124           matches the given keyword, or -1 if none match, or -2 if more
13125           than 1 match. For greater detail see [589]Section 7.10.7.
13126
13127    Other new functions:
13128
13129    \fip2hex(s)
13130           Converts a dotted decimal IP address to an 8-digit hexadecimal
13131           number. \fip2hex(128.59.39.2) = 803b2702.
13132
13133    \fhex2ip(x)
13134           Converts an 8-digit hexadecimal IP address to dotted decimal
13135           form, e.g. \fhex2ip(803b2702) = 128.59.39.2. The inverse of
13136           \fip2hex().
13137
13138    \fcommand()
13139    \frawcommand()
13140           These run an external command and return its output; see
13141           [590]Section 4.2.8.4.
13142
13143    \fdialconvert(s)
13144           s is a phone number in either literal or portable format (not a
13145           dialing directory entry name). The function returns the dial
13146           string that would actually be used when dialing from the current
13147           location (after processing country code, area code, and other
13148           SET DIAL values).
13149
13150    \ferrstring(n)
13151           Returns the system error message associated with the (numeric)
13152           error code n. UNIX and VMS only. Use in conjunction with
13153           \v(errno) or \v(pexitstat). See [591]Section 4.2.5 for a usage
13154           example. Note: This function doesn't work in Windows because
13155           there is not a consistent error-code-to-message mapping; error
13156           code "x" means something completely different depending on
13157           whether it comes from the C runtime library, Winsock, a
13158           Windows-32 API, TAPI, etc,
13159
13160    \fpattern(s)
13161           Used in INPUT, REINPUT, and MINPUT commands to denote search
13162           strings that are to be treated as patterns rather than
13163           literally.
13164
13165    Also see [592]Section 7.8 on built-in help for functions.
13166
13167   7.4. New IF Conditions
13168
13169    IF AVAILABLE feature command
13170           Executes the command if the given feature is available.
13171           Presently used only to determine if specific authentication and
13172           encryption options are available. Type "if available ?" to see
13173           which features may be tested.
13174
13175    IF FLOAT f1 command
13176           Executes command if f1 is a legal floating point number (which
13177           includes integers). Use this to preverify arguments for the
13178           \ffp...() floating-point arithmetic functions, e.g. "if float
13179           \%1 echo \ffpint(\%1)".
13180
13181    IF == n1 n2 command
13182           Synonym for "if =" (numeric equality). Note that as of C-Kermit
13183           7.0, this and all other numeric comparison operators also work
13184           for floating-point numbers.
13185
13186    IF != n1 n2 command
13187           Executes the command if n1 and n2 are both numbers or variables
13188           containing numbers and the value of n1 is not equal to the value
13189           of n2. This is equivalent to "if not = n1 n2".
13190
13191    IF <= n1 n2 command
13192           Executes the command if n1 and n2 are both numbers or variables
13193           containing numbers and the value of n1 is less than or equal to
13194           the value of n2. This is equivalent to "if not > n1 n2".
13195
13196    IF >= n1 n2 command
13197           Executes the command if n1 and n2 are both numbers or variables
13198           containing numbers and the value of n1 is greater than or equal
13199           to the value of n2. Equivalent to "if not < n1 n2".
13200
13201    IF COMMAND word command
13202           Executes the command if word is a built-in C-Kermit command.
13203           Example:
13204
13205   if not command copy define { copy run copy \%1 \%2 }".
13206
13207           This defines a COPY macro that runs an external COPY command if
13208           COPY is not already a built-in command.
13209
13210    IF LOCAL command
13211           Executes the command if Kermit is in local mode, i.e. if it has
13212           a SET LINE, SET PORT, or SET HOST (TELNET, RLOGIN, etc) device
13213           or connection open. Does not execute the command if in remote
13214           mode.
13215
13216    IF MATCH string pattern command
13217           Executes the command if the string matches the pattern. For a
13218           description of the syntax for the pattern, see [593]Section
13219           4.9.1. If you want to test if the string contains pattern, use
13220           IF \fsearch(pattern,string).
13221
13222    IF OPEN { DEBUG-LOG, SESSION-LOG, TRANSACTION-LOG, ... } command
13223           Executes the command if the given file is open, fails if it is
13224           not open. Type IF OPEN ? for a complete list of files that can
13225           be checked (all the files that can be opened with the OPEN or
13226           LOG commands).
13227
13228    IF QUIET command
13229           Executes the command if SET QUIET is ON, and does not execute it
13230           if SET QUIET is OFF. Example: IF NOT QUIET ECHO { This is a
13231           message.}.
13232
13233    IF READABLE name
13234           Succeeds if name is the name of an existing file or directory
13235           that is readable.
13236
13237    IF WRITEABLE name
13238           Succeeds if name is the name of an existing file or directory
13239           that is writeable, e.g.:
13240
13241   if not writeable \v(lockdir) echo Please read installation instructions!
13242
13243    IF FLAG command
13244           This tests a user-settable condition, which can mean anything
13245           you like. SET FLAG ON causes subsequent IF FLAG commands to
13246           succeed; SET FLAG OFF causes them to fail. One way to use it
13247           would be for debugging your scripts; precede any debugging
13248           statements with IF FLAG. Then SET FLAG on to debug your script,
13249           SET FLAG OFF to run it without debugging. Another common use is
13250           for causing an inner loop to cause an outer loop to exit.
13251
13252    IF C-KERMIT command
13253           C-Kermit, but not Kermit 95 or MS-DOS Kermit, executes the
13254           command.
13255
13256    IF K-95 command
13257           Kermit 95, but not C-Kermit or MS-DOS Kermit, executes the
13258           command.
13259
13260    IF MS-KERMIT command
13261           MS-DOS Kermit, but not C-Kermit or Kermit 95, executes the
13262           command.
13263
13264   7.5. Using More than Ten Macro Arguments
13265
13266    The \v(argc) variable now gives the actual number of arguments, even if
13267    the number is greater than 9:
13268
13269   C-Kermit> define xx echo \v(argc)
13270   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
13271   27
13272
13273    Remember that \v(argc) includes the name of the macro itself, so it is
13274    always at least 1, and is always 1 greater than the actual number of
13275    arguments. As in versions 6.0 and earlier, if more than 9 arguments are
13276    given, only the first nine are assigned to the variables \%1..\%9.
13277
13278    The \&_[] array, discussed on page 353 of [594]Using C-Kermit, 2nd ed,
13279    now holds all the arguments, up to some implementation-dependent limit
13280    (64 or greater), rather than only the first 9. To illustrate: the
13281    following macro tells the number of arguments it was called with and
13282    then prints them:
13283
13284   define show_all_args {
13285       local \%i
13286       echo \&_[0] - Number of arguments: \feval(\v(argc)-1)
13287       for \%i 1 \v(argc)-1 1 { echo \flpad(\%i,3). "\&_[\%i]" }
13288   }
13289
13290    Within a macro \&_[0], like \%0, contains the name of the macro.
13291
13292    At top level, the \&_[] array is filled as follows:
13293
13294      * If the first argument on the C-Kermit command line was a filename,
13295        or C-Kermit was invoked from a "Kerbang" script ([595]Section
13296        7.19), element 0 contains the filename, and elements 1 through
13297        \v(argc)-1 hold the remaining command-line arguments.
13298      * Otherwise the program name goes in element 0, and elements 1
13299        through \v(argc)-1 hold any arguments that were included after "--"
13300        or "="
13301
13302    The new \%* variable, when used within a macro, is replaced by the text
13303    that followed the macro name in the macro invocation. If no arguments
13304    were given, \%* is replaced by the empty string. Examples:
13305
13306   C-Kermit> define xx echo [\%*]
13307   C-Kermit> define \%a oofa
13308   C-Kermit> xx
13309   []
13310   C-Kermit> xx \%a
13311   [oofa]
13312   C-Kermit> xx a
13313   [a]
13314   C-Kermit> xx a b
13315   [a b]
13316   C-Kermit> xx a b c
13317   [a b c]
13318   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
13319   [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]
13320
13321    Note that \%* can not be used at top level, since Kermit does not have
13322    access to the raw command line (only to its elements separately, after
13323    they have been processed by the shell and the C library).
13324
13325    C-Kermit 7.0 also adds a SHIFT command:
13326
13327    SHIFT [ number ]
13328           Shifts the macro arguments (except argument 0) the given number
13329           of places to the left and adjusts \v(argc) accordingly. The
13330           default number is 1.
13331
13332    To illustrate, suppose macro XXX is invoked as follows:
13333
13334   xxx arg1 arg2 arg3
13335
13336    Then inside XXX, \%1 is "arg1", \%2 is "arg2", and \%3 is "arg3". After
13337    a SHIFT command is given inside XXX, then \%1 is "arg2", \%2 is "arg3",
13338    and \%3 is empty. \%0 (the name of the macro) remains unchanged.
13339
13340    If more than 9 arguments were given, then arguments are shifted into
13341    the \%1..9 variables from the argument vector array.
13342
13343    At top level, the SHIFT command operates on the \&_[] array and \%1..9
13344    variables; the \&@[] array is not affected. See [596]Section 7.16 for
13345    details.
13346
13347    The \%* variable is not affected by the SHIFT command.
13348
13349   7.6. Clarification of Function Call Syntax
13350
13351    Spaces are normally stripped from the front and back of each function
13352    argument; to prevent this enclose the argument in braces:
13353
13354   \fsplit(\%a,&a,{ })
13355
13356    However, function calls that contain spaces can make trouble when the
13357    function is to be used in a "word" field, since space separates words.
13358    For example:
13359
13360   for \%i 1 \fsplit(\%a,&a,{ }) 1 {
13361     echo \%i. "\&a[\%i]"
13362   }
13363
13364    In most cases, the trouble can be averted by enclosing the function
13365    reference in braces:
13366
13367   for \%i 1 {\fsplit(\%a,&a,{ })} 1 {
13368     echo \%i. "\&a[\%i]"
13369   }
13370
13371    or by replacing spaces with \32 (the ASCII code for space):
13372
13373   for \%i 1 \fsplit(\%a,&a,\32) 1 {
13374     echo \%i. "\&a[\%i]"
13375   }
13376
13377    Braces are also used in function calls to indicate grouping. For
13378    example:
13379
13380   \fsubstring(abcd,2,2) = "bc"
13381
13382    But suppose "abcd" needed to contain a comma:
13383
13384   \fsubstring(ab,cd,2,2)
13385
13386    This would cause an error, since "cd" appears to be the second
13387    argument, when really you want the first "2" to be the second argument.
13388    Braces to the rescue:
13389
13390   \fsubstring({ab,cd},2,2) = "b,"
13391
13392    Similarly, leading and trailing spaces are stripped from each argument,
13393    so:
13394
13395   \fsubstring( abcd ,2,2) = "bc"
13396
13397    but braces preserve them:
13398
13399   \fsubstring({ abcd },2,2) = "ab"
13400
13401    Given these special uses for braces, there is no way to pass literal
13402    braces to the function itself. For example:
13403
13404   \fsubstring(ab{cd,2,2)
13405
13406    causes an error.
13407
13408    So if you need a function to include braces, define a variable
13409    containing the string that has braces. Example:
13410
13411   define \%a ab{cd
13412   \fsubstring(\%a,2,2) = "b{"
13413
13414    If the string is to start with a leading brace and end with a closing
13415    brace, then double braces must appear around the string (which itself
13416    is enclosed in braces):
13417
13418   define \%a {{{foo}}}
13419   \fsubstring(\%a) = "{foo}"
13420
13421    This also works for any other kind of string:
13422
13423   define \%a {{ab{cd}}
13424   echo \fsubstring(\%a) = "ab{cd"
13425
13426   7.7. Autodownload during INPUT Command Execution
13427
13428    As of 6.1 / 1.1.12, C-Kermit can be told to look for incoming Kermit
13429    (or Zmodem) packets during execution of an INPUT command. By default
13430    (for consistency with earlier releases), this is not done. You can
13431    enable this feature with:
13432
13433   SET INPUT AUTODOWNLOAD ON
13434
13435    (and disable it again with OFF.)
13436
13437    One possible use for this feature is as a server mode with a time
13438    limit:
13439
13440   INPUT 3600 secret-string-to-end-the-INPUT-command
13441
13442    In this example, any GET, SEND, or REMOTE commands received within one
13443    hour (3600 seconds) of when the INPUT command was issued will be
13444    executed. Here's another example, in which we want to stay open until
13445    11:30pm, or until interrupted by seven consecutive Ctrl-C (\3)
13446    characters:
13447
13448   INPUT 23:30:00 \3\3\3\3\3\3\3
13449
13450    The INPUT AUTODOWNLOAD setting is displayed by SHOW SCRIPTS or SHOW
13451    INPUT.
13452
13453   7.8. Built-in Help for Functions.
13454
13455    Beginning in C-Kermit 7.0, you may obtain a description of the calling
13456    conventions and return values of any built-in function, such as
13457    \fsubstring(), with the new HELP FUNCTION command; give the function's
13458    name without the leading "\f", e.g. "help func substring". You can use
13459    ?, completion, and abbreviation in the normal manner.
13460
13461   7.9. Variable Assignments
13462
13463     7.9.1. Assignment Operators
13464
13465    Programmers accustomed to languages such as C or Fortran might find
13466    Kermit's method of assigning values to variables unnatural or awkward.
13467    Beginning in C-Kermit 7.0, you can use the following alternative
13468    notation:
13469
13470  .name = value    is equivalent to   DEFINE name value
13471  .name := value   is equivalent to   ASSIGN name value
13472  .name ::= value  is equivalent to   ASSIGN name \feval(value)
13473
13474    When the command begins with a period (.), this indicates an
13475    assignment. The name can be a macro name, a \%{digit,letter} variable,
13476    or an array element. There can be space(s) between "." and the name.
13477    Examples:
13478
13479   .\%a = This is a string  ; Same as "define \%a This is a string"
13480   echo \%a
13481   This is a string
13482
13483   .xxx = \%a               ; Same as "define xxx \%a"
13484   echo \m(xxx)
13485   \%a
13486
13487   .xxx := \%a              ; Same as "assign xxx \%a"
13488   echo \m(xxx)
13489   This is a string
13490
13491   declare \&a[2]           ; Use with arrays...
13492   define \%i 2
13493   .\&a[1] = first
13494   .\&a[\%i] = second
13495
13496    The following sequence illustrates the differences among three levels
13497    of evaluation:
13498
13499   .\%x = 2          ; Define a variable to have a numeric value
13500   .\%y = (3 + \%x)  ; Define another variable as an arithmetic expression
13501
13502   .xxx = 4 * \%y    ; "=" simply copies the right-hand side.
13503   echo \m(xxx)
13504   4 * \%y
13505
13506   .xxx := 4 * \%y   ; ":=" evaluates the variables first, then copies.
13507   echo \m(xxx)
13508   4 * (3 + 2)
13509
13510   .xxx ::= 4 * \%y  ; "::=" evaluates the expression, then copies.
13511   echo \m(xxx)
13512   20
13513
13514    You can also use this syntax to clear (undefine) a variable:
13515
13516   .\%a = oofa       ; Define the variable
13517   echo "\%a"
13518   "oofa"
13519   .\%a              ; Clear the variable
13520   echo "\%a"
13521   ""
13522
13523    Extra credit: Can you guess what happens below when the file "abc" does
13524    not exist?
13525
13526   fopen /read \%c abc
13527   if fail ...
13528
13529     7.9.2. New Assignment Commands
13530
13531    Recall the DEFINE and ASSIGN commands, and their hidden counterparts,
13532    _DEFINE and _ASSIGN. The former take the variable name literally, the
13533    latter evaluate the variable-name field to form the variable name
13534    dynamically. Examples:
13535
13536   DEFINE \%x foo    ; Sets the value of the variable \%x to "foo".
13537   DEFINE \%a \%x    ; Sets the value of the variable \%a to "\%x".
13538   _DEFINE x_\%a \%x ; Sets the value of the variable x_foo to "\%x".
13539   ASSIGN \%a \%x    ; Sets the value of the variable \%a to the "foo".
13540   _ASSIGN x_\%a \%x ; Sets the value of the variable x_foo to "foo".
13541
13542    This concept has been carried over to the remaining variable-assignment
13543    commands: EVALUATE, INCREMENT, and DECREMENT:
13544
13545    EVALUATE variablename expression
13546           Evaluates the arithmetic expression and assigns its value to the
13547           variable whose name is given. Example: "eval \%a 1+1" assigns
13548           "2" to \%a.
13549
13550    _EVALUATE metaname expression
13551           Evaluates the arithmetic expression and assigns its value to the
13552           variable whose name is computed from the given metaname.
13553           Example: "eval foo<\%a>::\%1 \%2 * (\%3 + \%4)" assigns the
13554           value of "\%2 * (\%3 + \%4)" to the variable whose name is
13555           computed from "foo<\%a>::\%1".
13556
13557    INCREMENT variablename [ expression ]
13558           Evaluates the arithmetic expression and adds its value to the
13559           value of the variable whose name is given. Example: "increment
13560           \%a".
13561
13562    _INCREMENT metaname [ expression ]
13563           Evaluates the arithmetic expression and adds its value to the
13564           value of the variable whose name is computed from the given
13565           metaname. Example: "_increment Words::\%1.count[\%2]".
13566
13567    DECREMENT variablename [ expression ]
13568           Evaluates the arithmetic expression and subtracts its value from
13569           the value of the variable whose name is given.
13570
13571    _DECREMENT metaname [ expression ]
13572           Evaluates the arithmetic expression and subtracts its value from
13573           the value of the variable whose name is computed from the given
13574           metaname.
13575
13576    WARNING: The syntax of the EVALUATE command has changed since C-Kermit
13577    6.0 and K95 1.1.17. Previously, it did not include a variable name,
13578    only an expression. To restore the old behavior, use SET EVALUATE OLD.
13579    To return to the new behavior after restoring the old behavior, use SET
13580    EVALUATE NEW.
13581
13582    NOTE: There are no analogs to the "_" commands for the operators
13583    described in [597]Section 7.9.1; those operators can not be used to
13584    assign values to variables whose names must be computed.
13585
13586   7.10. Arrays
13587
13588    C-Kermit 7.0 adds lots of new array-related features, and groups them
13589    together under the NEW ARRAY command:
13590
13591    ARRAY { CLEAR, COPY, DECLARE, DESTROY, RESIZE, SHOW, SORT }
13592
13593    In each of the ARRAY commands, wherever an array name is expected,
13594    "short forms" may be used. For example, all of the following are
13595    acceptable:
13596
13597   array show \&a[]  (or SHOW ARRAY...)
13598   array show &a[]
13599   array show a[]
13600   array show &a
13601   array show a
13602
13603    In addition, ranges are accepted in the ARRAY COPY, ARRAY CLEAR, ARRAY
13604    SET, ARRAY SHOW, and ARRAY SORT commands:
13605
13606   array clear \&a[16]     ; Clears 16 thru end
13607   array clear &a[16]      ; Ditto
13608   array clear a[16]       ; Ditto
13609
13610   array clear \&a[16:32]  ; Clears 16 thru 32
13611   array clear &a[16:32]   ; Ditto
13612   array clear a[16:32]    ; Ditto
13613
13614    When using array names as function arguments, you must omit the "\" and
13615    you must include the "&". You may optionally include empty brackets.
13616    Examples:
13617
13618   \fsplit(\%a,a)          ; Bad
13619   \fsplit(\%a,\&a)        ; Bad
13620   \fsplit(\%a,&a[3])      ; Bad
13621
13622   \fsplit(\%a,&a)         ; Good
13623   \fsplit(\%a,&a[])       ; Good
13624
13625     7.10.1. Array Initializers
13626
13627    Beginning in C-Kermit 7.0, you may initialize an array -- in whole or
13628    in part -- in its declaration:
13629
13630    [ ARRAY ] DECLARE array-name[size] [ = ] [ value1 [ value2 [...] ] ]
13631
13632    For compatibility with versions 5A and 6.0, the ARRAY keyword is
13633    optional. DECLARE can also be spelled DCL.
13634
13635    Initializers are (a) optional, (b) start with element 1, (c) must be
13636    enclosed in braces if they contain spaces, and (d) are evaluated
13637    according to normal rules by the DECLARE command prior to assignment.
13638    Thus the assignments made here are the same as those made by the ASSIGN
13639    command. This allows you to initialize array elements from the values
13640    of other variables. If you actually want to initialize an array element
13641    to variable's name, as opposed to its value, use double backslashes (as
13642    in "\\&a", "\\v(time)", etc).
13643
13644    The size (dimension) of the array is optional. If the size is omitted,
13645    as in "\&a[]", then the array sizes itself to the number of
13646    initializers; if there are no initializers the array is not declared
13647    or, if it was declared previously, it is destroyed. If a size is given,
13648    any extra elements in the initialization list are discarded and
13649    ignored.
13650
13651    NOTE: Unlike in C, the list of initializers is NOT enclosed in braces.
13652    Instead, braces are used to group multiple words together. So:
13653
13654   ARRAY DECLARE \&a[] = { one two three }
13655
13656    would create an array with two elements (0 and 1), with element 1
13657    having the value " one two three ".
13658
13659    Examples:
13660
13661    ARRAY DECLARE \&a[16]
13662           Declares the array \&a with 17 elements (0 through 16), in which
13663           all elements are initially empty. If the array \&a[] existed
13664           before, the earlier copy is destroyed.
13665
13666    ARRAY DECLARE &a[16]
13667    ARRAY DECLARE a[16]
13668    ARRAY DCL \&a[16]
13669    ARRAY DCL &a[16]
13670    ARRAY DCL a[16]
13671    DECLARE \&a[16]
13672    DECLARE &a[16]
13673    DECLARE a[16]
13674    DCL \&a[16]
13675    DCL &a[16]
13676    DCL a[16]
13677           All of the above are the same as the first example.
13678
13679    ARRAY DECLARE \&a[16] = alpha beta {gamma delta}
13680           Declares the array \&a with 17 elements (0 through 16),
13681           initializing \&a[1] to "alpha", \&a[2] to "beta", and \&a[3] to
13682           "gamma delta". The remaining elements are empty.
13683
13684    ARRAY DECLARE \&a[] = alpha beta {gamma delta}
13685           Same as the previous example, but the array is automatically
13686           dimensioned to 3.
13687
13688    ARRAY DECLARE \&a[3] = alpha beta {gamma delta} epsilon zeta
13689           Too many initializers; only the first three are kept.
13690
13691    ARRAY DECLARE \&a[0]
13692    ARRAY DECLARE \&a[]
13693    ARRAY DECLARE &a[]
13694    ARRAY DECLARE &a
13695    ARRAY DECLARE a
13696    DECLARE \&[0]
13697    DECLARE a
13698    DCL a
13699           All of these are equivalent. Each destroys \&a[] if it exists.
13700           Declaring an array with a dimension of 0 is the same as ARRAY
13701           DESTROY arrayname.
13702
13703    ARRAY DECLARE \&a[] = \%1 \%2 \%3
13704           Declares the array \&a with 3 elements (0 through 3),
13705           initializing \&a[1] to the value of \%1, \&a[2] to the value of
13706           \%2, and \&a[3] to the value of \%3. In this case, any reference
13707           to one of these array elements is replaced by the value of the
13708           corresponding \%n variable at the time the declaration was
13709           executed (immediate evaluation; the array element's value does
13710           not change if the initializer variable's value changes).
13711
13712    ARRAY DECLARE \&a[] = \\%1 \\%2 \\%3
13713           Declares the array \&a with 3 elements (0 through 3),
13714           initializing \&a[1] to the string "\%1", \&a[2] to "\%2", and
13715           \&a[3] to "\%3". In this case any reference to one of these
13716           array elements is replaced by the CURRENT value of the
13717           corresponding \%n variable (deferred evaluation -- the array
13718           element's value follows the value of the initializer variable).
13719
13720    The equal sign (=) preceding the initializer list is optional, but is
13721    recommended for clarity. If you need to initialize element 1 to a
13722    literal equal sign, use two of them, separated by a space, as in this
13723    example:
13724
13725   ARRAY DECLARE \&a[] = = + - * /
13726
13727    Remember, element 0 is not initialized by the DECLARE command. To
13728    initialize element 0, use a regular DEFINE or ASSIGN command:
13729
13730   ARRAY DECLARE \&a[] one two three four five six seven eight nine
13731   DEFINE \&a[0] zero
13732
13733    Finally, remember that every command level has its own local array,
13734    \&_[], containing all the macro arguments (\%0, \%1, ...) for that
13735    level. See [598]Section 7.5 for details.
13736
13737     7.10.2. Turning a String into an Array of Words
13738
13739    The \fsplit(s1,&a,s2,s3) function assigns the words of string s1 to
13740    successive elements of the array (beginning with element 1) whose
13741    identifying letter, a-z, is given after the "&" in the second argument,
13742    using break and include characters given in s2 and s3. See [599]Section
13743    7.3 for details.
13744
13745     7.10.3. Arrays of Filenames
13746
13747    See [600]Section 4.11.3 for news about how \ffiles() and related
13748    functions can assign a list of filenames to an array. To recapitulate
13749    briefly here:
13750
13751   \ffiles(*,&a)
13752
13753    assigns all files that match the first argument to the array denoted by
13754    the second argument. If the array has not been declared, it is declared
13755    automatically, with exactly the number of elements needed to hold the
13756    file list; if it was previously declared, it is destroyed and reused.
13757    The filenames are assigned starting at array element 1. Element 0 holds
13758    the number of files in the list.
13759
13760    The DIRECTORY command ([601]Section 4.5.1) can also create filename
13761    arrays if you give it the /ARRAY: switch; this allows selection
13762    criteria beyond whether the filename matches the given pattern.
13763
13764    All functions and commands that create filename arrays store the number
13765    of filenames, n, as element 0 of the array, and the filenames as
13766    elements 1 through n.
13767
13768     7.10.4. Automatic Arrays
13769
13770    In a command file or macro, you can now have local (automatic) arrays.
13771    Just give the name followed by empty subscript brackets (no spaces
13772    inside the brackets please) in a LOCAL command, and then declare the
13773    array:
13774
13775   LOCAL \%a \&a[] oofa
13776   ARRAY DECLARE \&a[32] = value1 value2 value3 ...
13777
13778    This declares the scalar variable \%a, the array \&a[], and the macro
13779    name "oofa" to be local, and then declares the new local copy of \&a[]
13780    with 32 elements, perhaps assigning some initial values. When C-Kermit
13781    exits from the command file or macro containing these command, the
13782    previous \&a[] array is restored (and if there was no \&a[] at any
13783    higher level, this will still be true). The process can be repeated to
13784    any level. Thus it is now safe to write scripts or macros containing
13785    arrays without danger of interfering with global arrays of the same
13786    name.
13787
13788    Just as scalars are inherited by lower command levels, so are arrays.
13789    So, for example, if \&a[] is declared at top level, all lower levels
13790    will see it unless they include a "local \&a[]" statement, in which
13791    case all levels at and beneath the level where the LOCAL statement was
13792    executed will see the local copy. This too can be repeated to any
13793    level.
13794
13795    On the other hand, if you DECLARE an array at a lower command level
13796    without also making it LOCAL, this replaces the copy that was declared
13797    at the lowest command level above this one.
13798
13799     7.10.5. Sorting Arrays
13800
13801    Although arrays can be sorted using FOR loops as shown on page 383 of
13802    Using C-Kermit, 2nd Ed., this involves quite a bit of repetitive
13803    interpretation by the command parser, and so can be slow for large
13804    arrays. For this reason, C-Kermit 7.0 adds a built-in SORT command:
13805
13806    ARRAY SORT [ switches ] array [ array2 ]
13807           Sorts the given array in place. Sorting is strictly lexical
13808           (string based). The array name can be given fully, e.g. "\&a[]",
13809           or the "\" and/or "&" and/or brackets can be omitted, e.g.
13810           "array sort \&a[]", "sort &a", "sort a". Also, a range can be
13811           indicated in the brackets as noted in [602]Section 7.10, to
13812           restrict the sort to a range of elements (equivalent to the
13813           /RANGE switch, described just below), e.g. "array sort
13814           &a[20:30]".
13815
13816    A second array may be specified. If it is, and if it is at least as big
13817    as the first array, it is sorted according to the first array. For a
13818    sample application, see [603]Section 7.10.10.
13819
13820    See [604]Section 1.5 for an explanation of switches. The optional
13821    switches are:
13822
13823    /CASE:{ON,OFF}
13824           /CASE:ON means that alphabetic case is significant in
13825           comparisons; uppercase letters are sorted before lowercase ones.
13826           /CASE:OFF means case is ignored, e.g. "A" is the same as "a". If
13827           this switch is not given, sorting is according the current SET
13828           CASE setting.
13829
13830    /KEY:n
13831           Comparison begins at position n(1-based) in each string. If no
13832           key is given, the entire strings are compared. Only one key can
13833           be given. If an array element is shorter than the key value, n,
13834           that element is considered empty for comparison purposes, and
13835           therefore lexically less than any element at least ncharacters
13836           long.
13837
13838    /NUMERIC
13839           If this switch is included, it means sorting should be numeric,
13840           rather than lexical. The sort key is the string starting at the
13841           key position, skipping any leading blanks or tabs, and then as
13842           much of the string from that point on that fits the definition
13843           of "numeric", terminating at the first character that does not
13844           qualify. A numeric string has an optional sign (+ or -) followed
13845           by one or more digits, and (if your version of Kermit was built
13846           with floating-point support; see [605]Section 7.23 ) zero or one
13847           decimal point (period). If both /CASE and /NUMERIC are given,
13848           /NUMERIC takes precedence.
13849
13850    /RANGE:n[:m]
13851           Sort elements nthrough m of the array. By default, the entire
13852           array from element 1 to its dimensioned size is sorted, which
13853           might produce surprising results if the array is not full; see
13854           example in [606]Section 7.10.7. If ":m" is omitted from the
13855           range, the dimensioned size is used. Thus, to sort an entire
13856           array, \&a[], including its 0th element, use "sort /range:0 &a".
13857           You can also sort any desired section of an array, e.g. "sort
13858           /range:10:20 &a" or "sort /range:\%i:\%j-1 &b". As noted above,
13859           you can also specify a range in the array-name brackets. If you
13860           specify a range in the array-name brackets AND with a /RANGE
13861           switch, the ones in the brackets take precedence.
13862
13863    /REVERSE
13864           Sort in reverse order. If this switch is not given, the array is
13865           sorted in ascending order.
13866
13867    Remember that numeric switch arguments can be numbers, arithmetic
13868    expressions, or variables whose values are numbers or expressions, as
13869    illustrated in the /RANGE examples above.
13870
13871    A typical sorting application might be to list students' test scores in
13872    descending order. Suppose you had the following records:
13873
13874   olaf      65
13875   olga      98
13876   ivan      83
13877   xena     100
13878
13879    (and so on) stored in array \&s[] (e.g. by reading them from a file as
13880    illustrated in [607]section 7.10.7). In these records, the student's
13881    name is in columns 1-9 and the score in 10-12. So to rearrange the list
13882    in descending order of score:
13883
13884   sort /key:10 /reverse &s
13885
13886    Then to list your top five students:
13887
13888   for \%i 1 5 1 { echo \&s[\%i] }
13889
13890    Or more simply (see next section):
13891
13892   show array a[1:5]
13893
13894    To illustrate the difference between a lexical and a numeric sort,
13895    suppose you have the following records (the lines that are numbered,
13896    starting at column 1) in array \&a[]:
13897
13898     Column   1         2
13899     12345678901234567890
13900
13901    1. Ivan 10.0 2. Olaf 9.95 3. Olga 101.5
13902
13903    ARRAY SORT /KEY:10 &a[] would order them 3,1,2, but ARRAY SORT /KEY:10
13904    /NUMERIC &a[] would order them 2,1,3.
13905
13906     7.10.6. Displaying Arrays
13907
13908    The SHOW ARRAY command (or ARRAY SHOW) now accepts an optional
13909    array-name argument:
13910
13911   SHOW ARRAY \&a[]
13912
13913    (you can leave off the \, the \&, and/or the []'s if you like; "show
13914    array a" is equivalent to "show array \&a[]"). When an array is
13915    specified, its dimension is shown and all defined (non-empty) elements
13916    are listed.
13917
13918    Example:
13919
13920   assign \%n \ffiles(*,&a)  ; Fill an array with filenames ([608]Section 4.11.3)
13921   show array \&a[]          ; Show the array we just read
13922   array show \&a[]          ; Same as previous
13923   array sort \&a[]          ; Sort the array
13924   array show \&a[]          ; Show it after sorting
13925   array show \&a            ; Show it again
13926   array show &a             ; Show it again
13927   array show a              ; Show it again
13928
13929    (The final four commands demonstrate the alternative forms that are
13930    accepted for the array name.)
13931
13932    If you SHOW ARRAY without giving an array name, all defined arrays are
13933    listed by name and dimension, but their contents are not shown.
13934
13935    You can also show a piece of an array by including a subscript or range
13936    within the array brackets:
13937
13938   array show \&a[5]         ; Shows \&a[5]
13939   array show &a[3:8]        ; Shows \&a[3] through \&a[8]
13940   array show a[:\%n-1]      ; Shows \&a[0] through \&a[\%n-1]
13941
13942     7.10.7. Other Array Operations
13943
13944    ARRAY DESTROY arrayname
13945           Destroys and undeclares the named array. Subscripts or ranges
13946           are not accepted in this command.
13947
13948    ARRAY COPY array1 array2
13949           Copies the first array to the second array. If the target array
13950           has not been declared, it is created automatically with the same
13951           size as the first. If it has been declared, it will be used as
13952           declared; if the source array is larger, only as much of it as
13953           will fit is copied to the target array. Syntax for array1 and
13954           array2 is as in ARRAY SHOW (SHOW ARRAY). Example:
13955
13956   .\%n := \ffiles(*,&a)  ; Create and load array A with a file list.
13957   array copy &a &b       ; Copy array A to array B.
13958
13959           The ARRAY COPY command also lets you copy pieces of arrays by
13960           including range specifiers, as in these examples:
13961
13962         ARRAY COPY \&a[4:27] \&b
13963                 This copies \&a[] elements 4-27 to \&b[] elements 1-23,
13964                 creating \&b[] if necessary or, if \&b[] is already
13965                 declared, stopping early if its size is less than 23.
13966
13967         ARRAY COPY \&a[4:27] \&b[12]
13968                 This copies \&a[] elements 4-27 to \&b[] elements 12-35,
13969                 creating \&b[] if necessary or, if \&b[] is already
13970                 declared, stopping early if its size is less than 35.
13971
13972         ARRAY COPY \&a[4:27] \&b[12:14]
13973                 This copies \&a[] elements 4-6 to \&b[] elements 12-14,
13974                 creating \&b[] if necessary or, if \&b[] is already
13975                 declared, stopping early if its size is less than 14.
13976
13977         ARRAY COPY \&a[17] \&b
13978                 This copies all the elements of \&a[] starting with 17
13979                 until the last to \&b[], creating \&b[] if necessary or,
13980                 if \&b[] is already declared, stopping early if \&b[] is
13981                 not big enough.
13982
13983    ARRAY CLEAR arrayname
13984           Sets all the elements of the array to the empty value. You may
13985           also include a range specifier to clear only a selected portion
13986           of the array; for example "array clear \&a[37:214]". If the
13987           range is out of bounds, only the part of the array that is in
13988           bounds is cleared.
13989
13990    ARRAY SET arrayname [ value ]
13991           Sets all the elements of the array to the given value. If no
13992           value is given, the array is cleared. You may also include a
13993           range specifier to set only a selected portion of the array; for
13994           example "array set \&a[1:9] -1". If the range is out of bounds,
13995           only the part of the array that is in bounds is set.
13996
13997    ARRAY RESIZE arrayname size
13998           Resizes the given array. If the size is greater than the array's
13999           current dimension, new empty elements are added to the end. If
14000           the size is less than the current dimension, the extra elements
14001           are discarded. Note: If you have stored the array size in
14002           element 0, ARRAY RESIZE does not change this value. Alternative
14003           notation: ARRAY RESIZE arrayname[size]. For a practical example,
14004           see [609]Section 7.10.11.
14005
14006    \farraylook(pattern,arrayname)
14007           This function returns the index of the first element of the
14008           given array that matches the given pattern (for details about
14009           pattern syntax, see [610]section 4.9). The array name can
14010           include a range specification to restrict the search to a given
14011           segment of the array. If no elements match the pattern, -1 is
14012           returned.
14013
14014    \ftablelook(keyword,arrayname[,delimiter])
14015           Looks in the given "table", which must be sorted, for the given
14016           keyword. The keyword need not be spelled out in full.
14017           Pattern-matching characters should not be included as part of
14018           the keyword. The function returns the index of the table element
14019           that uniquely matches the given keyword, or -1 if none match, or
14020           -2 if more than 1 match.
14021
14022    A "table" is an array that is sorted in lexical order; each of its
14023    elements may contain multiple fields, delimited by the given delimiter
14024    character or, if no delimiter is specified, a colon (:).
14025
14026    The \farraylook() function does exactly what you tell it. If you give
14027    it a pattern that does not include wildcard characters (such as *, ?,
14028    etc), it requires an exact match. For example:
14029
14030   \farraylook(oofa,&a)
14031
14032    searches for the first element of \&a[] whose value is "oofa". But:
14033
14034   \farraylook(oofa*,&a)
14035
14036    finds the first element whose value starts with "oofa", and;
14037
14038   \farraylook(*oofa,&a)
14039
14040    finds the first element whose value ends with "oofa", and;
14041
14042   \farraylook(*oofa*,&a)
14043
14044    finds the first element whose value contains "oofa".
14045
14046    Here's a simple demonstration of looking up patterns in arrays:
14047
14048   local \&a[] \%x \%n
14049   declare \&a[] = zero one two three four five six seven eight nine ten
14050   while true {
14051       .\%x = 1
14052       .\%n = 0
14053       ask \%a { Pattern? }
14054       if not def \%a exit 0 Done.
14055       while <= \%x \fdim(&a) {
14056           .\%x := \farraylook(\%a,&a[\%x])
14057           if ( < \%x 0 ) break
14058           echo \flpad(\%x,3). \&a[\%x]
14059           increment \%x
14060           increment \%n
14061       }
14062       if ( < \%n 1 ) echo Pattern not found - "\%a"
14063   }
14064
14065    The array need not be sorted. When a pattern is given, a search is
14066    performed; if there is a match, the matching element's index and the
14067    element itself are printed, and the search begins again at the next
14068    element. Thus each matching element is printed. If none match, the
14069    "Pattern not found" message is printed. The process repeats for as many
14070    patterns as the user wants to type, and terminates when the user types
14071    an empty pattern.
14072
14073    Now let's build a little command parser, consisting of a keyword table,
14074    and a loop to look up the user's commands in it with \ftablelook(). In
14075    this case the array elements have "fields" separated by colon (:) -- a
14076    keyword and a value. Keyword tables must be sorted if \tablelook() is
14077    to work right, so after declaring and initializing the table array, we
14078    sort it.
14079
14080   local \&k[] \%a \%i \%n
14081
14082   array declare \&k[] = drive:9 do:8 discuss:7 live:6 spend:5 help:4 quit:0
14083
14084   array sort &k                             ; Make sure array is sorted
14085   echo Type "help" for help.                ; Print greeting & instructions
14086
14087   while true {                              ; Loop to get commands
14088       undefine \%a
14089       while not defined \%a {               ; Get a command
14090           ask \%a { Command? }
14091       }
14092       .\%n := \ftablelook(\%a,&k)           ; Look up the command
14093       switch \%n {                          ; Handle errors
14094         :-1, echo Not found - "\%a"         ; Doesn't match
14095              continue
14096         :-2, echo Ambiguous - "\%a"         ; Matches too many
14097              continue
14098       }
14099       switch \fword(\&k[\%n],2) {           ; Dispatch according to value
14100          :9, echo Driving..., break
14101          :8, echo Doing..., break
14102          :7, echo Discussing..., break
14103          :6, echo Living..., break
14104          :5, echo Spending..., break
14105          :4, echo { Commands (may be abbreviated):}
14106              for \%i 1 \fdim(&k) 1 {
14107                 echo {  \%i. \fword(\&k[\%i],1) }
14108              }
14109              break
14110          :0, exit 0 Bye!
14111          :default, stop 1 Internal error
14112       }
14113   }
14114
14115    In this example, keywords are "drive", "do", "discuss", etc, and their
14116    values are unique numbers (values need not be numbers, and there need
14117    not be only one value -- there can be 0, 1, 2, or more of them). The
14118    user types a command, which can be the whole word (like "help") or any
14119    abbreviation (like "hel", "he", or just "h"). If this does not match
14120    any keywords, \ftablelook() returns -1; if it matches more than one (as
14121    would "d"), it returns -2. Otherwise the array index is returned, 1 or
14122    higher.
14123
14124    Given the array index \%n, we can get the table values as follows:
14125
14126   \fword(\&k[\%n],1) is the keyword (first field)
14127   \fword(\&k[\%n],2) is the value (second field, in this case a number)
14128
14129    In our example, we use the value (number) as the SWITCH variable. As
14130    noted, \fablelook() expects the array elements to contain multiple
14131    fields separated by colon (:) (or other character that you specify,
14132    e.g. \ftablelook(\%a,&a,^)) and when matching the keyword, ignores the
14133    first delimiter and everything after it.
14134
14135     7.10.8. Hints for Using Arrays
14136
14137    C programmers are accustomed to out-of-bounds array references causing
14138    core dumps or worse. In C-Kermit:
14139
14140      * A reference to an an out-of-bounds array element returns the empty
14141        string.
14142      * An attempt to set the value of an array element that is out of
14143        bounds or that has not been declared simply fails.
14144
14145    C programmers expect an array of size nto have elements 0 through n-1.
14146    Fortran programmers expect the same array to have elements 1 through n.
14147    C-Kermit accommodates both styles; when you declare an array of size n,
14148    it has n=1 elements, 0 through n, and you can use the array in your
14149    accustomed manner, 0-based or 1-based.
14150
14151    However, note that C-Kermit has certain biases towards 1-based arrays:
14152
14153      * Assignment of file lists starts with element 1 ([611]Section
14154        7.10.3).
14155      * Assignment by \fsplit() starts with element 1 ([612]Section 7.3).
14156      * Array initialization skips the 0th element. To initialize a 0-based
14157        array, use something like this:
14158   declare \&a[3] = one two three
14159   .\&a[0] = zero
14160
14161      * The ARRAY SORT command skips the 0th element unless you include
14162        /RANGE:0
14163      * The SHIFT command ignores element 0 of the \&_[] array.
14164
14165    The distinction between an array's dimensioned size and the number of
14166    elements in the array is important when sorting. To illustrate:
14167
14168   declare \&a[100]                  ; Declare array &a with 100 elements
14169   fopen /read \%c oofa.txt          ; Open a file
14170   if fail...
14171   for \%i 1 \fdim(&a) 1 {           ; Read the file into the array
14172       fread \%c \&a[\%i]
14173       if fail break
14174   }
14175   fclose \%c
14176   if > \%i \fdim(&a) end 1 File has too many lines for array.
14177   .\%n ::= \%i - 1
14178   echo File has \%n line(s).
14179
14180    Let's say the file had 95 lines. This leaves elements 96-100 of the
14181    array empty. Now suppose you sort the array and write out the result:
14182
14183   sort &a                           ; Sort the whole array
14184   fopen /write \%o oofa.txt.sorted  ; Open an output file
14185   if fail ...
14186   for \%i 1 \%n 1 {                 ; Write out 95 records
14187       fwrite /line \%o \&a[\%i]
14188       if fail end 1 Write error
14189   }
14190   close write
14191
14192    You might be surprised at the contents of "oofa.txt.sorted" -- five
14193    empty elements, 96-100, floated to the top of the array in the sort,
14194    and since your write loop only had 95 iterations, the final 5 lines of
14195    the sorted file are lost.
14196
14197    Therefore, when dealing with partially filled arrays -- especially when
14198    sorting them -- remember to specify the number of elements. A handy way
14199    of recording an array's "true" size is to put it in the 0th element.
14200    That way, it "travels with the array". To illustrate (continuing the
14201    previous example at the "close read" statement):
14202
14203   close read
14204   if > \%i \fdim(&a) end 1 File has too many lines for array.
14205   .\&a[0] ::= \%i - 1     ; Assign number of lines to \&a[0].
14206   echo File has \&a[0] line(s).
14207   sort /range:1:\&a[0] &a
14208   open write oofa.txt.sorted
14209   if fail ...
14210   for \%i 1 \&a[0] 1 {
14211       writeln file \&a[\%j]
14212       if fail end 1 Write error
14213   }
14214   close write
14215
14216    Note the SORT switch, /RANGE:1:\&a[0]. This keeps the sort 1-based, and
14217    uses element 0 of the array as its size indicator.
14218
14219    Finally, note that even though some commands or functions might put a
14220    size in array element 0, no built-in functions or commands depend on a
14221    size actually being there. Thus you are perfectly free to replace the
14222    size with something else and treat the array as 0-based.
14223
14224     7.10.9. Do-It-Yourself Arrays
14225
14226    Kermit's \&x[] arrays are nice because of the accompanying built-in
14227    functionality -- ARRAY commands, built-in functions that load and
14228    search arrays, automatic evaluation of arithmetic expressions within
14229    the subscript brackets, and so on. Yet they also have certain
14230    limitations:
14231
14232     1. Except when created by dynamic loading (e.g. by \ffiles()) they
14233        must be declared and dimensioned in advance.
14234     2. Indices must be numeric, positive, and in range.
14235     3. There can be only one dimension. Matrices or other
14236        higher-dimensioned arrays are not available.
14237
14238    But none of this is to say you can't invent any kind of data structure
14239    you like. In [613]Section 7.9.2 you can see some examples. Here's
14240    another (courtesy of Dat Thuc Nguyen), in which a pair of matrices is
14241    created and then added: no dimensioning necessary.
14242
14243   .row = 4
14244   .col = 9
14245
14246   ; MACRO TO PRINT A MATRIX
14247   define PMATRIX {
14248       echo Matrix \%1:
14249       for \%r 1 \m(row) 1 {
14250           for \%c 1 \m(col) 1 {
14251               xecho \flpad(\m(\%1[\%r][\%c]),4)
14252           }
14253           echo
14254       }
14255       echo
14256   }
14257   ; CREATE MATRICES A AND B
14258   for \%r 1 \m(row) 1 {
14259       for \%c 1 \m(col) 1 {
14260           _eval A[\%r][\%c] \%r + \%c
14261           _eval B[\%r][\%c] \%r * \%c
14262       }
14263   }
14264   ; CREATE MATRIX C = SUM OF MATRIX A AND MATRIX B
14265   for \%r 1 \m(row) 1 {
14266       for \%c 1 \m(col) 1 {
14267           _eval C[\%r][\%c] \m(A[\%r][\%c]) + \m(B[\%r][\%c])
14268       }
14269   }
14270   pmatrix A  ; Print Matrix A
14271   pmatrix B  ; Print Matrix B
14272   pmatrix C  ; Print Matrix C
14273
14274    In the example, we use matrix-like notation to create macros with names
14275    like "A[1][1]", "B[3][7]", and so on.
14276
14277     7.10.10. Associative Arrays
14278
14279    An associative array is a special kind of Do-It-Yourself array. It
14280    differs from a regular array in that its indices need not be numbers --
14281    they can be anything at all -- words, filenames, names of months, any
14282    character string at all, and that it doesn't have to be (and in fact
14283    can't be) declared. An associative array element is simply a macro
14284    whose name ends with an index enclosed in angle brackets, for example:
14285
14286   file<oofa.txt>
14287
14288    More formally:
14289
14290   basename<index>
14291
14292    An associative array is a collection of all associative array elements
14293    that have the same basename. Any number of associative arrays, each
14294    with any number of elements, can exist at the same time.
14295
14296    An associative array element can be assigned a value, such as "1", just
14297    like any other macro:
14298
14299   define file<oofa.txt> 1     ; Give "file<oofa.txt>" the value "1".
14300
14301    or:
14302
14303   assign file<oofa.txt> \%a   ; Give it the value of the variable \%a.
14304
14305    However, since an associative array element is a macro, it may not have
14306    an empty (null) value, since assigning an empty value to a macro
14307    undefines the macro.
14308
14309    You can refer to the value of an associative array element using the
14310    familiar notation for macro values:
14311
14312   echo \m(file<oofa.txt>)     ; Echo the value of "file<oofa.txt>".
14313
14314    Associative arrays are most useful, however, when the value of the
14315    index is a variable. In that case, you must use the "hidden" forms of
14316    the DEFINE or ASSIGN commands that evaluate the macro name before
14317    making the assignment (see [614]Using C-Kermit, page 457). Example:
14318
14319   define \%f oofa.txt
14320   _define file<\%f> 1
14321   echo file<\%f> = \m(file<\%f>)
14322
14323    prints:
14324
14325   file<oofa.txt> = 1
14326
14327    and then:
14328
14329   _increment file<\%f>
14330   echo file<\%f> = \m(file<\%f>)
14331
14332    prints:
14333
14334   file<oofa.txt> = 2
14335
14336    What are associative arrays good for? The classic example is "word
14337    counts": finding the number of times each word is used in a text
14338    without knowing in advance what the words are. Without associative
14339    arrays, your program would have to build a table of some kind, and
14340    every time a word was encountered, look it up in the table to find its
14341    position and counter, or add it to the table if it wasn't found -- a
14342    time-consuming and laborious process. Associative arrays, however, let
14343    you use the word itself as the table index and therefore sidestep all
14344    the table building and lookups.
14345
14346    Let's work through a practical example. Suppose you have a
14347    file-transfer log in which each line is composed of a number of
14348    blank-separated fields, and the 9th field is a filename (which happens
14349    to be the format of certain FTP server logs, as well as of C-Kermit's
14350    new FTP-format transaction log, described in [615]Section 4.17.2), for
14351    example:
14352
14353   Wed Jul 14 09:35:31 1999 22 xx.mit.edu 13412 /pub/ftp/mm/intro.txt ....
14354
14355    and you want to find out how many times each file was transferred. The
14356    following code builds an associative array, file<>, containing the
14357    counts for each file:
14358
14359   local name line max \%c \%n          ; Declare local variables
14360   fopen /read \%c /var/log/ftpd.log    ; Open the log file ([616]Section 1.22)
14361   if fail exit 1 Can't open log        ; Check
14362   while true {                         ; Loop for each record
14363       fread /line \%c line             ; Read a line
14364       if fail break                    ; Check for end of file
14365       .name := \fword(\m(line),9,{ })  ; Get 9th field = filename (Sec 7.3)
14366       _increment file<\m(name)>        ; Increment its counter (Sec 7.9.2)
14367   }
14368   fclose \%c                           ; Close file when done.
14369
14370    Note that _INCREMENT (and INCREMENT, and [_]DECREMENT) treat an empty
14371    (i.e. nonexistent) variable as having a value of 0, and therefore
14372    creates the variable with a value of 1.
14373
14374    At this point, if you told Kermit to "show macro file<", it would list
14375    the associative array. But since you don't necessarily know the names
14376    of the files in the array, or even how many elements are in the array,
14377    how can you use it in a script program?
14378
14379    The idea of creating macro names that include character-string indices
14380    enclosed in angle brackets is perfectly arbitrary and doesn't depend on
14381    any Kermit features that weren't already there -- we could just as
14382    easily have used some other notation, such as "file[index]",
14383    "file:index", or "file.index", and the code above would have worked
14384    just as well (with the corresponding syntax adjustments). But to be
14385    able to use an associative array in a program after the array is built,
14386    we need a method of accessing all its elements without knowing in
14387    advance what they are. That's where the chosen notation comes in.
14388
14389    First of all, any macro name that ends with "<xxx>" (where "xxx" is any
14390    string) is case sensitive, unlike all other macro names, which are case
14391    independent. To illustrate, "file<oofa.txt>" and "file<OOFA.TXT>" are
14392    two distinct macros, whereas "OOFA", "Oofa", and "oofa", when used as
14393    macro names, are all the same.
14394
14395    Second, the new \faaconvert() function converts an associative array
14396    (that is, all macros with names of the form "base<index>" that have the
14397    same "base" part) into a pair of regular arrays and returns the number
14398    of elements:
14399
14400   \faaconvert(name,&a[,&b])
14401
14402    "name" is the name of the associative array, without the angle brackets
14403    or index ("file" in our example).
14404
14405    The second argument is the name of a regular array in which to store
14406    the indices of the associative array (filenames in our example); if an
14407    array of this name already exists, it is destroyed unless the array is
14408    LOCAL. The third argument is the name of another regular array in which
14409    to store the values (the counts in our example), with the same rules
14410    about array name collisions. If you care only about the indices and not
14411    the values, you can omit the third argument to \faaconvert(). In any
14412    case, the associative array is converted, not copied: its elements are
14413    moved to the specified regular arrays, so after conversion the original
14414    associative array is gone.
14415
14416    As with other array-loading functions, \faaconvert() sets element 0 of
14417    each array to the number of elements in the array.
14418
14419    To continue our example:
14420
14421   .max := 0                                   ; Maximum count
14422   .\%n := \faaconvert(file,&a,&b)             ; Convert
14423   for \%i 1 \%n 1 {                           ; Loop through values
14424       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
14425       if ( > \&b[\%i] \m(max) ) {             ; Check for new maximum
14426           .name := \&a[\%i]
14427           .max  := \&b[\%i]
14428       }
14429   }
14430   echo Most popular file: \m(name), accesses: \m(max)
14431
14432    This lists the files and counts and then announces which file has the
14433    highest count.
14434
14435    Now suppose you want to sort the array pair created from an associative
14436    array. In our example, \&a[] contains filenames, and \&b[] contains the
14437    associated counts. Here we take advantage of the ARRAY SORT command's
14438    ability to sort a second array according to the first one:
14439
14440   array sort /reverse /numeric &b &a          ; Descending sort by count
14441
14442    Now to see the top five files and their counts:
14443
14444   echo The top 5 files are:
14445   for \%i 1 5 1 {                             ; Loop through top 5 values
14446       echo \flpad(\%i,3). \&a[\%i]: \&b[\%i]  ; Echo this pair
14447   }
14448
14449     7.10.11. Transferring Array Contents to Other Computers
14450
14451    The SEND /ARRAY:arrayname command ([617]Section 4.7.1) allows you to
14452    send the contents of any array, or any contiguous segment of it, in
14453    either text or binary mode to another computer, using Kermit protocol.
14454    When used in conjunction with C-Kermit's other features (the array
14455    features described in this section; the file i/o package from
14456    [618]Section 1.22; its decision-making, pattern-matching, and string
14457    manipulation capabilities, and so on) the possibilities are endless:
14458    extracts of large files, remote database queries, ..., all without
14459    recourse to system-dependent mechanisms such UNIX pipes and filters,
14460    thus ensuring cross-platform portability of scripts that use these
14461    features.
14462
14463    When sending an array in text mode, Kermit appends a line terminator to
14464    each array element, even empty ones, and it also converts the character
14465    set from your current FILE character-set to your current TRANSFER
14466    character-set, if any. No conversions are made or line terminations
14467    added in binary mode. For example, the following array:
14468
14469   dcl \&a[] = One Two Three Four Five Six
14470
14471    is sent as six lines, one word per line, in text mode, and as the bare
14472    unterminated string "OneTwoThreeFourFiveSix" in binary mode.
14473
14474    You should always include a /TEXT or /BINARY switch in any SEND /ARRAY
14475    command to force the desired transfer mode, otherwise you're likely to
14476    be surprised by the effects described in [619]Section 4.3.
14477
14478    Here are some examples:
14479
14480    send /text /array:\&a[]
14481           Sends the entire contents of the array \&a[] in text mode. Since
14482           an as-name is not included, the receiver is told the filename is
14483           _array_a_.
14484
14485    send /text /array:&a[]
14486    send /text /array:a[]
14487    send /text /array:&a
14488    send /text /array:a
14489           These are all equivalent to the previous example.
14490
14491    send /text /array:&a /as-name:foo.bar
14492           As above, but the array is sent under the name foo.bar.
14493
14494    send /text /array:&a[100:199] /as:foo.bar
14495           As above, but only the elements from 100 through 199 are sent.
14496
14497    In text-mode transfers, character sets are translated according to your
14498    current settings, just as for text files. In binary mode, of course,
14499    there is no character-set translation or other conversion of any kind.
14500    But remember that array elements can not contain the NUL (ASCII 0)
14501    character, since they are implemented as NUL-terminated strings.
14502
14503    Here's an example that shows how to send all the lines (up to 1000 of
14504    them) from a file animals.txt that contain the words "cat", "dog", or
14505    "hog" (see [620]Section 4.9 about pattern matching):
14506
14507   declare \&a[1000]
14508   fopen /read \%c animals.txt
14509   if fail exit 1
14510   .\%i = 0
14511   while true {
14512       fread \%c line
14513       if fail break
14514       if match {\m(line)} {*{cat,[dh]og}*} {
14515           increment \%i
14516           if ( > \%i \fdim(&a) ) break
14517           .\&a[\%i] := \m(line)
14518       }
14519   }
14520   fclose \%c
14521   send /array:a[1:\%i] /text
14522
14523    Note that we are careful to send only the part of the array that was
14524    filled, not the entire array, because there are likely to be lots of
14525    unused elements at the end, and these would be sent as blank lines
14526    otherwise.
14527
14528    This example raises an interesting question: what if we want to send
14529    ALL the matching lines, even if there are more than 1000 of them, but
14530    we don't know the number in advance? Clearly the problem is limited by
14531    Kermit's (and the computer's) memory. If there are a thousand trillion
14532    matching lines, they most likely will not fit in memory, and in this
14533    case the only solution is to write them first to a temporary file on
14534    mass storage and then send the temporary file and delete it afterwards.
14535
14536    However, when the selection is likely to fit in memory, the
14537    once-familiar technique of initial allocation with extents can be used:
14538
14539   if match {\m(line)} {*{cat,[dh]og}*} {
14540       increment \%i
14541       if ( > \%i \fdim(&a) ) {
14542           array resize a \fdim(&a)+100
14543           if fail stop 1 MEMORY FULL
14544           echo NEW DIMENSION: \fdim(&a)
14545       }
14546       .\&a[\%i] := \m(line)
14547   }
14548
14549    This grows the array in chunks of 100 as needed.
14550
14551   7.11. OUTPUT Command Improvements
14552
14553    LINEOUT [ text ]
14554           This command is exactly like OUTPUT, except it supplies a
14555           carriage return at the end of the text. "lineout exit" is
14556           exactly the same as "output exit\13".
14557
14558    SET OUTPUT SPECIAL-ESCAPES { ON, OFF }
14559           This command lets you tell C-Kermit whether to process \N, \L,
14560           and \B specially in an OUTPUT command, as distinct from other \
14561           sequences (such as \%a, \13, \v(time), etc). Normally the
14562           special escapes are handled. Use SET OUTPUT SPECIAL-ESCAPES OFF
14563           to disable them.
14564
14565    Disabling special escapes is necessary in situations when you need to
14566    transmit lines of data and you have no control over what is in the
14567    lines. For example, a file oofa.txt that contains:
14568
14569   This is a file
14570   It has \%a variables in it
14571   And it has \B in it.
14572   And it has \L in it.
14573   And it has \N in it.
14574   And this is the last line.
14575
14576    can be sent like this:
14577
14578   local line
14579   set output special-escapes off
14580   fopen /read \%c oofa.txt
14581   if fail stop 1 Can't open oofa.txt
14582   while success {
14583       fread \%c line
14584       if fail break
14585       ; Add filtering or processing commands here...
14586       output \m(line)\13
14587   }
14588
14589   7.12. Function and Variable Diagnostics
14590
14591    In C-Kermit 6.0 and earlier, the only diagnostic returned by a failing
14592    function call was an empty value, which (a) could not be distinguished
14593    from an empty value returned by a successful function call; (b) did not
14594    give any indication of the cause of failure; and (c) did not cause the
14595    enclosing statement to fail. C-Kermit 7.0 corrects these deficiencies.
14596
14597    SET FUNCTION DIAGNOSTICS { ON, OFF }
14598           when ON, allows built-in functions to return diagnostic messages
14599           when improperly referenced, instead of an empty string. FUNCTION
14600           DIAGNOSTICS are ON by default. When OFF, improperly referenced
14601           functions continue to return an empty string. This command also
14602           affects built-in variables; in this case, an error message is
14603           returned only if the variable does not exist. When FUNCTION
14604           DIAGNOSTICS are ON, the error message is also printed.
14605
14606    For variables, the only message is:
14607
14608   <ERROR:NO_SUCH_VARIABLE:\v(name)>
14609
14610    where "name" is the name of the nonexistent variable.
14611
14612    For functions, the diagnostic message is:
14613
14614   <ERROR:message:\fname()>
14615
14616    where "message" is replaced by a message, and "name" is replaced by the
14617    function name, e.g. <ERROR:ARG_NOT_NUMERIC:\fmod()>. Messages include:
14618
14619   ARG_BAD_ARRAY       An argument contains a malformed array reference.
14620   ARG_BAD_DATE        An argument contains a malformed date and/or time.
14621   ARG_BAD_PHONENUM    An argument contains a malformed telephone number.
14622   ARG_BAD_VARIABLE    An argument contains a malformed \%x variable.
14623   ARG_INCOMPLETE      An argument is incomplete (e.g. a broken Base64 string).
14624   ARG_EVAL_FAILURE    An argument could not be evaluated (internal error).
14625   ARG_NOT_ARRAY       An argument references an array that is not declared.
14626   ARG_NOT_NUMERIC     An argument that must be integer contains non-digits.
14627   ARG_NOT_FLOAT       An argument has bad floating-point number format.
14628   ARG_NOT_VARIABLE    An argument that must be a variable is not a variable.
14629   ARG_OUT_OF_RANGE    An argument's numeric value is too big or too small,
14630                       or an argument contains illegal characters (e.g. a hex
14631                       or Base-64 string).
14632   ARG_TOO_LONG        An argument's value is too long.
14633   ARRAY_FAILURE       Failure to create an array.
14634   DIVIDE_BY_ZERO      Execution of the function would cause division by zero.
14635   FLOATING_POINT_OP   Execution error in a floating-point operation.
14636   FILE_NOT_FOUND      Filename argument names a file that can't be found.
14637   FILE_NOT_READABLE   Filename argument is not a regular file.
14638   FILE_NOT_ACCESSIBLE Filename argument names a file that is read-protected.
14639   FILE_ERROR          Other error with filename argument.
14640   FILE_NOT_OPEN       A file function was given a channel that is not open.
14641   FILE_ERROR_-n       A file function got error -n ([621]Section 1.22).
14642   LOOKUP_FAILURE      Error looking up function (shouldn't happen).
14643   MALLOC_FAILURE      Failure to allocate needed memory (shouldn't happen).
14644   NAME_AMBIGUOUS      The function is not uniquely identified.
14645   MISSING_ARG         A required argument is missing.
14646   NO_SUCH_FUNCTION    An argument references a function that is not defined.
14647   NO_SUCH_MACRO       An argument references a macro that is not defined.
14648   RESULT_TOO_LONG     The result of a function is too long.
14649   UNKNOWN_FUNCTION    Internal error locating function (shouldn't happen).
14650
14651    Examples:
14652
14653   assign \%m \fmod()
14654   ?<ERROR:MISSING_ARG:\fmod()>
14655   echo "\fcontents(\%m)"
14656   "<ERROR:MISSING_ARG:\fmod()>"
14657   echo \fmod(3,x)
14658   ?<ERROR:ARG_NOT_NUMERIC:\fmod()>
14659   echo \fmod(3,4-2*2)
14660   ?<ERROR:DIVIDE_BY_ZERO:\fmod()>
14661
14662    Notice the use of \fcontents() in echoing the value of a variable that
14663    contains a returned error message. That's because the error message
14664    includes the name of the variable or function that failed, so you must
14665    use \fcontents() to prevent it from being evaluated again -- otherwise
14666    the same error will occur.
14667
14668    The handling of function and variable errors is controlled by:
14669
14670    SET FUNCTION ERROR { ON, OFF }
14671           Tells whether invalid function calls or variable references
14672           should cause command errors. FUNCTION ERROR is ON by default.
14673           When ON, and an error is diagnosed in a built-in function or
14674           variable, the command that includes the function call or
14675           variable reference fails. The failing command can be handled in
14676           the normal way with IF FAILURE / IF SUCCESS, SET TAKE ERROR, or
14677           SET MACRO ERROR.
14678
14679    When FUNCTION DIAGNOSTICS is OFF, there is no error message.
14680
14681    SHOW SCRIPTS displays the current FUNCTION DIAGNOSTICS and ERROR
14682    settings.
14683
14684   7.13. Return Value of Macros
14685
14686    In C-Kermit 5A and 6.0, there are two ways to return one level from a
14687    macro: RETURN value and END number text. When RETURN is used, the
14688    value, which can be a number or a text string, is assigned to
14689    \v(return). When END was used, however, \v(return) was not set.
14690    SUCCESS/FAILURE was set according to whether the number was zero, and
14691    the text was printed, but the actual value of the number was lost.
14692
14693    In C-Kermit 7.0, the END number is available in the \v(return)
14694    variable.
14695
14696   7.14. The ASSERT, FAIL, and SUCCEED Commands.
14697
14698    The ASSERT command is just like the IF command, but without a command
14699    to execute. It simply succeeds or fails, and this can be tested by a
14700    subsequent IF SUCCESS or IF FAILURE command. Example:
14701
14702   ASSERT = 1 1
14703   IF SUCCESS echo 1 = 1.
14704
14705    The FAIL command does nothing, but always fails. The SUCCEED command
14706    does nothing, but always succeeds.
14707
14708    These commands are handy in debugging scripts when you want to induce a
14709    failure (or success) that normally would not occur, e.g. for testing
14710    blocks of code that normally are not executed.
14711
14712   7.15. Using Alarms
14713
14714    Alarms may be set in two ways:
14715
14716    SET ALARM number
14717           Sets an alarm for the given number of seconds "from now", i.e.
14718           in the future, relative to when the SET ALARM command was given.
14719           Examples:
14720
14721   set alarm 60        ; 60 seconds from now
14722   set alarm +60       ; The same as "60"
14723   set alarm -60       ; Not legal - you can't set an alarm in the past.
14724   set alarm 60*60     ; 60 minutes from now.
14725   set alarm \%a+10    ; You can use variables, etc.
14726
14727    SET ALARM hh:mm:ss
14728           Sets an alarm for the specified time. If the given time is
14729           earlier than the current time, the alarm is set for the given
14730           time in the next day. You may give the time in various formats:
14731
14732   set alarm 15:00:00  ; 3:00:00pm
14733   set alarm 3:00:00pm ; 3:00:00pm
14734   set alarm 3:00pm    ; 3:00:00pm
14735   set alarm 3pm       ; 3:00:00pm
14736
14737    SHOW ALARM
14738           Displays the current alarm, if any, in standard date-time format
14739           (see [622]Section 1.6): yyyymmdd hh:mm:ss.
14740
14741    IF ALARM command
14742           Executes the command if an alarm has been set and the alarm time
14743           has passed.
14744
14745    IF ALARM { command-list } [ ELSE { command-list } ]
14746           Executes the command-list if an alarm has been set and the alarm
14747           time has passed. Otherwise, if an ELSE part is given, its
14748           command-list is executed.
14749
14750    CLEAR ALARM
14751           Clears the alarm.
14752
14753    Only one alarm may be set at a time.
14754
14755    Example: Suppose you have a script that is always running, and that
14756    transfers files periodically, and that keeps a transaction log. Suppose
14757    you want to start a new transaction log each day:
14758
14759   log transactions \v(date).log
14760   set alarm 00:00:00                     ; Set an alarm for midnight
14761   while true {                           ; Main script loop
14762       xif alarm {                        ; If the alarm time is past...
14763           close transactions             ; Close current log
14764           log transactions \v(date).log  ; Start new one
14765           pause 1                        ; To make sure 00:00:00 is past
14766           set alarm 00:00:00             ; Set a new alarm
14767       }
14768       ; put the rest of the script here...
14769   }
14770
14771    Note that IF ALARM -- no matter whether it succeeds or fails -- does
14772    NOT clear an expired alarm. Thus, once an alarm has expired, every IF
14773    ALARM will succeed until the alarm is cleared (with the CLEAR ALARM
14774    command) or reset with a new SET ALARM command.
14775
14776   7.16. Passing Arguments to Command Files
14777
14778    Beginning in version 7.0, C-Kermit accepts arguments on the TAKE
14779    command line, for example:
14780
14781   C-Kermit> take oofa.ksc one two {this is three} four
14782
14783    This automatically sets the variables \%1 through \%9 to the arguments,
14784    and \%0 to the name of the file, in this case:
14785
14786   \%0 = /usr/olga/oofa.ksc
14787   \%1 = one
14788   \%2 = two
14789   \%3 = this is three
14790   \%4 = four
14791
14792    and \%5..\%9 are undefined (empty). Arguments past the ninth are
14793    available in the \&_[] argument-vector array ( [623]Section 7.5).
14794
14795    The variables are those at the current macro level. Thus, if the TAKE
14796    command is executed from within a macro, the macro's arguments are
14797    replaced by those given on the TAKE command line (but only if at least
14798    one argument is given). The command shown above is exactly equivalent
14799    to:
14800
14801   assign \%0 /usr/olga/oofa.ksc
14802   assign \%1 one
14803   assign \%2 two
14804   assign \%3 this is three
14805   assign \%4 four
14806   assign \%5
14807   assign \%6
14808   assign \%7
14809   assign \%8
14810   assign \%9
14811   take oofa.ksc
14812
14813    Remember, the variables \%0..\%9 are on the macro call stack, and
14814    command files are independent of the macro stack. Thus, if a command
14815    file TAKEs another command file and passes arguments to it, the
14816    variables are changed from that point on for both files, and so forth
14817    for all levels of nested command files without intervening macro
14818    invocations.
14819
14820    It would have been possible to change C-Kermit to use the overall
14821    command stack, rather than the macro stack, for arguments -- this would
14822    have made TAKE work exactly like DO, which is "nicer", but it would
14823    also have broken countless existing scripts. However, the new SHIFT
14824    command ([624]Section 7.5) makes it possible to create an alternative
14825    TAKE command that does indeed save and restore the argument variables
14826    at its own level around execution of a command file:
14827
14828   define mtake {
14829      local \%f
14830      assign \%f \fcontents(\%1)
14831      shift
14832      take \%f
14833   }
14834
14835    C-Kermit 7.0 also supports a new, easier way to pass arguments to
14836    scripts from the system command line:
14837
14838   kermit filename arg1 arg2 arg3 ...
14839
14840    in which arg1, arg2, arg3 (etc) are arguments for the script (whose
14841    filename is given), and are assigned to \%1, \%2, ... \%9. The filename
14842    is assigned to \%0. This applies equally to "Kerbang" scripts in UNIX
14843    ([625]Section 7.19). For example, suppose you have a file called
14844    "showargs" containing the following lines:
14845
14846   #!/usr/local/bin/kermit +
14847   echo Hello from \%0
14848   show args
14849   exit
14850
14851    (except not indented, since the "#!" line must be on the left margin).
14852    If you give this file execute permission:
14853
14854   chmod +x showargs
14855
14856    then you can run it exactly as you would run a UNIX shell script, e.g.:
14857
14858   $ showargs one two three
14859   Hello from /usr/olga/showargs
14860   Top-level arguments (\v(argc) = 4):
14861    \&_[0] = /usr/olga/showargs
14862    \&_[1] = one
14863    \&_[2] = two
14864    \&_[3] = three
14865
14866    Furthermore, the \&_[] array now contains the filename, if one was
14867    given as the first command line argument, or it is a "Kerbang" script,
14868    in element 0.
14869
14870    Otherwise element 0 is program name, and elements 1 through \v(argc)-1
14871    contain the command-line arguments, if any, that appear after "--" or
14872    "=", if any. This array is saved and restored around macro calls;
14873    recall that inside macros it contains the macro argument vector
14874    (allowing you to access arguments programmatically, and to have more
14875    than 9 of them).
14876
14877    At top level, notice the difference between the \&@[] and \&_[] arrays.
14878    The former includes C-Kermit options; the latter omits them.
14879
14880   7.17. Dialogs with Timed Responses
14881
14882    The ASK, ASKQ, GETOK, and GETC commands (let's call them the "ASK-class
14883    commands") let you write scripts that carry on dialogs with the user,
14884    asking them for text, a Yes/No answer, or a character, respectively.
14885    Prior to C-Kermit 7.0, these questions would always wait forever for an
14886    answer. In C-Kermit 7.0, you may specify a time limit for them with the
14887    new command:
14888
14889    SET ASK-TIMER number
14890           Sets a time-limit on ASK-CLASS commands to the given number of
14891           seconds. If the number is 0 or less, there is no time limit and
14892           these commands wait forever for a response. Any timer that is
14893           established by this command remains in effect for all future
14894           ASK-class commands until another SET ASK-TIMER command is given
14895           (e.g. with a value of 0 to disable ASK timeouts).
14896
14897    IF ASKTIMEOUT command
14898           An ASK-class command that times out returns a failure status.
14899           You can test explicitly for a timeout with:
14900
14901   7.18. Increased Flexibility of SWITCH Case Labels
14902
14903    Prior to C-Kermit 7.0 / K95 1.1.19, the case labels in SWITCH
14904    statements were string constants.
14905
14906    Now case labels can be variables, function calls, or any mixture of
14907    these with each other and/or with regular characters.
14908
14909    Furthermore, after the case label is evaluated, it is treated not as a
14910    string constant, but as a pattern against which the SWITCH variable is
14911    matched ([626]Section 4.9.1).
14912
14913    This introduces a possible incompatibility with previous releases,
14914    since the following characters in case labels are no longer taken
14915    literally:
14916
14917   \ * ? [ {
14918
14919    Any scripts that previously included any of these characters in case
14920    labels must now quote them with backslash (\).
14921
14922   7.19. "Kerbang" Scripts
14923
14924    In UNIX only, Kermit scripts can be stored in files and run "directly",
14925    without starting Kermit first (as noted on page 467 of the manual),
14926    just as a shell script can be "run" as if it were a program. This
14927    section amplifies on that idea a bit, and presents some new aspects of
14928    version 7.0 that make it easier to write and run Kermit scripts
14929    directly.
14930
14931      NOTE: On non-UNIX platforms, such as VMS or Windows, Kerbang scripts
14932      can be run as "kermit + scriptfilename arg1 arg2 arg3 ...". Windows
14933      95/98/NT file associations do not allow for the passing of
14934      parameters. In VMS, however, you can achieve the Kerbang effect by
14935      defining a symbol, as in this example:
14936
14937   $ autotelnet :== "$SYS$TOOLS:KERMIT.EXE + AUTOTELNET.KSC"
14938
14939      and then running the script like any other command:
14940
14941   $ autotelnet xyzcorp.com myuserid
14942
14943      See [627]Section 9.3 for an explanation of the "+" symbol.
14944
14945    UNIX shell scripts can specify which shell should run them by including
14946    a "shebang" line at the top, e.g.:
14947
14948   #!/bin/sh
14949
14950    (but not indented; the shebang line must be on the left margin). The
14951    term "shebang" is a contraction of "shell" and "bang". "Bang" is a
14952    slang word for the exclamation mark ("!"); "shebang" itself is an
14953    American slang word used in in the phrase "the whole shebang".
14954
14955    We can run Kermit scripts directly too, by including a "shebang" line
14956    that names Kermit as the "shell"; thus we call these "Kerbang" scripts.
14957    This mechanism has been considerably simplified in C-Kermit 7.0 to
14958    facilitate C-Kermit's use a scripting tool just like any of the UNIX
14959    shells or scripting languages. The rules are the same as for shell
14960    scripts:
14961
14962     1. The first line of the Kermit script must begin with "#!"
14963        immediately followed by the full pathname of the program that will
14964        execute the script (in this case, C-Kermit rather than a UNIX
14965        shell), followed by any Kermit command-line options. To suppress
14966        execution of the C-Kermit initialization file and to make command
14967        line arguments available to the script, the final option should be
14968        "+":
14969   #!/usr/local/bin/kermit +
14970
14971        Some users have reported that in some circumstances a space might
14972        be necessary after the plus sign; this depends on your shell -- it
14973        has nothing to do with Kermit. In most cases, no space is needed.
14974     2. The file must have execute permission (granted via "chmod +x
14975        filename").
14976
14977    When C-Kermit is invoked from a Kerbang script (or from the system
14978    prompt with a "+" command-line argument, which amounts to the same
14979    thing), the following special rules apply:
14980
14981     1. The C-Kermit initialization file is NOT executed automatically. If
14982        you want it to be executed, include a TAKE command for it in the
14983        script, e.g. "take \v(home).kermrc". (In previous releases, the
14984        initialization file was always executed, with no way to prevent it
14985        except for the user to include Kermit-specific command line options
14986        which had nothing to do with the script). Many scripts have no need
14987        for the standard Kermit initialization file, which is quite lengthy
14988        and not only delays startup of the script, but also spews forth
14989        numerous messages that are most likely unrelated to the script.
14990     2. If the initialization file is not executed, neither is your
14991        customization file, since the initialization file is the command
14992        file from which the customization file is TAKEn. Again, you can
14993        include a TAKE command for the initialization file if desired, or
14994        for the customization file by itself, or for any other file.
14995     3. C-Kermit does not process command-line arguments at all. Instead,
14996        it passes all words on the command line after the "+" to the script
14997        as \%0 (the script name), \%1..\%9 (the first nine arguments), as
14998        well as in the argument vector array \&_[]. The variable \v(argc)
14999        is set to the total number of "words" (as passed by the shell to
15000        Kermit) including the script name. Quoting and grouping rules are
15001        those of the shell.
15002     4. At any point where the script terminates, it must include an EXIT
15003        command if you want it to exit back to the shell; otherwise
15004        C-Kermit enters interactive prompting mode when the script
15005        terminates. The EXIT command can include a numeric status to be
15006        returned to the shell (0, 1, etc), plus an optional message.
15007
15008    Here is a simple Kerbang script that prints its arguments:
15009
15010   #/usr/local/bin/kermit +
15011   echo Hello from \%0
15012   for \%i 0 \v(argc)-1 1 {
15013       echo \%i. "\&_[\%i]"
15014   }
15015   exit 0
15016
15017    Save this file as (say) "showargs", then give it execute permission and
15018    run it (the \&_[] array is the same as \%0..\%9, but allows you to
15019    refer to argument variables programmatically; see [628]Section 7.5).
15020    (Yes, you could substitute SHOW ARGUMENTS for the loop.)
15021
15022   $ chmod +x showargs
15023   $ ./showargs one "this is two" three
15024
15025    The script displays its arguments:
15026
15027   Hello from /usr/olga/showargs
15028   0. "/usr/olga/showargs"
15029   1. "one"
15030   2. "this is two"
15031   3. "three"
15032   $
15033
15034    Notice that no banners or greetings are printed and that startup is
15035    instantaneous, just like a shell script. Also notice that grouping of
15036    arguments is determined by *shell* quoting rules, not Kermit ones,
15037    since the command line is parsed by the shell before Kermit ever sees
15038    it.
15039
15040    Of course you can put any commands at all into a Kerbang script. It can
15041    read and write files, make connections, transfer files, anything that
15042    Kermit can do -- because it *is* Kermit. And of course, Kerbang scripts
15043    can also be executed from the Kermit prompt (or from another script)
15044    with a TAKE command; the Kerbang line is ignored since it starts with
15045    "#", which is a comment introducer to Kermit just as it is to the UNIX
15046    shell. In VMS and other non-UNIX platforms, the Kerbang line has no
15047    effect and can be omitted.
15048
15049    It might be desireable for a script to know whether it has been invoked
15050    directly from the shell (as a Kerbang script) or by a TAKE command
15051    given to the Kermit prompt or in a Kermit command file or macro. This
15052    can be done as in this example:
15053
15054   #!/usr/local/bin/kermit +
15055   assign \%m \fbasename(\%0)
15056   define usage { exit 1 {usage: \%m phonenumber message} }
15057   define apage { (definition of APAGE...) } ; (See [629]book pp.454-456)
15058   xif equal "\%0" "\v(cmdfil)" {
15059       if not def \%1 usage
15060       if not def \%2 usage
15061       apage {\%1} {\%2}
15062       exit \v(status)
15063   }
15064
15065    In a Kerbang script, \%0 and \v(cmdfile) are the same; both of them are
15066    the name of the script. When a script is invoked by a Kermit TAKE
15067    command, \%0 is the name of the Kermit program, but \v(cmdfile) is the
15068    name of the script. In the example above, a macro called APAGE is
15069    defined. If the script was invoked directly, the APAGE macro is also
15070    executed. Otherwise, it is available for subsequent and perhaps
15071    repeated use later in the Kermit session.
15072
15073    An especially handy use for Kerbang scripts is to have the
15074    initialization file itself be one. Since the standard initialization
15075    file is rather long and time-consuming to execute, it is often overkill
15076    if you want to start Kermit just to transfer a file. Of course there
15077    are command-line switches to suppress initialization-file execution,
15078    etc, but another approach is to "run" the initialization file when you
15079    want its features (notably the services directory), and run C-Kermit
15080    directly when you don't. A setup like this requires that (a) the
15081    C-Kermit initialization file is configured as a Kerbang script (has
15082    #!/path.../kermit as first line), has execute permission, and is in
15083    your PATH; and (b) that you don't have a .kermrc file in your login
15084    directory.
15085
15086   7.20. IF and XIF Statement Syntax
15087
15088    The IF command has been improved in two significant ways in C-Kermit
15089    7.0, described in the following subsections. All changes are backwards
15090    compatible.
15091
15092     7.20.1. The IF/XIF Distinction
15093
15094    The distinction between IF and XIF is no longer important as of
15095    C-Kermit 7.0. You should be able to use IF in all cases (and of course,
15096    also XIF for backwards compatibility). In the past, IF was used for
15097    single-command THEN parts, followed optionally by a separate ELSE
15098    command:
15099
15100   IF condition command1    ; THEN part
15101   ELSE command2            ; ELSE part
15102
15103    whereas XIF was required if either part had multiple commands:
15104
15105   XIF condition { command, command, ... } ELSE { command, command, ... }
15106
15107    The syntactic differences were primarily that IF / ELSE was two
15108    commands on two separate lines, whereas XIF was one command on one
15109    line, and that XIF allowed (and in fact required) braces around its
15110    command lists, whereas IF did not allow them.
15111
15112    Furthermore, the chaining or nesting of parts and conditions was
15113    inconsistent. For example, the IF command could be used like this:
15114
15115   IF condition command
15116   ELSE IF condition command
15117   ELSE IF condition command
15118   ELSE IF condition command
15119   ...
15120
15121    but XIF could not. C-Kermit 7.0 accepts the old syntax and executes it
15122    the same as previous versions, but also accepts a new unified and more
15123    convenient syntax:
15124
15125    IF condition command-list [ ELSE command-list ]
15126
15127    or:
15128
15129 IF condition command-list
15130 ELSE command-list
15131
15132    in which the ELSE part is optional, and where command-list can be a
15133    single command (with or without braces around it) or a list of commands
15134    enclosed in braces. Examples:
15135
15136    Example 1:
15137
15138   IF condition { command1, command2 } ELSE { command3, command4 }
15139
15140    Example 2 (same as Example 1):
15141
15142   IF condition {
15143      command1
15144      command2
15145   } ELSE {
15146      command3
15147      command4
15148   }
15149
15150    Example 3 (same as 1 and 2):
15151
15152   IF condition {
15153      command1
15154      command2
15155   }
15156   ELSE { command3, command4 }
15157
15158    Example 4 (same as 1-3):
15159
15160   IF condition {
15161      command1
15162      command2
15163   }
15164   ELSE {
15165      command3
15166      command4
15167   }
15168
15169    Example 5 (ELSE can be followed by another command):
15170
15171   IF condition1 {
15172      command1
15173      command2
15174   } ELSE IF condition2 {
15175      command3
15176      command4
15177   } ELSE {
15178      command5
15179      command6
15180   }
15181
15182    Example 5 suggests other possibilities:
15183
15184   IF condition {
15185      command1
15186      command2
15187   } ELSE FOR variable initial final increment {
15188      command3
15189      command4
15190   }
15191
15192    And this too is possible, except for some non-obvious quoting
15193    considerations:
15194
15195   dcl \&a[6] = one two three four five six
15196
15197   IF < \%n 3 {
15198       echo \\%n is too small: \%n
15199   } ELSE FOR \\%i 1 \\%n 1 {
15200       echo \\%i. \\&a[\\%i]
15201   }
15202
15203    (The loop variable must be quoted in this context to prevent premature
15204    evaluation.)
15205
15206    Many C programmers prefer to code IF-ELSE, WHILE, FOR, and SWITCH with
15207    the block-open bracket on its own line. This does not work in Kermit:
15208
15209   IF condition        ; THIS FORMAT DOES NOT NOT WORK
15210   {
15211      command1
15212      command2
15213   }
15214   ELSE
15215   {
15216      command3
15217      command4
15218   }
15219
15220    Explanation: the Kermit command language is line oriented; each line is
15221    a command, each command is a line. The first line above, having no hint
15222    of continuation, is an incomplete command, yet syntactically correct --
15223    an IF statement with an empty THEN part. Interestingly enough, since
15224    the next line begins with "{" it is a block that (in [630]C-Kermit 8.0
15225    and later) is a block that is executed unconditionally. Thus the
15226    commands in the THEN part are executed regardless of whether the
15227    condition is true -- not what you wanted!
15228
15229    The new block syntax used in the IF, WHILE, FOR, and SWITCH commands
15230    employs certain tricks to allow multiple lines to be treated as a
15231    single line:
15232
15233      * Any line ending with "{" (ignoring whitespace and comments) marks
15234        the beginning of a block;
15235      * Any line beginning with "}" (ignoring whitespace) marks the end of
15236        a block;
15237      * Line breaks within a block separate commands; the comma is implied
15238        by the line end.
15239
15240    Thus:
15241
15242   IF condition {
15243      command1
15244      command2
15245   } ELSE {
15246      command3
15247      command4
15248   }
15249
15250    is "assembled" into:
15251
15252   IF condition { command1, command2 } ELSE { command3, command4 }
15253
15254    Note the addition of commas to separate commands within blocks. As
15255    always, if you need continue a command onto additional lines, you can
15256    end the continued lines with the continuation character, "-". You can
15257    also do this if you want to put opening brackets on their own line:
15258
15259   IF condition -
15260   {
15261      command1
15262      command2
15263   }
15264   ELSE -
15265   {
15266      command3
15267      command4
15268   }
15269
15270     7.20.2. Boolean Expressions (The IF/WHILE Condition)
15271
15272    Prior to C-Kermit 7.0, the IF and WHILE commands accepted only a single
15273    Boolean ("true or false") assertion, e.g. "if > \%m 0 command" or "if
15274    exist filename command". There was no way to form Boolean expressions
15275    and, in particular, nothing that approached a Boolean OR function (AND
15276    could be simulated by concatenating IF statements: "if condition1 if
15277    condition2..").
15278
15279    C-Kermit 7.0 (and K95 1.1.19) allow grouping of Boolean assertions
15280    using parentheses and combining them using AND (or &&) and OR (or ||).
15281    Each of these operators -- including the parentheses -- is a field and
15282    must be set off by spaces. AND has higher precedence than OR, NOT has
15283    higher precedence than AND, but parentheses can be used to force any
15284    desired order of evaluation. The old syntax is still accepted.
15285
15286    Here are some examples:
15287
15288   define \%z 0                          ; Define some variables
15289   define \%n 1                          ; for use in the examples.
15290
15291   if > \%n \%z echo \%n is greater.     ; Original format - still accepted.
15292   if ( > \%n \%z ) echo \%n is greater. ; Parentheses may be used in 7.0.
15293   if ( > \%n \%z && not = \%z 0 ) ...   ; Two assertions combined with AND.
15294   if ( > \%n \%z and not = \%z 0 ) ...  ; Same as previous ("and" = "&&").
15295   if ( > \%n \%z || not = \%z 0 ) ...   ; Two assertions combined with OR.
15296   if ( > \%n \%z or not = \%z 0 ) ...   ; Same as previous ("or" = "||").
15297   if ( > \%n \%z || != \%z 0 ) ...      ; Ditto ("!=" = "not =").
15298   while ( 1 ) { ... }                   ; Just like C.
15299
15300    Notice the spaces around all operators including the parentheses --
15301    these are required. The following examples show how parentheses can be
15302    used to alter the precedence of the AND and OR operators:
15303
15304   if ( false || false && false || true ) ,..         ; True
15305   if ( false || ( false && false ) || true ) ...     ; Same as previous
15306   if ( ( false || false ) && ( false || true ) ) ... ; False
15307
15308    Similarly for NOT:
15309
15310   if ( not true && false ) ...          ; False (NOT binds to TRUE only)
15311   if ( ( not true ) && false ) ...      ; Same as previous
15312   if ( not ( true && false ) ) ...      ; True (NOT binds to (TRUE && FALSE))
15313
15314    Notes:
15315
15316     1. The syntax of the Boolean expression itself has not changed; each
15317        expression begins with a keyword or token such as "EXIST", ">", or
15318        "=", etc; operators such as "<", "=", and ">" do not go between
15319        their operands but precede them as before; this might be called
15320        "reverse reverse Polish notation"; it allows deterministic
15321        on-the-fly parsing of these expressions at the C-Kermit> prompt as
15322        well as in scripts, and allows ?-help to be given for each item
15323        when IF or WHILE commands are typed at the prompt.
15324     2. Parentheses are required when there is more than one Boolean
15325        assertion.
15326     3. Parentheses are not required, but are allowed, when there is only
15327        one Boolean assertion.
15328     4. Evaluation of Boolean assertions occurs left to right, but the
15329        resulting Boolean expression is evaluated afterwards according to
15330        the rules of precedence. All Boolean assertions are always
15331        evaluated; there is no "early stopping" property and therefore no
15332        question about when or if side effects will occur -- if any Boolean
15333        assertion has side effects, they will always occur.
15334
15335    Constructions of arbitrary complexity are possible, within reason.
15336
15337    Also see [631]Section 7.4 for new IF / WHILE conditions.
15338
15339   7.21. Screen Formatting and Cursor Control
15340
15341    C-Kermit 7.0 adds a simple way to create formatted screens, the SCREEN
15342    command:
15343
15344    SCREEN { CLEAR, CLEOL, MOVE-TO row [ column ] }
15345           Performs screen-formatting actions. Correct operation of these
15346           commands depends on proper terminal setup on both ends of the
15347           connection -- mainly that the host terminal type is set to agree
15348           with the kind of terminal or the emulation you are viewing
15349           C-Kermit through. The UNIX version uses terminfo or termcap (not
15350           curses); the VMS version uses SMG; K-95 uses its built in screen
15351           manager.
15352
15353    SCREEN CLEAR
15354           Moves the cursor to home position and clears the entire screen.
15355           Synonyms: CLEAR COMMAND-SCREEN ALL (K-95 only), CLS, CLEAR
15356           SCREEN.
15357
15358    SCREEN CLEOL
15359           Clears from the current cursor position to the end of the line.
15360           Synonym: CLEAR COMMAND-SCREEN EOL (K-95 only)
15361
15362    SCREEN MOVE-TO row column
15363           Moves the cursor to the indicated row and column. The row and
15364           column numbers are 1-based, so on a 24x80 screen the home
15365           position is 1 1 and the lower right corner is 24 80. If a row or
15366           column number is given that too large for what Kermit or the
15367           operating system thinks is your screen size, the appropriate
15368           number is substituted.
15369
15370    These escape sequences used by these commands depends on the platform.
15371    In UNIX, your TERM environment variable is used to query the
15372    terminfo/termcap database; if the query fails, ANSI/VT100 sequences are
15373    used. In VMS, the SMG library is used, which sends sequences based on
15374    your VMS terminal type. K95 does its own screen control. On other
15375    platforms (such as AOS/VS, VOS, etc), screen formatting is not
15376    supported, and the SCREEN command does nothing.
15377
15378    The three SCREEN actions can be used in scripts to produce menus,
15379    formatted screens, dynamic displays, etc. Related variables include:
15380
15381   \v(terminal)     The type terminal C-Kermit thinks you have.
15382   \v(rows)         The number of rows C-Kermit thinks your terminal has.
15383   \v(columns)      The number of columns C-Kermit thinks your terminal has.
15384
15385    And functions:
15386
15387   \fscrncurx()     The current X coordinate of the cursor (K-95 only).
15388   \fscrncury()     The current Y coordinate of the cursor (K-95 only).
15389   \fscrnstr(x,y,n) The string of length nat position (x,y) (K-95 only).
15390
15391    And commands:
15392
15393   ECHO string      Writes string + CRLF at the current cursor position.
15394   XECHO string     Writes string at current cursor position; CRLF not supplied.
15395   GETC v prompt    Issues prompt, reads one character into variable v, no echo.
15396
15397    And special characters:
15398
15399   Ctrl-L           At the C-Kermit> command prompt, or in a C-Kermit command,
15400                    works like Return or Enter, but also clears the screen
15401
15402    Example 1: A macro that prints a message \%1 at cursor position
15403    (\%2,\%3):
15404
15405   define MSG {
15406       if not def \%3 def \%3 0             ; Default column to 0
15407       if > \v(argc) 2 screen move \%2 \%3  ; Move to given row/col (if any)
15408       screen cleol                         ; Clear to end of line
15409       if def \%1 xecho \fcontents(\%1)     ; Print message (if any)
15410   }
15411
15412    Example 2: A macro put the cursor on the bottom screen line, left
15413    margin:
15414
15415   define BOT {
15416       screen move \v(rows) 0
15417   }
15418
15419    Example 3: A macro to center message \%1 on line \%2.
15420
15421   define CENTER {
15422       if not def \%2 def \%2 1
15423       .\%x ::= (\v(cols)-\flen(\%1))/2
15424       msg {\%1} {\%2} {\%x}
15425   }
15426
15427    Example 4: A simple menu (building on Examples 1-3):
15428
15429   def \%c 0                             ; Menu choice variable
15430   screen clear                          ; Clear the screen
15431   center {Welcome to This Menu} 2       ; Display the menu
15432   msg {Choices:} 4
15433   msg { 1. File} 6
15434   msg { 2. Edit} 7
15435   msg { 3. Exit} 8
15436   while ( != \%c 3 ) {                  ; Read and verify choice
15437       while true {                      ; Keep trying till we get a good one
15438           screen move 10                ; Move to line 10
15439           screen cleol                  ; Clear this line
15440           getc \%c {Your choice: }      ; Prompt and get and echo 1 character
15441           xecho \%c
15442           if ( not numeric \%c ) { msg {Not numeric - "\%c"} 12, continue }
15443           if ( >= \%c 1 && <= \%c 3 ) break
15444           msg {Out of range - "\%c"} 12
15445       }
15446       switch \%c {                      ; Valid choice - execute it.
15447         :1, msg {Filing... } 12, break
15448         :2, msg {Editing...} 12, break
15449         :3, msg {Exiting...} 12, break
15450       }
15451   }
15452   echo Bye                              ; Exit chosen - say goodbye.
15453   bot                                   ; Leave cursor at screen bottom.
15454   exit                                  ; And exit.
15455
15456    Similar scripts can work over the communication connection; substitute
15457    INPUT and OUTPUT for GETC and ECHO/XECHO.
15458
15459   7.22. Evaluating Arithmetic Expressions
15460
15461    A new arithmetic operator was added to the list recognized by the
15462    EVALUATE command, the \feval() function, and which can also be used
15463    anywhere else arithmetic expressions are accepted (numeric command
15464    fields, array subscripts, etc):
15465
15466    Prefix "!"
15467           This operator inverts the "truth value" of the number or
15468           arithmetic expression that follows. If the value of the operand
15469           is 0, the result is 1. If the value is nonzero, the result is 0.
15470
15471    Examples:
15472
15473   set eval old
15474   evaluate 0
15475   0
15476
15477   evaluate !0
15478   1
15479
15480   evaluate !3
15481   0
15482
15483   evaluate !(-3)
15484   0
15485
15486   .\%a = 1
15487   .\%b = 0
15488   evaluate !(\%a|\%b)
15489   0
15490
15491   evaluate !(\%a&\%b)
15492   1
15493
15494   evaluate !(!(\%a&\%b))
15495   0
15496
15497    Note the distinction between Prefix ! (invert truth value) and Suffix !
15498    (factorial). Also the distinction between Prefix ! and Prefix ~ (which
15499    inverts all the bits in its operand). Also note that prefix operators
15500    (!, -, and ~) can not be adjacent unless you use parentheses to
15501    separate them, as shown in the final example above.
15502
15503   7.23. Floating-Point Arithmetic
15504
15505    C-Kermit 7.0 adds limited support for floating-point numbers (numbers
15506    that have fractional parts, like 3.141592653). This support is provided
15507    through a small repertoire of functions and in Boolean expressions that
15508    compare numbers, but does not apply to number parsing in general, or to
15509    expression evaluation, array subscripts, the INCREMENT and DECREMENT
15510    commands, or in any context other than those listed in this section.
15511
15512    A floating point number has an optional sign (+ or -), followed by a
15513    series of decimal digits containing either zero or one period (.)
15514    character, which is the decimal point. The use of comma or any other
15515    character besides period as a decimal point is not supported.
15516    Scientific notation is not supported either. Examples of legal
15517    floating-point numbers:
15518
15519   0                Integers can be used
15520   1                Ditto
15521   2.               A decimal point without decimal digits
15522   3.0              A decimal point with decimal digits
15523   3.141592653      Ditto
15524  -4.0              A negative sign can be included
15525  +5.0              A positive sign can be included
15526
15527    Examples of notations that are not accepted:
15528
15529   1,000,000        Separators can not be used
15530   1.000.000        Ditto (or multiple decimal points)
15531   6.022137E23      No scientific notation
15532   6.62606868e-34   Ditto
15533   12.5+6.25        No "bare" expressions
15534
15535    You can use IF FLOAT test a string or variable to see if it's in
15536    acceptable floating-point format. Example:
15537
15538   ask \%f { Type a number: }
15539   if not def \%f .\%f = 0.0
15540   if not float \%f stop 1 Invalid floating-point number: "\%f"
15541
15542    C-Kermit's floating-point support, like its support for whole numbers
15543    (integers), relies on the capabilities of the underlying computer. Your
15544    computer has only a limited amount of precision for numbers, depending
15545    on its architecture. Thus floating-point numbers that have too many
15546    digits will not be accurate; adding a very small number to a very large
15547    one might have no effect at all; and so on. For details, read a text on
15548    numerical analysis. Example:
15549
15550   .\%a = 11111111111111111111  ; A long number
15551   .\%b = 22222222222222222222  ; Another one
15552   echo \ffpadd(\%a,\%b)        ; Add them - the result should be all 3's
15553   33333333333333330000.0       ; See the result
15554
15555    In this example, the computer has 16 digits of precision; after that,
15556    the (low-order) digits are set to 0, since the computer doesn't know
15557    what they really are. In fact, the computer returns random digits, but
15558    Kermit sets all digits beyond the computer's precision to 0.
15559
15560    C-Kermit's floating-point functions have names of the form
15561    "\ffpxxx(args)" ("\f" for function, "fp" for floating-point), where
15562    "xxx" is replaced by the name of the function, such as "sqrt", and
15563    "args" is the argument list, consisting of one or two floating-point
15564    numbers (depending on the function), and an optional "d" argument that
15565    says now many decimal places should be shown in the result. Example:
15566
15567   \ffpdiv(10,3,1) returns "3.3"
15568   \ffpdiv(10,3,2) returns "3.33"
15569   \ffpdiv(10,3,3) returns "3.333"
15570
15571    and so on, up to the precision of the computer. If the decimal-places
15572    argument is less than zero, the fractional part of the result is
15573    truncated:
15574
15575   \ffpdiv(10,3,-1) returns "3".
15576
15577    If the decimal-places argument is 0, or is omitted, C-Kermit returns as
15578    many decimal places as are meaningful in the computer's floating-point
15579    precision, truncating any extraneous trailing 0's:
15580
15581   \ffpdiv(10,8) returns "1.25".
15582   \ffpdiv(10,4) returns "2.5".
15583   \ffpdiv(10,2) returns "5.0".
15584   \ffpdiv(10,3) returns "3.333333333333333" (for 16-digit precision).
15585
15586    There is no way to request that a floating-point function return a
15587    decimal point but no decimal places. However, this is easy enough to
15588    accomplish in other ways, for example by supplying it outside the
15589    function call:
15590
15591   echo \ffpadd(\%a,\%b,-1).
15592
15593    Kermit's floating-point functions always round the result for the
15594    requested number of decimal places when the "d" argument is given and
15595    has a value greater than 0 (see the description of \ffpround() just
15596    below).
15597
15598    Floating-point arguments can be constants in floating-point format or
15599    variables whose values are floating-point numbers. If a floating-point
15600    argument is omitted, or is a variable with no value, 0.0 is supplied
15601    automatically. Example:
15602
15603   def \%x 999.999
15604   undef \%y
15605   echo \ffpmin(\%x,\%y)
15606   0.0
15607
15608    Or equivalently:
15609
15610   echo \ffpmin(999.999)
15611   0.0
15612
15613    The floating-point functions are:
15614
15615    \ffpround(f1,d)
15616           Returns f1 rounded to d decimal places. For this function only,
15617           d = 0 (or d omitted) has a special meaning: return the integer
15618           part of f1 rounded according to the fractional part. Examples:
15619
15620   \ffpround(2.74653,-1) returns "2" (fraction truncated, no rounding).
15621   \ffpround(2.74653,0)  returns "3" (integer part is rounded).
15622   \ffpround(2.74653)    returns "3" (d omitted same as d = 0).
15623   \ffpround(2.74653,1)  returns "2.7".
15624   \ffpround(2.74653,2)  returns "2.75".
15625   \ffpround(2.74653,3)  returns "2.747".
15626   \ffpround(2.74653,4)  returns "2.7465", etc.
15627
15628    \ffpadd(f1,f2,d)
15629           Returns the sum of f1 and f2.
15630
15631    \ffpsubtract(f1,f2,d)
15632           Subtracts f2 from f1 and returns the result.
15633
15634    \ffpmultiply(f1,f2,d)
15635           Returns the product of f1 and f2.
15636
15637    \ffpdivide(f1,f2,d)
15638           If f2 is not 0, divides f1 by f2 and returns the quotient.
15639           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
15640
15641    \ffpraise(f1,f2,d)
15642           If f1 = 0 and f2 <= 0, or if f1 < 0 and f2 has a fractional
15643           part, an ARG_OUT_OF_RANGE error occurs; otherwise f1 raised to
15644           the f2 power is returned.
15645
15646    \ffpsqrt(f1,d)
15647           If f1 >= 0, returns the square root of f1; otherwise
15648           ARG_OUT_OF_RANGE.
15649
15650    \ffpabsolute(f1,d)
15651           Returns the absolute value of f1 (i.e. f1 without a sign). This
15652           is the floating-point analog of \fabsolute(n1).
15653
15654    \ffpint(f1)
15655           Returns the integer part of f1. Equivalent to \ffpround(f1,-1).
15656
15657    \ffpexp(f1,d)
15658           The base of natural logarithms, e (2.718282...), raised to the
15659           f1 power.
15660
15661    \ffplogn(f1,d)
15662           The natural logarithm of f1 (the power to which e must be raised
15663           to obtain f1).
15664
15665    \ffplog10(f1,d)
15666           The base-10 logarithm of f1 (the power to which 10 must be
15667           raised to obtain f1).
15668
15669    \ffpmodulus(f1,f2,d)
15670           If f2 is not 0, the remainder after dividing f1 by f2.
15671           If f2 is 0, a DIVIDE_BY_ZERO error occurs.
15672           This is the floating-point analog of \fmod(n1,n2).
15673
15674    \ffpmaximum(f1,f2,d)
15675           Returns the maximum of f1 and f2. This is the floating-point
15676           analog of \fmax(n1,n2).
15677
15678    \ffpminimum(f1,f2,d)
15679           Returns the minimum of f1 and f2. This is the floating-point
15680           analog of \fmin(n1,n2).
15681
15682    \ffpsine(f1,d)
15683           Returns the sine of f1 radians.
15684
15685    \ffpcosine(f1,d)
15686           Returns the cosine of f1 radians.
15687
15688    \ffptangent(f1,d)
15689           Returns the tangent of f1 radians.
15690
15691    Note that all of these functions can be used with integer arguments. If
15692    you want an integer result, specify d = -1 (to truncate) or feed the
15693    result to \ffpround(xxx,0) (to round).
15694
15695    Floating-point numbers (or variables or functions that return them) can
15696    be used in Boolean expressions (see [632]Section 7.20.2) that compare
15697    numbers:
15698
15699   = x y
15700   != x y
15701   < x y
15702   > x y
15703   <= x y
15704   >= x y
15705
15706    In these examples, x and y can be either integers or floating-point
15707    numbers in any combination. In an arithmetic comparison of an integer
15708    and a floating-point number, the integer is converted to floating-point
15709    before the comparison is made. Examples:
15710
15711   .\%t = 3.000000000
15712   .\%f = 3.141592653
15713   .\%i = 3
15714
15715   if > \%f \%i echo Pi is greater.
15716   if = \%t \%i echo "\%i" = "\%t".
15717
15718    A floating-point number can also be used in:
15719
15720   IF number command
15721
15722    where the command is executed if the number is nonzero. If the number
15723    is floating-point, the command is not executed if the number is 0.0,
15724    and is executed otherwise.
15725
15726    Floating-point numbers can be sorted using ARRAY SORT /NUMERIC (see
15727    [633]Section 7.10.5 ).
15728
15729    Two floating-point constants are provided:
15730
15731   \v(math_pi) = Pi (3.141592653...)
15732   \v(math_e)  = e, the base of natural logarithms (2.71828...)
15733
15734    These are given to the computer's precision, e.g. 16 digits. This
15735    number itself is available in a variable:
15736
15737    \v(math_precision)
15738           How many significant digits in a floating-point number.
15739
15740   7.24. Tracing Script Execution
15741
15742    The TRACE command is handy for debugging scripts.
15743
15744    TRACE [ { /ON, /OFF } ] [ { ASSIGNMENTS, COMMAND-LEVEL, ALL } ]
15745           Selects tracing of the given object.
15746
15747    Optional switches are /ON and /OFF. If no switch is given, /ON is
15748    implied. The trace objects are ASSIGNMENTS, COMMAND-LEVEL, and ALL. The
15749    default object is ALL, meaning to select all trace objects (besides
15750    ALL). Thus TRACE by itself selects tracing of everything, as does TRACE
15751    /ON, and TRACE /OFF turns off all tracing.
15752
15753    When tracing of ASSIGNMENTS is on, every time the value of any
15754    user-defined variable or macro changes, C-Kermit prints one of the
15755    following:
15756
15757    >>> name: "value"
15758           The name of the variable or macro followed by the new value in
15759           quotes. This includes implicit macro-parameter assignments
15760           during macro invocation.
15761
15762    >>> name: (undef)
15763           This indicates that the variable or macro has been undefined.
15764
15765    <<< name: "value"
15766           For RETURN statements: the name of the macro and the return
15767           value.
15768
15769    <<< name: (null)
15770           For RETURN statements that include no value or an empty value.
15771
15772    When tracing of COMMAND-LEVEL is on, C-Kermit prints:
15773
15774    [n] +F: "name"
15775           Whenever a command file is entered, where "n" is the command
15776           level (0 = top); the name of the command file is shown in
15777           quotes.
15778
15779    [n] +M: "name"
15780           Whenever a macro is entered; "n" is the command level. The name
15781           of the macro is shown in quotes.
15782
15783    [n] -F: "name"
15784           Whenever a command file is reentered from below, when a macro or
15785           command file that it has invoked has returned.
15786
15787    [n] -M: "name"
15788           Whenever a macro is reentered from below.
15789
15790    For other debugging tools, see SHOW ARGS, SHOW STACK, SET TAKE, SET
15791    MACRO, and of course, ECHO.
15792
15793   7.25. Compact Substring Notation
15794
15795    It is often desirable to extract a substring from a string which is
15796    stored in a variable, and for this we have the \fsubstring() function,
15797    which is used like this:
15798
15799   define \%a 1234567890
15800   echo \fsubstring(\%a,3,4) ; substring from 3rd character length 4
15801   3456
15802
15803    or like this with macro-named variables:
15804
15805   define string 1234567890
15806   echo \fsubstring(\m(string),3,4)
15807   3456
15808
15809    C-Kermit 7.0 adds a pair of alternative compact notations:
15810
15811 \:(variablename[start:length])  <-- Substring of variable's value
15812 \s(macroname[start:length])     <-- Substring of macro's definition
15813
15814    These are exactly equivalent to using \fsubstring(), except more
15815    compact to write and also faster since evaluation is in one step
15816    instead of two.
15817
15818    The "\:()" notation can be used with any Kermit variable, that is,
15819    almost anything that starts with a backslash:
15820
15821   \:(\%a[2:6])      <-- equivalent to \fsubstring(\%a,2,6)
15822   \:(\&x[1][2:6])   <-- equivalent to \fsubstring(\&x[1],2,6)
15823   \:(\m(foo)[2:6])  <-- equivalent to \fsubstring(\m(foo),2,6)
15824   \:(\v(time)[2:6]) <-- equivalent to \fsubstring(\v(time),2,6)
15825   \:(\$(TERM)[2:6]) <-- equivalent to \fsubstring(\$(TERM),2,6)
15826   \:(ABCDEFGH[2:6]) <-- equivalent to \fsubstring(ABCDEFGH,2,6)
15827
15828    Whatever appears between the left parenthesis and the left bracket is
15829    evaluated and then the indicated substring of the result is returned.
15830
15831    The "\s()" notation is the same, except after evaluating the variable,
15832    the result is treated as a macro name and is looked up in the macro
15833    table. Then the indicated substring of the macro definition is
15834    returned. Example:
15835
15836   define testing abcdefghijklmnopqrstuvwxyz
15837   define \%a testing
15838
15839   \s(testing[2:6])  -->  bcdefg
15840   \:(testing[2:6])  -->  esting
15841   \:(\%a[2:6])      -->  esting
15842   \s(\%a[2:6])      -->  bcdefg
15843
15844    Note that the following two examples are equivalent:
15845
15846   \:(\m(foo)[2:6])
15847   \s(foo[2:6])
15848
15849    The first number in the brackets is the 1-based starting position. If
15850    it is omitted, or less than 1, it is treated as 1. If it is greater
15851    than the length of the string, an empty string is returned.
15852
15853    The second number is the length of the desired substring. If the second
15854    number is omitted, is less than 0, or would be past the end of the
15855    string, then "through the end of the string" is assumed. If it is 0,
15856    the empty string is returned.
15857
15858    If the brackets are empty or omitted, the original string is returned.
15859
15860    The starting position and length need not be literal numbers; they can
15861    also be variables, functions, arithmetic expressions, or even other
15862    \s() or \:() quantities; anything that evaluates to a number, for
15863    example:
15864
15865   \s(block[1025:\fhex2n(\s(block[\%b:\%n+4]))/2])
15866
15867    Syntactically, \m(name) and \s(name) differ only in that the sequence
15868    [*] at the end of the name (where * is any sequence of 0 or more
15869    characters) is treated as substring notation in \s(name), but is
15870    considered part of the name in \m(name) (to see why, see [634]Section
15871    7.10.9).
15872
15873   7.26. New WAIT Command Options
15874
15875    The WAIT command has been extended to allow waiting for different kinds
15876    of things (formerly it only waited for modem signals). Now it also can
15877    wait for file events.
15878
15879     7.26.1. Waiting for Modem Signals
15880
15881    The previous syntax:
15882
15883   WAIT time { CD, DSR, RTS, RI, ... }
15884
15885    has changed to:
15886
15887   WAIT time MODEM-SIGNALS { CD, DSR, RTS, RI, ... }
15888
15889    However, the previous syntax is still accepted. The behavior is the
15890    same in either case.
15891
15892     7.26.2. Waiting for File Events
15893
15894    The new WAIT option:
15895
15896   WAIT time FILE { CREATION, DELETION, MODIFICATION } filename
15897
15898    lets you tell Kermit to wait the given amount of time (or until the
15899    given time of day) for a file whose name is filename to be created,
15900    deleted, or modified, respectively. The filename may not contain
15901    wildcards. If the specified event does not occur within the time limit,
15902    or if WAIT CANCELLATION is ON and you interrupt from the keyboard
15903    before the time is up, the WAIT command fails. If the event is
15904    MODIFICATION and the file does not exist, the command fails. Otherwise,
15905    if the given event occurs within the time limit, the command succeeds.
15906    Examples:
15907
15908    WAIT 600 FILE DELETION oofa.tmp
15909           Wait up to 10 minutes for file oofa.tmp to disappear.
15910
15911    WAIT 23:59:59 FILE MOD orders.db
15912           Wait until just before midnight for the orders.db file to be
15913           changed.
15914
15915    Example: Suppose you want to have the current copy of /etc/motd on your
15916    screen at all times, and you want to hear a bell whenever it changes:
15917
15918   def \%f /etc/motd                      ; The file of interest.
15919   while 1 {                              ; Loop forever...
15920       cls                                ; Clear the screen.
15921       echo \%f: \v(date) \v(time)...     ; Print 2-line heading...
15922       echo
15923       if ( not exist \%f ) {             ; If file doesn't exist,
15924           echo \%f does not exist...     ; print message,
15925           wait 600 file creat \%f        ; and wait for it to appear.
15926           continue
15927       }
15928       beep                               ; Something new - beep.
15929       type /head:\v(rows-2) \%f          ; Display the file
15930       if fail exit 1 \%f: \ferrstring()  ; (checking for errors).
15931       wait 999 file mod \%f              ; Wait for it to change.
15932   }
15933
15934    This notices when the file is created, deleted, or modified, and acts
15935    only then (or when you interrupt it with); the time shown in the
15936    heading is the time of the most recent event (including when the
15937    program started).
15938
15939    See [635]Section 1.10, where the \v(kbchar) variable is explained. This
15940    lets you modify a loop like the one above to also accept
15941    single-character commands, which interrupt the WAIT, and dispatch
15942    accordingly. For example:
15943
15944   wait 999 file mod \%f              ; Wait for the file to change.
15945   if defined \v(kbchar) {            ; Interrupted from keyboard?
15946       switch \v(kbchar) {            ; Handle the keystroke...
15947         :q, exit                     ; Q to Quit
15948         :h, echo blah blah, break    ; H for Help
15949         :default, beep, continue     ; Anything else beep and ignore
15950       }
15951   }
15952
15953    This lets you write event-driven applications that wait for up to three
15954    events at once: a file or modem event, a timeout, and a keystroke.
15955
15956   7.27. Relaxed FOR and SWITCH Syntax
15957
15958    For consistency with the extended IF and WHILE syntax, the FOR and
15959    SWITCH control lists may (but need not be) enclosed in parentheses:
15960
15961   FOR ( \%i 1 \%n 1 ) { command-list... }
15962   SWITCH ( \%c ) { command-list... }
15963
15964    In the FOR command, the increment item can be omitted if the control
15965    list is enclosed in parentheses, in which case the increment defaults
15966    appropriately to 1 or -1, depending on the values of the first two
15967    variables.
15968
15969    As with IF, the parentheses around the FOR-command control list must be
15970    set off by spaces (in the SWITCH command, the spaces are not required
15971    since the SWITCH expression is a single arithmetic expression).
15972
15973    Also, outer braces around the command list are supplied automatically
15974    if you omit them, e.g.:
15975
15976   FOR ( \%i 1 %n 1 ) echo \%i
15977
15978   8. USING OTHER FILE TRANSFER PROTOCOLS
15979
15980    In C-Kermit 7.0, alternative protocols can be selected using switches.
15981    Switches are described in [636]Section 1.5; the use of
15982    protocol-selection switches is described in [637]Section 4.7.1.
15983    Example:
15984
15985   send /binary /protocol:zmodem x.tar.gz
15986
15987    Note that file transfer recovery works only with Kermit and Zmodem
15988    protocols. With Zmodem, recovery can be initiated only by the sender.
15989
15990    Only pre-1988 versions of the publicly-distributed sz/rz programs use
15991    Standard I/O; those released later than that do not use Standard I/O
15992    and therefore do not work with REDIRECT. However, Omen Technology does
15993    offer an up-to-date redirectable version called crzsz, which must be
15994    licensed for use:
15995
15996      "Unix Crz and Csz support XMODEM, YMODEM, and ZMODEM transfers when
15997      called by dial-out programs such as Kermit and certain versions of
15998      cu(1). They are clients designed for this use.
15999
16000      "Crz and Csz are Copyrighted shareware programs. Use of these
16001      programs beyond a brief evaluation period requires registration.
16002      Please print the "mailer.rz" file, fill out the form and return same
16003      with your registration."
16004
16005    To use the crzsz programs as your external XYZMODEM programs in
16006    C-Kermit, follow the instructions in the book, but put a "c" before
16007    each command, e.g.:
16008
16009   set protocol zmodem {csz %s} {csz -a %s} crz crz crz crz
16010
16011    To use Zmodem protocol over Telnet or other non-transparent
16012    connections, you might need to add the -e (Escape) option:
16013
16014   set protocol zmodem {csz -e %s} {csz -e -a %s} crz crz crz crz
16015
16016   9. COMMAND-LINE OPTIONS
16017
16018   9.0. Extended-Format Command-Line Options
16019
16020    Standard UNIX command line options are a single letter. C-Kermit has
16021    run out of letters, so new options are in a new extended format:
16022
16023  --word[:arg]
16024
16025    where a keyword (rather than a single letter) specifies the function,
16026    and if an argument is to be included, it is separated by a colon (or
16027    equal sign). Most of the new extended-format command-line options are
16028    only for use with the Internet Kermit Service Daemon; see the [638]IKSD
16029    Administration Guide for details. However, several of them are also
16030    general in nature:
16031
16032    --nointerrupts
16033           Disables keyboard interrupts that are normally enabled, which
16034           are usually Ctrl-C (to interrupt a command) and Ctrl-Z (UNIX
16035           only, to suspend C-Kermit).
16036
16037    --help
16038           Lists the extended command-line options that are available in
16039           your version of C-Kermit. If any options seem to be missing,
16040           that is because your copy of C-Kermit was built with
16041           compile-time options to deselect them.
16042
16043    --helpfile:filename
16044           Specifies the name of a file to be displayed if the user types
16045           HELP (not followed by a specific command or topic), in place of
16046           the built-in top-level help text. The file need not fit on one
16047           screen; more-prompting is used if the file is more than one
16048           screen long if COMMAND MORE-PROMPTING is ON, as it is by
16049           default.
16050
16051    --bannerfile:filename
16052           The name of a file containing a message to be printed after the
16053           user logs in, in place of the normal message (Copyright notice,
16054           "Type HELP or ? for help", "Default transfer mode is...", etc).
16055
16056    --cdmessage:{on,off,0,1,2}
16057           For use in the Server-Side Server configuration; whenever the
16058           client tells the server to change directory, the server sends
16059           the contents of a "read me" file to the client's screen. This
16060           feature is On by default, and operates only in client/server
16061           mode when ON or 1. If set to 2 or higher, it also operates when
16062           the CD command is given at the IKSD> prompt. Synonym: --cdmsg.
16063
16064    --cdfile:filename
16065           When cdmessage is on, this is the name of the "read me" file to
16066           be sent. Normally you would specify a relative (not absolute)
16067           name, since the file is opened using the literal name you
16068           specified, after changing to the new directory. Example:
16069
16070   --cdfile:READ.ME
16071
16072           You can also give a list of up to 8 filenames by (a) enclosing
16073           each filename in braces, and (b) enclosing the entire list in
16074           braces. Example:
16075           --cdfile:{{./.readme}{READ.ME}{aaareadme.txt}{README}{read-this-
16076           first}} When a list is given, it is searched from left to right
16077           and the first file found is displayed. The default list for UNIX
16078           is:
16079
16080   {{./.readme}{README.TXT}{READ.ME}}
16081
16082   9.1. Command Line Personalities
16083
16084    Beginning in version 7.0, if the C-Kermit binary is renamed to "telnet"
16085    (or TELNET.EXE, telnet.pr, etc, depending on the platform), it accepts
16086    the Telnet command line:
16087
16088   telnet [ host [ port ] ]
16089
16090    In Unix, you can achieve the same effect with a symlink:
16091
16092   cd /usr/bin
16093   mv telnet oldtelnet
16094   ln -ls /usr/local/bin/kermit telnet
16095
16096    When installed in this manner, C-Kermit always reads its initialization
16097    file. If no host (and therefore no port) is given, C-Kermit starts in
16098    interactive prompting mode. If a host is given as the first
16099    command-line argument, C-Kermit makes a connection to it. The host
16100    argument can be an IP host name or address, or the name of a TCP/IP
16101    entry in your C-Kermit network directory.
16102
16103    If a port is given, it is used. If a port is not given, then if the
16104    hostname was found in your network directory and port was also listed
16105    there, then that port is used. Otherwise port 23 (the Telnet port) is
16106    used.
16107
16108    When C-Kermit is called "telnet" and it is invoked with a hostname on
16109    the command line, it exits automatically when the connection is closed.
16110    While the connection is open, however, you may escape back and forth as
16111    many times as you like, transfer files, etc.
16112
16113    An rlogin personality is also available, but it is less useful, at
16114    least in UNIX and VMS, where the Rlogin TCP port is privileged.
16115
16116    The new variable \v(name) indicates the name with which C-Kermit was
16117    invoked ("kermit", "wermit", "k95", "telnet", etc).
16118
16119   9.2. Built-in Help for Command Line Options
16120
16121    "kermit -h", given from the system prompt, lists as many command-line
16122    options as will fit on a standard 24x80 screen. For more comprehensive
16123    help, use the interactive HELP OPTIONS command that was added in
16124    C-Kermit 7.0:
16125
16126    HELP OPTIONS
16127    Explains how command-line options work, their syntax, etc.
16128
16129    HELP OPTIONS ALL
16130    Lists all command-line options and gives brief help about each one.
16131
16132    HELP OPTION x
16133    Gives brief help about option "x".
16134
16135    HELP EXTENDED-OPTIONS
16136    Lists the available extended-format command-line options.
16137
16138    HELP EXTENDED-OPTION xxx
16139    Gives help for the specified extended option.
16140
16141   9.3. New Command-Line Options
16142
16143    Command-line options added since C-Kermit 6.0 are:
16144
16145    +
16146           (plus sign by itself): The next argument is the name of a script
16147           to execute; all subsequent arguments are ignored by C-Kermit
16148           itself, but passed to the script as top-level copies of \%1,
16149           \%2, etc; the \&_[] is also set accordingly. \%0 and \&_[0]
16150           become the name of the script file, rather than the pathname of
16151           the C-Kermit program, which is its normal value. Primarily for
16152           use in the top line of "Kerbang" scripts in UNIX (see
16153           [639]Section 7.19). Example from UNIX command line:
16154
16155   $ kermit [ regular kermit args ] + filename
16156
16157           Sample first line of Kerbang script:
16158
16159   #!/usr/local/bin/kermit +
16160
16161    --
16162           (two hyphens surrounded by whitespace) Equivalent to "=", for
16163           compatibility with UNIX getopt(1,3).
16164
16165    -G
16166           GET (like -g), but send the incoming file to standard output.
16167           Example: "kermit -G oofa.txt | lpr" retrieves a file from your
16168           local computer (providing it is running a Kermit program that
16169           supports the autodownload feature and has it enabled) and prints
16170           it.
16171
16172    -O
16173           equivalent to -x (start up in server mode), but exits after the
16174           first client command has been executed (mnemonic: O = Only One).
16175           This one is handy replacing "kermit -x" in the "automatically
16176           start Kermit on the other end" string:
16177
16178   set protocol kermit {kermit -ir} {kermit -r} {kermit -x}
16179
16180           since -x leaves the remote Kermit in server mode after the
16181           transfer, which can be confusing, whereas -O makes it go away
16182           automatically after the transfer.
16183
16184    -L
16185           Recursive, when used in combination with -s (mnemonic: L =
16186           Levels). In UNIX or other environments where the shell expands
16187           wildcards itself, the -s argument, if it contains wildcards,
16188           must be quoted to prevent this, e.g.:
16189
16190   kermit -L -s "*.c"
16191
16192           In UNIX only, "kermit -L -s ." means to send the current
16193           directory tree. See [640]Sections 4.10 and [641]4.11 about
16194           recursive file transfer.
16195
16196    -V
16197           Equivalent to SET FILE PATTERNS OFF ([642]Section 4.3) and SET
16198           TRANSFER MODE MANUAL. In other words, take the FILE TYPE setting
16199           literally. For example, "kermit -VT oofa.bin" means send the
16200           file in Text mode, no matter what its name is and no matter
16201           whether a kindred spirit is recognized at the other end of the
16202           connection.
16203
16204    -0
16205           (digit zero) means "be 100% transparent in CONNECT mode". This
16206           is equivalent to the following series of commands: SET PARITY
16207           NONE, SET COMMAND BYTESIZE 8, SET TERMINAL BYTESIZE 8, SET FLOW
16208           NONE, SET TERM ESCAPE DISABLED, SET TERM CHAR TRANSPARENT, SET
16209           TERM AUTODOWNLOAD OFF, SET TERM APC OFF, SET TELOPT KERMIT
16210           REFUSE REFUSE.
16211
16212   10. C-KERMIT AND G-KERMIT
16213
16214    Every multifunctioned and long-lived software program grows in
16215    complexity and size over time to meet the needs and requests of its
16216    users and the demands of the underlying technology as it changes.
16217
16218    Eventually users begin to notice how big the application has grown, how
16219    much disk space it occupies, how long it takes to load, and they start
16220    to long for the good old days when it was lean and mean. Not long after
16221    that they begin asking for a "light" version that only does the basics
16222    with no frills.
16223
16224    And so it is with C-Kermit. A "light" version of Kermit was released
16225    (for UNIX only) in December 1999 under the GNU General Public License;
16226    thus it is called G-Kermit (for GNU Kermit). All it does is send and
16227    receive files, period. You can find it at:
16228
16229   [643]http://www.columbia.edu/kermit/gkermit.html
16230
16231    Where the C-Kermit 7.0 binary might be anywhere from 1 to 3 million
16232    bytes in size, the G-Kermit binary ranges from 30K to 100K, depending
16233    on the underlying architecture (RISC vs CISC, etc).
16234
16235    G-Kermit and C-Kermit may reside side-by-side on the same computer.
16236    G-Kermit does not make connections; it does not have a script language;
16237    it does not translate character sets. G-Kermit may be used instead of
16238    C-Kermit when:
16239
16240      * It is on the remote end.
16241      * Files are to be transferred in binary mode or in text mode without
16242        character-set translation.
16243      * File timestamps don't need to be preserved.
16244
16245    In such cases G-Kermit might be preferred since it generally starts up
16246    faster, and yet transfers files just as fast on most (but not
16247    necessarily all) kinds of connections; for example, it supports
16248    streaming ([644]Section 4.20).
16249
16250    G-Kermit is also handy for bootstrapping. It is easier to load on a new
16251    computer than C-Kermit -- it fits on a floppy diskette with plenty of
16252    room to spare. Thus if you have (say) an old PC running (say) SCO Xenix
16253    and no network connection, you can download the Xenix version of
16254    G-Kermit to (say) a DOS or Windows PC, copy it to diskette, read the
16255    diskette on Xenix with "dosread", and then use G-Kermit to receive
16256    C-Kermit (which does not fit on a diskette). If diskettes aren't an
16257    option, other bootstrapping methods are possible too -- see the
16258    [645]G-Kermit web page for details.
16259
16260 III. APPENDICES
16261
16262   III.1. Character Set Tables
16263
16264     III.1.1. The Hewlett Packard Roman8 Character Set
16265
16266 dec col/row oct hex  description
16267 160  10/00  240  A0  (Undefined)
16268 161  10/01  241  A1  A grave
16269 162  10/02  242  A2  A circumflex
16270 163  10/03  243  A3  E grave
16271 164  10/04  244  A4  E circumflex
16272 165  10/05  245  A5  E diaeresis
16273 166  10/06  246  A6  I circumflex
16274 167  10/07  247  A7  I diaeresis
16275 168  10/08  250  A8  Acute accent
16276 169  10/09  251  A9  Grave accent
16277 170  10/10  252  AA  Circumflex accent
16278 171  10/11  253  AB  Diaeresis
16279 172  10/12  254  AC  Tilde accent
16280 173  10/13  255  AD  U grave
16281 174  10/14  256  AE  U circumflex
16282 175  10/15  257  AF  Lira symbol
16283 176  11/00  260  B0  Top bar (macron)
16284 177  11/01  261  B1  Y acute
16285 178  11/02  262  B2  y acute
16286 179  11/03  263  B3  Degree Sign
16287 180  11/04  264  B4  C cedilla
16288 181  11/05  265  B5  c cedilla
16289 182  11/06  266  B6  N tilde
16290 183  11/07  267  B7  n tilde
16291 184  11/08  270  B8  Inverted exclamation mark
16292 185  11/09  271  B9  Inverted question mark
16293 186  11/10  272  BA  Currency symbol
16294 187  11/11  273  BB  Pound sterling symbol
16295 188  11/12  274  BC  Yen symbol
16296 189  11/13  275  BD  Paragraph
16297 190  11/14  276  BE  Florin (Guilder) symbol
16298 191  11/15  277  BF  Cent symbol
16299 192  12/00  300  C0  a circumflex
16300 193  12/01  301  C1  e circumflex
16301 194  12/02  302  C2  o circumflex
16302 195  12/03  303  C3  u circumflex
16303 196  12/04  304  C4  a acute
16304 197  12/05  305  C5  e acute
16305 198  12/06  306  C6  o acute
16306 199  12/07  307  C7  u acute
16307 200  12/08  310  C8  a grave
16308 201  12/09  311  C9  e grave
16309 202  12/10  312  CA  o grave
16310 203  12/11  313  CB  u grave
16311 204  12/12  314  CC  a diaeresis
16312 205  12/13  315  CD  e diaeresis
16313 206  12/14  316  CE  o diaeresis
16314 207  12/15  317  CF  u diaeresis
16315 208  13/00  320  D0  A ring
16316 209  13/01  321  D1  i circumflex
16317 210  13/02  322  D2  O with stroke
16318 211  13/03  323  D3  AE digraph
16319 212  13/04  324  D4  a ring
16320 213  13/05  325  D5  i acute
16321 214  13/06  326  D6  o with stroke
16322 215  13/07  327  D7  ae digraph
16323 216  13/08  330  D8  A diaeresis
16324 217  13/09  331  D9  i grave
16325 218  13/10  332  DA  O diaeresis
16326 219  13/11  333  DB  U diaeresis
16327 220  13/12  334  DC  E acute
16328 221  13/13  335  DD  i diaeresis
16329 222  13/14  336  DE  German sharp s
16330 223  13/15  337  DF  O circumflex
16331 224  14/00  340  E0  A acute
16332 225  14/01  341  E1  A tilde
16333 226  14/02  342  E2  a tilde
16334 227  14/03  343  E3  Icelandic Eth
16335 228  14/04  344  E4  Icelandic eth
16336 229  14/05  345  E5  I acute
16337 230  14/06  346  E6  I grave
16338 231  14/07  347  E7  O acute
16339 232  14/08  350  E8  O grave
16340 233  14/09  351  E9  O tilde
16341 234  14/10  352  EA  o tilde
16342 235  14/11  353  EB  S caron
16343 236  14/12  354  EC  s caron
16344 237  14/13  355  ED  U acute
16345 238  14/14  356  EE  Y diaeresis
16346 239  14/15  357  EF  y diaeresis
16347 240  15/00  360  F0  Icelandic Thorn
16348 241  15/01  361  F1  Icelandic thorn
16349 242  15/02  362  F2  Middle dot
16350 243  15/03  363  F3  Greek mu
16351 244  15/04  364  F4  Pilcrow sign
16352 245  15/05  365  F5  Fraction 3/4
16353 246  15/06  366  F6  Long dash, horizontal bar
16354 247  15/07  367  F7  Fraction 1/4
16355 248  15/08  370  F8  Fraction 1/2
16356 249  15/09  371  F9  Feminine ordinal
16357 250  15/10  372  FA  Masculine ordinal
16358 251  15/11  373  FB  Left guillemot
16359 252  15/12  374  FC  Solid box
16360 253  15/13  375  FD  Right guillemot
16361 254  15/14  376  FE  Plus or minus sign
16362 255  15/15  377  FF  (Undefined)
16363
16364     III.1.2. Greek Character Sets
16365
16366     III.1.2.1. The ISO 8859-7 Latin / Greek Alphabet = ELOT 928
16367
16368 dec col/row oct hex  description
16369 160  10/00  240  A0  No-break space
16370 161  10/01  241  A1  Left single quotation mark
16371 162  10/02  242  A2  right single quotation mark
16372 163  10/03  243  A3  Pound sign
16373 164  10/04  244  A4  (UNUSED)
16374 165  10/05  245  A5  (UNUSED)
16375 166  10/06  246  A6  Broken bar
16376 167  10/07  247  A7  Paragraph sign
16377 168  10/08  250  A8  Diaeresis (Dialytika)
16378 169  10/09  251  A9  Copyright sign
16379 170  10/10  252  AA  (UNUSED)
16380 171  10/11  253  AB  Left angle quotation
16381 172  10/12  254  AC  Not sign
16382 173  10/13  255  AD  Soft hyphen
16383 174  10/14  256  AE  (UNUSED)
16384 175  10/15  257  AF  Horizontal bar (Parenthetiki pavla)
16385 176  11/00  260  B0  Degree sign
16386 177  11/01  261  B1  Plus-minus sign
16387 178  11/02  262  B2  Superscript two
16388 179  11/03  263  B3  Superscript three
16389 180  11/04  264  B4  Accent (tonos)
16390 181  11/05  265  B5  Diaeresis and accent (Dialytika and Tonos)
16391 182  11/06  266  B6  Alpha with accent
16392 183  11/07  267  B7  Middle dot (Ano Teleia)
16393 184  11/08  270  B8  Epsilon with accent
16394 185  11/09  271  B9  Eta with accent
16395 186  11/10  272  BA  Iota with accent
16396 187  11/11  273  BB  Right angle quotation
16397 188  11/12  274  BC  Omicron with accent
16398 189  11/13  275  BD  One half
16399 190  11/14  276  BE  Upsilon with accent
16400 191  11/15  277  BF  Omega with accent
16401 192  12/00  300  C0  iota with diaeresis and accent
16402 193  12/01  301  C1  Alpha
16403 194  12/02  302  C2  Beta
16404 195  12/03  303  C3  Gamma
16405 196  12/04  304  C4  Delta
16406 197  12/05  305  C5  Epsilon
16407 198  12/06  306  C6  Zeta
16408 199  12/07  307  C7  Eta
16409 200  12/08  310  C8  Theta
16410 201  12/09  311  C9  Iota
16411 202  12/10  312  CA  Kappa
16412 203  12/11  313  CB  Lamda
16413 204  12/12  314  CC  Mu
16414 205  12/13  315  CD  Nu
16415 206  12/14  316  CE  Ksi
16416 207  12/15  317  CF  Omicron
16417 208  13/00  320  D0  Pi
16418 209  13/01  321  D1  Rho
16419 210  13/02  322  D2  (UNUSED)
16420 211  13/03  323  D3  Sigma
16421 212  13/04  324  D4  Tau
16422 213  13/05  325  D5  Upsilon
16423 214  13/06  326  D6  Phi
16424 215  13/07  327  D7  Khi
16425 216  13/08  330  D8  Psi
16426 217  13/09  331  D9  Omega
16427 218  13/10  332  DA  Iota with diaeresis
16428 219  13/11  333  DB  Upsilon with diaeresis
16429 220  13/12  334  DC  alpha with accent
16430 221  13/13  335  DD  epsilon with accent
16431 222  13/14  336  DE  eta with accent
16432 223  13/15  337  DF  iota with accent
16433 224  14/00  340  E0  upsilon with diaeresis and accent
16434 225  14/01  341  E1  alpha
16435 226  14/02  342  E2  beta
16436 227  14/03  343  E3  gamma
16437 228  14/04  344  E4  delta
16438 229  14/05  345  E5  epsilon
16439 230  14/06  346  E6  zeta
16440 231  14/07  347  E7  eta
16441 232  14/08  350  E8  theta
16442 233  14/09  351  E9  iota
16443 234  14/10  352  EA  kappa
16444 235  14/11  353  EB  lamda
16445 236  14/12  354  EC  mu
16446 237  14/13  355  ED  nu
16447 238  14/14  356  EE  ksi
16448 239  14/15  357  EF  omicron
16449 240  15/00  360  F0  pi
16450 241  15/01  361  F1  rho
16451 242  15/02  362  F2  terminal sigma
16452 243  15/03  363  F3  sigma
16453 244  15/04  364  F4  tau
16454 245  15/05  365  F5  upsilon
16455 246  15/06  366  F6  phi
16456 247  15/07  367  F7  khi
16457 248  15/08  370  F8  psi
16458 249  15/09  371  F9  omega
16459 250  15/10  372  FA  iota with diaeresis
16460 251  15/11  373  FB  upsilon with diaeresis
16461 252  15/12  374  FC  omicron with diaeresis
16462 253  15/13  375  FD  upsilon with accent
16463 254  15/14  376  FE  omega with accent
16464 255  15/15  377  FF  (UNUSED)
16465
16466     III.1.2.2. The ELOT 927 Character Set
16467
16468 dec col/row oct hex  description
16469  32  02/00   40  20  SPACE
16470  33  02/01   41  21  EXCLAMATION MARK
16471  34  02/02   42  22  QUOTATION MARK
16472  35  02/03   43  23  NUMBER SIGN
16473  36  02/04   44  24  DOLLAR SIGN
16474  37  02/05   45  25  PERCENT SIGN
16475  38  02/06   46  26  AMPERSAND
16476  39  02/07   47  27  APOSTROPHE
16477  40  02/08   50  28  LEFT PARENTHESIS
16478  41  02/09   51  29  RIGHT PARENTHESIS
16479  42  02/10   52  2A  ASTERISK
16480  43  02/11   53  2B  PLUS SIGN
16481  44  02/12   54  2C  COMMA
16482  45  02/13   55  2D  HYPHEN, MINUS SIGN
16483  46  02/14   56  2E  PERIOD, FULL STOP
16484  47  02/15   57  2F  SOLIDUS, SLASH
16485  48  03/00   60  30  DIGIT ZERO
16486  49  03/01   61  31  DIGIT ONE
16487  50  03/02   62  32  DIGIT TWO
16488  51  03/03   63  33  DIGIT THREE
16489  52  03/04   64  34  DIGIT FOUR
16490  53  03/05   65  35  DIGIT FIVE
16491  54  03/06   66  36  DIGIT SIX
16492  55  03/07   67  37  DIGIT SEVEN
16493  56  03/08   70  38  DIGIT EIGHT
16494  57  03/09   71  39  DIGIT NINE
16495  58  03/10   72  3A  COLON
16496  59  03/11   73  3B  SEMICOLON
16497  60  03/12   74  3C  LESS-THAN SIGN, LEFT ANGLE BRACKET
16498  61  03/13   75  3D  EQUALS SIGN
16499  62  03/14   76  3E  GREATER-THAN SIGN, RIGHT ANGLE BRACKET
16500  63  03/15   77  3F  QUESTION MARK
16501  64  04/00  100  40  COMMERCIAL AT SIGN
16502  65  04/01  101  41  CAPITAL LETTER A
16503  66  04/02  102  42  CAPITAL LETTER B
16504  67  04/03  103  43  CAPITAL LETTER C
16505  68  04/04  104  44  CAPITAL LETTER D
16506  69  04/05  105  45  CAPITAL LETTER E
16507  70  04/06  106  46  CAPITAL LETTER F
16508  71  04/07  107  47  CAPITAL LETTER G
16509  72  04/08  110  48  CAPITAL LETTER H
16510  73  04/09  111  49  CAPITAL LETTER I
16511  74  04/10  112  4A  CAPITAL LETTER J
16512  75  04/11  113  4B  CAPITAL LETTER K
16513  76  04/12  114  4C  CAPITAL LETTER L
16514  77  04/13  115  4D  CAPITAL LETTER M
16515  78  04/14  116  4E  CAPITAL LETTER N
16516  79  04/15  117  4F  CAPITAL LETTER O
16517  80  05/00  120  50  CAPITAL LETTER P
16518  81  05/01  121  51  CAPITAL LETTER Q
16519  82  05/02  122  52  CAPITAL LETTER R
16520  83  05/03  123  53  CAPITAL LETTER S
16521  84  05/04  124  54  CAPITAL LETTER T
16522  85  05/05  125  55  CAPITAL LETTER U
16523  86  05/06  126  56  CAPITAL LETTER V
16524  87  05/07  127  57  CAPITAL LETTER W
16525  88  05/08  130  58  CAPITAL LETTER X
16526  89  05/09  131  59  CAPITAL LETTER Y
16527  90  05/10  132  5A  CAPITAL LETTER Z
16528  91  05/11  133  5B  LEFT SQUARE BRACKET
16529  92  05/12  134  5C  REVERSE SOLIDUS, BACKSLASH
16530  93  05/13  135  5D  RIGHT SQUARE BRACKET
16531  94  05/14  136  5E  CIRCUMFLEX ACCENT
16532  95  05/15  137  5F  UNDERSCORE
16533  96  06/00  140  60  ACCENT GRAVE
16534  97  06/01  141  61  GREEK LETTER ALPHA
16535  98  06/02  142  62  GREEK LETTER BETA
16536  99  06/03  143  63  GREEK LETTER GAMMA
16537 100  06/04  144  64  GREEK LETTER DELTA
16538 101  06/05  145  65  GREEK LETTER EPSILON
16539 102  06/06  146  66  GREEK LETTER ZETA
16540 103  06/07  147  67  GREEK LETTER ETA
16541 104  06/08  150  68  GREEK LETTER THETA
16542 105  06/09  151  69  GREEK LETTER IOTA
16543 106  06/10  152  6A  GREEK LETTER KAPPA
16544 107  06/11  153  6B  GREEK LETTER LAMDA
16545 108  06/12  154  6C  GREEK LETTER MU
16546 109  06/13  155  6D  GREEK LETTER NU
16547 110  06/14  156  6E  GREEK LETTER KSI
16548 111  06/15  157  6F  GREEK LETTER OMICRON
16549 112  07/00  160  70  GREEK LETTER PI
16550 113  07/01  161  71  GREEK LETTER RHO
16551 114  07/02  162  72  GREEK LETTER SIGMA
16552 115  07/03  163  73  GREEK LETTER TAU
16553 116  07/04  164  74  GREEK LETTER UPSILON
16554 117  07/05  165  75  GREEK LETTER FI
16555 118  07/06  166  76  GREEK LETTER XI
16556 119  07/07  167  77  GREEK LETTER PSI
16557 120  07/08  170  78  GREEK LETTER OMEGA
16558 121  07/09  171  79  SPACE
16559 122  07/10  172  7A  SPACE
16560 123  07/11  173  7B  LEFT CURLY BRACKET, LEFT BRACE
16561 124  07/12  174  7C  VERTICAL LINE, VERTICAL BAR
16562 125  07/13  175  7D  RIGHT CURLY BRACKET, RIGHT BRACE
16563 126  07/14  176  7E  TILDE
16564 127  07/15  177  7F  RUBOUT, DELETE
16565
16566     III.1.2.3. PC Code Page 869
16567
16568    (to be filled in...)
16569
16570     III.2. Updated Country Codes
16571
16572    Date: Mon, 7 Apr 1997 23:23:49 EDT
16573    From: Dave Leibold <dleibold@else.net>
16574    Newsgroups: comp.dcom.telecom
16575    Subject: Ex-USSR Country Codes Profile
16576    Organization: TELECOM Digest
16577
16578    Ex-USSR Country Codes Profile
16579    4 April 1997
16580
16581    Below is a summary of the country codes that have formed in the wake of
16582    the USSR dissolution, along with some updated findings and reports.
16583    Additional or corrected information on any of these nations would be
16584    welcome (c/o dleibold@else.net).
16585      * Kyrgyz Republic country code 996 will take effect, at least in
16586        Canada, effective 1 May 1997, according to CRTC Telecom Order
16587        97-464, based on Stentor Tariff Notice 433. There is no indication
16588        whether there will be a permissive dialing period involved or for
16589        how long such a permissive operation would remain.
16590      * Country code 992 was reported as a recent assignment for
16591        Tajikistan, which will be moving from country code 7 at some
16592        unknown time.
16593      * Uzbekistan has its own country code assignment, but I have no
16594        information if this is in service yet or what implementation dates
16595        have been set.
16596      * Kazakstan does not have a known separate country code assignment at
16597        present. It remains in country code 7 for the time being.
16598      * Russia seems destined to keep country code 7.
16599      * Recent news reports speak of some agreements forming between Russia
16600        and Belarus. While there is no outright reunification yet, there is
16601        expected to be much closer ties between the two nations. Whether
16602        this will lead to a reunification of telephone codes remains to be
16603        seen.
16604
16605    In the table, "Effective" means the date at which the country code
16606    began service (which could vary according to the nation). "Mandatory"
16607    means the date at which the country code 7 is invalid for calls to that
16608    nation. There are a number of question marks since exact dates have not
16609    been collected in all cases.
16610
16611 CC  Nation            Effective     Mandatory    Notes
16612
16613 370 Lithuania         1993?         ???          Announced Jan 1993
16614 371 Latvia            1993?         ???
16615 372 Estonia           1 Feb 1993?   March 1993?
16616 373 Moldova           1993?         ???          Announced Jan 1993
16617 374 Armenia           1 May 1995    1 July 1995  Announced Jan 1995 (ITU)
16618 375 Belarus           16 Apr 1995   1997?
16619 380 Ukraine           16 Apr 1995   Oct 1995?
16620 7   Kazakstan         (no known changes)
16621 7   Russia            (presumably not changing)
16622 992 Tajikistan        ???           ???          Announced 1996-7?
16623 993 Turkmenistan      3 Jan 1997    3 Apr 1997   Canada as of 29 Nov 1996
16624 994 Azerbaijan        Sept 1994?    ???          Announced 1992
16625 995 Georgia           1994?         ???          ref: Telecom Digest Oct 1994
16626 996 Kyrgyz Republic   1 May 1997    ???          ref: Stentor Canada/CRTC
16627 998 Uzbekistan        ???           ???          Announced 1996? (ITU)
16628
16629    Details courtesy Toby Nixon, ITU, Stentor (Canada), CRTC (Canada),
16630    TELECOM Digest (including information collected for the country code
16631    listings).
16632
16633 IV. ERRATA & CORRIGENDA
16634
16635    The following errors in [646]Using C-Kermit, Second Edition, first
16636    printing, have been noted.
16637
16638    First, some missing acknowledgements for C-Kermit 6.0: JE Jones of
16639    Microware for help with OS-9, Nigel Roles for his help with Plan 9,
16640    Lucas Hart for help with VMS and Digital UNIX, Igor Kovalenko for his
16641    help with QNX. And later, to Susan Kleinmann for her help with Debian
16642    Linux packaging; Patrick Volkerding for his help with Slackware Linux
16643    packaging; Jim Knoble for his help with Red Hat Linux packaging; and to
16644    dozens of others for sending individual C-Kermit binaries for varied
16645    and diverse platforms.
16646
16647    Thanks to James Spath for both binaries and reporting many of the typos
16648    noted below. Also to Dat Thuc Nguyen for spotting several typos.
16649
16650 PAGE    REMARKS
16651 COVER   "COS" is a misprint.  There is no COS.  Pretend it says "SCO" or "VOS".
16652         (This is fixed in the second printing.)
16653  xxi    Second line: Fred Smith's affiliation should be Computrition.
16654  83     Change "commands other" to "commands as other" (1st paragraph)
16655  87     Change "The the" to "The" (2nd paragraph)
16656  92     "set modem-type user-defined supra" should be "set modem type ..."
16657  95     Change "VI" to "vi" (1st paragraph)
16658  96     Change "it it" to "it is" (1st paragraph)
16659  97     Change "advantage a literal" to "advantage of a literal" (2nd
16660         paragraph)
16661 102     The call-waiting example would be better as SET DIAL PREFIX *70W
16662         (rather than "*70,") because the former will not cause an incorrect
16663         call to be placed with pulse dialing.
16664 123     Third paragraph from bottom: "..otherwise if a your local username.."
16665         should be "..otherwise your local username..".
16666 160     Delete the "it" between "and" and "to" (2nd paragraph)
16667 185     In "When TRANSFER DISPLAY is OFF, C-Kermit skips the display...",
16668         "OFF" should be "NONE".
16669 187     The last paragraph says the "A command" is ignored, should be "S".
16670 194     Change "it known" to "it is known" (4th paragraph).
16671 235     In C-Kermit 7.0, the syntax of the GET command changed.  MGET now
16672         must be used to get a list of files and there is no more multiline
16673         GET command.
16674 268     Last paragraph: "effect" should be "affect".
16675 275     In the SET PROTOCOL KERMIT description, the following sentence is
16676         incorrect and should be removed: 'If you omit the commands, the
16677         default ones are restored: "kermit -ir" and "kermit -r" respectively".
16678         The correct information is given at the bottom of page 281.
16679 279     9th line.  The decimal value of ST is 156, not 155.
16680 295     In the stepping stones, skip ahead to Chapter 17 on p. 327.
16681 298     Table 16-2, Portuguese entry.  Column 4/00 should show section sign,
16682         not acute accent.
16683 316     Other languages written in the Hebrew alphabet include Karaim (a Turkic
16684         language spoken in Lithuania and Poland), Judeo-Kurdish, and Judeo-
16685         Georgian.
16686 332     UNDEFINE definition, change "This just" to "This is just".
16687 344     It might be necessary to set the modem's pulse generation rate when
16688         sending numeric pages; most Hayes compatible modems use the S11
16689         register for this.
16690 350     Delete "is" from between "It" and "ceases" (4th paragraph)
16691 351     Top - both occurrences of "print \%a" should be "echo \%a".
16692 364     \v(input) and \v(query) out of alphabetical order.
16693 378     In the MYSEND macro, "if not \m(rc) goto bad" should be:
16694         "if \m(rc) goto bad" (remove the "not").
16695 382-383 It should be stated that the loop control variable must be of the \%a
16696         type, or else an array element; macro names can not be used for this.
16697 383     In line 3, "\%f[\%i]" should be "\&f[\%i]".
16698 383     In the sort example, it should be stated that the array is 1-based.
16699 387     Change "You can list" to "You can get a list" (5th paragraph)
16700 393     \Fverify() description.  The 3rd sentence could be stated more clearly
16701         as "If all characters in string2 are also in string1, 0 is returned."
16702 398     Copying \ffiles() results to an array before is not required as of
16703         C-Kermit 7.0 (see [647]Section 7.3).
16704 403     In "(\%a + 3) * (\%b  5)", a minus sign is missing between b and 5.
16705 407     C-Kermit 7.0 no longer supports multiline GET.  Change
16706         "get, \%1, \%2" to "get {\%1} {\%2}" or "get /as:{\%2} {\%1}".
16707 409     READ example while loop should be:
16708         while success { echo \m(line), read line }
16709 409     "WRITE file" should be "WRITE keyword" (you can't put a filename there)
16710         (The same applies to WRITE-LINE / WRITELN).
16711 414     \Funhexify() missing from Table 18-3.
16712 425     MINPUT definition, change 2nd "text2" to "text3".
16713 436     Several lines are missing from the UNIXLOGIN macro listing.
16714         After the "xif fail" block, insert:
16715
16716           out \%1\13                    ; Send username, carriage return
16717           inp 5 Password:               ; Wait 5 sec for this prompt
16718           if fail end 1 No password prompt
16719           pause                         ; Wait a sec
16720           out \%2\13                    ; Send password
16721
16722 440     Change "set terminal byteszie" to "set terminal bytesize".
16723         Change "input Password:" to "input 10 Password".
16724 448     Franchise script: "access line" should be "access \m(line)".
16725 453     There are two incorrectly coded IF statements in the DELIVER macro
16726         definition.  Replace both occurrences of "if > \%1 \%3 {" with
16727         "xif > \%i \%3 {" (replace "if" by "xif" and "\%1" with "\%i").
16728 453     "the the" (last paragraph) should be "the".
16729 454     EOT (last paragraph) is End of Transmission, not End of Text.
16730 457     _DEFINE definition: "name constructed" should be "name is constructed".
16731 457     "macro for and" (last paragraph) should be "macro and".
16732 459     Should explain that \v(user) is a legal abbreviation of \v(userid).
16733 480     Figure II-2 is backwards; the least-significant bit is transmitted
16734         first, then up to the highest, and the parity bit last.
16735 534     The VMS Appendix section on Odd Record Lengths no longer applies;
16736         C-Kermit 7.0 handles odd record lengths as well as even ones.
16737 559     Table VIII-3, Portuguese entry.  Column 4/00 should show section sign,
16738         not acute accent.
16739 560-563 HP-Roman8 missing from Table VII-4; there wasn't room to squeeze it in.
16740         It is listed in section II(6).
16741 565     "d stroke" in Table VII-5 has the wrong appearance; the stem should
16742         be upright.  The letter shown in the table is actually a lowercase
16743         Icelandic eth, which has a curved stem.
16744 601-604 BeBox, BeOS, Plan 9, and probably others not listed in trademarks.
16745 604     The words "SCRIBE TEXT FORMATTER" appear at the end of the last
16746         sentence of the first paragraph of the Colophon.  They should have
16747         been in the Index.
16748 Index:  Missing entries: SET { SEND, RECEIVE } PATHNAMES, Call waiting, ...
16749         \F()            Page 605, add also 413-414
16750         \Fbreak         389
16751         \Fcapitalize    390
16752         \Fchecksum      414
16753         \Fcrc16         414
16754         \Fexecute       414
16755         \Fhexify        390
16756         \Fltrim         391
16757         \Frepeat        392
16758         \Fspawn         392
16759         \Ftod2secs      399
16760         \v() built_in   Page 606, add also 361-364
16761         \v(_line)       354, 361
16762         \v(apcactive)   361
16763         \v(charset)     362
16764         \v(cpu)         362
16765         \v(crc16)       357, 362
16766         \v(d$xxx)       add page 362
16767         \v(dialnumber)  362
16768         \v(dialresult)  362
16769         \v(errno)       362
16770         \v(errstring)   362
16771         \v(exedir)      362
16772         \v(inidir)      363
16773         \v(ipaddress)   363
16774         \v(keyboard)    363
16775         \v(macro)       363
16776         \v(minput)      363
16777         \v(m_xxx)       94, 363
16778         \v(password)    364
16779         \v(query)       364
16780         \v(prompt)      364
16781         \v(speed)       356, 364
16782         \v(startup)     364
16783         \v(status)      364
16784         \v(sysid)       364
16785         \v(system)      364
16786         \v(fsize)       at lower half page 606 should read \v(tfsize)
16787         \v(xversion)    364
16788         BEEP Command    40
16789         SET FLOW        62, 212
16790
16791    Figure II-5 on page 493. The pin assignments of the Mini Din-8
16792    connector are not described anywhere. As noted in the text, these tend
16793    to vary from vendor to vendor. One common arrangement is:
16794
16795   1. HSKout (Handshake out -- definition depends on software)
16796   2. HSKin  (Handshake in or external clock)
16797   3. TxD-
16798   4. Not used
16799   5. RxD-
16800   6. TxD+
16801   7. Not used
16802   8. RxD+
16803
16804    Note the "balanced pairs" for Receive Data (RxD) and Transmit Data
16805    (TxD), and the utter lack of modem signals. These connectors follow the
16806    RS-423 standard, rather than RS-232. In some arrangements, Pin 1 is
16807    used for DTR and Pin 2 for CD; in others Pin 1 is RTS and Pin 2 is CTS.
16808
16809    Please send reports of other errors to the authors, as well as
16810    suggestions for improvements, additional index entries, and any other
16811    comments:
16812
16813    [648]kermit@columbia.edu
16814
16815 APPENDIX V. ADDITIONAL COPYRIGHT NOTICES
16816
16817    The following copyrights cover some of the source code used in the
16818    development of C-Kermit, Kermit 95, or Kermit 95 support libraries.
16819
16820 /*****************************************************************************/
16821 /*                                                                           */
16822 /*              Copyright (c) 1995 by Oy Online Solutions Ltd.               */
16823 /*                                                                           */
16824 /*   Distribution of this source code is strictly forbbidden. Use of this    */
16825 /*   source code is granted to the University of Columbia C-Kermit project   */
16826 /*   to be distributed in binary format only. Please familiarize yourself    */
16827 /*   with the accompanying LICENSE.P file.                                   */
16828 /*                                                                           */
16829 /*****************************************************************************/
16830
16831    used for Xmodem, Ymodem, and Zmodem protocol in Kermit 95 (p95.dll,
16832    p2.dll)
16833
16834    Copyright (c) 1997 Stanford University
16835
16836    The use of this software for revenue-generating purposes may require a
16837    license from the owners of the underlying intellectual property.
16838    Specifically, the SRP-3 protocol may not be used for revenue-generating
16839    purposes without a license.
16840
16841    Within that constraint, permission to use, copy, modify, and distribute
16842    this software and its documentation for any purpose is hereby granted
16843    without fee, provided that the above copyright notices and this
16844    permission notice appear in all copies of the software and related
16845    documentation.
16846
16847    THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16848    EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16849    WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16850
16851    IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
16852    INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
16853    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
16854    ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
16855    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
16856    SOFTWARE.
16857
16858    Used for Secure Remote Password (TM) protocol (SRP) in C-Kermit, Kermit
16859    95 (k95.exe, k2.exe, k95crypt.dll, k2crypt.dll)
16860
16861    Copyright 1990 by the Massachusetts Institute of Technology. All Rights
16862    Reserved.
16863
16864    Export of this software from the United States of America may require a
16865    specific license from the United States Government. It is the
16866    responsibility of any person or organization contemplating export to
16867    obtain such a license before exporting.
16868
16869    WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute
16870    this software and its documentation for any purpose and without fee is
16871    hereby granted, provided that the above copyright notice appear in all
16872    copies and that both that copyright notice and this permission notice
16873    appear in supporting documentation, and that the name of M.I.T. not be
16874    used in advertising or publicity pertaining to distribution of the
16875    software without specific, written prior permission. M.I.T. makes no
16876    representations about the suitability of this software for any purpose.
16877    It is provided "as is" without express or implied warranty.
16878
16879    Used for Telnet Authentication Option, Telnet Encryption Option, and
16880    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
16881    k95crypt.dll, k2crypt.dll)
16882
16883    Copyright (c) 1991, 1993 The Regents of the University of California.
16884    All rights reserved.
16885
16886    Redistribution and use in source and binary forms, with or without
16887    modification, are permitted provided that the following conditions are
16888    met:
16889     1. Redistributions of source code must retain the above copyright
16890        notice, this list of conditions and the following disclaimer.
16891     2. Redistributions in binary form must reproduce the above copyright
16892        notice, this list of conditions and the following disclaimer in the
16893        documentation and/or other materials provided with the
16894        distribution.
16895     3. All advertising materials mentioning features or use of this
16896        software must display the following acknowledgement:
16897
16898      This product includes software developed by the University of
16899      California, Berkeley and its contributors.
16900     4. Neither the name of the University nor the names of its
16901        contributors may be used to endorse or promote products derived
16902        from this software without specific prior written permission.
16903
16904    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
16905    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16906    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16907    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
16908    BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
16909    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
16910    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
16911    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
16912    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
16913    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
16914    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16915
16916    Used for Telnet Authentication Option, Telnet Encryption Option, and
16917    Kerberos (TM) authentication in C-Kermit, Kermit 95 (k95.exe, k2.exe,
16918    k95crypt.dll, k2crypt.dll)
16919
16920    Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) All rights
16921    reserved.
16922
16923    This package is an DES implementation written by Eric Young
16924    (eay@cryptsoft.com). The implementation was written so as to conform
16925    with MIT's libdes.
16926
16927    This library is free for commercial and non-commercial use as long as
16928    the following conditions are aheared to. The following conditions apply
16929    to all code found in this distribution.
16930
16931    Copyright remains Eric Young's, and as such any Copyright notices in
16932    the code are not to be removed. If this package is used in a product,
16933    Eric Young should be given attribution as the author of that the SSL
16934    library. This can be in the form of a textual message at program
16935    startup or in documentation (online or textual) provided with the
16936    package.
16937
16938    Redistribution and use in source and binary forms, with or without
16939    modification, are permitted provided that the following conditions are
16940    met:
16941     1. Redistributions of source code must retain the copyright notice,
16942        this list of conditions and the following disclaimer.
16943     2. Redistributions in binary form must reproduce the above copyright
16944        notice, this list of conditions and the following disclaimer in the
16945        documentation and/or other materials provided with the
16946        distribution.
16947     3. All advertising materials mentioning features or use of this
16948        software must display the following acknowledgement: This product
16949        includes software developed by Eric Young (eay@cryptsoft.com)
16950
16951    THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR
16952    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16953    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16954    DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
16955    ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
16956    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
16957    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
16958    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
16959    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
16960    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
16961    POSSIBILITY OF SUCH DAMAGE.
16962
16963    The license and distribution terms for any publically available version
16964    or derivative of this code cannot be changed. i.e. this code cannot
16965    simply be copied and put under another distrubution license [including
16966    the GNU Public License.]
16967
16968    The reason behind this being stated in this direct manner is past
16969    experience in code simply being copied and the attribution removed from
16970    it and then being distributed as part of other packages. This
16971    implementation was a non-trivial and unpaid effort.
16972
16973    Used DES encryption in Kermit 95 (k95crypt.dll, k2crypt.dll)
16974      __________________________________________________________________
16975
16976  * This is version 1.1 of CryptoLib
16977  *
16978  * The authors of this software are Jack Lacy, Don Mitchell and Matt Blaze
16979  *              Copyright (c) 1991, 1992, 1993, 1994, 1995 by AT&T.
16980  * Permission to use, copy, and modify this software without fee
16981  * is hereby granted, provided that this entire notice is included in
16982  * all copies of any software which is or includes a copy or
16983  * modification of this software and in all copies of the supporting
16984  * documentation for such software.
16985  *
16986  * NOTE:
16987  * Some of the algorithms in cryptolib may be covered by patents.
16988  * It is the responsibility of the user to ensure that any required
16989  * licenses are obtained.
16990  *
16991  *
16992  * SOME PARTS OF CRYPTOLIB MAY BE RESTRICTED UNDER UNITED STATES EXPORT
16993  * REGULATIONS.
16994  *
16995  *
16996  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
16997  * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
16998  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
16999  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
17000
17001    Used for Big Number library in Kermit 95 (k95crypt.dll, k2crypt.dll).
17002
17003    [ [649]Top ] [ [650]C-Kermit ] [ [651]Kermit Home ]
17004      __________________________________________________________________
17005      __________________________________________________________________
17006
17007    CKERMIT70.HTM / The Kermit Project / Columbia University / 8 Feb 2000
17008
17009 References
17010
17011    1. http://www.columbia.edu/
17012    2. mailto:kermit@columbia.edu
17013    3. http://www.columbia.edu/kermit/index.html
17014    4. http://www.columbia.edu/kermit/k95.html
17015    5. http://www.columbia.edu/kermit/ckermit.html
17016    6. http://www.columbia.edu/kermit/ckscripts.html
17017    7. http://www.columbia.edu/kermit/current.html
17018    8. http://www.columbia.edu/kermit/whatsnew.html
17019    9. http://www.columbia.edu/kermit/faq.html
17020   10. http://www.columbia.edu/kermit/support.html
17021   11. http://www.amazon.com/gp/product/1555581641?ie=UTF8&tag=aleidmoreldom-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1555581641
17022   12. mailto:kermit-support@columbia.edu
17023   13. http://www.columbia.edu/kermit/
17024   14. http://www.kermit-project.org/
17025   15. http://www.columbia.nyc.ny.us/kermit/
17026   16. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
17027   17. ftp://kermit.columbia.edu/kermit/f/ckcmai.c
17028   18. http://www.columbia.edu/kermit/ckermit70.html#xv
17029   19. http://www.columbia.edu/kermit/ckb2.htm
17030   20. ftp://kermit.columbia.edu/kermit/f/ckcbwr.txt
17031   21. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17032   22. ftp://kermit.columbia.edu/kermit/f/ckvbwr.txt
17033   23. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17034   24. ftp://kermit.columbia.edu/kermit/f/ckermit70.txt
17035   25. ftp://kermit.columbia.edu/kermit/f/security.txt
17036   26. http://www.columbia.edu/kermit/security.htm
17037   27. ftp://kermit.columbia.edu/kermit/f/iksd.txt
17038   28. http://www.columbia.edu/kermit/iksd.htm
17039   29. http://www.columbia.edu/kermit/cuiksd.htm
17040   30. ftp://kermit.columbia.edu/kermit/f/telnet.txt
17041   31. http://www.columbia.edu/kermit/telnet.htm
17042   32. ftp://kermit.columbia.edu/kermit/f/COPYING.TXT
17043   33. http://www.columbia.edu/kermit/k95.html
17044   34. http://www.opensource.org/
17045   35. http://www.columbia.edu/kermit/ckb2.htm
17046   36. http://www.columbia.edu/kermit/ckermit70.html#xi
17047   37. http://www.columbia.edu/kermit/ckermit70.html#xii
17048   38. http://www.columbia.edu/kermit/ckermit70.html#x0
17049   39. http://www.columbia.edu/kermit/ckermit70.html#x1
17050   40. http://www.columbia.edu/kermit/ckermit70.html#x1.0
17051   41. http://www.columbia.edu/kermit/ckermit70.html#x1.1
17052   42. http://www.columbia.edu/kermit/ckermit70.html#x1.2
17053   43. http://www.columbia.edu/kermit/ckermit70.html#x1.3
17054   44. http://www.columbia.edu/kermit/ckermit70.html#x1.4
17055   45. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17056   46. http://www.columbia.edu/kermit/ckermit70.html#x1.5.1
17057   47. http://www.columbia.edu/kermit/ckermit70.html#x1.5.2
17058   48. http://www.columbia.edu/kermit/ckermit70.html#x1.5.3
17059   49. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17060   50. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
17061   51. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17062   52. http://www.columbia.edu/kermit/ckermit70.html#x1.7
17063   53. http://www.columbia.edu/kermit/ckermit70.html#x1.8
17064   54. http://www.columbia.edu/kermit/ckermit70.html#x1.9
17065   55. http://www.columbia.edu/kermit/ckermit70.html#x1.10
17066   56. http://www.columbia.edu/kermit/ckermit70.html#x1.11
17067   57. http://www.columbia.edu/kermit/ckermit70.html#x1.11.1
17068   58. http://www.columbia.edu/kermit/ckermit70.html#x1.11.2
17069   59. http://www.columbia.edu/kermit/ckermit70.html#x1.11.3
17070   60. http://www.columbia.edu/kermit/ckermit70.html#x1.11.4
17071   61. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
17072   62. http://www.columbia.edu/kermit/ckermit70.html#x1.11.6
17073   63. http://www.columbia.edu/kermit/ckermit70.html#x1.11.7
17074   64. http://www.columbia.edu/kermit/ckermit70.html#x1.12
17075   65. http://www.columbia.edu/kermit/ckermit70.html#x1.13
17076   66. http://www.columbia.edu/kermit/ckermit70.html#x1.14
17077   67. http://www.columbia.edu/kermit/ckermit70.html#x1.15
17078   68. http://www.columbia.edu/kermit/ckermit70.html#x1.16
17079   69. http://www.columbia.edu/kermit/ckermit70.html#x1.17
17080   70. http://www.columbia.edu/kermit/ckermit70.html#x1.18
17081   71. http://www.columbia.edu/kermit/ckermit70.html#x1.19
17082   72. http://www.columbia.edu/kermit/ckermit70.html#x1.20
17083   73. http://www.columbia.edu/kermit/ckermit70.html#x1.21
17084   74. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17085   75. http://www.columbia.edu/kermit/ckermit70.html#x1.22.1
17086   76. http://www.columbia.edu/kermit/ckermit70.html#x1.22.2
17087   77. http://www.columbia.edu/kermit/ckermit70.html#x1.22.3
17088   78. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
17089   79. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
17090   80. http://www.columbia.edu/kermit/ckermit70.html#x1.22.6
17091   81. http://www.columbia.edu/kermit/ckermit70.html#x1.22.7
17092   82. http://www.columbia.edu/kermit/ckermit70.html#x1.22.8
17093   83. http://www.columbia.edu/kermit/ckermit70.html#x1.23
17094   84. http://www.columbia.edu/kermit/ckermit70.html#x1.24
17095   85. http://www.columbia.edu/kermit/ckermit70.html#x2
17096   86. http://www.columbia.edu/kermit/ckermit70.html#x2.0
17097   87. http://www.columbia.edu/kermit/ckermit70.html#x2.1
17098   88. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
17099   89. http://www.columbia.edu/kermit/ckermit70.html#x2.1.2
17100   90. http://www.columbia.edu/kermit/ckermit70.html#x2.1.3
17101   91. http://www.columbia.edu/kermit/ckermit70.html#x2.1.4
17102   92. http://www.columbia.edu/kermit/ckermit70.html#x2.1.5
17103   93. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
17104   94. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
17105   95. http://www.columbia.edu/kermit/ckermit70.html#x2.1.8
17106   96. http://www.columbia.edu/kermit/ckermit70.html#x2.1.9
17107   97. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
17108   98. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
17109   99. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
17110  100. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
17111  101. http://www.columbia.edu/kermit/ckermit70.html#x2.1.14
17112  102. http://www.columbia.edu/kermit/ckermit70.html#x2.1.15
17113  103. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
17114  104. http://www.columbia.edu/kermit/ckermit70.html#x2.2
17115  105. http://www.columbia.edu/kermit/ckermit70.html#x2.2.1
17116  106. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
17117  107. http://www.columbia.edu/kermit/ckermit70.html#x2.3
17118  108. http://www.columbia.edu/kermit/ckermit70.html#x2.3.0
17119  109. http://www.columbia.edu/kermit/ckermit70.html#x2.3.1
17120  110. http://www.columbia.edu/kermit/ckermit70.html#x2.3.2
17121  111. http://www.columbia.edu/kermit/ckermit70.html#x2.3.3
17122  112. http://www.columbia.edu/kermit/ckermit70.html#x2.3.4
17123  113. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
17124  114. http://www.columbia.edu/kermit/ckermit70.html#x2.3.6
17125  115. http://www.columbia.edu/kermit/ckermit70.html#x2.4
17126  116. http://www.columbia.edu/kermit/ckermit70.html#x2.5
17127  117. http://www.columbia.edu/kermit/ckermit70.html#x2.6
17128  118. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17129  119. http://www.columbia.edu/kermit/ckermit70.html#x2.7.0
17130  120. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1
17131  121. http://www.columbia.edu/kermit/ckermit70.html#x2.7.2
17132  122. http://www.columbia.edu/kermit/ckermit70.html#x2.7.3
17133  123. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4
17134  124. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.1
17135  125. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.2
17136  126. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.3
17137  127. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.4
17138  128. http://www.columbia.edu/kermit/ckermit70.html#x2.7.4.5
17139  129. http://www.columbia.edu/kermit/ckermit70.html#x2.8
17140  130. http://www.columbia.edu/kermit/ckermit70.html#x2.9
17141  131. http://www.columbia.edu/kermit/ckermit70.html#x2.9.1
17142  132. http://www.columbia.edu/kermit/ckermit70.html#x2.9.2
17143  133. http://www.columbia.edu/kermit/ckermit70.html#x2.10
17144  134. http://www.columbia.edu/kermit/ckermit70.html#x2.11
17145  135. http://www.columbia.edu/kermit/ckermit70.html#x2.12
17146  136. http://www.columbia.edu/kermit/ckermit70.html#x2.13
17147  137. http://www.columbia.edu/kermit/ckermit70.html#x2.14
17148  138. http://www.columbia.edu/kermit/ckermit70.html#x2.15
17149  139. http://www.columbia.edu/kermit/ckermit70.html#x3
17150  140. http://www.columbia.edu/kermit/ckermit70.html#x3.1
17151  141. http://www.columbia.edu/kermit/ckermit70.html#x3.2
17152  142. http://www.columbia.edu/kermit/ckermit70.html#x3.3
17153  143. http://www.columbia.edu/kermit/ckermit70.html#x3.4
17154  144. http://www.columbia.edu/kermit/ckermit70.html#x4
17155  145. http://www.columbia.edu/kermit/ckermit70.html#x4.0
17156  146. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17157  147. http://www.columbia.edu/kermit/ckermit70.html#x4.1.1
17158  148. http://www.columbia.edu/kermit/ckermit70.html#x4.1.2
17159  149. http://www.columbia.edu/kermit/ckermit70.html#x4.1.3
17160  150. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17161  151. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1
17162  152. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.1
17163  153. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.2
17164  154. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
17165  155. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17166  156. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.1
17167  157. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2.2
17168  158. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
17169  159. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.1
17170  160. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3.2
17171  161. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
17172  162. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
17173  163. http://www.columbia.edu/kermit/ckermit70.html#x4.2.6
17174  164. http://www.columbia.edu/kermit/ckermit70.html#x4.2.7
17175  165. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8
17176  166. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
17177  167. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
17178  168. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.3
17179  169. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
17180  170. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17181  171. http://www.columbia.edu/kermit/ckermit70.html#x4.3.1
17182  172. http://www.columbia.edu/kermit/ckermit70.html#x4.3.2
17183  173. http://www.columbia.edu/kermit/ckermit70.html#x4.3.3
17184  174. http://www.columbia.edu/kermit/ckermit70.html#x4.3.4
17185  175. http://www.columbia.edu/kermit/ckermit70.html#x4.4
17186  176. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1
17187  177. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.1
17188  178. http://www.columbia.edu/kermit/ckermit70.html#x4.4.1.2
17189  179. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2
17190  180. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1
17191  181. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.1
17192  182. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.1.2
17193  183. http://www.columbia.edu/kermit/ckermit70.html#x4.4.2.2
17194  184. http://www.columbia.edu/kermit/ckermit70.html#x4.5
17195  185. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17196  186. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
17197  187. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.1
17198  188. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2.2
17199  189. http://www.columbia.edu/kermit/ckermit70.html#x4.5.3
17200  190. http://www.columbia.edu/kermit/ckermit70.html#x4.5.4
17201  191. http://www.columbia.edu/kermit/ckermit70.html#x4.6
17202  192. http://www.columbia.edu/kermit/ckermit70.html#x4.7
17203  193. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17204  194. http://www.columbia.edu/kermit/ckermit70.html#x4.7.2
17205  195. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
17206  196. http://www.columbia.edu/kermit/ckermit70.html#x4.8
17207  197. http://www.columbia.edu/kermit/ckermit70.html#x4.8.1
17208  198. http://www.columbia.edu/kermit/ckermit70.html#x4.8.2
17209  199. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17210  200. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17211  201. http://www.columbia.edu/kermit/ckermit70.html#x4.9.2
17212  202. http://www.columbia.edu/kermit/ckermit70.html#x4.9.3
17213  203. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17214  204. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17215  205. http://www.columbia.edu/kermit/ckermit70.html#x4.11.1
17216  206. http://www.columbia.edu/kermit/ckermit70.html#x4.11.2
17217  207. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17218  208. http://www.columbia.edu/kermit/ckermit70.html#x4.11.4
17219  209. http://www.columbia.edu/kermit/ckermit70.html#x4.11.5
17220  210. http://www.columbia.edu/kermit/ckermit70.html#x4.11.6
17221  211. http://www.columbia.edu/kermit/ckermit70.html#x4.12
17222  212. http://www.columbia.edu/kermit/ckermit70.html#x4.13
17223  213. http://www.columbia.edu/kermit/ckermit70.html#x4.14
17224  214. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17225  215. http://www.columbia.edu/kermit/ckermit70.html#x4.16
17226  216. http://www.columbia.edu/kermit/ckermit70.html#x4.17
17227  217. http://www.columbia.edu/kermit/ckermit70.html#x4.17.1
17228  218. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
17229  219. http://www.columbia.edu/kermit/ckermit70.html#x4.18
17230  220. http://www.columbia.edu/kermit/ckermit70.html#x4.19
17231  221. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17232  222. http://www.columbia.edu/kermit/ckermit70.html#x4.20.1
17233  223. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2
17234  224. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.1
17235  225. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.2
17236  226. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
17237  227. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.4
17238  228. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.5
17239  229. http://www.columbia.edu/kermit/ckermit70.html#x4.20.3
17240  230. http://www.columbia.edu/kermit/ckermit70.html#x4.21
17241  231. http://www.columbia.edu/kermit/ckermit70.html#x4.22
17242  232. http://www.columbia.edu/kermit/ckermit70.html#x4.22.1
17243  233. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
17244  234. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
17245  235. http://www.columbia.edu/kermit/ckermit70.html#x4.22.4
17246  236. http://www.columbia.edu/kermit/ckermit70.html#x4.22.5
17247  237. http://www.columbia.edu/kermit/ckermit70.html#x4.22.6
17248  238. http://www.columbia.edu/kermit/ckermit70.html#x4.22.7
17249  239. http://www.columbia.edu/kermit/ckermit70.html#x4.22.8
17250  240. http://www.columbia.edu/kermit/ckermit70.html#x4.23
17251  241. http://www.columbia.edu/kermit/ckermit70.html#x4.24
17252  242. http://www.columbia.edu/kermit/ckermit70.html#x4.25
17253  243. http://www.columbia.edu/kermit/ckermit70.html#x5
17254  244. http://www.columbia.edu/kermit/ckermit70.html#x5.0
17255  245. http://www.columbia.edu/kermit/ckermit70.html#x5.1
17256  246. http://www.columbia.edu/kermit/ckermit70.html#x5.2
17257  247. http://www.columbia.edu/kermit/ckermit70.html#x5.3
17258  248. http://www.columbia.edu/kermit/ckermit70.html#x5.3.1
17259  249. http://www.columbia.edu/kermit/ckermit70.html#x5.3.2
17260  250. http://www.columbia.edu/kermit/ckermit70.html#x5.4
17261  251. http://www.columbia.edu/kermit/ckermit70.html#x5.5
17262  252. http://www.columbia.edu/kermit/ckermit70.html#x5.6
17263  253. http://www.columbia.edu/kermit/ckermit70.html#x5.7
17264  254. http://www.columbia.edu/kermit/ckermit70.html#x6
17265  255. http://www.columbia.edu/kermit/ckermit70.html#x6.0
17266  256. http://www.columbia.edu/kermit/ckermit70.html#x6.1
17267  257. http://www.columbia.edu/kermit/ckermit70.html#x6.2
17268  258. http://www.columbia.edu/kermit/ckermit70.html#x6.3
17269  259. http://www.columbia.edu/kermit/ckermit70.html#x6.4
17270  260. http://www.columbia.edu/kermit/ckermit70.html#x6.5
17271  261. http://www.columbia.edu/kermit/ckermit70.html#x6.6
17272  262. http://www.columbia.edu/kermit/ckermit70.html#x6.6.1
17273  263. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17274  264. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17275  265. http://www.columbia.edu/kermit/ckermit70.html#x6.6.3
17276  266. http://www.columbia.edu/kermit/ckermit70.html#x6.6.4
17277  267. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
17278  268. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
17279  269. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.2
17280  270. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.3
17281  271. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
17282  272. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.5
17283  273. http://www.columbia.edu/kermit/ckermit70.html#x6.7
17284  274. http://www.columbia.edu/kermit/ckermit70.html#x7
17285  275. http://www.columbia.edu/kermit/ckermit70.html#x7.0
17286  276. http://www.columbia.edu/kermit/ckermit70.html#x7.1
17287  277. http://www.columbia.edu/kermit/ckermit70.html#x7.1.1
17288  278. http://www.columbia.edu/kermit/ckermit70.html#x7.1.2
17289  279. http://www.columbia.edu/kermit/ckermit70.html#x7.1.3
17290  280. http://www.columbia.edu/kermit/ckermit70.html#x7.1.4
17291  281. http://www.columbia.edu/kermit/ckermit70.html#x7.2
17292  282. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17293  283. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17294  284. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17295  285. http://www.columbia.edu/kermit/ckermit70.html#x7.6
17296  286. http://www.columbia.edu/kermit/ckermit70.html#x7.7
17297  287. http://www.columbia.edu/kermit/ckermit70.html#x7.8
17298  288. http://www.columbia.edu/kermit/ckermit70.html#x7.9
17299  289. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
17300  290. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
17301  291. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17302  292. http://www.columbia.edu/kermit/ckermit70.html#x7.10.1
17303  293. http://www.columbia.edu/kermit/ckermit70.html#x7.10.2
17304  294. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
17305  295. http://www.columbia.edu/kermit/ckermit70.html#x7.10.4
17306  296. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17307  297. http://www.columbia.edu/kermit/ckermit70.html#x7.10.6
17308  298. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17309  299. http://www.columbia.edu/kermit/ckermit70.html#x7.10.8
17310  300. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
17311  301. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
17312  302. http://www.columbia.edu/kermit/ckermit70.html#x7.11
17313  303. http://www.columbia.edu/kermit/ckermit70.html#x7.12
17314  304. http://www.columbia.edu/kermit/ckermit70.html#x7.13
17315  305. http://www.columbia.edu/kermit/ckermit70.html#x7.14
17316  306. http://www.columbia.edu/kermit/ckermit70.html#x7.15
17317  307. http://www.columbia.edu/kermit/ckermit70.html#x7.16
17318  308. http://www.columbia.edu/kermit/ckermit70.html#x7.17
17319  309. http://www.columbia.edu/kermit/ckermit70.html#x7.18
17320  310. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17321  311. http://www.columbia.edu/kermit/ckermit70.html#x7.20
17322  312. http://www.columbia.edu/kermit/ckermit70.html#x7.20.1
17323  313. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
17324  314. http://www.columbia.edu/kermit/ckermit70.html#x7.21
17325  315. http://www.columbia.edu/kermit/ckermit70.html#x7.22
17326  316. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17327  317. http://www.columbia.edu/kermit/ckermit70.html#x7.24
17328  318. http://www.columbia.edu/kermit/ckermit70.html#x7.25
17329  319. http://www.columbia.edu/kermit/ckermit70.html#x7.26
17330  320. http://www.columbia.edu/kermit/ckermit70.html#x7.26.1
17331  321. http://www.columbia.edu/kermit/ckermit70.html#x7.26.2
17332  322. http://www.columbia.edu/kermit/ckermit70.html#x7.27
17333  323. http://www.columbia.edu/kermit/ckermit70.html#x8
17334  324. http://www.columbia.edu/kermit/ckermit70.html#x9
17335  325. http://www.columbia.edu/kermit/ckermit70.html#x9.0
17336  326. http://www.columbia.edu/kermit/ckermit70.html#x9.1
17337  327. http://www.columbia.edu/kermit/ckermit70.html#x9.2
17338  328. http://www.columbia.edu/kermit/ckermit70.html#x9.3
17339  329. http://www.columbia.edu/kermit/ckermit70.html#x10
17340  330. http://www.columbia.edu/kermit/ckermit70.html#xiii
17341  331. http://www.columbia.edu/kermit/ckermit70.html#xiii.1
17342  332. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.1
17343  333. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2
17344  334. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.1
17345  335. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.2
17346  336. http://www.columbia.edu/kermit/ckermit70.html#xiii.1.2.3
17347  337. http://www.columbia.edu/kermit/ckermit70.html#xiii.2
17348  338. http://www.columbia.edu/kermit/ckermit70.html#xiv
17349  339. http://www.columbia.edu/kermit/ckermit70.html#xv
17350  340. http://www.columbia.edu/kermit/ckb2.htm
17351  341. http://www.columbia.edu/kermit/ckbreviews.html
17352  342. http://www.bhusa.com/
17353  343. http://www.columbia.edu/kermit/manuals.html#ckde
17354  344. http://www.columbia.edu/kermit/manuals.html#ktb
17355  345. http://www.columbia.edu/kermit/news.html
17356  346. news:comp.protocols.kermit.announce
17357  347. news:comp.protocols.kermit.misc
17358  348. http://www.columbia.edu/kermit/ckb2.htm
17359  349. http://www.columbia.edu/kermit/ckermit70.html#x4
17360  350. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17361  351. http://www.columbia.edu/kermit/ckermit70.html#x4.23
17362  352. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17363  353. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17364  354. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17365  355. http://www.columbia.edu/kermit/ckermit70.html#x4.9.
17366  356. http://www.columbia.edu/kermit/ckb2.htm
17367  357. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
17368  358. http://www.columbia.edu/kermit/ckermit70.html#x2.15
17369  359. http://www.columbia.edu/kermit/ckermit70.html#x9.1
17370  360. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17371  361. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17372  362. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17373  363. http://www.columbia.edu/kermit/ckermit70.html#mjd
17374  364. http://www.columbia.edu/kermit/ckermit70.html#mjd
17375  365. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17376  366. http://www.columbia.edu/kermit/ckb2.htm
17377  367. http://www.columbia.edu/kermit/ckb2.htm
17378  368. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17379  369. http://www.columbia.edu/kermit/ckermit70.html#x2.12
17380  370. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17381  371. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17382  372. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5
17383  373. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17384  374. http://www.columbia.edu/kermit/ckermit70.html#x7.18
17385  375. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17386  376. http://www.columbia.edu/kermit/ckermit70.html#x1.15
17387  377. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17388  378. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17389  379. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17390  380. http://www.columbia.edu/kermit/ckermit70.html#x7.1
17391  381. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17392  382. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
17393  383. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
17394  384. http://www.columbia.edu/kermit/ckermit70.html#x1.22.4
17395  385. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
17396  386. http://www.columbia.edu/kermit/ckb2.htm
17397  387. http://www.columbia.edu/kermit/ckermit70.html#x1.22.5
17398  388. http://www.columbia.edu/kermit/ckermit70.html#x7.12
17399  389. http://www.columbia.edu/kermit/ckermit70.html#x2.1.16
17400  390. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17401  391. http://www.columbia.edu/kermit/ckermit70.html#x2.3.5
17402  392. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17403  393. http://www.telefonica.es/cambiodenumeracion/
17404  394. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17405  395. http://www.columbia.edu/kermit/ckb2.htm
17406  396. http://www.columbia.edu/kermit/ckermit70.html#x2.2.2
17407  397. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
17408  398. http://www.columbia.edu/kermit/ckermit70.html#x2.1.13
17409  399. http://www.columbia.edu/kermit/ckermit70.html#x2.1.12
17410  400. http://www.columbia.edu/kermit/ckb2.htm
17411  401. http://www.columbia.edu/kermit/ckermit70.html#x2.1.1
17412  402. http://www.columbia.edu/kermit/ckb2.htm
17413  403. http://www.columbia.edu/kermit/ckb2.htm
17414  404. http://www.columbia.edu/kermit/ckermit70.html#x2.1.7
17415  405. http://www.columbia.edu/kermit/ckermit70.html#x2.1.6
17416  406. http://www.columbia.edu/kermit/ckb2.htm
17417  407. ftp://kermit.columbia.edu/kermit/f/telnet.txt
17418  408. http://www.columbia.edu/kermit/telnet.htm
17419  409. ftp://kermit.columbia.edu/kermit/f/telnet.txt
17420  410. http://www.columbia.edu/kermit/telnet.htm
17421  411. ftp://ftp.isi.edu/in-notes/rfc1572.txt
17422  412. ftp://ftp.isi.edu/in-notes/rfc779.txt
17423  413. http://www.columbia.edu/kermit/ckb2.htm
17424  414. http://www.columbia.edu/kermit/ckermit70.html#x2.10
17425  415. http://www.columbia.edu/kermit/ckermit70.html#x2.8
17426  416. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17427  417. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17428  418. http://www.psy.uq.oz.au/~ftp/Crypto/
17429  419. http://www.columbia.edu/kermit/security.htm
17430  420. http://srp.stanford.edu/srp/
17431  421. http://www.columbia.edu/kermit/ckermit70.html#x2.7.1,
17432  422. ftp://kermit.columbia.edu/kermit/f/ckccfg.txt
17433  423. http://www.columbia.edu/kermit/security.htm
17434  424. http://www.columbia.edu/kermit/ckb2.htm
17435  425. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17436  426. http://www.columbia.edu/kermit/ckermit70.html#x2.0
17437  427. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
17438  428. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17439  429. ftp://kermit.columbia.edu/kermit/f/ckuins.txt
17440  430. http://www.columbia.edu/kermit/iksd.html#x4.2
17441  431. http://www.columbia.edu/kermit/iksd.html
17442  432. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.1
17443  433. ftp://ftp.isi.edu/in-notes/rfc1945.txt
17444  434. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17445  435. http://www.columbia.edu/kermit/ckermit70.html#x3.2
17446  436. http://www.columbia.edu/kermit/ckermit70.html#x3.2
17447  437. http://www.columbia.edu/kermit/ckb2.htm
17448  438. http://www.columbia.edu/kermit/ckb2.htm
17449  439. http://www.columbia.edu/kermit/ckermit70.html#x5.4
17450  440. ftp://kermit.columbia.edu/kermit/f/ckubwr.txt
17451  441. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17452  442. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17453  443. http://www.columbia.edu/kermit/ckermit70.html#x4.7.3
17454  444. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17455  445. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17456  446. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17457  447. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17458  448. http://www.columbia.edu/kermit/ckermit70.html#x4.2.4
17459  449. http://www.columbia.edu/kermit/ckermit70.html#x4.7
17460  450. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
17461  451. http://www.columbia.edu/kermit/ckermit70.html#x4.2.1.3
17462  452. http://www.columbia.edu/kermit/ckb2.htm
17463  453. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17464  454. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17465  455. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.2
17466  456. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17467  457. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17468  458. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17469  459. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17470  460. http://www.telstra.com.au/docs/PGP/
17471  461. http://www.telstra.com.au/docs/PGP/pgpdoc2/pgpdoc2_17.html
17472  462. http://www.columbia.edu/kermit/security.htm
17473  463. http://www.columbia.edu/kermit/ckermit70.html#x2.7
17474  464. http://www.columbia.edu/kermit/ckb2.htm
17475  465. http://www.columbia.edu/kermit/ckermit70.html#x2.14
17476  466. http://www.columbia.edu/kermit/ckermit70.html#x1.23
17477  467. http://www.columbia.edu/kermit/ckermit70.html#x4.7
17478  468. http://www.columbia.edu/kermit/ckb2.htm
17479  469. http://www.columbia.edu/kermit/ckb2.htm
17480  470. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17481  471. http://www.columbia.edu/kermit/ckb2.htm
17482  472. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17483  473. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17484  474. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
17485  475. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17486  476. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17487  477. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17488  478. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17489  479. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17490  480. http://www.columbia.edu/kermit/ckermit70.html#x1.5.5
17491  481. http://www.columbia.edu/kermit/ckb2.htm
17492  482. http://www.columbia.edu/kermit/ckb2.htm
17493  483. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17494  484. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17495  485. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17496  486. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
17497  487. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17498  488. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17499  489. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17500  490. http://www.columbia.edu/kermit/ckermit70.html#x1.5.4
17501  491. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17502  492. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
17503  493. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17504  494. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17505  495. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17506  496. http://www.columbia.edu/kermit/ckb2.htm
17507  497. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17508  498. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17509  499. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17510  500. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17511  501. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17512  502. http://www.columbia.edu/kermit/ckermit70.html#x4.2.2
17513  503. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17514  504. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17515  505. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17516  506. http://www.columbia.edu/kermit/ckermit70.html#x1.11.5
17517  507. http://www.columbia.edu/kermit/ckermit70.html#x4.0.6
17518  508. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17519  509. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17520  510. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17521  511. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17522  512. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17523  513. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17524  514. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17525  515. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17526  516. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
17527  517. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17528  518. http://www.columbia.edu/kermit/ckb2.htm
17529  519. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17530  520. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17531  521. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17532  522. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17533  523. http://www.columbia.edu/kermit/ckermit70.html#x4.15
17534  524. http://www.columbia.edu/kermit/ckermit70.html#x4.18
17535  525. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17536  526. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17537  527. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17538  528. http://www.columbia.edu/kermit/ckermit70.html#x4.19
17539  529. http://www.columbia.edu/kermit/ckermit70.html#x4.16
17540  530. http://www.columbia.edu/kermit/ckermit70.html#x4.19
17541  531. http://www.columbia.edu/kermit/ckermit70.html#x4.20.2.3
17542  532. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17543  533. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.4
17544  534. http://www.columbia.edu/kermit/ckermit70.html#x4.22.2
17545  535. http://www.columbia.edu/kermit/ckermit70.html#x4.22.3
17546  536. http://www.columbia.edu/kermit/ckb2.htm
17547  537. http://www.columbia.edu/kermit/ckb2.htm
17548  538. http://www.columbia.edu/kermit/ckermit70.html#x9.3
17549  539. http://www.columbia.edu/kermit/ckermit70.html#x5.2.1
17550  540. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17551  541. http://www.columbia.edu/kermit/ckermit70.html#x4.5.2
17552  542. http://www.columbia.edu/kermit/ckermit70.html#x6.6
17553  543. http://www.columbia.edu/kermit/ckermit70.html#xiii
17554  544. http://www.columbia.edu/kermit/ckermit70.html#xiii
17555  545. ftp://ftp.isi.edu/in-notes/rfc1489.txt
17556  546. ftp://ftp.isi.edu/in-notes/rfc2319.txt
17557  547. http://www.unicode.org/
17558  548. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17559  549. http://www.columbia.edu/kermit/ckermit70.html#x6.6.5.1
17560  550. ftp://ftp.isi.edu/in-notes/rfc2640.txt
17561  551. http://www.columbia.edu/kermit/ckermit70.html#x6.6.2
17562  552. http://www.columbia.edu/kermit/ckermit70.html#x6.0
17563  553. http://www.columbia.edu/kermit/ckermit70.html#x6.5
17564  554. http://www.columbia.edu/kermit/ckermit70.html#x6.4
17565  555. http://www.columbia.edu/kermit/ckb2.htm
17566  556. http://www.columbia.edu/kermit/ckermit70.html#x4.21
17567  557. http://www.columbia.edu/kermit/ckermit70.html#x6.5
17568  558. http://www.columbia.edu/kermit/ckermit70.html#x2.8
17569  559. http://www.columbia.edu/kermit/ckermit70.html#x7.7
17570  560. http://www.columbia.edu/kermit/ckermit70.html#x7.2
17571  561. http://www.columbia.edu/kermit/ckermit70.html#x1.19
17572  562. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17573  563. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17574  564. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17575  565. http://www.columbia.edu/kermit/ckermit70.html#x4.1
17576  566. http://www.columbia.edu/kermit/ckermit70.html#x4.2
17577  567. http://www.columbia.edu/kermit/ckermit70.html#x2.1.11
17578  568. http://www.columbia.edu/kermit/ckermit70.html#x2.10
17579  569. http://www.columbia.edu/kermit/ckermit70.html#ferrstring
17580  570. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
17581  571. http://www.columbia.edu/kermit/ckermit70.html#x2.1.10
17582  572. http://www.columbia.edu/kermit/ckermit70.html#x9.1
17583  573. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17584  574. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17585  575. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17586  576. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17587  577. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17588  578. http://www.columbia.edu/kermit/ckermit70.html#x7.24
17589  579. http://www.columbia.edu/kermit/ckermit70.html#x7.24
17590  580. http://www.columbia.edu/kermit/ckermit70.html#x4.2.3
17591  581. http://www.columbia.edu/kermit/ck90.html
17592  582. http://www.columbia.edu/kermit/ckermit70.html#x7.12
17593  583. http://www.columbia.edu/kermit/ckermit70.html#x7.9
17594  584. http://www.columbia.edu/kermit/ckb2.htm
17595  585. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17596  586. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17597  587. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17598  588. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17599  589. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17600  590. http://www.columbia.edu/kermit/ckermit70.html#x4.2.8.4
17601  591. http://www.columbia.edu/kermit/ckermit70.html#x4.2.5
17602  592. http://www.columbia.edu/kermit/ckermit70.html#x7.8
17603  593. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17604  594. http://www.columbia.edu/kermit/ckb2.htm
17605  595. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17606  596. http://www.columbia.edu/kermit/ckermit70.html#x7.16
17607  597. http://www.columbia.edu/kermit/ckermit70.html#x7.9.1
17608  598. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17609  599. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17610  600. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17611  601. http://www.columbia.edu/kermit/ckermit70.html#x4.5.1
17612  602. http://www.columbia.edu/kermit/ckermit70.html#x7.10
17613  603. http://www.columbia.edu/kermit/ckermit70.html#x7.10.10
17614  604. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17615  605. http://www.columbia.edu/kermit/ckermit70.html#x7.23
17616  606. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17617  607. http://www.columbia.edu/kermit/ckermit70.html#x7.10.7
17618  608. http://www.columbia.edu/kermit/ckermit70.html#x4.11.3
17619  609. http://www.columbia.edu/kermit/ckermit70.html#x7.10.11
17620  610. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17621  611. http://www.columbia.edu/kermit/ckermit70.html#x7.10.3
17622  612. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17623  613. http://www.columbia.edu/kermit/ckermit70.html#x7.9.2
17624  614. http://www.columbia.edu/kermit/ckb2.htm
17625  615. http://www.columbia.edu/kermit/ckermit70.html#x4.17.2
17626  616. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17627  617. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17628  618. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17629  619. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17630  620. http://www.columbia.edu/kermit/ckermit70.html#x4.9
17631  621. http://www.columbia.edu/kermit/ckermit70.html#x1.22
17632  622. http://www.columbia.edu/kermit/ckermit70.html#x1.6
17633  623. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17634  624. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17635  625. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17636  626. http://www.columbia.edu/kermit/ckermit70.html#x4.9.1
17637  627. http://www.columbia.edu/kermit/ckermit70.html#x9.3
17638  628. http://www.columbia.edu/kermit/ckermit70.html#x7.5
17639  629. http://www.columbia.edu/kermit/ckb2.htm
17640  630. http://www.columbia.edu/kermit/ckermit80.html
17641  631. http://www.columbia.edu/kermit/ckermit70.html#x7.4
17642  632. http://www.columbia.edu/kermit/ckermit70.html#x7.20.2
17643  633. http://www.columbia.edu/kermit/ckermit70.html#x7.10.5
17644  634. http://www.columbia.edu/kermit/ckermit70.html#x7.10.9
17645  635. http://www.columbia.edu/kermit/ckermit70.html#x1.10
17646  636. http://www.columbia.edu/kermit/ckermit70.html#x1.5
17647  637. http://www.columbia.edu/kermit/ckermit70.html#x4.7.1
17648  638. http://www.columbia.edu/kermit/iksd.html
17649  639. http://www.columbia.edu/kermit/ckermit70.html#x7.19
17650  640. http://www.columbia.edu/kermit/ckermit70.html#x4.10
17651  641. http://www.columbia.edu/kermit/ckermit70.html#x4.11
17652  642. http://www.columbia.edu/kermit/ckermit70.html#x4.3
17653  643. http://www.columbia.edu/kermit/gkermit.html
17654  644. http://www.columbia.edu/kermit/ckermit70.html#x4.20
17655  645. http://www.columbia.edu/kermit/gkermit.html
17656  646. http://www.columbia.edu/kermit/ckb2.htm
17657  647. http://www.columbia.edu/kermit/ckermit70.html#x7.3
17658  648. mailto:kermit@columbia.edu
17659  649. http://www.columbia.edu/kermit/ckermit70.html#top
17660  650. http://www.columbia.edu/kermit/ckermit.html
17661  651. http://www.columbia.edu/kermit/index.html